From bb6fb6dfcc17cddac11ac295861f7608194447a7 Mon Sep 17 00:00:00 2001 From: James Hogan Date: Tue, 24 Oct 2017 13:07:54 +0100 Subject: [PATCH 01/74] metag: Remove arch/metag/ The earliest Meta architecture port of Linux I have a record of was an import of a Meta port of Linux v2.4.1 in February 2004, which was worked on significantly over the next few years by Graham Whaley, Will Newton, Matt Fleming, myself and others. Eventually the port was merged into mainline in v3.9 in March 2013, not long after Imagination Technologies bought MIPS Technologies and shifted its CPU focus over to the MIPS architecture. As a result, though the port was maintained for a while, kept on life support for a while longer, and useful for testing a few specific drivers for which I don't have ready access to the equivalent MIPS hardware, it is now essentially dead with no users. It is also stuck using an out-of-tree toolchain based on GCC 4.2.4 which is no longer maintained, now struggles to build modern kernels due to toolchain bugs, and doesn't itself build with a modern GCC. The latest buildroot port is still using an old uClibc snapshot which is no longer served, and the latest uClibc doesn't build with GCC 4.2.4. So lets call it a day and drop the Meta architecture port from the kernel. RIP Meta. Signed-off-by: James Hogan Link: https://lkml.kernel.org/r/95906b76-6ce1-3f84-eaba-c29b4ae952eb@roeck-us.net Reviewed-by: Guenter Roeck Acked-by: Peter Zijlstra (Intel) Acked-by: Graham Whaley Cc: linux-metag@vger.kernel.org --- arch/metag/Kconfig | 287 ----- arch/metag/Kconfig.debug | 34 - arch/metag/Kconfig.soc | 69 -- arch/metag/Makefile | 89 -- arch/metag/boot/.gitignore | 3 - arch/metag/boot/Makefile | 68 -- arch/metag/boot/dts/Makefile | 16 - arch/metag/boot/dts/skeleton.dts | 10 - arch/metag/boot/dts/skeleton.dtsi | 15 - arch/metag/boot/dts/tz1090.dtsi | 108 -- arch/metag/boot/dts/tz1090_generic.dts | 10 - arch/metag/configs/meta1_defconfig | 39 - arch/metag/configs/meta2_defconfig | 40 - arch/metag/configs/meta2_smp_defconfig | 41 - arch/metag/configs/tz1090_defconfig | 42 - arch/metag/include/asm/Kbuild | 33 - arch/metag/include/asm/atomic.h | 49 - arch/metag/include/asm/atomic_lnkget.h | 204 ---- arch/metag/include/asm/atomic_lock1.h | 157 --- arch/metag/include/asm/barrier.h | 85 -- arch/metag/include/asm/bitops.h | 127 -- arch/metag/include/asm/bug.h | 13 - arch/metag/include/asm/cache.h | 24 - arch/metag/include/asm/cacheflush.h | 251 ---- arch/metag/include/asm/cachepart.h | 43 - arch/metag/include/asm/checksum.h | 93 -- arch/metag/include/asm/clock.h | 59 - arch/metag/include/asm/cmpxchg.h | 64 - arch/metag/include/asm/cmpxchg_irq.h | 43 - arch/metag/include/asm/cmpxchg_lnkget.h | 87 -- arch/metag/include/asm/cmpxchg_lock1.h | 49 - arch/metag/include/asm/core_reg.h | 36 - arch/metag/include/asm/cpu.h | 15 - arch/metag/include/asm/da.h | 44 - arch/metag/include/asm/delay.h | 30 - arch/metag/include/asm/div64.h | 13 - arch/metag/include/asm/dma-mapping.h | 12 - arch/metag/include/asm/elf.h | 126 -- arch/metag/include/asm/fixmap.h | 69 -- arch/metag/include/asm/ftrace.h | 24 - arch/metag/include/asm/global_lock.h | 101 -- arch/metag/include/asm/highmem.h | 62 - arch/metag/include/asm/hugetlb.h | 75 -- arch/metag/include/asm/hwthread.h | 41 - arch/metag/include/asm/io.h | 170 --- arch/metag/include/asm/irq.h | 38 - arch/metag/include/asm/irqflags.h | 94 -- arch/metag/include/asm/l2cache.h | 259 ---- arch/metag/include/asm/linkage.h | 8 - arch/metag/include/asm/mach/arch.h | 86 -- arch/metag/include/asm/metag_isa.h | 81 -- arch/metag/include/asm/metag_mem.h | 1109 ----------------- arch/metag/include/asm/metag_regs.h | 1184 ------------------ arch/metag/include/asm/mman.h | 12 - arch/metag/include/asm/mmu.h | 78 -- arch/metag/include/asm/mmu_context.h | 115 -- arch/metag/include/asm/mmzone.h | 43 - arch/metag/include/asm/module.h | 38 - arch/metag/include/asm/page.h | 129 -- arch/metag/include/asm/perf_event.h | 4 - arch/metag/include/asm/pgalloc.h | 83 -- arch/metag/include/asm/pgtable-bits.h | 105 -- arch/metag/include/asm/pgtable.h | 270 ---- arch/metag/include/asm/processor.h | 201 --- arch/metag/include/asm/ptrace.h | 61 - arch/metag/include/asm/setup.h | 10 - arch/metag/include/asm/smp.h | 28 - arch/metag/include/asm/sparsemem.h | 14 - arch/metag/include/asm/spinlock.h | 19 - arch/metag/include/asm/spinlock_lnkget.h | 213 ---- arch/metag/include/asm/spinlock_lock1.h | 165 --- arch/metag/include/asm/spinlock_types.h | 21 - arch/metag/include/asm/stacktrace.h | 21 - arch/metag/include/asm/string.h | 14 - arch/metag/include/asm/switch.h | 21 - arch/metag/include/asm/syscall.h | 104 -- arch/metag/include/asm/syscalls.h | 40 - arch/metag/include/asm/tbx.h | 1420 ---------------------- arch/metag/include/asm/tcm.h | 31 - arch/metag/include/asm/thread_info.h | 141 --- arch/metag/include/asm/tlb.h | 37 - arch/metag/include/asm/tlbflush.h | 78 -- arch/metag/include/asm/topology.h | 28 - arch/metag/include/asm/traps.h | 48 - arch/metag/include/asm/uaccess.h | 213 ---- arch/metag/include/asm/unistd.h | 12 - arch/metag/include/asm/user_gateway.h | 45 - arch/metag/include/uapi/asm/Kbuild | 31 - arch/metag/include/uapi/asm/byteorder.h | 2 - arch/metag/include/uapi/asm/ech.h | 16 - arch/metag/include/uapi/asm/ptrace.h | 114 -- arch/metag/include/uapi/asm/sigcontext.h | 32 - arch/metag/include/uapi/asm/siginfo.h | 16 - arch/metag/include/uapi/asm/swab.h | 27 - arch/metag/include/uapi/asm/unistd.h | 24 - arch/metag/kernel/.gitignore | 1 - arch/metag/kernel/Makefile | 40 - arch/metag/kernel/asm-offsets.c | 15 - arch/metag/kernel/cachepart.c | 132 -- arch/metag/kernel/clock.c | 110 -- arch/metag/kernel/core_reg.c | 118 -- arch/metag/kernel/da.c | 25 - arch/metag/kernel/devtree.c | 57 - arch/metag/kernel/dma.c | 588 --------- arch/metag/kernel/ftrace.c | 121 -- arch/metag/kernel/ftrace_stub.S | 62 - arch/metag/kernel/head.S | 66 - arch/metag/kernel/irq.c | 293 ----- arch/metag/kernel/kick.c | 110 -- arch/metag/kernel/machines.c | 21 - arch/metag/kernel/metag_ksyms.c | 55 - arch/metag/kernel/module.c | 284 ----- arch/metag/kernel/perf/Makefile | 3 - arch/metag/kernel/perf/perf_event.c | 879 ------------- arch/metag/kernel/perf/perf_event.h | 106 -- arch/metag/kernel/perf_callchain.c | 97 -- arch/metag/kernel/process.c | 448 ------- arch/metag/kernel/ptrace.c | 427 ------- arch/metag/kernel/setup.c | 622 ---------- arch/metag/kernel/signal.c | 336 ----- arch/metag/kernel/smp.c | 668 ---------- arch/metag/kernel/stacktrace.c | 187 --- arch/metag/kernel/sys_metag.c | 181 --- arch/metag/kernel/tbiunexp.S | 23 - arch/metag/kernel/tcm.c | 152 --- arch/metag/kernel/time.c | 26 - arch/metag/kernel/topology.c | 78 -- arch/metag/kernel/traps.c | 992 --------------- arch/metag/kernel/user_gateway.S | 98 -- arch/metag/kernel/vmlinux.lds.S | 74 -- arch/metag/lib/Makefile | 23 - arch/metag/lib/ashldi3.S | 34 - arch/metag/lib/ashrdi3.S | 34 - arch/metag/lib/checksum.c | 167 --- arch/metag/lib/clear_page.S | 18 - arch/metag/lib/cmpdi2.S | 33 - arch/metag/lib/copy_page.S | 21 - arch/metag/lib/delay.c | 57 - arch/metag/lib/div64.S | 109 -- arch/metag/lib/divsi3.S | 101 -- arch/metag/lib/ip_fast_csum.S | 33 - arch/metag/lib/lshrdi3.S | 34 - arch/metag/lib/memcpy.S | 186 --- arch/metag/lib/memmove.S | 346 ------ arch/metag/lib/memset.S | 87 -- arch/metag/lib/modsi3.S | 39 - arch/metag/lib/muldi3.S | 45 - arch/metag/lib/ucmpdi2.S | 28 - arch/metag/lib/usercopy.c | 1257 ------------------- arch/metag/mm/Kconfig | 147 --- arch/metag/mm/Makefile | 20 - arch/metag/mm/cache.c | 521 -------- arch/metag/mm/extable.c | 15 - arch/metag/mm/fault.c | 247 ---- arch/metag/mm/highmem.c | 122 -- arch/metag/mm/hugetlbpage.c | 251 ---- arch/metag/mm/init.c | 408 ------- arch/metag/mm/ioremap.c | 90 -- arch/metag/mm/l2cache.c | 193 --- arch/metag/mm/maccess.c | 69 -- arch/metag/mm/mmu-meta1.c | 157 --- arch/metag/mm/mmu-meta2.c | 208 ---- arch/metag/mm/numa.c | 82 -- arch/metag/oprofile/Makefile | 18 - arch/metag/oprofile/backtrace.c | 63 - arch/metag/oprofile/backtrace.h | 7 - arch/metag/oprofile/common.c | 66 - arch/metag/tbx/Makefile | 22 - arch/metag/tbx/tbicore.S | 136 --- arch/metag/tbx/tbictx.S | 366 ------ arch/metag/tbx/tbictxfpu.S | 190 --- arch/metag/tbx/tbidefr.S | 175 --- arch/metag/tbx/tbidspram.S | 161 --- arch/metag/tbx/tbilogf.S | 48 - arch/metag/tbx/tbipcx.S | 451 ------- arch/metag/tbx/tbiroot.S | 87 -- arch/metag/tbx/tbisoft.S | 237 ---- arch/metag/tbx/tbistring.c | 114 -- arch/metag/tbx/tbitimer.S | 207 ---- 179 files changed, 25078 deletions(-) delete mode 100644 arch/metag/Kconfig delete mode 100644 arch/metag/Kconfig.debug delete mode 100644 arch/metag/Kconfig.soc delete mode 100644 arch/metag/Makefile delete mode 100644 arch/metag/boot/.gitignore delete mode 100644 arch/metag/boot/Makefile delete mode 100644 arch/metag/boot/dts/Makefile delete mode 100644 arch/metag/boot/dts/skeleton.dts delete mode 100644 arch/metag/boot/dts/skeleton.dtsi delete mode 100644 arch/metag/boot/dts/tz1090.dtsi delete mode 100644 arch/metag/boot/dts/tz1090_generic.dts delete mode 100644 arch/metag/configs/meta1_defconfig delete mode 100644 arch/metag/configs/meta2_defconfig delete mode 100644 arch/metag/configs/meta2_smp_defconfig delete mode 100644 arch/metag/configs/tz1090_defconfig delete mode 100644 arch/metag/include/asm/Kbuild delete mode 100644 arch/metag/include/asm/atomic.h delete mode 100644 arch/metag/include/asm/atomic_lnkget.h delete mode 100644 arch/metag/include/asm/atomic_lock1.h delete mode 100644 arch/metag/include/asm/barrier.h delete mode 100644 arch/metag/include/asm/bitops.h delete mode 100644 arch/metag/include/asm/bug.h delete mode 100644 arch/metag/include/asm/cache.h delete mode 100644 arch/metag/include/asm/cacheflush.h delete mode 100644 arch/metag/include/asm/cachepart.h delete mode 100644 arch/metag/include/asm/checksum.h delete mode 100644 arch/metag/include/asm/clock.h delete mode 100644 arch/metag/include/asm/cmpxchg.h delete mode 100644 arch/metag/include/asm/cmpxchg_irq.h delete mode 100644 arch/metag/include/asm/cmpxchg_lnkget.h delete mode 100644 arch/metag/include/asm/cmpxchg_lock1.h delete mode 100644 arch/metag/include/asm/core_reg.h delete mode 100644 arch/metag/include/asm/cpu.h delete mode 100644 arch/metag/include/asm/da.h delete mode 100644 arch/metag/include/asm/delay.h delete mode 100644 arch/metag/include/asm/div64.h delete mode 100644 arch/metag/include/asm/dma-mapping.h delete mode 100644 arch/metag/include/asm/elf.h delete mode 100644 arch/metag/include/asm/fixmap.h delete mode 100644 arch/metag/include/asm/ftrace.h delete mode 100644 arch/metag/include/asm/global_lock.h delete mode 100644 arch/metag/include/asm/highmem.h delete mode 100644 arch/metag/include/asm/hugetlb.h delete mode 100644 arch/metag/include/asm/hwthread.h delete mode 100644 arch/metag/include/asm/io.h delete mode 100644 arch/metag/include/asm/irq.h delete mode 100644 arch/metag/include/asm/irqflags.h delete mode 100644 arch/metag/include/asm/l2cache.h delete mode 100644 arch/metag/include/asm/linkage.h delete mode 100644 arch/metag/include/asm/mach/arch.h delete mode 100644 arch/metag/include/asm/metag_isa.h delete mode 100644 arch/metag/include/asm/metag_mem.h delete mode 100644 arch/metag/include/asm/metag_regs.h delete mode 100644 arch/metag/include/asm/mman.h delete mode 100644 arch/metag/include/asm/mmu.h delete mode 100644 arch/metag/include/asm/mmu_context.h delete mode 100644 arch/metag/include/asm/mmzone.h delete mode 100644 arch/metag/include/asm/module.h delete mode 100644 arch/metag/include/asm/page.h delete mode 100644 arch/metag/include/asm/perf_event.h delete mode 100644 arch/metag/include/asm/pgalloc.h delete mode 100644 arch/metag/include/asm/pgtable-bits.h delete mode 100644 arch/metag/include/asm/pgtable.h delete mode 100644 arch/metag/include/asm/processor.h delete mode 100644 arch/metag/include/asm/ptrace.h delete mode 100644 arch/metag/include/asm/setup.h delete mode 100644 arch/metag/include/asm/smp.h delete mode 100644 arch/metag/include/asm/sparsemem.h delete mode 100644 arch/metag/include/asm/spinlock.h delete mode 100644 arch/metag/include/asm/spinlock_lnkget.h delete mode 100644 arch/metag/include/asm/spinlock_lock1.h delete mode 100644 arch/metag/include/asm/spinlock_types.h delete mode 100644 arch/metag/include/asm/stacktrace.h delete mode 100644 arch/metag/include/asm/string.h delete mode 100644 arch/metag/include/asm/switch.h delete mode 100644 arch/metag/include/asm/syscall.h delete mode 100644 arch/metag/include/asm/syscalls.h delete mode 100644 arch/metag/include/asm/tbx.h delete mode 100644 arch/metag/include/asm/tcm.h delete mode 100644 arch/metag/include/asm/thread_info.h delete mode 100644 arch/metag/include/asm/tlb.h delete mode 100644 arch/metag/include/asm/tlbflush.h delete mode 100644 arch/metag/include/asm/topology.h delete mode 100644 arch/metag/include/asm/traps.h delete mode 100644 arch/metag/include/asm/uaccess.h delete mode 100644 arch/metag/include/asm/unistd.h delete mode 100644 arch/metag/include/asm/user_gateway.h delete mode 100644 arch/metag/include/uapi/asm/Kbuild delete mode 100644 arch/metag/include/uapi/asm/byteorder.h delete mode 100644 arch/metag/include/uapi/asm/ech.h delete mode 100644 arch/metag/include/uapi/asm/ptrace.h delete mode 100644 arch/metag/include/uapi/asm/sigcontext.h delete mode 100644 arch/metag/include/uapi/asm/siginfo.h delete mode 100644 arch/metag/include/uapi/asm/swab.h delete mode 100644 arch/metag/include/uapi/asm/unistd.h delete mode 100644 arch/metag/kernel/.gitignore delete mode 100644 arch/metag/kernel/Makefile delete mode 100644 arch/metag/kernel/asm-offsets.c delete mode 100644 arch/metag/kernel/cachepart.c delete mode 100644 arch/metag/kernel/clock.c delete mode 100644 arch/metag/kernel/core_reg.c delete mode 100644 arch/metag/kernel/da.c delete mode 100644 arch/metag/kernel/devtree.c delete mode 100644 arch/metag/kernel/dma.c delete mode 100644 arch/metag/kernel/ftrace.c delete mode 100644 arch/metag/kernel/ftrace_stub.S delete mode 100644 arch/metag/kernel/head.S delete mode 100644 arch/metag/kernel/irq.c delete mode 100644 arch/metag/kernel/kick.c delete mode 100644 arch/metag/kernel/machines.c delete mode 100644 arch/metag/kernel/metag_ksyms.c delete mode 100644 arch/metag/kernel/module.c delete mode 100644 arch/metag/kernel/perf/Makefile delete mode 100644 arch/metag/kernel/perf/perf_event.c delete mode 100644 arch/metag/kernel/perf/perf_event.h delete mode 100644 arch/metag/kernel/perf_callchain.c delete mode 100644 arch/metag/kernel/process.c delete mode 100644 arch/metag/kernel/ptrace.c delete mode 100644 arch/metag/kernel/setup.c delete mode 100644 arch/metag/kernel/signal.c delete mode 100644 arch/metag/kernel/smp.c delete mode 100644 arch/metag/kernel/stacktrace.c delete mode 100644 arch/metag/kernel/sys_metag.c delete mode 100644 arch/metag/kernel/tbiunexp.S delete mode 100644 arch/metag/kernel/tcm.c delete mode 100644 arch/metag/kernel/time.c delete mode 100644 arch/metag/kernel/topology.c delete mode 100644 arch/metag/kernel/traps.c delete mode 100644 arch/metag/kernel/user_gateway.S delete mode 100644 arch/metag/kernel/vmlinux.lds.S delete mode 100644 arch/metag/lib/Makefile delete mode 100644 arch/metag/lib/ashldi3.S delete mode 100644 arch/metag/lib/ashrdi3.S delete mode 100644 arch/metag/lib/checksum.c delete mode 100644 arch/metag/lib/clear_page.S delete mode 100644 arch/metag/lib/cmpdi2.S delete mode 100644 arch/metag/lib/copy_page.S delete mode 100644 arch/metag/lib/delay.c delete mode 100644 arch/metag/lib/div64.S delete mode 100644 arch/metag/lib/divsi3.S delete mode 100644 arch/metag/lib/ip_fast_csum.S delete mode 100644 arch/metag/lib/lshrdi3.S delete mode 100644 arch/metag/lib/memcpy.S delete mode 100644 arch/metag/lib/memmove.S delete mode 100644 arch/metag/lib/memset.S delete mode 100644 arch/metag/lib/modsi3.S delete mode 100644 arch/metag/lib/muldi3.S delete mode 100644 arch/metag/lib/ucmpdi2.S delete mode 100644 arch/metag/lib/usercopy.c delete mode 100644 arch/metag/mm/Kconfig delete mode 100644 arch/metag/mm/Makefile delete mode 100644 arch/metag/mm/cache.c delete mode 100644 arch/metag/mm/extable.c delete mode 100644 arch/metag/mm/fault.c delete mode 100644 arch/metag/mm/highmem.c delete mode 100644 arch/metag/mm/hugetlbpage.c delete mode 100644 arch/metag/mm/init.c delete mode 100644 arch/metag/mm/ioremap.c delete mode 100644 arch/metag/mm/l2cache.c delete mode 100644 arch/metag/mm/maccess.c delete mode 100644 arch/metag/mm/mmu-meta1.c delete mode 100644 arch/metag/mm/mmu-meta2.c delete mode 100644 arch/metag/mm/numa.c delete mode 100644 arch/metag/oprofile/Makefile delete mode 100644 arch/metag/oprofile/backtrace.c delete mode 100644 arch/metag/oprofile/backtrace.h delete mode 100644 arch/metag/oprofile/common.c delete mode 100644 arch/metag/tbx/Makefile delete mode 100644 arch/metag/tbx/tbicore.S delete mode 100644 arch/metag/tbx/tbictx.S delete mode 100644 arch/metag/tbx/tbictxfpu.S delete mode 100644 arch/metag/tbx/tbidefr.S delete mode 100644 arch/metag/tbx/tbidspram.S delete mode 100644 arch/metag/tbx/tbilogf.S delete mode 100644 arch/metag/tbx/tbipcx.S delete mode 100644 arch/metag/tbx/tbiroot.S delete mode 100644 arch/metag/tbx/tbisoft.S delete mode 100644 arch/metag/tbx/tbistring.c delete mode 100644 arch/metag/tbx/tbitimer.S diff --git a/arch/metag/Kconfig b/arch/metag/Kconfig deleted file mode 100644 index c7b62a3395390..0000000000000 --- a/arch/metag/Kconfig +++ /dev/null @@ -1,287 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -config METAG - def_bool y - select EMBEDDED - select GENERIC_ATOMIC64 - select GENERIC_CLOCKEVENTS - select GENERIC_IRQ_SHOW - select GENERIC_SMP_IDLE_THREAD - select HAVE_64BIT_ALIGNED_ACCESS - select HAVE_ARCH_TRACEHOOK - select HAVE_C_RECORDMCOUNT - select HAVE_DEBUG_KMEMLEAK - select HAVE_DEBUG_STACKOVERFLOW - select HAVE_DYNAMIC_FTRACE - select HAVE_EXIT_THREAD - select HAVE_FTRACE_MCOUNT_RECORD - select HAVE_FUNCTION_TRACER - select HAVE_KERNEL_BZIP2 - select HAVE_KERNEL_GZIP - select HAVE_KERNEL_LZO - select HAVE_KERNEL_XZ - select HAVE_MEMBLOCK - select HAVE_MEMBLOCK_NODE_MAP - select HAVE_MOD_ARCH_SPECIFIC - select HAVE_OPROFILE - select HAVE_PERF_EVENTS - select HAVE_SYSCALL_TRACEPOINTS - select HAVE_UNDERSCORE_SYMBOL_PREFIX - select IRQ_DOMAIN - select GENERIC_IRQ_EFFECTIVE_AFF_MASK - select MODULES_USE_ELF_RELA - select OF - select OF_EARLY_FLATTREE - select SPARSE_IRQ - select CPU_NO_EFFICIENT_FFS - -config STACKTRACE_SUPPORT - def_bool y - -config LOCKDEP_SUPPORT - def_bool y - -config RWSEM_GENERIC_SPINLOCK - def_bool y - -config RWSEM_XCHGADD_ALGORITHM - bool - -config GENERIC_HWEIGHT - def_bool y - -config GENERIC_CALIBRATE_DELAY - def_bool y - -config NO_IOPORT_MAP - def_bool y - -source "init/Kconfig" - -source "kernel/Kconfig.freezer" - -menu "Processor type and features" - -config MMU - def_bool y - -config STACK_GROWSUP - def_bool y - -config HOTPLUG_CPU - bool "Enable CPU hotplug support" - depends on SMP - help - Say Y here to allow turning CPUs off and on. CPUs can be - controlled through /sys/devices/system/cpu. - - Say N if you want to disable CPU hotplug. - -config HIGHMEM - bool "High Memory Support" - help - The address space of Meta processors is only 4 Gigabytes large - and it has to accommodate user address space, kernel address - space as well as some memory mapped IO. That means that, if you - have a large amount of physical memory and/or IO, not all of the - memory can be "permanently mapped" by the kernel. The physical - memory that is not permanently mapped is called "high memory". - - Depending on the selected kernel/user memory split, minimum - vmalloc space and actual amount of RAM, you may not need this - option which should result in a slightly faster kernel. - - If unsure, say n. - -source "arch/metag/mm/Kconfig" - -source "arch/metag/Kconfig.soc" - -config METAG_META12 - bool - help - Select this from the SoC config symbol to indicate that it contains a - Meta 1.2 core. - -config METAG_META21 - bool - help - Select this from the SoC config symbol to indicate that it contains a - Meta 2.1 core. - -config SMP - bool "Symmetric multi-processing support" - depends on METAG_META21 && METAG_META21_MMU - help - This enables support for systems with more than one thread running - Linux. If you have a system with only one thread running Linux, - say N. Otherwise, say Y. - -config NR_CPUS - int "Maximum number of CPUs (2-4)" if SMP - range 2 4 if SMP - default "1" if !SMP - default "4" if SMP - -config METAG_SMP_WRITE_REORDERING - bool - help - This attempts to prevent cache-memory incoherence due to external - reordering of writes from different hardware threads when SMP is - enabled. It adds fences (system event 0) to smp_mb and smp_rmb in an - attempt to catch some of the cases, and also before writes to shared - memory in LOCK1 protected atomics and spinlocks. - This will not completely prevent cache incoherency on affected cores. - -config METAG_LNKGET_AROUND_CACHE - bool - depends on METAG_META21 - help - This indicates that the LNKGET/LNKSET instructions go around the - cache, which requires some extra cache flushes when the memory needs - to be accessed by normal GET/SET instructions too. - -choice - prompt "Atomicity primitive" - default METAG_ATOMICITY_LNKGET - help - This option selects the mechanism for performing atomic operations. - -config METAG_ATOMICITY_IRQSOFF - depends on !SMP - bool "irqsoff" - help - This option disables interrupts to achieve atomicity. This mechanism - is not SMP-safe. - -config METAG_ATOMICITY_LNKGET - depends on METAG_META21 - bool "lnkget/lnkset" - help - This option uses the LNKGET and LNKSET instructions to achieve - atomicity. LNKGET/LNKSET are load-link/store-conditional instructions. - Choose this option if your system requires low latency. - -config METAG_ATOMICITY_LOCK1 - depends on SMP - bool "lock1" - help - This option uses the LOCK1 instruction for atomicity. This is mainly - provided as a debugging aid if the lnkget/lnkset atomicity primitive - isn't working properly. - -endchoice - -config METAG_FPU - bool "FPU Support" - depends on METAG_META21 - default y - help - This option allows processes to use FPU hardware available with this - CPU. If this option is not enabled FPU registers will not be saved - and restored on context-switch. - - If you plan on running programs which are compiled to use hard floats - say Y here. - -config METAG_DSP - bool "DSP Support" - help - This option allows processes to use DSP hardware available - with this CPU. If this option is not enabled DSP registers - will not be saved and restored on context-switch. - - If you plan on running DSP programs say Y here. - -config METAG_PERFCOUNTER_IRQS - bool "PerfCounters interrupt support" - depends on METAG_META21 - help - This option enables using interrupts to collect information from - Performance Counters. This option is supported in new META21 - (starting from HTP265). - - When disabled, Performance Counters information will be collected - based on Timer Interrupt. - -config HW_PERF_EVENTS - def_bool METAG_PERFCOUNTER_IRQS && PERF_EVENTS - -config METAG_DA - bool "DA support" - help - Say Y if you plan to use a DA debug adapter with Linux. The presence - of the DA will be detected automatically at boot, so it is safe to say - Y to this option even when booting without a DA. - - This enables support for services provided by DA JTAG debug adapters, - such as: - - communication over DA channels (such as the console driver). - - use of the DA filesystem. - -menu "Boot options" - -config METAG_BUILTIN_DTB - bool "Embed DTB in kernel image" - default y - help - Embeds a device tree binary in the kernel image. - -config METAG_BUILTIN_DTB_NAME - string "Built in DTB" - depends on METAG_BUILTIN_DTB - help - Set the name of the DTB to embed (leave blank to pick one - automatically based on kernel configuration). - -config CMDLINE_BOOL - bool "Default bootloader kernel arguments" - -config CMDLINE - string "Kernel command line" - depends on CMDLINE_BOOL - help - On some architectures there is currently no way for the boot loader - to pass arguments to the kernel. For these architectures, you should - supply some command-line options at build time by entering them - here. - -config CMDLINE_FORCE - bool "Force default kernel command string" - depends on CMDLINE_BOOL - help - Set this to have arguments from the default kernel command string - override those passed by the boot loader. - -endmenu - -source "kernel/Kconfig.preempt" - -source kernel/Kconfig.hz - -endmenu - -menu "Power management options" - -source kernel/power/Kconfig - -endmenu - -menu "Executable file formats" - -source "fs/Kconfig.binfmt" - -endmenu - -source "net/Kconfig" - -source "drivers/Kconfig" - -source "fs/Kconfig" - -source "arch/metag/Kconfig.debug" - -source "security/Kconfig" - -source "crypto/Kconfig" - -source "lib/Kconfig" diff --git a/arch/metag/Kconfig.debug b/arch/metag/Kconfig.debug deleted file mode 100644 index ac4516c605db4..0000000000000 --- a/arch/metag/Kconfig.debug +++ /dev/null @@ -1,34 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -menu "Kernel hacking" - -config TRACE_IRQFLAGS_SUPPORT - bool - default y - -source "lib/Kconfig.debug" - -config 4KSTACKS - bool "Use 4Kb for kernel stacks instead of 8Kb" - depends on DEBUG_KERNEL - help - If you say Y here the kernel will use a 4Kb stacksize for the - kernel stack attached to each process/thread. This facilitates - running more threads on a system and also reduces the pressure - on the VM subsystem for higher order allocations. This option - will also use IRQ stacks to compensate for the reduced stackspace. - -config METAG_FUNCTION_TRACE - bool "Output Meta real-time trace data for function entry/exit" - help - If you say Y here the kernel will use the Meta hardware trace - unit to output information about function entry and exit that - can be used by a debugger for profiling and call-graphs. - -config METAG_POISON_CATCH_BUFFERS - bool "Poison catch buffer contents on kernel entry" - help - If you say Y here the kernel will write poison data to the - catch buffer registers on kernel entry. This will make any - problem with catch buffer handling much more apparent. - -endmenu diff --git a/arch/metag/Kconfig.soc b/arch/metag/Kconfig.soc deleted file mode 100644 index c521f0e00d8ef..0000000000000 --- a/arch/metag/Kconfig.soc +++ /dev/null @@ -1,69 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -choice - prompt "SoC Type" - default META21_FPGA - -config META12_FPGA - bool "Meta 1.2 FPGA" - select METAG_META12 - help - This is a Meta 1.2 FPGA bitstream, just a bare CPU. - -config META21_FPGA - bool "Meta 2.1 FPGA" - select METAG_META21 - help - This is a Meta 2.1 FPGA bitstream, just a bare CPU. - -config SOC_TZ1090 - bool "Toumaz Xenif TZ1090 SoC (Comet)" - select IMGPDC_IRQ - select METAG_LNKGET_AROUND_CACHE - select METAG_META21 - select METAG_SMP_WRITE_REORDERING - select PINCTRL - select PINCTRL_TZ1090 - select PINCTRL_TZ1090_PDC - help - This is a Toumaz Technology Xenif TZ1090 (A.K.A. Comet) SoC containing - a 2-threaded HTP. - -endchoice - -menu "SoC configuration" - -if METAG_META21 - -# Meta 2.x specific options - -config METAG_META21_MMU - bool "Meta 2.x MMU mode" - default y - help - Use the Meta 2.x MMU in extended mode. - -config METAG_UNALIGNED - bool "Meta 2.x unaligned access checking" - default y - help - All memory accesses will be checked for alignment and an exception - raised on unaligned accesses. This feature does cost performance - but without it there will be no notification of this type of error. - -config METAG_USER_TCM - bool "Meta on-chip memory support for userland" - select GENERIC_ALLOCATOR - default y - help - Allow the on-chip memories of Meta SoCs to be used by user - applications. - -endif - -config METAG_HALT_ON_PANIC - bool "Halt the core on panic" - help - Halt the core when a panic occurs. This is useful when running - pre-production silicon or in an FPGA environment. - -endmenu diff --git a/arch/metag/Makefile b/arch/metag/Makefile deleted file mode 100644 index 033a582141195..0000000000000 --- a/arch/metag/Makefile +++ /dev/null @@ -1,89 +0,0 @@ -# -# metag/Makefile -# -# This file is included by the global makefile so that you can add your own -# architecture-specific flags and dependencies. Remember to do have actions -# for "archclean" cleaning up for this architecture. -# -# This file is subject to 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) 1994 by Linus Torvalds -# 2007,2008,2012 by Imagination Technologies Ltd. -# - -LDFLAGS := -OBJCOPYFLAGS := -O binary -R .note -R .comment -S - -checkflags-$(CONFIG_METAG_META12) += -DMETAC_1_2 -checkflags-$(CONFIG_METAG_META21) += -DMETAC_2_1 -CHECKFLAGS += -D__metag__ $(checkflags-y) - -KBUILD_DEFCONFIG := tz1090_defconfig - -sflags-$(CONFIG_METAG_META12) += -mmetac=1.2 -ifeq ($(CONFIG_METAG_META12),y) -# Only use TBI API 1.4 if DSP is enabled for META12 cores -sflags-$(CONFIG_METAG_DSP) += -DTBI_1_4 -endif -sflags-$(CONFIG_METAG_META21) += -mmetac=2.1 -DTBI_1_4 - -cflags-$(CONFIG_METAG_FUNCTION_TRACE) += -mhwtrace-leaf -mhwtrace-retpc -cflags-$(CONFIG_METAG_META21) += -mextensions=bex - -KBUILD_CFLAGS += -pipe -KBUILD_CFLAGS += -ffunction-sections - -KBUILD_CFLAGS += $(sflags-y) $(cflags-y) -KBUILD_AFLAGS += $(sflags-y) - -LDFLAGS_vmlinux := $(ldflags-y) - -head-y := arch/metag/kernel/head.o - -core-y += arch/metag/boot/dts/ -core-y += arch/metag/kernel/ -core-y += arch/metag/mm/ - -libs-y += arch/metag/lib/ -libs-y += arch/metag/tbx/ - -drivers-$(CONFIG_OPROFILE) += arch/metag/oprofile/ - -boot := arch/metag/boot - -boot_targets += uImage -boot_targets += uImage.gz -boot_targets += uImage.bz2 -boot_targets += uImage.xz -boot_targets += uImage.lzo -boot_targets += uImage.bin -boot_targets += vmlinux.bin - -PHONY += $(boot_targets) - -all: vmlinux.bin - -$(boot_targets): vmlinux - $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ - -%.dtb %.dtb.S %.dtb.o: scripts - $(Q)$(MAKE) $(build)=$(boot)/dts $(boot)/dts/$@ - -dtbs: scripts - $(Q)$(MAKE) $(build)=$(boot)/dts - -archclean: - $(Q)$(MAKE) $(clean)=$(boot) - -define archhelp - echo '* vmlinux.bin - Binary kernel image (arch/$(ARCH)/boot/vmlinux.bin)' - @echo ' uImage - Alias to bootable U-Boot image' - @echo ' uImage.bin - Kernel-only image for U-Boot (bin)' - @echo ' uImage.gz - Kernel-only image for U-Boot (gzip)' - @echo ' uImage.bz2 - Kernel-only image for U-Boot (bzip2)' - @echo ' uImage.xz - Kernel-only image for U-Boot (xz)' - @echo ' uImage.lzo - Kernel-only image for U-Boot (lzo)' - @echo ' dtbs - Build device tree blobs for enabled boards' -endef diff --git a/arch/metag/boot/.gitignore b/arch/metag/boot/.gitignore deleted file mode 100644 index 6c662ddb909aa..0000000000000 --- a/arch/metag/boot/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -vmlinux* -uImage* -ramdisk.* diff --git a/arch/metag/boot/Makefile b/arch/metag/boot/Makefile deleted file mode 100644 index 5a1f88cf91e33..0000000000000 --- a/arch/metag/boot/Makefile +++ /dev/null @@ -1,68 +0,0 @@ -# -# This file is subject to 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,2012 Imagination Technologies Ltd. -# - -suffix-y := bin -suffix-$(CONFIG_KERNEL_GZIP) := gz -suffix-$(CONFIG_KERNEL_BZIP2) := bz2 -suffix-$(CONFIG_KERNEL_XZ) := xz -suffix-$(CONFIG_KERNEL_LZO) := lzo - -targets += vmlinux.bin -targets += uImage -targets += uImage.gz -targets += uImage.bz2 -targets += uImage.xz -targets += uImage.lzo -targets += uImage.bin - -extra-y += vmlinux.bin -extra-y += vmlinux.bin.gz -extra-y += vmlinux.bin.bz2 -extra-y += vmlinux.bin.xz -extra-y += vmlinux.bin.lzo - -UIMAGE_LOADADDR = $(CONFIG_PAGE_OFFSET) - -ifeq ($(CONFIG_FUNCTION_TRACER),y) -orig_cflags := $(KBUILD_CFLAGS) -KBUILD_CFLAGS = $(subst -pg, , $(orig_cflags)) -endif - -$(obj)/vmlinux.bin: vmlinux FORCE - $(call if_changed,objcopy) - -$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE - $(call if_changed,gzip) - -$(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin FORCE - $(call if_changed,bzip2) - -$(obj)/vmlinux.bin.xz: $(obj)/vmlinux.bin FORCE - $(call if_changed,xzkern) - -$(obj)/vmlinux.bin.lzo: $(obj)/vmlinux.bin FORCE - $(call if_changed,lzo) - -$(obj)/uImage.gz: $(obj)/vmlinux.bin.gz FORCE - $(call if_changed,uimage,gzip) - -$(obj)/uImage.bz2: $(obj)/vmlinux.bin.bz2 FORCE - $(call if_changed,uimage,bzip2) - -$(obj)/uImage.xz: $(obj)/vmlinux.bin.xz FORCE - $(call if_changed,uimage,xz) - -$(obj)/uImage.lzo: $(obj)/vmlinux.bin.lzo FORCE - $(call if_changed,uimage,lzo) - -$(obj)/uImage.bin: $(obj)/vmlinux.bin FORCE - $(call if_changed,uimage,none) - -$(obj)/uImage: $(obj)/uImage.$(suffix-y) - @ln -sf $(notdir $<) $@ - @echo ' Image $@ is ready' diff --git a/arch/metag/boot/dts/Makefile b/arch/metag/boot/dts/Makefile deleted file mode 100644 index f0a180f62766b..0000000000000 --- a/arch/metag/boot/dts/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -dtb-y += skeleton.dtb -dtb-y += tz1090_generic.dtb - -# Built-in dtb -builtindtb-y := skeleton -builtindtb-$(CONFIG_SOC_TZ1090) := tz1090_generic - -ifneq ($(CONFIG_METAG_BUILTIN_DTB_NAME),"") - builtindtb-y := $(patsubst "%",%,$(CONFIG_METAG_BUILTIN_DTB_NAME)) -endif - -dtb-$(CONFIG_METAG_BUILTIN_DTB) += $(builtindtb-y).dtb -obj-$(CONFIG_METAG_BUILTIN_DTB) += $(builtindtb-y).dtb.o - -.SECONDARY: $(obj)/$(builtindtb-y).dtb.S diff --git a/arch/metag/boot/dts/skeleton.dts b/arch/metag/boot/dts/skeleton.dts deleted file mode 100644 index 7a49aeb365d0c..0000000000000 --- a/arch/metag/boot/dts/skeleton.dts +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright (C) 2012 Imagination Technologies Ltd. - * - * 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. - */ -/dts-v1/; - -#include "skeleton.dtsi" diff --git a/arch/metag/boot/dts/skeleton.dtsi b/arch/metag/boot/dts/skeleton.dtsi deleted file mode 100644 index 43e2ffe73c271..0000000000000 --- a/arch/metag/boot/dts/skeleton.dtsi +++ /dev/null @@ -1,15 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Skeleton device tree; the bare minimum needed to boot; just include and - * add a compatible value. The bootloader will typically populate the memory - * node. - */ - -/ { - compatible = "img,meta"; - #address-cells = <1>; - #size-cells = <1>; - chosen { }; - aliases { }; - memory { device_type = "memory"; reg = <0 0>; }; -}; diff --git a/arch/metag/boot/dts/tz1090.dtsi b/arch/metag/boot/dts/tz1090.dtsi deleted file mode 100644 index 24ea7d2e91380..0000000000000 --- a/arch/metag/boot/dts/tz1090.dtsi +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (C) 2012 Imagination Technologies Ltd. - * - * 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 "skeleton.dtsi" - -#include - -/ { - compatible = "toumaz,tz1090", "img,meta"; - - interrupt-parent = <&intc>; - - intc: interrupt-controller { - compatible = "img,meta-intc"; - interrupt-controller; - #interrupt-cells = <2>; - num-banks = <2>; - }; - - soc { - compatible = "simple-bus"; - #address-cells = <1>; - #size-cells = <1>; - ranges; - - pdc: pdc@0x02006000 { - interrupt-controller; - #interrupt-cells = <2>; - - reg = <0x02006000 0x1000>; - compatible = "img,pdc-intc"; - - num-perips = <3>; - num-syswakes = <3>; - - interrupts = <18 IRQ_TYPE_LEVEL_HIGH>, /* Syswakes */ - <30 IRQ_TYPE_LEVEL_HIGH>, /* Perip 0 (RTC) */ - <29 IRQ_TYPE_LEVEL_HIGH>, /* Perip 1 (IR) */ - <31 IRQ_TYPE_LEVEL_HIGH>; /* Perip 2 (WDT) */ - }; - - pinctrl: pinctrl@02005800 { - #gpio-range-cells = <3>; - compatible = "img,tz1090-pinctrl"; - reg = <0x02005800 0xe4>; - }; - - pdc_pinctrl: pinctrl@02006500 { - #gpio-range-cells = <3>; - compatible = "img,tz1090-pdc-pinctrl"; - reg = <0x02006500 0x100>; - }; - - gpios: gpios@02005800 { - #address-cells = <1>; - #size-cells = <0>; - compatible = "img,tz1090-gpio"; - reg = <0x02005800 0x90>; - - gpios0: bank@0 { - gpio-controller; - interrupt-controller; - #gpio-cells = <2>; - #interrupt-cells = <2>; - reg = <0>; - interrupts = <13 IRQ_TYPE_LEVEL_HIGH>; - gpio-ranges = <&pinctrl 0 0 30>; - }; - gpios1: bank@1 { - gpio-controller; - interrupt-controller; - #gpio-cells = <2>; - #interrupt-cells = <2>; - reg = <1>; - interrupts = <14 IRQ_TYPE_LEVEL_HIGH>; - gpio-ranges = <&pinctrl 0 30 30>; - }; - gpios2: bank@2 { - gpio-controller; - interrupt-controller; - #gpio-cells = <2>; - #interrupt-cells = <2>; - reg = <2>; - interrupts = <15 IRQ_TYPE_LEVEL_HIGH>; - gpio-ranges = <&pinctrl 0 60 30>; - }; - }; - - pdc_gpios: gpios@02006500 { - gpio-controller; - #gpio-cells = <2>; - - compatible = "img,tz1090-pdc-gpio"; - reg = <0x02006500 0x100>; - - interrupt-parent = <&pdc>; - interrupts = <8 IRQ_TYPE_NONE>, - <9 IRQ_TYPE_NONE>, - <10 IRQ_TYPE_NONE>; - gpio-ranges = <&pdc_pinctrl 0 0 7>; - }; - }; -}; diff --git a/arch/metag/boot/dts/tz1090_generic.dts b/arch/metag/boot/dts/tz1090_generic.dts deleted file mode 100644 index f960909559647..0000000000000 --- a/arch/metag/boot/dts/tz1090_generic.dts +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright (C) 2012 Imagination Technologies Ltd. - * - * 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. - */ -/dts-v1/; - -#include "tz1090.dtsi" diff --git a/arch/metag/configs/meta1_defconfig b/arch/metag/configs/meta1_defconfig deleted file mode 100644 index 01cd67e4403dc..0000000000000 --- a/arch/metag/configs/meta1_defconfig +++ /dev/null @@ -1,39 +0,0 @@ -# CONFIG_LOCALVERSION_AUTO is not set -# CONFIG_SWAP is not set -CONFIG_SYSFS_DEPRECATED=y -CONFIG_SYSFS_DEPRECATED_V2=y -CONFIG_KALLSYMS_ALL=y -# CONFIG_ELF_CORE is not set -CONFIG_SLAB=y -# CONFIG_BLK_DEV_BSG is not set -CONFIG_PARTITION_ADVANCED=y -# CONFIG_MSDOS_PARTITION is not set -# CONFIG_IOSCHED_DEADLINE is not set -# CONFIG_IOSCHED_CFQ is not set -CONFIG_FLATMEM_MANUAL=y -CONFIG_META12_FPGA=y -CONFIG_METAG_DA=y -CONFIG_HZ_100=y -CONFIG_DEVTMPFS=y -CONFIG_DEVTMPFS_MOUNT=y -# CONFIG_STANDALONE is not set -# CONFIG_PREVENT_FIRMWARE_BUILD is not set -# CONFIG_FW_LOADER is not set -CONFIG_BLK_DEV_RAM=y -CONFIG_BLK_DEV_RAM_COUNT=1 -CONFIG_BLK_DEV_RAM_SIZE=16384 -# CONFIG_INPUT is not set -# CONFIG_SERIO is not set -# CONFIG_VT is not set -# CONFIG_LEGACY_PTYS is not set -CONFIG_DA_TTY=y -CONFIG_DA_CONSOLE=y -# CONFIG_DEVKMEM is not set -# CONFIG_HW_RANDOM is not set -# CONFIG_HWMON is not set -# CONFIG_USB_SUPPORT is not set -# CONFIG_DNOTIFY is not set -CONFIG_TMPFS=y -# CONFIG_MISC_FILESYSTEMS is not set -# CONFIG_SCHED_DEBUG is not set -CONFIG_DEBUG_INFO=y diff --git a/arch/metag/configs/meta2_defconfig b/arch/metag/configs/meta2_defconfig deleted file mode 100644 index 643392ba7ed51..0000000000000 --- a/arch/metag/configs/meta2_defconfig +++ /dev/null @@ -1,40 +0,0 @@ -# CONFIG_LOCALVERSION_AUTO is not set -# CONFIG_SWAP is not set -CONFIG_SYSVIPC=y -CONFIG_SYSFS_DEPRECATED=y -CONFIG_SYSFS_DEPRECATED_V2=y -CONFIG_KALLSYMS_ALL=y -# CONFIG_ELF_CORE is not set -CONFIG_SLAB=y -# CONFIG_BLK_DEV_BSG is not set -CONFIG_PARTITION_ADVANCED=y -# CONFIG_MSDOS_PARTITION is not set -# CONFIG_IOSCHED_DEADLINE is not set -# CONFIG_IOSCHED_CFQ is not set -CONFIG_METAG_L2C=y -CONFIG_FLATMEM_MANUAL=y -CONFIG_METAG_HALT_ON_PANIC=y -CONFIG_METAG_DA=y -CONFIG_HZ_100=y -CONFIG_DEVTMPFS=y -# CONFIG_STANDALONE is not set -# CONFIG_PREVENT_FIRMWARE_BUILD is not set -# CONFIG_FW_LOADER is not set -CONFIG_BLK_DEV_RAM=y -CONFIG_BLK_DEV_RAM_COUNT=1 -CONFIG_BLK_DEV_RAM_SIZE=16384 -# CONFIG_INPUT is not set -# CONFIG_SERIO is not set -# CONFIG_VT is not set -# CONFIG_LEGACY_PTYS is not set -CONFIG_DA_TTY=y -CONFIG_DA_CONSOLE=y -# CONFIG_DEVKMEM is not set -# CONFIG_HW_RANDOM is not set -# CONFIG_HWMON is not set -# CONFIG_USB_SUPPORT is not set -# CONFIG_DNOTIFY is not set -CONFIG_TMPFS=y -# CONFIG_MISC_FILESYSTEMS is not set -# CONFIG_SCHED_DEBUG is not set -CONFIG_DEBUG_INFO=y diff --git a/arch/metag/configs/meta2_smp_defconfig b/arch/metag/configs/meta2_smp_defconfig deleted file mode 100644 index f3306737da207..0000000000000 --- a/arch/metag/configs/meta2_smp_defconfig +++ /dev/null @@ -1,41 +0,0 @@ -# CONFIG_LOCALVERSION_AUTO is not set -# CONFIG_SWAP is not set -CONFIG_SYSVIPC=y -CONFIG_SYSFS_DEPRECATED=y -CONFIG_SYSFS_DEPRECATED_V2=y -CONFIG_KALLSYMS_ALL=y -# CONFIG_ELF_CORE is not set -CONFIG_SLAB=y -# CONFIG_BLK_DEV_BSG is not set -CONFIG_PARTITION_ADVANCED=y -# CONFIG_MSDOS_PARTITION is not set -# CONFIG_IOSCHED_DEADLINE is not set -# CONFIG_IOSCHED_CFQ is not set -CONFIG_METAG_L2C=y -CONFIG_FLATMEM_MANUAL=y -CONFIG_METAG_HALT_ON_PANIC=y -CONFIG_SMP=y -CONFIG_METAG_DA=y -CONFIG_HZ_100=y -CONFIG_DEVTMPFS=y -# CONFIG_STANDALONE is not set -# CONFIG_PREVENT_FIRMWARE_BUILD is not set -# CONFIG_FW_LOADER is not set -CONFIG_BLK_DEV_RAM=y -CONFIG_BLK_DEV_RAM_COUNT=1 -CONFIG_BLK_DEV_RAM_SIZE=16384 -# CONFIG_INPUT is not set -# CONFIG_SERIO is not set -# CONFIG_VT is not set -# CONFIG_LEGACY_PTYS is not set -CONFIG_DA_TTY=y -CONFIG_DA_CONSOLE=y -# CONFIG_DEVKMEM is not set -# CONFIG_HW_RANDOM is not set -# CONFIG_HWMON is not set -# CONFIG_USB_SUPPORT is not set -# CONFIG_DNOTIFY is not set -CONFIG_TMPFS=y -# CONFIG_MISC_FILESYSTEMS is not set -# CONFIG_SCHED_DEBUG is not set -CONFIG_DEBUG_INFO=y diff --git a/arch/metag/configs/tz1090_defconfig b/arch/metag/configs/tz1090_defconfig deleted file mode 100644 index 9f9316a6df27a..0000000000000 --- a/arch/metag/configs/tz1090_defconfig +++ /dev/null @@ -1,42 +0,0 @@ -# CONFIG_LOCALVERSION_AUTO is not set -# CONFIG_SWAP is not set -CONFIG_SYSVIPC=y -CONFIG_SYSFS_DEPRECATED=y -CONFIG_SYSFS_DEPRECATED_V2=y -CONFIG_KALLSYMS_ALL=y -# CONFIG_ELF_CORE is not set -CONFIG_SLAB=y -# CONFIG_BLK_DEV_BSG is not set -CONFIG_PARTITION_ADVANCED=y -# CONFIG_MSDOS_PARTITION is not set -# CONFIG_IOSCHED_DEADLINE is not set -# CONFIG_IOSCHED_CFQ is not set -CONFIG_FLATMEM_MANUAL=y -CONFIG_SOC_TZ1090=y -CONFIG_METAG_HALT_ON_PANIC=y -# CONFIG_METAG_FPU is not set -CONFIG_METAG_DA=y -CONFIG_HZ_100=y -CONFIG_DEVTMPFS=y -# CONFIG_STANDALONE is not set -# CONFIG_PREVENT_FIRMWARE_BUILD is not set -# CONFIG_FW_LOADER is not set -CONFIG_BLK_DEV_RAM=y -CONFIG_BLK_DEV_RAM_COUNT=1 -CONFIG_BLK_DEV_RAM_SIZE=16384 -# CONFIG_INPUT is not set -# CONFIG_SERIO is not set -# CONFIG_VT is not set -# CONFIG_LEGACY_PTYS is not set -CONFIG_DA_TTY=y -CONFIG_DA_CONSOLE=y -# CONFIG_DEVKMEM is not set -# CONFIG_HW_RANDOM is not set -CONFIG_GPIOLIB=y -# CONFIG_HWMON is not set -# CONFIG_USB_SUPPORT is not set -# CONFIG_DNOTIFY is not set -CONFIG_TMPFS=y -# CONFIG_MISC_FILESYSTEMS is not set -# CONFIG_SCHED_DEBUG is not set -CONFIG_DEBUG_INFO=y diff --git a/arch/metag/include/asm/Kbuild b/arch/metag/include/asm/Kbuild deleted file mode 100644 index 913c779979df4..0000000000000 --- a/arch/metag/include/asm/Kbuild +++ /dev/null @@ -1,33 +0,0 @@ -generic-y += bugs.h -generic-y += current.h -generic-y += device.h -generic-y += dma.h -generic-y += emergency-restart.h -generic-y += exec.h -generic-y += extable.h -generic-y += fb.h -generic-y += futex.h -generic-y += hardirq.h -generic-y += hw_irq.h -generic-y += irq_regs.h -generic-y += irq_work.h -generic-y += kdebug.h -generic-y += kmap_types.h -generic-y += kprobes.h -generic-y += local.h -generic-y += local64.h -generic-y += mcs_spinlock.h -generic-y += mm-arch-hooks.h -generic-y += pci.h -generic-y += percpu.h -generic-y += preempt.h -generic-y += sections.h -generic-y += serial.h -generic-y += switch_to.h -generic-y += timex.h -generic-y += trace_clock.h -generic-y += unaligned.h -generic-y += user.h -generic-y += vga.h -generic-y += word-at-a-time.h -generic-y += xor.h diff --git a/arch/metag/include/asm/atomic.h b/arch/metag/include/asm/atomic.h deleted file mode 100644 index 97ae189c2dd88..0000000000000 --- a/arch/metag/include/asm/atomic.h +++ /dev/null @@ -1,49 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __ASM_METAG_ATOMIC_H -#define __ASM_METAG_ATOMIC_H - -#include -#include -#include -#include - -#if defined(CONFIG_METAG_ATOMICITY_IRQSOFF) -/* The simple UP case. */ -#include -#else - -#if defined(CONFIG_METAG_ATOMICITY_LOCK1) -#include -#else -#include -#endif - -#define atomic_add_negative(a, v) (atomic_add_return((a), (v)) < 0) - -#define atomic_dec_return(v) atomic_sub_return(1, (v)) -#define atomic_inc_return(v) atomic_add_return(1, (v)) - -/* - * atomic_inc_and_test - increment and test - * @v: pointer of type atomic_t - * - * Atomically increments @v by 1 - * and returns true if the result is zero, or false for all - * other cases. - */ -#define atomic_inc_and_test(v) (atomic_inc_return(v) == 0) - -#define atomic_sub_and_test(i, v) (atomic_sub_return((i), (v)) == 0) -#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0) - -#define atomic_inc(v) atomic_add(1, (v)) -#define atomic_dec(v) atomic_sub(1, (v)) - -#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) -#define atomic_dec_if_positive(v) atomic_sub_if_positive(1, v) - -#endif - -#include - -#endif /* __ASM_METAG_ATOMIC_H */ diff --git a/arch/metag/include/asm/atomic_lnkget.h b/arch/metag/include/asm/atomic_lnkget.h deleted file mode 100644 index 17e8c61c946de..0000000000000 --- a/arch/metag/include/asm/atomic_lnkget.h +++ /dev/null @@ -1,204 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __ASM_METAG_ATOMIC_LNKGET_H -#define __ASM_METAG_ATOMIC_LNKGET_H - -#define ATOMIC_INIT(i) { (i) } - -#define atomic_set(v, i) WRITE_ONCE((v)->counter, (i)) - -#include - -#include - -/* - * None of these asm statements clobber memory as LNKSET writes around - * the cache so the memory it modifies cannot safely be read by any means - * other than these accessors. - */ - -static inline int atomic_read(const atomic_t *v) -{ - int temp; - - asm volatile ( - "LNKGETD %0, [%1]\n" - : "=da" (temp) - : "da" (&v->counter)); - - return temp; -} - -#define ATOMIC_OP(op) \ -static inline void atomic_##op(int i, atomic_t *v) \ -{ \ - int temp; \ - \ - asm volatile ( \ - "1: LNKGETD %0, [%1]\n" \ - " " #op " %0, %0, %2\n" \ - " LNKSETD [%1], %0\n" \ - " DEFR %0, TXSTAT\n" \ - " ANDT %0, %0, #HI(0x3f000000)\n" \ - " CMPT %0, #HI(0x02000000)\n" \ - " BNZ 1b\n" \ - : "=&d" (temp) \ - : "da" (&v->counter), "bd" (i) \ - : "cc"); \ -} \ - -#define ATOMIC_OP_RETURN(op) \ -static inline int atomic_##op##_return(int i, atomic_t *v) \ -{ \ - int result, temp; \ - \ - smp_mb(); \ - \ - asm volatile ( \ - "1: LNKGETD %1, [%2]\n" \ - " " #op " %1, %1, %3\n" \ - " LNKSETD [%2], %1\n" \ - " DEFR %0, TXSTAT\n" \ - " ANDT %0, %0, #HI(0x3f000000)\n" \ - " CMPT %0, #HI(0x02000000)\n" \ - " BNZ 1b\n" \ - : "=&d" (temp), "=&da" (result) \ - : "da" (&v->counter), "br" (i) \ - : "cc"); \ - \ - smp_mb(); \ - \ - return result; \ -} - -#define ATOMIC_FETCH_OP(op) \ -static inline int atomic_fetch_##op(int i, atomic_t *v) \ -{ \ - int result, temp; \ - \ - smp_mb(); \ - \ - asm volatile ( \ - "1: LNKGETD %1, [%2]\n" \ - " " #op " %0, %1, %3\n" \ - " LNKSETD [%2], %0\n" \ - " DEFR %0, TXSTAT\n" \ - " ANDT %0, %0, #HI(0x3f000000)\n" \ - " CMPT %0, #HI(0x02000000)\n" \ - " BNZ 1b\n" \ - : "=&d" (temp), "=&d" (result) \ - : "da" (&v->counter), "bd" (i) \ - : "cc"); \ - \ - smp_mb(); \ - \ - return result; \ -} - -#define ATOMIC_OPS(op) ATOMIC_OP(op) ATOMIC_OP_RETURN(op) ATOMIC_FETCH_OP(op) - -ATOMIC_OPS(add) -ATOMIC_OPS(sub) - -#undef ATOMIC_OPS -#define ATOMIC_OPS(op) ATOMIC_OP(op) ATOMIC_FETCH_OP(op) - -ATOMIC_OPS(and) -ATOMIC_OPS(or) -ATOMIC_OPS(xor) - -#undef ATOMIC_OPS -#undef ATOMIC_FETCH_OP -#undef ATOMIC_OP_RETURN -#undef ATOMIC_OP - -static inline int atomic_cmpxchg(atomic_t *v, int old, int new) -{ - int result, temp; - - smp_mb(); - - asm volatile ( - "1: LNKGETD %1, [%2]\n" - " CMP %1, %3\n" - " LNKSETDEQ [%2], %4\n" - " BNE 2f\n" - " DEFR %0, TXSTAT\n" - " ANDT %0, %0, #HI(0x3f000000)\n" - " CMPT %0, #HI(0x02000000)\n" - " BNZ 1b\n" - "2:\n" - : "=&d" (temp), "=&d" (result) - : "da" (&v->counter), "bd" (old), "da" (new) - : "cc"); - - smp_mb(); - - return result; -} - -static inline int atomic_xchg(atomic_t *v, int new) -{ - int temp, old; - - asm volatile ( - "1: LNKGETD %1, [%2]\n" - " LNKSETD [%2], %3\n" - " DEFR %0, TXSTAT\n" - " ANDT %0, %0, #HI(0x3f000000)\n" - " CMPT %0, #HI(0x02000000)\n" - " BNZ 1b\n" - : "=&d" (temp), "=&d" (old) - : "da" (&v->counter), "da" (new) - : "cc"); - - return old; -} - -static inline int __atomic_add_unless(atomic_t *v, int a, int u) -{ - int result, temp; - - smp_mb(); - - asm volatile ( - "1: LNKGETD %1, [%2]\n" - " CMP %1, %3\n" - " ADD %0, %1, %4\n" - " LNKSETDNE [%2], %0\n" - " BEQ 2f\n" - " DEFR %0, TXSTAT\n" - " ANDT %0, %0, #HI(0x3f000000)\n" - " CMPT %0, #HI(0x02000000)\n" - " BNZ 1b\n" - "2:\n" - : "=&d" (temp), "=&d" (result) - : "da" (&v->counter), "bd" (u), "bd" (a) - : "cc"); - - smp_mb(); - - return result; -} - -static inline int atomic_sub_if_positive(int i, atomic_t *v) -{ - int result, temp; - - asm volatile ( - "1: LNKGETD %1, [%2]\n" - " SUBS %1, %1, %3\n" - " LNKSETDGE [%2], %1\n" - " BLT 2f\n" - " DEFR %0, TXSTAT\n" - " ANDT %0, %0, #HI(0x3f000000)\n" - " CMPT %0, #HI(0x02000000)\n" - " BNZ 1b\n" - "2:\n" - : "=&d" (temp), "=&da" (result) - : "da" (&v->counter), "bd" (i) - : "cc"); - - return result; -} - -#endif /* __ASM_METAG_ATOMIC_LNKGET_H */ diff --git a/arch/metag/include/asm/atomic_lock1.h b/arch/metag/include/asm/atomic_lock1.h deleted file mode 100644 index 2ce8fa3a79c2d..0000000000000 --- a/arch/metag/include/asm/atomic_lock1.h +++ /dev/null @@ -1,157 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __ASM_METAG_ATOMIC_LOCK1_H -#define __ASM_METAG_ATOMIC_LOCK1_H - -#define ATOMIC_INIT(i) { (i) } - -#include - -#include -#include - -static inline int atomic_read(const atomic_t *v) -{ - return READ_ONCE((v)->counter); -} - -/* - * atomic_set needs to be take the lock to protect atomic_add_unless from a - * possible race, as it reads the counter twice: - * - * CPU0 CPU1 - * atomic_add_unless(1, 0) - * ret = v->counter (non-zero) - * if (ret != u) v->counter = 0 - * v->counter += 1 (counter set to 1) - * - * Making atomic_set take the lock ensures that ordering and logical - * consistency is preserved. - */ -static inline int atomic_set(atomic_t *v, int i) -{ - unsigned long flags; - - __global_lock1(flags); - fence(); - v->counter = i; - __global_unlock1(flags); - return i; -} - -#define atomic_set_release(v, i) atomic_set((v), (i)) - -#define ATOMIC_OP(op, c_op) \ -static inline void atomic_##op(int i, atomic_t *v) \ -{ \ - unsigned long flags; \ - \ - __global_lock1(flags); \ - fence(); \ - v->counter c_op i; \ - __global_unlock1(flags); \ -} \ - -#define ATOMIC_OP_RETURN(op, c_op) \ -static inline int atomic_##op##_return(int i, atomic_t *v) \ -{ \ - unsigned long result; \ - unsigned long flags; \ - \ - __global_lock1(flags); \ - result = v->counter; \ - result c_op i; \ - fence(); \ - v->counter = result; \ - __global_unlock1(flags); \ - \ - return result; \ -} - -#define ATOMIC_FETCH_OP(op, c_op) \ -static inline int atomic_fetch_##op(int i, atomic_t *v) \ -{ \ - unsigned long result; \ - unsigned long flags; \ - \ - __global_lock1(flags); \ - result = v->counter; \ - fence(); \ - v->counter c_op i; \ - __global_unlock1(flags); \ - \ - return result; \ -} - -#define ATOMIC_OPS(op, c_op) \ - ATOMIC_OP(op, c_op) \ - ATOMIC_OP_RETURN(op, c_op) \ - ATOMIC_FETCH_OP(op, c_op) - -ATOMIC_OPS(add, +=) -ATOMIC_OPS(sub, -=) - -#undef ATOMIC_OPS -#define ATOMIC_OPS(op, c_op) \ - ATOMIC_OP(op, c_op) \ - ATOMIC_FETCH_OP(op, c_op) - -ATOMIC_OPS(and, &=) -ATOMIC_OPS(or, |=) -ATOMIC_OPS(xor, ^=) - -#undef ATOMIC_OPS -#undef ATOMIC_FETCH_OP -#undef ATOMIC_OP_RETURN -#undef ATOMIC_OP - -static inline int atomic_cmpxchg(atomic_t *v, int old, int new) -{ - int ret; - unsigned long flags; - - __global_lock1(flags); - ret = v->counter; - if (ret == old) { - fence(); - v->counter = new; - } - __global_unlock1(flags); - - return ret; -} - -#define atomic_xchg(v, new) (xchg(&((v)->counter), new)) - -static inline int __atomic_add_unless(atomic_t *v, int a, int u) -{ - int ret; - unsigned long flags; - - __global_lock1(flags); - ret = v->counter; - if (ret != u) { - fence(); - v->counter += a; - } - __global_unlock1(flags); - - return ret; -} - -static inline int atomic_sub_if_positive(int i, atomic_t *v) -{ - int ret; - unsigned long flags; - - __global_lock1(flags); - ret = v->counter - 1; - if (ret >= 0) { - fence(); - v->counter = ret; - } - __global_unlock1(flags); - - return ret; -} - -#endif /* __ASM_METAG_ATOMIC_LOCK1_H */ diff --git a/arch/metag/include/asm/barrier.h b/arch/metag/include/asm/barrier.h deleted file mode 100644 index 2661fec5696a7..0000000000000 --- a/arch/metag/include/asm/barrier.h +++ /dev/null @@ -1,85 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_METAG_BARRIER_H -#define _ASM_METAG_BARRIER_H - -#include - -#define nop() asm volatile ("NOP") - -#ifdef CONFIG_METAG_META21 - -/* HTP and above have a system event to fence writes */ -static inline void wr_fence(void) -{ - volatile int *flushptr = (volatile int *) LINSYSEVENT_WR_FENCE; - barrier(); - *flushptr = 0; - barrier(); -} - -#else /* CONFIG_METAG_META21 */ - -/* - * ATP doesn't have system event to fence writes, so it is necessary to flush - * the processor write queues as well as possibly the write combiner (depending - * on the page being written). - * To ensure the write queues are flushed we do 4 writes to a system event - * register (in this case write combiner flush) which will also flush the write - * combiner. - */ -static inline void wr_fence(void) -{ - volatile int *flushptr = (volatile int *) LINSYSEVENT_WR_COMBINE_FLUSH; - barrier(); - *flushptr = 0; - *flushptr = 0; - *flushptr = 0; - *flushptr = 0; - barrier(); -} - -#endif /* !CONFIG_METAG_META21 */ - -/* flush writes through the write combiner */ -#define mb() wr_fence() -#define rmb() barrier() -#define wmb() mb() - -#ifdef CONFIG_METAG_SMP_WRITE_REORDERING -/* - * Write to the atomic memory unlock system event register (command 0). This is - * needed before a write to shared memory in a critical section, to prevent - * external reordering of writes before the fence on other threads with writes - * after the fence on this thread (and to prevent the ensuing cache-memory - * incoherence). It is therefore ineffective if used after and on the same - * thread as a write. - */ -static inline void metag_fence(void) -{ - volatile int *flushptr = (volatile int *) LINSYSEVENT_WR_ATOMIC_UNLOCK; - barrier(); - *flushptr = 0; - barrier(); -} -#define __smp_mb() metag_fence() -#define __smp_rmb() metag_fence() -#define __smp_wmb() barrier() -#else -#define metag_fence() do { } while (0) -#define __smp_mb() barrier() -#define __smp_rmb() barrier() -#define __smp_wmb() barrier() -#endif - -#ifdef CONFIG_SMP -#define fence() metag_fence() -#else -#define fence() do { } while (0) -#endif - -#define __smp_mb__before_atomic() barrier() -#define __smp_mb__after_atomic() barrier() - -#include - -#endif /* _ASM_METAG_BARRIER_H */ diff --git a/arch/metag/include/asm/bitops.h b/arch/metag/include/asm/bitops.h deleted file mode 100644 index 766ad43010ad3..0000000000000 --- a/arch/metag/include/asm/bitops.h +++ /dev/null @@ -1,127 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __ASM_METAG_BITOPS_H -#define __ASM_METAG_BITOPS_H - -#include -#include -#include - -#ifdef CONFIG_SMP -/* - * These functions are the basis of our bit ops. - */ -static inline void set_bit(unsigned int bit, volatile unsigned long *p) -{ - unsigned long flags; - unsigned long mask = 1UL << (bit & 31); - - p += bit >> 5; - - __global_lock1(flags); - fence(); - *p |= mask; - __global_unlock1(flags); -} - -static inline void clear_bit(unsigned int bit, volatile unsigned long *p) -{ - unsigned long flags; - unsigned long mask = 1UL << (bit & 31); - - p += bit >> 5; - - __global_lock1(flags); - fence(); - *p &= ~mask; - __global_unlock1(flags); -} - -static inline void change_bit(unsigned int bit, volatile unsigned long *p) -{ - unsigned long flags; - unsigned long mask = 1UL << (bit & 31); - - p += bit >> 5; - - __global_lock1(flags); - fence(); - *p ^= mask; - __global_unlock1(flags); -} - -static inline int test_and_set_bit(unsigned int bit, volatile unsigned long *p) -{ - unsigned long flags; - unsigned long old; - unsigned long mask = 1UL << (bit & 31); - - p += bit >> 5; - - __global_lock1(flags); - old = *p; - if (!(old & mask)) { - fence(); - *p = old | mask; - } - __global_unlock1(flags); - - return (old & mask) != 0; -} - -static inline int test_and_clear_bit(unsigned int bit, - volatile unsigned long *p) -{ - unsigned long flags; - unsigned long old; - unsigned long mask = 1UL << (bit & 31); - - p += bit >> 5; - - __global_lock1(flags); - old = *p; - if (old & mask) { - fence(); - *p = old & ~mask; - } - __global_unlock1(flags); - - return (old & mask) != 0; -} - -static inline int test_and_change_bit(unsigned int bit, - volatile unsigned long *p) -{ - unsigned long flags; - unsigned long old; - unsigned long mask = 1UL << (bit & 31); - - p += bit >> 5; - - __global_lock1(flags); - fence(); - old = *p; - *p = old ^ mask; - __global_unlock1(flags); - - return (old & mask) != 0; -} - -#else -#include -#endif /* CONFIG_SMP */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#endif /* __ASM_METAG_BITOPS_H */ diff --git a/arch/metag/include/asm/bug.h b/arch/metag/include/asm/bug.h deleted file mode 100644 index ee07a943f931b..0000000000000 --- a/arch/metag/include/asm/bug.h +++ /dev/null @@ -1,13 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_METAG_BUG_H -#define _ASM_METAG_BUG_H - -#include - -struct pt_regs; - -extern const char *trap_name(int trapno); -extern void __noreturn die(const char *str, struct pt_regs *regs, long err, - unsigned long addr); - -#endif diff --git a/arch/metag/include/asm/cache.h b/arch/metag/include/asm/cache.h deleted file mode 100644 index b5df02239c8d1..0000000000000 --- a/arch/metag/include/asm/cache.h +++ /dev/null @@ -1,24 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __ASM_METAG_CACHE_H -#define __ASM_METAG_CACHE_H - -/* L1 cache line size (64 bytes) */ -#define L1_CACHE_SHIFT 6 -#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) - -/* Meta requires large data items to be 8 byte aligned. */ -#define ARCH_SLAB_MINALIGN 8 - -/* - * With an L2 cache, we may invalidate dirty lines, so we need to ensure DMA - * buffers have cache line alignment. - */ -#ifdef CONFIG_METAG_L2C -#define ARCH_DMA_MINALIGN L1_CACHE_BYTES -#else -#define ARCH_DMA_MINALIGN 8 -#endif - -#define __read_mostly __attribute__((__section__(".data..read_mostly"))) - -#endif diff --git a/arch/metag/include/asm/cacheflush.h b/arch/metag/include/asm/cacheflush.h deleted file mode 100644 index 2584a51eca1a6..0000000000000 --- a/arch/metag/include/asm/cacheflush.h +++ /dev/null @@ -1,251 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _METAG_CACHEFLUSH_H -#define _METAG_CACHEFLUSH_H - -#include -#include -#include - -#include -#include -#include - -void metag_cache_probe(void); - -void metag_data_cache_flush_all(const void *start); -void metag_code_cache_flush_all(const void *start); - -/* - * Routines to flush physical cache lines that may be used to cache data or code - * normally accessed via the linear address range supplied. The region flushed - * must either lie in local or global address space determined by the top bit of - * the pStart address. If Bytes is >= 4K then the whole of the related cache - * state will be flushed rather than a limited range. - */ -void metag_data_cache_flush(const void *start, int bytes); -void metag_code_cache_flush(const void *start, int bytes); - -#ifdef CONFIG_METAG_META12 - -/* Write through, virtually tagged, split I/D cache. */ - -static inline void __flush_cache_all(void) -{ - metag_code_cache_flush_all((void *) PAGE_OFFSET); - metag_data_cache_flush_all((void *) PAGE_OFFSET); -} - -#define flush_cache_all() __flush_cache_all() - -/* flush the entire user address space referenced in this mm structure */ -static inline void flush_cache_mm(struct mm_struct *mm) -{ - if (mm == current->mm) - __flush_cache_all(); -} - -#define flush_cache_dup_mm(mm) flush_cache_mm(mm) - -/* flush a range of addresses from this mm */ -static inline void flush_cache_range(struct vm_area_struct *vma, - unsigned long start, unsigned long end) -{ - flush_cache_mm(vma->vm_mm); -} - -static inline void flush_cache_page(struct vm_area_struct *vma, - unsigned long vmaddr, unsigned long pfn) -{ - flush_cache_mm(vma->vm_mm); -} - -#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 -static inline void flush_dcache_page(struct page *page) -{ - metag_data_cache_flush_all((void *) PAGE_OFFSET); -} - -#define flush_dcache_mmap_lock(mapping) do { } while (0) -#define flush_dcache_mmap_unlock(mapping) do { } while (0) - -static inline void flush_icache_page(struct vm_area_struct *vma, - struct page *page) -{ - metag_code_cache_flush(page_to_virt(page), PAGE_SIZE); -} - -static inline void flush_cache_vmap(unsigned long start, unsigned long end) -{ - metag_data_cache_flush_all((void *) PAGE_OFFSET); -} - -static inline void flush_cache_vunmap(unsigned long start, unsigned long end) -{ - metag_data_cache_flush_all((void *) PAGE_OFFSET); -} - -#else - -/* Write through, physically tagged, split I/D cache. */ - -#define flush_cache_all() do { } while (0) -#define flush_cache_mm(mm) do { } while (0) -#define flush_cache_dup_mm(mm) do { } while (0) -#define flush_cache_range(vma, start, end) do { } while (0) -#define flush_cache_page(vma, vmaddr, pfn) do { } while (0) -#define flush_dcache_mmap_lock(mapping) do { } while (0) -#define flush_dcache_mmap_unlock(mapping) do { } while (0) -#define flush_icache_page(vma, pg) do { } while (0) -#define flush_cache_vmap(start, end) do { } while (0) -#define flush_cache_vunmap(start, end) do { } while (0) - -#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 -static inline void flush_dcache_page(struct page *page) -{ - /* FIXME: We can do better than this. All we are trying to do is - * make the i-cache coherent, we should use the PG_arch_1 bit like - * e.g. powerpc. - */ -#ifdef CONFIG_SMP - metag_out32(1, SYSC_ICACHE_FLUSH); -#else - metag_code_cache_flush_all((void *) PAGE_OFFSET); -#endif -} - -#endif - -/* Push n pages at kernel virtual address and clear the icache */ -static inline void flush_icache_range(unsigned long address, - unsigned long endaddr) -{ -#ifdef CONFIG_SMP - metag_out32(1, SYSC_ICACHE_FLUSH); -#else - metag_code_cache_flush((void *) address, endaddr - address); -#endif -} - -static inline void flush_cache_sigtramp(unsigned long addr, int size) -{ - /* - * Flush the icache in case there was previously some code - * fetched from this address, perhaps a previous sigtramp. - * - * We don't need to flush the dcache, it's write through and - * we just wrote the sigtramp code through it. - */ -#ifdef CONFIG_SMP - metag_out32(1, SYSC_ICACHE_FLUSH); -#else - metag_code_cache_flush((void *) addr, size); -#endif -} - -#ifdef CONFIG_METAG_L2C - -/* - * Perform a single specific CACHEWD operation on an address, masking lower bits - * of address first. - */ -static inline void cachewd_line(void *addr, unsigned int data) -{ - unsigned long masked = (unsigned long)addr & -0x40; - __builtin_meta2_cachewd((void *)masked, data); -} - -/* Perform a certain CACHEW op on each cache line in a range */ -static inline void cachew_region_op(void *start, unsigned long size, - unsigned int op) -{ - unsigned long offset = (unsigned long)start & 0x3f; - int i; - if (offset) { - size += offset; - start -= offset; - } - i = (size - 1) >> 6; - do { - __builtin_meta2_cachewd(start, op); - start += 0x40; - } while (i--); -} - -/* prevent write fence and flushbacks being reordered in L2 */ -static inline void l2c_fence_flush(void *addr) -{ - /* - * Synchronise by reading back and re-flushing. - * It is assumed this access will miss, as the caller should have just - * flushed the cache line. - */ - (void)(volatile u8 *)addr; - cachewd_line(addr, CACHEW_FLUSH_L1D_L2); -} - -/* prevent write fence and writebacks being reordered in L2 */ -static inline void l2c_fence(void *addr) -{ - /* - * A write back has occurred, but not necessarily an invalidate, so the - * readback in l2c_fence_flush() would hit in the cache and have no - * effect. Therefore fully flush the line first. - */ - cachewd_line(addr, CACHEW_FLUSH_L1D_L2); - l2c_fence_flush(addr); -} - -/* Used to keep memory consistent when doing DMA. */ -static inline void flush_dcache_region(void *start, unsigned long size) -{ - /* metag_data_cache_flush won't flush L2 cache lines if size >= 4096 */ - if (meta_l2c_is_enabled()) { - cachew_region_op(start, size, CACHEW_FLUSH_L1D_L2); - if (meta_l2c_is_writeback()) - l2c_fence_flush(start + size - 1); - } else { - metag_data_cache_flush(start, size); - } -} - -/* Write back dirty lines to memory (or do nothing if no writeback caches) */ -static inline void writeback_dcache_region(void *start, unsigned long size) -{ - if (meta_l2c_is_enabled() && meta_l2c_is_writeback()) { - cachew_region_op(start, size, CACHEW_WRITEBACK_L1D_L2); - l2c_fence(start + size - 1); - } -} - -/* Invalidate (may also write back if necessary) */ -static inline void invalidate_dcache_region(void *start, unsigned long size) -{ - if (meta_l2c_is_enabled()) - cachew_region_op(start, size, CACHEW_INVALIDATE_L1D_L2); - else - metag_data_cache_flush(start, size); -} -#else -#define flush_dcache_region(s, l) metag_data_cache_flush((s), (l)) -#define writeback_dcache_region(s, l) do {} while (0) -#define invalidate_dcache_region(s, l) flush_dcache_region((s), (l)) -#endif - -static inline void copy_to_user_page(struct vm_area_struct *vma, - struct page *page, unsigned long vaddr, - void *dst, const void *src, - unsigned long len) -{ - memcpy(dst, src, len); - flush_icache_range((unsigned long)dst, (unsigned long)dst + len); -} - -static inline void copy_from_user_page(struct vm_area_struct *vma, - struct page *page, unsigned long vaddr, - void *dst, const void *src, - unsigned long len) -{ - memcpy(dst, src, len); -} - -#endif /* _METAG_CACHEFLUSH_H */ diff --git a/arch/metag/include/asm/cachepart.h b/arch/metag/include/asm/cachepart.h deleted file mode 100644 index 79411e977586c..0000000000000 --- a/arch/metag/include/asm/cachepart.h +++ /dev/null @@ -1,43 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Meta cache partition manipulation. - * - * Copyright 2010 Imagination Technologies Ltd. - */ - -#ifndef _METAG_CACHEPART_H_ -#define _METAG_CACHEPART_H_ - -/** - * get_dcache_size() - Get size of data cache. - */ -unsigned int get_dcache_size(void); - -/** - * get_icache_size() - Get size of code cache. - */ -unsigned int get_icache_size(void); - -/** - * get_global_dcache_size() - Get the thread's global dcache. - * - * Returns the size of the current thread's global dcache partition. - */ -unsigned int get_global_dcache_size(void); - -/** - * get_global_icache_size() - Get the thread's global icache. - * - * Returns the size of the current thread's global icache partition. - */ -unsigned int get_global_icache_size(void); - -/** - * check_for_dache_aliasing() - Ensure that the bootloader has configured the - * dache and icache properly to avoid aliasing - * @thread_id: Hardware thread ID - * - */ -void check_for_cache_aliasing(int thread_id); - -#endif diff --git a/arch/metag/include/asm/checksum.h b/arch/metag/include/asm/checksum.h deleted file mode 100644 index 6533d14e97899..0000000000000 --- a/arch/metag/include/asm/checksum.h +++ /dev/null @@ -1,93 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _METAG_CHECKSUM_H -#define _METAG_CHECKSUM_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 - */ -extern __wsum csum_partial(const void *buff, int len, __wsum sum); - -/* - * the same as csum_partial, but copies from src while it - * checksums - * - * here even more important to align src and dst on a 32-bit (or even - * better 64-bit) boundary - */ -extern __wsum csum_partial_copy(const void *src, void *dst, int len, - __wsum sum); - -/* - * the same as csum_partial_copy, but copies from user space. - * - * here even more important to align src and dst on a 32-bit (or even - * better 64-bit) boundary - */ -extern __wsum csum_partial_copy_from_user(const void __user *src, void *dst, - int len, __wsum sum, int *csum_err); - -#define csum_partial_copy_nocheck(src, dst, len, sum) \ - csum_partial_copy((src), (dst), (len), (sum)) - -/* - * Fold a partial checksum - */ -static inline __sum16 csum_fold(__wsum csum) -{ - u32 sum = (__force u32)csum; - sum = (sum & 0xffff) + (sum >> 16); - sum = (sum & 0xffff) + (sum >> 16); - return (__force __sum16)~sum; -} - -/* - * This is a version of ip_compute_csum() optimized for IP headers, - * which always checksum on 4 octet boundaries. - */ -extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl); - -/* - * computes the checksum of the TCP/UDP pseudo-header - * returns a 16-bit checksum, already complemented - */ -static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, - __u32 len, __u8 proto, - __wsum sum) -{ - unsigned long len_proto = (proto + len) << 8; - asm ("ADDS %0, %0, %1\n" - "ADDCS %0, %0, #1\n" - "ADDS %0, %0, %2\n" - "ADDCS %0, %0, #1\n" - "ADDS %0, %0, %3\n" - "ADDCS %0, %0, #1\n" - : "=d" (sum) - : "d" (daddr), "d" (saddr), "d" (len_proto), - "0" (sum) - : "cc"); - return sum; -} - -static inline __sum16 -csum_tcpudp_magic(__be32 saddr, __be32 daddr, __u32 len, - __u8 proto, __wsum sum) -{ - return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum)); -} - -/* - * this routine is used for miscellaneous IP-like checksums, mainly - * in icmp.c - */ -extern __sum16 ip_compute_csum(const void *buff, int len); - -#endif /* _METAG_CHECKSUM_H */ diff --git a/arch/metag/include/asm/clock.h b/arch/metag/include/asm/clock.h deleted file mode 100644 index ded4ab2e1fd05..0000000000000 --- a/arch/metag/include/asm/clock.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * arch/metag/include/asm/clock.h - * - * Copyright (C) 2012 Imagination Technologies Ltd. - * - * 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. - */ - -#ifndef _METAG_CLOCK_H_ -#define _METAG_CLOCK_H_ - -#include - -/** - * struct meta_clock_desc - Meta Core clock callbacks. - * @get_core_freq: Get the frequency of the Meta core. If this is NULL, the - * core frequency will be determined like this: - * Meta 1: based on loops_per_jiffy. - * Meta 2: (EXPAND_TIMER_DIV + 1) MHz. - * If a "core" clock is provided by the device tree, it - * will override this function. - */ -struct meta_clock_desc { - unsigned long (*get_core_freq)(void); -}; - -extern struct meta_clock_desc _meta_clock; - -/* - * Perform platform clock initialisation, reading clocks from device tree etc. - * Only accessible during boot. - */ -void init_metag_clocks(void); - -/* - * Set up the default clock, ensuring all callbacks are valid - only accessible - * during boot. - */ -void setup_meta_clocks(struct meta_clock_desc *desc); - -/** - * get_coreclock() - Get the frequency of the Meta core clock. - * - * Returns: The Meta core clock frequency in Hz. - */ -static inline unsigned long get_coreclock(void) -{ - /* - * Use the current clock callback. If set correctly this will provide - * the most accurate frequency as it can be calculated directly from the - * PLL configuration. otherwise a default callback will have been set - * instead. - */ - return _meta_clock.get_core_freq(); -} - -#endif /* _METAG_CLOCK_H_ */ diff --git a/arch/metag/include/asm/cmpxchg.h b/arch/metag/include/asm/cmpxchg.h deleted file mode 100644 index 68c4ab1466fdb..0000000000000 --- a/arch/metag/include/asm/cmpxchg.h +++ /dev/null @@ -1,64 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __ASM_METAG_CMPXCHG_H -#define __ASM_METAG_CMPXCHG_H - -#include - -#if defined(CONFIG_METAG_ATOMICITY_IRQSOFF) -#include -#elif defined(CONFIG_METAG_ATOMICITY_LOCK1) -#include -#elif defined(CONFIG_METAG_ATOMICITY_LNKGET) -#include -#endif - -extern void __xchg_called_with_bad_pointer(void); - -#define __xchg(ptr, x, size) \ -({ \ - unsigned long __xchg__res; \ - volatile void *__xchg_ptr = (ptr); \ - switch (size) { \ - case 4: \ - __xchg__res = xchg_u32(__xchg_ptr, x); \ - break; \ - case 1: \ - __xchg__res = xchg_u8(__xchg_ptr, x); \ - break; \ - default: \ - __xchg_called_with_bad_pointer(); \ - __xchg__res = x; \ - break; \ - } \ - \ - __xchg__res; \ -}) - -#define xchg(ptr, x) \ - ((__typeof__(*(ptr)))__xchg((ptr), (unsigned long)(x), sizeof(*(ptr)))) - -/* This function doesn't exist, so you'll get a linker error - * if something tries to do an invalid cmpxchg(). */ -extern void __cmpxchg_called_with_bad_pointer(void); - -static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old, - unsigned long new, int size) -{ - switch (size) { - case 4: - return __cmpxchg_u32(ptr, old, new); - } - __cmpxchg_called_with_bad_pointer(); - return old; -} - -#define cmpxchg(ptr, o, n) \ - ({ \ - __typeof__(*(ptr)) _o_ = (o); \ - __typeof__(*(ptr)) _n_ = (n); \ - (__typeof__(*(ptr))) __cmpxchg((ptr), (unsigned long)_o_, \ - (unsigned long)_n_, \ - sizeof(*(ptr))); \ - }) - -#endif /* __ASM_METAG_CMPXCHG_H */ diff --git a/arch/metag/include/asm/cmpxchg_irq.h b/arch/metag/include/asm/cmpxchg_irq.h deleted file mode 100644 index 5255e37f84964..0000000000000 --- a/arch/metag/include/asm/cmpxchg_irq.h +++ /dev/null @@ -1,43 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __ASM_METAG_CMPXCHG_IRQ_H -#define __ASM_METAG_CMPXCHG_IRQ_H - -#include - -static inline unsigned long xchg_u32(volatile u32 *m, unsigned long val) -{ - unsigned long flags, retval; - - local_irq_save(flags); - retval = *m; - *m = val; - local_irq_restore(flags); - return retval; -} - -static inline unsigned long xchg_u8(volatile u8 *m, unsigned long val) -{ - unsigned long flags, retval; - - local_irq_save(flags); - retval = *m; - *m = val & 0xff; - local_irq_restore(flags); - return retval; -} - -static inline unsigned long __cmpxchg_u32(volatile int *m, unsigned long old, - unsigned long new) -{ - __u32 retval; - unsigned long flags; - - local_irq_save(flags); - retval = *m; - if (retval == old) - *m = new; - local_irq_restore(flags); /* implies memory barrier */ - return retval; -} - -#endif /* __ASM_METAG_CMPXCHG_IRQ_H */ diff --git a/arch/metag/include/asm/cmpxchg_lnkget.h b/arch/metag/include/asm/cmpxchg_lnkget.h deleted file mode 100644 index c69be00a47391..0000000000000 --- a/arch/metag/include/asm/cmpxchg_lnkget.h +++ /dev/null @@ -1,87 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __ASM_METAG_CMPXCHG_LNKGET_H -#define __ASM_METAG_CMPXCHG_LNKGET_H - -static inline unsigned long xchg_u32(volatile u32 *m, unsigned long val) -{ - int temp, old; - - smp_mb(); - - asm volatile ( - "1: LNKGETD %1, [%2]\n" - " LNKSETD [%2], %3\n" - " DEFR %0, TXSTAT\n" - " ANDT %0, %0, #HI(0x3f000000)\n" - " CMPT %0, #HI(0x02000000)\n" - " BNZ 1b\n" -#ifdef CONFIG_METAG_LNKGET_AROUND_CACHE - " DCACHE [%2], %0\n" -#endif - : "=&d" (temp), "=&d" (old) - : "da" (m), "da" (val) - : "cc" - ); - - smp_mb(); - - return old; -} - -static inline unsigned long xchg_u8(volatile u8 *m, unsigned long val) -{ - int temp, old; - - smp_mb(); - - asm volatile ( - "1: LNKGETD %1, [%2]\n" - " LNKSETD [%2], %3\n" - " DEFR %0, TXSTAT\n" - " ANDT %0, %0, #HI(0x3f000000)\n" - " CMPT %0, #HI(0x02000000)\n" - " BNZ 1b\n" -#ifdef CONFIG_METAG_LNKGET_AROUND_CACHE - " DCACHE [%2], %0\n" -#endif - : "=&d" (temp), "=&d" (old) - : "da" (m), "da" (val & 0xff) - : "cc" - ); - - smp_mb(); - - return old; -} - -static inline unsigned long __cmpxchg_u32(volatile int *m, unsigned long old, - unsigned long new) -{ - __u32 retval, temp; - - smp_mb(); - - asm volatile ( - "1: LNKGETD %1, [%2]\n" - " CMP %1, %3\n" - " LNKSETDEQ [%2], %4\n" - " BNE 2f\n" - " DEFR %0, TXSTAT\n" - " ANDT %0, %0, #HI(0x3f000000)\n" - " CMPT %0, #HI(0x02000000)\n" - " BNZ 1b\n" -#ifdef CONFIG_METAG_LNKGET_AROUND_CACHE - " DCACHE [%2], %0\n" -#endif - "2:\n" - : "=&d" (temp), "=&d" (retval) - : "da" (m), "bd" (old), "da" (new) - : "cc" - ); - - smp_mb(); - - return retval; -} - -#endif /* __ASM_METAG_CMPXCHG_LNKGET_H */ diff --git a/arch/metag/include/asm/cmpxchg_lock1.h b/arch/metag/include/asm/cmpxchg_lock1.h deleted file mode 100644 index 5976e39db2b4b..0000000000000 --- a/arch/metag/include/asm/cmpxchg_lock1.h +++ /dev/null @@ -1,49 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __ASM_METAG_CMPXCHG_LOCK1_H -#define __ASM_METAG_CMPXCHG_LOCK1_H - -#include - -/* Use LOCK2 as these have to be atomic w.r.t. ordinary accesses. */ - -static inline unsigned long xchg_u32(volatile u32 *m, unsigned long val) -{ - unsigned long flags, retval; - - __global_lock2(flags); - fence(); - retval = *m; - *m = val; - __global_unlock2(flags); - return retval; -} - -static inline unsigned long xchg_u8(volatile u8 *m, unsigned long val) -{ - unsigned long flags, retval; - - __global_lock2(flags); - fence(); - retval = *m; - *m = val & 0xff; - __global_unlock2(flags); - return retval; -} - -static inline unsigned long __cmpxchg_u32(volatile int *m, unsigned long old, - unsigned long new) -{ - __u32 retval; - unsigned long flags; - - __global_lock2(flags); - retval = *m; - if (retval == old) { - fence(); - *m = new; - } - __global_unlock2(flags); - return retval; -} - -#endif /* __ASM_METAG_CMPXCHG_LOCK1_H */ diff --git a/arch/metag/include/asm/core_reg.h b/arch/metag/include/asm/core_reg.h deleted file mode 100644 index ca70a0a29b614..0000000000000 --- a/arch/metag/include/asm/core_reg.h +++ /dev/null @@ -1,36 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __ASM_METAG_CORE_REG_H_ -#define __ASM_METAG_CORE_REG_H_ - -#include - -extern void core_reg_write(int unit, int reg, int thread, unsigned int val); -extern unsigned int core_reg_read(int unit, int reg, int thread); - -/* - * These macros allow direct access from C to any register known to the - * assembler. Example candidates are TXTACTCYC, TXIDLECYC, and TXPRIVEXT. - */ - -#define __core_reg_get(reg) ({ \ - unsigned int __grvalue; \ - asm volatile("MOV %0," #reg \ - : "=r" (__grvalue)); \ - __grvalue; \ -}) - -#define __core_reg_set(reg, value) do { \ - unsigned int __srvalue = (value); \ - asm volatile("MOV " #reg ",%0" \ - : \ - : "r" (__srvalue)); \ -} while (0) - -#define __core_reg_swap(reg, value) do { \ - unsigned int __srvalue = (value); \ - asm volatile("SWAP " #reg ",%0" \ - : "+r" (__srvalue)); \ - (value) = __srvalue; \ -} while (0) - -#endif diff --git a/arch/metag/include/asm/cpu.h b/arch/metag/include/asm/cpu.h deleted file mode 100644 index 9dac67de4748e..0000000000000 --- a/arch/metag/include/asm/cpu.h +++ /dev/null @@ -1,15 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_METAG_CPU_H -#define _ASM_METAG_CPU_H - -#include - -struct cpuinfo_metag { - struct cpu cpu; -#ifdef CONFIG_SMP - unsigned long loops_per_jiffy; -#endif -}; - -DECLARE_PER_CPU(struct cpuinfo_metag, cpu_data); -#endif /* _ASM_METAG_CPU_H */ diff --git a/arch/metag/include/asm/da.h b/arch/metag/include/asm/da.h deleted file mode 100644 index 901daa540e6e0..0000000000000 --- a/arch/metag/include/asm/da.h +++ /dev/null @@ -1,44 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Meta DA JTAG debugger control. - * - * Copyright 2012 Imagination Technologies Ltd. - */ - -#ifndef _METAG_DA_H_ -#define _METAG_DA_H_ - -#ifdef CONFIG_METAG_DA - -#include -#include - -extern bool _metag_da_present; - -/** - * metag_da_enabled() - Find whether a DA is currently enabled. - * - * Returns: true if a DA was detected, false if not. - */ -static inline bool metag_da_enabled(void) -{ - return _metag_da_present; -} - -/** - * metag_da_probe() - Try and detect a connected DA. - * - * This is used at start up to detect whether a DA is active. - * - * Returns: 0 on detection, -err otherwise. - */ -int __init metag_da_probe(void); - -#else /* !CONFIG_METAG_DA */ - -#define metag_da_enabled() false -#define metag_da_probe() do {} while (0) - -#endif - -#endif /* _METAG_DA_H_ */ diff --git a/arch/metag/include/asm/delay.h b/arch/metag/include/asm/delay.h deleted file mode 100644 index fd73d3d5d2942..0000000000000 --- a/arch/metag/include/asm/delay.h +++ /dev/null @@ -1,30 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _METAG_DELAY_H -#define _METAG_DELAY_H - -/* - * Copyright (C) 1993 Linus Torvalds - * - * Delay routines calling functions in arch/metag/lib/delay.c - */ - -/* Undefined functions to get compile-time errors */ -extern void __bad_udelay(void); -extern void __bad_ndelay(void); - -extern void __udelay(unsigned long usecs); -extern void __ndelay(unsigned long nsecs); -extern void __const_udelay(unsigned long xloops); -extern void __delay(unsigned long loops); - -/* 0x10c7 is 2**32 / 1000000 (rounded up) */ -#define udelay(n) (__builtin_constant_p(n) ? \ - ((n) > 20000 ? __bad_udelay() : __const_udelay((n) * 0x10c7ul)) : \ - __udelay(n)) - -/* 0x5 is 2**32 / 1000000000 (rounded up) */ -#define ndelay(n) (__builtin_constant_p(n) ? \ - ((n) > 20000 ? __bad_ndelay() : __const_udelay((n) * 5ul)) : \ - __ndelay(n)) - -#endif /* _METAG_DELAY_H */ diff --git a/arch/metag/include/asm/div64.h b/arch/metag/include/asm/div64.h deleted file mode 100644 index e3686d2ae20e1..0000000000000 --- a/arch/metag/include/asm/div64.h +++ /dev/null @@ -1,13 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __ASM_DIV64_H__ -#define __ASM_DIV64_H__ - -#include - -extern u64 div_u64(u64 dividend, u64 divisor); -extern s64 div_s64(s64 dividend, s64 divisor); - -#define div_u64 div_u64 -#define div_s64 div_s64 - -#endif diff --git a/arch/metag/include/asm/dma-mapping.h b/arch/metag/include/asm/dma-mapping.h deleted file mode 100644 index cfd6a0505b568..0000000000000 --- a/arch/metag/include/asm/dma-mapping.h +++ /dev/null @@ -1,12 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_METAG_DMA_MAPPING_H -#define _ASM_METAG_DMA_MAPPING_H - -extern const struct dma_map_ops metag_dma_ops; - -static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) -{ - return &metag_dma_ops; -} - -#endif diff --git a/arch/metag/include/asm/elf.h b/arch/metag/include/asm/elf.h deleted file mode 100644 index a6c33800ba662..0000000000000 --- a/arch/metag/include/asm/elf.h +++ /dev/null @@ -1,126 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __ASM_METAG_ELF_H -#define __ASM_METAG_ELF_H - -#define EM_METAG 174 - -/* Meta relocations */ -#define R_METAG_HIADDR16 0 -#define R_METAG_LOADDR16 1 -#define R_METAG_ADDR32 2 -#define R_METAG_NONE 3 -#define R_METAG_RELBRANCH 4 -#define R_METAG_GETSETOFF 5 - -/* Backward compatibility */ -#define R_METAG_REG32OP1 6 -#define R_METAG_REG32OP2 7 -#define R_METAG_REG32OP3 8 -#define R_METAG_REG16OP1 9 -#define R_METAG_REG16OP2 10 -#define R_METAG_REG16OP3 11 -#define R_METAG_REG32OP4 12 - -#define R_METAG_HIOG 13 -#define R_METAG_LOOG 14 - -/* GNU */ -#define R_METAG_GNU_VTINHERIT 30 -#define R_METAG_GNU_VTENTRY 31 - -/* PIC relocations */ -#define R_METAG_HI16_GOTOFF 32 -#define R_METAG_LO16_GOTOFF 33 -#define R_METAG_GETSET_GOTOFF 34 -#define R_METAG_GETSET_GOT 35 -#define R_METAG_HI16_GOTPC 36 -#define R_METAG_LO16_GOTPC 37 -#define R_METAG_HI16_PLT 38 -#define R_METAG_LO16_PLT 39 -#define R_METAG_RELBRANCH_PLT 40 -#define R_METAG_GOTOFF 41 -#define R_METAG_PLT 42 -#define R_METAG_COPY 43 -#define R_METAG_JMP_SLOT 44 -#define R_METAG_RELATIVE 45 -#define R_METAG_GLOB_DAT 46 - -/* - * ELF register definitions. - */ - -#include -#include -#include -#include - -typedef unsigned long elf_greg_t; - -#define ELF_NGREG (sizeof(struct user_gp_regs) / sizeof(elf_greg_t)) -typedef elf_greg_t elf_gregset_t[ELF_NGREG]; - -typedef unsigned long elf_fpregset_t; - -/* - * This is used to ensure we don't load something for the wrong architecture. - */ -#define elf_check_arch(x) ((x)->e_machine == EM_METAG) - -/* - * These are used to set parameters in the core dumps. - */ -#define ELF_CLASS ELFCLASS32 -#define ELF_DATA ELFDATA2LSB -#define ELF_ARCH EM_METAG - -#define ELF_PLAT_INIT(_r, load_addr) \ - do { _r->ctx.AX[0].U0 = 0; } while (0) - -#define USE_ELF_CORE_DUMP -#define CORE_DUMP_USE_REGSET -#define ELF_EXEC_PAGESIZE PAGE_SIZE - -/* This is the location that an ET_DYN program is loaded if exec'ed. Typical - use of this is to invoke "./ld.so someprog" to test out a new version of - the loader. We need to make sure that it is out of the way of the program - that it will "exec", and that there is sufficient room for the brk. */ - -#define ELF_ET_DYN_BASE 0x08000000UL - -#define ELF_CORE_COPY_REGS(_dest, _regs) \ - memcpy((char *)&_dest, (char *)_regs, sizeof(struct pt_regs)); - -/* This yields a mask that user programs can use to figure out what - instruction set this cpu supports. */ - -#define ELF_HWCAP (0) - -/* This yields a string that ld.so will use to load implementation - specific libraries for optimization. This is more specific in - intent than poking at uname or /proc/cpuinfo. */ - -#define ELF_PLATFORM (NULL) - -#define STACK_RND_MASK (0) - -#ifdef CONFIG_METAG_USER_TCM - -struct elf32_phdr; -struct file; - -unsigned long __metag_elf_map(struct file *filep, unsigned long addr, - struct elf32_phdr *eppnt, int prot, int type, - unsigned long total_size); - -static inline unsigned long metag_elf_map(struct file *filep, - unsigned long addr, - struct elf32_phdr *eppnt, int prot, - int type, unsigned long total_size) -{ - return __metag_elf_map(filep, addr, eppnt, prot, type, total_size); -} -#define elf_map metag_elf_map - -#endif - -#endif diff --git a/arch/metag/include/asm/fixmap.h b/arch/metag/include/asm/fixmap.h deleted file mode 100644 index af621b041739a..0000000000000 --- a/arch/metag/include/asm/fixmap.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * fixmap.h: compile-time virtual memory allocation - * - * This file is subject to 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) 1998 Ingo Molnar - * - * Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999 - */ - -#ifndef _ASM_FIXMAP_H -#define _ASM_FIXMAP_H - -#include -#ifdef CONFIG_HIGHMEM -#include -#include -#endif - -/* - * Here we define all the compile-time 'special' virtual - * addresses. The point is to have a constant address at - * compile time, but to set the physical address only - * in the boot process. We allocate these special addresses - * from the end of the consistent memory region backwards. - * Also this lets us do fail-safe vmalloc(), we - * can guarantee that these special addresses and - * vmalloc()-ed addresses never overlap. - * - * these 'compile-time allocated' memory buffers are - * fixed-size 4k pages. (or larger if used with an increment - * higher than 1) use fixmap_set(idx,phys) to associate - * physical memory with fixmap indices. - * - * TLB entries of such buffers will not be flushed across - * task switches. - */ -enum fixed_addresses { -#define FIX_N_COLOURS 8 -#ifdef CONFIG_HIGHMEM - /* reserved pte's for temporary kernel mappings */ - FIX_KMAP_BEGIN, - FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1, -#endif - __end_of_fixed_addresses -}; - -#define FIXADDR_TOP (CONSISTENT_START - PAGE_SIZE) -#define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) -#define FIXADDR_START ((FIXADDR_TOP - FIXADDR_SIZE) & PMD_MASK) - -#include - -#define kmap_get_fixmap_pte(vaddr) \ - pte_offset_kernel( \ - pmd_offset(pud_offset(pgd_offset_k(vaddr), (vaddr)), (vaddr)), \ - (vaddr) \ - ) - -/* - * Called from pgtable_init() - */ -extern void fixrange_init(unsigned long start, unsigned long end, - pgd_t *pgd_base); - - -#endif diff --git a/arch/metag/include/asm/ftrace.h b/arch/metag/include/asm/ftrace.h deleted file mode 100644 index b1c8c76fb7720..0000000000000 --- a/arch/metag/include/asm/ftrace.h +++ /dev/null @@ -1,24 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_METAG_FTRACE -#define _ASM_METAG_FTRACE - -#ifdef CONFIG_FUNCTION_TRACER -#define MCOUNT_INSN_SIZE 8 /* sizeof mcount call */ - -#ifndef __ASSEMBLY__ -extern void mcount_wrapper(void); -#define MCOUNT_ADDR ((unsigned long)(mcount_wrapper)) - -static inline unsigned long ftrace_call_adjust(unsigned long addr) -{ - return addr; -} - -struct dyn_arch_ftrace { - /* No extra data needed on metag */ -}; -#endif /* __ASSEMBLY__ */ - -#endif /* CONFIG_FUNCTION_TRACER */ - -#endif /* _ASM_METAG_FTRACE */ diff --git a/arch/metag/include/asm/global_lock.h b/arch/metag/include/asm/global_lock.h deleted file mode 100644 index 4d3da9682233f..0000000000000 --- a/arch/metag/include/asm/global_lock.h +++ /dev/null @@ -1,101 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __ASM_METAG_GLOBAL_LOCK_H -#define __ASM_METAG_GLOBAL_LOCK_H - -#include - -/** - * __global_lock1() - Acquire global voluntary lock (LOCK1). - * @flags: Variable to store flags into. - * - * Acquires the Meta global voluntary lock (LOCK1), also taking care to disable - * all triggers so we cannot be interrupted, and to enforce a compiler barrier - * so that the compiler cannot reorder memory accesses across the lock. - * - * No other hardware thread will be able to acquire the voluntary or exclusive - * locks until the voluntary lock is released with @__global_unlock1, but they - * may continue to execute as long as they aren't trying to acquire either of - * the locks. - */ -#define __global_lock1(flags) do { \ - unsigned int __trval; \ - asm volatile("MOV %0,#0\n\t" \ - "SWAP %0,TXMASKI\n\t" \ - "LOCK1" \ - : "=r" (__trval) \ - : \ - : "memory"); \ - (flags) = __trval; \ -} while (0) - -/** - * __global_unlock1() - Release global voluntary lock (LOCK1). - * @flags: Variable to restore flags from. - * - * Releases the Meta global voluntary lock (LOCK1) acquired with - * @__global_lock1, also taking care to re-enable triggers, and to enforce a - * compiler barrier so that the compiler cannot reorder memory accesses across - * the unlock. - * - * This immediately allows another hardware thread to acquire the voluntary or - * exclusive locks. - */ -#define __global_unlock1(flags) do { \ - unsigned int __trval = (flags); \ - asm volatile("LOCK0\n\t" \ - "MOV TXMASKI,%0" \ - : \ - : "r" (__trval) \ - : "memory"); \ -} while (0) - -/** - * __global_lock2() - Acquire global exclusive lock (LOCK2). - * @flags: Variable to store flags into. - * - * Acquires the Meta global voluntary lock and global exclusive lock (LOCK2), - * also taking care to disable all triggers so we cannot be interrupted, to take - * the atomic lock (system event) and to enforce a compiler barrier so that the - * compiler cannot reorder memory accesses across the lock. - * - * No other hardware thread will be able to execute code until the locks are - * released with @__global_unlock2. - */ -#define __global_lock2(flags) do { \ - unsigned int __trval; \ - unsigned int __aloc_hi = LINSYSEVENT_WR_ATOMIC_LOCK & 0xFFFF0000; \ - asm volatile("MOV %0,#0\n\t" \ - "SWAP %0,TXMASKI\n\t" \ - "LOCK2\n\t" \ - "SETD [%1+#0x40],D1RtP" \ - : "=r&" (__trval) \ - : "u" (__aloc_hi) \ - : "memory"); \ - (flags) = __trval; \ -} while (0) - -/** - * __global_unlock2() - Release global exclusive lock (LOCK2). - * @flags: Variable to restore flags from. - * - * Releases the Meta global exclusive lock (LOCK2) and global voluntary lock - * acquired with @__global_lock2, also taking care to release the atomic lock - * (system event), re-enable triggers, and to enforce a compiler barrier so that - * the compiler cannot reorder memory accesses across the unlock. - * - * This immediately allows other hardware threads to continue executing and one - * of them to acquire locks. - */ -#define __global_unlock2(flags) do { \ - unsigned int __trval = (flags); \ - unsigned int __alock_hi = LINSYSEVENT_WR_ATOMIC_LOCK & 0xFFFF0000; \ - asm volatile("SETD [%1+#0x00],D1RtP\n\t" \ - "LOCK0\n\t" \ - "MOV TXMASKI,%0" \ - : \ - : "r" (__trval), \ - "u" (__alock_hi) \ - : "memory"); \ -} while (0) - -#endif /* __ASM_METAG_GLOBAL_LOCK_H */ diff --git a/arch/metag/include/asm/highmem.h b/arch/metag/include/asm/highmem.h deleted file mode 100644 index 8b0dfd684e153..0000000000000 --- a/arch/metag/include/asm/highmem.h +++ /dev/null @@ -1,62 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_HIGHMEM_H -#define _ASM_HIGHMEM_H - -#include -#include -#include - -/* - * Right now we initialize only a single pte table. It can be extended - * easily, subsequent pte tables have to be allocated in one physical - * chunk of RAM. - */ -/* - * Ordering is (from lower to higher memory addresses): - * - * high_memory - * Persistent kmap area - * PKMAP_BASE - * fixed_addresses - * FIXADDR_START - * FIXADDR_TOP - * Vmalloc area - * VMALLOC_START - * VMALLOC_END - */ -#define PKMAP_BASE (FIXADDR_START - PMD_SIZE) -#define LAST_PKMAP PTRS_PER_PTE -#define LAST_PKMAP_MASK (LAST_PKMAP - 1) -#define PKMAP_NR(virt) (((virt) - PKMAP_BASE) >> PAGE_SHIFT) -#define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT)) - -#define kmap_prot PAGE_KERNEL - -static inline void flush_cache_kmaps(void) -{ - flush_cache_all(); -} - -/* declarations for highmem.c */ -extern unsigned long highstart_pfn, highend_pfn; - -extern pte_t *pkmap_page_table; - -extern void *kmap_high(struct page *page); -extern void kunmap_high(struct page *page); - -extern void kmap_init(void); - -/* - * The following functions are already defined by - * when CONFIG_HIGHMEM is not set. - */ -#ifdef CONFIG_HIGHMEM -extern void *kmap(struct page *page); -extern void kunmap(struct page *page); -extern void *kmap_atomic(struct page *page); -extern void __kunmap_atomic(void *kvaddr); -extern void *kmap_atomic_pfn(unsigned long pfn); -#endif - -#endif diff --git a/arch/metag/include/asm/hugetlb.h b/arch/metag/include/asm/hugetlb.h deleted file mode 100644 index 1607363d26395..0000000000000 --- a/arch/metag/include/asm/hugetlb.h +++ /dev/null @@ -1,75 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_METAG_HUGETLB_H -#define _ASM_METAG_HUGETLB_H - -#include -#include - - -static inline int is_hugepage_only_range(struct mm_struct *mm, - unsigned long addr, - unsigned long len) { - return 0; -} - -int prepare_hugepage_range(struct file *file, unsigned long addr, - unsigned long len); - -static inline void hugetlb_free_pgd_range(struct mmu_gather *tlb, - unsigned long addr, unsigned long end, - unsigned long floor, - unsigned long ceiling) -{ - free_pgd_range(tlb, addr, end, floor, ceiling); -} - -static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, - pte_t *ptep, pte_t pte) -{ - set_pte_at(mm, addr, ptep, pte); -} - -static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm, - unsigned long addr, pte_t *ptep) -{ - return ptep_get_and_clear(mm, addr, ptep); -} - -static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, - unsigned long addr, pte_t *ptep) -{ -} - -static inline int huge_pte_none(pte_t pte) -{ - return pte_none(pte); -} - -static inline pte_t huge_pte_wrprotect(pte_t pte) -{ - return pte_wrprotect(pte); -} - -static inline void huge_ptep_set_wrprotect(struct mm_struct *mm, - unsigned long addr, pte_t *ptep) -{ - ptep_set_wrprotect(mm, addr, ptep); -} - -static inline int huge_ptep_set_access_flags(struct vm_area_struct *vma, - unsigned long addr, pte_t *ptep, - pte_t pte, int dirty) -{ - return ptep_set_access_flags(vma, addr, ptep, pte, dirty); -} - -static inline pte_t huge_ptep_get(pte_t *ptep) -{ - return *ptep; -} - -static inline void arch_clear_hugepage_flags(struct page *page) -{ -} - -#endif /* _ASM_METAG_HUGETLB_H */ diff --git a/arch/metag/include/asm/hwthread.h b/arch/metag/include/asm/hwthread.h deleted file mode 100644 index 8d2171da5414e..0000000000000 --- a/arch/metag/include/asm/hwthread.h +++ /dev/null @@ -1,41 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Copyright (C) 2008 Imagination Technologies - */ -#ifndef __METAG_HWTHREAD_H -#define __METAG_HWTHREAD_H - -#include -#include - -#include - -#define BAD_HWTHREAD_ID (0xFFU) -#define BAD_CPU_ID (0xFFU) - -extern u8 cpu_2_hwthread_id[]; -extern u8 hwthread_id_2_cpu[]; - -/* - * Each hardware thread's Control Unit registers are memory-mapped - * and can therefore be accessed by any other hardware thread. - * - * This helper function returns the memory address where "thread"'s - * register "regnum" is mapped. - */ -static inline -void __iomem *__CU_addr(unsigned int thread, unsigned int regnum) -{ - unsigned int base, thread_offset, thread_regnum; - - WARN_ON(thread == BAD_HWTHREAD_ID); - - base = T0UCTREG0; /* Control unit base */ - - thread_offset = TnUCTRX_STRIDE * thread; - thread_regnum = TXUCTREGn_STRIDE * regnum; - - return (void __iomem *)(base + thread_offset + thread_regnum); -} - -#endif /* __METAG_HWTHREAD_H */ diff --git a/arch/metag/include/asm/io.h b/arch/metag/include/asm/io.h deleted file mode 100644 index 71cd2bc547181..0000000000000 --- a/arch/metag/include/asm/io.h +++ /dev/null @@ -1,170 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_METAG_IO_H -#define _ASM_METAG_IO_H - -#include -#include - -#define IO_SPACE_LIMIT 0 - -#define page_to_bus page_to_phys -#define bus_to_page phys_to_page - -/* - * Generic I/O - */ - -#define __raw_readb __raw_readb -static inline u8 __raw_readb(const volatile void __iomem *addr) -{ - u8 ret; - asm volatile("GETB %0,[%1]" - : "=da" (ret) - : "da" (addr) - : "memory"); - return ret; -} - -#define __raw_readw __raw_readw -static inline u16 __raw_readw(const volatile void __iomem *addr) -{ - u16 ret; - asm volatile("GETW %0,[%1]" - : "=da" (ret) - : "da" (addr) - : "memory"); - return ret; -} - -#define __raw_readl __raw_readl -static inline u32 __raw_readl(const volatile void __iomem *addr) -{ - u32 ret; - asm volatile("GETD %0,[%1]" - : "=da" (ret) - : "da" (addr) - : "memory"); - return ret; -} - -#define __raw_readq __raw_readq -static inline u64 __raw_readq(const volatile void __iomem *addr) -{ - u64 ret; - asm volatile("GETL %0,%t0,[%1]" - : "=da" (ret) - : "da" (addr) - : "memory"); - return ret; -} - -#define __raw_writeb __raw_writeb -static inline void __raw_writeb(u8 b, volatile void __iomem *addr) -{ - asm volatile("SETB [%0],%1" - : - : "da" (addr), - "da" (b) - : "memory"); -} - -#define __raw_writew __raw_writew -static inline void __raw_writew(u16 b, volatile void __iomem *addr) -{ - asm volatile("SETW [%0],%1" - : - : "da" (addr), - "da" (b) - : "memory"); -} - -#define __raw_writel __raw_writel -static inline void __raw_writel(u32 b, volatile void __iomem *addr) -{ - asm volatile("SETD [%0],%1" - : - : "da" (addr), - "da" (b) - : "memory"); -} - -#define __raw_writeq __raw_writeq -static inline void __raw_writeq(u64 b, volatile void __iomem *addr) -{ - asm volatile("SETL [%0],%1,%t1" - : - : "da" (addr), - "da" (b) - : "memory"); -} - -/* - * The generic io.h can define all the other generic accessors - */ - -#include - -/* - * Despite being a 32bit architecture, Meta can do 64bit memory accesses - * (assuming the bus supports it). - */ - -#define readq __raw_readq -#define writeq __raw_writeq - -/* - * Meta specific I/O for accessing non-MMU areas. - * - * These can be provided with a physical address rather than an __iomem pointer - * and should only be used by core architecture code for accessing fixed core - * registers. Generic drivers should use ioremap and the generic I/O accessors. - */ - -#define metag_in8(addr) __raw_readb((volatile void __iomem *)(addr)) -#define metag_in16(addr) __raw_readw((volatile void __iomem *)(addr)) -#define metag_in32(addr) __raw_readl((volatile void __iomem *)(addr)) -#define metag_in64(addr) __raw_readq((volatile void __iomem *)(addr)) - -#define metag_out8(b, addr) __raw_writeb(b, (volatile void __iomem *)(addr)) -#define metag_out16(b, addr) __raw_writew(b, (volatile void __iomem *)(addr)) -#define metag_out32(b, addr) __raw_writel(b, (volatile void __iomem *)(addr)) -#define metag_out64(b, addr) __raw_writeq(b, (volatile void __iomem *)(addr)) - -/* - * io remapping functions - */ - -extern void __iomem *__ioremap(unsigned long offset, - size_t size, unsigned long flags); -extern void __iounmap(void __iomem *addr); - -/** - * ioremap - map bus memory into CPU space - * @offset: bus address of the memory - * @size: size of the resource to map - * - * ioremap performs a platform specific sequence of operations to - * make bus memory CPU accessible via the readb/readw/readl/writeb/ - * writew/writel functions and the other mmio helpers. The returned - * address is not guaranteed to be usable directly as a virtual - * address. - */ -#define ioremap(offset, size) \ - __ioremap((offset), (size), 0) - -#define ioremap_nocache(offset, size) \ - __ioremap((offset), (size), 0) - -#define ioremap_cached(offset, size) \ - __ioremap((offset), (size), _PAGE_CACHEABLE) - -#define ioremap_wc(offset, size) \ - __ioremap((offset), (size), _PAGE_WR_COMBINE) - -#define ioremap_wt(offset, size) \ - __ioremap((offset), (size), 0) - -#define iounmap(addr) \ - __iounmap(addr) - -#endif /* _ASM_METAG_IO_H */ diff --git a/arch/metag/include/asm/irq.h b/arch/metag/include/asm/irq.h deleted file mode 100644 index cb02c29935a4d..0000000000000 --- a/arch/metag/include/asm/irq.h +++ /dev/null @@ -1,38 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __ASM_METAG_IRQ_H -#define __ASM_METAG_IRQ_H - -#ifdef CONFIG_4KSTACKS -extern void irq_ctx_init(int cpu); -extern void irq_ctx_exit(int cpu); -# define __ARCH_HAS_DO_SOFTIRQ -#else -static inline void irq_ctx_init(int cpu) -{ -} -static inline void irq_ctx_exit(int cpu) -{ -} -#endif - -void tbi_startup_interrupt(int); -void tbi_shutdown_interrupt(int); - -struct pt_regs; - -int tbisig_map(unsigned int hw); -extern void do_IRQ(int irq, struct pt_regs *regs); -extern void init_IRQ(void); - -#ifdef CONFIG_METAG_SUSPEND_MEM -int traps_save_context(void); -int traps_restore_context(void); -#endif - -#include - -#ifdef CONFIG_HOTPLUG_CPU -extern void migrate_irqs(void); -#endif - -#endif /* __ASM_METAG_IRQ_H */ diff --git a/arch/metag/include/asm/irqflags.h b/arch/metag/include/asm/irqflags.h deleted file mode 100644 index e2fe34acb93b9..0000000000000 --- a/arch/metag/include/asm/irqflags.h +++ /dev/null @@ -1,94 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * IRQ flags handling - * - * This file gets included from lowlevel asm headers too, to provide - * wrapped versions of the local_irq_*() APIs, based on the - * raw_local_irq_*() functions from the lowlevel headers. - */ -#ifndef _ASM_IRQFLAGS_H -#define _ASM_IRQFLAGS_H - -#ifndef __ASSEMBLY__ - -#include -#include - -#define INTS_OFF_MASK TXSTATI_BGNDHALT_BIT - -#ifdef CONFIG_SMP -extern unsigned int get_trigger_mask(void); -#else - -extern unsigned int global_trigger_mask; - -static inline unsigned int get_trigger_mask(void) -{ - return global_trigger_mask; -} -#endif - -static inline unsigned long arch_local_save_flags(void) -{ - return __core_reg_get(TXMASKI); -} - -static inline int arch_irqs_disabled_flags(unsigned long flags) -{ - return (flags & ~INTS_OFF_MASK) == 0; -} - -static inline int arch_irqs_disabled(void) -{ - unsigned long flags = arch_local_save_flags(); - - return arch_irqs_disabled_flags(flags); -} - -static inline unsigned long __irqs_disabled(void) -{ - /* - * We shouldn't enable exceptions if they are not already - * enabled. This is required for chancalls to work correctly. - */ - return arch_local_save_flags() & INTS_OFF_MASK; -} - -/* - * For spinlocks, etc: - */ -static inline unsigned long arch_local_irq_save(void) -{ - unsigned long flags = __irqs_disabled(); - - asm volatile("SWAP %0,TXMASKI\n" : "=r" (flags) : "0" (flags) - : "memory"); - - return flags; -} - -static inline void arch_local_irq_restore(unsigned long flags) -{ - asm volatile("MOV TXMASKI,%0\n" : : "r" (flags) : "memory"); -} - -static inline void arch_local_irq_disable(void) -{ - unsigned long flags = __irqs_disabled(); - - asm volatile("MOV TXMASKI,%0\n" : : "r" (flags) : "memory"); -} - -#ifdef CONFIG_SMP -/* Avoid circular include dependencies through */ -void arch_local_irq_enable(void); -#else -static inline void arch_local_irq_enable(void) -{ - arch_local_irq_restore(get_trigger_mask()); -} -#endif - -#endif /* (__ASSEMBLY__) */ - -#endif /* !(_ASM_IRQFLAGS_H) */ diff --git a/arch/metag/include/asm/l2cache.h b/arch/metag/include/asm/l2cache.h deleted file mode 100644 index f260b158b8fea..0000000000000 --- a/arch/metag/include/asm/l2cache.h +++ /dev/null @@ -1,259 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _METAG_L2CACHE_H -#define _METAG_L2CACHE_H - -#ifdef CONFIG_METAG_L2C - -#include -#include - -/* - * Store the last known value of pfenable (we don't want prefetch enabled while - * L2 is off). - */ -extern int l2c_pfenable; - -/* defined in arch/metag/drivers/core-sysfs.c */ -extern struct sysdev_class cache_sysclass; - -static inline void wr_fence(void); - -/* - * Functions for reading of L2 cache configuration. - */ - -/* Get raw L2 config register (CORE_CONFIG3) */ -static inline unsigned int meta_l2c_config(void) -{ - const unsigned int *corecfg3 = (const unsigned int *)METAC_CORE_CONFIG3; - return *corecfg3; -} - -/* Get whether the L2 is present */ -static inline int meta_l2c_is_present(void) -{ - return meta_l2c_config() & METAC_CORECFG3_L2C_HAVE_L2C_BIT; -} - -/* Get whether the L2 is configured for write-back instead of write-through */ -static inline int meta_l2c_is_writeback(void) -{ - return meta_l2c_config() & METAC_CORECFG3_L2C_MODE_BIT; -} - -/* Get whether the L2 is unified instead of separated code/data */ -static inline int meta_l2c_is_unified(void) -{ - return meta_l2c_config() & METAC_CORECFG3_L2C_UNIFIED_BIT; -} - -/* Get the L2 cache size in bytes */ -static inline unsigned int meta_l2c_size(void) -{ - unsigned int size_s; - if (!meta_l2c_is_present()) - return 0; - size_s = (meta_l2c_config() & METAC_CORECFG3_L2C_SIZE_BITS) - >> METAC_CORECFG3_L2C_SIZE_S; - /* L2CSIZE is in KiB */ - return 1024 << size_s; -} - -/* Get the number of ways in the L2 cache */ -static inline unsigned int meta_l2c_ways(void) -{ - unsigned int ways_s; - if (!meta_l2c_is_present()) - return 0; - ways_s = (meta_l2c_config() & METAC_CORECFG3_L2C_NUM_WAYS_BITS) - >> METAC_CORECFG3_L2C_NUM_WAYS_S; - return 0x1 << ways_s; -} - -/* Get the line size of the L2 cache */ -static inline unsigned int meta_l2c_linesize(void) -{ - unsigned int line_size; - if (!meta_l2c_is_present()) - return 0; - line_size = (meta_l2c_config() & METAC_CORECFG3_L2C_LINE_SIZE_BITS) - >> METAC_CORECFG3_L2C_LINE_SIZE_S; - switch (line_size) { - case METAC_CORECFG3_L2C_LINE_SIZE_64B: - return 64; - default: - return 0; - } -} - -/* Get the revision ID of the L2 cache */ -static inline unsigned int meta_l2c_revision(void) -{ - return (meta_l2c_config() & METAC_CORECFG3_L2C_REV_ID_BITS) - >> METAC_CORECFG3_L2C_REV_ID_S; -} - - -/* - * Start an initialisation of the L2 cachelines and wait for completion. - * This should only be done in a LOCK1 or LOCK2 critical section while the L2 - * is disabled. - */ -static inline void _meta_l2c_init(void) -{ - metag_out32(SYSC_L2C_INIT_INIT, SYSC_L2C_INIT); - while (metag_in32(SYSC_L2C_INIT) == SYSC_L2C_INIT_IN_PROGRESS) - /* do nothing */; -} - -/* - * Start a writeback of dirty L2 cachelines and wait for completion. - * This should only be done in a LOCK1 or LOCK2 critical section. - */ -static inline void _meta_l2c_purge(void) -{ - metag_out32(SYSC_L2C_PURGE_PURGE, SYSC_L2C_PURGE); - while (metag_in32(SYSC_L2C_PURGE) == SYSC_L2C_PURGE_IN_PROGRESS) - /* do nothing */; -} - -/* Set whether the L2 cache is enabled. */ -static inline void _meta_l2c_enable(int enabled) -{ - unsigned int enable; - - enable = metag_in32(SYSC_L2C_ENABLE); - if (enabled) - enable |= SYSC_L2C_ENABLE_ENABLE_BIT; - else - enable &= ~SYSC_L2C_ENABLE_ENABLE_BIT; - metag_out32(enable, SYSC_L2C_ENABLE); -} - -/* Set whether the L2 cache prefetch is enabled. */ -static inline void _meta_l2c_pf_enable(int pfenabled) -{ - unsigned int enable; - - enable = metag_in32(SYSC_L2C_ENABLE); - if (pfenabled) - enable |= SYSC_L2C_ENABLE_PFENABLE_BIT; - else - enable &= ~SYSC_L2C_ENABLE_PFENABLE_BIT; - metag_out32(enable, SYSC_L2C_ENABLE); -} - -/* Return whether the L2 cache is enabled */ -static inline int _meta_l2c_is_enabled(void) -{ - return metag_in32(SYSC_L2C_ENABLE) & SYSC_L2C_ENABLE_ENABLE_BIT; -} - -/* Return whether the L2 cache prefetch is enabled */ -static inline int _meta_l2c_pf_is_enabled(void) -{ - return metag_in32(SYSC_L2C_ENABLE) & SYSC_L2C_ENABLE_PFENABLE_BIT; -} - - -/* Return whether the L2 cache is enabled */ -static inline int meta_l2c_is_enabled(void) -{ - int en; - - /* - * There is no need to lock at the moment, as the enable bit is never - * intermediately changed, so we will never see an intermediate result. - */ - en = _meta_l2c_is_enabled(); - - return en; -} - -/* - * Ensure the L2 cache is disabled. - * Return whether the L2 was previously disabled. - */ -int meta_l2c_disable(void); - -/* - * Ensure the L2 cache is enabled. - * Return whether the L2 was previously enabled. - */ -int meta_l2c_enable(void); - -/* Return whether the L2 cache prefetch is enabled */ -static inline int meta_l2c_pf_is_enabled(void) -{ - return l2c_pfenable; -} - -/* - * Set whether the L2 cache prefetch is enabled. - * Return whether the L2 prefetch was previously enabled. - */ -int meta_l2c_pf_enable(int pfenable); - -/* - * Flush the L2 cache. - * Return 1 if the L2 is disabled. - */ -int meta_l2c_flush(void); - -/* - * Write back all dirty cache lines in the L2 cache. - * Return 1 if the L2 is disabled or there isn't any writeback. - */ -static inline int meta_l2c_writeback(void) -{ - unsigned long flags; - int en; - - /* no need to purge if it's not a writeback cache */ - if (!meta_l2c_is_writeback()) - return 1; - - /* - * Purge only works if the L2 is enabled, and involves reading back to - * detect completion, so keep this operation atomic with other threads. - */ - __global_lock1(flags); - en = meta_l2c_is_enabled(); - if (likely(en)) { - wr_fence(); - _meta_l2c_purge(); - } - __global_unlock1(flags); - - return !en; -} - -#else /* CONFIG_METAG_L2C */ - -#define meta_l2c_config() 0 -#define meta_l2c_is_present() 0 -#define meta_l2c_is_writeback() 0 -#define meta_l2c_is_unified() 0 -#define meta_l2c_size() 0 -#define meta_l2c_ways() 0 -#define meta_l2c_linesize() 0 -#define meta_l2c_revision() 0 - -#define meta_l2c_is_enabled() 0 -#define _meta_l2c_pf_is_enabled() 0 -#define meta_l2c_pf_is_enabled() 0 -#define meta_l2c_disable() 1 -#define meta_l2c_enable() 0 -#define meta_l2c_pf_enable(X) 0 -static inline int meta_l2c_flush(void) -{ - return 1; -} -static inline int meta_l2c_writeback(void) -{ - return 1; -} - -#endif /* CONFIG_METAG_L2C */ - -#endif /* _METAG_L2CACHE_H */ diff --git a/arch/metag/include/asm/linkage.h b/arch/metag/include/asm/linkage.h deleted file mode 100644 index 3a9024ecb827e..0000000000000 --- a/arch/metag/include/asm/linkage.h +++ /dev/null @@ -1,8 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __ASM_LINKAGE_H -#define __ASM_LINKAGE_H - -#define __ALIGN .p2align 2 -#define __ALIGN_STR ".p2align 2" - -#endif diff --git a/arch/metag/include/asm/mach/arch.h b/arch/metag/include/asm/mach/arch.h deleted file mode 100644 index 433f94624fa25..0000000000000 --- a/arch/metag/include/asm/mach/arch.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * arch/metag/include/asm/mach/arch.h - * - * Copyright (C) 2012 Imagination Technologies Ltd. - * - * based on the ARM version: - * Copyright (C) 2000 Russell King - * - * 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. - */ - -#ifndef _METAG_MACH_ARCH_H_ -#define _METAG_MACH_ARCH_H_ - -#include - -#include - -/** - * struct machine_desc - Describes a board controlled by a Meta. - * @name: Board/SoC name. - * @dt_compat: Array of device tree 'compatible' strings. - * @clocks: Clock callbacks. - * - * @nr_irqs: Maximum number of IRQs. - * If 0, defaults to NR_IRQS in asm-generic/irq.h. - * - * @init_early: Early init callback. - * @init_irq: IRQ init callback for setting up IRQ controllers. - * @init_machine: Arch init callback for setting up devices. - * @init_late: Late init callback. - * - * This structure is provided by each board which can be controlled by a Meta. - * It is chosen by matching the compatible strings in the device tree provided - * by the bootloader with the strings in @dt_compat, and sets up any aspects of - * the machine that aren't configured with device tree (yet). - */ -struct machine_desc { - const char *name; - const char **dt_compat; - struct meta_clock_desc *clocks; - - unsigned int nr_irqs; - - void (*init_early)(void); - void (*init_irq)(void); - void (*init_machine)(void); - void (*init_late)(void); -}; - -/* - * Current machine - only accessible during boot. - */ -extern const struct machine_desc *machine_desc; - -/* - * Machine type table - also only accessible during boot - */ -extern struct machine_desc __arch_info_begin[], __arch_info_end[]; -#define for_each_machine_desc(p) \ - for (p = __arch_info_begin; p < __arch_info_end; p++) - -static inline struct machine_desc *default_machine_desc(void) -{ - /* the default machine is the last one linked in */ - if (__arch_info_end - 1 < __arch_info_begin) - return NULL; - return __arch_info_end - 1; -} - -/* - * Set of macros to define architecture features. This is built into - * a table by the linker. - */ -#define MACHINE_START(_type, _name) \ -static const struct machine_desc __mach_desc_##_type \ -__used \ -__attribute__((__section__(".arch.info.init"))) = { \ - .name = _name, - -#define MACHINE_END \ -}; - -#endif /* _METAG_MACH_ARCH_H_ */ diff --git a/arch/metag/include/asm/metag_isa.h b/arch/metag/include/asm/metag_isa.h deleted file mode 100644 index c8aa2ae3899f4..0000000000000 --- a/arch/metag/include/asm/metag_isa.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * asm/metag_isa.h - * - * Copyright (C) 2000-2007, 2012 Imagination Technologies. - * - * 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. - * - * Various defines for Meta instruction set. - */ - -#ifndef _ASM_METAG_ISA_H_ -#define _ASM_METAG_ISA_H_ - - -/* L1 cache layout */ - -/* Data cache line size as bytes and shift */ -#define DCACHE_LINE_BYTES 64 -#define DCACHE_LINE_S 6 - -/* Number of ways in the data cache */ -#define DCACHE_WAYS 4 - -/* Instruction cache line size as bytes and shift */ -#define ICACHE_LINE_BYTES 64 -#define ICACHE_LINE_S 6 - -/* Number of ways in the instruction cache */ -#define ICACHE_WAYS 4 - - -/* - * CACHEWD/CACHEWL instructions use the bottom 8 bits of the data presented to - * control the operation actually achieved. - */ -/* Use of these two bits should be discouraged since the bits dont have - * consistent meanings - */ -#define CACHEW_ICACHE_BIT 0x01 -#define CACHEW_TLBFLUSH_BIT 0x02 - -#define CACHEW_FLUSH_L1D_L2 0x0 -#define CACHEW_INVALIDATE_L1I 0x1 -#define CACHEW_INVALIDATE_L1DTLB 0x2 -#define CACHEW_INVALIDATE_L1ITLB 0x3 -#define CACHEW_WRITEBACK_L1D_L2 0x4 -#define CACHEW_INVALIDATE_L1D 0x8 -#define CACHEW_INVALIDATE_L1D_L2 0xC - -/* - * CACHERD/CACHERL instructions use bits 3:5 of the address presented to - * control the operation achieved and hence the specific result. - */ -#define CACHER_ADDR_BITS 0xFFFFFFC0 -#define CACHER_OPER_BITS 0x00000030 -#define CACHER_OPER_S 4 -#define CACHER_OPER_LINPHY 0 -#define CACHER_ICACHE_BIT 0x00000008 -#define CACHER_ICACHE_S 3 - -/* - * CACHERD/CACHERL LINPHY Oper result is one/two 32-bit words - * - * If CRLINPHY0_VAL_BIT (Bit 0) set then, - * Lower 32-bits corresponds to MMCU_ENTRY_* above. - * Upper 32-bits corresponds to CRLINPHY1_* values below (if requested). - * else - * Lower 32-bits corresponds to CRLINPHY0_* values below. - * Upper 32-bits undefined. - */ -#define CRLINPHY0_VAL_BIT 0x00000001 -#define CRLINPHY0_FIRST_BIT 0x00000004 /* Set if VAL=0 due to first level */ - -#define CRLINPHY1_READ_BIT 0x00000001 /* Set if reads permitted */ -#define CRLINPHY1_SINGLE_BIT 0x00000004 /* Set if TLB does not cache entry */ -#define CRLINPHY1_PAGEMSK_BITS 0x0000FFF0 /* Set to ((2^n-1)>>12) value */ -#define CRLINPHY1_PAGEMSK_S 4 - -#endif /* _ASM_METAG_ISA_H_ */ diff --git a/arch/metag/include/asm/metag_mem.h b/arch/metag/include/asm/metag_mem.h deleted file mode 100644 index 7848bc6d3b614..0000000000000 --- a/arch/metag/include/asm/metag_mem.h +++ /dev/null @@ -1,1109 +0,0 @@ -/* - * asm/metag_mem.h - * - * Copyright (C) 2000-2007, 2012 Imagination Technologies. - * - * 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. - * - * Various defines for Meta (memory-mapped) registers. - */ - -#ifndef _ASM_METAG_MEM_H_ -#define _ASM_METAG_MEM_H_ - -/***************************************************************************** - * META MEMORY MAP LINEAR ADDRESS VALUES - ****************************************************************************/ -/* - * COMMON MEMORY MAP - * ----------------- - */ - -#define LINSYSTEM_BASE 0x00200000 -#define LINSYSTEM_LIMIT 0x07FFFFFF - -/* Linear cache flush now implemented via DCACHE instruction. These defines - related to a special region that used to exist for achieving cache flushes. - */ -#define LINSYSLFLUSH_S 0 - -#define LINSYSRES0_BASE 0x00200000 -#define LINSYSRES0_LIMIT 0x01FFFFFF - -#define LINSYSCUSTOM_BASE 0x02000000 -#define LINSYSCUSTOM_LIMIT 0x02FFFFFF - -#define LINSYSEXPAND_BASE 0x03000000 -#define LINSYSEXPAND_LIMIT 0x03FFFFFF - -#define LINSYSEVENT_BASE 0x04000000 -#define LINSYSEVENT_WR_ATOMIC_UNLOCK 0x04000000 -#define LINSYSEVENT_WR_ATOMIC_LOCK 0x04000040 -#define LINSYSEVENT_WR_CACHE_DISABLE 0x04000080 -#define LINSYSEVENT_WR_CACHE_ENABLE 0x040000C0 -#define LINSYSEVENT_WR_COMBINE_FLUSH 0x04000100 -#define LINSYSEVENT_WR_FENCE 0x04000140 -#define LINSYSEVENT_LIMIT 0x04000FFF - -#define LINSYSCFLUSH_BASE 0x04400000 -#define LINSYSCFLUSH_DCACHE_LINE 0x04400000 -#define LINSYSCFLUSH_ICACHE_LINE 0x04500000 -#define LINSYSCFLUSH_MMCU 0x04700000 -#ifndef METAC_1_2 -#define LINSYSCFLUSH_TxMMCU_BASE 0x04700020 -#define LINSYSCFLUSH_TxMMCU_STRIDE 0x00000008 -#endif -#define LINSYSCFLUSH_ADDR_BITS 0x000FFFFF -#define LINSYSCFLUSH_ADDR_S 0 -#define LINSYSCFLUSH_LIMIT 0x047FFFFF - -#define LINSYSCTRL_BASE 0x04800000 -#define LINSYSCTRL_LIMIT 0x04FFFFFF - -#define LINSYSMTABLE_BASE 0x05000000 -#define LINSYSMTABLE_LIMIT 0x05FFFFFF - -#define LINSYSDIRECT_BASE 0x06000000 -#define LINSYSDIRECT_LIMIT 0x07FFFFFF - -#define LINLOCAL_BASE 0x08000000 -#define LINLOCAL_LIMIT 0x7FFFFFFF - -#define LINCORE_BASE 0x80000000 -#define LINCORE_LIMIT 0x87FFFFFF - -#define LINCORE_CODE_BASE 0x80000000 -#define LINCORE_CODE_LIMIT 0x81FFFFFF - -#define LINCORE_DATA_BASE 0x82000000 -#define LINCORE_DATA_LIMIT 0x83FFFFFF - - -/* The core can support locked icache lines in this region */ -#define LINCORE_ICACHE_BASE 0x84000000 -#define LINCORE_ICACHE_LIMIT 0x85FFFFFF - -/* The core can support locked dcache lines in this region */ -#define LINCORE_DCACHE_BASE 0x86000000 -#define LINCORE_DCACHE_LIMIT 0x87FFFFFF - -#define LINGLOBAL_BASE 0x88000000 -#define LINGLOBAL_LIMIT 0xFFFDFFFF - -/* - * CHIP Core Register Map - * ---------------------- - */ -#define CORE_HWBASE 0x04800000 -#define PRIV_HWBASE 0x04810000 -#define TRIG_HWBASE 0x04820000 -#define SYSC_HWBASE 0x04830000 - -/***************************************************************************** - * INTER-THREAD KICK REGISTERS FOR SOFTWARE EVENT GENERATION - ****************************************************************************/ -/* - * These values define memory mapped registers that can be used to supply - * kicks to threads that service arbitrary software events. - */ - -#define T0KICK 0x04800800 /* Background kick 0 */ -#define TXXKICK_MAX 0xFFFF /* Maximum kicks */ -#define TnXKICK_STRIDE 0x00001000 /* Thread scale value */ -#define TnXKICK_STRIDE_S 12 -#define T0KICKI 0x04800808 /* Interrupt kick 0 */ -#define TXIKICK_OFFSET 0x00000008 /* Int level offset value */ -#define T1KICK 0x04801800 /* Background kick 1 */ -#define T1KICKI 0x04801808 /* Interrupt kick 1 */ -#define T2KICK 0x04802800 /* Background kick 2 */ -#define T2KICKI 0x04802808 /* Interrupt kick 2 */ -#define T3KICK 0x04803800 /* Background kick 3 */ -#define T3KICKI 0x04803808 /* Interrupt kick 3 */ - -/***************************************************************************** - * GLOBAL REGISTER ACCESS RESOURCES - ****************************************************************************/ -/* - * These values define memory mapped registers that allow access to the - * internal state of all threads in order to allow global set-up of thread - * state and external handling of thread events, errors, or debugging. - * - * The actual unit and register index values needed to access individul - * registers are chip specific see - METAC_TXUXX_VALUES in metac_x_y.h. - * However two C array initialisers TXUXX_MASKS and TGUXX_MASKS will always be - * defined to allow arbitrary loading, display, and saving of all valid - * register states without detailed knowledge of their purpose - TXUXX sets - * bits for all valid registers and TGUXX sets bits for the sub-set which are - * global. - */ - -#define T0UCTREG0 0x04800000 /* Access to all CT regs */ -#define TnUCTRX_STRIDE 0x00001000 /* Thread scale value */ -#define TXUCTREGn_STRIDE 0x00000008 /* Register scale value */ - -#define TXUXXRXDT 0x0480FFF0 /* Data to/from any threads reg */ -#define TXUXXRXRQ 0x0480FFF8 -#define TXUXXRXRQ_DREADY_BIT 0x80000000 /* Poll for done */ -#define TXUXXRXRQ_DSPEXT_BIT 0x00020000 /* Addr DSP Regs */ -#define TXUXXRXRQ_RDnWR_BIT 0x00010000 /* Set for read */ -#define TXUXXRXRQ_TX_BITS 0x00003000 /* Thread number */ -#define TXUXXRXRQ_TX_S 12 -#define TXUXXRXRQ_RX_BITS 0x000001F0 /* Register num */ -#define TXUXXRXRQ_RX_S 4 -#define TXUXXRXRQ_DSPRARD0 0 /* DSP RAM A Read Pointer 0 */ -#define TXUXXRXRQ_DSPRARD1 1 /* DSP RAM A Read Pointer 1 */ -#define TXUXXRXRQ_DSPRAWR0 2 /* DSP RAM A Write Pointer 0 */ -#define TXUXXRXRQ_DSPRAWR2 3 /* DSP RAM A Write Pointer 1 */ -#define TXUXXRXRQ_DSPRBRD0 4 /* DSP RAM B Read Pointer 0 */ -#define TXUXXRXRQ_DSPRBRD1 5 /* DSP RAM B Read Pointer 1 */ -#define TXUXXRXRQ_DSPRBWR0 6 /* DSP RAM B Write Pointer 0 */ -#define TXUXXRXRQ_DSPRBWR1 7 /* DSP RAM B Write Pointer 1 */ -#define TXUXXRXRQ_DSPRARINC0 8 /* DSP RAM A Read Increment 0 */ -#define TXUXXRXRQ_DSPRARINC1 9 /* DSP RAM A Read Increment 1 */ -#define TXUXXRXRQ_DSPRAWINC0 10 /* DSP RAM A Write Increment 0 */ -#define TXUXXRXRQ_DSPRAWINC1 11 /* DSP RAM A Write Increment 1 */ -#define TXUXXRXRQ_DSPRBRINC0 12 /* DSP RAM B Read Increment 0 */ -#define TXUXXRXRQ_DSPRBRINC1 13 /* DSP RAM B Read Increment 1 */ -#define TXUXXRXRQ_DSPRBWINC0 14 /* DSP RAM B Write Increment 0 */ -#define TXUXXRXRQ_DSPRBWINC1 15 /* DSP RAM B Write Increment 1 */ - -#define TXUXXRXRQ_ACC0L0 16 /* Accumulator 0 bottom 32-bits */ -#define TXUXXRXRQ_ACC1L0 17 /* Accumulator 1 bottom 32-bits */ -#define TXUXXRXRQ_ACC2L0 18 /* Accumulator 2 bottom 32-bits */ -#define TXUXXRXRQ_ACC3L0 19 /* Accumulator 3 bottom 32-bits */ -#define TXUXXRXRQ_ACC0HI 20 /* Accumulator 0 top 8-bits */ -#define TXUXXRXRQ_ACC1HI 21 /* Accumulator 1 top 8-bits */ -#define TXUXXRXRQ_ACC2HI 22 /* Accumulator 2 top 8-bits */ -#define TXUXXRXRQ_ACC3HI 23 /* Accumulator 3 top 8-bits */ -#define TXUXXRXRQ_UXX_BITS 0x0000000F /* Unit number */ -#define TXUXXRXRQ_UXX_S 0 - -/***************************************************************************** - * PRIVILEGE CONTROL VALUES FOR MEMORY MAPPED RESOURCES - ****************************************************************************/ -/* - * These values define memory mapped registers that give control over and - * the privilege required to access other memory mapped resources. These - * registers themselves always require privilege to update them. - */ - -#define TXPRIVREG_STRIDE 0x8 /* Delta between per-thread regs */ -#define TXPRIVREG_STRIDE_S 3 - -/* - * Each bit 0 to 15 defines privilege required to access internal register - * regions 0x04800000 to 0x048FFFFF in 64k chunks - */ -#define T0PIOREG 0x04810100 -#define T1PIOREG 0x04810108 -#define T2PIOREG 0x04810110 -#define T3PIOREG 0x04810118 - -/* - * Each bit 0 to 31 defines privilege required to use the pair of - * system events implemented as writee in the regions 0x04000000 to - * 0x04000FFF in 2*64 byte chunks. - */ -#define T0PSYREG 0x04810180 -#define T1PSYREG 0x04810188 -#define T2PSYREG 0x04810190 -#define T3PSYREG 0x04810198 - -/* - * CHIP PRIV CONTROLS - * ------------------ - */ - -/* The TXPIOREG register holds a bit mask directly mappable to - corresponding addresses in the range 0x04800000 to 049FFFFF */ -#define TXPIOREG_ADDR_BITS 0x1F0000 /* Up to 32x64K bytes */ -#define TXPIOREG_ADDR_S 16 - -/* Hence based on the _HWBASE values ... */ -#define TXPIOREG_CORE_BIT (1<<((0x04800000>>16)&0x1F)) -#define TXPIOREG_PRIV_BIT (1<<((0x04810000>>16)&0x1F)) -#define TXPIOREG_TRIG_BIT (1<<((0x04820000>>16)&0x1F)) -#define TXPIOREG_SYSC_BIT (1<<((0x04830000>>16)&0x1F)) - -#define TXPIOREG_WRC_BIT 0x00080000 /* Wr combiner reg priv */ -#define TXPIOREG_LOCALBUS_RW_BIT 0x00040000 /* Local bus rd/wr priv */ -#define TXPIOREG_SYSREGBUS_RD_BIT 0x00020000 /* Sys reg bus write priv */ -#define TXPIOREG_SYSREGBUS_WR_BIT 0x00010000 /* Sys reg bus read priv */ - -/* CORE region privilege controls */ -#define T0PRIVCORE 0x04800828 -#define TXPRIVCORE_TXBKICK_BIT 0x001 /* Background kick priv */ -#define TXPRIVCORE_TXIKICK_BIT 0x002 /* Interrupt kick priv */ -#define TXPRIVCORE_TXAMAREGX_BIT 0x004 /* TXAMAREG4|5|6 priv */ -#define TnPRIVCORE_STRIDE 0x00001000 - -#define T0PRIVSYSR 0x04810000 -#define TnPRIVSYSR_STRIDE 0x00000008 -#define TnPRIVSYSR_STRIDE_S 3 -#define TXPRIVSYSR_CFLUSH_BIT 0x01 -#define TXPRIVSYSR_MTABLE_BIT 0x02 -#define TXPRIVSYSR_DIRECT_BIT 0x04 -#ifdef METAC_1_2 -#define TXPRIVSYSR_ALL_BITS 0x07 -#else -#define TXPRIVSYSR_CORE_BIT 0x08 -#define TXPRIVSYSR_CORECODE_BIT 0x10 -#define TXPRIVSYSR_ALL_BITS 0x1F -#endif -#define T1PRIVSYSR 0x04810008 -#define T2PRIVSYSR 0x04810010 -#define T3PRIVSYSR 0x04810018 - -/***************************************************************************** - * H/W TRIGGER STATE/LEVEL REGISTERS AND H/W TRIGGER VECTORS - ****************************************************************************/ -/* - * These values define memory mapped registers that give control over and - * the state of hardware trigger sources both external to the META processor - * and internal to it. - */ - -#define HWSTATMETA 0x04820000 /* Hardware status/clear META trig */ -#define HWSTATMETA_T0HALT_BITS 0xF -#define HWSTATMETA_T0HALT_S 0 -#define HWSTATMETA_T0BHALT_BIT 0x1 /* Background HALT */ -#define HWSTATMETA_T0IHALT_BIT 0x2 /* Interrupt HALT */ -#define HWSTATMETA_T0PHALT_BIT 0x4 /* PF/RO Memory HALT */ -#define HWSTATMETA_T0AMATR_BIT 0x8 /* AMA trigger */ -#define HWSTATMETA_TnINT_S 4 /* Shift by (thread*4) */ -#define HWSTATEXT 0x04820010 /* H/W status/clear external trigs 0-31 */ -#define HWSTATEXT2 0x04820018 /* H/W status/clear external trigs 32-63 */ -#define HWSTATEXT4 0x04820020 /* H/W status/clear external trigs 64-95 */ -#define HWSTATEXT6 0x04820028 /* H/W status/clear external trigs 96-128 */ -#define HWLEVELEXT 0x04820030 /* Edge/Level type of external trigs 0-31 */ -#define HWLEVELEXT2 0x04820038 /* Edge/Level type of external trigs 32-63 */ -#define HWLEVELEXT4 0x04820040 /* Edge/Level type of external trigs 64-95 */ -#define HWLEVELEXT6 0x04820048 /* Edge/Level type of external trigs 96-128 */ -#define HWLEVELEXT_XXX_LEVEL 1 /* Level sense logic in HWSTATEXTn */ -#define HWLEVELEXT_XXX_EDGE 0 -#define HWMASKEXT 0x04820050 /* Enable/disable of external trigs 0-31 */ -#define HWMASKEXT2 0x04820058 /* Enable/disable of external trigs 32-63 */ -#define HWMASKEXT4 0x04820060 /* Enable/disable of external trigs 64-95 */ -#define HWMASKEXT6 0x04820068 /* Enable/disable of external trigs 96-128 */ -#define T0VECINT_BHALT 0x04820500 /* Background HALT trigger vector */ -#define TXVECXXX_BITS 0xF /* Per-trigger vector vals 0,1,4-15 */ -#define TXVECXXX_S 0 -#define T0VECINT_IHALT 0x04820508 /* Interrupt HALT */ -#define T0VECINT_PHALT 0x04820510 /* PF/RO memory fault */ -#define T0VECINT_AMATR 0x04820518 /* AMA trigger */ -#define TnVECINT_STRIDE 0x00000020 /* Per thread stride */ -#define HWVEC0EXT 0x04820700 /* Vectors for external triggers 0-31 */ -#define HWVEC20EXT 0x04821700 /* Vectors for external triggers 32-63 */ -#define HWVEC40EXT 0x04822700 /* Vectors for external triggers 64-95 */ -#define HWVEC60EXT 0x04823700 /* Vectors for external triggers 96-127 */ -#define HWVECnEXT_STRIDE 0x00000008 /* Per trigger stride */ -#define HWVECnEXT_DEBUG 0x1 /* Redirect trigger to debug i/f */ - -/* - * CORE HWCODE-BREAKPOINT REGISTERS/VALUES - * --------------------------------------- - */ -#define CODEB0ADDR 0x0480FF00 /* Address specifier */ -#define CODEBXADDR_MATCHX_BITS 0xFFFFFFFC -#define CODEBXADDR_MATCHX_S 2 -#define CODEB0CTRL 0x0480FF08 /* Control */ -#define CODEBXCTRL_MATEN_BIT 0x80000000 /* Match 'Enable' */ -#define CODEBXCTRL_MATTXEN_BIT 0x10000000 /* Match threadn enable */ -#define CODEBXCTRL_HITC_BITS 0x00FF0000 /* Hit counter */ -#define CODEBXCTRL_HITC_S 16 -#define CODEBXHITC_NEXT 0xFF /* Next 'hit' will trigger */ -#define CODEBXHITC_HIT1 0x00 /* No 'hits' after trigger */ -#define CODEBXCTRL_MMASK_BITS 0x0000FFFC /* Mask ADDR_MATCH bits */ -#define CODEBXCTRL_MMASK_S 2 -#define CODEBXCTRL_MATLTX_BITS 0x00000003 /* Match threadn LOCAL addr */ -#define CODEBXCTRL_MATLTX_S 0 /* Match threadn LOCAL addr */ -#define CODEBnXXXX_STRIDE 0x00000010 /* Stride between CODEB reg sets */ -#define CODEBnXXXX_STRIDE_S 4 -#define CODEBnXXXX_LIMIT 3 /* Sets 0-3 */ - -/* - * CORE DATA-WATCHPOINT REGISTERS/VALUES - * ------------------------------------- - */ -#define DATAW0ADDR 0x0480FF40 /* Address specifier */ -#define DATAWXADDR_MATCHR_BITS 0xFFFFFFF8 -#define DATAWXADDR_MATCHR_S 3 -#define DATAWXADDR_MATCHW_BITS 0xFFFFFFFF -#define DATAWXADDR_MATCHW_S 0 -#define DATAW0CTRL 0x0480FF48 /* Control */ -#define DATAWXCTRL_MATRD_BIT 0x80000000 /* Match 'Read' */ -#ifndef METAC_1_2 -#define DATAWXCTRL_MATNOTTX_BIT 0x20000000 /* Invert threadn enable */ -#endif -#define DATAWXCTRL_MATWR_BIT 0x40000000 /* Match 'Write' */ -#define DATAWXCTRL_MATTXEN_BIT 0x10000000 /* Match threadn enable */ -#define DATAWXCTRL_WRSIZE_BITS 0x0F000000 /* Write Match Size */ -#define DATAWXCTRL_WRSIZE_S 24 -#define DATAWWRSIZE_ANY 0 /* Any size transaction matches */ -#define DATAWWRSIZE_8BIT 1 /* Specific sizes ... */ -#define DATAWWRSIZE_16BIT 2 -#define DATAWWRSIZE_32BIT 3 -#define DATAWWRSIZE_64BIT 4 -#define DATAWXCTRL_HITC_BITS 0x00FF0000 /* Hit counter */ -#define DATAWXCTRL_HITC_S 16 -#define DATAWXHITC_NEXT 0xFF /* Next 'hit' will trigger */ -#define DATAWXHITC_HIT1 0x00 /* No 'hits' after trigger */ -#define DATAWXCTRL_MMASK_BITS 0x0000FFF8 /* Mask ADDR_MATCH bits */ -#define DATAWXCTRL_MMASK_S 3 -#define DATAWXCTRL_MATLTX_BITS 0x00000003 /* Match threadn LOCAL addr */ -#define DATAWXCTRL_MATLTX_S 0 /* Match threadn LOCAL addr */ -#define DATAW0DMATCH0 0x0480FF50 /* Write match data */ -#define DATAW0DMATCH1 0x0480FF58 -#define DATAW0DMASK0 0x0480FF60 /* Write match data mask */ -#define DATAW0DMASK1 0x0480FF68 -#define DATAWnXXXX_STRIDE 0x00000040 /* Stride between DATAW reg sets */ -#define DATAWnXXXX_STRIDE_S 6 -#define DATAWnXXXX_LIMIT 1 /* Sets 0,1 */ - -/* - * CHIP Automatic Mips Allocation control registers - * ------------------------------------------------ - */ - -/* CORE memory mapped AMA registers */ -#define T0AMAREG4 0x04800810 -#define TXAMAREG4_POOLSIZE_BITS 0x3FFFFF00 -#define TXAMAREG4_POOLSIZE_S 8 -#define TXAMAREG4_AVALUE_BITS 0x000000FF -#define TXAMAREG4_AVALUE_S 0 -#define T0AMAREG5 0x04800818 -#define TXAMAREG5_POOLC_BITS 0x07FFFFFF -#define TXAMAREG5_POOLC_S 0 -#define T0AMAREG6 0x04800820 -#define TXAMAREG6_DLINEDEF_BITS 0x00FFFFF0 -#define TXAMAREG6_DLINEDEF_S 0 -#define TnAMAREGX_STRIDE 0x00001000 - -/* - * Memory Management Control Unit Table Entries - * -------------------------------------------- - */ -#define MMCU_ENTRY_S 4 /* -> Entry size */ -#define MMCU_ENTRY_ADDR_BITS 0xFFFFF000 /* Physical address */ -#define MMCU_ENTRY_ADDR_S 12 /* -> Page size */ -#define MMCU_ENTRY_CWIN_BITS 0x000000C0 /* Caching 'window' selection */ -#define MMCU_ENTRY_CWIN_S 6 -#define MMCU_CWIN_UNCACHED 0 /* May not be memory etc. */ -#define MMCU_CWIN_BURST 1 /* Cached but LRU unset */ -#define MMCU_CWIN_C1SET 2 /* Cached in 1 set only */ -#define MMCU_CWIN_CACHED 3 /* Fully cached */ -#define MMCU_ENTRY_CACHE_BIT 0x00000080 /* Set for cached region */ -#define MMCU_ECACHE1_FULL_BIT 0x00000040 /* Use all the sets */ -#define MMCU_ECACHE0_BURST_BIT 0x00000040 /* Match bursts */ -#define MMCU_ENTRY_SYS_BIT 0x00000010 /* Sys-coherent access required */ -#define MMCU_ENTRY_WRC_BIT 0x00000008 /* Write combining allowed */ -#define MMCU_ENTRY_PRIV_BIT 0x00000004 /* Privilege required */ -#define MMCU_ENTRY_WR_BIT 0x00000002 /* Writes allowed */ -#define MMCU_ENTRY_VAL_BIT 0x00000001 /* Entry is valid */ - -#ifdef METAC_2_1 -/* - * Extended first-level/top table entries have extra/larger fields in later - * cores as bits 11:0 previously had no effect in such table entries. - */ -#define MMCU_E1ENT_ADDR_BITS 0xFFFFFFC0 /* Physical address */ -#define MMCU_E1ENT_ADDR_S 6 /* -> resolution < page size */ -#define MMCU_E1ENT_PGSZ_BITS 0x0000001E /* Page size for 2nd level */ -#define MMCU_E1ENT_PGSZ_S 1 -#define MMCU_E1ENT_PGSZ0_POWER 12 /* PgSz 0 -> 4K */ -#define MMCU_E1ENT_PGSZ_MAX 10 /* PgSz 10 -> 4M maximum */ -#define MMCU_E1ENT_MINIM_BIT 0x00000020 -#endif /* METAC_2_1 */ - -/* MMCU control register in SYSC region */ -#define MMCU_TABLE_PHYS_ADDR 0x04830010 -#define MMCU_TABLE_PHYS_ADDR_BITS 0xFFFFFFFC -#ifdef METAC_2_1 -#define MMCU_TABLE_PHYS_EXTEND 0x00000001 /* See below */ -#endif -#define MMCU_DCACHE_CTRL_ADDR 0x04830018 -#define MMCU_xCACHE_CTRL_ENABLE_BIT 0x00000001 -#define MMCU_xCACHE_CTRL_PARTITION_BIT 0x00000000 /* See xCPART below */ -#define MMCU_ICACHE_CTRL_ADDR 0x04830020 - -#ifdef METAC_2_1 - -/* - * Allow direct access to physical memory used to implement MMU table. - * - * Each is based on a corresponding MMCU_TnLOCAL_TABLE_PHYSn or similar - * MMCU_TnGLOBAL_TABLE_PHYSn register pair (see next). - */ -#define LINSYSMEMT0L_BASE 0x05000000 -#define LINSYSMEMT0L_LIMIT 0x051FFFFF -#define LINSYSMEMTnX_STRIDE 0x00200000 /* 2MB Local per thread */ -#define LINSYSMEMTnX_STRIDE_S 21 -#define LINSYSMEMTXG_OFFSET 0x00800000 /* +2MB Global per thread */ -#define LINSYSMEMTXG_OFFSET_S 23 -#define LINSYSMEMT1L_BASE 0x05200000 -#define LINSYSMEMT1L_LIMIT 0x053FFFFF -#define LINSYSMEMT2L_BASE 0x05400000 -#define LINSYSMEMT2L_LIMIT 0x055FFFFF -#define LINSYSMEMT3L_BASE 0x05600000 -#define LINSYSMEMT3L_LIMIT 0x057FFFFF -#define LINSYSMEMT0G_BASE 0x05800000 -#define LINSYSMEMT0G_LIMIT 0x059FFFFF -#define LINSYSMEMT1G_BASE 0x05A00000 -#define LINSYSMEMT1G_LIMIT 0x05BFFFFF -#define LINSYSMEMT2G_BASE 0x05C00000 -#define LINSYSMEMT2G_LIMIT 0x05DFFFFF -#define LINSYSMEMT3G_BASE 0x05E00000 -#define LINSYSMEMT3G_LIMIT 0x05FFFFFF - -/* - * Extended MMU table functionality allows a sparse or flat table to be - * described much more efficiently than before. - */ -#define MMCU_T0LOCAL_TABLE_PHYS0 0x04830700 -#define MMCU_TnX_TABLE_PHYSX_STRIDE 0x20 /* Offset per thread */ -#define MMCU_TnX_TABLE_PHYSX_STRIDE_S 5 -#define MMCU_TXG_TABLE_PHYSX_OFFSET 0x10 /* Global versus local */ -#define MMCU_TXG_TABLE_PHYSX_OFFSET_S 4 -#define MMCU_TBLPHYS0_DCCTRL_BITS 0x000000DF /* DC controls */ -#define MMCU_TBLPHYS0_ENTLB_BIT 0x00000020 /* Cache in TLB */ -#define MMCU_TBLPHYS0_TBLSZ_BITS 0x00000F00 /* Area supported */ -#define MMCU_TBLPHYS0_TBLSZ_S 8 -#define MMCU_TBLPHYS0_TBLSZ0_POWER 22 /* 0 -> 4M */ -#define MMCU_TBLPHYS0_TBLSZ_MAX 9 /* 9 -> 2G */ -#define MMCU_TBLPHYS0_LINBASE_BITS 0xFFC00000 /* Linear base */ -#define MMCU_TBLPHYS0_LINBASE_S 22 - -#define MMCU_T0LOCAL_TABLE_PHYS1 0x04830708 -#define MMCU_TBLPHYS1_ADDR_BITS 0xFFFFFFFC /* Physical base */ -#define MMCU_TBLPHYS1_ADDR_S 2 - -#define MMCU_T0GLOBAL_TABLE_PHYS0 0x04830710 -#define MMCU_T0GLOBAL_TABLE_PHYS1 0x04830718 -#define MMCU_T1LOCAL_TABLE_PHYS0 0x04830720 -#define MMCU_T1LOCAL_TABLE_PHYS1 0x04830728 -#define MMCU_T1GLOBAL_TABLE_PHYS0 0x04830730 -#define MMCU_T1GLOBAL_TABLE_PHYS1 0x04830738 -#define MMCU_T2LOCAL_TABLE_PHYS0 0x04830740 -#define MMCU_T2LOCAL_TABLE_PHYS1 0x04830748 -#define MMCU_T2GLOBAL_TABLE_PHYS0 0x04830750 -#define MMCU_T2GLOBAL_TABLE_PHYS1 0x04830758 -#define MMCU_T3LOCAL_TABLE_PHYS0 0x04830760 -#define MMCU_T3LOCAL_TABLE_PHYS1 0x04830768 -#define MMCU_T3GLOBAL_TABLE_PHYS0 0x04830770 -#define MMCU_T3GLOBAL_TABLE_PHYS1 0x04830778 - -#define MMCU_T0EBWCCTRL 0x04830640 -#define MMCU_TnEBWCCTRL_BITS 0x00000007 -#define MMCU_TnEBWCCTRL_S 0 -#define MMCU_TnEBWCCCTRL_DISABLE_ALL 0 -#define MMCU_TnEBWCCCTRL_ABIT25 1 -#define MMCU_TnEBWCCCTRL_ABIT26 2 -#define MMCU_TnEBWCCCTRL_ABIT27 3 -#define MMCU_TnEBWCCCTRL_ABIT28 4 -#define MMCU_TnEBWCCCTRL_ABIT29 5 -#define MMCU_TnEBWCCCTRL_ABIT30 6 -#define MMCU_TnEBWCCCTRL_ENABLE_ALL 7 -#define MMCU_TnEBWCCTRL_STRIDE 8 - -#endif /* METAC_2_1 */ - - -/* Registers within the SYSC register region */ -#define METAC_ID 0x04830000 -#define METAC_ID_MAJOR_BITS 0xFF000000 -#define METAC_ID_MAJOR_S 24 -#define METAC_ID_MINOR_BITS 0x00FF0000 -#define METAC_ID_MINOR_S 16 -#define METAC_ID_REV_BITS 0x0000FF00 -#define METAC_ID_REV_S 8 -#define METAC_ID_MAINT_BITS 0x000000FF -#define METAC_ID_MAINT_S 0 - -#ifdef METAC_2_1 -/* Use of this section is strongly deprecated */ -#define METAC_ID2 0x04830008 -#define METAC_ID2_DESIGNER_BITS 0xFFFF0000 /* Modified by customer */ -#define METAC_ID2_DESIGNER_S 16 -#define METAC_ID2_MINOR2_BITS 0x00000F00 /* 3rd digit of prod rev */ -#define METAC_ID2_MINOR2_S 8 -#define METAC_ID2_CONFIG_BITS 0x000000FF /* Wrapper configuration */ -#define METAC_ID2_CONFIG_S 0 - -/* Primary core identification and configuration information */ -#define METAC_CORE_ID 0x04831000 -#define METAC_COREID_GROUP_BITS 0xFF000000 -#define METAC_COREID_GROUP_S 24 -#define METAC_COREID_GROUP_METAG 0x14 -#define METAC_COREID_ID_BITS 0x00FF0000 -#define METAC_COREID_ID_S 16 -#define METAC_COREID_ID_W32 0x10 /* >= for 32-bit pipeline */ -#define METAC_COREID_CONFIG_BITS 0x0000FFFF -#define METAC_COREID_CONFIG_S 0 -#define METAC_COREID_CFGCACHE_BITS 0x0007 -#define METAC_COREID_CFGCACHE_S 0 -#define METAC_COREID_CFGCACHE_NOM 0 -#define METAC_COREID_CFGCACHE_TYPE0 1 -#define METAC_COREID_CFGCACHE_NOMMU 1 /* Alias for TYPE0 */ -#define METAC_COREID_CFGCACHE_NOCACHE 2 -#define METAC_COREID_CFGCACHE_PRIVNOMMU 3 -#define METAC_COREID_CFGDSP_BITS 0x0038 -#define METAC_COREID_CFGDSP_S 3 -#define METAC_COREID_CFGDSP_NOM 0 -#define METAC_COREID_CFGDSP_MIN 1 -#define METAC_COREID_NOFPACC_BIT 0x0040 /* Set if no FPU accum */ -#define METAC_COREID_CFGFPU_BITS 0x0180 -#define METAC_COREID_CFGFPU_S 7 -#define METAC_COREID_CFGFPU_NOM 0 -#define METAC_COREID_CFGFPU_SNGL 1 -#define METAC_COREID_CFGFPU_DBL 2 -#define METAC_COREID_NOAMA_BIT 0x0200 /* Set if no AMA present */ -#define METAC_COREID_NOCOH_BIT 0x0400 /* Set if no Gbl coherency */ - -/* Core revision information */ -#define METAC_CORE_REV 0x04831008 -#define METAC_COREREV_DESIGN_BITS 0xFF000000 -#define METAC_COREREV_DESIGN_S 24 -#define METAC_COREREV_MAJOR_BITS 0x00FF0000 -#define METAC_COREREV_MAJOR_S 16 -#define METAC_COREREV_MINOR_BITS 0x0000FF00 -#define METAC_COREREV_MINOR_S 8 -#define METAC_COREREV_MAINT_BITS 0x000000FF -#define METAC_COREREV_MAINT_S 0 - -/* Configuration information control outside the core */ -#define METAC_CORE_DESIGNER1 0x04831010 /* Arbitrary value */ -#define METAC_CORE_DESIGNER2 0x04831018 /* Arbitrary value */ - -/* Configuration information covering presence/number of various features */ -#define METAC_CORE_CONFIG2 0x04831020 -#define METAC_CORECFG2_COREDBGTYPE_BITS 0x60000000 /* Core debug type */ -#define METAC_CORECFG2_COREDBGTYPE_S 29 -#define METAC_CORECFG2_DCSMALL_BIT 0x04000000 /* Data cache small */ -#define METAC_CORECFG2_ICSMALL_BIT 0x02000000 /* Inst cache small */ -#define METAC_CORECFG2_DCSZNP_BITS 0x01C00000 /* Data cache size np */ -#define METAC_CORECFG2_DCSZNP_S 22 -#define METAC_CORECFG2_ICSZNP_BITS 0x00380000 /* Inst cache size np */ -#define METAC_CORECFG2_ICSZNP_S 19 -#define METAC_CORECFG2_DCSZ_BITS 0x00070000 /* Data cache size */ -#define METAC_CORECFG2_DCSZ_S 16 -#define METAC_CORECFG2_xCSZ_4K 0 /* Allocated values */ -#define METAC_CORECFG2_xCSZ_8K 1 -#define METAC_CORECFG2_xCSZ_16K 2 -#define METAC_CORECFG2_xCSZ_32K 3 -#define METAC_CORECFG2_xCSZ_64K 4 -#define METAC_CORE_C2ICSZ_BITS 0x0000E000 /* Inst cache size */ -#define METAC_CORE_C2ICSZ_S 13 -#define METAC_CORE_GBLACC_BITS 0x00001800 /* Number of Global Acc */ -#define METAC_CORE_GBLACC_S 11 -#define METAC_CORE_GBLDXR_BITS 0x00000700 /* 0 -> 0, R -> 2^(R-1) */ -#define METAC_CORE_GBLDXR_S 8 -#define METAC_CORE_GBLAXR_BITS 0x000000E0 /* 0 -> 0, R -> 2^(R-1) */ -#define METAC_CORE_GBLAXR_S 5 -#define METAC_CORE_RTTRACE_BIT 0x00000010 -#define METAC_CORE_WATCHN_BITS 0x0000000C /* 0 -> 0, N -> 2^N */ -#define METAC_CORE_WATCHN_S 2 -#define METAC_CORE_BREAKN_BITS 0x00000003 /* 0 -> 0, N -> 2^N */ -#define METAC_CORE_BREAKN_S 0 - -/* Configuration information covering presence/number of various features */ -#define METAC_CORE_CONFIG3 0x04831028 -#define METAC_CORECFG3_L2C_REV_ID_BITS 0x000F0000 /* Revision of L2 cache */ -#define METAC_CORECFG3_L2C_REV_ID_S 16 -#define METAC_CORECFG3_L2C_LINE_SIZE_BITS 0x00003000 /* L2 line size */ -#define METAC_CORECFG3_L2C_LINE_SIZE_S 12 -#define METAC_CORECFG3_L2C_LINE_SIZE_64B 0x0 /* 64 bytes */ -#define METAC_CORECFG3_L2C_NUM_WAYS_BITS 0x00000F00 /* L2 number of ways (2^n) */ -#define METAC_CORECFG3_L2C_NUM_WAYS_S 8 -#define METAC_CORECFG3_L2C_SIZE_BITS 0x000000F0 /* L2 size (2^n) */ -#define METAC_CORECFG3_L2C_SIZE_S 4 -#define METAC_CORECFG3_L2C_UNIFIED_BIT 0x00000004 /* Unified cache: */ -#define METAC_CORECFG3_L2C_UNIFIED_S 2 -#define METAC_CORECFG3_L2C_UNIFIED_UNIFIED 1 /* - Unified D/I cache */ -#define METAC_CORECFG3_L2C_UNIFIED_SEPARATE 0 /* - Separate D/I cache */ -#define METAC_CORECFG3_L2C_MODE_BIT 0x00000002 /* Cache Mode: */ -#define METAC_CORECFG3_L2C_MODE_S 1 -#define METAC_CORECFG3_L2C_MODE_WRITE_BACK 1 /* - Write back */ -#define METAC_CORECFG3_L2C_MODE_WRITE_THROUGH 0 /* - Write through */ -#define METAC_CORECFG3_L2C_HAVE_L2C_BIT 0x00000001 /* Have L2C */ -#define METAC_CORECFG3_L2C_HAVE_L2C_S 0 - -#endif /* METAC_2_1 */ - -#define SYSC_CACHE_MMU_CONFIG 0x04830028 -#ifdef METAC_2_1 -#define SYSC_CMMUCFG_DCSKEWABLE_BIT 0x00000040 -#define SYSC_CMMUCFG_ICSKEWABLE_BIT 0x00000020 -#define SYSC_CMMUCFG_DCSKEWOFF_BIT 0x00000010 /* Skew association override */ -#define SYSC_CMMUCFG_ICSKEWOFF_BIT 0x00000008 /* -> default 0 on if present */ -#define SYSC_CMMUCFG_MODE_BITS 0x00000007 /* Access to old state */ -#define SYSC_CMMUCFG_MODE_S 0 -#define SYSC_CMMUCFG_ON 0x7 -#define SYSC_CMMUCFG_EBYPASS 0x6 /* Enhanced by-pass mode */ -#define SYSC_CMMUCFG_EBYPASSIC 0x4 /* EB just inst cache */ -#define SYSC_CMMUCFG_EBYPASSDC 0x2 /* EB just data cache */ -#endif /* METAC_2_1 */ -/* Old definitions, Keep them for now */ -#define SYSC_CMMUCFG_MMU_ON_BIT 0x1 -#define SYSC_CMMUCFG_DC_ON_BIT 0x2 -#define SYSC_CMMUCFG_IC_ON_BIT 0x4 - -#define SYSC_JTAG_THREAD 0x04830030 -#define SYSC_JTAG_TX_BITS 0x00000003 /* Read only bits! */ -#define SYSC_JTAG_TX_S 0 -#define SYSC_JTAG_PRIV_BIT 0x00000004 -#ifdef METAC_2_1 -#define SYSC_JTAG_SLAVETX_BITS 0x00000018 -#define SYSC_JTAG_SLAVETX_S 3 -#endif /* METAC_2_1 */ - -#define SYSC_DCACHE_FLUSH 0x04830038 -#define SYSC_ICACHE_FLUSH 0x04830040 -#define SYSC_xCACHE_FLUSH_INIT 0x1 -#define MMCU_DIRECTMAP0_ADDR 0x04830080 /* LINSYSDIRECT_BASE -> */ -#define MMCU_DIRECTMAPn_STRIDE 0x00000010 /* 4 Region settings */ -#define MMCU_DIRECTMAPn_S 4 -#define MMCU_DIRECTMAPn_ADDR_BITS 0xFF800000 -#define MMCU_DIRECTMAPn_ADDR_S 23 -#define MMCU_DIRECTMAPn_ADDR_SCALE 0x00800000 /* 8M Regions */ -#ifdef METAC_2_1 -/* - * These fields in the above registers provide MMCU_ENTRY_* values - * for each direct mapped region to enable optimisation of these areas. - * (LSB similar to VALID must be set for enhancments to be active) - */ -#define MMCU_DIRECTMAPn_ENHANCE_BIT 0x00000001 /* 0 = no optim */ -#define MMCU_DIRECTMAPn_DCCTRL_BITS 0x000000DF /* Get DC Ctrl */ -#define MMCU_DIRECTMAPn_DCCTRL_S 0 -#define MMCU_DIRECTMAPn_ICCTRL_BITS 0x0000C000 /* Get IC Ctrl */ -#define MMCU_DIRECTMAPn_ICCTRL_S 8 -#define MMCU_DIRECTMAPn_ENTLB_BIT 0x00000020 /* Cache in TLB */ -#define MMCU_DIRECTMAPn_ICCWIN_BITS 0x0000C000 /* Get IC Win Bits */ -#define MMCU_DIRECTMAPn_ICCWIN_S 14 -#endif /* METAC_2_1 */ - -#define MMCU_DIRECTMAP1_ADDR 0x04830090 -#define MMCU_DIRECTMAP2_ADDR 0x048300a0 -#define MMCU_DIRECTMAP3_ADDR 0x048300b0 - -/* - * These bits partion each threads use of data cache or instruction cache - * resource by modifying the top 4 bits of the address within the cache - * storage area. - */ -#define SYSC_DCPART0 0x04830200 -#define SYSC_xCPARTn_STRIDE 0x00000008 -#define SYSC_xCPARTL_AND_BITS 0x0000000F /* Masks top 4 bits */ -#define SYSC_xCPARTL_AND_S 0 -#define SYSC_xCPARTG_AND_BITS 0x00000F00 /* Masks top 4 bits */ -#define SYSC_xCPARTG_AND_S 8 -#define SYSC_xCPARTL_OR_BITS 0x000F0000 /* Ors into top 4 bits */ -#define SYSC_xCPARTL_OR_S 16 -#ifdef METAC_2_1 -#define SYSC_DCPART_GCON_BIT 0x00100000 /* Coherent shared local */ -#endif /* METAC_2_1 */ -#define SYSC_xCPARTG_OR_BITS 0x0F000000 /* Ors into top 4 bits */ -#define SYSC_xCPARTG_OR_S 24 -#define SYSC_CWRMODE_BIT 0x80000000 /* Write cache mode bit */ - -#define SYSC_DCPART1 0x04830208 -#define SYSC_DCPART2 0x04830210 -#define SYSC_DCPART3 0x04830218 -#define SYSC_ICPART0 0x04830220 -#define SYSC_ICPART1 0x04830228 -#define SYSC_ICPART2 0x04830230 -#define SYSC_ICPART3 0x04830238 - -/* - * META Core Memory and Cache Update registers - */ -#define SYSC_MCMDATAX 0x04830300 /* 32-bit read/write data register */ -#define SYSC_MCMDATAT 0x04830308 /* Read or write data triggers oper */ -#define SYSC_MCMGCTRL 0x04830310 /* Control register */ -#define SYSC_MCMGCTRL_READ_BIT 0x00000001 /* Set to issue 1st read */ -#define SYSC_MCMGCTRL_AINC_BIT 0x00000002 /* Set for auto-increment */ -#define SYSC_MCMGCTRL_ADDR_BITS 0x000FFFFC /* Address or index */ -#define SYSC_MCMGCTRL_ADDR_S 2 -#define SYSC_MCMGCTRL_ID_BITS 0x0FF00000 /* Internal memory block Id */ -#define SYSC_MCMGCTRL_ID_S 20 -#define SYSC_MCMGID_NODEV 0xFF /* No Device Selected */ -#define SYSC_MCMGID_DSPRAM0A 0x04 /* DSP RAM D0 block A access */ -#define SYSC_MCMGID_DSPRAM0B 0x05 /* DSP RAM D0 block B access */ -#define SYSC_MCMGID_DSPRAM1A 0x06 /* DSP RAM D1 block A access */ -#define SYSC_MCMGID_DSPRAM1B 0x07 /* DSP RAM D1 block B access */ -#define SYSC_MCMGID_DCACHEL 0x08 /* DCACHE lines (64-bytes/line) */ -#ifdef METAC_2_1 -#define SYSC_MCMGID_DCACHETLB 0x09 /* DCACHE TLB ( Read Only ) */ -#endif /* METAC_2_1 */ -#define SYSC_MCMGID_DCACHET 0x0A /* DCACHE tags (32-bits/line) */ -#define SYSC_MCMGID_DCACHELRU 0x0B /* DCACHE LRU (8-bits/line) */ -#define SYSC_MCMGID_ICACHEL 0x0C /* ICACHE lines (64-bytes/line */ -#ifdef METAC_2_1 -#define SYSC_MCMGID_ICACHETLB 0x0D /* ICACHE TLB (Read Only ) */ -#endif /* METAC_2_1 */ -#define SYSC_MCMGID_ICACHET 0x0E /* ICACHE Tags (32-bits/line) */ -#define SYSC_MCMGID_ICACHELRU 0x0F /* ICACHE LRU (8-bits/line ) */ -#define SYSC_MCMGID_COREIRAM0 0x10 /* Core code mem id 0 */ -#define SYSC_MCMGID_COREIRAMn 0x17 -#define SYSC_MCMGID_COREDRAM0 0x18 /* Core data mem id 0 */ -#define SYSC_MCMGID_COREDRAMn 0x1F -#ifdef METAC_2_1 -#define SYSC_MCMGID_DCACHEST 0x20 /* DCACHE ST ( Read Only ) */ -#define SYSC_MCMGID_ICACHEST 0x21 /* ICACHE ST ( Read Only ) */ -#define SYSC_MCMGID_DCACHETLBLRU 0x22 /* DCACHE TLB LRU ( Read Only )*/ -#define SYSC_MCMGID_ICACHETLBLRU 0x23 /* ICACHE TLB LRU( Read Only ) */ -#define SYSC_MCMGID_DCACHESTLRU 0x24 /* DCACHE ST LRU ( Read Only ) */ -#define SYSC_MCMGID_ICACHESTLRU 0x25 /* ICACHE ST LRU ( Read Only ) */ -#define SYSC_MCMGID_DEBUGTLB 0x26 /* DEBUG TLB ( Read Only ) */ -#define SYSC_MCMGID_DEBUGST 0x27 /* DEBUG ST ( Read Only ) */ -#define SYSC_MCMGID_L2CACHEL 0x30 /* L2 Cache Lines (64-bytes/line) */ -#define SYSC_MCMGID_L2CACHET 0x31 /* L2 Cache Tags (32-bits/line) */ -#define SYSC_MCMGID_COPROX0 0x70 /* Coprocessor port id 0 */ -#define SYSC_MCMGID_COPROXn 0x77 -#endif /* METAC_2_1 */ -#define SYSC_MCMGCTRL_TR31_BIT 0x80000000 /* Trigger 31 on completion */ -#define SYSC_MCMSTATUS 0x04830318 /* Status read only */ -#define SYSC_MCMSTATUS_IDLE_BIT 0x00000001 - -/* META System Events */ -#define SYSC_SYS_EVENT 0x04830400 -#define SYSC_SYSEVT_ATOMIC_BIT 0x00000001 -#define SYSC_SYSEVT_CACHEX_BIT 0x00000002 -#define SYSC_ATOMIC_LOCK 0x04830408 -#define SYSC_ATOMIC_STATE_TX_BITS 0x0000000F -#define SYSC_ATOMIC_STATE_TX_S 0 -#ifdef METAC_1_2 -#define SYSC_ATOMIC_STATE_DX_BITS 0x000000F0 -#define SYSC_ATOMIC_STATE_DX_S 4 -#else /* METAC_1_2 */ -#define SYSC_ATOMIC_SOURCE_BIT 0x00000010 -#endif /* !METAC_1_2 */ - - -#ifdef METAC_2_1 - -/* These definitions replace the EXPAND_TIMER_DIV register defines which are to - * be deprecated. - */ -#define SYSC_TIMER_DIV 0x04830140 -#define SYSC_TIMDIV_BITS 0x000000FF -#define SYSC_TIMDIV_S 0 - -/* META Enhanced by-pass control for local and global region */ -#define MMCU_LOCAL_EBCTRL 0x04830600 -#define MMCU_GLOBAL_EBCTRL 0x04830608 -#define MMCU_EBCTRL_SINGLE_BIT 0x00000020 /* TLB Uncached */ -/* - * These fields in the above registers provide MMCU_ENTRY_* values - * for each direct mapped region to enable optimisation of these areas. - */ -#define MMCU_EBCTRL_DCCTRL_BITS 0x000000C0 /* Get DC Ctrl */ -#define MMCU_EBCTRL_DCCTRL_S 0 -#define MMCU_EBCTRL_ICCTRL_BITS 0x0000C000 /* Get DC Ctrl */ -#define MMCU_EBCTRL_ICCTRL_S 8 - -/* META Cached Core Mode Registers */ -#define MMCU_T0CCM_ICCTRL 0x04830680 /* Core cached code control */ -#define MMCU_TnCCM_xxCTRL_STRIDE 8 -#define MMCU_TnCCM_xxCTRL_STRIDE_S 3 -#define MMCU_T1CCM_ICCTRL 0x04830688 -#define MMCU_T2CCM_ICCTRL 0x04830690 -#define MMCU_T3CCM_ICCTRL 0x04830698 -#define MMCU_T0CCM_DCCTRL 0x048306C0 /* Core cached data control */ -#define MMCU_T1CCM_DCCTRL 0x048306C8 -#define MMCU_T2CCM_DCCTRL 0x048306D0 -#define MMCU_T3CCM_DCCTRL 0x048306D8 -#define MMCU_TnCCM_ENABLE_BIT 0x00000001 -#define MMCU_TnCCM_WIN3_BIT 0x00000002 -#define MMCU_TnCCM_DCWRITE_BIT 0x00000004 /* In DCCTRL only */ -#define MMCU_TnCCM_REGSZ_BITS 0x00000F00 -#define MMCU_TnCCM_REGSZ_S 8 -#define MMCU_TnCCM_REGSZ0_POWER 12 /* RegSz 0 -> 4K */ -#define MMCU_TnCCM_REGSZ_MAXBYTES 0x00080000 /* 512K max */ -#define MMCU_TnCCM_ADDR_BITS 0xFFFFF000 -#define MMCU_TnCCM_ADDR_S 12 - -#endif /* METAC_2_1 */ - -/* - * Hardware performance counter registers - * -------------------------------------- - */ -#ifdef METAC_2_1 -/* Two Performance Counter Internal Core Events Control registers */ -#define PERF_ICORE0 0x0480FFD0 -#define PERF_ICORE1 0x0480FFD8 -#define PERFI_CTRL_BITS 0x0000000F -#define PERFI_CTRL_S 0 -#define PERFI_CAH_DMISS 0x0 /* Dcache Misses in cache (TLB Hit) */ -#define PERFI_CAH_IMISS 0x1 /* Icache Misses in cache (TLB Hit) */ -#define PERFI_TLB_DMISS 0x2 /* Dcache Misses in per-thread TLB */ -#define PERFI_TLB_IMISS 0x3 /* Icache Misses in per-thread TLB */ -#define PERFI_TLB_DWRHITS 0x4 /* DC Write-Hits in per-thread TLB */ -#define PERFI_TLB_DWRMISS 0x5 /* DC Write-Miss in per-thread TLB */ -#define PERFI_CAH_DLFETCH 0x8 /* DC Read cache line fetch */ -#define PERFI_CAH_ILFETCH 0x9 /* DC Read cache line fetch */ -#define PERFI_CAH_DWFETCH 0xA /* DC Read cache word fetch */ -#define PERFI_CAH_IWFETCH 0xB /* DC Read cache word fetch */ -#endif /* METAC_2_1 */ - -/* Two memory-mapped hardware performance counter registers */ -#define PERF_COUNT0 0x0480FFE0 -#define PERF_COUNT1 0x0480FFE8 - -/* Fields in PERF_COUNTn registers */ -#define PERF_COUNT_BITS 0x00ffffff /* Event count value */ - -#define PERF_THREAD_BITS 0x0f000000 /* Thread mask selects threads */ -#define PERF_THREAD_S 24 - -#define PERF_CTRL_BITS 0xf0000000 /* Event filter control */ -#define PERF_CTRL_S 28 - -#define PERFCTRL_SUPER 0 /* Superthread cycles */ -#define PERFCTRL_REWIND 1 /* Rewinds due to Dcache Misses */ -#ifdef METAC_2_1 -#define PERFCTRL_SUPREW 2 /* Rewinds of superthreaded cycles (no mask) */ - -#define PERFCTRL_CYCLES 3 /* Counts all cycles (no mask) */ - -#define PERFCTRL_PREDBC 4 /* Conditional branch predictions */ -#define PERFCTRL_MISPBC 5 /* Conditional branch mispredictions */ -#define PERFCTRL_PREDRT 6 /* Return predictions */ -#define PERFCTRL_MISPRT 7 /* Return mispredictions */ -#endif /* METAC_2_1 */ - -#define PERFCTRL_DHITS 8 /* Dcache Hits */ -#define PERFCTRL_IHITS 9 /* Icache Hits */ -#define PERFCTRL_IMISS 10 /* Icache Misses in cache or TLB */ -#ifdef METAC_2_1 -#define PERFCTRL_DCSTALL 11 /* Dcache+TLB o/p delayed (per-thread) */ -#define PERFCTRL_ICSTALL 12 /* Icache+TLB o/p delayed (per-thread) */ - -#define PERFCTRL_INT 13 /* Internal core detailed events (see next) */ -#define PERFCTRL_EXT 15 /* External source in core periphery */ -#endif /* METAC_2_1 */ - -#ifdef METAC_2_1 -/* These definitions replace the EXPAND_PERFCHANx register defines which are to - * be deprecated. - */ -#define PERF_CHAN0 0x04830150 -#define PERF_CHAN1 0x04830158 -#define PERF_CHAN_BITS 0x0000000F -#define PERF_CHAN_S 0 -#define PERFCHAN_WRC_WRBURST 0x0 /* Write combiner write burst */ -#define PERFCHAN_WRC_WRITE 0x1 /* Write combiner write */ -#define PERFCHAN_WRC_RDBURST 0x2 /* Write combiner read burst */ -#define PERFCHAN_WRC_READ 0x3 /* Write combiner read */ -#define PERFCHAN_PREARB_DELAY 0x4 /* Pre-arbiter delay cycle */ - /* Cross-bar hold-off cycle: */ -#define PERFCHAN_XBAR_HOLDWRAP 0x5 /* wrapper register */ -#define PERFCHAN_XBAR_HOLDSBUS 0x6 /* system bus (ATP only) */ -#define PERFCHAN_XBAR_HOLDCREG 0x9 /* core registers */ -#define PERFCHAN_L2C_MISS 0x6 /* L2 Cache miss */ -#define PERFCHAN_L2C_HIT 0x7 /* L2 Cache hit */ -#define PERFCHAN_L2C_WRITEBACK 0x8 /* L2 Cache writeback */ - /* Admission delay cycle: */ -#define PERFCHAN_INPUT_CREG 0xB /* core registers */ -#define PERFCHAN_INPUT_INTR 0xC /* internal ram */ -#define PERFCHAN_INPUT_WRC 0xD /* write combiners(memory) */ - -/* Should following be removed as not in TRM anywhere? */ -#define PERFCHAN_XBAR_HOLDINTR 0x8 /* internal ram */ -#define PERFCHAN_INPUT_SBUS 0xA /* register port */ -/* End of remove section. */ - -#define PERFCHAN_MAINARB_DELAY 0xF /* Main arbiter delay cycle */ - -#endif /* METAC_2_1 */ - -#ifdef METAC_2_1 -/* - * Write combiner registers - * ------------------------ - * - * These replace the EXPAND_T0WRCOMBINE register defines, which will be - * deprecated. - */ -#define WRCOMB_CONFIG0 0x04830100 -#define WRCOMB_LFFEn_BIT 0x00004000 /* Enable auto line full flush */ -#define WRCOMB_ENABLE_BIT 0x00002000 /* Enable write combiner */ -#define WRCOMB_TIMEOUT_ENABLE_BIT 0x00001000 /* Timeout flush enable */ -#define WRCOMB_TIMEOUT_COUNT_BITS 0x000003FF -#define WRCOMB_TIMEOUT_COUNT_S 0 -#define WRCOMB_CONFIG4 0x04830180 -#define WRCOMB_PARTALLOC_BITS 0x000000C0 -#define WRCOMB_PARTALLOC_S 64 -#define WRCOMB_PARTSIZE_BITS 0x00000030 -#define WRCOMB_PARTSIZE_S 4 -#define WRCOMB_PARTOFFSET_BITS 0x0000000F -#define WRCOMB_PARTOFFSET_S 0 -#define WRCOMB_CONFIG_STRIDE 8 -#endif /* METAC_2_1 */ - -#ifdef METAC_2_1 -/* - * Thread arbiter registers - * ------------------------ - * - * These replace the EXPAND_T0ARBITER register defines, which will be - * deprecated. - */ -#define ARBITER_ARBCONFIG0 0x04830120 -#define ARBCFG_BPRIORITY_BIT 0x02000000 -#define ARBCFG_IPRIORITY_BIT 0x01000000 -#define ARBCFG_PAGE_BITS 0x00FF0000 -#define ARBCFG_PAGE_S 16 -#define ARBCFG_BBASE_BITS 0x0000FF00 -#define ARGCFG_BBASE_S 8 -#define ARBCFG_IBASE_BITS 0x000000FF -#define ARBCFG_IBASE_S 0 -#define ARBITER_TTECONFIG0 0x04820160 -#define ARBTTE_IUPPER_BITS 0xFF000000 -#define ARBTTE_IUPPER_S 24 -#define ARBTTE_ILOWER_BITS 0x00FF0000 -#define ARBTTE_ILOWER_S 16 -#define ARBTTE_BUPPER_BITS 0x0000FF00 -#define ARBTTE_BUPPER_S 8 -#define ARBTTE_BLOWER_BITS 0x000000FF -#define ARBTTE_BLOWER_S 0 -#define ARBITER_STRIDE 8 -#endif /* METAC_2_1 */ - -/* - * Expansion area registers - * -------------------------------------- - */ - -/* These defines are to be deprecated. See above instead. */ -#define EXPAND_T0WRCOMBINE 0x03000000 -#ifdef METAC_2_1 -#define EXPWRC_LFFEn_BIT 0x00004000 /* Enable auto line full flush */ -#endif /* METAC_2_1 */ -#define EXPWRC_ENABLE_BIT 0x00002000 /* Enable write combiner */ -#define EXPWRC_TIMEOUT_ENABLE_BIT 0x00001000 /* Timeout flush enable */ -#define EXPWRC_TIMEOUT_COUNT_BITS 0x000003FF -#define EXPWRC_TIMEOUT_COUNT_S 0 -#define EXPAND_TnWRCOMBINE_STRIDE 0x00000008 - -/* These defines are to be deprecated. See above instead. */ -#define EXPAND_T0ARBITER 0x03000020 -#define EXPARB_BPRIORITY_BIT 0x02000000 -#define EXPARB_IPRIORITY_BIT 0x01000000 -#define EXPARB_PAGE_BITS 0x00FF0000 -#define EXPARB_PAGE_S 16 -#define EXPARB_BBASE_BITS 0x0000FF00 -#define EXPARB_BBASE_S 8 -#define EXPARB_IBASE_BITS 0x000000FF -#define EXPARB_IBASE_S 0 -#define EXPAND_TnARBITER_STRIDE 0x00000008 - -/* These definitions are to be deprecated. See above instead. */ -#define EXPAND_TIMER_DIV 0x03000040 -#define EXPTIM_DIV_BITS 0x000000FF -#define EXPTIM_DIV_S 0 - -/* These definitions are to be deprecated. See above instead. */ -#define EXPAND_PERFCHAN0 0x03000050 -#define EXPAND_PERFCHAN1 0x03000058 -#define EXPPERF_CTRL_BITS 0x0000000F -#define EXPPERF_CTRL_S 0 -#define EXPPERF_WRC_WRBURST 0x0 /* Write combiner write burst */ -#define EXPPERF_WRC_WRITE 0x1 /* Write combiner write */ -#define EXPPERF_WRC_RDBURST 0x2 /* Write combiner read burst */ -#define EXPPERF_WRC_READ 0x3 /* Write combiner read */ -#define EXPPERF_PREARB_DELAY 0x4 /* Pre-arbiter delay cycle */ - /* Cross-bar hold-off cycle: */ -#define EXPPERF_XBAR_HOLDWRAP 0x5 /* wrapper register */ -#define EXPPERF_XBAR_HOLDSBUS 0x6 /* system bus */ -#ifdef METAC_1_2 -#define EXPPERF_XBAR_HOLDLBUS 0x7 /* local bus */ -#else /* METAC_1_2 */ -#define EXPPERF_XBAR_HOLDINTR 0x8 /* internal ram */ -#define EXPPERF_XBAR_HOLDCREG 0x9 /* core registers */ - /* Admission delay cycle: */ -#define EXPPERF_INPUT_SBUS 0xA /* register port */ -#define EXPPERF_INPUT_CREG 0xB /* core registers */ -#define EXPPERF_INPUT_INTR 0xC /* internal ram */ -#define EXPPERF_INPUT_WRC 0xD /* write combiners(memory) */ -#endif /* !METAC_1_2 */ -#define EXPPERF_MAINARB_DELAY 0xF /* Main arbiter delay cycle */ - -/* - * Debug port registers - * -------------------------------------- - */ - -/* Data Exchange Register */ -#define DBGPORT_MDBGDATAX 0x0 - -/* Data Transfer register */ -#define DBGPORT_MDBGDATAT 0x4 - -/* Control Register 0 */ -#define DBGPORT_MDBGCTRL0 0x8 -#define DBGPORT_MDBGCTRL0_ADDR_BITS 0xFFFFFFFC -#define DBGPORT_MDBGCTRL0_ADDR_S 2 -#define DBGPORT_MDBGCTRL0_AUTOINCR_BIT 0x00000002 -#define DBGPORT_MDBGCTRL0_RD_BIT 0x00000001 - -/* Control Register 1 */ -#define DBGPORT_MDBGCTRL1 0xC -#ifdef METAC_2_1 -#define DBGPORT_MDBGCTRL1_DEFERRTHREAD_BITS 0xC0000000 -#define DBGPORT_MDBGCTRL1_DEFERRTHREAD_S 30 -#endif /* METAC_2_1 */ -#define DBGPORT_MDBGCTRL1_LOCK2_INTERLOCK_BIT 0x20000000 -#define DBGPORT_MDBGCTRL1_ATOMIC_INTERLOCK_BIT 0x10000000 -#define DBGPORT_MDBGCTRL1_TRIGSTATUS_BIT 0x08000000 -#define DBGPORT_MDBGCTRL1_GBLPORT_IDLE_BIT 0x04000000 -#define DBGPORT_MDBGCTRL1_COREMEM_IDLE_BIT 0x02000000 -#define DBGPORT_MDBGCTRL1_READY_BIT 0x01000000 -#ifdef METAC_2_1 -#define DBGPORT_MDBGCTRL1_DEFERRID_BITS 0x00E00000 -#define DBGPORT_MDBGCTRL1_DEFERRID_S 21 -#define DBGPORT_MDBGCTRL1_DEFERR_BIT 0x00100000 -#endif /* METAC_2_1 */ -#define DBGPORT_MDBGCTRL1_WR_ACTIVE_BIT 0x00040000 -#define DBGPORT_MDBGCTRL1_COND_LOCK2_BIT 0x00020000 -#define DBGPORT_MDBGCTRL1_LOCK2_BIT 0x00010000 -#define DBGPORT_MDBGCTRL1_DIAGNOSE_BIT 0x00008000 -#define DBGPORT_MDBGCTRL1_FORCEDIAG_BIT 0x00004000 -#define DBGPORT_MDBGCTRL1_MEMFAULT_BITS 0x00003000 -#define DBGPORT_MDBGCTRL1_MEMFAULT_S 12 -#define DBGPORT_MDBGCTRL1_TRIGGER_BIT 0x00000100 -#ifdef METAC_2_1 -#define DBGPORT_MDBGCTRL1_INTSPECIAL_BIT 0x00000080 -#define DBGPORT_MDBGCTRL1_INTRUSIVE_BIT 0x00000040 -#endif /* METAC_2_1 */ -#define DBGPORT_MDBGCTRL1_THREAD_BITS 0x00000030 /* Thread mask selects threads */ -#define DBGPORT_MDBGCTRL1_THREAD_S 4 -#define DBGPORT_MDBGCTRL1_TRANS_SIZE_BITS 0x0000000C -#define DBGPORT_MDBGCTRL1_TRANS_SIZE_S 2 -#define DBGPORT_MDBGCTRL1_TRANS_SIZE_32_BIT 0x00000000 -#define DBGPORT_MDBGCTRL1_TRANS_SIZE_16_BIT 0x00000004 -#define DBGPORT_MDBGCTRL1_TRANS_SIZE_8_BIT 0x00000008 -#define DBGPORT_MDBGCTRL1_BYTE_ROUND_BITS 0x00000003 -#define DBGPORT_MDBGCTRL1_BYTE_ROUND_S 0 -#define DBGPORT_MDBGCTRL1_BYTE_ROUND_8_BIT 0x00000001 -#define DBGPORT_MDBGCTRL1_BYTE_ROUND_16_BIT 0x00000002 - - -/* L2 Cache registers */ -#define SYSC_L2C_INIT 0x048300C0 -#define SYSC_L2C_INIT_INIT 1 -#define SYSC_L2C_INIT_IN_PROGRESS 0 -#define SYSC_L2C_INIT_COMPLETE 1 - -#define SYSC_L2C_ENABLE 0x048300D0 -#define SYSC_L2C_ENABLE_ENABLE_BIT 0x00000001 -#define SYSC_L2C_ENABLE_PFENABLE_BIT 0x00000002 - -#define SYSC_L2C_PURGE 0x048300C8 -#define SYSC_L2C_PURGE_PURGE 1 -#define SYSC_L2C_PURGE_IN_PROGRESS 0 -#define SYSC_L2C_PURGE_COMPLETE 1 - -#endif /* _ASM_METAG_MEM_H_ */ diff --git a/arch/metag/include/asm/metag_regs.h b/arch/metag/include/asm/metag_regs.h deleted file mode 100644 index 60b750971d8a1..0000000000000 --- a/arch/metag/include/asm/metag_regs.h +++ /dev/null @@ -1,1184 +0,0 @@ -/* - * asm/metag_regs.h - * - * Copyright (C) 2000-2007, 2012 Imagination Technologies. - * - * 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. - * - * Various defines for Meta core (non memory-mapped) registers. - */ - -#ifndef _ASM_METAG_REGS_H_ -#define _ASM_METAG_REGS_H_ - -/* - * CHIP Unit Identifiers and Valid/Global register number masks - * ------------------------------------------------------------ - */ -#define TXUCT_ID 0x0 /* Control unit regs */ -#ifdef METAC_1_2 -#define TXUCT_MASK 0xFF0FFFFF /* Valid regs 0..31 */ -#else -#define TXUCT_MASK 0xFF1FFFFF /* Valid regs 0..31 */ -#endif -#define TGUCT_MASK 0x00000000 /* No global regs */ -#define TXUD0_ID 0x1 /* Data unit regs */ -#define TXUD1_ID 0x2 -#define TXUDX_MASK 0xFFFFFFFF /* Valid regs 0..31 */ -#define TGUDX_MASK 0xFFFF0000 /* Global regs for base inst */ -#define TXUDXDSP_MASK 0x0F0FFFFF /* Valid DSP regs */ -#define TGUDXDSP_MASK 0x0E0E0000 /* Global DSP ACC regs */ -#define TXUA0_ID 0x3 /* Address unit regs */ -#define TXUA1_ID 0x4 -#define TXUAX_MASK 0x0000FFFF /* Valid regs 0-15 */ -#define TGUAX_MASK 0x0000FF00 /* Global regs 8-15 */ -#define TXUPC_ID 0x5 /* PC registers */ -#define TXUPC_MASK 0x00000003 /* Valid regs 0- 1 */ -#define TGUPC_MASK 0x00000000 /* No global regs */ -#define TXUPORT_ID 0x6 /* Ports are not registers */ -#define TXUTR_ID 0x7 -#define TXUTR_MASK 0x0000005F /* Valid regs 0-3,4,6 */ -#define TGUTR_MASK 0x00000000 /* No global regs */ -#ifdef METAC_2_1 -#define TXUTT_ID 0x8 -#define TXUTT_MASK 0x0000000F /* Valid regs 0-3 */ -#define TGUTT_MASK 0x00000010 /* Global reg 4 */ -#define TXUFP_ID 0x9 /* FPU regs */ -#define TXUFP_MASK 0x0000FFFF /* Valid regs 0-15 */ -#define TGUFP_MASK 0x00000000 /* No global regs */ -#endif /* METAC_2_1 */ - -#ifdef METAC_1_2 -#define TXUXX_MASKS { TXUCT_MASK, TXUDX_MASK, TXUDX_MASK, TXUAX_MASK, \ - TXUAX_MASK, TXUPC_MASK, 0, TXUTR_MASK, \ - 0, 0, 0, 0, 0, 0, 0, 0 } -#define TGUXX_MASKS { TGUCT_MASK, TGUDX_MASK, TGUDX_MASK, TGUAX_MASK, \ - TGUAX_MASK, TGUPC_MASK, 0, TGUTR_MASK, \ - 0, 0, 0, 0, 0, 0, 0, 0 } -#else /* METAC_1_2 */ -#define TXUXX_MASKS { TXUCT_MASK, TXUDX_MASK, TXUDX_MASK, TXUAX_MASK, \ - TXUAX_MASK, TXUPC_MASK, 0, TXUTR_MASK, \ - TXUTT_MASK, TXUFP_MASK, 0, 0, \ - 0, 0, 0, 0 } -#define TGUXX_MASKS { TGUCT_MASK, TGUDX_MASK, TGUDX_MASK, TGUAX_MASK, \ - TGUAX_MASK, TGUPC_MASK, 0, TGUTR_MASK, \ - TGUTT_MASK, TGUFP_MASK, 0, 0, \ - 0, 0, 0, 0 } -#endif /* !METAC_1_2 */ - -#define TXUXXDSP_MASKS { 0, TXUDXDSP_MASK, TXUDXDSP_MASK, 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0, 0, 0, 0 } -#define TGUXXDSP_MASKS { 0, TGUDXDSP_MASK, TGUDXDSP_MASK, 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0, 0, 0, 0 } - -/* ------------------------------------------------------------------------- -; DATA AND ADDRESS UNIT REGISTERS -; -----------------------------------------------------------------------*/ -/* - Thread local D0 registers - */ -/* D0.0 ; Holds 32-bit result, can be used as scratch */ -#define D0Re0 D0.0 -/* D0.1 ; Used to pass Arg6_32 */ -#define D0Ar6 D0.1 -/* D0.2 ; Used to pass Arg4_32 */ -#define D0Ar4 D0.2 -/* D0.3 ; Used to pass Arg2_32 to a called routine (see D1.3 below) */ -#define D0Ar2 D0.3 -/* D0.4 ; Can be used as scratch; used to save A0FrP in entry sequences */ -#define D0FrT D0.4 -/* D0.5 ; C compiler assumes preservation, save with D1.5 if used */ -/* D0.6 ; C compiler assumes preservation, save with D1.6 if used */ -/* D0.7 ; C compiler assumes preservation, save with D1.7 if used */ -/* D0.8 ; Use of D0.8 and above is not encouraged */ -/* D0.9 */ -/* D0.10 */ -/* D0.11 */ -/* D0.12 */ -/* D0.13 */ -/* D0.14 */ -/* D0.15 */ -/* - Thread local D1 registers - */ -/* D1.0 ; Holds top 32-bits of 64-bit result, can be used as scratch */ -#define D1Re0 D1.0 -/* D1.1 ; Used to pass Arg5_32 */ -#define D1Ar5 D1.1 -/* D1.2 ; Used to pass Arg3_32 */ -#define D1Ar3 D1.2 -/* D1.3 ; Used to pass Arg1_32 (first 32-bit argument) to a called routine */ -#define D1Ar1 D1.3 -/* D1.4 ; Used for Return Pointer, save during entry with A0FrP (via D0.4) */ -#define D1RtP D1.4 -/* D1.5 ; C compiler assumes preservation, save if used */ -/* D1.6 ; C compiler assumes preservation, save if used */ -/* D1.7 ; C compiler assumes preservation, save if used */ -/* D1.8 ; Use of D1.8 and above is not encouraged */ -/* D1.9 */ -/* D1.10 */ -/* D1.11 */ -/* D1.12 */ -/* D1.13 */ -/* D1.14 */ -/* D1.15 */ -/* - Thread local A0 registers - */ -/* A0.0 ; Primary stack pointer */ -#define A0StP A0.0 -/* A0.1 ; Used as local frame pointer in C, save if used (via D0.4) */ -#define A0FrP A0.1 -/* A0.2 */ -/* A0.3 */ -/* A0.4 ; Use of A0.4 and above is not encouraged */ -/* A0.5 */ -/* A0.6 */ -/* A0.7 */ -/* - Thread local A1 registers - */ -/* A1.0 ; Global static chain pointer - do not modify */ -#define A1GbP A1.0 -/* A1.1 ; Local static chain pointer in C, can be used as scratch */ -#define A1LbP A1.1 -/* A1.2 */ -/* A1.3 */ -/* A1.4 ; Use of A1.4 and above is not encouraged */ -/* A1.5 */ -/* A1.6 */ -/* A1.7 */ -#ifdef METAC_2_1 -/* Renameable registers for use with Fast Interrupts */ -/* The interrupt stack pointer (usually a global register) */ -#define A0IStP A0IReg -/* The interrupt global pointer (usually a global register) */ -#define A1IGbP A1IReg -#endif -/* - Further registers may be globally allocated via linkage/loading tools, - normally they are not used. - */ -/*------------------------------------------------------------------------- -; STACK STRUCTURE and CALLING CONVENTION -; -----------------------------------------------------------------------*/ -/* -; Calling convention indicates that the following is the state of the -; stack frame at the start of a routine- -; -; Arg9_32 [A0StP+#-12] -; Arg8_32 [A0StP+#- 8] -; Arg7_32 [A0StP+#- 4] -; A0StP-> -; -; Registers D1.3, D0.3, ..., to D0.1 are used to pass Arg1_32 to Arg6_32 -; respectively. If a routine needs to store them on the stack in order -; to make sub-calls or because of the general complexity of the routine it -; is best to dump these registers immediately at the start of a routine -; using a MSETL or SETL instruction- -; -; MSETL [A0StP],D0Ar6,D0Ar4,D0Ar2; Only dump arguments expected -;or SETL [A0StP+#8++],D0Ar2 ; Up to two 32-bit args expected -; -; For non-leaf routines it is always necessary to save and restore at least -; the return address value D1RtP on the stack. Also by convention if the -; frame is saved then a new A0FrP value must be set-up. So for non-leaf -; routines at this point both these registers must be saved onto the stack -; using a SETL instruction and the new A0FrP value is then set-up- -; -; MOV D0FrT,A0FrP -; ADD A0FrP,A0StP,#0 -; SETL [A0StP+#8++],D0FrT,D1RtP -; -; Registers D0.5, D1.5, to D1.7 are assumed to be preserved across calls so -; a SETL or MSETL instruction can be used to save the current state -; of these registers if they are modified by the current routine- -; -; MSETL [A0StP],D0.5,D0.6,D0.7 ; Only save registers modified -;or SETL [A0StP+#8++],D0.5 ; Only D0.5 and/or D1.5 modified -; -; All of the above sequences can be combined into one maximal case- -; -; MOV D0FrT,A0FrP ; Save and calculate new frame pointer -; ADD A0FrP,A0StP,#(ARS) -; MSETL [A0StP],D0Ar6,D0Ar4,D0Ar2,D0FrT,D0.5,D0.6,D0.7 -; -; Having completed the above sequence the only remaining task on routine -; entry is to reserve any local and outgoing argment storage space on the -; stack. This instruction may be omitted if the size of this region is zero- -; -; ADD A0StP,A0StP,#(LCS) -; -; LCS is the first example use of one of a number of standard local defined -; values that can be created to make assembler code more readable and -; potentially more robust- -; -; #define ARS 0x18 ; Register arg bytes saved on stack -; #define FRS 0x20 ; Frame save area size in bytes -; #define LCS 0x00 ; Locals and Outgoing arg size -; #define ARO (LCS+FRS) ; Stack offset to access args -; -; All of the above defines should be undefined (#undef) at the end of each -; routine to avoid accidental use in the next routine. -; -; Given all of the above the following stack structure is expected during -; the body of a routine if all args passed in registers are saved during -; entry- -; -; ; 'Incoming args area' -; Arg10_32 [A0StP+#-((10*4)+ARO)] Arg9_32 [A0StP+#-(( 9*4)+ARO)] -; Arg8_32 [A0StP+#-(( 8*4)+ARO)] Arg7_32 [A0StP+#-(( 7*4)+ARO)] -;--- Call point -; D0Ar6= Arg6_32 [A0StP+#-(( 6*4)+ARO)] D1Ar5=Arg5_32 [A0StP+#-(( 5*4)+ARO)] -; D0Ar4= Arg4_32 [A0StP+#-(( 4*4)+ARO)] D1Ar3=Arg3_32 [A0StP+#-(( 3*4)+ARO)] -; D0Ar2= Arg2_32 [A0StP+#-(( 2*4)+ARO)] D1Ar2=Arg1_32 [A0StP+#-(( 1*4)+ARO)] -; ; 'Frame area' -; A0FrP-> D0FrT, D1RtP, -; D0.5, D1.5, -; D0.6, D1.6, -; D0.7, D1.7, -; ; 'Locals area' -; Loc0_32 [A0StP+# (( 0*4)-LCS)], Loc1_32 [A0StP+# (( 1*4)-LCS)] -; .... other locals -; Locn_32 [A0StP+# (( n*4)-LCS)] -; ; 'Outgoing args area' -; Outm_32 [A0StP+#- ( m*4)] .... other outgoing args -; Out8_32 [A0StP+#- ( 1*4)] Out7_32 [A0StP+#- ( 1*4)] -; A0StP-> (Out1_32-Out6_32 in regs D1Ar1-D0Ar6) -; -; The exit sequence for a non-leaf routine can use the frame pointer created -; in the entry sequence to optimise the recovery of the full state- -; -; MGETL D0FrT,D0.5,D0.6,D0.7,[A0FrP] -; SUB A0StP,A0FrP,#(ARS+FRS) -; MOV A0FrP,D0FrT -; MOV PC,D1RtP -; -; Having described the most complex non-leaf case above, it is worth noting -; that if a routine is a leaf and does not use any of the caller-preserved -; state. The routine can be implemented as- -; -; ADD A0StP,A0StP,#LCS -; .... body of routine -; SUB A0StP,A0StP,#LCS -; MOV PC,D1RtP -; -; The stack adjustments can also be omitted if no local storage is required. -; -; Another exit sequence structure is more applicable if for a leaf routine -; with no local frame pointer saved/generated in which the call saved -; registers need to be saved and restored- -; -; MSETL [A0StP],D0.5,D0.6,D0.7 ; Hence FRS is 0x18, ARS is 0x00 -; ADD A0StP,A0StP,#LCS -; .... body of routine -; GETL D0.5,D1.5,[A0StP+#((0*8)-(FRS+LCS))] -; GETL D0.6,D1.6,[A0StP+#((1*8)-(FRS+LCS))] -; GETL D0.7,D1.7,[A0StP+#((2*8)-(FRS+LCS))] -; SUB A0StP,A0StP,#(ARS+FRS+LCS) -; MOV PC,D1RtP -; -; Lastly, to support profiling assembler code should use a fixed entry/exit -; sequence if the trigger define _GMON_ASM is defined- -; -; #ifndef _GMON_ASM -; ... optimised entry code -; #else -; ; Profiling entry case -; MOV D0FrT,A0FrP ; Save and calculate new frame pointer -; ADD A0FrP,A0StP,#(ARS) -; MSETL [A0StP],...,D0FrT,... or SETL [A0FrP],D0FrT,D1RtP -; CALLR D0FrT,_mcount_wrapper -; #endif -; ... body of routine -; #ifndef _GMON_ASM -; ... optimised exit code -; #else -; ; Profiling exit case -; MGETL D0FrT,...,[A0FrP] or GETL D0FrT,D1RtP,[A0FrP++] -; SUB A0StP,A0FrP,#(ARS+FRS) -; MOV A0FrP,D0FrT -; MOV PC,D1RtP -; #endif - - -; ------------------------------------------------------------------------- -; CONTROL UNIT REGISTERS -; ------------------------------------------------------------------------- -; -; See the assembler guide, hardware documentation, or the field values -; defined below for some details of the use of these registers. -*/ -#define TXENABLE CT.0 /* Need to define bit-field values in these */ -#define TXMODE CT.1 -#define TXSTATUS CT.2 /* DEFAULT 0x00020000 */ -#define TXRPT CT.3 -#define TXTIMER CT.4 -#define TXL1START CT.5 -#define TXL1END CT.6 -#define TXL1COUNT CT.7 -#define TXL2START CT.8 -#define TXL2END CT.9 -#define TXL2COUNT CT.10 -#define TXBPOBITS CT.11 -#define TXMRSIZE CT.12 -#define TXTIMERI CT.13 -#define TXDRCTRL CT.14 /* DEFAULT 0x0XXXF0F0 */ -#define TXDRSIZE CT.15 -#define TXCATCH0 CT.16 -#define TXCATCH1 CT.17 -#define TXCATCH2 CT.18 -#define TXCATCH3 CT.19 - -#ifdef METAC_2_1 -#define TXDEFR CT.20 -#define TXCPRS CT.21 -#endif - -#define TXINTERN0 CT.23 -#define TXAMAREG0 CT.24 -#define TXAMAREG1 CT.25 -#define TXAMAREG2 CT.26 -#define TXAMAREG3 CT.27 -#define TXDIVTIME CT.28 /* DEFAULT 0x00000001 */ -#define TXPRIVEXT CT.29 /* DEFAULT 0x003B0000 */ -#define TXTACTCYC CT.30 -#define TXIDLECYC CT.31 - -/***************************************************************************** - * CONTROL UNIT REGISTER BITS - ****************************************************************************/ -/* - * The following registers and where appropriate the sub-fields of those - * registers are defined for pervasive use in controlling program flow. - */ - -/* - * TXENABLE register fields - only the thread id is routinely useful - */ -#define TXENABLE_REGNUM 0 -#define TXENABLE_THREAD_BITS 0x00000700 -#define TXENABLE_THREAD_S 8 -#define TXENABLE_REV_STEP_BITS 0x000000F0 -#define TXENABLE_REV_STEP_S 4 - -/* - * TXMODE register - controls extensions of the instruction set - */ -#define TXMODE_REGNUM 1 -#define TXMODE_DEFAULT 0 /* All fields default to zero */ - -/* - * TXSTATUS register - contains a couple of stable bits that can be used - * to determine the privilege processing level and interrupt - * processing level of the current thread. - */ -#define TXSTATUS_REGNUM 2 -#define TXSTATUS_PSTAT_BIT 0x00020000 /* -> Privilege active */ -#define TXSTATUS_PSTAT_S 17 -#define TXSTATUS_ISTAT_BIT 0x00010000 /* -> In interrupt state */ -#define TXSTATUS_ISTAT_S 16 - -/* - * These are all relatively boring registers, mostly full 32-bit - */ -#define TXRPT_REGNUM 3 /* Repeat counter for XFR... instructions */ -#define TXTIMER_REGNUM 4 /* Timer-- causes timer trigger on overflow */ -#define TXL1START_REGNUM 5 /* Hardware Loop 1 Start-PC/End-PC/Count */ -#define TXL1END_REGNUM 6 -#define TXL1COUNT_REGNUM 7 -#define TXL2START_REGNUM 8 /* Hardware Loop 2 Start-PC/End-PC/Count */ -#define TXL2END_REGNUM 9 -#define TXL2COUNT_REGNUM 10 -#define TXBPOBITS_REGNUM 11 /* Branch predict override bits - tune perf */ -#define TXTIMERI_REGNUM 13 /* Timer-- time based interrupt trigger */ - -/* - * TXDIVTIME register is routinely read to calculate the time-base for - * the TXTIMER register. - */ -#define TXDIVTIME_REGNUM 28 -#define TXDIVTIME_DIV_BITS 0x000000FF -#define TXDIVTIME_DIV_S 0 -#define TXDIVTIME_DIV_MIN 0x00000001 /* Maximum resolution */ -#define TXDIVTIME_DIV_MAX 0x00000100 /* 1/1 -> 1/256 resolution */ -#define TXDIVTIME_BASE_HZ 1000000 /* Timers run at 1Mhz @1/1 */ - -/* - * TXPRIVEXT register can be consulted to decide if write access to a - * part of the threads register set is not permitted when in - * unprivileged mode (PSTAT == 0). - */ -#define TXPRIVEXT_REGNUM 29 -#define TXPRIVEXT_COPRO_BITS 0xFF000000 /* Co-processor 0-7 */ -#define TXPRIVEXT_COPRO_S 24 -#ifndef METAC_1_2 -#define TXPRIVEXT_TXTIMER_BIT 0x00080000 /* TXTIMER priv */ -#define TXPRIVEXT_TRACE_BIT 0x00040000 /* TTEXEC|TTCTRL|GTEXEC */ -#endif -#define TXPRIVEXT_TXTRIGGER_BIT 0x00020000 /* TXSTAT|TXMASK|TXPOLL */ -#define TXPRIVEXT_TXGBLCREG_BIT 0x00010000 /* Global common regs */ -#define TXPRIVEXT_CBPRIV_BIT 0x00008000 /* Mem i/f dump priv */ -#define TXPRIVEXT_ILOCK_BIT 0x00004000 /* LOCK inst priv */ -#define TXPRIVEXT_TXITACCYC_BIT 0x00002000 /* TXIDLECYC|TXTACTCYC */ -#define TXPRIVEXT_TXDIVTIME_BIT 0x00001000 /* TXDIVTIME priv */ -#define TXPRIVEXT_TXAMAREGX_BIT 0x00000800 /* TXAMAREGX priv */ -#define TXPRIVEXT_TXTIMERI_BIT 0x00000400 /* TXTIMERI priv */ -#define TXPRIVEXT_TXSTATUS_BIT 0x00000200 /* TXSTATUS priv */ -#define TXPRIVEXT_TXDISABLE_BIT 0x00000100 /* TXENABLE priv */ -#ifndef METAC_1_2 -#define TXPRIVEXT_MINIMON_BIT 0x00000080 /* Enable Minim features */ -#define TXPRIVEXT_OLDBCCON_BIT 0x00000020 /* Restore Static predictions */ -#define TXPRIVEXT_ALIGNREW_BIT 0x00000010 /* Align & precise checks */ -#endif -#define TXPRIVEXT_KEEPPRI_BIT 0x00000008 /* Use AMA_Priority if ISTAT=1*/ -#define TXPRIVEXT_TXTOGGLEI_BIT 0x00000001 /* TX.....I priv */ - -/* - * TXTACTCYC register - counts instructions issued for this thread - */ -#define TXTACTCYC_REGNUM 30 -#define TXTACTCYC_COUNT_MASK 0x00FFFFFF - -/* - * TXIDLECYC register - counts idle cycles - */ -#define TXIDLECYC_REGNUM 31 -#define TXIDLECYC_COUNT_MASK 0x00FFFFFF - -/***************************************************************************** - * DSP EXTENSIONS - ****************************************************************************/ -/* - * The following values relate to fields and controls that only a program - * using the DSP extensions of the META instruction set need to know. - */ - - -#ifndef METAC_1_2 -/* - * Allow co-processor hardware to replace the read pipeline data source in - * appropriate cases. - */ -#define TXMODE_RDCPEN_BIT 0x00800000 -#endif - -/* - * Address unit addressing modes - */ -#define TXMODE_A1ADDR_BITS 0x00007000 -#define TXMODE_A1ADDR_S 12 -#define TXMODE_A0ADDR_BITS 0x00000700 -#define TXMODE_A0ADDR_S 8 -#define TXMODE_AXADDR_MODULO 3 -#define TXMODE_AXADDR_REVB 4 -#define TXMODE_AXADDR_REVW 5 -#define TXMODE_AXADDR_REVD 6 -#define TXMODE_AXADDR_REVL 7 - -/* - * Data unit OverScale select (default 0 -> normal, 1 -> top 16 bits) - */ -#define TXMODE_DXOVERSCALE_BIT 0x00000080 - -/* - * Data unit MX mode select (default 0 -> MX16, 1 -> MX8) - */ -#define TXMODE_M8_BIT 0x00000040 - -/* - * Data unit accumulator saturation point (default -> 40 bit accumulator) - */ -#define TXMODE_DXACCSAT_BIT 0x00000020 /* Set for 32-bit accumulator */ - -/* - * Data unit accumulator saturation enable (default 0 -> no saturation) - */ -#define TXMODE_DXSAT_BIT 0x00000010 - -/* - * Data unit master rounding control (default 0 -> normal, 1 -> convergent) - */ -#define TXMODE_DXROUNDING_BIT 0x00000008 - -/* - * Data unit product shift for fractional arithmetic (default off) - */ -#define TXMODE_DXPRODSHIFT_BIT 0x00000004 - -/* - * Select the arithmetic mode (multiply mostly) for both data units - */ -#define TXMODE_DXARITH_BITS 0x00000003 -#define TXMODE_DXARITH_32 3 -#define TXMODE_DXARITH_32H 2 -#define TXMODE_DXARITH_S16 1 -#define TXMODE_DXARITH_16 0 - -/* - * TXMRSIZE register value only relevant when DSP modulo addressing active - */ -#define TXMRSIZE_REGNUM 12 -#define TXMRSIZE_MIN 0x0002 /* 0, 1 -> normal addressing logic */ -#define TXMRSIZE_MAX 0xFFFF - -/* - * TXDRCTRL register can be used to detect the actaul size of the DSP RAM - * partitions allocated to this thread. - */ -#define TXDRCTRL_REGNUM 14 -#define TXDRCTRL_SINESIZE_BITS 0x0F000000 -#define TXDRCTRL_SINESIZE_S 24 -#define TXDRCTRL_RAMSZPOW_BITS 0x001F0000 /* Limit = (1< DSP Thread */ -#define TXENABLE_CLASS_LDSP 0x8 /* -> DSP LITE Thread */ -#define TXENABLE_CLASS_GP 0xC /* -> General Purpose Thread */ -#define TXENABLE_CLASSALT_LFPU 0x2 /* Set to indicate LITE FPU */ -#define TXENABLE_CLASSALT_FPUR8 0x1 /* Set to indicate 8xFPU regs */ -#define TXENABLE_MTXARCH_BIT 0x00000800 -#define TXENABLE_STEP_REV_BITS 0x000000F0 -#define TXENABLE_STEP_REV_S 4 -#define TXENABLE_STOPPED_BIT 0x00000004 /* TXOFF due to ENABLE->0 */ -#define TXENABLE_OFF_BIT 0x00000002 /* Thread is in off state */ -#define TXENABLE_ENABLE_BIT 0x00000001 /* Set if running */ - -/* - * TXSTATUS register - used by external/internal interrupt/error handler - */ -#define TXSTATUS_CB1MARKER_BIT 0x00800000 /* -> int level mem state */ -#define TXSTATUS_CBMARKER_BIT 0x00400000 /* -> mem i/f state dumped */ -#define TXSTATUS_MEM_FAULT_BITS 0x00300000 -#define TXSTATUS_MEM_FAULT_S 20 -#define TXSTATUS_MEMFAULT_NONE 0x0 /* -> No memory fault */ -#define TXSTATUS_MEMFAULT_GEN 0x1 /* -> General fault */ -#define TXSTATUS_MEMFAULT_PF 0x2 /* -> Page fault */ -#define TXSTATUS_MEMFAULT_RO 0x3 /* -> Read only fault */ -#define TXSTATUS_MAJOR_HALT_BITS 0x000C0000 -#define TXSTATUS_MAJOR_HALT_S 18 -#define TXSTATUS_MAJHALT_TRAP 0x0 /* -> SWITCH inst used */ -#define TXSTATUS_MAJHALT_INST 0x1 /* -> Unknown inst or fetch */ -#define TXSTATUS_MAJHALT_PRIV 0x2 /* -> Internal privilege */ -#define TXSTATUS_MAJHALT_MEM 0x3 /* -> Memory i/f fault */ -#define TXSTATUS_L_STEP_BITS 0x00000800 /* -> Progress of L oper */ -#define TXSTATUS_LSM_STEP_BITS 0x00000700 /* -> Progress of L/S mult */ -#define TXSTATUS_LSM_STEP_S 8 -#define TXSTATUS_FLAG_BITS 0x0000001F /* -> All the flags */ -#define TXSTATUS_SCC_BIT 0x00000010 /* -> Split-16 flags ... */ -#define TXSTATUS_SCF_LZ_BIT 0x00000008 /* -> Split-16 Low Z flag */ -#define TXSTATUS_SCF_HZ_BIT 0x00000004 /* -> Split-16 High Z flag */ -#define TXSTATUS_SCF_HC_BIT 0x00000002 /* -> Split-16 High C flag */ -#define TXSTATUS_SCF_LC_BIT 0x00000001 /* -> Split-16 Low C flag */ -#define TXSTATUS_CF_Z_BIT 0x00000008 /* -> Condition Z flag */ -#define TXSTATUS_CF_N_BIT 0x00000004 /* -> Condition N flag */ -#define TXSTATUS_CF_O_BIT 0x00000002 /* -> Condition O flag */ -#define TXSTATUS_CF_C_BIT 0x00000001 /* -> Condition C flag */ - -/* - * TXCATCH0-3 register contents may store information on a memory operation - * that has failed if the bit TXSTATUS_CBMARKER_BIT is set. - */ -#define TXCATCH0_REGNUM 16 -#define TXCATCH1_REGNUM 17 -#define TXCATCH1_ADDR_BITS 0xFFFFFFFF /* TXCATCH1 is Addr 0-31 */ -#define TXCATCH1_ADDR_S 0 -#define TXCATCH2_REGNUM 18 -#define TXCATCH2_DATA0_BITS 0xFFFFFFFF /* TXCATCH2 is Data 0-31 */ -#define TXCATCH2_DATA0_S 0 -#define TXCATCH3_REGNUM 19 -#define TXCATCH3_DATA1_BITS 0xFFFFFFFF /* TXCATCH3 is Data 32-63 */ -#define TXCATCH3_DATA1_S 0 - -/* - * Detailed catch state information - * -------------------------------- - */ - -/* Contents of TXCATCH0 register */ -#define TXCATCH0_LDRXX_BITS 0xF8000000 /* Load destination reg 0-31 */ -#define TXCATCH0_LDRXX_S 27 -#define TXCATCH0_LDDST_BITS 0x07FF0000 /* Load destination bits */ -#define TXCATCH0_LDDST_S 16 -#define TXCATCH0_LDDST_D1DSP 0x400 /* One bit set if it's a LOAD */ -#define TXCATCH0_LDDST_D0DSP 0x200 -#define TXCATCH0_LDDST_TMPLT 0x100 -#define TXCATCH0_LDDST_TR 0x080 -#ifdef METAC_2_1 -#define TXCATCH0_LDDST_FPU 0x040 -#endif -#define TXCATCH0_LDDST_PC 0x020 -#define TXCATCH0_LDDST_A1 0x010 -#define TXCATCH0_LDDST_A0 0x008 -#define TXCATCH0_LDDST_D1 0x004 -#define TXCATCH0_LDDST_D0 0x002 -#define TXCATCH0_LDDST_CT 0x001 -#ifdef METAC_2_1 -#define TXCATCH0_WATCHSTOP_BIT 0x00004000 /* Set if Data Watch set fault */ -#endif -#define TXCATCH0_WATCHS_BIT 0x00004000 /* Set if Data Watch set fault */ -#define TXCATCH0_WATCH1_BIT 0x00002000 /* Set if Data Watch 1 matches */ -#define TXCATCH0_WATCH0_BIT 0x00001000 /* Set if Data Watch 0 matches */ -#define TXCATCH0_FAULT_BITS 0x00000C00 /* See TXSTATUS_MEMFAULT_* */ -#define TXCATCH0_FAULT_S 10 -#define TXCATCH0_PRIV_BIT 0x00000200 /* Privilege of transaction */ -#define TXCATCH0_READ_BIT 0x00000100 /* Set for Read or Load cases */ - -#ifdef METAC_2_1 -/* LNKGET Marker bit in TXCATCH0 */ -#define TXCATCH0_LNKGET_MARKER_BIT 0x00000008 -#define TXCATCH0_PREPROC_BIT 0x00000004 -#endif - -/* Loads are indicated by one of the LDDST bits being set */ -#define TXCATCH0_LDM16_BIT 0x00000004 /* Load M16 flag */ -#define TXCATCH0_LDL2L1_BITS 0x00000003 /* Load data size L2,L1 */ -#define TXCATCH0_LDL2L1_S 0 - -/* Reads are indicated by the READ bit being set without LDDST bits */ -#define TXCATCH0_RAXX_BITS 0x0000001F /* RAXX issue port for read */ -#define TXCATCH0_RAXX_S 0 - -/* Write operations are all that remain if READ bit is not set */ -#define TXCATCH0_WMASK_BITS 0x000000FF /* Write byte lane mask */ -#define TXCATCH0_WMASK_S 0 - -#ifdef METAC_2_1 - -/* When a FPU exception is signalled then FPUSPEC == FPUSPEC_TAG */ -#define TXCATCH0_FPURDREG_BITS 0xF8000000 -#define TXCATCH0_FPURDREG_S 27 -#define TXCATCH0_FPUR1REG_BITS 0x07C00000 -#define TXCATCH0_FPUR1REG_S 22 -#define TXCATCH0_FPUSPEC_BITS 0x000F0000 -#define TXCATCH0_FPUSPEC_S 16 -#define TXCATCH0_FPUSPEC_TAG 0xF -#define TXCATCH0_FPUINSTA_BIT 0x00001000 -#define TXCATCH0_FPUINSTQ_BIT 0x00000800 -#define TXCATCH0_FPUINSTZ_BIT 0x00000400 -#define TXCATCH0_FPUINSTN_BIT 0x00000200 -#define TXCATCH0_FPUINSTO3O_BIT 0x00000100 -#define TXCATCH0_FPUWIDTH_BITS 0x000000C0 -#define TXCATCH0_FPUWIDTH_S 6 -#define TXCATCH0_FPUWIDTH_FLOAT 0 -#define TXCATCH0_FPUWIDTH_DOUBLE 1 -#define TXCATCH0_FPUWIDTH_PAIRED 2 -#define TXCATCH0_FPUOPENC_BITS 0x0000003F -#define TXCATCH0_FPUOPENC_S 0 -#define TXCATCH0_FPUOPENC_ADD 0 /* rop1=Rs1, rop3=Rs2 */ -#define TXCATCH0_FPUOPENC_SUB 1 /* rop1=Rs1, rop3=Rs2 */ -#define TXCATCH0_FPUOPENC_MUL 2 /* rop1=Rs1, rop2=Rs2 */ -#define TXCATCH0_FPUOPENC_ATOI 3 /* rop3=Rs */ -#define TXCATCH0_FPUOPENC_ATOX 4 /* rop3=Rs, uses #Imm */ -#define TXCATCH0_FPUOPENC_ITOA 5 /* rop3=Rs */ -#define TXCATCH0_FPUOPENC_XTOA 6 /* rop3=Rs, uses #Imm */ -#define TXCATCH0_FPUOPENC_ATOH 7 /* rop2=Rs */ -#define TXCATCH0_FPUOPENC_HTOA 8 /* rop2=Rs */ -#define TXCATCH0_FPUOPENC_DTOF 9 /* rop3=Rs */ -#define TXCATCH0_FPUOPENC_FTOD 10 /* rop3=Rs */ -#define TXCATCH0_FPUOPENC_DTOL 11 /* rop3=Rs */ -#define TXCATCH0_FPUOPENC_LTOD 12 /* rop3=Rs */ -#define TXCATCH0_FPUOPENC_DTOXL 13 /* rop3=Rs, uses #imm */ -#define TXCATCH0_FPUOPENC_XLTOD 14 /* rop3=Rs, uses #imm */ -#define TXCATCH0_FPUOPENC_CMP 15 /* rop1=Rs1, rop2=Rs2 */ -#define TXCATCH0_FPUOPENC_MIN 16 /* rop1=Rs1, rop2=Rs2 */ -#define TXCATCH0_FPUOPENC_MAX 17 /* rop1=Rs1, rop2=Rs2 */ -#define TXCATCH0_FPUOPENC_ADDRE 18 /* rop1=Rs1, rop3=Rs2 */ -#define TXCATCH0_FPUOPENC_SUBRE 19 /* rop1=Rs1, rop3=Rs2 */ -#define TXCATCH0_FPUOPENC_MULRE 20 /* rop1=Rs1, rop2=Rs2 */ -#define TXCATCH0_FPUOPENC_MXA 21 /* rop1=Rs1, rop2=Rs2, rop3=Rs3*/ -#define TXCATCH0_FPUOPENC_MXAS 22 /* rop1=Rs1, rop2=Rs2, rop3=Rs3*/ -#define TXCATCH0_FPUOPENC_MAR 23 /* rop1=Rs1, rop2=Rs2 */ -#define TXCATCH0_FPUOPENC_MARS 24 /* rop1=Rs1, rop2=Rs2 */ -#define TXCATCH0_FPUOPENC_MUZ 25 /* rop1=Rs1, rop2=Rs2, rop3=Rs3*/ -#define TXCATCH0_FPUOPENC_MUZS 26 /* rop1=Rs1, rop2=Rs2, rop3=Rs3*/ -#define TXCATCH0_FPUOPENC_RCP 27 /* rop2=Rs */ -#define TXCATCH0_FPUOPENC_RSQ 28 /* rop2=Rs */ - -/* For floating point exceptions TXCATCH1 is used to carry extra data */ -#define TXCATCH1_FPUR2REG_BITS 0xF8000000 -#define TXCATCH1_FPUR2REG_S 27 -#define TXCATCH1_FPUR3REG_BITS 0x07C00000 /* Undefined if O3O set */ -#define TXCATCH1_FPUR3REG_S 22 -#define TXCATCH1_FPUIMM16_BITS 0x0000FFFF -#define TXCATCH1_FPUIMM16_S 0 - -#endif /* METAC_2_1 */ - -/* - * TXDIVTIME register used to hold the partial base address of memory i/f - * state dump area. Now deprecated. - */ -#define TXDIVTIME_CBBASE_MASK 0x03FFFE00 -#define TXDIVTIME_CBBASE_LINBASE 0x80000000 -#define TXDIVTIME_CBBASE_LINBOFF 0x00000000 /* BGnd state */ -#define TXDIVTIME_CBBASE_LINIOFF 0x00000100 /* Int state */ - -/* - * TXDIVTIME register used to indicate if the read pipeline was dirty when a - * thread was interrupted, halted, or generated an exception. It is invalid - * to attempt to issue a further pipeline read address while the read - * pipeline is in the dirty state. - */ -#define TXDIVTIME_RPDIRTY_BIT 0x80000000 - -/* - * Further bits in the TXDIVTIME register allow interrupt handling code to - * short-cut the discovery the most significant bit last read from TXSTATI. - * - * This is the bit number of the trigger line that a low level interrupt - * handler should acknowledge and then perhaps the index of a corresponding - * handler function. - */ -#define TXDIVTIME_IRQENC_BITS 0x0F000000 -#define TXDIVTIME_IRQENC_S 24 - -/* - * If TXDIVTIME_RPVALID_BIT is set the read pipeline contained significant - * information when the thread was interrupted|halted|exceptioned. Each slot - * containing data is indicated by a one bit in the corresponding - * TXDIVTIME_RPMASK_BITS bit (least significance bit relates to first - * location in read pipeline - most likely to have the 1 state). Empty slots - * contain zeroes with no interlock applied on reads if RPDIRTY is currently - * set with RPMASK itself being read-only state. - */ -#define TXDIVTIME_RPMASK_BITS 0x003F0000 /* -> Full (1) Empty (0) */ -#define TXDIVTIME_RPMASK_S 16 - -/* - * TXPRIVEXT register can be used to single step thread execution and - * enforce synchronous memory i/f address checking for debugging purposes. - */ -#define TXPRIVEXT_TXSTEP_BIT 0x00000004 -#define TXPRIVEXT_MEMCHECK_BIT 0x00000002 - -/* - * TXINTERNx registers holds internal state information for H/W debugging only - */ -#define TXINTERN0_REGNUM 23 -#define TXINTERN0_LOCK2_BITS 0xF0000000 -#define TXINTERN0_LOCK2_S 28 -#define TXINTERN0_LOCK1_BITS 0x0F000000 -#define TXINTERN0_LOCK1_S 24 -#define TXINTERN0_TIFDF_BITS 0x0000F000 -#define TXINTERN0_TIFDF_S 12 -#define TXINTERN0_TIFIB_BITS 0x00000F00 -#define TXINTERN0_TIFIB_S 8 -#define TXINTERN0_TIFAF_BITS 0x000000F0 -#define TXINTERN0_TIFAF_S 4 -#define TXINTERN0_MSTATE_BITS 0x0000000F -#define TXINTERN0_MSTATE_S 0 - -/* - * TXSTAT, TXMASK, TXPOLL, TXSTATI, TXMASKI, TXPOLLI registers from trigger - * bank all have similar contents (upper kick count bits not in MASK regs) - */ -#define TXSTAT_REGNUM 0 -#define TXSTAT_TIMER_BIT 0x00000001 -#define TXSTAT_TIMER_S 0 -#define TXSTAT_KICK_BIT 0x00000002 -#define TXSTAT_KICK_S 1 -#define TXSTAT_DEFER_BIT 0x00000008 -#define TXSTAT_DEFER_S 3 -#define TXSTAT_EXTTRIG_BITS 0x0000FFF0 -#define TXSTAT_EXTTRIG_S 4 -#define TXSTAT_FPE_BITS 0x003F0000 -#define TXSTAT_FPE_S 16 -#define TXSTAT_FPE_DENORMAL_BIT 0x00200000 -#define TXSTAT_FPE_DENORMAL_S 21 -#define TXSTAT_FPE_INVALID_BIT 0x00100000 -#define TXSTAT_FPE_INVALID_S 20 -#define TXSTAT_FPE_DIVBYZERO_BIT 0x00080000 -#define TXSTAT_FPE_DIVBYZERO_S 19 -#define TXSTAT_FPE_OVERFLOW_BIT 0x00040000 -#define TXSTAT_FPE_OVERFLOW_S 18 -#define TXSTAT_FPE_UNDERFLOW_BIT 0x00020000 -#define TXSTAT_FPE_UNDERFLOW_S 17 -#define TXSTAT_FPE_INEXACT_BIT 0x00010000 -#define TXSTAT_FPE_INEXACT_S 16 -#define TXSTAT_BUSERR_BIT 0x00800000 /* Set if bus error/ack state */ -#define TXSTAT_BUSERR_S 23 -#define TXSTAT_BUSSTATE_BITS 0xFF000000 /* Read only */ -#define TXSTAT_BUSSTATE_S 24 -#define TXSTAT_KICKCNT_BITS 0xFFFF0000 -#define TXSTAT_KICKCNT_S 16 -#define TXMASK_REGNUM 1 -#define TXSTATI_REGNUM 2 -#define TXSTATI_BGNDHALT_BIT 0x00000004 -#define TXMASKI_REGNUM 3 -#define TXPOLL_REGNUM 4 -#define TXPOLLI_REGNUM 6 - -/* - * TXDRCTRL register can be used to partition the DSP RAM space available to - * this thread at startup. This is achieved by offsetting the region allocated - * to each thread. - */ -#define TXDRCTRL_D1PARTOR_BITS 0x00000F00 /* OR's into top 4 bits */ -#define TXDRCTRL_D1PARTOR_S 8 -#define TXDRCTRL_D0PARTOR_BITS 0x0000000F /* OR's into top 4 bits */ -#define TXDRCTRL_D0PARTOR_S 0 -/* Given extracted Pow and Or fields this is threads base within DSP RAM */ -#define TXDRCTRL_DXBASE(Pow, Or) ((Or)<<((Pow)-4)) - -/***************************************************************************** - * RUN TIME TRACE CONTROL REGISTERS - ****************************************************************************/ -/* - * The following values are only relevant to code that implements run-time - * trace features within the META Core - */ -#define TTEXEC TT.0 -#define TTCTRL TT.1 -#define TTMARK TT.2 -#define TTREC TT.3 -#define GTEXEC TT.4 - -#define TTEXEC_REGNUM 0 -#define TTEXEC_EXTTRIGAND_BITS 0x7F000000 -#define TTEXEC_EXTTRIGAND_S 24 -#define TTEXEC_EXTTRIGEN_BIT 0x00008000 -#define TTEXEC_EXTTRIGMATCH_BITS 0x00007F00 -#define TTEXEC_EXTTRIGMATCH_S 8 -#define TTEXEC_TCMODE_BITS 0x00000003 -#define TTEXEC_TCMODE_S 0 - -#define TTCTRL_REGNUM 1 -#define TTCTRL_TRACETT_BITS 0x00008000 -#define TTCTRL_TRACETT_S 15 -#define TTCTRL_TRACEALL_BITS 0x00002000 -#define TTCTRL_TRACEALL_S 13 -#ifdef METAC_2_1 -#define TTCTRL_TRACEALLTAG_BITS 0x00000400 -#define TTCTRL_TRACEALLTAG_S 10 -#endif /* METAC_2_1 */ -#define TTCTRL_TRACETAG_BITS 0x00000200 -#define TTCTRL_TRACETAG_S 9 -#define TTCTRL_TRACETTPC_BITS 0x00000080 -#define TTCTRL_TRACETTPC_S 7 -#define TTCTRL_TRACEMPC_BITS 0x00000020 -#define TTCTRL_TRACEMPC_S 5 -#define TTCTRL_TRACEEN_BITS 0x00000008 -#define TTCTRL_TRACEEN_S 3 -#define TTCTRL_TRACEEN1_BITS 0x00000004 -#define TTCTRL_TRACEEN1_S 2 -#define TTCTRL_TRACEPC_BITS 0x00000002 -#define TTCTRL_TRACEPC_S 1 - -#ifdef METAC_2_1 -#define TTMARK_REGNUM 2 -#define TTMARK_BITS 0xFFFFFFFF -#define TTMARK_S 0x0 - -#define TTREC_REGNUM 3 -#define TTREC_BITS 0xFFFFFFFFFFFFFFFF -#define TTREC_S 0x0 -#endif /* METAC_2_1 */ - -#define GTEXEC_REGNUM 4 -#define GTEXEC_DCRUN_BITS 0x80000000 -#define GTEXEC_DCRUN_S 31 -#define GTEXEC_ICMODE_BITS 0x0C000000 -#define GTEXEC_ICMODE_S 26 -#define GTEXEC_TCMODE_BITS 0x03000000 -#define GTEXEC_TCMODE_S 24 -#define GTEXEC_PERF1CMODE_BITS 0x00040000 -#define GTEXEC_PERF1CMODE_S 18 -#define GTEXEC_PERF0CMODE_BITS 0x00010000 -#define GTEXEC_PERF0CMODE_S 16 -#define GTEXEC_REFMSEL_BITS 0x0000F000 -#define GTEXEC_REFMSEL_S 12 -#define GTEXEC_METRICTH_BITS 0x000003FF -#define GTEXEC_METRICTH_S 0 - -#ifdef METAC_2_1 -/* - * Clock Control registers - * ----------------------- - */ -#define TXCLKCTRL_REGNUM 22 - -/* - * Default setting is with clocks always on (DEFON), turning all clocks off - * can only be done from external devices (OFF), enabling automatic clock - * gating will allow clocks to stop as units fall idle. - */ -#define TXCLKCTRL_ALL_OFF 0x02222222 -#define TXCLKCTRL_ALL_DEFON 0x01111111 -#define TXCLKCTRL_ALL_AUTO 0x02222222 - -/* - * Individual fields control caches, floating point and main data/addr units - */ -#define TXCLKCTRL_CLOCKIC_BITS 0x03000000 -#define TXCLKCTRL_CLOCKIC_S 24 -#define TXCLKCTRL_CLOCKDC_BITS 0x00300000 -#define TXCLKCTRL_CLOCKDC_S 20 -#define TXCLKCTRL_CLOCKFP_BITS 0x00030000 -#define TXCLKCTRL_CLOCKFP_S 16 -#define TXCLKCTRL_CLOCKD1_BITS 0x00003000 -#define TXCLKCTRL_CLOCKD1_S 12 -#define TXCLKCTRL_CLOCKD0_BITS 0x00000300 -#define TXCLKCTRL_CLOCKD0_S 8 -#define TXCLKCTRL_CLOCKA1_BITS 0x00000030 -#define TXCLKCTRL_CLOCKA1_S 4 -#define TXCLKCTRL_CLOCKA0_BITS 0x00000003 -#define TXCLKCTRL_CLOCKA0_S 0 - -/* - * Individual settings for each field are common - */ -#define TXCLKCTRL_CLOCKxx_OFF 0 -#define TXCLKCTRL_CLOCKxx_DEFON 1 -#define TXCLKCTRL_CLOCKxx_AUTO 2 - -#endif /* METAC_2_1 */ - -#ifdef METAC_2_1 -/* - * Fast interrupt new bits - * ------------------------------------ - */ -#define TXSTATUS_IPTOGGLE_BIT 0x80000000 /* Prev PToggle of TXPRIVEXT */ -#define TXSTATUS_ISTATE_BIT 0x40000000 /* IState bit */ -#define TXSTATUS_IWAIT_BIT 0x20000000 /* wait indefinitely in decision step*/ -#define TXSTATUS_IEXCEPT_BIT 0x10000000 /* Indicate an exception occurred */ -#define TXSTATUS_IRPCOUNT_BITS 0x0E000000 /* Number of 'dirty' date entries*/ -#define TXSTATUS_IRPCOUNT_S 25 -#define TXSTATUS_IRQSTAT_BITS 0x0000F000 /* IRQEnc bits, trigger or interrupts */ -#define TXSTATUS_IRQSTAT_S 12 -#define TXSTATUS_LNKSETOK_BIT 0x00000020 /* LNKSetOK bit, successful LNKSET */ - -/* New fields in TXDE for fast interrupt system */ -#define TXDIVTIME_IACTIVE_BIT 0x00008000 /* Enable new interrupt system */ -#define TXDIVTIME_INONEST_BIT 0x00004000 /* Gate nested interrupt */ -#define TXDIVTIME_IREGIDXGATE_BIT 0x00002000 /* gate of the IRegIdex field */ -#define TXDIVTIME_IREGIDX_BITS 0x00001E00 /* Index of A0.0/1 replaces */ -#define TXDIVTIME_IREGIDX_S 9 -#define TXDIVTIME_NOST_BIT 0x00000100 /* disable superthreading bit */ -#endif - -#endif /* _ASM_METAG_REGS_H_ */ diff --git a/arch/metag/include/asm/mman.h b/arch/metag/include/asm/mman.h deleted file mode 100644 index dcb0d20a64fd8..0000000000000 --- a/arch/metag/include/asm/mman.h +++ /dev/null @@ -1,12 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __METAG_MMAN_H__ -#define __METAG_MMAN_H__ - -#include - -#ifndef __ASSEMBLY__ -#define arch_mmap_check metag_mmap_check -int metag_mmap_check(unsigned long addr, unsigned long len, - unsigned long flags); -#endif -#endif /* __METAG_MMAN_H__ */ diff --git a/arch/metag/include/asm/mmu.h b/arch/metag/include/asm/mmu.h deleted file mode 100644 index cab5a01c3dcb8..0000000000000 --- a/arch/metag/include/asm/mmu.h +++ /dev/null @@ -1,78 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __MMU_H -#define __MMU_H - -#ifdef CONFIG_METAG_USER_TCM -#include -#endif - -#ifdef CONFIG_HUGETLB_PAGE -#include -#endif - -typedef struct { - /* Software pgd base pointer used for Meta 1.x MMU. */ - unsigned long pgd_base; -#ifdef CONFIG_METAG_USER_TCM - struct list_head tcm; -#endif -#ifdef CONFIG_HUGETLB_PAGE -#if HPAGE_SHIFT < HUGEPT_SHIFT - /* last partially filled huge page table address */ - unsigned long part_huge; -#endif -#endif -} mm_context_t; - -/* Given a virtual address, return the pte for the top level 4meg entry - * that maps that address. - * Returns 0 (an empty pte) if that range is not mapped. - */ -unsigned long mmu_read_first_level_page(unsigned long vaddr); - -/* Given a linear (virtual) address, return the second level 4k pte - * that maps that address. Returns 0 if the address is not mapped. - */ -unsigned long mmu_read_second_level_page(unsigned long vaddr); - -/* Get the virtual base address of the MMU */ -unsigned long mmu_get_base(void); - -/* Initialize the MMU. */ -void mmu_init(unsigned long mem_end); - -#ifdef CONFIG_METAG_META21_MMU -/* - * For cpu "cpu" calculate and return the address of the - * MMCU_TnLOCAL_TABLE_PHYS0 if running in local-space or - * MMCU_TnGLOBAL_TABLE_PHYS0 if running in global-space. - */ -static inline unsigned long mmu_phys0_addr(unsigned int cpu) -{ - unsigned long phys0; - - phys0 = (MMCU_T0LOCAL_TABLE_PHYS0 + - (MMCU_TnX_TABLE_PHYSX_STRIDE * cpu)) + - (MMCU_TXG_TABLE_PHYSX_OFFSET * is_global_space(PAGE_OFFSET)); - - return phys0; -} - -/* - * For cpu "cpu" calculate and return the address of the - * MMCU_TnLOCAL_TABLE_PHYS1 if running in local-space or - * MMCU_TnGLOBAL_TABLE_PHYS1 if running in global-space. - */ -static inline unsigned long mmu_phys1_addr(unsigned int cpu) -{ - unsigned long phys1; - - phys1 = (MMCU_T0LOCAL_TABLE_PHYS1 + - (MMCU_TnX_TABLE_PHYSX_STRIDE * cpu)) + - (MMCU_TXG_TABLE_PHYSX_OFFSET * is_global_space(PAGE_OFFSET)); - - return phys1; -} -#endif /* CONFIG_METAG_META21_MMU */ - -#endif diff --git a/arch/metag/include/asm/mmu_context.h b/arch/metag/include/asm/mmu_context.h deleted file mode 100644 index 7b47663796222..0000000000000 --- a/arch/metag/include/asm/mmu_context.h +++ /dev/null @@ -1,115 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __METAG_MMU_CONTEXT_H -#define __METAG_MMU_CONTEXT_H - -#include - -#include -#include -#include -#include - -#include -#include - -static inline void enter_lazy_tlb(struct mm_struct *mm, - struct task_struct *tsk) -{ -} - -static inline int init_new_context(struct task_struct *tsk, - struct mm_struct *mm) -{ -#ifndef CONFIG_METAG_META21_MMU - /* We use context to store a pointer to the page holding the - * pgd of a process while it is running. While a process is not - * running the pgd and context fields should be equal. - */ - mm->context.pgd_base = (unsigned long) mm->pgd; -#endif -#ifdef CONFIG_METAG_USER_TCM - INIT_LIST_HEAD(&mm->context.tcm); -#endif - return 0; -} - -#ifdef CONFIG_METAG_USER_TCM - -#include -#include - -static inline void destroy_context(struct mm_struct *mm) -{ - struct tcm_allocation *pos, *n; - - list_for_each_entry_safe(pos, n, &mm->context.tcm, list) { - tcm_free(pos->tag, pos->addr, pos->size); - list_del(&pos->list); - kfree(pos); - } -} -#else -#define destroy_context(mm) do { } while (0) -#endif - -#ifdef CONFIG_METAG_META21_MMU -static inline void load_pgd(pgd_t *pgd, int thread) -{ - unsigned long phys0 = mmu_phys0_addr(thread); - unsigned long phys1 = mmu_phys1_addr(thread); - - /* - * 0x900 2Gb address space - * The permission bits apply to MMU table region which gives a 2MB - * window into physical memory. We especially don't want userland to be - * able to access this. - */ - metag_out32(0x900 | _PAGE_CACHEABLE | _PAGE_PRIV | _PAGE_WRITE | - _PAGE_PRESENT, phys0); - /* Set new MMU base address */ - metag_out32(__pa(pgd) & MMCU_TBLPHYS1_ADDR_BITS, phys1); -} -#endif - -static inline void switch_mmu(struct mm_struct *prev, struct mm_struct *next) -{ -#ifdef CONFIG_METAG_META21_MMU - load_pgd(next->pgd, hard_processor_id()); -#else - unsigned int i; - - /* prev->context == prev->pgd in the case where we are initially - switching from the init task to the first process. */ - if (prev->context.pgd_base != (unsigned long) prev->pgd) { - for (i = FIRST_USER_PGD_NR; i < USER_PTRS_PER_PGD; i++) - ((pgd_t *) prev->context.pgd_base)[i] = prev->pgd[i]; - } else - prev->pgd = (pgd_t *)mmu_get_base(); - - next->pgd = prev->pgd; - prev->pgd = (pgd_t *) prev->context.pgd_base; - - for (i = FIRST_USER_PGD_NR; i < USER_PTRS_PER_PGD; i++) - next->pgd[i] = ((pgd_t *) next->context.pgd_base)[i]; - - flush_cache_all(); -#endif - flush_tlb_all(); -} - -static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, - struct task_struct *tsk) -{ - if (prev != next) - switch_mmu(prev, next); -} - -static inline void activate_mm(struct mm_struct *prev_mm, - struct mm_struct *next_mm) -{ - switch_mmu(prev_mm, next_mm); -} - -#define deactivate_mm(tsk, mm) do { } while (0) - -#endif diff --git a/arch/metag/include/asm/mmzone.h b/arch/metag/include/asm/mmzone.h deleted file mode 100644 index 8627fb5322062..0000000000000 --- a/arch/metag/include/asm/mmzone.h +++ /dev/null @@ -1,43 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __ASM_METAG_MMZONE_H -#define __ASM_METAG_MMZONE_H - -#ifdef CONFIG_NEED_MULTIPLE_NODES -#include - -extern struct pglist_data *node_data[]; -#define NODE_DATA(nid) (node_data[nid]) - -static inline int pfn_to_nid(unsigned long pfn) -{ - int nid; - - for (nid = 0; nid < MAX_NUMNODES; nid++) - if (pfn >= node_start_pfn(nid) && pfn <= node_end_pfn(nid)) - break; - - return nid; -} - -static inline struct pglist_data *pfn_to_pgdat(unsigned long pfn) -{ - return NODE_DATA(pfn_to_nid(pfn)); -} - -/* arch/metag/mm/numa.c */ -void __init setup_bootmem_node(int nid, unsigned long start, unsigned long end); -#else -static inline void -setup_bootmem_node(int nid, unsigned long start, unsigned long end) -{ -} -#endif /* CONFIG_NEED_MULTIPLE_NODES */ - -#ifdef CONFIG_NUMA -/* SoC specific mem init */ -void __init soc_mem_setup(void); -#else -static inline void __init soc_mem_setup(void) {}; -#endif - -#endif /* __ASM_METAG_MMZONE_H */ diff --git a/arch/metag/include/asm/module.h b/arch/metag/include/asm/module.h deleted file mode 100644 index e957171c320b0..0000000000000 --- a/arch/metag/include/asm/module.h +++ /dev/null @@ -1,38 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_METAG_MODULE_H -#define _ASM_METAG_MODULE_H - -#include - -struct metag_plt_entry { - /* Indirect jump instruction sequence. */ - unsigned long tramp[2]; -}; - -struct mod_arch_specific { - /* Indices of PLT sections within module. */ - unsigned int core_plt_section, init_plt_section; -}; - -#if defined CONFIG_METAG_META12 -#define MODULE_PROC_FAMILY "META 1.2 " -#elif defined CONFIG_METAG_META21 -#define MODULE_PROC_FAMILY "META 2.1 " -#else -#define MODULE_PROC_FAMILY "" -#endif - -#ifdef CONFIG_4KSTACKS -#define MODULE_STACKSIZE "4KSTACKS " -#else -#define MODULE_STACKSIZE "" -#endif - -#define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY MODULE_STACKSIZE - -#ifdef MODULE -asm(".section .plt,\"ax\",@progbits; .balign 8; .previous"); -asm(".section .init.plt,\"ax\",@progbits; .balign 8; .previous"); -#endif - -#endif /* _ASM_METAG_MODULE_H */ diff --git a/arch/metag/include/asm/page.h b/arch/metag/include/asm/page.h deleted file mode 100644 index 9e994d77069d7..0000000000000 --- a/arch/metag/include/asm/page.h +++ /dev/null @@ -1,129 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _METAG_PAGE_H -#define _METAG_PAGE_H - -#include - -#include - -/* PAGE_SHIFT determines the page size */ -#if defined(CONFIG_PAGE_SIZE_4K) -#define PAGE_SHIFT 12 -#elif defined(CONFIG_PAGE_SIZE_8K) -#define PAGE_SHIFT 13 -#elif defined(CONFIG_PAGE_SIZE_16K) -#define PAGE_SHIFT 14 -#endif - -#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) -#define PAGE_MASK (~(PAGE_SIZE-1)) - -#if defined(CONFIG_HUGETLB_PAGE_SIZE_8K) -# define HPAGE_SHIFT 13 -#elif defined(CONFIG_HUGETLB_PAGE_SIZE_16K) -# define HPAGE_SHIFT 14 -#elif defined(CONFIG_HUGETLB_PAGE_SIZE_32K) -# define HPAGE_SHIFT 15 -#elif defined(CONFIG_HUGETLB_PAGE_SIZE_64K) -# define HPAGE_SHIFT 16 -#elif defined(CONFIG_HUGETLB_PAGE_SIZE_128K) -# define HPAGE_SHIFT 17 -#elif defined(CONFIG_HUGETLB_PAGE_SIZE_256K) -# define HPAGE_SHIFT 18 -#elif defined(CONFIG_HUGETLB_PAGE_SIZE_512K) -# define HPAGE_SHIFT 19 -#elif defined(CONFIG_HUGETLB_PAGE_SIZE_1M) -# define HPAGE_SHIFT 20 -#elif defined(CONFIG_HUGETLB_PAGE_SIZE_2M) -# define HPAGE_SHIFT 21 -#elif defined(CONFIG_HUGETLB_PAGE_SIZE_4M) -# define HPAGE_SHIFT 22 -#endif - -#ifdef CONFIG_HUGETLB_PAGE -# define HPAGE_SIZE (1UL << HPAGE_SHIFT) -# define HPAGE_MASK (~(HPAGE_SIZE-1)) -# define HUGETLB_PAGE_ORDER (HPAGE_SHIFT-PAGE_SHIFT) -/* - * We define our own hugetlb_get_unmapped_area so we don't corrupt 2nd level - * page tables with normal pages in them. - */ -# define HUGEPT_SHIFT (22) -# define HUGEPT_ALIGN (1 << HUGEPT_SHIFT) -# define HUGEPT_MASK (HUGEPT_ALIGN - 1) -# define ALIGN_HUGEPT(x) ALIGN(x, HUGEPT_ALIGN) -# define HAVE_ARCH_HUGETLB_UNMAPPED_AREA -#endif - -#ifndef __ASSEMBLY__ - -/* On the Meta, we would like to know if the address (heap) we have is - * in local or global space. - */ -#define is_global_space(addr) ((addr) > 0x7fffffff) -#define is_local_space(addr) (!is_global_space(addr)) - -extern void clear_page(void *to); -extern void copy_page(void *to, void *from); - -#define clear_user_page(page, vaddr, pg) clear_page(page) -#define copy_user_page(to, from, vaddr, pg) copy_page(to, from) - -/* - * These are used to make use of C type-checking.. - */ -typedef struct { unsigned long pte; } pte_t; -typedef struct { unsigned long pgd; } pgd_t; -typedef struct { unsigned long pgprot; } pgprot_t; -typedef struct page *pgtable_t; - -#define pte_val(x) ((x).pte) -#define pgd_val(x) ((x).pgd) -#define pgprot_val(x) ((x).pgprot) - -#define __pte(x) ((pte_t) { (x) }) -#define __pgd(x) ((pgd_t) { (x) }) -#define __pgprot(x) ((pgprot_t) { (x) }) - -/* The kernel must now ALWAYS live at either 0xC0000000 or 0x40000000 - that - * being either global or local space. - */ -#define PAGE_OFFSET (CONFIG_PAGE_OFFSET) - -#if PAGE_OFFSET >= LINGLOBAL_BASE -#define META_MEMORY_BASE LINGLOBAL_BASE -#define META_MEMORY_LIMIT LINGLOBAL_LIMIT -#else -#define META_MEMORY_BASE LINLOCAL_BASE -#define META_MEMORY_LIMIT LINLOCAL_LIMIT -#endif - -/* Offset between physical and virtual mapping of kernel memory. */ -extern unsigned int meta_memoffset; - -#define __pa(x) ((unsigned long)(((unsigned long)(x)) - meta_memoffset)) -#define __va(x) ((void *)((unsigned long)(((unsigned long)(x)) + meta_memoffset))) - -extern unsigned long pfn_base; -#define ARCH_PFN_OFFSET (pfn_base) -#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) -#define page_to_virt(page) __va(page_to_pfn(page) << PAGE_SHIFT) -#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) -#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) -#ifdef CONFIG_FLATMEM -extern unsigned long max_pfn; -extern unsigned long min_low_pfn; -#define pfn_valid(pfn) ((pfn) >= min_low_pfn && (pfn) < max_pfn) -#endif - -#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) - -#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ - VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) - -#include -#include - -#endif /* __ASSMEBLY__ */ - -#endif /* _METAG_PAGE_H */ diff --git a/arch/metag/include/asm/perf_event.h b/arch/metag/include/asm/perf_event.h deleted file mode 100644 index 105bbff0149fb..0000000000000 --- a/arch/metag/include/asm/perf_event.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef __ASM_METAG_PERF_EVENT_H -#define __ASM_METAG_PERF_EVENT_H - -#endif /* __ASM_METAG_PERF_EVENT_H */ diff --git a/arch/metag/include/asm/pgalloc.h b/arch/metag/include/asm/pgalloc.h deleted file mode 100644 index 0b9d95d78b61a..0000000000000 --- a/arch/metag/include/asm/pgalloc.h +++ /dev/null @@ -1,83 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _METAG_PGALLOC_H -#define _METAG_PGALLOC_H - -#include -#include - -#define pmd_populate_kernel(mm, pmd, pte) \ - set_pmd(pmd, __pmd(_PAGE_TABLE | __pa(pte))) - -#define pmd_populate(mm, pmd, pte) \ - set_pmd(pmd, __pmd(_PAGE_TABLE | page_to_phys(pte))) - -#define pmd_pgtable(pmd) pmd_page(pmd) - -/* - * Allocate and free page tables. - */ -#ifdef CONFIG_METAG_META21_MMU -static inline void pgd_ctor(pgd_t *pgd) -{ - memcpy(pgd + USER_PTRS_PER_PGD, - swapper_pg_dir + USER_PTRS_PER_PGD, - (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t)); -} -#else -#define pgd_ctor(x) do { } while (0) -#endif - -static inline pgd_t *pgd_alloc(struct mm_struct *mm) -{ - pgd_t *pgd = (pgd_t *)get_zeroed_page(GFP_KERNEL); - if (pgd) - pgd_ctor(pgd); - return pgd; -} - -static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) -{ - free_page((unsigned long)pgd); -} - -static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, - unsigned long address) -{ - pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL | __GFP_ZERO); - return pte; -} - -static inline pgtable_t pte_alloc_one(struct mm_struct *mm, - unsigned long address) -{ - struct page *pte; - pte = alloc_pages(GFP_KERNEL | __GFP_ZERO, 0); - if (!pte) - return NULL; - if (!pgtable_page_ctor(pte)) { - __free_page(pte); - return NULL; - } - return pte; -} - -static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) -{ - free_page((unsigned long)pte); -} - -static inline void pte_free(struct mm_struct *mm, pgtable_t pte) -{ - pgtable_page_dtor(pte); - __free_page(pte); -} - -#define __pte_free_tlb(tlb, pte, addr) \ - do { \ - pgtable_page_dtor(pte); \ - tlb_remove_page((tlb), (pte)); \ - } while (0) - -#define check_pgt_cache() do { } while (0) - -#endif diff --git a/arch/metag/include/asm/pgtable-bits.h b/arch/metag/include/asm/pgtable-bits.h deleted file mode 100644 index 5f6b82282a415..0000000000000 --- a/arch/metag/include/asm/pgtable-bits.h +++ /dev/null @@ -1,105 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Meta page table definitions. - */ - -#ifndef _METAG_PGTABLE_BITS_H -#define _METAG_PGTABLE_BITS_H - -#include - -/* - * Definitions for MMU descriptors - * - * These are the hardware bits in the MMCU pte entries. - * Derived from the Meta toolkit headers. - */ -#define _PAGE_PRESENT MMCU_ENTRY_VAL_BIT -#define _PAGE_WRITE MMCU_ENTRY_WR_BIT -#define _PAGE_PRIV MMCU_ENTRY_PRIV_BIT -/* Write combine bit - this can cause writes to occur out of order */ -#define _PAGE_WR_COMBINE MMCU_ENTRY_WRC_BIT -/* Sys coherent bit - this bit is never used by Linux */ -#define _PAGE_SYS_COHERENT MMCU_ENTRY_SYS_BIT -#define _PAGE_ALWAYS_ZERO_1 0x020 -#define _PAGE_CACHE_CTRL0 0x040 -#define _PAGE_CACHE_CTRL1 0x080 -#define _PAGE_ALWAYS_ZERO_2 0x100 -#define _PAGE_ALWAYS_ZERO_3 0x200 -#define _PAGE_ALWAYS_ZERO_4 0x400 -#define _PAGE_ALWAYS_ZERO_5 0x800 - -/* These are software bits that we stuff into the gaps in the hardware - * pte entries that are not used. Note, these DO get stored in the actual - * hardware, but the hardware just does not use them. - */ -#define _PAGE_ACCESSED _PAGE_ALWAYS_ZERO_1 -#define _PAGE_DIRTY _PAGE_ALWAYS_ZERO_2 - -/* Pages owned, and protected by, the kernel. */ -#define _PAGE_KERNEL _PAGE_PRIV - -/* No cacheing of this page */ -#define _PAGE_CACHE_WIN0 (MMCU_CWIN_UNCACHED << MMCU_ENTRY_CWIN_S) -/* burst cacheing - good for data streaming */ -#define _PAGE_CACHE_WIN1 (MMCU_CWIN_BURST << MMCU_ENTRY_CWIN_S) -/* One cache way per thread */ -#define _PAGE_CACHE_WIN2 (MMCU_CWIN_C1SET << MMCU_ENTRY_CWIN_S) -/* Full on cacheing */ -#define _PAGE_CACHE_WIN3 (MMCU_CWIN_CACHED << MMCU_ENTRY_CWIN_S) - -#define _PAGE_CACHEABLE (_PAGE_CACHE_WIN3 | _PAGE_WR_COMBINE) - -/* which bits are used for cache control ... */ -#define _PAGE_CACHE_MASK (_PAGE_CACHE_CTRL0 | _PAGE_CACHE_CTRL1 | \ - _PAGE_WR_COMBINE) - -/* This is a mask of the bits that pte_modify is allowed to change. */ -#define _PAGE_CHG_MASK (PAGE_MASK) - -#define _PAGE_SZ_SHIFT 1 -#define _PAGE_SZ_4K (0x0) -#define _PAGE_SZ_8K (0x1 << _PAGE_SZ_SHIFT) -#define _PAGE_SZ_16K (0x2 << _PAGE_SZ_SHIFT) -#define _PAGE_SZ_32K (0x3 << _PAGE_SZ_SHIFT) -#define _PAGE_SZ_64K (0x4 << _PAGE_SZ_SHIFT) -#define _PAGE_SZ_128K (0x5 << _PAGE_SZ_SHIFT) -#define _PAGE_SZ_256K (0x6 << _PAGE_SZ_SHIFT) -#define _PAGE_SZ_512K (0x7 << _PAGE_SZ_SHIFT) -#define _PAGE_SZ_1M (0x8 << _PAGE_SZ_SHIFT) -#define _PAGE_SZ_2M (0x9 << _PAGE_SZ_SHIFT) -#define _PAGE_SZ_4M (0xa << _PAGE_SZ_SHIFT) -#define _PAGE_SZ_MASK (0xf << _PAGE_SZ_SHIFT) - -#if defined(CONFIG_PAGE_SIZE_4K) -#define _PAGE_SZ (_PAGE_SZ_4K) -#elif defined(CONFIG_PAGE_SIZE_8K) -#define _PAGE_SZ (_PAGE_SZ_8K) -#elif defined(CONFIG_PAGE_SIZE_16K) -#define _PAGE_SZ (_PAGE_SZ_16K) -#endif -#define _PAGE_TABLE (_PAGE_SZ | _PAGE_PRESENT) - -#if defined(CONFIG_HUGETLB_PAGE_SIZE_8K) -# define _PAGE_SZHUGE (_PAGE_SZ_8K) -#elif defined(CONFIG_HUGETLB_PAGE_SIZE_16K) -# define _PAGE_SZHUGE (_PAGE_SZ_16K) -#elif defined(CONFIG_HUGETLB_PAGE_SIZE_32K) -# define _PAGE_SZHUGE (_PAGE_SZ_32K) -#elif defined(CONFIG_HUGETLB_PAGE_SIZE_64K) -# define _PAGE_SZHUGE (_PAGE_SZ_64K) -#elif defined(CONFIG_HUGETLB_PAGE_SIZE_128K) -# define _PAGE_SZHUGE (_PAGE_SZ_128K) -#elif defined(CONFIG_HUGETLB_PAGE_SIZE_256K) -# define _PAGE_SZHUGE (_PAGE_SZ_256K) -#elif defined(CONFIG_HUGETLB_PAGE_SIZE_512K) -# define _PAGE_SZHUGE (_PAGE_SZ_512K) -#elif defined(CONFIG_HUGETLB_PAGE_SIZE_1M) -# define _PAGE_SZHUGE (_PAGE_SZ_1M) -#elif defined(CONFIG_HUGETLB_PAGE_SIZE_2M) -# define _PAGE_SZHUGE (_PAGE_SZ_2M) -#elif defined(CONFIG_HUGETLB_PAGE_SIZE_4M) -# define _PAGE_SZHUGE (_PAGE_SZ_4M) -#endif - -#endif /* _METAG_PGTABLE_BITS_H */ diff --git a/arch/metag/include/asm/pgtable.h b/arch/metag/include/asm/pgtable.h deleted file mode 100644 index a3422f06c03b0..0000000000000 --- a/arch/metag/include/asm/pgtable.h +++ /dev/null @@ -1,270 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Macros and functions to manipulate Meta page tables. - */ - -#ifndef _METAG_PGTABLE_H -#define _METAG_PGTABLE_H - -#include -#define __ARCH_USE_5LEVEL_HACK -#include - -/* Invalid regions on Meta: 0x00000000-0x001FFFFF and 0xFFFF0000-0xFFFFFFFF */ -#if PAGE_OFFSET >= LINGLOBAL_BASE -#define CONSISTENT_START 0xF7000000 -#define CONSISTENT_END 0xF73FFFFF -#define VMALLOC_START 0xF8000000 -#define VMALLOC_END 0xFFFEFFFF -#else -#define CONSISTENT_START 0x77000000 -#define CONSISTENT_END 0x773FFFFF -#define VMALLOC_START 0x78000000 -#define VMALLOC_END 0x7FFFFFFF -#endif - -/* - * The Linux memory management assumes a three-level page table setup. On - * Meta, we use that, but "fold" the mid level into the top-level page - * table. - */ - -/* PGDIR_SHIFT determines the size of the area a second-level page table can - * map. This is always 4MB. - */ - -#define PGDIR_SHIFT 22 -#define PGDIR_SIZE (1UL << PGDIR_SHIFT) -#define PGDIR_MASK (~(PGDIR_SIZE-1)) - -/* - * Entries per page directory level: we use a two-level, so - * we don't really have any PMD directory physically. First level tables - * always map 2Gb (local or global) at a granularity of 4MB, second-level - * tables map 4MB with a granularity between 4MB and 4kB (between 1 and - * 1024 entries). - */ -#define PTRS_PER_PTE (PGDIR_SIZE/PAGE_SIZE) -#define HPTRS_PER_PTE (PGDIR_SIZE/HPAGE_SIZE) -#define PTRS_PER_PGD 512 - -#define USER_PTRS_PER_PGD 256 -#define FIRST_USER_ADDRESS META_MEMORY_BASE -#define FIRST_USER_PGD_NR pgd_index(FIRST_USER_ADDRESS) - -#define PAGE_NONE __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED | \ - _PAGE_CACHEABLE) - -#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_WRITE | \ - _PAGE_ACCESSED | _PAGE_CACHEABLE) -#define PAGE_SHARED_C PAGE_SHARED -#define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED | \ - _PAGE_CACHEABLE) -#define PAGE_COPY_C PAGE_COPY - -#define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED | \ - _PAGE_CACHEABLE) -#define PAGE_KERNEL __pgprot(_PAGE_PRESENT | _PAGE_DIRTY | \ - _PAGE_ACCESSED | _PAGE_WRITE | \ - _PAGE_CACHEABLE | _PAGE_KERNEL) - -#define __P000 PAGE_NONE -#define __P001 PAGE_READONLY -#define __P010 PAGE_COPY -#define __P011 PAGE_COPY -#define __P100 PAGE_READONLY -#define __P101 PAGE_READONLY -#define __P110 PAGE_COPY_C -#define __P111 PAGE_COPY_C - -#define __S000 PAGE_NONE -#define __S001 PAGE_READONLY -#define __S010 PAGE_SHARED -#define __S011 PAGE_SHARED -#define __S100 PAGE_READONLY -#define __S101 PAGE_READONLY -#define __S110 PAGE_SHARED_C -#define __S111 PAGE_SHARED_C - -#ifndef __ASSEMBLY__ - -#include - -/* zero page used for uninitialized stuff */ -extern unsigned long empty_zero_page; -#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page)) - -/* Certain architectures need to do special things when pte's - * within a page table are directly modified. Thus, the following - * hook is made available. - */ -#define set_pte(pteptr, pteval) ((*(pteptr)) = (pteval)) -#define set_pte_at(mm, addr, ptep, pteval) set_pte(ptep, pteval) - -#define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval) - -#define pte_pfn(pte) (pte_val(pte) >> PAGE_SHIFT) - -#define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) - -#define pte_none(x) (!pte_val(x)) -#define pte_present(x) (pte_val(x) & _PAGE_PRESENT) -#define pte_clear(mm, addr, xp) do { pte_val(*(xp)) = 0; } while (0) - -#define pmd_none(x) (!pmd_val(x)) -#define pmd_bad(x) ((pmd_val(x) & ~(PAGE_MASK | _PAGE_SZ_MASK)) \ - != (_PAGE_TABLE & ~_PAGE_SZ_MASK)) -#define pmd_present(x) (pmd_val(x) & _PAGE_PRESENT) -#define pmd_clear(xp) do { pmd_val(*(xp)) = 0; } while (0) - -#define pte_page(x) pfn_to_page(pte_pfn(x)) - -/* - * The following only work if pte_present() is true. - * Undefined behaviour if not.. - */ - -static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; } -static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } -static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } -static inline int pte_special(pte_t pte) { return 0; } - -static inline pte_t pte_wrprotect(pte_t pte) { pte_val(pte) &= (~_PAGE_WRITE); return pte; } -static inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~_PAGE_DIRTY; return pte; } -static inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~_PAGE_ACCESSED; return pte; } -static inline pte_t pte_mkwrite(pte_t pte) { pte_val(pte) |= _PAGE_WRITE; return pte; } -static inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= _PAGE_DIRTY; return pte; } -static inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= _PAGE_ACCESSED; return pte; } -static inline pte_t pte_mkspecial(pte_t pte) { return pte; } -static inline pte_t pte_mkhuge(pte_t pte) { return pte; } - -/* - * Macro and implementation to make a page protection as uncacheable. - */ -#define pgprot_writecombine(prot) \ - __pgprot(pgprot_val(prot) & ~(_PAGE_CACHE_CTRL1 | _PAGE_CACHE_CTRL0)) - -#define pgprot_noncached(prot) \ - __pgprot(pgprot_val(prot) & ~_PAGE_CACHEABLE) - - -/* - * Conversion functions: convert a page and protection to a page entry, - * and a page entry and page directory to the page they refer to. - */ - -#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot)) - -static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) -{ - pte_val(pte) = (pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot); - return pte; -} - -static inline unsigned long pmd_page_vaddr(pmd_t pmd) -{ - unsigned long paddr = pmd_val(pmd) & PAGE_MASK; - if (!paddr) - return 0; - return (unsigned long)__va(paddr); -} - -#define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)) -#define pmd_page_shift(pmd) (12 + ((pmd_val(pmd) & _PAGE_SZ_MASK) \ - >> _PAGE_SZ_SHIFT)) -#define pmd_num_ptrs(pmd) (PGDIR_SIZE >> pmd_page_shift(pmd)) - -/* - * Each pgd is only 2k, mapping 2Gb (local or global). If we're in global - * space drop the top bit before indexing the pgd. - */ -#if PAGE_OFFSET >= LINGLOBAL_BASE -#define pgd_index(address) ((((address) & ~0x80000000) >> PGDIR_SHIFT) \ - & (PTRS_PER_PGD-1)) -#else -#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) -#endif - -#define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address)) - -#define pgd_offset_k(address) pgd_offset(&init_mm, address) - -#define pmd_index(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1)) - -/* Find an entry in the second-level page table.. */ -#if !defined(CONFIG_HUGETLB_PAGE) - /* all pages are of size (1 << PAGE_SHIFT), so no need to read 1st level pt */ -# define pte_index(pmd, address) \ - (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) -#else - /* some pages are huge, so read 1st level pt to find out */ -# define pte_index(pmd, address) \ - (((address) >> pmd_page_shift(pmd)) & (pmd_num_ptrs(pmd) - 1)) -#endif -#define pte_offset_kernel(dir, address) \ - ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(*(dir), address)) -#define pte_offset_map(dir, address) pte_offset_kernel(dir, address) -#define pte_offset_map_nested(dir, address) pte_offset_kernel(dir, address) - -#define pte_unmap(pte) do { } while (0) -#define pte_unmap_nested(pte) do { } while (0) - -#define pte_ERROR(e) \ - pr_err("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e)) -#define pgd_ERROR(e) \ - pr_err("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e)) - -/* - * Meta doesn't have any external MMU info: the kernel page - * tables contain all the necessary information. - */ -static inline void update_mmu_cache(struct vm_area_struct *vma, - unsigned long address, pte_t *pte) -{ -} - -/* - * Encode and decode a swap entry (must be !pte_none(e) && !pte_present(e)) - * Since PAGE_PRESENT is bit 1, we can use the bits above that. - */ -#define __swp_type(x) (((x).val >> 1) & 0xff) -#define __swp_offset(x) ((x).val >> 10) -#define __swp_entry(type, offset) ((swp_entry_t) { ((type) << 1) | \ - ((offset) << 10) }) -#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) -#define __swp_entry_to_pte(x) ((pte_t) { (x).val }) - -#define kern_addr_valid(addr) (1) - -/* - * No page table caches to initialise - */ -#define pgtable_cache_init() do { } while (0) - -extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; -void paging_init(unsigned long mem_end); - -#ifdef CONFIG_METAG_META12 -/* This is a workaround for an issue in Meta 1 cores. These cores cache - * invalid entries in the TLB so we always need to flush whenever we add - * a new pte. Unfortunately we can only flush the whole TLB not shoot down - * single entries so this is sub-optimal. This implementation ensures that - * we will get a flush at the second attempt, so we may still get repeated - * faults, we just don't overflow the kernel stack handling them. - */ -#define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS -#define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \ -({ \ - int __changed = !pte_same(*(__ptep), __entry); \ - if (__changed) { \ - set_pte_at((__vma)->vm_mm, (__address), __ptep, __entry); \ - } \ - flush_tlb_page(__vma, __address); \ - __changed; \ -}) -#endif - -#include - -#endif /* __ASSEMBLY__ */ -#endif /* _METAG_PGTABLE_H */ diff --git a/arch/metag/include/asm/processor.h b/arch/metag/include/asm/processor.h deleted file mode 100644 index 9a0c502cd4a03..0000000000000 --- a/arch/metag/include/asm/processor.h +++ /dev/null @@ -1,201 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Copyright (C) 2005,2006,2007,2008 Imagination Technologies - */ - -#ifndef __ASM_METAG_PROCESSOR_H -#define __ASM_METAG_PROCESSOR_H - -#include - -#include -#include -#include - -/* - * Default implementation of macro that returns current - * instruction pointer ("program counter"). - */ -#define current_text_addr() ({ __label__ _l; _l: &&_l; }) - -/* The task stops where the kernel starts */ -#define TASK_SIZE PAGE_OFFSET -/* Add an extra page of padding at the top of the stack for the guard page. */ -#define STACK_TOP (TASK_SIZE - PAGE_SIZE) -#define STACK_TOP_MAX STACK_TOP -/* Maximum virtual space for stack */ -#define STACK_SIZE_MAX (CONFIG_MAX_STACK_SIZE_MB*1024*1024) - -/* This decides where the kernel will search for a free chunk of vm - * space during mmap's. - */ -#define TASK_UNMAPPED_BASE META_MEMORY_BASE - -typedef struct { - unsigned long seg; -} mm_segment_t; - -#ifdef CONFIG_METAG_FPU -struct meta_fpu_context { - TBICTXEXTFPU fpstate; - union { - struct { - TBICTXEXTBB4 fx8_15; - TBICTXEXTFPACC fpacc; - } fx8_15; - struct { - TBICTXEXTFPACC fpacc; - TBICTXEXTBB4 unused; - } nofx8_15; - } extfpstate; - bool needs_restore; -}; -#else -struct meta_fpu_context {}; -#endif - -#ifdef CONFIG_METAG_DSP -struct meta_ext_context { - struct { - TBIEXTCTX ctx; - TBICTXEXTBB8 bb8; - TBIDUAL ax[TBICTXEXTAXX_BYTES / sizeof(TBIDUAL)]; - TBICTXEXTHL2 hl2; - TBICTXEXTTDPR ext; - TBICTXEXTRP6 rp; - } regs; - - /* DSPRAM A and B save areas. */ - void *ram[2]; - - /* ECH encoded size of DSPRAM save areas. */ - unsigned int ram_sz[2]; -}; -#else -struct meta_ext_context {}; -#endif - -struct thread_struct { - PTBICTX kernel_context; - /* A copy of the user process Sig.SaveMask. */ - unsigned int user_flags; - struct meta_fpu_context *fpu_context; - void __user *tls_ptr; - unsigned short int_depth; - unsigned short txdefr_failure; - struct meta_ext_context *dsp_context; -}; - -#define INIT_THREAD { \ - NULL, /* kernel_context */ \ - 0, /* user_flags */ \ - NULL, /* fpu_context */ \ - NULL, /* tls_ptr */ \ - 1, /* int_depth - we start in kernel */ \ - 0, /* txdefr_failure */ \ - NULL, /* dsp_context */ \ -} - -/* Needed to make #define as we are referencing 'current', that is not visible - * yet. - * - * Stack layout is as below. - - argc argument counter (integer) - argv[0] program name (pointer) - argv[1...N] program args (pointers) - argv[argc-1] end of args (integer) - NULL - env[0...N] environment variables (pointers) - NULL - - */ -#define start_thread(regs, pc, usp) do { \ - unsigned int *argc = (unsigned int *) bprm->exec; \ - current->thread.int_depth = 1; \ - /* Force this process down to user land */ \ - regs->ctx.SaveMask = TBICTX_PRIV_BIT; \ - regs->ctx.CurrPC = pc; \ - regs->ctx.AX[0].U0 = usp; \ - regs->ctx.DX[3].U1 = *((int *)argc); /* argc */ \ - regs->ctx.DX[3].U0 = (int)((int *)argc + 1); /* argv */ \ - regs->ctx.DX[2].U1 = (int)((int *)argc + \ - regs->ctx.DX[3].U1 + 2); /* envp */ \ - regs->ctx.DX[2].U0 = 0; /* rtld_fini */ \ -} while (0) - -/* Forward declaration, a strange C thing */ -struct task_struct; - -/* Free all resources held by a thread. */ -static inline void release_thread(struct task_struct *dead_task) -{ -} - -/* - * Return saved PC of a blocked thread. - */ -#define thread_saved_pc(tsk) \ - ((unsigned long)(tsk)->thread.kernel_context->CurrPC) -#define thread_saved_sp(tsk) \ - ((unsigned long)(tsk)->thread.kernel_context->AX[0].U0) -#define thread_saved_fp(tsk) \ - ((unsigned long)(tsk)->thread.kernel_context->AX[1].U0) - -unsigned long get_wchan(struct task_struct *p); - -#define KSTK_EIP(tsk) (task_pt_regs(tsk)->ctx.CurrPC) -#define KSTK_ESP(tsk) (task_pt_regs(tsk)->ctx.AX[0].U0) - -#define user_stack_pointer(regs) ((regs)->ctx.AX[0].U0) - -#define cpu_relax() barrier() - -extern void setup_priv(void); - -static inline unsigned int hard_processor_id(void) -{ - unsigned int id; - - asm volatile ("MOV %0, TXENABLE\n" - "AND %0, %0, %1\n" - "LSR %0, %0, %2\n" - : "=&d" (id) - : "I" (TXENABLE_THREAD_BITS), - "K" (TXENABLE_THREAD_S) - ); - - return id; -} - -#define OP3_EXIT 0 - -#define HALT_OK 0 -#define HALT_PANIC -1 - -/* - * Halt (stop) the hardware thread. This instruction sequence is the - * standard way to cause a Meta hardware thread to exit. The exit code - * is pushed onto the stack which is interpreted by the debug adapter. - */ -static inline void hard_processor_halt(int exit_code) -{ - asm volatile ("MOV D1Ar1, %0\n" - "MOV D0Ar6, %1\n" - "MSETL [A0StP],D0Ar6,D0Ar4,D0Ar2\n" - "1:\n" - "SWITCH #0xC30006\n" - "B 1b\n" - : : "r" (exit_code), "K" (OP3_EXIT)); -} - -/* Set these hooks to call SoC specific code to restart/halt/power off. */ -extern void (*soc_restart)(char *cmd); -extern void (*soc_halt)(void); - -extern void show_trace(struct task_struct *tsk, unsigned long *sp, - struct pt_regs *regs); - -extern const struct seq_operations cpuinfo_op; - -#endif diff --git a/arch/metag/include/asm/ptrace.h b/arch/metag/include/asm/ptrace.h deleted file mode 100644 index 9074f254c9ca8..0000000000000 --- a/arch/metag/include/asm/ptrace.h +++ /dev/null @@ -1,61 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _METAG_PTRACE_H -#define _METAG_PTRACE_H - -#include -#include -#include - -#ifndef __ASSEMBLY__ - -/* this struct defines the way the registers are stored on the - stack during a system call. */ - -struct pt_regs { - TBICTX ctx; - TBICTXEXTCB0 extcb0[5]; -}; - -#define user_mode(regs) (((regs)->ctx.SaveMask & TBICTX_PRIV_BIT) > 0) - -#define instruction_pointer(regs) ((unsigned long)(regs)->ctx.CurrPC) -#define profile_pc(regs) instruction_pointer(regs) - -#define task_pt_regs(task) \ - ((struct pt_regs *)(task_stack_page(task) + \ - sizeof(struct thread_info))) - -#define current_pt_regs() \ - ((struct pt_regs *)((char *)current_thread_info() + \ - sizeof(struct thread_info))) - -int syscall_trace_enter(struct pt_regs *regs); -void syscall_trace_leave(struct pt_regs *regs); - -/* copy a struct user_gp_regs out to user */ -int metag_gp_regs_copyout(const struct pt_regs *regs, - unsigned int pos, unsigned int count, - void *kbuf, void __user *ubuf); -/* copy a struct user_gp_regs in from user */ -int metag_gp_regs_copyin(struct pt_regs *regs, - unsigned int pos, unsigned int count, - const void *kbuf, const void __user *ubuf); -/* copy a struct user_cb_regs out to user */ -int metag_cb_regs_copyout(const struct pt_regs *regs, - unsigned int pos, unsigned int count, - void *kbuf, void __user *ubuf); -/* copy a struct user_cb_regs in from user */ -int metag_cb_regs_copyin(struct pt_regs *regs, - unsigned int pos, unsigned int count, - const void *kbuf, const void __user *ubuf); -/* copy a struct user_rp_state out to user */ -int metag_rp_state_copyout(const struct pt_regs *regs, - unsigned int pos, unsigned int count, - void *kbuf, void __user *ubuf); -/* copy a struct user_rp_state in from user */ -int metag_rp_state_copyin(struct pt_regs *regs, - unsigned int pos, unsigned int count, - const void *kbuf, const void __user *ubuf); - -#endif /* __ASSEMBLY__ */ -#endif /* _METAG_PTRACE_H */ diff --git a/arch/metag/include/asm/setup.h b/arch/metag/include/asm/setup.h deleted file mode 100644 index 504621d79ef59..0000000000000 --- a/arch/metag/include/asm/setup.h +++ /dev/null @@ -1,10 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_METAG_SETUP_H -#define _ASM_METAG_SETUP_H - -#include - -extern const struct machine_desc *setup_machine_fdt(void *dt); -void per_cpu_trap_init(unsigned long); -extern void __init dump_machine_table(void); -#endif /* _ASM_METAG_SETUP_H */ diff --git a/arch/metag/include/asm/smp.h b/arch/metag/include/asm/smp.h deleted file mode 100644 index 8d3683d836804..0000000000000 --- a/arch/metag/include/asm/smp.h +++ /dev/null @@ -1,28 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __ASM_SMP_H -#define __ASM_SMP_H - -#include - -#define raw_smp_processor_id() (current_thread_info()->cpu) - -enum ipi_msg_type { - IPI_CALL_FUNC, - IPI_RESCHEDULE, -}; - -extern void arch_send_call_function_single_ipi(int cpu); -extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); - -asmlinkage void secondary_start_kernel(void); - -extern void secondary_startup(void); - -#ifdef CONFIG_HOTPLUG_CPU -extern void __cpu_die(unsigned int cpu); -extern int __cpu_disable(void); -extern void cpu_die(void); -#endif - -extern void smp_init_cpus(void); -#endif /* __ASM_SMP_H */ diff --git a/arch/metag/include/asm/sparsemem.h b/arch/metag/include/asm/sparsemem.h deleted file mode 100644 index 2942894bace53..0000000000000 --- a/arch/metag/include/asm/sparsemem.h +++ /dev/null @@ -1,14 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __ASM_METAG_SPARSEMEM_H -#define __ASM_METAG_SPARSEMEM_H - -/* - * SECTION_SIZE_BITS 2^N: how big each section will be - * MAX_PHYSADDR_BITS 2^N: how much physical address space we have - * MAX_PHYSMEM_BITS 2^N: how much memory we can have in that space - */ -#define SECTION_SIZE_BITS 26 -#define MAX_PHYSADDR_BITS 32 -#define MAX_PHYSMEM_BITS 32 - -#endif /* __ASM_METAG_SPARSEMEM_H */ diff --git a/arch/metag/include/asm/spinlock.h b/arch/metag/include/asm/spinlock.h deleted file mode 100644 index 4497c232d9c1a..0000000000000 --- a/arch/metag/include/asm/spinlock.h +++ /dev/null @@ -1,19 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __ASM_SPINLOCK_H -#define __ASM_SPINLOCK_H - -#include -#include - -#ifdef CONFIG_METAG_ATOMICITY_LOCK1 -#include -#else -#include -#endif - -/* - * both lock1 and lnkget are test-and-set spinlocks with 0 unlocked and 1 - * locked. - */ - -#endif /* __ASM_SPINLOCK_H */ diff --git a/arch/metag/include/asm/spinlock_lnkget.h b/arch/metag/include/asm/spinlock_lnkget.h deleted file mode 100644 index dfd780eab3504..0000000000000 --- a/arch/metag/include/asm/spinlock_lnkget.h +++ /dev/null @@ -1,213 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __ASM_SPINLOCK_LNKGET_H -#define __ASM_SPINLOCK_LNKGET_H - -/* - * None of these asm statements clobber memory as LNKSET writes around - * the cache so the memory it modifies cannot safely be read by any means - * other than these accessors. - */ - -static inline int arch_spin_is_locked(arch_spinlock_t *lock) -{ - int ret; - - asm volatile ("LNKGETD %0, [%1]\n" - "TST %0, #1\n" - "MOV %0, #1\n" - "XORZ %0, %0, %0\n" - : "=&d" (ret) - : "da" (&lock->lock) - : "cc"); - return ret; -} - -static inline void arch_spin_lock(arch_spinlock_t *lock) -{ - int tmp; - - asm volatile ("1: LNKGETD %0,[%1]\n" - " TST %0, #1\n" - " ADD %0, %0, #1\n" - " LNKSETDZ [%1], %0\n" - " BNZ 1b\n" - " DEFR %0, TXSTAT\n" - " ANDT %0, %0, #HI(0x3f000000)\n" - " CMPT %0, #HI(0x02000000)\n" - " BNZ 1b\n" - : "=&d" (tmp) - : "da" (&lock->lock) - : "cc"); - - smp_mb(); -} - -/* Returns 0 if failed to acquire lock */ -static inline int arch_spin_trylock(arch_spinlock_t *lock) -{ - int tmp; - - asm volatile (" LNKGETD %0,[%1]\n" - " TST %0, #1\n" - " ADD %0, %0, #1\n" - " LNKSETDZ [%1], %0\n" - " BNZ 1f\n" - " DEFR %0, TXSTAT\n" - " ANDT %0, %0, #HI(0x3f000000)\n" - " CMPT %0, #HI(0x02000000)\n" - " MOV %0, #1\n" - "1: XORNZ %0, %0, %0\n" - : "=&d" (tmp) - : "da" (&lock->lock) - : "cc"); - - smp_mb(); - - return tmp; -} - -static inline void arch_spin_unlock(arch_spinlock_t *lock) -{ - smp_mb(); - - asm volatile (" SETD [%0], %1\n" - : - : "da" (&lock->lock), "da" (0) - : "memory"); -} - -/* - * RWLOCKS - * - * - * Write locks are easy - we just set bit 31. When unlocking, we can - * just write zero since the lock is exclusively held. - */ - -static inline void arch_write_lock(arch_rwlock_t *rw) -{ - int tmp; - - asm volatile ("1: LNKGETD %0,[%1]\n" - " CMP %0, #0\n" - " ADD %0, %0, %2\n" - " LNKSETDZ [%1], %0\n" - " BNZ 1b\n" - " DEFR %0, TXSTAT\n" - " ANDT %0, %0, #HI(0x3f000000)\n" - " CMPT %0, #HI(0x02000000)\n" - " BNZ 1b\n" - : "=&d" (tmp) - : "da" (&rw->lock), "bd" (0x80000000) - : "cc"); - - smp_mb(); -} - -static inline int arch_write_trylock(arch_rwlock_t *rw) -{ - int tmp; - - asm volatile (" LNKGETD %0,[%1]\n" - " CMP %0, #0\n" - " ADD %0, %0, %2\n" - " LNKSETDZ [%1], %0\n" - " BNZ 1f\n" - " DEFR %0, TXSTAT\n" - " ANDT %0, %0, #HI(0x3f000000)\n" - " CMPT %0, #HI(0x02000000)\n" - " MOV %0,#1\n" - "1: XORNZ %0, %0, %0\n" - : "=&d" (tmp) - : "da" (&rw->lock), "bd" (0x80000000) - : "cc"); - - smp_mb(); - - return tmp; -} - -static inline void arch_write_unlock(arch_rwlock_t *rw) -{ - smp_mb(); - - asm volatile (" SETD [%0], %1\n" - : - : "da" (&rw->lock), "da" (0) - : "memory"); -} - -/* - * Read locks are a bit more hairy: - * - Exclusively load the lock value. - * - Increment it. - * - Store new lock value if positive, and we still own this location. - * If the value is negative, we've already failed. - * - If we failed to store the value, we want a negative result. - * - If we failed, try again. - * Unlocking is similarly hairy. We may have multiple read locks - * currently active. However, we know we won't have any write - * locks. - */ -static inline void arch_read_lock(arch_rwlock_t *rw) -{ - int tmp; - - asm volatile ("1: LNKGETD %0,[%1]\n" - " ADDS %0, %0, #1\n" - " LNKSETDPL [%1], %0\n" - " BMI 1b\n" - " DEFR %0, TXSTAT\n" - " ANDT %0, %0, #HI(0x3f000000)\n" - " CMPT %0, #HI(0x02000000)\n" - " BNZ 1b\n" - : "=&d" (tmp) - : "da" (&rw->lock) - : "cc"); - - smp_mb(); -} - -static inline void arch_read_unlock(arch_rwlock_t *rw) -{ - int tmp; - - smp_mb(); - - asm volatile ("1: LNKGETD %0,[%1]\n" - " SUB %0, %0, #1\n" - " LNKSETD [%1], %0\n" - " DEFR %0, TXSTAT\n" - " ANDT %0, %0, #HI(0x3f000000)\n" - " CMPT %0, #HI(0x02000000)\n" - " BNZ 1b\n" - : "=&d" (tmp) - : "da" (&rw->lock) - : "cc", "memory"); -} - -static inline int arch_read_trylock(arch_rwlock_t *rw) -{ - int tmp; - - asm volatile (" LNKGETD %0,[%1]\n" - " ADDS %0, %0, #1\n" - " LNKSETDPL [%1], %0\n" - " BMI 1f\n" - " DEFR %0, TXSTAT\n" - " ANDT %0, %0, #HI(0x3f000000)\n" - " CMPT %0, #HI(0x02000000)\n" - " MOV %0,#1\n" - " BZ 2f\n" - "1: MOV %0,#0\n" - "2:\n" - : "=&d" (tmp) - : "da" (&rw->lock) - : "cc"); - - smp_mb(); - - return tmp; -} - -#endif /* __ASM_SPINLOCK_LNKGET_H */ diff --git a/arch/metag/include/asm/spinlock_lock1.h b/arch/metag/include/asm/spinlock_lock1.h deleted file mode 100644 index c0bd81bbe18c0..0000000000000 --- a/arch/metag/include/asm/spinlock_lock1.h +++ /dev/null @@ -1,165 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __ASM_SPINLOCK_LOCK1_H -#define __ASM_SPINLOCK_LOCK1_H - -#include -#include - -static inline int arch_spin_is_locked(arch_spinlock_t *lock) -{ - int ret; - - barrier(); - ret = lock->lock; - WARN_ON(ret != 0 && ret != 1); - return ret; -} - -static inline void arch_spin_lock(arch_spinlock_t *lock) -{ - unsigned int we_won = 0; - unsigned long flags; - -again: - __global_lock1(flags); - if (lock->lock == 0) { - fence(); - lock->lock = 1; - we_won = 1; - } - __global_unlock1(flags); - if (we_won == 0) - goto again; - WARN_ON(lock->lock != 1); -} - -/* Returns 0 if failed to acquire lock */ -static inline int arch_spin_trylock(arch_spinlock_t *lock) -{ - unsigned long flags; - unsigned int ret; - - __global_lock1(flags); - ret = lock->lock; - if (ret == 0) { - fence(); - lock->lock = 1; - } - __global_unlock1(flags); - return (ret == 0); -} - -static inline void arch_spin_unlock(arch_spinlock_t *lock) -{ - barrier(); - WARN_ON(!lock->lock); - lock->lock = 0; -} - -/* - * RWLOCKS - * - * - * Write locks are easy - we just set bit 31. When unlocking, we can - * just write zero since the lock is exclusively held. - */ - -static inline void arch_write_lock(arch_rwlock_t *rw) -{ - unsigned long flags; - unsigned int we_won = 0; - -again: - __global_lock1(flags); - if (rw->lock == 0) { - fence(); - rw->lock = 0x80000000; - we_won = 1; - } - __global_unlock1(flags); - if (we_won == 0) - goto again; - WARN_ON(rw->lock != 0x80000000); -} - -static inline int arch_write_trylock(arch_rwlock_t *rw) -{ - unsigned long flags; - unsigned int ret; - - __global_lock1(flags); - ret = rw->lock; - if (ret == 0) { - fence(); - rw->lock = 0x80000000; - } - __global_unlock1(flags); - - return (ret == 0); -} - -static inline void arch_write_unlock(arch_rwlock_t *rw) -{ - barrier(); - WARN_ON(rw->lock != 0x80000000); - rw->lock = 0; -} - -/* - * Read locks are a bit more hairy: - * - Exclusively load the lock value. - * - Increment it. - * - Store new lock value if positive, and we still own this location. - * If the value is negative, we've already failed. - * - If we failed to store the value, we want a negative result. - * - If we failed, try again. - * Unlocking is similarly hairy. We may have multiple read locks - * currently active. However, we know we won't have any write - * locks. - */ -static inline void arch_read_lock(arch_rwlock_t *rw) -{ - unsigned long flags; - unsigned int we_won = 0, ret; - -again: - __global_lock1(flags); - ret = rw->lock; - if (ret < 0x80000000) { - fence(); - rw->lock = ret + 1; - we_won = 1; - } - __global_unlock1(flags); - if (!we_won) - goto again; -} - -static inline void arch_read_unlock(arch_rwlock_t *rw) -{ - unsigned long flags; - unsigned int ret; - - __global_lock1(flags); - fence(); - ret = rw->lock--; - __global_unlock1(flags); - WARN_ON(ret == 0); -} - -static inline int arch_read_trylock(arch_rwlock_t *rw) -{ - unsigned long flags; - unsigned int ret; - - __global_lock1(flags); - ret = rw->lock; - if (ret < 0x80000000) { - fence(); - rw->lock = ret + 1; - } - __global_unlock1(flags); - return (ret < 0x80000000); -} - -#endif /* __ASM_SPINLOCK_LOCK1_H */ diff --git a/arch/metag/include/asm/spinlock_types.h b/arch/metag/include/asm/spinlock_types.h deleted file mode 100644 index cd197f1bed595..0000000000000 --- a/arch/metag/include/asm/spinlock_types.h +++ /dev/null @@ -1,21 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_METAG_SPINLOCK_TYPES_H -#define _ASM_METAG_SPINLOCK_TYPES_H - -#ifndef __LINUX_SPINLOCK_TYPES_H -# error "please don't include this file directly" -#endif - -typedef struct { - volatile unsigned int lock; -} arch_spinlock_t; - -#define __ARCH_SPIN_LOCK_UNLOCKED { 0 } - -typedef struct { - volatile unsigned int lock; -} arch_rwlock_t; - -#define __ARCH_RW_LOCK_UNLOCKED { 0 } - -#endif /* _ASM_METAG_SPINLOCK_TYPES_H */ diff --git a/arch/metag/include/asm/stacktrace.h b/arch/metag/include/asm/stacktrace.h deleted file mode 100644 index f45e3cb2bbb54..0000000000000 --- a/arch/metag/include/asm/stacktrace.h +++ /dev/null @@ -1,21 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __ASM_STACKTRACE_H -#define __ASM_STACKTRACE_H - -struct stackframe { - unsigned long fp; - unsigned long sp; - unsigned long lr; - unsigned long pc; -}; - -struct metag_frame { - unsigned long fp; - unsigned long lr; -}; - -extern int unwind_frame(struct stackframe *frame); -extern void walk_stackframe(struct stackframe *frame, - int (*fn)(struct stackframe *, void *), void *data); - -#endif /* __ASM_STACKTRACE_H */ diff --git a/arch/metag/include/asm/string.h b/arch/metag/include/asm/string.h deleted file mode 100644 index 86f9614d5fc61..0000000000000 --- a/arch/metag/include/asm/string.h +++ /dev/null @@ -1,14 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _METAG_STRING_H_ -#define _METAG_STRING_H_ - -#define __HAVE_ARCH_MEMSET -extern void *memset(void *__s, int __c, size_t __count); - -#define __HAVE_ARCH_MEMCPY -void *memcpy(void *__to, __const__ void *__from, size_t __n); - -#define __HAVE_ARCH_MEMMOVE -extern void *memmove(void *__dest, __const__ void *__src, size_t __n); - -#endif /* _METAG_STRING_H_ */ diff --git a/arch/metag/include/asm/switch.h b/arch/metag/include/asm/switch.h deleted file mode 100644 index 1fd6a587c8440..0000000000000 --- a/arch/metag/include/asm/switch.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (C) 2012 Imagination Technologies Ltd. - * - * 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_METAG_SWITCH_H -#define _ASM_METAG_SWITCH_H - -/* metag SWITCH codes */ -#define __METAG_SW_PERM_BREAK 0x400002 /* compiled in breakpoint */ -#define __METAG_SW_SYS_LEGACY 0x440000 /* legacy system calls */ -#define __METAG_SW_SYS 0x440001 /* system calls */ - -/* metag SWITCH instruction encoding */ -#define __METAG_SW_ENCODING(TYPE) (0xaf000000 | (__METAG_SW_##TYPE)) - -#endif /* _ASM_METAG_SWITCH_H */ diff --git a/arch/metag/include/asm/syscall.h b/arch/metag/include/asm/syscall.h deleted file mode 100644 index 24fc97939f771..0000000000000 --- a/arch/metag/include/asm/syscall.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Access to user system call parameters and results - * - * Copyright (C) 2008 Imagination Technologies Ltd. - * - * This copyrighted material is made available to anyone wishing to use, - * modify, copy, or redistribute it subject to the terms and conditions - * of the GNU General Public License v.2. - * - * See asm-generic/syscall.h for descriptions of what we must do here. - */ - -#ifndef _ASM_METAG_SYSCALL_H -#define _ASM_METAG_SYSCALL_H - -#include -#include -#include - -#include - -static inline long syscall_get_nr(struct task_struct *task, - struct pt_regs *regs) -{ - unsigned long insn; - - /* - * FIXME there's no way to find out how we got here other than to - * examine the memory at the PC to see if it is a syscall - * SWITCH instruction. - */ - if (get_user(insn, (unsigned long *)(regs->ctx.CurrPC - 4))) - return -1; - - if (insn == __METAG_SW_ENCODING(SYS)) - return regs->ctx.DX[0].U1; - else - return -1L; -} - -static inline void syscall_rollback(struct task_struct *task, - struct pt_regs *regs) -{ - /* do nothing */ -} - -static inline long syscall_get_error(struct task_struct *task, - struct pt_regs *regs) -{ - unsigned long error = regs->ctx.DX[0].U0; - return IS_ERR_VALUE(error) ? error : 0; -} - -static inline long syscall_get_return_value(struct task_struct *task, - struct pt_regs *regs) -{ - return regs->ctx.DX[0].U0; -} - -static inline void syscall_set_return_value(struct task_struct *task, - struct pt_regs *regs, - int error, long val) -{ - regs->ctx.DX[0].U0 = (long) error ?: val; -} - -static inline void syscall_get_arguments(struct task_struct *task, - struct pt_regs *regs, - unsigned int i, unsigned int n, - unsigned long *args) -{ - unsigned int reg, j; - BUG_ON(i + n > 6); - - for (j = i, reg = 6 - i; j < (i + n); j++, reg--) { - if (reg % 2) - args[j] = regs->ctx.DX[(reg + 1) / 2].U0; - else - args[j] = regs->ctx.DX[reg / 2].U1; - } -} - -static inline void syscall_set_arguments(struct task_struct *task, - struct pt_regs *regs, - unsigned int i, unsigned int n, - const unsigned long *args) -{ - unsigned int reg; - BUG_ON(i + n > 6); - - for (reg = 6 - i; i < (i + n); i++, reg--) { - if (reg % 2) - regs->ctx.DX[(reg + 1) / 2].U0 = args[i]; - else - regs->ctx.DX[reg / 2].U1 = args[i]; - } -} - -#define NR_syscalls __NR_syscalls - -/* generic syscall table */ -extern const void *sys_call_table[]; - -#endif /* _ASM_METAG_SYSCALL_H */ diff --git a/arch/metag/include/asm/syscalls.h b/arch/metag/include/asm/syscalls.h deleted file mode 100644 index eac0cf1203231..0000000000000 --- a/arch/metag/include/asm/syscalls.h +++ /dev/null @@ -1,40 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_METAG_SYSCALLS_H -#define _ASM_METAG_SYSCALLS_H - -#include -#include -#include -#include - -/* kernel/signal.c */ -#define sys_rt_sigreturn sys_rt_sigreturn -asmlinkage long sys_rt_sigreturn(void); - -#include - -/* kernel/sys_metag.c */ -asmlinkage int sys_metag_setglobalbit(char __user *, int); -asmlinkage void sys_metag_set_fpu_flags(unsigned int); -asmlinkage int sys_metag_set_tls(void __user *); -asmlinkage void *sys_metag_get_tls(void); - -asmlinkage long sys_truncate64_metag(const char __user *, unsigned long, - unsigned long); -asmlinkage long sys_ftruncate64_metag(unsigned int, unsigned long, - unsigned long); -asmlinkage long sys_fadvise64_64_metag(int, unsigned long, unsigned long, - unsigned long, unsigned long, int); -asmlinkage long sys_readahead_metag(int, unsigned long, unsigned long, size_t); -asmlinkage ssize_t sys_pread64_metag(unsigned long, char __user *, size_t, - unsigned long, unsigned long); -asmlinkage ssize_t sys_pwrite64_metag(unsigned long, char __user *, size_t, - unsigned long, unsigned long); -asmlinkage long sys_sync_file_range_metag(int, unsigned long, unsigned long, - unsigned long, unsigned long, - unsigned int); - -int do_work_pending(struct pt_regs *regs, unsigned int thread_flags, - int syscall); - -#endif /* _ASM_METAG_SYSCALLS_H */ diff --git a/arch/metag/include/asm/tbx.h b/arch/metag/include/asm/tbx.h deleted file mode 100644 index 5cd2a6c86223d..0000000000000 --- a/arch/metag/include/asm/tbx.h +++ /dev/null @@ -1,1420 +0,0 @@ -/* - * asm/tbx.h - * - * Copyright (C) 2000-2012 Imagination Technologies. - * - * 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. - * - * Thread binary interface header - */ - -#ifndef _ASM_METAG_TBX_H_ -#define _ASM_METAG_TBX_H_ - -/* for CACHEW_* values */ -#include -/* for LINSYSEVENT_* addresses */ -#include - -#ifdef TBI_1_4 -#ifndef TBI_MUTEXES_1_4 -#define TBI_MUTEXES_1_4 -#endif -#ifndef TBI_SEMAPHORES_1_4 -#define TBI_SEMAPHORES_1_4 -#endif -#ifndef TBI_ASYNC_SWITCH_1_4 -#define TBI_ASYNC_SWITCH_1_4 -#endif -#ifndef TBI_FASTINT_1_4 -#define TBI_FASTINT_1_4 -#endif -#endif - - -/* Id values in the TBI system describe a segment using an arbitrary - integer value and flags in the bottom 8 bits, the SIGPOLL value is - used in cases where control over blocking or polling behaviour is - needed. */ -#define TBID_SIGPOLL_BIT 0x02 /* Set bit in an Id value to poll vs block */ -/* Extended segment identifiers use strings in the string table */ -#define TBID_IS_SEGSTR( Id ) (((Id) & (TBID_SEGTYPE_BITS>>1)) == 0) - -/* Segment identifiers contain the following related bit-fields */ -#define TBID_SEGTYPE_BITS 0x0F /* One of the predefined segment types */ -#define TBID_SEGTYPE_S 0 -#define TBID_SEGSCOPE_BITS 0x30 /* Indicates the scope of the segment */ -#define TBID_SEGSCOPE_S 4 -#define TBID_SEGGADDR_BITS 0xC0 /* Indicates access possible via pGAddr */ -#define TBID_SEGGADDR_S 6 - -/* Segments of memory can only really contain a few types of data */ -#define TBID_SEGTYPE_TEXT 0x02 /* Code segment */ -#define TBID_SEGTYPE_DATA 0x04 /* Data segment */ -#define TBID_SEGTYPE_STACK 0x06 /* Stack segment */ -#define TBID_SEGTYPE_HEAP 0x0A /* Heap segment */ -#define TBID_SEGTYPE_ROOT 0x0C /* Root block segments */ -#define TBID_SEGTYPE_STRING 0x0E /* String table segment */ - -/* Segments have one of three possible scopes */ -#define TBID_SEGSCOPE_INIT 0 /* Temporary area for initialisation phase */ -#define TBID_SEGSCOPE_LOCAL 1 /* Private to this thread */ -#define TBID_SEGSCOPE_GLOBAL 2 /* Shared globally throughout the system */ -#define TBID_SEGSCOPE_SHARED 3 /* Limited sharing between local/global */ - -/* For segment specifier a further field in two of the remaining bits - indicates the usefulness of the pGAddr field in the segment descriptor - descriptor. */ -#define TBID_SEGGADDR_NULL 0 /* pGAddr is NULL -> SEGSCOPE_(LOCAL|INIT) */ -#define TBID_SEGGADDR_READ 1 /* Only read via pGAddr */ -#define TBID_SEGGADDR_WRITE 2 /* Full access via pGAddr */ -#define TBID_SEGGADDR_EXEC 3 /* Only execute via pGAddr */ - -/* The following values are common to both segment and signal Id value and - live in the top 8 bits of the Id values. */ - -/* The ISTAT bit indicates if segments are related to interrupt vs - background level interfaces a thread can still handle all triggers at - either level, but can also split these up if it wants to. */ -#define TBID_ISTAT_BIT 0x01000000 -#define TBID_ISTAT_S 24 - -/* Privilege needed to access a segment is indicated by the next bit. - - This bit is set to mirror the current privilege level when starting a - search for a segment - setting it yourself toggles the automatically - generated state which is only useful to emulate unprivileged behaviour - or access unprivileged areas of memory while at privileged level. */ -#define TBID_PSTAT_BIT 0x02000000 -#define TBID_PSTAT_S 25 - -/* The top six bits of a signal/segment specifier identifies a thread within - the system. This represents a segments owner. */ -#define TBID_THREAD_BITS 0xFC000000 -#define TBID_THREAD_S 26 - -/* Special thread id values */ -#define TBID_THREAD_NULL (-32) /* Never matches any thread/segment id used */ -#define TBID_THREAD_GLOBAL (-31) /* Things global to all threads */ -#define TBID_THREAD_HOST ( -1) /* Host interface */ -#define TBID_THREAD_EXTIO (TBID_THREAD_HOST) /* Host based ExtIO i/f */ - -/* Virtual Id's are used for external thread interface structures or the - above special Id's */ -#define TBID_IS_VIRTTHREAD( Id ) ((Id) < 0) - -/* Real Id's are used for actual hardware threads that are local */ -#define TBID_IS_REALTHREAD( Id ) ((Id) >= 0) - -/* Generate a segment Id given Thread, Scope, and Type */ -#define TBID_SEG( Thread, Scope, Type ) (\ - ((Thread)<= TBID_SIGNUM_TRT) ? 1<<((SigNum)-TBID_SIGNUM_TRT) :\ - ((SigNum) == TBID_SIGNUM_LWK) ? \ - TXSTAT_KICK_BIT : TXSTATI_BGNDHALT_BIT ) - -/* Return the hardware trigger vector number for entries in the - HWVEC0EXT table that will generate the required internal trigger. */ -#define TBI_TRIG_VEC(SigNum) (\ - ((SigNum) >= TBID_SIGNUM_T10) ? ((SigNum)-TBID_SIGNUM_TRT) : -1) - -/* Default trigger masks for each thread at background/interrupt level */ -#define TBI_TRIGS_INIT( Thread ) (\ - TXSTAT_KICK_BIT + TBI_TRIG_BIT(TBID_SIGNUM_TR1(Thread)) ) -#define TBI_INTS_INIT( Thread ) (\ - TXSTAT_KICK_BIT + TXSTATI_BGNDHALT_BIT \ - + TBI_TRIG_BIT(TBID_SIGNUM_TR2(Thread)) ) - -#ifndef __ASSEMBLY__ -/* A spin-lock location is a zero-initialised location in memory */ -typedef volatile int TBISPIN, *PTBISPIN; - -/* A kick location is a hardware location you can write to - * in order to cause a kick - */ -typedef volatile int *PTBIKICK; - -#if defined(METAC_1_0) || defined(METAC_1_1) -/* Macro to perform a kick */ -#define TBI_KICK( pKick ) do { pKick[0] = 1; } while (0) -#else -/* #define METAG_LIN_VALUES before including machine.h if required */ -#ifdef LINSYSEVENT_WR_COMBINE_FLUSH -/* Macro to perform a kick - write combiners must be flushed */ -#define TBI_KICK( pKick ) do {\ - volatile int *pFlush = (volatile int *) LINSYSEVENT_WR_COMBINE_FLUSH; \ - pFlush[0] = 0; \ - pKick[0] = 1; } while (0) -#endif -#endif /* if defined(METAC_1_0) || defined(METAC_1_1) */ -#endif /* ifndef __ASSEMBLY__ */ - -#ifndef __ASSEMBLY__ -/* 64-bit dual unit state value */ -typedef struct _tbidual_tag_ { - /* 32-bit value from a pair of registers in data or address units */ - int U0, U1; -} TBIDUAL, *PTBIDUAL; -#endif /* ifndef __ASSEMBLY__ */ - -/* Byte offsets of fields within TBIDUAL */ -#define TBIDUAL_U0 (0) -#define TBIDUAL_U1 (4) - -#define TBIDUAL_BYTES (8) - -#define TBICTX_CRIT_BIT 0x0001 /* ASync state saved in TBICTX */ -#define TBICTX_SOFT_BIT 0x0002 /* Sync state saved in TBICTX (other bits 0) */ -#ifdef TBI_FASTINT_1_4 -#define TBICTX_FINT_BIT 0x0004 /* Using Fast Interrupts */ -#endif -#define TBICTX_FPAC_BIT 0x0010 /* FPU state in TBICTX, FPU active on entry */ -#define TBICTX_XMCC_BIT 0x0020 /* Bit to identify a MECC task */ -#define TBICTX_CBUF_BIT 0x0040 /* Hardware catch buffer flag from TXSTATUS */ -#define TBICTX_CBRP_BIT 0x0080 /* Read pipeline dirty from TXDIVTIME */ -#define TBICTX_XDX8_BIT 0x0100 /* Saved DX.8 to DX.15 too */ -#define TBICTX_XAXX_BIT 0x0200 /* Save remaining AX registers to AX.7 */ -#define TBICTX_XHL2_BIT 0x0400 /* Saved hardware loop registers too */ -#define TBICTX_XTDP_BIT 0x0800 /* Saved DSP registers too */ -#define TBICTX_XEXT_BIT 0x1000 /* Set if TBICTX.Ext.Ctx contains extended - state save area, otherwise TBICTX.Ext.AX2 - just holds normal A0.2 and A1.2 states */ -#define TBICTX_WAIT_BIT 0x2000 /* Causes wait for trigger - sticky toggle */ -#define TBICTX_XCBF_BIT 0x4000 /* Catch buffer or RD extracted into TBICTX */ -#define TBICTX_PRIV_BIT 0x8000 /* Set if system uses 'privileged' model */ - -#ifdef METAC_1_0 -#define TBICTX_XAX3_BIT 0x0200 /* Saved AX.5 to AX.7 for XAXX */ -#define TBICTX_AX_REGS 5 /* Ax.0 to Ax.4 are core GP regs on CHORUS */ -#else -#define TBICTX_XAX4_BIT 0x0200 /* Saved AX.4 to AX.7 for XAXX */ -#define TBICTX_AX_REGS 4 /* Default is Ax.0 to Ax.3 */ -#endif - -#ifdef TBI_1_4 -#define TBICTX_CFGFPU_FX16_BIT 0x00010000 /* Save FX.8 to FX.15 too */ - -/* The METAC_CORE_ID_CONFIG field indicates omitted DSP resources */ -#define METAC_COREID_CFGXCTX_MASK( Value ) (\ - ( (((Value & METAC_COREID_CFGDSP_BITS)>> \ - METAC_COREID_CFGDSP_S ) == METAC_COREID_CFGDSP_MIN) ? \ - ~(TBICTX_XHL2_BIT+TBICTX_XTDP_BIT+ \ - TBICTX_XAXX_BIT+TBICTX_XDX8_BIT ) : ~0U ) ) -#endif - -/* Extended context state provides a standardised method for registering the - arguments required by __TBICtxSave to save the additional register states - currently in use by non general purpose code. The state of the __TBIExtCtx - variable in the static space of the thread forms an extension of the base - context of the thread. - - If ( __TBIExtCtx.Ctx.SaveMask == 0 ) then pExt is assumed to be NULL and - the empty state of __TBIExtCtx is represented by the fact that - TBICTX.SaveMask does not have the bit TBICTX_XEXT_BIT set. - - If ( __TBIExtCtx.Ctx.SaveMask != 0 ) then pExt should point at a suitably - sized extended context save area (usually at the end of the stack space - allocated by the current routine). This space should allow for the - displaced state of A0.2 and A1.2 to be saved along with the other extended - states indicated via __TBIExtCtx.Ctx.SaveMask. */ -#ifndef __ASSEMBLY__ -typedef union _tbiextctx_tag_ { - long long Val; - TBIDUAL AX2; - struct _tbiextctxext_tag { -#ifdef TBI_1_4 - short DspramSizes; /* DSPRAM sizes. Encoding varies between - TBICtxAlloc and the ECH scheme. */ -#else - short Reserved0; -#endif - short SaveMask; /* Flag bits for state saved */ - PTBIDUAL pExt; /* AX[2] state saved first plus Xxxx state */ - - } Ctx; - -} TBIEXTCTX, *PTBIEXTCTX; - -/* Automatic registration of extended context save for __TBINestInts */ -extern TBIEXTCTX __TBIExtCtx; -#endif /* ifndef __ASSEMBLY__ */ - -/* Byte offsets of fields within TBIEXTCTX */ -#define TBIEXTCTX_AX2 (0) -#define TBIEXTCTX_Ctx (0) -#define TBIEXTCTX_Ctx_SaveMask (TBIEXTCTX_Ctx + 2) -#define TBIEXTCTX_Ctx_pExt (TBIEXTCTX_Ctx + 2 + 2) - -/* Extended context data size calculation constants */ -#define TBICTXEXT_BYTES (8) -#define TBICTXEXTBB8_BYTES (8*8) -#define TBICTXEXTAX3_BYTES (3*8) -#define TBICTXEXTAX4_BYTES (4*8) -#ifdef METAC_1_0 -#define TBICTXEXTAXX_BYTES TBICTXEXTAX3_BYTES -#else -#define TBICTXEXTAXX_BYTES TBICTXEXTAX4_BYTES -#endif -#define TBICTXEXTHL2_BYTES (3*8) -#define TBICTXEXTTDR_BYTES (27*8) -#define TBICTXEXTTDP_BYTES TBICTXEXTTDR_BYTES - -#ifdef TBI_1_4 -#define TBICTXEXTFX8_BYTES (4*8) -#define TBICTXEXTFPAC_BYTES (1*4 + 2*2 + 4*8) -#define TBICTXEXTFACF_BYTES (3*8) -#endif - -/* Maximum flag bits to be set via the TBICTX_EXTSET macro */ -#define TBICTXEXT_MAXBITS (TBICTX_XEXT_BIT| \ - TBICTX_XDX8_BIT|TBICTX_XAXX_BIT|\ - TBICTX_XHL2_BIT|TBICTX_XTDP_BIT ) - -/* Maximum size of the extended context save area for current variant */ -#define TBICTXEXT_MAXBYTES (TBICTXEXT_BYTES+TBICTXEXTBB8_BYTES+\ - TBICTXEXTAXX_BYTES+TBICTXEXTHL2_BYTES+\ - TBICTXEXTTDP_BYTES ) - -#ifdef TBI_FASTINT_1_4 -/* Maximum flag bits to be set via the TBICTX_EXTSET macro */ -#define TBICTX2EXT_MAXBITS (TBICTX_XDX8_BIT|TBICTX_XAXX_BIT|\ - TBICTX_XHL2_BIT|TBICTX_XTDP_BIT ) - -/* Maximum size of the extended context save area for current variant */ -#define TBICTX2EXT_MAXBYTES (TBICTXEXTBB8_BYTES+TBICTXEXTAXX_BYTES\ - +TBICTXEXTHL2_BYTES+TBICTXEXTTDP_BYTES ) -#endif - -/* Specify extended resources being used by current routine, code must be - assembler generated to utilise extended resources- - - MOV D0xxx,A0StP ; Perform alloca - routine should - ADD A0StP,A0StP,#SaveSize ; setup/use A0FrP to access locals - MOVT D1xxx,#SaveMask ; TBICTX_XEXT_BIT MUST be set - SETL [A1GbP+#OG(___TBIExtCtx)],D0xxx,D1xxx - - NB: OG(___TBIExtCtx) is a special case supported for SETL/GETL operations - on 64-bit sizes structures only, other accesses must be based on use - of OGA(___TBIExtCtx). - - At exit of routine- - - MOV D0xxx,#0 ; Clear extended context save state - MOV D1xxx,#0 - SETL [A1GbP+#OG(___TBIExtCtx)],D0xxx,D1xxx - SUB A0StP,A0StP,#SaveSize ; If original A0StP required - - NB: Both the setting and clearing of the whole __TBIExtCtx MUST be done - atomically in one 64-bit write operation. - - For simple interrupt handling only via __TBINestInts there should be no - impact of the __TBIExtCtx system. If pre-emptive scheduling is being - performed however (assuming __TBINestInts has already been called earlier - on) then the following logic will correctly call __TBICtxSave if required - and clear out the currently selected background task- - - if ( __TBIExtCtx.Ctx.SaveMask & TBICTX_XEXT_BIT ) - { - / * Store extended states in pCtx * / - State.Sig.SaveMask |= __TBIExtCtx.Ctx.SaveMask; - - (void) __TBICtxSave( State, (void *) __TBIExtCtx.Ctx.pExt ); - __TBIExtCtx.Val = 0; - } - - and when restoring task states call __TBICtxRestore- - - / * Restore state from pCtx * / - State.Sig.pCtx = pCtx; - State.Sig.SaveMask = pCtx->SaveMask; - - if ( State.Sig.SaveMask & TBICTX_XEXT_BIT ) - { - / * Restore extended states from pCtx * / - __TBIExtCtx.Val = pCtx->Ext.Val; - - (void) __TBICtxRestore( State, (void *) __TBIExtCtx.Ctx.pExt ); - } - - */ - -/* Critical thread state save area */ -#ifndef __ASSEMBLY__ -typedef struct _tbictx_tag_ { - /* TXSTATUS_FLAG_BITS and TXSTATUS_LSM_STEP_BITS from TXSTATUS */ - short Flags; - /* Mask indicates any extended context state saved; 0 -> Never run */ - short SaveMask; - /* Saved PC value */ - int CurrPC; - /* Saved critical register states */ - TBIDUAL DX[8]; - /* Background control register states - for cores without catch buffer - base in DIVTIME the TXSTATUS bits RPVALID and RPMASK are stored with - the real state TXDIVTIME in CurrDIVTIME */ - int CurrRPT, CurrBPOBITS, CurrMODE, CurrDIVTIME; - /* Saved AX register states */ - TBIDUAL AX[2]; - TBIEXTCTX Ext; - TBIDUAL AX3[TBICTX_AX_REGS-3]; - - /* Any CBUF state to be restored by a handler return must be stored here. - Other extended state can be stored anywhere - see __TBICtxSave and - __TBICtxRestore. */ - -} TBICTX, *PTBICTX; - -#ifdef TBI_FASTINT_1_4 -typedef struct _tbictx2_tag_ { - TBIDUAL AX[2]; /* AU.0, AU.1 */ - TBIDUAL DX[2]; /* DU.0, DU.4 */ - int CurrMODE; - int CurrRPT; - int CurrSTATUS; - void *CurrPC; /* PC in PC address space */ -} TBICTX2, *PTBICTX2; -/* TBICTX2 is followed by: - * TBICTXEXTCB0 if TXSTATUS.CBMarker - * TBIDUAL * TXSTATUS.IRPCount if TXSTATUS.IRPCount > 0 - * TBICTXGP if using __TBIStdRootIntHandler or __TBIStdCtxSwitchRootIntHandler - */ - -typedef struct _tbictxgp_tag_ { - short DspramSizes; - short SaveMask; - void *pExt; - TBIDUAL DX[6]; /* DU.1-DU.3, DU.5-DU.7 */ - TBIDUAL AX[2]; /* AU.2-AU.3 */ -} TBICTXGP, *PTBICTXGP; - -#define TBICTXGP_DspramSizes (0) -#define TBICTXGP_SaveMask (TBICTXGP_DspramSizes + 2) -#define TBICTXGP_MAX_BYTES (2 + 2 + 4 + 8*(6+2)) - -#endif -#endif /* ifndef __ASSEMBLY__ */ - -/* Byte offsets of fields within TBICTX */ -#define TBICTX_Flags (0) -#define TBICTX_SaveMask (2) -#define TBICTX_CurrPC (4) -#define TBICTX_DX (2 + 2 + 4) -#define TBICTX_CurrRPT (2 + 2 + 4 + 8 * 8) -#define TBICTX_CurrMODE (2 + 2 + 4 + 8 * 8 + 4 + 4) -#define TBICTX_AX (2 + 2 + 4 + 8 * 8 + 4 + 4 + 4 + 4) -#define TBICTX_Ext (2 + 2 + 4 + 8 * 8 + 4 + 4 + 4 + 4 + 2 * 8) -#define TBICTX_Ext_AX2 (TBICTX_Ext + TBIEXTCTX_AX2) -#define TBICTX_Ext_AX2_U0 (TBICTX_Ext + TBIEXTCTX_AX2 + TBIDUAL_U0) -#define TBICTX_Ext_AX2_U1 (TBICTX_Ext + TBIEXTCTX_AX2 + TBIDUAL_U1) -#define TBICTX_Ext_Ctx_pExt (TBICTX_Ext + TBIEXTCTX_Ctx_pExt) -#define TBICTX_Ext_Ctx_SaveMask (TBICTX_Ext + TBIEXTCTX_Ctx_SaveMask) - -#ifdef TBI_FASTINT_1_4 -#define TBICTX2_BYTES (8 * 2 + 8 * 2 + 4 + 4 + 4 + 4) -#define TBICTXEXTCB0_BYTES (4 + 4 + 8) - -#define TBICTX2_CRIT_MAX_BYTES (TBICTX2_BYTES + TBICTXEXTCB0_BYTES + 6 * TBIDUAL_BYTES) -#define TBI_SWITCH_NEXT_PC(PC, EXTRA) ((PC) + (EXTRA & 1) ? 8 : 4) -#endif - -#ifndef __ASSEMBLY__ -/* Extended thread state save areas - catch buffer state element */ -typedef struct _tbictxextcb0_tag_ { - /* Flags data and address value - see METAC_CATCH_VALUES in machine.h */ - unsigned long CBFlags, CBAddr; - /* 64-bit data */ - TBIDUAL CBData; - -} TBICTXEXTCB0, *PTBICTXEXTCB0; - -/* Read pipeline state saved on later cores after single catch buffer slot */ -typedef struct _tbictxextrp6_tag_ { - /* RPMask is TXSTATUS_RPMASK_BITS only, reserved is undefined */ - unsigned long RPMask, Reserved0; - TBIDUAL CBData[6]; - -} TBICTXEXTRP6, *PTBICTXEXTRP6; - -/* Extended thread state save areas - 8 DU register pairs */ -typedef struct _tbictxextbb8_tag_ { - /* Remaining Data unit registers in 64-bit pairs */ - TBIDUAL UX[8]; - -} TBICTXEXTBB8, *PTBICTXEXTBB8; - -/* Extended thread state save areas - 3 AU register pairs */ -typedef struct _tbictxextbb3_tag_ { - /* Remaining Address unit registers in 64-bit pairs */ - TBIDUAL UX[3]; - -} TBICTXEXTBB3, *PTBICTXEXTBB3; - -/* Extended thread state save areas - 4 AU register pairs or 4 FX pairs */ -typedef struct _tbictxextbb4_tag_ { - /* Remaining Address unit or FPU registers in 64-bit pairs */ - TBIDUAL UX[4]; - -} TBICTXEXTBB4, *PTBICTXEXTBB4; - -/* Extended thread state save areas - Hardware loop states (max 2) */ -typedef struct _tbictxexthl2_tag_ { - /* Hardware looping register states */ - TBIDUAL Start, End, Count; - -} TBICTXEXTHL2, *PTBICTXEXTHL2; - -/* Extended thread state save areas - DSP register states */ -typedef struct _tbictxexttdp_tag_ { - /* DSP 32-bit accumulator register state (Bits 31:0 of ACX.0) */ - TBIDUAL Acc32[1]; - /* DSP > 32-bit accumulator bits 63:32 of ACX.0 (zero-extended) */ - TBIDUAL Acc64[1]; - /* Twiddle register state, and three phase increment states */ - TBIDUAL PReg[4]; - /* Modulo region size, padded to 64-bits */ - int CurrMRSIZE, Reserved0; - -} TBICTXEXTTDP, *PTBICTXEXTTDP; - -/* Extended thread state save areas - DSP register states including DSP RAM */ -typedef struct _tbictxexttdpr_tag_ { - /* DSP 32-bit accumulator register state (Bits 31:0 of ACX.0) */ - TBIDUAL Acc32[1]; - /* DSP 40-bit accumulator register state (Bits 39:8 of ACX.0) */ - TBIDUAL Acc40[1]; - /* DSP RAM Pointers */ - TBIDUAL RP0[2], WP0[2], RP1[2], WP1[2]; - /* DSP RAM Increments */ - TBIDUAL RPI0[2], WPI0[2], RPI1[2], WPI1[2]; - /* Template registers */ - unsigned long Tmplt[16]; - /* Modulo address region size and DSP RAM module region sizes */ - int CurrMRSIZE, CurrDRSIZE; - -} TBICTXEXTTDPR, *PTBICTXEXTTDPR; - -#ifdef TBI_1_4 -/* The METAC_ID_CORE register state is a marker for the FPU - state that is then stored after this core header structure. */ -#define TBICTXEXTFPU_CONFIG_MASK ( (METAC_COREID_NOFPACC_BIT+ \ - METAC_COREID_CFGFPU_BITS ) << \ - METAC_COREID_CONFIG_BITS ) - -/* Recorded FPU exception state from TXDEFR in DefrFpu */ -#define TBICTXEXTFPU_DEFRFPU_MASK (TXDEFR_FPU_FE_BITS) - -/* Extended thread state save areas - FPU register states */ -typedef struct _tbictxextfpu_tag_ { - /* Stored METAC_CORE_ID CONFIG */ - int CfgFpu; - /* Stored deferred TXDEFR bits related to FPU - * - * This is encoded as follows in order to fit into 16-bits: - * DefrFPU:15 - 14 <= 0 - * :13 - 8 <= TXDEFR:21-16 - * : 7 - 6 <= 0 - * : 5 - 0 <= TXDEFR:5-0 - */ - short DefrFpu; - - /* TXMODE bits related to FPU */ - short ModeFpu; - - /* FPU Even/Odd register states */ - TBIDUAL FX[4]; - - /* if CfgFpu & TBICTX_CFGFPU_FX16_BIT -> 1 then TBICTXEXTBB4 holds FX.8-15 */ - /* if CfgFpu & TBICTX_CFGFPU_NOACF_BIT -> 0 then TBICTXEXTFPACC holds state */ -} TBICTXEXTFPU, *PTBICTXEXTFPU; - -/* Extended thread state save areas - FPU accumulator state */ -typedef struct _tbictxextfpacc_tag_ { - /* FPU accumulator register state - three 64-bit parts */ - TBIDUAL FAcc32[3]; - -} TBICTXEXTFPACC, *PTBICTXEXTFPACC; -#endif - -/* Prototype TBI structure */ -struct _tbi_tag_ ; - -/* A 64-bit return value used commonly in the TBI APIs */ -typedef union _tbires_tag_ { - /* Save and load this value to get/set the whole result quickly */ - long long Val; - - /* Parameter of a fnSigs or __TBICtx* call */ - struct _tbires_sig_tag_ { - /* TXMASK[I] bits zeroed upto and including current trigger level */ - unsigned short TrigMask; - /* Control bits for handlers - see PTBIAPIFN documentation below */ - unsigned short SaveMask; - /* Pointer to the base register context save area of the thread */ - PTBICTX pCtx; - } Sig; - - /* Result of TBIThrdPrivId call */ - struct _tbires_thrdprivid_tag_ { - /* Basic thread identifier; just TBID_THREAD_BITS */ - int Id; - /* None thread number bits; TBID_ISTAT_BIT+TBID_PSTAT_BIT */ - int Priv; - } Thrd; - - /* Parameter and Result of a __TBISwitch call */ - struct _tbires_switch_tag_ { - /* Parameter passed across context switch */ - void *pPara; - /* Thread context of other Thread includng restore flags */ - PTBICTX pCtx; - } Switch; - - /* For extended S/W events only */ - struct _tbires_ccb_tag_ { - void *pCCB; - int COff; - } CCB; - - struct _tbires_tlb_tag_ { - int Leaf; /* TLB Leaf data */ - int Flags; /* TLB Flags */ - } Tlb; - -#ifdef TBI_FASTINT_1_4 - struct _tbires_intr_tag_ { - short TrigMask; - short SaveMask; - PTBICTX2 pCtx; - } Intr; -#endif - -} TBIRES, *PTBIRES; -#endif /* ifndef __ASSEMBLY__ */ - -#ifndef __ASSEMBLY__ -/* Prototype for all signal handler functions, called via ___TBISyncTrigger or - ___TBIASyncTrigger. - - State.Sig.TrigMask will indicate the bits set within TXMASKI at - the time of the handler call that have all been cleared to prevent - nested interrupt occurring immediately. - - State.Sig.SaveMask is a bit-mask which will be set to Zero when a trigger - occurs at background level and TBICTX_CRIT_BIT and optionally - TBICTX_CBUF_BIT when a trigger occurs at interrupt level. - - TBICTX_CBUF_BIT reflects the state of TXSTATUS_CBMARKER_BIT for - the interrupted background thread. - - State.Sig.pCtx will point at a TBICTX structure generated to hold the - critical state of the interrupted thread at interrupt level and - should be set to NULL when called at background level. - - Triggers will indicate the status of TXSTAT or TXSTATI sampled by the - code that called the handler. - - Inst is defined as 'Inst' if the SigNum is TBID_SIGNUM_SWx and holds the - actual SWITCH instruction detected, in other cases the value of this - parameter is undefined. - - pTBI points at the PTBI structure related to the thread and processing - level involved. - - TBIRES return value at both processing levels is similar in terms of any - changes that the handler makes. By default the State argument value - passed in should be returned. - - Sig.TrigMask value is bits to OR back into TXMASKI when the handler - completes to enable currently disabled interrupts. - - Sig.SaveMask value is ignored. - - Sig.pCtx is ignored. - - */ -typedef TBIRES (*PTBIAPIFN)( TBIRES State, int SigNum, - int Triggers, int Inst, - volatile struct _tbi_tag_ *pTBI ); -#endif /* ifndef __ASSEMBLY__ */ - -#ifndef __ASSEMBLY__ -/* The global memory map is described by a list of segment descriptors */ -typedef volatile struct _tbiseg_tag_ { - volatile struct _tbiseg_tag_ *pLink; - int Id; /* Id of the segment */ - TBISPIN Lock; /* Spin-lock for struct (normally 0) */ - unsigned int Bytes; /* Size of region in bytes */ - void *pGAddr; /* Base addr of region in global space */ - void *pLAddr; /* Base addr of region in local space */ - int Data[2]; /* Segment specific data (may be extended) */ - -} TBISEG, *PTBISEG; -#endif /* ifndef __ASSEMBLY__ */ - -/* Offsets of fields in TBISEG structure */ -#define TBISEG_pLink ( 0) -#define TBISEG_Id ( 4) -#define TBISEG_Lock ( 8) -#define TBISEG_Bytes (12) -#define TBISEG_pGAddr (16) -#define TBISEG_pLAddr (20) -#define TBISEG_Data (24) - -#ifndef __ASSEMBLY__ -typedef volatile struct _tbi_tag_ { - int SigMask; /* Bits set to represent S/W events */ - PTBIKICK pKick; /* Kick addr for S/W events */ - void *pCCB; /* Extended S/W events */ - PTBISEG pSeg; /* Related segment structure */ - PTBIAPIFN fnSigs[TBID_SIGNUM_MAX+1];/* Signal handler API table */ -} *PTBI, TBI; -#endif /* ifndef __ASSEMBLY__ */ - -/* Byte offsets of fields within TBI */ -#define TBI_SigMask (0) -#define TBI_pKick (4) -#define TBI_pCCB (8) -#define TBI_pSeg (12) -#define TBI_fnSigs (16) - -#ifdef TBI_1_4 -#ifndef __ASSEMBLY__ -/* This handler should be used for TBID_SIGNUM_DFR */ -extern TBIRES __TBIHandleDFR ( TBIRES State, int SigNum, - int Triggers, int Inst, - volatile struct _tbi_tag_ *pTBI ); -#endif -#endif - -/* String table entry - special values */ -#define METAG_TBI_STRS (0x5300) /* Tag : If entry is valid */ -#define METAG_TBI_STRE (0x4500) /* Tag : If entry is end of table */ -#define METAG_TBI_STRG (0x4700) /* Tag : If entry is a gap */ -#define METAG_TBI_STRX (0x5A00) /* TransLen : If no translation present */ - -#ifndef __ASSEMBLY__ -typedef volatile struct _tbistr_tag_ { - short Bytes; /* Length of entry in Bytes */ - short Tag; /* Normally METAG_TBI_STRS(0x5300) */ - short Len; /* Length of the string entry (incl null) */ - short TransLen; /* Normally METAG_TBI_STRX(0x5A00) */ - char String[8]; /* Zero terminated (may-be bigger) */ - -} TBISTR, *PTBISTR; -#endif /* ifndef __ASSEMBLY__ */ - -/* Cache size information - available as fields of Data[1] of global heap - segment */ -#define METAG_TBI_ICACHE_SIZE_S 0 /* see comments below */ -#define METAG_TBI_ICACHE_SIZE_BITS 0x0000000F -#define METAG_TBI_ICACHE_FILL_S 4 -#define METAG_TBI_ICACHE_FILL_BITS 0x000000F0 -#define METAG_TBI_DCACHE_SIZE_S 8 -#define METAG_TBI_DCACHE_SIZE_BITS 0x00000F00 -#define METAG_TBI_DCACHE_FILL_S 12 -#define METAG_TBI_DCACHE_FILL_BITS 0x0000F000 - -/* METAG_TBI_xCACHE_SIZE - Describes the physical cache size rounded up to the next power of 2 - relative to a 16K (2^14) cache. These sizes are encoded as a signed addend - to this base power of 2, for example - 4K -> 2^12 -> -2 (i.e. 12-14) - 8K -> 2^13 -> -1 - 16K -> 2^14 -> 0 - 32K -> 2^15 -> +1 - 64K -> 2^16 -> +2 - 128K -> 2^17 -> +3 - - METAG_TBI_xCACHE_FILL - Describes the physical cache size within the power of 2 area given by - the value above. For example a 10K cache may be represented as having - nearest size 16K with a fill of 10 sixteenths. This is encoded as the - number of unused 1/16ths, for example - 0000 -> 0 -> 16/16 - 0001 -> 1 -> 15/16 - 0010 -> 2 -> 14/16 - ... - 1111 -> 15 -> 1/16 - */ - -#define METAG_TBI_CACHE_SIZE_BASE_LOG2 14 - -/* Each declaration made by this macro generates a TBISTR entry */ -#ifndef __ASSEMBLY__ -#define TBISTR_DECL( Name, Str ) \ - __attribute__ ((__section__ (".tbistr") )) const char Name[] = #Str -#endif - -/* META timer values - see below for Timer support routines */ -#define TBI_TIMERWAIT_MIN (-16) /* Minimum 'recommended' period */ -#define TBI_TIMERWAIT_MAX (-0x7FFFFFFF) /* Maximum 'recommended' period */ - -#ifndef __ASSEMBLY__ -/* These macros allow direct access from C to any register known to the - assembler or defined in machine.h. Example candidates are TXTACTCYC, - TXIDLECYC, and TXPRIVEXT. Note that when higher level macros and routines - like the timer and trigger handling features below these should be used in - preference to this direct low-level access mechanism. */ -#define TBI_GETREG( Reg ) __extension__ ({\ - int __GRValue; \ - __asm__ volatile ("MOV\t%0," #Reg "\t/* (*TBI_GETREG OK) */" : \ - "=r" (__GRValue) ); \ - __GRValue; }) - -#define TBI_SETREG( Reg, Value ) do {\ - int __SRValue = Value; \ - __asm__ volatile ("MOV\t" #Reg ",%0\t/* (*TBI_SETREG OK) */" : \ - : "r" (__SRValue) ); } while (0) - -#define TBI_SWAPREG( Reg, Value ) do {\ - int __XRValue = (Value); \ - __asm__ volatile ("SWAP\t" #Reg ",%0\t/* (*TBI_SWAPREG OK) */" : \ - "=r" (__XRValue) : "0" (__XRValue) ); \ - Value = __XRValue; } while (0) - -/* Obtain and/or release global critical section lock given that interrupts - are already disabled and/or should remain disabled. */ -#define TBI_NOINTSCRITON do {\ - __asm__ volatile ("LOCK1\t\t/* (*TBI_NOINTSCRITON OK) */");} while (0) -#define TBI_NOINTSCRITOFF do {\ - __asm__ volatile ("LOCK0\t\t/* (*TBI_NOINTSCRITOFF OK) */");} while (0) -/* Optimised in-lining versions of the above macros */ - -#define TBI_LOCK( TrigState ) do {\ - int __TRValue; \ - int __ALOCKHI = LINSYSEVENT_WR_ATOMIC_LOCK & 0xFFFF0000; \ - __asm__ volatile ("MOV %0,#0\t\t/* (*TBI_LOCK ... */\n\t" \ - "SWAP\t%0,TXMASKI\t/* ... */\n\t" \ - "LOCK2\t\t/* ... */\n\t" \ - "SETD\t[%1+#0x40],D1RtP /* ... OK) */" : \ - "=r&" (__TRValue) : "u" (__ALOCKHI) ); \ - TrigState = __TRValue; } while (0) -#define TBI_CRITON( TrigState ) do {\ - int __TRValue; \ - __asm__ volatile ("MOV %0,#0\t\t/* (*TBI_CRITON ... */\n\t" \ - "SWAP\t%0,TXMASKI\t/* ... */\n\t" \ - "LOCK1\t\t/* ... OK) */" : \ - "=r" (__TRValue) ); \ - TrigState = __TRValue; } while (0) - -#define TBI_INTSX( TrigState ) do {\ - int __TRValue = TrigState; \ - __asm__ volatile ("SWAP\t%0,TXMASKI\t/* (*TBI_INTSX OK) */" : \ - "=r" (__TRValue) : "0" (__TRValue) ); \ - TrigState = __TRValue; } while (0) - -#define TBI_UNLOCK( TrigState ) do {\ - int __TRValue = TrigState; \ - int __ALOCKHI = LINSYSEVENT_WR_ATOMIC_LOCK & 0xFFFF0000; \ - __asm__ volatile ("SETD\t[%1+#0x00],D1RtP\t/* (*TBI_UNLOCK ... */\n\t" \ - "LOCK0\t\t/* ... */\n\t" \ - "MOV\tTXMASKI,%0\t/* ... OK) */" : \ - : "r" (__TRValue), "u" (__ALOCKHI) ); } while (0) - -#define TBI_CRITOFF( TrigState ) do {\ - int __TRValue = TrigState; \ - __asm__ volatile ("LOCK0\t\t/* (*TBI_CRITOFF ... */\n\t" \ - "MOV\tTXMASKI,%0\t/* ... OK) */" : \ - : "r" (__TRValue) ); } while (0) - -#define TBI_TRIGSX( SrcDst ) do { TBI_SWAPREG( TXMASK, SrcDst );} while (0) - -/* Composite macros to perform logic ops on INTS or TRIGS masks */ -#define TBI_INTSOR( Bits ) do {\ - int __TT = 0; TBI_INTSX(__TT); \ - __TT |= (Bits); TBI_INTSX(__TT); } while (0) - -#define TBI_INTSAND( Bits ) do {\ - int __TT = 0; TBI_INTSX(__TT); \ - __TT &= (Bits); TBI_INTSX(__TT); } while (0) - -#ifdef TBI_1_4 -#define TBI_DEFRICTRLSOR( Bits ) do {\ - int __TT = TBI_GETREG( CT.20 ); \ - __TT |= (Bits); TBI_SETREG( CT.20, __TT); } while (0) - -#define TBI_DEFRICTRLSAND( Bits ) do {\ - int __TT = TBI_GETREG( TXDEFR ); \ - __TT &= (Bits); TBI_SETREG( CT.20, __TT); } while (0) -#endif - -#define TBI_TRIGSOR( Bits ) do {\ - int __TT = TBI_GETREG( TXMASK ); \ - __TT |= (Bits); TBI_SETREG( TXMASK, __TT); } while (0) - -#define TBI_TRIGSAND( Bits ) do {\ - int __TT = TBI_GETREG( TXMASK ); \ - __TT &= (Bits); TBI_SETREG( TXMASK, __TT); } while (0) - -/* Macros to disable and re-enable interrupts using TBI_INTSX, deliberate - traps and exceptions can still be handled within the critical section. */ -#define TBI_STOPINTS( Value ) do {\ - int __TT = TBI_GETREG( TXMASKI ); \ - __TT &= TXSTATI_BGNDHALT_BIT; TBI_INTSX( __TT ); \ - Value = __TT; } while (0) -#define TBI_RESTINTS( Value ) do {\ - int __TT = Value; TBI_INTSX( __TT ); } while (0) - -/* Return pointer to segment list at current privilege level */ -PTBISEG __TBISegList( void ); - -/* Search the segment list for a match given Id, pStart can be NULL */ -PTBISEG __TBIFindSeg( PTBISEG pStart, int Id ); - -/* Prepare a new segment structure using space from within another */ -PTBISEG __TBINewSeg( PTBISEG pFromSeg, int Id, unsigned int Bytes ); - -/* Prepare a new segment using any global or local heap segments available */ -PTBISEG __TBIMakeNewSeg( int Id, unsigned int Bytes ); - -/* Insert a new segment into the segment list so __TBIFindSeg can locate it */ -void __TBIAddSeg( PTBISEG pSeg ); -#define __TBIADDSEG_DEF /* Some versions failed to define this */ - -/* Return Id of current thread; TBID_ISTAT_BIT+TBID_THREAD_BITS */ -int __TBIThreadId( void ); - -/* Return TBIRES.Thrd data for current thread */ -TBIRES __TBIThrdPrivId( void ); - -/* Return pointer to current threads TBI root block. - Id implies whether Int or Background root block is required */ -PTBI __TBI( int Id ); - -/* Try to set Mask bit using the spin-lock protocol, return 0 if fails and - new state if succeeds */ -int __TBIPoll( PTBISPIN pLock, int Mask ); - -/* Set Mask bits via the spin-lock protocol in *pLock, return new state */ -int __TBISpin( PTBISPIN pLock, int Mask ); - -/* Default handler set up for all TBI.fnSigs entries during initialisation */ -TBIRES __TBIUnExpXXX( TBIRES State, int SigNum, - int Triggers, int Inst, PTBI pTBI ); - -/* Call this routine to service triggers at background processing level. The - TBID_POLL_BIT of the Id parameter value will be used to indicate that the - routine should return if no triggers need to be serviced initially. If this - bit is not set the routine will block until one trigger handler is serviced - and then behave like the poll case servicing any remaining triggers - actually outstanding before returning. Normally the State parameter should - be simply initialised to zero and the result should be ignored, other - values/options are for internal use only. */ -TBIRES __TBISyncTrigger( TBIRES State, int Id ); - -/* Call this routine to enable processing of triggers by signal handlers at - interrupt level. The State parameter value passed is returned by this - routine. The State.Sig.TrigMask field also specifies the initial - state of the interrupt mask register TXMASKI to be setup by the call. - The other parts of the State parameter are ignored unless the PRIV bit is - set in the SaveMask field. In this case the State.Sig.pCtx field specifies - the base of the stack to which the interrupt system should switch into - as it saves the state of the previously executing code. In the case the - thread will be unprivileged as it continues execution at the return - point of this routine and it's future state will be effectively never - trusted to be valid. */ -TBIRES __TBIASyncTrigger( TBIRES State ); - -/* Call this to swap soft threads executing at the background processing level. - The TBIRES returned to the new thread will be the same as the NextThread - value specified to the call. The NextThread.Switch.pCtx value specifies - which thread context to restore and the NextThread.Switch.Para value can - hold an arbitrary expression to be passed between the threads. The saved - state of the previous thread will be stored in a TBICTX descriptor created - on it's stack and the address of this will be stored into the *rpSaveCtx - location specified. */ -TBIRES __TBISwitch( TBIRES NextThread, PTBICTX *rpSaveCtx ); - -/* Call this to initialise a stack frame ready for further use, up to four - 32-bit arguments may be specified after the fixed args to be passed via - the new stack pStack to the routine specified via fnMain. If the - main-line routine ever returns the thread will operate as if main itself - had returned and terminate with the return code given. */ -typedef int (*PTBIMAINFN)( TBIRES Arg /*, <= 4 additional 32-bit args */ ); -PTBICTX __TBISwitchInit( void *pStack, PTBIMAINFN fnMain, ... ); - -/* Call this to resume a thread from a saved synchronous TBICTX state. - The TBIRES returned to the new thread will be the same as the NextThread - value specified to the call. The NextThread.Switch.pCtx value specifies - which thread context to restore and the NextThread.Switch.Para value can - hold an arbitrary expression to be passed between the threads. The context - of the calling thread is lost and this routine never returns to the - caller. The TrigsMask value supplied is ored into TXMASKI to enable - interrupts after the context of the new thread is established. */ -void __TBISyncResume( TBIRES NextThread, int TrigsMask ); - -/* Call these routines to save and restore the extended states of - scheduled tasks. */ -void *__TBICtxSave( TBIRES State, void *pExt ); -void *__TBICtxRestore( TBIRES State, void *pExt ); - -#ifdef TBI_1_4 -#ifdef TBI_FASTINT_1_4 -/* Call these routines to copy the GP state to a separate buffer - * Only necessary for context switching. - */ -PTBICTXGP __TBICtx2SaveCrit( PTBICTX2 pCurrentCtx, PTBICTX2 pSaveCtx ); -void *__TBICtx2SaveGP( PTBICTXGP pCurrentCtxGP, PTBICTXGP pSaveCtxGP ); - -/* Call these routines to save and restore the extended states of - scheduled tasks. */ -void *__TBICtx2Save( PTBICTXGP pCtxGP, short SaveMask, void *pExt ); -void *__TBICtx2Restore( PTBICTX2 pCtx, short SaveMask, void *pExt ); -#endif - -/* If FPAC flag is set then significant FPU context exists. Call these routine - to save and restore it */ -void *__TBICtxFPUSave( TBIRES State, void *pExt ); -void *__TBICtxFPURestore( TBIRES State, void *pExt ); - -#ifdef TBI_FASTINT_1_4 -extern void *__TBICtx2FPUSave (PTBICTXGP, short, void*); -extern void *__TBICtx2FPURestore (PTBICTXGP, short, void*); -#endif -#endif - -#ifdef TBI_1_4 -/* Call these routines to save and restore DSPRAM. */ -void *__TBIDspramSaveA (short DspramSizes, void *pExt); -void *__TBIDspramSaveB (short DspramSizes, void *pExt); -void *__TBIDspramRestoreA (short DspramSizes, void *pExt); -void *__TBIDspramRestoreB (short DspramSizes, void *pExt); -#endif - -/* This routine should be used at the entrypoint of interrupt handlers to - re-enable higher priority interrupts and/or save state from the previously - executing background code. State is a TBIRES.Sig parameter with NoNestMask - indicating the triggers (if any) that should remain disabled and SaveMask - CBUF bit indicating the if the hardware catch buffer is dirty. Optionally - any number of extended state bits X??? including XCBF can be specified to - force a nested state save call to __TBICtxSave before the current routine - continues. (In the latter case __TBICtxRestore should be called to restore - any extended states before the background thread of execution is resumed) - - By default (no X??? bits specified in SaveMask) this routine performs a - sub-call to __TBICtxSave with the pExt and State parameters specified IF - some triggers could be serviced while the current interrupt handler - executes and the hardware catch buffer is actually dirty. In this case - this routine provides the XCBF bit in State.Sig.SaveMask to force the - __TBICtxSave to extract the current catch state. - - The NoNestMask parameter should normally indicate that the same or lower - triggers than those provoking the current handler call should not be - serviced in nested calls, zero may be specified if all possible interrupts - are to be allowed. - - The TBIRES.Sig value returned will be similar to the State parameter - specified with the XCBF bit ORed into it's SaveMask if a context save was - required and fewer bits set in it's TrigMask corresponding to the same/lower - priority interrupt triggers still not enabled. */ -TBIRES __TBINestInts( TBIRES State, void *pExt, int NoNestMask ); - -/* This routine causes the TBICTX structure specified in State.Sig.pCtx to - be restored. This implies that execution will not return to the caller. - The State.Sig.TrigMask field will be restored during the context switch - such that any immediately occurring interrupts occur in the context of the - newly specified task. The State.Sig.SaveMask parameter is ignored. */ -void __TBIASyncResume( TBIRES State ); - -/* Call this routine to enable fastest possible processing of one or more - interrupt triggers via a unified signal handler. The handler concerned - must simple return after servicing the related hardware. - The State.Sig.TrigMask parameter indicates the interrupt triggers to be - enabled and the Thin.Thin.fnHandler specifies the routine to call and - the whole Thin parameter value will be passed to this routine unaltered as - it's first parameter. */ -void __TBIASyncThin( TBIRES State, TBIRES Thin ); - -/* Do this before performing your own direct spin-lock access - use TBI_LOCK */ -int __TBILock( void ); - -/* Do this after performing your own direct spin-lock access - use TBI_UNLOCK */ -void __TBIUnlock( int TrigState ); - -/* Obtain and release global critical section lock - only stops execution - of interrupts on this thread and similar critical section code on other - local threads - use TBI_CRITON or TBI_CRITOFF */ -int __TBICritOn( void ); -void __TBICritOff( int TrigState ); - -/* Change INTS (TXMASKI) - return old state - use TBI_INTSX */ -int __TBIIntsX( int NewMask ); - -/* Change TRIGS (TXMASK) - return old state - use TBI_TRIGSX */ -int __TBITrigsX( int NewMask ); - -/* This function initialises a timer for first use, only the TBID_ISTAT_BIT - of the Id parameter is used to indicate which timer is to be modified. The - Wait value should either be zero to disable the timer concerned or be in - the recommended TBI_TIMERWAIT_* range to specify the delay required before - the first timer trigger occurs. - - The TBID_ISTAT_BIT of the Id parameter similar effects all other timer - support functions (see below). */ -void __TBITimerCtrl( int Id, int Wait ); - -/* This routine returns a 64-bit time stamp value that is initialised to zero - via a __TBITimerCtrl timer enabling call. */ -long long __TBITimeStamp( int Id ); - -/* To manage a periodic timer each period elapsed should be subracted from - the current timer value to attempt to set up the next timer trigger. The - Wait parameter should be a value in the recommended TBI_TIMERWAIT_* range. - The return value is the new aggregate value that the timer was updated to, - if this is less than zero then a timer trigger is guaranteed to be - generated after the number of ticks implied, if a positive result is - returned either itterative or step-wise corrective action must be taken to - resynchronise the timer and hence provoke a future timer trigger. */ -int __TBITimerAdd( int Id, int Wait ); - -/* String table search function, pStart is first entry to check or NULL, - pStr is string data to search for and MatchLen is either length of string - to compare for an exact match or negative length to compare for partial - match. */ -const TBISTR *__TBIFindStr( const TBISTR *pStart, - const char *pStr, int MatchLen ); - -/* String table translate function, pStr is text to translate and Len is - it's length. Value returned may not be a string pointer if the - translation value is really some other type, 64-bit alignment of the return - pointer is guaranteed so almost any type including a structure could be - located with this routine. */ -const void *__TBITransStr( const char *pStr, int Len ); - - - -/* Arbitrary physical memory access windows, use different Channels to avoid - conflict/thrashing within a single piece of code. */ -void *__TBIPhysAccess( int Channel, int PhysAddr, int Bytes ); -void __TBIPhysRelease( int Channel, void *pLinAddr ); - -#ifdef METAC_1_0 -/* Data cache function nullified because data cache is off */ -#define TBIDCACHE_FLUSH( pAddr ) -#define TBIDCACHE_PRELOAD( Type, pAddr ) ((Type) (pAddr)) -#define TBIDCACHE_REFRESH( Type, pAddr ) ((Type) (pAddr)) -#endif -#ifdef METAC_1_1 -/* To flush a single cache line from the data cache using a linear address */ -#define TBIDCACHE_FLUSH( pAddr ) ((volatile char *) \ - (((unsigned int) (pAddr))>>LINSYSLFLUSH_S))[0] = 0 - -extern void * __builtin_dcache_preload (void *); - -/* Try to ensure that the data at the address concerned is in the cache */ -#define TBIDCACHE_PRELOAD( Type, Addr ) \ - ((Type) __builtin_dcache_preload ((void *)(Addr))) - -extern void * __builtin_dcache_refresh (void *); - -/* Flush any old version of data from address and re-load a new copy */ -#define TBIDCACHE_REFRESH( Type, Addr ) __extension__ ({ \ - Type __addr = (Type)(Addr); \ - (void)__builtin_dcache_refresh ((void *)(((unsigned int)(__addr))>>6)); \ - __addr; }) - -#endif -#ifndef METAC_1_0 -#ifndef METAC_1_1 -/* Support for DCACHE builtin */ -extern void __builtin_dcache_flush (void *); - -/* To flush a single cache line from the data cache using a linear address */ -#define TBIDCACHE_FLUSH( Addr ) \ - __builtin_dcache_flush ((void *)(Addr)) - -extern void * __builtin_dcache_preload (void *); - -/* Try to ensure that the data at the address concerned is in the cache */ -#define TBIDCACHE_PRELOAD( Type, Addr ) \ - ((Type) __builtin_dcache_preload ((void *)(Addr))) - -extern void * __builtin_dcache_refresh (void *); - -/* Flush any old version of data from address and re-load a new copy */ -#define TBIDCACHE_REFRESH( Type, Addr ) \ - ((Type) __builtin_dcache_refresh ((void *)(Addr))) - -#endif -#endif - -/* Flush the MMCU cache */ -#define TBIMCACHE_FLUSH() { ((volatile int *) LINSYSCFLUSH_MMCU)[0] = 0; } - -#ifdef METAC_2_1 -/* Obtain the MMU table entry for the specified address */ -#define TBIMTABLE_LEAFDATA(ADDR) TBIXCACHE_RD((int)(ADDR) & (-1<<6)) - -#ifndef __ASSEMBLY__ -/* Obtain the full MMU table entry for the specified address */ -#define TBIMTABLE_DATA(ADDR) __extension__ ({ TBIRES __p; \ - __p.Val = TBIXCACHE_RL((int)(ADDR) & (-1<<6)); \ - __p; }) -#endif -#endif - -/* Combine a physical base address, and a linear address - * Internal use only - */ -#define _TBIMTABLE_LIN2PHYS(PHYS, LIN, LMASK) (void*)(((int)(PHYS)&0xFFFFF000)\ - +((int)(LIN)&(LMASK))) - -/* Convert a linear to a physical address */ -#define TBIMTABLE_LIN2PHYS(LEAFDATA, ADDR) \ - (((LEAFDATA) & CRLINPHY0_VAL_BIT) \ - ? _TBIMTABLE_LIN2PHYS(LEAFDATA, ADDR, 0x00000FFF) \ - : 0) - -/* Debug support - using external debugger or host */ -void __TBIDumpSegListEntries( void ); -void __TBILogF( const char *pFmt, ... ); -void __TBIAssert( const char *pFile, int LineNum, const char *pExp ); -void __TBICont( const char *pMsg, ... ); /* TBIAssert -> 'wait for continue' */ - -/* Array of signal name data for debug messages */ -extern const char __TBISigNames[]; -#endif /* ifndef __ASSEMBLY__ */ - - - -/* Scale of sub-strings in the __TBISigNames string list */ -#define TBI_SIGNAME_SCALE 4 -#define TBI_SIGNAME_SCALE_S 2 - -#define TBI_1_3 - -#ifdef TBI_1_3 - -#ifndef __ASSEMBLY__ -#define TBIXCACHE_RD(ADDR) __extension__ ({\ - void * __Addr = (void *)(ADDR); \ - int __Data; \ - __asm__ volatile ( "CACHERD\t%0,[%1+#0]" : \ - "=r" (__Data) : "r" (__Addr) ); \ - __Data; }) - -#define TBIXCACHE_RL(ADDR) __extension__ ({\ - void * __Addr = (void *)(ADDR); \ - long long __Data; \ - __asm__ volatile ( "CACHERL\t%0,%t0,[%1+#0]" : \ - "=d" (__Data) : "r" (__Addr) ); \ - __Data; }) - -#define TBIXCACHE_WD(ADDR, DATA) do {\ - void * __Addr = (void *)(ADDR); \ - int __Data = DATA; \ - __asm__ volatile ( "CACHEWD\t[%0+#0],%1" : \ - : "r" (__Addr), "r" (__Data) ); } while(0) - -#define TBIXCACHE_WL(ADDR, DATA) do {\ - void * __Addr = (void *)(ADDR); \ - long long __Data = DATA; \ - __asm__ volatile ( "CACHEWL\t[%0+#0],%1,%t1" : \ - : "r" (__Addr), "r" (__Data) ); } while(0) - -#ifdef TBI_4_0 - -#define TBICACHE_FLUSH_L1D_L2(ADDR) \ - TBIXCACHE_WD(ADDR, CACHEW_FLUSH_L1D_L2) -#define TBICACHE_WRITEBACK_L1D_L2(ADDR) \ - TBIXCACHE_WD(ADDR, CACHEW_WRITEBACK_L1D_L2) -#define TBICACHE_INVALIDATE_L1D(ADDR) \ - TBIXCACHE_WD(ADDR, CACHEW_INVALIDATE_L1D) -#define TBICACHE_INVALIDATE_L1D_L2(ADDR) \ - TBIXCACHE_WD(ADDR, CACHEW_INVALIDATE_L1D_L2) -#define TBICACHE_INVALIDATE_L1DTLB(ADDR) \ - TBIXCACHE_WD(ADDR, CACHEW_INVALIDATE_L1DTLB) -#define TBICACHE_INVALIDATE_L1I(ADDR) \ - TBIXCACHE_WD(ADDR, CACHEW_INVALIDATE_L1I) -#define TBICACHE_INVALIDATE_L1ITLB(ADDR) \ - TBIXCACHE_WD(ADDR, CACHEW_INVALIDATE_L1ITLB) - -#endif /* TBI_4_0 */ -#endif /* ifndef __ASSEMBLY__ */ - -/* - * Calculate linear PC value from real PC and Minim mode control, the LSB of - * the result returned indicates if address compression has occurred. - */ -#ifndef __ASSEMBLY__ -#define METAG_LINPC( PCVal ) (\ - ( (TBI_GETREG(TXPRIVEXT) & TXPRIVEXT_MINIMON_BIT) != 0 ) ? ( \ - ( ((PCVal) & 0x00900000) == 0x00900000 ) ? \ - (((PCVal) & 0xFFE00000) + (((PCVal) & 0x001FFFFC)>>1) + 1) : \ - ( ((PCVal) & 0x00800000) == 0x00000000 ) ? \ - (((PCVal) & 0xFF800000) + (((PCVal) & 0x007FFFFC)>>1) + 1) : \ - (PCVal) ) \ - : (PCVal) ) -#define METAG_LINPC_X2BIT 0x00000001 /* Make (Size>>1) if compressed */ - -/* Convert an arbitrary Linear address into a valid Minim PC or return 0 */ -#define METAG_PCMINIM( LinVal ) (\ - (((LinVal) & 0x00980000) == 0x00880000) ? \ - (((LinVal) & 0xFFE00000) + (((LinVal) & 0x000FFFFE)<<1)) : \ - (((LinVal) & 0x00C00000) == 0x00000000) ? \ - (((LinVal) & 0xFF800000) + (((LinVal) & 0x003FFFFE)<<1)) : 0 ) - -/* Reverse a METAG_LINPC conversion step to return the original PCVal */ -#define METAG_PCLIN( LinVal ) ( 0xFFFFFFFC & (\ - ( (LinVal & METAG_LINPC_X2BIT) != 0 ) ? METAG_PCMINIM( LinVal ) : \ - (LinVal) )) - -/* - * Flush the MMCU Table cache privately for each thread. On cores that do not - * support per-thread flushing it will flush all threads mapping data. - */ -#define TBIMCACHE_TFLUSH(Thread) do {\ - ((volatile int *)( LINSYSCFLUSH_TxMMCU_BASE + \ - (LINSYSCFLUSH_TxMMCU_STRIDE*(Thread)) ))[0] = 0; \ - } while(0) - -/* - * To flush a single linear-matched cache line from the code cache. In - * cases where Minim is possible the METAC_LINPC operation must be used - * to pre-process the address being flushed. - */ -#define TBIICACHE_FLUSH( pAddr ) TBIXCACHE_WD (pAddr, CACHEW_ICACHE_BIT) - -/* To flush a single linear-matched mapping from code/data MMU table cache */ -#define TBIMCACHE_AFLUSH( pAddr, SegType ) \ - TBIXCACHE_WD(pAddr, CACHEW_TLBFLUSH_BIT + ( \ - ((SegType) == TBID_SEGTYPE_TEXT) ? CACHEW_ICACHE_BIT : 0 )) - -/* - * To flush translation data corresponding to a range of addresses without - * using TBITCACHE_FLUSH to flush all of this threads translation data. It - * is necessary to know what stride (>= 4K) must be used to flush a specific - * region. - * - * For example direct mapped regions use the maximum page size (512K) which may - * mean that only one flush is needed to cover the sub-set of the direct - * mapped area used since it was setup. - * - * The function returns the stride on which flushes should be performed. - * - * If 0 is returned then the region is not subject to MMU caching, if -1 is - * returned then this indicates that only TBIMCACHE_TFLUSH can be used to - * flush the region concerned rather than TBIMCACHE_AFLUSH which this - * function is designed to support. - */ -int __TBIMMUCacheStride( const void *pStart, int Bytes ); - -/* - * This function will use the above lower level functions to achieve a MMU - * table data flush in an optimal a fashion as possible. On a system that - * supports linear address based caching this function will also call the - * code or data cache flush functions to maintain address/data coherency. - * - * SegType should be TBID_SEGTYPE_TEXT if the address range is for code or - * any other value such as TBID_SEGTYPE_DATA for data. If an area is - * used in both ways then call this function twice; once for each. - */ -void __TBIMMUCacheFlush( const void *pStart, int Bytes, int SegType ); - -/* - * Cached Core mode setup and flush functions allow one code and one data - * region of the corresponding global or local cache partion size to be - * locked into the corresponding cache memory. This prevents normal LRU - * logic discarding the code or data and avoids write-thru bandwidth in - * data areas. Code mappings are selected by specifying TBID_SEGTYPE_TEXT - * for SegType, otherwise data mappings are created. - * - * Mode supplied should always contain the VALID bit and WINx selection data. - * Data areas will be mapped read-only if the WRITE bit is not added. - * - * The address returned by the Opt function will either be the same as that - * passed in (if optimisation cannot be supported) or the base of the new core - * cached region in linear address space. The returned address must be passed - * into the End function to remove the mapping when required. If a non-core - * cached memory address is passed into it the End function has no effect. - * Note that the region accessed MUST be flushed from the appropriate cache - * before the End function is called to deliver correct operation. - */ -void *__TBICoreCacheOpt( const void *pStart, int Bytes, int SegType, int Mode ); -void __TBICoreCacheEnd( const void *pOpt, int Bytes, int SegType ); - -/* - * Optimise physical access channel and flush side effects before releasing - * the channel. If pStart is NULL the whole region must be flushed and this is - * done automatically by the channel release function if optimisation is - * enabled. Flushing the specific region that may have been accessed before - * release should optimises this process. On physically cached systems we do - * not flush the code/data caches only the MMU table data needs flushing. - */ -void __TBIPhysOptim( int Channel, int IMode, int DMode ); -void __TBIPhysFlush( int Channel, const void *pStart, int Bytes ); -#endif -#endif /* ifdef TBI_1_3 */ - -#endif /* _ASM_METAG_TBX_H_ */ diff --git a/arch/metag/include/asm/tcm.h b/arch/metag/include/asm/tcm.h deleted file mode 100644 index a0a4997e4b8a2..0000000000000 --- a/arch/metag/include/asm/tcm.h +++ /dev/null @@ -1,31 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __ASM_TCM_H__ -#define __ASM_TCM_H__ - -#include -#include - -struct tcm_allocation { - struct list_head list; - unsigned int tag; - unsigned long addr; - unsigned long size; -}; - -/* - * TCM memory region descriptor. - */ -struct tcm_region { - unsigned int tag; - struct resource res; -}; - -#define TCM_INVALID_TAG 0xffffffff - -unsigned long tcm_alloc(unsigned int tag, size_t len); -void tcm_free(unsigned int tag, unsigned long addr, size_t len); -unsigned int tcm_lookup_tag(unsigned long p); - -int tcm_add_region(struct tcm_region *reg); - -#endif diff --git a/arch/metag/include/asm/thread_info.h b/arch/metag/include/asm/thread_info.h deleted file mode 100644 index a1a9c7f5ca8c1..0000000000000 --- a/arch/metag/include/asm/thread_info.h +++ /dev/null @@ -1,141 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* thread_info.h: Meta low-level thread information - * - * Copyright (C) 2002 David Howells (dhowells@redhat.com) - * - Incorporating suggestions made by Linus Torvalds and Dave Miller - * - * Meta port by Imagination Technologies - */ - -#ifndef _ASM_THREAD_INFO_H -#define _ASM_THREAD_INFO_H - -#include -#include - -#ifndef __ASSEMBLY__ -#include -#endif - -/* - * 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 - */ -#ifndef __ASSEMBLY__ - -/* This must be 8 byte aligned so we can ensure stack alignment. */ -struct thread_info { - struct task_struct *task; /* main task structure */ - unsigned long flags; /* low level flags */ - unsigned long status; /* thread-synchronous flags */ - u32 cpu; /* current CPU */ - int preempt_count; /* 0 => preemptable, <0 => BUG */ - - mm_segment_t addr_limit; /* thread address space */ - - u8 supervisor_stack[0] __aligned(8); -}; - -#else /* !__ASSEMBLY__ */ - -#include - -#endif - -#ifdef CONFIG_4KSTACKS -#define THREAD_SHIFT 12 -#else -#define THREAD_SHIFT 13 -#endif - -#if THREAD_SHIFT >= PAGE_SHIFT -#define THREAD_SIZE_ORDER (THREAD_SHIFT - PAGE_SHIFT) -#else -#define THREAD_SIZE_ORDER 0 -#endif - -#define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER) - -#define STACK_WARN (THREAD_SIZE/8) -/* - * macros/functions for gaining access to the thread information structure - */ -#ifndef __ASSEMBLY__ - -#define INIT_THREAD_INFO(tsk) \ -{ \ - .task = &tsk, \ - .flags = 0, \ - .cpu = 0, \ - .preempt_count = INIT_PREEMPT_COUNT, \ - .addr_limit = KERNEL_DS, \ -} - -/* how to get the current stack pointer from C */ -register unsigned long current_stack_pointer asm("A0StP") __used; - -/* how to get the thread information struct from C */ -static inline struct thread_info *current_thread_info(void) -{ - return (struct thread_info *)(current_stack_pointer & - ~(THREAD_SIZE - 1)); -} - -#define __HAVE_ARCH_KSTACK_END -static inline int kstack_end(void *addr) -{ - return addr == (void *) (((unsigned long) addr & ~(THREAD_SIZE - 1)) - + sizeof(struct thread_info)); -} - -#endif - -/* - * 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_SIGPENDING 1 /* signal pending */ -#define TIF_NEED_RESCHED 2 /* rescheduling necessary */ -#define TIF_SINGLESTEP 3 /* restore singlestep on return to user - mode */ -#define TIF_SYSCALL_AUDIT 4 /* syscall auditing active */ -#define TIF_SECCOMP 5 /* secure computing */ -#define TIF_RESTORE_SIGMASK 6 /* restore signal mask in do_signal() */ -#define TIF_NOTIFY_RESUME 7 /* callback before returning to user */ -#define TIF_MEMDIE 8 /* is terminating due to OOM killer */ -#define TIF_SYSCALL_TRACEPOINT 9 /* syscall tracepoint instrumentation */ - - -#define _TIF_SYSCALL_TRACE (1< -#include - -/* Note, read http://lkml.org/lkml/2004/1/15/6 */ - -#ifdef CONFIG_METAG_META12 - -#define tlb_start_vma(tlb, vma) \ - do { \ - if (!tlb->fullmm) \ - flush_cache_range(vma, vma->vm_start, vma->vm_end); \ - } while (0) - -#define tlb_end_vma(tlb, vma) \ - do { \ - if (!tlb->fullmm) \ - flush_tlb_range(vma, vma->vm_start, vma->vm_end); \ - } while (0) - - -#else - -#define tlb_start_vma(tlb, vma) do { } while (0) -#define tlb_end_vma(tlb, vma) do { } while (0) - -#endif - -#define __tlb_remove_tlb_entry(tlb, pte, addr) do { } while (0) -#define tlb_flush(tlb) flush_tlb_mm((tlb)->mm) - -#include - -#endif diff --git a/arch/metag/include/asm/tlbflush.h b/arch/metag/include/asm/tlbflush.h deleted file mode 100644 index f3e5d99a3891b..0000000000000 --- a/arch/metag/include/asm/tlbflush.h +++ /dev/null @@ -1,78 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __ASM_METAG_TLBFLUSH_H -#define __ASM_METAG_TLBFLUSH_H - -#include -#include -#include -#include - -/* - * TLB flushing: - * - * - flush_tlb() flushes the current mm struct TLBs - * - flush_tlb_all() flushes all processes TLBs - * - flush_tlb_mm(mm) flushes the specified mm context TLB's - * - flush_tlb_page(vma, vmaddr) flushes one page - * - flush_tlb_range(mm, start, end) flushes a range of pages - * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages - * - flush_tlb_pgtables(mm, start, end) flushes a range of page tables - * - * FIXME: Meta 2 can flush single TLB entries. - * - */ - -#if defined(CONFIG_METAG_META21) && !defined(CONFIG_SMP) -static inline void __flush_tlb(void) -{ - /* flush TLB entries for just the current hardware thread */ - int thread = hard_processor_id(); - metag_out32(0, (LINSYSCFLUSH_TxMMCU_BASE + - LINSYSCFLUSH_TxMMCU_STRIDE * thread)); -} -#else -static inline void __flush_tlb(void) -{ - /* flush TLB entries for all hardware threads */ - metag_out32(0, LINSYSCFLUSH_MMCU); -} -#endif /* defined(CONFIG_METAG_META21) && !defined(CONFIG_SMP) */ - -#define flush_tlb() __flush_tlb() - -#define flush_tlb_all() __flush_tlb() - -#define local_flush_tlb_all() __flush_tlb() - -static inline void flush_tlb_mm(struct mm_struct *mm) -{ - if (mm == current->active_mm) - __flush_tlb(); -} - -static inline void flush_tlb_page(struct vm_area_struct *vma, - unsigned long addr) -{ - flush_tlb_mm(vma->vm_mm); -} - -static inline void flush_tlb_range(struct vm_area_struct *vma, - unsigned long start, unsigned long end) -{ - flush_tlb_mm(vma->vm_mm); -} - -static inline void flush_tlb_pgtables(struct mm_struct *mm, - unsigned long start, unsigned long end) -{ - flush_tlb_mm(mm); -} - -static inline void flush_tlb_kernel_range(unsigned long start, - unsigned long end) -{ - flush_tlb_all(); -} - -#endif /* __ASM_METAG_TLBFLUSH_H */ - diff --git a/arch/metag/include/asm/topology.h b/arch/metag/include/asm/topology.h deleted file mode 100644 index df0d9e6b7f129..0000000000000 --- a/arch/metag/include/asm/topology.h +++ /dev/null @@ -1,28 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_METAG_TOPOLOGY_H -#define _ASM_METAG_TOPOLOGY_H - -#ifdef CONFIG_NUMA - -#define cpu_to_node(cpu) ((void)(cpu), 0) - -#define cpumask_of_node(node) ((void)node, cpu_online_mask) - -#define pcibus_to_node(bus) ((void)(bus), -1) -#define cpumask_of_pcibus(bus) (pcibus_to_node(bus) == -1 ? \ - cpu_all_mask : \ - cpumask_of_node(pcibus_to_node(bus))) - -#endif - -#define mc_capable() (1) - -const struct cpumask *cpu_coregroup_mask(unsigned int cpu); - -extern cpumask_t cpu_core_map[NR_CPUS]; - -#define topology_core_cpumask(cpu) (&cpu_core_map[cpu]) - -#include - -#endif /* _ASM_METAG_TOPOLOGY_H */ diff --git a/arch/metag/include/asm/traps.h b/arch/metag/include/asm/traps.h deleted file mode 100644 index ac808740bd848..0000000000000 --- a/arch/metag/include/asm/traps.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2005,2008 Imagination Technologies - * - * This file is subject to 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 _METAG_TBIVECTORS_H -#define _METAG_TBIVECTORS_H - -#ifndef __ASSEMBLY__ - -#include - -typedef TBIRES (*kick_irq_func_t)(TBIRES, int, int, int, PTBI, int *); - -extern TBIRES kick_handler(TBIRES, int, int, int, PTBI); -struct kick_irq_handler { - struct list_head list; - kick_irq_func_t func; -}; - -extern void kick_register_func(struct kick_irq_handler *); -extern void kick_unregister_func(struct kick_irq_handler *); - -extern void head_end(TBIRES, unsigned long); -extern void restart_critical_section(TBIRES State); -extern TBIRES tail_end_sys(TBIRES, int, int *); -static inline TBIRES tail_end(TBIRES state) -{ - return tail_end_sys(state, -1, NULL); -} - -DECLARE_PER_CPU(PTBI, pTBI); -extern PTBI pTBI_get(unsigned int); - -extern int ret_from_fork(TBIRES arg); - -extern int do_page_fault(struct pt_regs *regs, unsigned long address, - unsigned int write_access, unsigned int trapno); - -extern TBIRES __TBIUnExpXXX(TBIRES State, int SigNum, int Triggers, int Inst, - PTBI pTBI); - -#endif - -#endif /* _METAG_TBIVECTORS_H */ diff --git a/arch/metag/include/asm/uaccess.h b/arch/metag/include/asm/uaccess.h deleted file mode 100644 index a5311eb36e32f..0000000000000 --- a/arch/metag/include/asm/uaccess.h +++ /dev/null @@ -1,213 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __METAG_UACCESS_H -#define __METAG_UACCESS_H - -/* - * User space memory access functions - */ - -/* - * 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. - */ - -#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) }) - -#define KERNEL_DS MAKE_MM_SEG(0xFFFFFFFF) -#define USER_DS MAKE_MM_SEG(PAGE_OFFSET) - -#define get_ds() (KERNEL_DS) -#define get_fs() (current_thread_info()->addr_limit) -#define set_fs(x) (current_thread_info()->addr_limit = (x)) - -#define segment_eq(a, b) ((a).seg == (b).seg) - -static inline int __access_ok(unsigned long addr, unsigned long size) -{ - /* - * Allow access to the user mapped memory area, but not the system area - * before it. The check extends to the top of the address space when - * kernel access is allowed (there's no real reason to user copy to the - * system area in any case). - */ - if (likely(addr >= META_MEMORY_BASE && addr < get_fs().seg && - size <= get_fs().seg - addr)) - return true; - /* - * Explicitly allow NULL pointers here. Parts of the kernel such - * as readv/writev use access_ok to validate pointers, but want - * to allow NULL pointers for various reasons. NULL pointers are - * safe to allow through because the first page is not mappable on - * Meta. - */ - if (!addr) - return true; - /* Allow access to core code memory area... */ - if (addr >= LINCORE_CODE_BASE && addr <= LINCORE_CODE_LIMIT && - size <= LINCORE_CODE_LIMIT + 1 - addr) - return true; - /* ... but no other areas. */ - return false; -} - -#define access_ok(type, addr, size) __access_ok((unsigned long)(addr), \ - (unsigned long)(size)) - -#include - -/* - * These are the main single-value transfer routines. They automatically - * use the right size if we just have the right pointer type. - */ - -#define put_user(x, ptr) \ - __put_user_check((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr))) -#define __put_user(x, ptr) \ - __put_user_nocheck((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr))) - -extern void __put_user_bad(void); - -#define __put_user_nocheck(x, ptr, size) \ -({ \ - long __pu_err; \ - __put_user_size((x), (ptr), (size), __pu_err); \ - __pu_err; \ -}) - -#define __put_user_check(x, ptr, size) \ -({ \ - long __pu_err = -EFAULT; \ - __typeof__(*(ptr)) __user *__pu_addr = (ptr); \ - if (access_ok(VERIFY_WRITE, __pu_addr, size)) \ - __put_user_size((x), __pu_addr, (size), __pu_err); \ - __pu_err; \ -}) - -extern long __put_user_asm_b(unsigned int x, void __user *addr); -extern long __put_user_asm_w(unsigned int x, void __user *addr); -extern long __put_user_asm_d(unsigned int x, void __user *addr); -extern long __put_user_asm_l(unsigned long long x, void __user *addr); - -#define __put_user_size(x, ptr, size, retval) \ -do { \ - retval = 0; \ - switch (size) { \ - case 1: \ - retval = __put_user_asm_b((__force unsigned int)x, ptr);\ - break; \ - case 2: \ - retval = __put_user_asm_w((__force unsigned int)x, ptr);\ - break; \ - case 4: \ - retval = __put_user_asm_d((__force unsigned int)x, ptr);\ - break; \ - case 8: \ - retval = __put_user_asm_l((__force unsigned long long)x,\ - ptr); \ - break; \ - default: \ - __put_user_bad(); \ - } \ -} while (0) - -#define get_user(x, ptr) \ - __get_user_check((x), (ptr), sizeof(*(ptr))) -#define __get_user(x, ptr) \ - __get_user_nocheck((x), (ptr), sizeof(*(ptr))) - -extern long __get_user_bad(void); - -#define __get_user_nocheck(x, ptr, size) \ -({ \ - long __gu_err; \ - long long __gu_val; \ - __get_user_size(__gu_val, (ptr), (size), __gu_err); \ - (x) = (__force __typeof__(*(ptr)))__gu_val; \ - __gu_err; \ -}) - -#define __get_user_check(x, ptr, size) \ -({ \ - long __gu_err = -EFAULT; \ - long long __gu_val = 0; \ - const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \ - if (access_ok(VERIFY_READ, __gu_addr, size)) \ - __get_user_size(__gu_val, __gu_addr, (size), __gu_err); \ - (x) = (__force __typeof__(*(ptr)))__gu_val; \ - __gu_err; \ -}) - -extern unsigned char __get_user_asm_b(const void __user *addr, long *err); -extern unsigned short __get_user_asm_w(const void __user *addr, long *err); -extern unsigned int __get_user_asm_d(const void __user *addr, long *err); -extern unsigned long long __get_user_asm_l(const void __user *addr, long *err); - -#define __get_user_size(x, ptr, size, retval) \ -do { \ - retval = 0; \ - switch (size) { \ - case 1: \ - x = __get_user_asm_b(ptr, &retval); break; \ - case 2: \ - x = __get_user_asm_w(ptr, &retval); break; \ - case 4: \ - x = __get_user_asm_d(ptr, &retval); break; \ - case 8: \ - x = __get_user_asm_l(ptr, &retval); break; \ - default: \ - (x) = __get_user_bad(); \ - } \ -} while (0) - -/* - * Copy a null terminated string from userspace. - * - * Must return: - * -EFAULT for an exception - * count if we hit the buffer limit - * bytes copied if we hit a null byte - * (without the null byte) - */ - -extern long __must_check __strncpy_from_user(char *dst, const char __user *src, - long count); - -static inline long -strncpy_from_user(char *dst, const char __user *src, long count) -{ - if (!access_ok(VERIFY_READ, src, 1)) - return -EFAULT; - return __strncpy_from_user(dst, src, count); -} -/* - * Return the size of a string (including the ending 0) - * - * Return 0 on exception, a value greater than N if too long - */ -extern long __must_check strnlen_user(const char __user *src, long count); - -extern unsigned long raw_copy_from_user(void *to, const void __user *from, - unsigned long n); -extern unsigned long raw_copy_to_user(void __user *to, const void *from, - unsigned long n); - -/* - * Zero Userspace - */ - -extern unsigned long __must_check __do_clear_user(void __user *to, - unsigned long n); - -static inline unsigned long clear_user(void __user *to, unsigned long n) -{ - if (access_ok(VERIFY_WRITE, to, n)) - return __do_clear_user(to, n); - return n; -} - -#define __clear_user(to, n) __do_clear_user(to, n) - -#endif /* _METAG_UACCESS_H */ diff --git a/arch/metag/include/asm/unistd.h b/arch/metag/include/asm/unistd.h deleted file mode 100644 index 32955a18fb32a..0000000000000 --- a/arch/metag/include/asm/unistd.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright (C) 2012 Imagination Technologies Ltd. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -#include - -#define __ARCH_WANT_SYS_CLONE diff --git a/arch/metag/include/asm/user_gateway.h b/arch/metag/include/asm/user_gateway.h deleted file mode 100644 index cf2392b95a56e..0000000000000 --- a/arch/metag/include/asm/user_gateway.h +++ /dev/null @@ -1,45 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Copyright (C) 2010 Imagination Technologies - */ - -#ifndef __ASM_METAG_USER_GATEWAY_H -#define __ASM_METAG_USER_GATEWAY_H - -#include - -/* Page of kernel code accessible to userspace. */ -#define USER_GATEWAY_PAGE 0x6ffff000 -/* Offset of TLS pointer array in gateway page. */ -#define USER_GATEWAY_TLS 0x100 - -#ifndef __ASSEMBLY__ - -extern char __user_gateway_start; -extern char __user_gateway_end; - -/* Kernel mapping of the gateway page. */ -extern void *gateway_page; - -static inline void set_gateway_tls(void __user *tls_ptr) -{ - void **gateway_tls = (void **)(gateway_page + USER_GATEWAY_TLS + - hard_processor_id() * 4); - - *gateway_tls = (__force void *)tls_ptr; -#ifdef CONFIG_METAG_META12 - /* Avoid cache aliases on virtually tagged cache. */ - __builtin_dcache_flush((void *)USER_GATEWAY_PAGE + USER_GATEWAY_TLS + - hard_processor_id() * sizeof(void *)); -#endif -} - -extern int __kuser_get_tls(void); -extern char *__kuser_get_tls_end[]; - -extern int __kuser_cmpxchg(int, int, unsigned long *); -extern char *__kuser_cmpxchg_end[]; - -#endif - -#endif diff --git a/arch/metag/include/uapi/asm/Kbuild b/arch/metag/include/uapi/asm/Kbuild deleted file mode 100644 index f9eaf07d29f84..0000000000000 --- a/arch/metag/include/uapi/asm/Kbuild +++ /dev/null @@ -1,31 +0,0 @@ -# UAPI Header export list -include include/uapi/asm-generic/Kbuild.asm - -generic-y += auxvec.h -generic-y += bitsperlong.h -generic-y += bpf_perf_event.h -generic-y += errno.h -generic-y += fcntl.h -generic-y += ioctl.h -generic-y += ioctls.h -generic-y += ipcbuf.h -generic-y += kvm_para.h -generic-y += mman.h -generic-y += msgbuf.h -generic-y += param.h -generic-y += poll.h -generic-y += posix_types.h -generic-y += resource.h -generic-y += sembuf.h -generic-y += setup.h -generic-y += shmbuf.h -generic-y += shmparam.h -generic-y += signal.h -generic-y += socket.h -generic-y += sockios.h -generic-y += stat.h -generic-y += statfs.h -generic-y += termbits.h -generic-y += termios.h -generic-y += types.h -generic-y += ucontext.h diff --git a/arch/metag/include/uapi/asm/byteorder.h b/arch/metag/include/uapi/asm/byteorder.h deleted file mode 100644 index e5e03ff7e20d0..0000000000000 --- a/arch/metag/include/uapi/asm/byteorder.h +++ /dev/null @@ -1,2 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#include diff --git a/arch/metag/include/uapi/asm/ech.h b/arch/metag/include/uapi/asm/ech.h deleted file mode 100644 index 1e09f1ea4f7fd..0000000000000 --- a/arch/metag/include/uapi/asm/ech.h +++ /dev/null @@ -1,16 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _UAPI_METAG_ECH_H -#define _UAPI_METAG_ECH_H - -/* - * These bits can be set in the top half of the D0.8 register when DSP context - * switching is enabled, in order to support partial DSP context save/restore. - */ - -#define TBICTX_XEXT_BIT 0x1000 /* Enable extended context save */ -#define TBICTX_XTDP_BIT 0x0800 /* DSP accumulators/RAM/templates */ -#define TBICTX_XHL2_BIT 0x0400 /* Hardware loops */ -#define TBICTX_XAXX_BIT 0x0200 /* Extended AX registers (A*.4-7) */ -#define TBICTX_XDX8_BIT 0x0100 /* Extended DX registers (D*.8-15) */ - -#endif /* _UAPI_METAG_ECH_H */ diff --git a/arch/metag/include/uapi/asm/ptrace.h b/arch/metag/include/uapi/asm/ptrace.h deleted file mode 100644 index 8ad9daa841c39..0000000000000 --- a/arch/metag/include/uapi/asm/ptrace.h +++ /dev/null @@ -1,114 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _UAPI_METAG_PTRACE_H -#define _UAPI_METAG_PTRACE_H - -#ifndef __ASSEMBLY__ - -/* - * These are the layouts of the regsets returned by the GETREGSET ptrace call - */ - -/* user_gp_regs::status */ - -/* CBMarker bit (indicates catch state / catch replay) */ -#define USER_GP_REGS_STATUS_CATCH_BIT (1 << 22) -#define USER_GP_REGS_STATUS_CATCH_S 22 -/* LSM_STEP field (load/store multiple step) */ -#define USER_GP_REGS_STATUS_LSM_STEP_BITS (0x7 << 8) -#define USER_GP_REGS_STATUS_LSM_STEP_S 8 -/* SCC bit (indicates split 16x16 condition flags) */ -#define USER_GP_REGS_STATUS_SCC_BIT (1 << 4) -#define USER_GP_REGS_STATUS_SCC_S 4 - -/* normal condition flags */ -/* CF_Z bit (Zero flag) */ -#define USER_GP_REGS_STATUS_CF_Z_BIT (1 << 3) -#define USER_GP_REGS_STATUS_CF_Z_S 3 -/* CF_N bit (Negative flag) */ -#define USER_GP_REGS_STATUS_CF_N_BIT (1 << 2) -#define USER_GP_REGS_STATUS_CF_N_S 2 -/* CF_V bit (oVerflow flag) */ -#define USER_GP_REGS_STATUS_CF_V_BIT (1 << 1) -#define USER_GP_REGS_STATUS_CF_V_S 1 -/* CF_C bit (Carry flag) */ -#define USER_GP_REGS_STATUS_CF_C_BIT (1 << 0) -#define USER_GP_REGS_STATUS_CF_C_S 0 - -/* split 16x16 condition flags */ -/* SCF_LZ bit (Low Zero flag) */ -#define USER_GP_REGS_STATUS_SCF_LZ_BIT (1 << 3) -#define USER_GP_REGS_STATUS_SCF_LZ_S 3 -/* SCF_HZ bit (High Zero flag) */ -#define USER_GP_REGS_STATUS_SCF_HZ_BIT (1 << 2) -#define USER_GP_REGS_STATUS_SCF_HZ_S 2 -/* SCF_HC bit (High Carry flag) */ -#define USER_GP_REGS_STATUS_SCF_HC_BIT (1 << 1) -#define USER_GP_REGS_STATUS_SCF_HC_S 1 -/* SCF_LC bit (Low Carry flag) */ -#define USER_GP_REGS_STATUS_SCF_LC_BIT (1 << 0) -#define USER_GP_REGS_STATUS_SCF_LC_S 0 - -/** - * struct user_gp_regs - User general purpose registers - * @dx: GP data unit regs (dx[reg][unit] = D{unit:0-1}.{reg:0-7}) - * @ax: GP address unit regs (ax[reg][unit] = A{unit:0-1}.{reg:0-3}) - * @pc: PC register - * @status: TXSTATUS register (condition flags, LSM_STEP etc) - * @rpt: TXRPT registers (branch repeat counter) - * @bpobits: TXBPOBITS register ("branch prediction other" bits) - * @mode: TXMODE register - * @_pad1: Reserved padding to make sizeof obviously 64bit aligned - * - * This is the user-visible general purpose register state structure. - * - * It can be accessed through PTRACE_GETREGSET with NT_PRSTATUS. - * - * It is also used in the signal context. - */ -struct user_gp_regs { - unsigned long dx[8][2]; - unsigned long ax[4][2]; - unsigned long pc; - unsigned long status; - unsigned long rpt; - unsigned long bpobits; - unsigned long mode; - unsigned long _pad1; -}; - -/** - * struct user_cb_regs - User catch buffer registers - * @flags: TXCATCH0 register (fault flags) - * @addr: TXCATCH1 register (fault address) - * @data: TXCATCH2 and TXCATCH3 registers (low and high data word) - * - * This is the user-visible catch buffer register state structure containing - * information about a failed memory access, and allowing the access to be - * modified and replayed. - * - * It can be accessed through PTRACE_GETREGSET with NT_METAG_CBUF. - */ -struct user_cb_regs { - unsigned long flags; - unsigned long addr; - unsigned long long data; -}; - -/** - * struct user_rp_state - User read pipeline state - * @entries: Read pipeline entries - * @mask: Mask of valid pipeline entries (RPMask from TXDIVTIME register) - * - * This is the user-visible read pipeline state structure containing the entries - * currently in the read pipeline and the mask of valid entries. - * - * It can be accessed through PTRACE_GETREGSET with NT_METAG_RPIPE. - */ -struct user_rp_state { - unsigned long long entries[6]; - unsigned long mask; -}; - -#endif /* __ASSEMBLY__ */ - -#endif /* _UAPI_METAG_PTRACE_H */ diff --git a/arch/metag/include/uapi/asm/sigcontext.h b/arch/metag/include/uapi/asm/sigcontext.h deleted file mode 100644 index ac7e1f28d584c..0000000000000 --- a/arch/metag/include/uapi/asm/sigcontext.h +++ /dev/null @@ -1,32 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _ASM_METAG_SIGCONTEXT_H -#define _ASM_METAG_SIGCONTEXT_H - -#include - -/* - * In a sigcontext structure we need to store the active state of the - * user process so that it does not get trashed when we call the signal - * handler. That not really the same as a user context that we are - * going to store on syscall etc. - */ -struct sigcontext { - struct user_gp_regs regs; /* needs to be first */ - - /* - * Catch registers describing a memory fault. - * If USER_GP_REGS_STATUS_CATCH_BIT is set in regs.status then catch - * buffers have been saved and will be replayed on sigreturn. - * Clear that bit to discard the catch state instead of replaying it. - */ - struct user_cb_regs cb; - - /* - * Read pipeline state. This will get restored on sigreturn. - */ - struct user_rp_state rp; - - unsigned long oldmask; -}; - -#endif diff --git a/arch/metag/include/uapi/asm/siginfo.h b/arch/metag/include/uapi/asm/siginfo.h deleted file mode 100644 index 9a3f6cde94879..0000000000000 --- a/arch/metag/include/uapi/asm/siginfo.h +++ /dev/null @@ -1,16 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _METAG_SIGINFO_H -#define _METAG_SIGINFO_H - -#define __ARCH_SI_TRAPNO - -#include - -/* - * SIGFPE si_codes - */ -#ifdef __KERNEL__ -#define FPE_FIXME 0 /* Broken dup of SI_USER */ -#endif /* __KERNEL__ */ - -#endif diff --git a/arch/metag/include/uapi/asm/swab.h b/arch/metag/include/uapi/asm/swab.h deleted file mode 100644 index 30d696fcc2377..0000000000000 --- a/arch/metag/include/uapi/asm/swab.h +++ /dev/null @@ -1,27 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef __ASM_METAG_SWAB_H -#define __ASM_METAG_SWAB_H - -#include -#include -#include - -static inline __attribute_const__ __u16 __arch_swab16(__u16 x) -{ - return __builtin_metag_bswaps(x); -} -#define __arch_swab16 __arch_swab16 - -static inline __attribute_const__ __u32 __arch_swab32(__u32 x) -{ - return __builtin_metag_bswap(x); -} -#define __arch_swab32 __arch_swab32 - -static inline __attribute_const__ __u64 __arch_swab64(__u64 x) -{ - return __builtin_metag_bswapll(x); -} -#define __arch_swab64 __arch_swab64 - -#endif /* __ASM_METAG_SWAB_H */ diff --git a/arch/metag/include/uapi/asm/unistd.h b/arch/metag/include/uapi/asm/unistd.h deleted file mode 100644 index 9f72c4cfcfb5e..0000000000000 --- a/arch/metag/include/uapi/asm/unistd.h +++ /dev/null @@ -1,24 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ -/* - * Copyright (C) 2012 Imagination Technologies Ltd. - * - * 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. - */ - -#define __ARCH_WANT_RENAMEAT - -/* Use the standard ABI for syscalls. */ -#include - -/* metag-specific syscalls. */ -#define __NR_metag_setglobalbit (__NR_arch_specific_syscall + 1) -__SYSCALL(__NR_metag_setglobalbit, sys_metag_setglobalbit) -#define __NR_metag_set_fpu_flags (__NR_arch_specific_syscall + 2) -__SYSCALL(__NR_metag_set_fpu_flags, sys_metag_set_fpu_flags) -#define __NR_metag_set_tls (__NR_arch_specific_syscall + 3) -__SYSCALL(__NR_metag_set_tls, sys_metag_set_tls) -#define __NR_metag_get_tls (__NR_arch_specific_syscall + 4) -__SYSCALL(__NR_metag_get_tls, sys_metag_get_tls) diff --git a/arch/metag/kernel/.gitignore b/arch/metag/kernel/.gitignore deleted file mode 100644 index c5f676c3c224b..0000000000000 --- a/arch/metag/kernel/.gitignore +++ /dev/null @@ -1 +0,0 @@ -vmlinux.lds diff --git a/arch/metag/kernel/Makefile b/arch/metag/kernel/Makefile deleted file mode 100644 index 73441d8c0369e..0000000000000 --- a/arch/metag/kernel/Makefile +++ /dev/null @@ -1,40 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# -# Makefile for the Linux/Meta kernel. -# - -extra-y += head.o -extra-y += vmlinux.lds - -obj-y += cachepart.o -obj-y += clock.o -obj-y += core_reg.o -obj-y += devtree.o -obj-y += dma.o -obj-y += irq.o -obj-y += kick.o -obj-y += machines.o -obj-y += process.o -obj-y += ptrace.o -obj-y += setup.o -obj-y += signal.o -obj-y += stacktrace.o -obj-y += sys_metag.o -obj-y += tbiunexp.o -obj-y += time.o -obj-y += topology.o -obj-y += traps.o -obj-y += user_gateway.o - -obj-$(CONFIG_PERF_EVENTS) += perf/ - -obj-$(CONFIG_METAG_COREMEM) += coremem.o -obj-$(CONFIG_METAG_DA) += da.o -obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o -obj-$(CONFIG_FUNCTION_TRACER) += ftrace_stub.o -obj-$(CONFIG_MODULES) += metag_ksyms.o -obj-$(CONFIG_MODULES) += module.o -obj-$(CONFIG_PERF_EVENTS) += perf_callchain.o -obj-$(CONFIG_SMP) += smp.o -obj-$(CONFIG_METAG_SUSPEND_MEM) += suspend.o -obj-$(CONFIG_METAG_USER_TCM) += tcm.o diff --git a/arch/metag/kernel/asm-offsets.c b/arch/metag/kernel/asm-offsets.c deleted file mode 100644 index d9b348b99ff21..0000000000000 --- a/arch/metag/kernel/asm-offsets.c +++ /dev/null @@ -1,15 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * This program is used to generate definitions needed by - * assembly language modules. - * - */ - -#include -#include - -int main(void) -{ - DEFINE(THREAD_INFO_SIZE, sizeof(struct thread_info)); - return 0; -} diff --git a/arch/metag/kernel/cachepart.c b/arch/metag/kernel/cachepart.c deleted file mode 100644 index 6e0f8a80cc960..0000000000000 --- a/arch/metag/kernel/cachepart.c +++ /dev/null @@ -1,132 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Meta cache partition manipulation. - * - * Copyright 2010 Imagination Technologies Ltd. - */ - -#include -#include -#include -#include -#include -#include -#include - -#define SYSC_DCPART(n) (SYSC_DCPART0 + SYSC_xCPARTn_STRIDE * (n)) -#define SYSC_ICPART(n) (SYSC_ICPART0 + SYSC_xCPARTn_STRIDE * (n)) - -#define CACHE_ASSOCIATIVITY 4 /* 4 way set-associative */ -#define ICACHE 0 -#define DCACHE 1 - -/* The CORE_CONFIG2 register is not available on Meta 1 */ -#ifdef CONFIG_METAG_META21 -unsigned int get_dcache_size(void) -{ - unsigned int config2 = metag_in32(METAC_CORE_CONFIG2); - unsigned int sz = 0x1000 << ((config2 & METAC_CORECFG2_DCSZ_BITS) - >> METAC_CORECFG2_DCSZ_S); - if (config2 & METAC_CORECFG2_DCSMALL_BIT) - sz >>= 6; - return sz; -} - -unsigned int get_icache_size(void) -{ - unsigned int config2 = metag_in32(METAC_CORE_CONFIG2); - unsigned int sz = 0x1000 << ((config2 & METAC_CORE_C2ICSZ_BITS) - >> METAC_CORE_C2ICSZ_S); - if (config2 & METAC_CORECFG2_ICSMALL_BIT) - sz >>= 6; - return sz; -} - -unsigned int get_global_dcache_size(void) -{ - unsigned int cpart = metag_in32(SYSC_DCPART(hard_processor_id())); - unsigned int temp = cpart & SYSC_xCPARTG_AND_BITS; - return (get_dcache_size() * ((temp >> SYSC_xCPARTG_AND_S) + 1)) >> 4; -} - -unsigned int get_global_icache_size(void) -{ - unsigned int cpart = metag_in32(SYSC_ICPART(hard_processor_id())); - unsigned int temp = cpart & SYSC_xCPARTG_AND_BITS; - return (get_icache_size() * ((temp >> SYSC_xCPARTG_AND_S) + 1)) >> 4; -} - -static int get_thread_cache_size(unsigned int cache, int thread_id) -{ - unsigned int cache_size; - unsigned int t_cache_part; - unsigned int isEnabled; - unsigned int offset = 0; - isEnabled = (cache == DCACHE ? metag_in32(MMCU_DCACHE_CTRL_ADDR) & 0x1 : - metag_in32(MMCU_ICACHE_CTRL_ADDR) & 0x1); - if (!isEnabled) - return 0; -#if PAGE_OFFSET >= LINGLOBAL_BASE - /* Checking for global cache */ - cache_size = (cache == DCACHE ? get_global_dcache_size() : - get_global_icache_size()); - offset = 8; -#else - cache_size = (cache == DCACHE ? get_dcache_size() : - get_icache_size()); -#endif - t_cache_part = (cache == DCACHE ? - (metag_in32(SYSC_DCPART(thread_id)) >> offset) & 0xF : - (metag_in32(SYSC_ICPART(thread_id)) >> offset) & 0xF); - switch (t_cache_part) { - case 0xF: - return cache_size; - case 0x7: - return cache_size / 2; - case 0x3: - return cache_size / 4; - case 0x1: - return cache_size / 8; - case 0: - return cache_size / 16; - } - return -1; -} - -void check_for_cache_aliasing(int thread_id) -{ - int thread_cache_size; - unsigned int cache_type; - for (cache_type = ICACHE; cache_type <= DCACHE; cache_type++) { - thread_cache_size = - get_thread_cache_size(cache_type, thread_id); - if (thread_cache_size < 0) - pr_emerg("Can't read %s cache size\n", - cache_type ? "DCACHE" : "ICACHE"); - else if (thread_cache_size == 0) - /* Cache is off. No need to check for aliasing */ - continue; - if (thread_cache_size / CACHE_ASSOCIATIVITY > PAGE_SIZE) { - pr_emerg("Potential cache aliasing detected in %s on Thread %d\n", - cache_type ? "DCACHE" : "ICACHE", thread_id); - pr_warn("Total %s size: %u bytes\n", - cache_type ? "DCACHE" : "ICACHE", - cache_type ? get_dcache_size() - : get_icache_size()); - pr_warn("Thread %s size: %d bytes\n", - cache_type ? "CACHE" : "ICACHE", - thread_cache_size); - pr_warn("Page Size: %lu bytes\n", PAGE_SIZE); - panic("Potential cache aliasing detected"); - } - } -} - -#else - -void check_for_cache_aliasing(int thread_id) -{ - return; -} - -#endif diff --git a/arch/metag/kernel/clock.c b/arch/metag/kernel/clock.c deleted file mode 100644 index 6339c9c6d0abe..0000000000000 --- a/arch/metag/kernel/clock.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * arch/metag/kernel/clock.c - * - * Copyright (C) 2012 Imagination Technologies Ltd. - * - * 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 -#include -#include -#include - -#include -#include - -struct meta_clock_desc _meta_clock; - -/* Default machine get_core_freq callback. */ -static unsigned long get_core_freq_default(void) -{ -#ifdef CONFIG_METAG_META21 - /* - * Meta 2 cores divide down the core clock for the Meta timers, so we - * can estimate the core clock from the divider. - */ - return (metag_in32(EXPAND_TIMER_DIV) + 1) * 1000000; -#else - /* - * On Meta 1 we don't know the core clock, but assuming the Meta timer - * is correct it can be estimated based on loops_per_jiffy. - */ - return (loops_per_jiffy * HZ * 5) >> 1; -#endif -} - -static struct clk *clk_core; - -/* Clk based get_core_freq callback. */ -static unsigned long get_core_freq_clk(void) -{ - return clk_get_rate(clk_core); -} - -/** - * init_metag_core_clock() - Set up core clock from devicetree. - * - * Checks to see if a "core" clock is provided in the device tree, and overrides - * the get_core_freq callback to use it. - */ -static void __init init_metag_core_clock(void) -{ - /* - * See if a core clock is provided by the devicetree (and - * registered by the init callback above). - */ - struct device_node *node; - node = of_find_compatible_node(NULL, NULL, "img,meta"); - if (!node) { - pr_warn("%s: no compatible img,meta DT node found\n", - __func__); - return; - } - - clk_core = of_clk_get_by_name(node, "core"); - if (IS_ERR(clk_core)) { - pr_warn("%s: no core clock found in DT\n", - __func__); - return; - } - - /* - * Override the core frequency callback to use - * this clk. - */ - _meta_clock.get_core_freq = get_core_freq_clk; -} - -/** - * init_metag_clocks() - Set up clocks from devicetree. - * - * Set up important clocks from device tree. In particular any needed for clock - * sources. - */ -void __init init_metag_clocks(void) -{ - init_metag_core_clock(); - - pr_info("Core clock frequency: %lu Hz\n", get_coreclock()); -} - -/** - * setup_meta_clocks() - Early set up of the Meta clock. - * @desc: Clock descriptor usually provided by machine description - * - * Ensures all callbacks are valid. - */ -void __init setup_meta_clocks(struct meta_clock_desc *desc) -{ - /* copy callbacks */ - if (desc) - _meta_clock = *desc; - - /* set fallback functions */ - if (!_meta_clock.get_core_freq) - _meta_clock.get_core_freq = get_core_freq_default; -} - diff --git a/arch/metag/kernel/core_reg.c b/arch/metag/kernel/core_reg.c deleted file mode 100644 index df2833f2766fa..0000000000000 --- a/arch/metag/kernel/core_reg.c +++ /dev/null @@ -1,118 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Support for reading and writing Meta core internal registers. - * - * Copyright (C) 2011 Imagination Technologies Ltd. - * - */ - -#include -#include - -#include -#include -#include -#include -#include -#include - -#define UNIT_BIT_MASK TXUXXRXRQ_UXX_BITS -#define REG_BIT_MASK TXUXXRXRQ_RX_BITS -#define THREAD_BIT_MASK TXUXXRXRQ_TX_BITS - -#define UNIT_SHIFTS TXUXXRXRQ_UXX_S -#define REG_SHIFTS TXUXXRXRQ_RX_S -#define THREAD_SHIFTS TXUXXRXRQ_TX_S - -#define UNIT_VAL(x) (((x) << UNIT_SHIFTS) & UNIT_BIT_MASK) -#define REG_VAL(x) (((x) << REG_SHIFTS) & REG_BIT_MASK) -#define THREAD_VAL(x) (((x) << THREAD_SHIFTS) & THREAD_BIT_MASK) - -/* - * core_reg_write() - modify the content of a register in a core unit. - * @unit: The unit to be modified. - * @reg: Register number within the unit. - * @thread: The thread we want to access. - * @val: The new value to write. - * - * Check asm/metag_regs.h for a list/defines of supported units (ie: TXUPC_ID, - * TXUTR_ID, etc), and regnums within the units (ie: TXMASKI_REGNUM, - * TXPOLLI_REGNUM, etc). - */ -void core_reg_write(int unit, int reg, int thread, unsigned int val) -{ - unsigned long flags; - - /* TXUCT_ID has its own memory mapped registers */ - if (unit == TXUCT_ID) { - void __iomem *cu_reg = __CU_addr(thread, reg); - metag_out32(val, cu_reg); - return; - } - - __global_lock2(flags); - - /* wait for ready */ - while (!(metag_in32(TXUXXRXRQ) & TXUXXRXRQ_DREADY_BIT)) - udelay(10); - - /* set the value to write */ - metag_out32(val, TXUXXRXDT); - - /* set the register to write */ - val = UNIT_VAL(unit) | REG_VAL(reg) | THREAD_VAL(thread); - metag_out32(val, TXUXXRXRQ); - - /* wait for finish */ - while (!(metag_in32(TXUXXRXRQ) & TXUXXRXRQ_DREADY_BIT)) - udelay(10); - - __global_unlock2(flags); -} -EXPORT_SYMBOL(core_reg_write); - -/* - * core_reg_read() - read the content of a register in a core unit. - * @unit: The unit to be modified. - * @reg: Register number within the unit. - * @thread: The thread we want to access. - * - * Check asm/metag_regs.h for a list/defines of supported units (ie: TXUPC_ID, - * TXUTR_ID, etc), and regnums within the units (ie: TXMASKI_REGNUM, - * TXPOLLI_REGNUM, etc). - */ -unsigned int core_reg_read(int unit, int reg, int thread) -{ - unsigned long flags; - unsigned int val; - - /* TXUCT_ID has its own memory mapped registers */ - if (unit == TXUCT_ID) { - void __iomem *cu_reg = __CU_addr(thread, reg); - val = metag_in32(cu_reg); - return val; - } - - __global_lock2(flags); - - /* wait for ready */ - while (!(metag_in32(TXUXXRXRQ) & TXUXXRXRQ_DREADY_BIT)) - udelay(10); - - /* set the register to read */ - val = (UNIT_VAL(unit) | REG_VAL(reg) | THREAD_VAL(thread) | - TXUXXRXRQ_RDnWR_BIT); - metag_out32(val, TXUXXRXRQ); - - /* wait for finish */ - while (!(metag_in32(TXUXXRXRQ) & TXUXXRXRQ_DREADY_BIT)) - udelay(10); - - /* read the register value */ - val = metag_in32(TXUXXRXDT); - - __global_unlock2(flags); - - return val; -} -EXPORT_SYMBOL(core_reg_read); diff --git a/arch/metag/kernel/da.c b/arch/metag/kernel/da.c deleted file mode 100644 index a35dbed6fffab..0000000000000 --- a/arch/metag/kernel/da.c +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Meta DA JTAG debugger control. - * - * Copyright 2012 Imagination Technologies Ltd. - */ - - -#include -#include -#include -#include -#include - -bool _metag_da_present; -EXPORT_SYMBOL_GPL(_metag_da_present); - -int __init metag_da_probe(void) -{ - _metag_da_present = (metag_in32(T0VECINT_BHALT) == 1); - if (_metag_da_present) - pr_info("DA present\n"); - else - pr_info("DA not present\n"); - return 0; -} diff --git a/arch/metag/kernel/devtree.c b/arch/metag/kernel/devtree.c deleted file mode 100644 index 6af749a644382..0000000000000 --- a/arch/metag/kernel/devtree.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * linux/arch/metag/kernel/devtree.c - * - * Copyright (C) 2012 Imagination Technologies Ltd. - * - * Based on ARM version: - * Copyright (C) 2009 Canonical Ltd. - * - * 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 -#include -#include -#include - -#include -#include -#include - -static const void * __init arch_get_next_mach(const char *const **match) -{ - static const struct machine_desc *mdesc = __arch_info_begin; - const struct machine_desc *m = mdesc; - - if (m >= __arch_info_end) - return NULL; - - mdesc++; - *match = m->dt_compat; - return m; -} - -/** - * setup_machine_fdt - Machine setup when an dtb was passed to the kernel - * @dt: virtual address pointer to dt blob - * - * If a dtb was passed to the kernel, then use it to choose the correct - * machine_desc and to setup the system. - */ -const struct machine_desc * __init setup_machine_fdt(void *dt) -{ - const struct machine_desc *mdesc; - - /* check device tree validity */ - if (!early_init_dt_scan(dt)) - return NULL; - - mdesc = of_flat_dt_match_machine(NULL, arch_get_next_mach); - if (!mdesc) - dump_machine_table(); /* does not return */ - pr_info("Machine name: %s\n", mdesc->name); - - return mdesc; -} diff --git a/arch/metag/kernel/dma.c b/arch/metag/kernel/dma.c deleted file mode 100644 index f0ab3a4983285..0000000000000 --- a/arch/metag/kernel/dma.c +++ /dev/null @@ -1,588 +0,0 @@ -/* - * Meta version derived from arch/powerpc/lib/dma-noncoherent.c - * Copyright (C) 2008 Imagination Technologies Ltd. - * - * PowerPC version derived from arch/arm/mm/consistent.c - * Copyright (C) 2001 Dan Malek (dmalek@jlc.net) - * - * Copyright (C) 2000 Russell King - * - * Consistent memory allocators. Used for DMA devices that want to - * share uncached memory with the processor core. The function return - * is the virtual address and 'dma_handle' is the physical address. - * Mostly stolen from the ARM port, with some changes for PowerPC. - * -- Dan - * - * Reorganized to get rid of the arch-specific consistent_* functions - * and provide non-coherent implementations for the DMA API. -Matt - * - * Added in_interrupt() safe dma_alloc_coherent()/dma_free_coherent() - * implementation. This is pulled straight from ARM and barely - * modified. -Matt - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#define CONSISTENT_OFFSET(x) (((unsigned long)(x) - CONSISTENT_START) \ - >> PAGE_SHIFT) - -static u64 get_coherent_dma_mask(struct device *dev) -{ - u64 mask = ~0ULL; - - if (dev) { - mask = dev->coherent_dma_mask; - - /* - * Sanity check the DMA mask - it must be non-zero, and - * must be able to be satisfied by a DMA allocation. - */ - if (mask == 0) { - dev_warn(dev, "coherent DMA mask is unset\n"); - return 0; - } - } - - return mask; -} -/* - * This is the page table (2MB) covering uncached, DMA consistent allocations - */ -static pte_t *consistent_pte; -static DEFINE_SPINLOCK(consistent_lock); - -/* - * VM region handling support. - * - * This should become something generic, handling VM region allocations for - * vmalloc and similar (ioremap, module space, etc). - * - * I envisage vmalloc()'s supporting vm_struct becoming: - * - * struct vm_struct { - * struct metag_vm_region region; - * unsigned long flags; - * struct page **pages; - * unsigned int nr_pages; - * unsigned long phys_addr; - * }; - * - * get_vm_area() would then call metag_vm_region_alloc with an appropriate - * struct metag_vm_region head (eg): - * - * struct metag_vm_region vmalloc_head = { - * .vm_list = LIST_HEAD_INIT(vmalloc_head.vm_list), - * .vm_start = VMALLOC_START, - * .vm_end = VMALLOC_END, - * }; - * - * However, vmalloc_head.vm_start is variable (typically, it is dependent on - * the amount of RAM found at boot time.) I would imagine that get_vm_area() - * would have to initialise this each time prior to calling - * metag_vm_region_alloc(). - */ -struct metag_vm_region { - struct list_head vm_list; - unsigned long vm_start; - unsigned long vm_end; - struct page *vm_pages; - int vm_active; -}; - -static struct metag_vm_region consistent_head = { - .vm_list = LIST_HEAD_INIT(consistent_head.vm_list), - .vm_start = CONSISTENT_START, - .vm_end = CONSISTENT_END, -}; - -static struct metag_vm_region *metag_vm_region_alloc(struct metag_vm_region - *head, size_t size, - gfp_t gfp) -{ - unsigned long addr = head->vm_start, end = head->vm_end - size; - unsigned long flags; - struct metag_vm_region *c, *new; - - new = kmalloc(sizeof(struct metag_vm_region), gfp); - if (!new) - goto out; - - spin_lock_irqsave(&consistent_lock, flags); - - list_for_each_entry(c, &head->vm_list, vm_list) { - if ((addr + size) < addr) - goto nospc; - if ((addr + size) <= c->vm_start) - goto found; - addr = c->vm_end; - if (addr > end) - goto nospc; - } - -found: - /* - * Insert this entry _before_ the one we found. - */ - list_add_tail(&new->vm_list, &c->vm_list); - new->vm_start = addr; - new->vm_end = addr + size; - new->vm_active = 1; - - spin_unlock_irqrestore(&consistent_lock, flags); - return new; - -nospc: - spin_unlock_irqrestore(&consistent_lock, flags); - kfree(new); -out: - return NULL; -} - -static struct metag_vm_region *metag_vm_region_find(struct metag_vm_region - *head, unsigned long addr) -{ - struct metag_vm_region *c; - - list_for_each_entry(c, &head->vm_list, vm_list) { - if (c->vm_active && c->vm_start == addr) - goto out; - } - c = NULL; -out: - return c; -} - -/* - * Allocate DMA-coherent memory space and return both the kernel remapped - * virtual and bus address for that space. - */ -static void *metag_dma_alloc(struct device *dev, size_t size, - dma_addr_t *handle, gfp_t gfp, unsigned long attrs) -{ - struct page *page; - struct metag_vm_region *c; - unsigned long order; - u64 mask = get_coherent_dma_mask(dev); - u64 limit; - - if (!consistent_pte) { - pr_err("%s: not initialised\n", __func__); - dump_stack(); - return NULL; - } - - if (!mask) - goto no_page; - size = PAGE_ALIGN(size); - limit = (mask + 1) & ~mask; - if ((limit && size >= limit) - || size >= (CONSISTENT_END - CONSISTENT_START)) { - pr_warn("coherent allocation too big (requested %#x mask %#Lx)\n", - size, mask); - return NULL; - } - - order = get_order(size); - - if (mask != 0xffffffff) - gfp |= GFP_DMA; - - page = alloc_pages(gfp, order); - if (!page) - goto no_page; - - /* - * Invalidate any data that might be lurking in the - * kernel direct-mapped region for device DMA. - */ - { - void *kaddr = page_address(page); - memset(kaddr, 0, size); - flush_dcache_region(kaddr, size); - } - - /* - * Allocate a virtual address in the consistent mapping region. - */ - c = metag_vm_region_alloc(&consistent_head, size, - gfp & ~(__GFP_DMA | __GFP_HIGHMEM)); - if (c) { - unsigned long vaddr = c->vm_start; - pte_t *pte = consistent_pte + CONSISTENT_OFFSET(vaddr); - struct page *end = page + (1 << order); - - c->vm_pages = page; - split_page(page, order); - - /* - * Set the "dma handle" - */ - *handle = page_to_bus(page); - - do { - BUG_ON(!pte_none(*pte)); - - SetPageReserved(page); - set_pte_at(&init_mm, vaddr, - pte, mk_pte(page, - pgprot_writecombine - (PAGE_KERNEL))); - page++; - pte++; - vaddr += PAGE_SIZE; - } while (size -= PAGE_SIZE); - - /* - * Free the otherwise unused pages. - */ - while (page < end) { - __free_page(page); - page++; - } - - return (void *)c->vm_start; - } - - if (page) - __free_pages(page, order); -no_page: - return NULL; -} - -/* - * free a page as defined by the above mapping. - */ -static void metag_dma_free(struct device *dev, size_t size, void *vaddr, - dma_addr_t dma_handle, unsigned long attrs) -{ - struct metag_vm_region *c; - unsigned long flags, addr; - pte_t *ptep; - - size = PAGE_ALIGN(size); - - spin_lock_irqsave(&consistent_lock, flags); - - c = metag_vm_region_find(&consistent_head, (unsigned long)vaddr); - if (!c) - goto no_area; - - c->vm_active = 0; - if ((c->vm_end - c->vm_start) != size) { - pr_err("%s: freeing wrong coherent size (%ld != %d)\n", - __func__, c->vm_end - c->vm_start, size); - dump_stack(); - size = c->vm_end - c->vm_start; - } - - ptep = consistent_pte + CONSISTENT_OFFSET(c->vm_start); - addr = c->vm_start; - do { - pte_t pte = ptep_get_and_clear(&init_mm, addr, ptep); - unsigned long pfn; - - ptep++; - addr += PAGE_SIZE; - - if (!pte_none(pte) && pte_present(pte)) { - pfn = pte_pfn(pte); - - if (pfn_valid(pfn)) { - struct page *page = pfn_to_page(pfn); - __free_reserved_page(page); - continue; - } - } - - pr_crit("%s: bad page in kernel page table\n", - __func__); - } while (size -= PAGE_SIZE); - - flush_tlb_kernel_range(c->vm_start, c->vm_end); - - list_del(&c->vm_list); - - spin_unlock_irqrestore(&consistent_lock, flags); - - kfree(c); - return; - -no_area: - spin_unlock_irqrestore(&consistent_lock, flags); - pr_err("%s: trying to free invalid coherent area: %p\n", - __func__, vaddr); - dump_stack(); -} - -static int metag_dma_mmap(struct device *dev, struct vm_area_struct *vma, - void *cpu_addr, dma_addr_t dma_addr, size_t size, - unsigned long attrs) -{ - unsigned long flags, user_size, kern_size; - struct metag_vm_region *c; - int ret = -ENXIO; - - if (attrs & DMA_ATTR_WRITE_COMBINE) - vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot); - else - vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); - - user_size = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; - - spin_lock_irqsave(&consistent_lock, flags); - c = metag_vm_region_find(&consistent_head, (unsigned long)cpu_addr); - spin_unlock_irqrestore(&consistent_lock, flags); - - if (c) { - unsigned long off = vma->vm_pgoff; - - kern_size = (c->vm_end - c->vm_start) >> PAGE_SHIFT; - - if (off < kern_size && - user_size <= (kern_size - off)) { - ret = remap_pfn_range(vma, vma->vm_start, - page_to_pfn(c->vm_pages) + off, - user_size << PAGE_SHIFT, - vma->vm_page_prot); - } - } - - - return ret; -} - -/* - * Initialise the consistent memory allocation. - */ -static int __init dma_alloc_init(void) -{ - pgd_t *pgd, *pgd_k; - pud_t *pud, *pud_k; - pmd_t *pmd, *pmd_k; - pte_t *pte; - int ret = 0; - - do { - int offset = pgd_index(CONSISTENT_START); - pgd = pgd_offset(&init_mm, CONSISTENT_START); - pud = pud_alloc(&init_mm, pgd, CONSISTENT_START); - pmd = pmd_alloc(&init_mm, pud, CONSISTENT_START); - WARN_ON(!pmd_none(*pmd)); - - pte = pte_alloc_kernel(pmd, CONSISTENT_START); - if (!pte) { - pr_err("%s: no pte tables\n", __func__); - ret = -ENOMEM; - break; - } - - pgd_k = ((pgd_t *) mmu_get_base()) + offset; - pud_k = pud_offset(pgd_k, CONSISTENT_START); - pmd_k = pmd_offset(pud_k, CONSISTENT_START); - set_pmd(pmd_k, *pmd); - - consistent_pte = pte; - } while (0); - - return ret; -} -early_initcall(dma_alloc_init); - -/* - * make an area consistent to devices. - */ -static void dma_sync_for_device(void *vaddr, size_t size, int dma_direction) -{ - /* - * Ensure any writes get through the write combiner. This is necessary - * even with DMA_FROM_DEVICE, or the write may dirty the cache after - * we've invalidated it and get written back during the DMA. - */ - - barrier(); - - switch (dma_direction) { - case DMA_BIDIRECTIONAL: - /* - * Writeback to ensure the device can see our latest changes and - * so that we have no dirty lines, and invalidate the cache - * lines too in preparation for receiving the buffer back - * (dma_sync_for_cpu) later. - */ - flush_dcache_region(vaddr, size); - break; - case DMA_TO_DEVICE: - /* - * Writeback to ensure the device can see our latest changes. - * There's no need to invalidate as the device shouldn't write - * to the buffer. - */ - writeback_dcache_region(vaddr, size); - break; - case DMA_FROM_DEVICE: - /* - * Invalidate to ensure we have no dirty lines that could get - * written back during the DMA. It's also safe to flush - * (writeback) here if necessary. - */ - invalidate_dcache_region(vaddr, size); - break; - case DMA_NONE: - BUG(); - } - - wmb(); -} - -/* - * make an area consistent to the core. - */ -static void dma_sync_for_cpu(void *vaddr, size_t size, int dma_direction) -{ - /* - * Hardware L2 cache prefetch doesn't occur across 4K physical - * boundaries, however according to Documentation/DMA-API-HOWTO.txt - * kmalloc'd memory is DMA'able, so accesses in nearby memory could - * trigger a cache fill in the DMA buffer. - * - * This should never cause dirty lines, so a flush or invalidate should - * be safe to allow us to see data from the device. - */ - if (_meta_l2c_pf_is_enabled()) { - switch (dma_direction) { - case DMA_BIDIRECTIONAL: - case DMA_FROM_DEVICE: - invalidate_dcache_region(vaddr, size); - break; - case DMA_TO_DEVICE: - /* The device shouldn't have written to the buffer */ - break; - case DMA_NONE: - BUG(); - } - } - - rmb(); -} - -static dma_addr_t metag_dma_map_page(struct device *dev, struct page *page, - unsigned long offset, size_t size, - enum dma_data_direction direction, unsigned long attrs) -{ - if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC)) - dma_sync_for_device((void *)(page_to_phys(page) + offset), - size, direction); - return page_to_phys(page) + offset; -} - -static void metag_dma_unmap_page(struct device *dev, dma_addr_t dma_address, - size_t size, enum dma_data_direction direction, - unsigned long attrs) -{ - if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC)) - dma_sync_for_cpu(phys_to_virt(dma_address), size, direction); -} - -static int metag_dma_map_sg(struct device *dev, struct scatterlist *sglist, - int nents, enum dma_data_direction direction, - unsigned long attrs) -{ - struct scatterlist *sg; - int i; - - for_each_sg(sglist, sg, nents, i) { - BUG_ON(!sg_page(sg)); - - sg->dma_address = sg_phys(sg); - - if (attrs & DMA_ATTR_SKIP_CPU_SYNC) - continue; - - dma_sync_for_device(sg_virt(sg), sg->length, direction); - } - - return nents; -} - - -static void metag_dma_unmap_sg(struct device *dev, struct scatterlist *sglist, - int nhwentries, enum dma_data_direction direction, - unsigned long attrs) -{ - struct scatterlist *sg; - int i; - - for_each_sg(sglist, sg, nhwentries, i) { - BUG_ON(!sg_page(sg)); - - sg->dma_address = sg_phys(sg); - - if (attrs & DMA_ATTR_SKIP_CPU_SYNC) - continue; - - dma_sync_for_cpu(sg_virt(sg), sg->length, direction); - } -} - -static void metag_dma_sync_single_for_cpu(struct device *dev, - dma_addr_t dma_handle, size_t size, - enum dma_data_direction direction) -{ - dma_sync_for_cpu(phys_to_virt(dma_handle), size, direction); -} - -static void metag_dma_sync_single_for_device(struct device *dev, - dma_addr_t dma_handle, size_t size, - enum dma_data_direction direction) -{ - dma_sync_for_device(phys_to_virt(dma_handle), size, direction); -} - -static void metag_dma_sync_sg_for_cpu(struct device *dev, - struct scatterlist *sglist, int nelems, - enum dma_data_direction direction) -{ - int i; - struct scatterlist *sg; - - for_each_sg(sglist, sg, nelems, i) - dma_sync_for_cpu(sg_virt(sg), sg->length, direction); -} - -static void metag_dma_sync_sg_for_device(struct device *dev, - struct scatterlist *sglist, int nelems, - enum dma_data_direction direction) -{ - int i; - struct scatterlist *sg; - - for_each_sg(sglist, sg, nelems, i) - dma_sync_for_device(sg_virt(sg), sg->length, direction); -} - -const struct dma_map_ops metag_dma_ops = { - .alloc = metag_dma_alloc, - .free = metag_dma_free, - .map_page = metag_dma_map_page, - .map_sg = metag_dma_map_sg, - .sync_single_for_device = metag_dma_sync_single_for_device, - .sync_single_for_cpu = metag_dma_sync_single_for_cpu, - .sync_sg_for_cpu = metag_dma_sync_sg_for_cpu, - .mmap = metag_dma_mmap, -}; -EXPORT_SYMBOL(metag_dma_ops); diff --git a/arch/metag/kernel/ftrace.c b/arch/metag/kernel/ftrace.c deleted file mode 100644 index f7b23d300881b..0000000000000 --- a/arch/metag/kernel/ftrace.c +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (C) 2008 Imagination Technologies Ltd. - * Licensed under the GPL - * - * Dynamic ftrace support. - */ - -#include -#include -#include - -#include - -#define D04_MOVT_TEMPLATE 0x02200005 -#define D04_CALL_TEMPLATE 0xAC200005 -#define D1RTP_MOVT_TEMPLATE 0x03200005 -#define D1RTP_CALL_TEMPLATE 0xAC200006 - -static const unsigned long NOP[2] = {0xa0fffffe, 0xa0fffffe}; -static unsigned long movt_and_call_insn[2]; - -static unsigned char *ftrace_nop_replace(void) -{ - return (char *)&NOP[0]; -} - -static unsigned char *ftrace_call_replace(unsigned long pc, unsigned long addr) -{ - unsigned long hi16, low16; - - hi16 = (addr & 0xffff0000) >> 13; - low16 = (addr & 0x0000ffff) << 3; - - /* - * The compiler makes the call to mcount_wrapper() - * (Meta's wrapper around mcount()) through the register - * D0.4. So whenever we're patching one of those compiler-generated - * calls we also need to go through D0.4. Otherwise use D1RtP. - */ - if (pc == (unsigned long)&ftrace_call) { - writel(D1RTP_MOVT_TEMPLATE | hi16, &movt_and_call_insn[0]); - writel(D1RTP_CALL_TEMPLATE | low16, &movt_and_call_insn[1]); - } else { - writel(D04_MOVT_TEMPLATE | hi16, &movt_and_call_insn[0]); - writel(D04_CALL_TEMPLATE | low16, &movt_and_call_insn[1]); - } - - return (unsigned char *)&movt_and_call_insn[0]; -} - -static int ftrace_modify_code(unsigned long pc, unsigned char *old_code, - unsigned char *new_code) -{ - unsigned char replaced[MCOUNT_INSN_SIZE]; - - /* - * Note: - * We are paranoid about modifying text, as if a bug was to happen, it - * could cause us to read or write to someplace that could cause harm. - * Carefully read and modify the code with probe_kernel_*(), and make - * sure what we read is what we expected it to be before modifying it. - */ - - /* read the text we want to modify */ - if (probe_kernel_read(replaced, (void *)pc, MCOUNT_INSN_SIZE)) - return -EFAULT; - - /* Make sure it is what we expect it to be */ - if (memcmp(replaced, old_code, MCOUNT_INSN_SIZE) != 0) - return -EINVAL; - - /* replace the text with the new text */ - if (probe_kernel_write((void *)pc, new_code, MCOUNT_INSN_SIZE)) - return -EPERM; - - flush_icache_range(pc, pc + MCOUNT_INSN_SIZE); - - return 0; -} - -int ftrace_update_ftrace_func(ftrace_func_t func) -{ - int ret; - unsigned long pc; - unsigned char old[MCOUNT_INSN_SIZE], *new; - - pc = (unsigned long)&ftrace_call; - memcpy(old, &ftrace_call, MCOUNT_INSN_SIZE); - new = ftrace_call_replace(pc, (unsigned long)func); - ret = ftrace_modify_code(pc, old, new); - - return ret; -} - -int ftrace_make_nop(struct module *mod, - struct dyn_ftrace *rec, unsigned long addr) -{ - unsigned char *new, *old; - unsigned long ip = rec->ip; - - old = ftrace_call_replace(ip, addr); - new = ftrace_nop_replace(); - - return ftrace_modify_code(ip, old, new); -} - -int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) -{ - unsigned char *new, *old; - unsigned long ip = rec->ip; - - old = ftrace_nop_replace(); - new = ftrace_call_replace(ip, addr); - - return ftrace_modify_code(ip, old, new); -} - -int __init ftrace_dyn_arch_init(void) -{ - return 0; -} diff --git a/arch/metag/kernel/ftrace_stub.S b/arch/metag/kernel/ftrace_stub.S deleted file mode 100644 index 3acc288217c02..0000000000000 --- a/arch/metag/kernel/ftrace_stub.S +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2008 Imagination Technologies Ltd. - * Licensed under the GPL - * - */ - -#include - - .text -#ifdef CONFIG_DYNAMIC_FTRACE - .global _mcount_wrapper - .type _mcount_wrapper,function -_mcount_wrapper: - MOV PC,D0.4 - - .global _ftrace_caller - .type _ftrace_caller,function -_ftrace_caller: - MSETL [A0StP], D0Ar6, D0Ar4, D0Ar2, D0.4 - MOV D1Ar1, D0.4 - MOV D0Ar2, D1RtP - SUB D1Ar1,D1Ar1,#MCOUNT_INSN_SIZE - - .global _ftrace_call -_ftrace_call: - MOVT D1RtP,#HI(_ftrace_stub) - CALL D1RtP,#LO(_ftrace_stub) - GETL D0.4, D1RtP, [A0StP++#(-8)] - GETL D0Ar2, D1Ar1, [A0StP++#(-8)] - GETL D0Ar4, D1Ar3, [A0StP++#(-8)] - GETL D0Ar6, D1Ar5, [A0StP++#(-8)] - MOV PC, D0.4 -#else - - .global _mcount_wrapper - .type _mcount_wrapper,function -_mcount_wrapper: - MSETL [A0StP], D0Ar6, D0Ar4, D0Ar2, D0.4 - MOV D1Ar1, D0.4 - MOV D0Ar2, D1RtP - MOVT D0Re0,#HI(_ftrace_trace_function) - ADD D0Re0,D0Re0,#LO(_ftrace_trace_function) - GET D1Ar3,[D0Re0] - MOVT D1Re0,#HI(_ftrace_stub) - ADD D1Re0,D1Re0,#LO(_ftrace_stub) - CMP D1Ar3,D1Re0 - BEQ $Ltrace_exit - MOV D1RtP,D1Ar3 - SUB D1Ar1,D1Ar1,#MCOUNT_INSN_SIZE - SWAP PC,D1RtP -$Ltrace_exit: - GETL D0.4, D1RtP, [A0StP++#(-8)] - GETL D0Ar2, D1Ar1, [A0StP++#(-8)] - GETL D0Ar4, D1Ar3, [A0StP++#(-8)] - GETL D0Ar6, D1Ar5, [A0StP++#(-8)] - MOV PC, D0.4 - -#endif /* CONFIG_DYNAMIC_FTRACE */ - - .global _ftrace_stub -_ftrace_stub: - MOV PC,D1RtP diff --git a/arch/metag/kernel/head.S b/arch/metag/kernel/head.S deleted file mode 100644 index 3ed27813413e0..0000000000000 --- a/arch/metag/kernel/head.S +++ /dev/null @@ -1,66 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ - ! Copyright 2005,2006,2007,2009 Imagination Technologies - -#include -#include -#include -#undef __exit - - __HEAD - ! Setup the stack and get going into _metag_start_kernel - .global __start - .type __start,function -__start: - ! D1Ar1 contains pTBI (ISTAT) - ! D0Ar2 contains pTBI - ! D1Ar3 contains __pTBISegs - ! D0Ar4 contains kernel arglist pointer - - MOVT D0Re0,#HI(___pTBIs) - ADD D0Re0,D0Re0,#LO(___pTBIs) - SETL [D0Re0],D0Ar2,D1Ar1 - MOVT D0Re0,#HI(___pTBISegs) - ADD D0Re0,D0Re0,#LO(___pTBISegs) - SETD [D0Re0],D1Ar3 - MOV A0FrP,#0 - MOV D0Re0,#0 - MOV D1Re0,#0 - MOV D1Ar3,#0 - MOV D1Ar1,D0Ar4 !Store kernel boot params - MOV D1Ar5,#0 - MOV D0Ar6,#0 -#ifdef CONFIG_METAG_DSP - MOV D0.8,#0 -#endif - MOVT A0StP,#HI(_init_thread_union) - ADD A0StP,A0StP,#LO(_init_thread_union) - ADD A0StP,A0StP,#THREAD_INFO_SIZE - MOVT D1RtP,#HI(_metag_start_kernel) - CALL D1RtP,#LO(_metag_start_kernel) - .size __start,.-__start - - !! Needed by TBX - .global __exit - .type __exit,function -__exit: - XOR TXENABLE,D0Re0,D0Re0 - .size __exit,.-__exit - -#ifdef CONFIG_SMP - .global _secondary_startup - .type _secondary_startup,function -_secondary_startup: -#if CONFIG_PAGE_OFFSET < LINGLOBAL_BASE - ! In case GCOn has just been turned on we need to fence any writes that - ! the boot thread might have performed prior to coherency taking effect. - MOVT D0Re0,#HI(LINSYSEVENT_WR_ATOMIC_UNLOCK) - MOV D1Re0,#0 - SETD [D0Re0], D1Re0 -#endif - MOVT A0StP,#HI(_secondary_data_stack) - ADD A0StP,A0StP,#LO(_secondary_data_stack) - GETD A0StP,[A0StP] - ADD A0StP,A0StP,#THREAD_INFO_SIZE - B _secondary_start_kernel - .size _secondary_startup,.-_secondary_startup -#endif diff --git a/arch/metag/kernel/irq.c b/arch/metag/kernel/irq.c deleted file mode 100644 index 704cf17f8370e..0000000000000 --- a/arch/metag/kernel/irq.c +++ /dev/null @@ -1,293 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Linux/Meta general interrupt handling code - * - */ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#ifdef CONFIG_4KSTACKS -union irq_ctx { - struct thread_info tinfo; - u32 stack[THREAD_SIZE/sizeof(u32)]; -}; - -static union irq_ctx *hardirq_ctx[NR_CPUS] __read_mostly; -static union irq_ctx *softirq_ctx[NR_CPUS] __read_mostly; -#endif - -static struct irq_domain *root_domain; - -static unsigned int startup_meta_irq(struct irq_data *data) -{ - tbi_startup_interrupt(data->hwirq); - return 0; -} - -static void shutdown_meta_irq(struct irq_data *data) -{ - tbi_shutdown_interrupt(data->hwirq); -} - -void do_IRQ(int irq, struct pt_regs *regs) -{ - struct pt_regs *old_regs = set_irq_regs(regs); -#ifdef CONFIG_4KSTACKS - struct irq_desc *desc; - union irq_ctx *curctx, *irqctx; - u32 *isp; -#endif - - irq_enter(); - - irq = irq_linear_revmap(root_domain, irq); - -#ifdef CONFIG_DEBUG_STACKOVERFLOW - /* Debugging check for stack overflow: is there less than 1KB free? */ - { - unsigned long sp; - - sp = __core_reg_get(A0StP); - sp &= THREAD_SIZE - 1; - - if (unlikely(sp > (THREAD_SIZE - 1024))) - pr_err("Stack overflow in do_IRQ: %ld\n", sp); - } -#endif - - -#ifdef CONFIG_4KSTACKS - curctx = (union irq_ctx *) current_thread_info(); - irqctx = hardirq_ctx[smp_processor_id()]; - - /* - * this is where we switch to the IRQ stack. However, if we are - * already using the IRQ stack (because we interrupted a hardirq - * handler) we can't do that and just have to keep using the - * current stack (which is the irq stack already after all) - */ - if (curctx != irqctx) { - /* build the stack frame on the IRQ stack */ - isp = (u32 *) ((char *)irqctx + sizeof(struct thread_info)); - irqctx->tinfo.task = curctx->tinfo.task; - - /* - * Copy the softirq bits in preempt_count so that the - * softirq checks work in the hardirq context. - */ - irqctx->tinfo.preempt_count = - (irqctx->tinfo.preempt_count & ~SOFTIRQ_MASK) | - (curctx->tinfo.preempt_count & SOFTIRQ_MASK); - - desc = irq_to_desc(irq); - - asm volatile ( - "MOV D0.5,%0\n" - "MOV D1Ar1,%1\n" - "MOV D1RtP,%2\n" - "SWAP A0StP,D0.5\n" - "SWAP PC,D1RtP\n" - "MOV A0StP,D0.5\n" - : - : "r" (isp), "r" (desc), "r" (desc->handle_irq) - : "memory", "cc", "D1Ar1", "D0Ar2", "D1Ar3", "D0Ar4", - "D1Ar5", "D0Ar6", "D0Re0", "D1Re0", "D0.4", "D1RtP", - "D0.5" - ); - } else -#endif - generic_handle_irq(irq); - - irq_exit(); - - set_irq_regs(old_regs); -} - -#ifdef CONFIG_4KSTACKS - -static char softirq_stack[NR_CPUS * THREAD_SIZE] __page_aligned_bss; - -static char hardirq_stack[NR_CPUS * THREAD_SIZE] __page_aligned_bss; - -/* - * allocate per-cpu stacks for hardirq and for softirq processing - */ -void irq_ctx_init(int cpu) -{ - union irq_ctx *irqctx; - - if (hardirq_ctx[cpu]) - return; - - irqctx = (union irq_ctx *) &hardirq_stack[cpu * THREAD_SIZE]; - irqctx->tinfo.task = NULL; - irqctx->tinfo.cpu = cpu; - irqctx->tinfo.preempt_count = HARDIRQ_OFFSET; - irqctx->tinfo.addr_limit = MAKE_MM_SEG(0); - - hardirq_ctx[cpu] = irqctx; - - irqctx = (union irq_ctx *) &softirq_stack[cpu * THREAD_SIZE]; - irqctx->tinfo.task = NULL; - irqctx->tinfo.cpu = cpu; - irqctx->tinfo.preempt_count = 0; - irqctx->tinfo.addr_limit = MAKE_MM_SEG(0); - - softirq_ctx[cpu] = irqctx; - - pr_info("CPU %u irqstacks, hard=%p soft=%p\n", - cpu, hardirq_ctx[cpu], softirq_ctx[cpu]); -} - -void irq_ctx_exit(int cpu) -{ - hardirq_ctx[smp_processor_id()] = NULL; -} - -extern asmlinkage void __do_softirq(void); - -void do_softirq_own_stack(void) -{ - struct thread_info *curctx; - union irq_ctx *irqctx; - u32 *isp; - - curctx = current_thread_info(); - irqctx = softirq_ctx[smp_processor_id()]; - irqctx->tinfo.task = curctx->task; - - /* build the stack frame on the softirq stack */ - isp = (u32 *) ((char *)irqctx + sizeof(struct thread_info)); - - asm volatile ( - "MOV D0.5,%0\n" - "SWAP A0StP,D0.5\n" - "CALLR D1RtP,___do_softirq\n" - "MOV A0StP,D0.5\n" - : - : "r" (isp) - : "memory", "cc", "D1Ar1", "D0Ar2", "D1Ar3", "D0Ar4", - "D1Ar5", "D0Ar6", "D0Re0", "D1Re0", "D0.4", "D1RtP", - "D0.5" - ); -} -#endif - -static struct irq_chip meta_irq_type = { - .name = "META-IRQ", - .irq_startup = startup_meta_irq, - .irq_shutdown = shutdown_meta_irq, -}; - -/** - * tbisig_map() - Map a TBI signal number to a virtual IRQ number. - * @hw: Number of the TBI signal. Must be in range. - * - * Returns: The virtual IRQ number of the TBI signal number IRQ specified by - * @hw. - */ -int tbisig_map(unsigned int hw) -{ - return irq_create_mapping(root_domain, hw); -} - -/** - * metag_tbisig_map() - map a tbi signal to a Linux virtual IRQ number - * @d: root irq domain - * @irq: virtual irq number - * @hw: hardware irq number (TBI signal number) - * - * This sets up a virtual irq for a specified TBI signal number. - */ -static int metag_tbisig_map(struct irq_domain *d, unsigned int irq, - irq_hw_number_t hw) -{ -#ifdef CONFIG_SMP - irq_set_chip_and_handler(irq, &meta_irq_type, handle_percpu_irq); -#else - irq_set_chip_and_handler(irq, &meta_irq_type, handle_simple_irq); -#endif - return 0; -} - -static const struct irq_domain_ops metag_tbisig_domain_ops = { - .map = metag_tbisig_map, -}; - -/* - * void init_IRQ(void) - * - * Parameters: None - * - * Returns: Nothing - * - * This function should be called during kernel startup to initialize - * the IRQ handling routines. - */ -void __init init_IRQ(void) -{ - root_domain = irq_domain_add_linear(NULL, 32, - &metag_tbisig_domain_ops, NULL); - if (unlikely(!root_domain)) - panic("init_IRQ: cannot add root IRQ domain"); - - irq_ctx_init(smp_processor_id()); - - init_internal_IRQ(); - init_external_IRQ(); - - if (machine_desc->init_irq) - machine_desc->init_irq(); -} - -int __init arch_probe_nr_irqs(void) -{ - if (machine_desc->nr_irqs) - nr_irqs = machine_desc->nr_irqs; - return 0; -} - -#ifdef CONFIG_HOTPLUG_CPU -/* - * The CPU has been marked offline. Migrate IRQs off this CPU. If - * the affinity settings do not allow other CPUs, force them onto any - * available CPU. - */ -void migrate_irqs(void) -{ - unsigned int i, cpu = smp_processor_id(); - - for_each_active_irq(i) { - struct irq_data *data = irq_get_irq_data(i); - struct cpumask *mask; - unsigned int newcpu; - - if (irqd_is_per_cpu(data)) - continue; - - mask = irq_data_get_affinity_mask(data); - if (!cpumask_test_cpu(cpu, mask)) - continue; - - newcpu = cpumask_any_and(mask, cpu_online_mask); - - if (newcpu >= nr_cpu_ids) { - pr_info_ratelimited("IRQ%u no longer affine to CPU%u\n", - i, cpu); - - cpumask_setall(mask); - } - irq_set_affinity(i, mask); - } -} -#endif /* CONFIG_HOTPLUG_CPU */ diff --git a/arch/metag/kernel/kick.c b/arch/metag/kernel/kick.c deleted file mode 100644 index beb3776213222..0000000000000 --- a/arch/metag/kernel/kick.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (C) 2009 Imagination Technologies - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file COPYING in the main directory of this archive - * for more details. - * - * The Meta KICK interrupt mechanism is generally a useful feature, so - * we provide an interface for registering multiple interrupt - * handlers. All the registered interrupt handlers are "chained". When - * a KICK interrupt is received the first function in the list is - * called. If that interrupt handler cannot handle the KICK the next - * one is called, then the next until someone handles it (or we run - * out of functions). As soon as one function handles the interrupt no - * other handlers are called. - * - * The only downside of chaining interrupt handlers is that each - * handler must be able to detect whether the KICK was intended for it - * or not. For example, when the IPI handler runs and it sees that - * there are no IPI messages it must not signal that the KICK was - * handled, thereby giving the other handlers a chance to run. - * - * The reason that we provide our own interface for calling KICK - * handlers instead of using the generic kernel infrastructure is that - * the KICK handlers require access to a CPU's pTBI structure. So we - * pass it as an argument. - */ -#include -#include -#include -#include -#include -#include - -#include - -/* - * All accesses/manipulations of kick_handlers_list should be - * performed while holding kick_handlers_lock. - */ -static DEFINE_SPINLOCK(kick_handlers_lock); -static LIST_HEAD(kick_handlers_list); - -void kick_register_func(struct kick_irq_handler *kh) -{ - unsigned long flags; - - spin_lock_irqsave(&kick_handlers_lock, flags); - - list_add_tail(&kh->list, &kick_handlers_list); - - spin_unlock_irqrestore(&kick_handlers_lock, flags); -} -EXPORT_SYMBOL(kick_register_func); - -void kick_unregister_func(struct kick_irq_handler *kh) -{ - unsigned long flags; - - spin_lock_irqsave(&kick_handlers_lock, flags); - - list_del(&kh->list); - - spin_unlock_irqrestore(&kick_handlers_lock, flags); -} -EXPORT_SYMBOL(kick_unregister_func); - -TBIRES -kick_handler(TBIRES State, int SigNum, int Triggers, int Inst, PTBI pTBI) -{ - struct pt_regs *old_regs; - struct kick_irq_handler *kh; - struct list_head *lh; - int handled = 0; - TBIRES ret; - - head_end(State, ~INTS_OFF_MASK); - - /* If we interrupted user code handle any critical sections. */ - if (State.Sig.SaveMask & TBICTX_PRIV_BIT) - restart_critical_section(State); - - trace_hardirqs_off(); - - old_regs = set_irq_regs((struct pt_regs *)State.Sig.pCtx); - irq_enter(); - - /* - * There is no need to disable interrupts here because we - * can't nest KICK interrupts in a KICK interrupt handler. - */ - spin_lock(&kick_handlers_lock); - - list_for_each(lh, &kick_handlers_list) { - kh = list_entry(lh, struct kick_irq_handler, list); - - ret = kh->func(State, SigNum, Triggers, Inst, pTBI, &handled); - if (handled) - break; - } - - spin_unlock(&kick_handlers_lock); - - WARN_ON(!handled); - - irq_exit(); - set_irq_regs(old_regs); - - return tail_end(ret); -} diff --git a/arch/metag/kernel/machines.c b/arch/metag/kernel/machines.c deleted file mode 100644 index e49790181051d..0000000000000 --- a/arch/metag/kernel/machines.c +++ /dev/null @@ -1,21 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * arch/metag/kernel/machines.c - * - * Copyright (C) 2012 Imagination Technologies Ltd. - * - * Generic Meta Boards. - */ - -#include -#include -#include - -static const char *meta_boards_compat[] __initdata = { - "img,meta", - NULL, -}; - -MACHINE_START(META, "Generic Meta") - .dt_compat = meta_boards_compat, -MACHINE_END diff --git a/arch/metag/kernel/metag_ksyms.c b/arch/metag/kernel/metag_ksyms.c deleted file mode 100644 index e312386efb72f..0000000000000 --- a/arch/metag/kernel/metag_ksyms.c +++ /dev/null @@ -1,55 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#include -#include - -#include -#include -#include -#include -#include -#include - -EXPORT_SYMBOL(clear_page); -EXPORT_SYMBOL(copy_page); - -#ifdef CONFIG_FLATMEM -/* needed for the pfn_valid macro */ -EXPORT_SYMBOL(max_pfn); -EXPORT_SYMBOL(min_low_pfn); -#endif - -/* Network checksum functions */ -EXPORT_SYMBOL(csum_partial); - -/* TBI symbols */ -EXPORT_SYMBOL(__TBI); -EXPORT_SYMBOL(__TBIFindSeg); -EXPORT_SYMBOL(__TBIPoll); -EXPORT_SYMBOL(__TBITimeStamp); - -#define DECLARE_EXPORT(name) extern void name(void); EXPORT_SYMBOL(name) - -/* libgcc functions */ -DECLARE_EXPORT(__ashldi3); -DECLARE_EXPORT(__ashrdi3); -DECLARE_EXPORT(__lshrdi3); -DECLARE_EXPORT(__udivsi3); -DECLARE_EXPORT(__divsi3); -DECLARE_EXPORT(__umodsi3); -DECLARE_EXPORT(__modsi3); -DECLARE_EXPORT(__muldi3); -DECLARE_EXPORT(__cmpdi2); -DECLARE_EXPORT(__ucmpdi2); - -/* Maths functions */ -EXPORT_SYMBOL(div_u64); -EXPORT_SYMBOL(div_s64); - -/* String functions */ -EXPORT_SYMBOL(memcpy); -EXPORT_SYMBOL(memset); -EXPORT_SYMBOL(memmove); - -#ifdef CONFIG_FUNCTION_TRACER -EXPORT_SYMBOL(mcount_wrapper); -#endif diff --git a/arch/metag/kernel/module.c b/arch/metag/kernel/module.c deleted file mode 100644 index bb8dfba9a763c..0000000000000 --- a/arch/metag/kernel/module.c +++ /dev/null @@ -1,284 +0,0 @@ -/* Kernel module help for Meta. - - 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. -*/ -#include -#include -#include -#include -#include -#include -#include - -#include - -/* Count how many different relocations (different symbol, different - addend) */ -static unsigned int count_relocs(const Elf32_Rela *rela, unsigned int num) -{ - unsigned int i, r_info, r_addend, _count_relocs; - - _count_relocs = 0; - r_info = 0; - r_addend = 0; - for (i = 0; i < num; i++) - /* Only count relbranch relocs, others don't need stubs */ - if (ELF32_R_TYPE(rela[i].r_info) == R_METAG_RELBRANCH && - (r_info != ELF32_R_SYM(rela[i].r_info) || - r_addend != rela[i].r_addend)) { - _count_relocs++; - r_info = ELF32_R_SYM(rela[i].r_info); - r_addend = rela[i].r_addend; - } - - return _count_relocs; -} - -static int relacmp(const void *_x, const void *_y) -{ - const Elf32_Rela *x, *y; - - y = (Elf32_Rela *)_x; - x = (Elf32_Rela *)_y; - - /* Compare the entire r_info (as opposed to ELF32_R_SYM(r_info) only) to - * make the comparison cheaper/faster. It won't affect the sorting or - * the counting algorithms' performance - */ - if (x->r_info < y->r_info) - return -1; - else if (x->r_info > y->r_info) - return 1; - else if (x->r_addend < y->r_addend) - return -1; - else if (x->r_addend > y->r_addend) - return 1; - else - return 0; -} - -static void relaswap(void *_x, void *_y, int size) -{ - uint32_t *x, *y, tmp; - int i; - - y = (uint32_t *)_x; - x = (uint32_t *)_y; - - for (i = 0; i < sizeof(Elf32_Rela) / sizeof(uint32_t); i++) { - tmp = x[i]; - x[i] = y[i]; - y[i] = tmp; - } -} - -/* Get the potential trampolines size required of the init and - non-init sections */ -static unsigned long get_plt_size(const Elf32_Ehdr *hdr, - const Elf32_Shdr *sechdrs, - const char *secstrings, - int is_init) -{ - unsigned long ret = 0; - unsigned i; - - /* Everything marked ALLOC (this includes the exported - symbols) */ - for (i = 1; i < hdr->e_shnum; i++) { - /* If it's called *.init*, and we're not init, we're - not interested */ - if ((strstr(secstrings + sechdrs[i].sh_name, ".init") != NULL) - != is_init) - continue; - - /* We don't want to look at debug sections. */ - if (strstr(secstrings + sechdrs[i].sh_name, ".debug") != NULL) - continue; - - if (sechdrs[i].sh_type == SHT_RELA) { - pr_debug("Found relocations in section %u\n", i); - pr_debug("Ptr: %p. Number: %u\n", - (void *)hdr + sechdrs[i].sh_offset, - sechdrs[i].sh_size / sizeof(Elf32_Rela)); - - /* Sort the relocation information based on a symbol and - * addend key. This is a stable O(n*log n) complexity - * alogrithm but it will reduce the complexity of - * count_relocs() to linear complexity O(n) - */ - sort((void *)hdr + sechdrs[i].sh_offset, - sechdrs[i].sh_size / sizeof(Elf32_Rela), - sizeof(Elf32_Rela), relacmp, relaswap); - - ret += count_relocs((void *)hdr - + sechdrs[i].sh_offset, - sechdrs[i].sh_size - / sizeof(Elf32_Rela)) - * sizeof(struct metag_plt_entry); - } - } - - return ret; -} - -int module_frob_arch_sections(Elf32_Ehdr *hdr, - Elf32_Shdr *sechdrs, - char *secstrings, - struct module *me) -{ - unsigned int i; - - /* Find .plt and .init.plt sections */ - for (i = 0; i < hdr->e_shnum; i++) { - if (strcmp(secstrings + sechdrs[i].sh_name, ".init.plt") == 0) - me->arch.init_plt_section = i; - else if (strcmp(secstrings + sechdrs[i].sh_name, ".plt") == 0) - me->arch.core_plt_section = i; - } - if (!me->arch.core_plt_section || !me->arch.init_plt_section) { - pr_err("Module doesn't contain .plt or .init.plt sections.\n"); - return -ENOEXEC; - } - - /* Override their sizes */ - sechdrs[me->arch.core_plt_section].sh_size - = get_plt_size(hdr, sechdrs, secstrings, 0); - sechdrs[me->arch.core_plt_section].sh_type = SHT_NOBITS; - sechdrs[me->arch.init_plt_section].sh_size - = get_plt_size(hdr, sechdrs, secstrings, 1); - sechdrs[me->arch.init_plt_section].sh_type = SHT_NOBITS; - return 0; -} - -/* Set up a trampoline in the PLT to bounce us to the distant function */ -static uint32_t do_plt_call(void *location, Elf32_Addr val, - Elf32_Shdr *sechdrs, struct module *mod) -{ - struct metag_plt_entry *entry; - /* Instructions used to do the indirect jump. */ - uint32_t tramp[2]; - - /* We have to trash a register, so we assume that any control - transfer more than 21-bits away must be a function call - (so we can use a call-clobbered register). */ - - /* MOVT D0Re0,#HI(v) */ - tramp[0] = 0x02000005 | (((val & 0xffff0000) >> 16) << 3); - /* JUMP D0Re0,#LO(v) */ - tramp[1] = 0xac000001 | ((val & 0x0000ffff) << 3); - - /* Init, or core PLT? */ - if (location >= mod->core_layout.base - && location < mod->core_layout.base + mod->core_layout.size) - entry = (void *)sechdrs[mod->arch.core_plt_section].sh_addr; - else - entry = (void *)sechdrs[mod->arch.init_plt_section].sh_addr; - - /* Find this entry, or if that fails, the next avail. entry */ - while (entry->tramp[0]) - if (entry->tramp[0] == tramp[0] && entry->tramp[1] == tramp[1]) - return (uint32_t)entry; - else - entry++; - - entry->tramp[0] = tramp[0]; - entry->tramp[1] = tramp[1]; - - return (uint32_t)entry; -} - -int apply_relocate_add(Elf32_Shdr *sechdrs, - const char *strtab, - unsigned int symindex, - unsigned int relsec, - struct module *me) -{ - unsigned int i; - Elf32_Rela *rel = (void *)sechdrs[relsec].sh_addr; - Elf32_Sym *sym; - Elf32_Addr relocation; - uint32_t *location; - int32_t value; - - pr_debug("Applying relocate section %u to %u\n", relsec, - sechdrs[relsec].sh_info); - for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) { - /* This is where to make the change */ - location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr - + rel[i].r_offset; - /* This is the symbol it is referring to. Note that all - undefined symbols have been resolved. */ - sym = (Elf32_Sym *)sechdrs[symindex].sh_addr - + ELF32_R_SYM(rel[i].r_info); - relocation = sym->st_value + rel[i].r_addend; - - switch (ELF32_R_TYPE(rel[i].r_info)) { - case R_METAG_NONE: - break; - case R_METAG_HIADDR16: - relocation >>= 16; - case R_METAG_LOADDR16: - *location = (*location & 0xfff80007) | - ((relocation & 0xffff) << 3); - break; - case R_METAG_ADDR32: - /* - * Packed data structures may cause a misaligned - * R_METAG_ADDR32 to be emitted. - */ - put_unaligned(relocation, location); - break; - case R_METAG_GETSETOFF: - *location += ((relocation & 0xfff) << 7); - break; - case R_METAG_RELBRANCH: - if (*location & (0x7ffff << 5)) { - pr_err("bad relbranch relocation\n"); - break; - } - - /* This jump is too big for the offset slot. Build - * a PLT to jump through to get to where we want to go. - * NB: 21bit check - not scaled to 19bit yet - */ - if (((int32_t)(relocation - - (uint32_t)location) > 0xfffff) || - ((int32_t)(relocation - - (uint32_t)location) < -0xfffff)) { - relocation = do_plt_call(location, relocation, - sechdrs, me); - } - - value = relocation - (uint32_t)location; - - /* branch instruction aligned */ - value /= 4; - - if ((value > 0x7ffff) || (value < -0x7ffff)) { - /* - * this should have been caught by the code - * above! - */ - pr_err("overflow of relbranch reloc\n"); - } - - *location = (*location & (~(0x7ffff << 5))) | - ((value & 0x7ffff) << 5); - break; - - default: - pr_err("module %s: Unknown relocation: %u\n", - me->name, ELF32_R_TYPE(rel[i].r_info)); - return -ENOEXEC; - } - } - return 0; -} diff --git a/arch/metag/kernel/perf/Makefile b/arch/metag/kernel/perf/Makefile deleted file mode 100644 index b158cb27208df..0000000000000 --- a/arch/metag/kernel/perf/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -# Makefile for performance event core - -obj-y += perf_event.o diff --git a/arch/metag/kernel/perf/perf_event.c b/arch/metag/kernel/perf/perf_event.c deleted file mode 100644 index 7e793eb0c1fe1..0000000000000 --- a/arch/metag/kernel/perf/perf_event.c +++ /dev/null @@ -1,879 +0,0 @@ -/* - * Meta performance counter support. - * Copyright (C) 2012 Imagination Technologies Ltd - * - * This code is based on the sh pmu code: - * Copyright (C) 2009 Paul Mundt - * - * and on the arm pmu code: - * Copyright (C) 2009 picoChip Designs, Ltd., James Iles - * Copyright (C) 2010 ARM Ltd., Will Deacon - * - * This file is subject to 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 -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "perf_event.h" - -static int _hw_perf_event_init(struct perf_event *); -static void _hw_perf_event_destroy(struct perf_event *); - -/* Determines which core type we are */ -static struct metag_pmu *metag_pmu __read_mostly; - -/* Processor specific data */ -static DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events); - -/* PMU admin */ -const char *perf_pmu_name(void) -{ - if (!metag_pmu) - return NULL; - - return metag_pmu->name; -} -EXPORT_SYMBOL_GPL(perf_pmu_name); - -int perf_num_counters(void) -{ - if (metag_pmu) - return metag_pmu->max_events; - - return 0; -} -EXPORT_SYMBOL_GPL(perf_num_counters); - -static inline int metag_pmu_initialised(void) -{ - return !!metag_pmu; -} - -static void release_pmu_hardware(void) -{ - int irq; - unsigned int version = (metag_pmu->version & - (METAC_ID_MINOR_BITS | METAC_ID_REV_BITS)) >> - METAC_ID_REV_S; - - /* Early cores don't have overflow interrupts */ - if (version < 0x0104) - return; - - irq = internal_irq_map(17); - if (irq >= 0) - free_irq(irq, (void *)1); - - irq = internal_irq_map(16); - if (irq >= 0) - free_irq(irq, (void *)0); -} - -static int reserve_pmu_hardware(void) -{ - int err = 0, irq[2]; - unsigned int version = (metag_pmu->version & - (METAC_ID_MINOR_BITS | METAC_ID_REV_BITS)) >> - METAC_ID_REV_S; - - /* Early cores don't have overflow interrupts */ - if (version < 0x0104) - goto out; - - /* - * Bit 16 on HWSTATMETA is the interrupt for performance counter 0; - * similarly, 17 is the interrupt for performance counter 1. - * We can't (yet) interrupt on the cycle counter, because it's a - * register, however it holds a 32-bit value as opposed to 24-bit. - */ - irq[0] = internal_irq_map(16); - if (irq[0] < 0) { - pr_err("unable to map internal IRQ %d\n", 16); - goto out; - } - err = request_irq(irq[0], metag_pmu->handle_irq, IRQF_NOBALANCING, - "metagpmu0", (void *)0); - if (err) { - pr_err("unable to request IRQ%d for metag PMU counters\n", - irq[0]); - goto out; - } - - irq[1] = internal_irq_map(17); - if (irq[1] < 0) { - pr_err("unable to map internal IRQ %d\n", 17); - goto out_irq1; - } - err = request_irq(irq[1], metag_pmu->handle_irq, IRQF_NOBALANCING, - "metagpmu1", (void *)1); - if (err) { - pr_err("unable to request IRQ%d for metag PMU counters\n", - irq[1]); - goto out_irq1; - } - - return 0; - -out_irq1: - free_irq(irq[0], (void *)0); -out: - return err; -} - -/* PMU operations */ -static void metag_pmu_enable(struct pmu *pmu) -{ -} - -static void metag_pmu_disable(struct pmu *pmu) -{ -} - -static int metag_pmu_event_init(struct perf_event *event) -{ - int err = 0; - atomic_t *active_events = &metag_pmu->active_events; - - if (!metag_pmu_initialised()) { - err = -ENODEV; - goto out; - } - - if (has_branch_stack(event)) - return -EOPNOTSUPP; - - event->destroy = _hw_perf_event_destroy; - - if (!atomic_inc_not_zero(active_events)) { - mutex_lock(&metag_pmu->reserve_mutex); - if (atomic_read(active_events) == 0) - err = reserve_pmu_hardware(); - - if (!err) - atomic_inc(active_events); - - mutex_unlock(&metag_pmu->reserve_mutex); - } - - /* Hardware and caches counters */ - switch (event->attr.type) { - case PERF_TYPE_HARDWARE: - case PERF_TYPE_HW_CACHE: - case PERF_TYPE_RAW: - err = _hw_perf_event_init(event); - break; - - default: - return -ENOENT; - } - - if (err) - event->destroy(event); - -out: - return err; -} - -void metag_pmu_event_update(struct perf_event *event, - struct hw_perf_event *hwc, int idx) -{ - u64 prev_raw_count, new_raw_count; - s64 delta; - - /* - * If this counter is chained, it may be that the previous counter - * value has been changed beneath us. - * - * To get around this, we read and exchange the new raw count, then - * add the delta (new - prev) to the generic counter atomically. - * - * Without interrupts, this is the simplest approach. - */ -again: - prev_raw_count = local64_read(&hwc->prev_count); - new_raw_count = metag_pmu->read(idx); - - if (local64_cmpxchg(&hwc->prev_count, prev_raw_count, - new_raw_count) != prev_raw_count) - goto again; - - /* - * Calculate the delta and add it to the counter. - */ - delta = (new_raw_count - prev_raw_count) & MAX_PERIOD; - - local64_add(delta, &event->count); - local64_sub(delta, &hwc->period_left); -} - -int metag_pmu_event_set_period(struct perf_event *event, - struct hw_perf_event *hwc, int idx) -{ - s64 left = local64_read(&hwc->period_left); - s64 period = hwc->sample_period; - int ret = 0; - - /* The period may have been changed */ - if (unlikely(period != hwc->last_period)) - left += period - hwc->last_period; - - if (unlikely(left <= -period)) { - left = period; - local64_set(&hwc->period_left, left); - hwc->last_period = period; - ret = 1; - } - - if (unlikely(left <= 0)) { - left += period; - local64_set(&hwc->period_left, left); - hwc->last_period = period; - ret = 1; - } - - if (left > (s64)metag_pmu->max_period) - left = metag_pmu->max_period; - - if (metag_pmu->write) { - local64_set(&hwc->prev_count, -(s32)left); - metag_pmu->write(idx, -left & MAX_PERIOD); - } - - perf_event_update_userpage(event); - - return ret; -} - -static void metag_pmu_start(struct perf_event *event, int flags) -{ - struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events); - struct hw_perf_event *hwc = &event->hw; - int idx = hwc->idx; - - if (WARN_ON_ONCE(idx == -1)) - return; - - /* - * We always have to reprogram the period, so ignore PERF_EF_RELOAD. - */ - if (flags & PERF_EF_RELOAD) - WARN_ON_ONCE(!(hwc->state & PERF_HES_UPTODATE)); - - hwc->state = 0; - - /* - * Reset the period. - * Some counters can't be stopped (i.e. are core global), so when the - * counter was 'stopped' we merely disabled the IRQ. If we don't reset - * the period, then we'll either: a) get an overflow too soon; - * or b) too late if the overflow happened since disabling. - * Obviously, this has little bearing on cores without the overflow - * interrupt, as the performance counter resets to zero on write - * anyway. - */ - if (metag_pmu->max_period) - metag_pmu_event_set_period(event, hwc, hwc->idx); - cpuc->events[idx] = event; - metag_pmu->enable(hwc, idx); -} - -static void metag_pmu_stop(struct perf_event *event, int flags) -{ - struct hw_perf_event *hwc = &event->hw; - - /* - * We should always update the counter on stop; see comment above - * why. - */ - if (!(hwc->state & PERF_HES_STOPPED)) { - metag_pmu_event_update(event, hwc, hwc->idx); - metag_pmu->disable(hwc, hwc->idx); - hwc->state |= PERF_HES_STOPPED | PERF_HES_UPTODATE; - } -} - -static int metag_pmu_add(struct perf_event *event, int flags) -{ - struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events); - struct hw_perf_event *hwc = &event->hw; - int idx = 0, ret = 0; - - perf_pmu_disable(event->pmu); - - /* check whether we're counting instructions */ - if (hwc->config == 0x100) { - if (__test_and_set_bit(METAG_INST_COUNTER, - cpuc->used_mask)) { - ret = -EAGAIN; - goto out; - } - idx = METAG_INST_COUNTER; - } else { - /* Check whether we have a spare counter */ - idx = find_first_zero_bit(cpuc->used_mask, - atomic_read(&metag_pmu->active_events)); - if (idx >= METAG_INST_COUNTER) { - ret = -EAGAIN; - goto out; - } - - __set_bit(idx, cpuc->used_mask); - } - hwc->idx = idx; - - /* Make sure the counter is disabled */ - metag_pmu->disable(hwc, idx); - - hwc->state = PERF_HES_STOPPED | PERF_HES_UPTODATE; - if (flags & PERF_EF_START) - metag_pmu_start(event, PERF_EF_RELOAD); - - perf_event_update_userpage(event); -out: - perf_pmu_enable(event->pmu); - return ret; -} - -static void metag_pmu_del(struct perf_event *event, int flags) -{ - struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events); - struct hw_perf_event *hwc = &event->hw; - int idx = hwc->idx; - - WARN_ON(idx < 0); - metag_pmu_stop(event, PERF_EF_UPDATE); - cpuc->events[idx] = NULL; - __clear_bit(idx, cpuc->used_mask); - - perf_event_update_userpage(event); -} - -static void metag_pmu_read(struct perf_event *event) -{ - struct hw_perf_event *hwc = &event->hw; - - /* Don't read disabled counters! */ - if (hwc->idx < 0) - return; - - metag_pmu_event_update(event, hwc, hwc->idx); -} - -static struct pmu pmu = { - .pmu_enable = metag_pmu_enable, - .pmu_disable = metag_pmu_disable, - - .event_init = metag_pmu_event_init, - - .add = metag_pmu_add, - .del = metag_pmu_del, - .start = metag_pmu_start, - .stop = metag_pmu_stop, - .read = metag_pmu_read, -}; - -/* Core counter specific functions */ -static const int metag_general_events[] = { - [PERF_COUNT_HW_CPU_CYCLES] = 0x03, - [PERF_COUNT_HW_INSTRUCTIONS] = 0x100, - [PERF_COUNT_HW_CACHE_REFERENCES] = -1, - [PERF_COUNT_HW_CACHE_MISSES] = -1, - [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = -1, - [PERF_COUNT_HW_BRANCH_MISSES] = -1, - [PERF_COUNT_HW_BUS_CYCLES] = -1, - [PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = -1, - [PERF_COUNT_HW_STALLED_CYCLES_BACKEND] = -1, - [PERF_COUNT_HW_REF_CPU_CYCLES] = -1, -}; - -static const int metag_pmu_cache_events[C(MAX)][C(OP_MAX)][C(RESULT_MAX)] = { - [C(L1D)] = { - [C(OP_READ)] = { - [C(RESULT_ACCESS)] = 0x08, - [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, - }, - [C(OP_WRITE)] = { - [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, - [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, - }, - [C(OP_PREFETCH)] = { - [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, - [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, - }, - }, - [C(L1I)] = { - [C(OP_READ)] = { - [C(RESULT_ACCESS)] = 0x09, - [C(RESULT_MISS)] = 0x0a, - }, - [C(OP_WRITE)] = { - [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, - [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, - }, - [C(OP_PREFETCH)] = { - [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, - [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, - }, - }, - [C(LL)] = { - [C(OP_READ)] = { - [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, - [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, - }, - [C(OP_WRITE)] = { - [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, - [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, - }, - [C(OP_PREFETCH)] = { - [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, - [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, - }, - }, - [C(DTLB)] = { - [C(OP_READ)] = { - [C(RESULT_ACCESS)] = 0xd0, - [C(RESULT_MISS)] = 0xd2, - }, - [C(OP_WRITE)] = { - [C(RESULT_ACCESS)] = 0xd4, - [C(RESULT_MISS)] = 0xd5, - }, - [C(OP_PREFETCH)] = { - [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, - [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, - }, - }, - [C(ITLB)] = { - [C(OP_READ)] = { - [C(RESULT_ACCESS)] = 0xd1, - [C(RESULT_MISS)] = 0xd3, - }, - [C(OP_WRITE)] = { - [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, - [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, - }, - [C(OP_PREFETCH)] = { - [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, - [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, - }, - }, - [C(BPU)] = { - [C(OP_READ)] = { - [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, - [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, - }, - [C(OP_WRITE)] = { - [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, - [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, - }, - [C(OP_PREFETCH)] = { - [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, - [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, - }, - }, - [C(NODE)] = { - [C(OP_READ)] = { - [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, - [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, - }, - [C(OP_WRITE)] = { - [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, - [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, - }, - [C(OP_PREFETCH)] = { - [C(RESULT_ACCESS)] = CACHE_OP_UNSUPPORTED, - [C(RESULT_MISS)] = CACHE_OP_UNSUPPORTED, - }, - }, -}; - - -static void _hw_perf_event_destroy(struct perf_event *event) -{ - atomic_t *active_events = &metag_pmu->active_events; - struct mutex *pmu_mutex = &metag_pmu->reserve_mutex; - - if (atomic_dec_and_mutex_lock(active_events, pmu_mutex)) { - release_pmu_hardware(); - mutex_unlock(pmu_mutex); - } -} - -static int _hw_perf_cache_event(int config, int *evp) -{ - unsigned long type, op, result; - int ev; - - if (!metag_pmu->cache_events) - return -EINVAL; - - /* Unpack config */ - type = config & 0xff; - op = (config >> 8) & 0xff; - result = (config >> 16) & 0xff; - - if (type >= PERF_COUNT_HW_CACHE_MAX || - op >= PERF_COUNT_HW_CACHE_OP_MAX || - result >= PERF_COUNT_HW_CACHE_RESULT_MAX) - return -EINVAL; - - ev = (*metag_pmu->cache_events)[type][op][result]; - if (ev == 0) - return -EOPNOTSUPP; - if (ev == -1) - return -EINVAL; - *evp = ev; - return 0; -} - -static int _hw_perf_event_init(struct perf_event *event) -{ - struct perf_event_attr *attr = &event->attr; - struct hw_perf_event *hwc = &event->hw; - int mapping = 0, err; - - switch (attr->type) { - case PERF_TYPE_HARDWARE: - if (attr->config >= PERF_COUNT_HW_MAX) - return -EINVAL; - - mapping = metag_pmu->event_map(attr->config); - break; - - case PERF_TYPE_HW_CACHE: - err = _hw_perf_cache_event(attr->config, &mapping); - if (err) - return err; - break; - - case PERF_TYPE_RAW: - mapping = attr->config; - break; - } - - /* Return early if the event is unsupported */ - if (mapping == -1) - return -EINVAL; - - /* - * Don't assign an index until the event is placed into the hardware. - * -1 signifies that we're still deciding where to put it. On SMP - * systems each core has its own set of counters, so we can't do any - * constraint checking yet. - */ - hwc->idx = -1; - - /* Store the event encoding */ - hwc->config |= (unsigned long)mapping; - - /* - * For non-sampling runs, limit the sample_period to half of the - * counter width. This way, the new counter value should be less - * likely to overtake the previous one (unless there are IRQ latency - * issues...) - */ - if (metag_pmu->max_period) { - if (!hwc->sample_period) { - hwc->sample_period = metag_pmu->max_period >> 1; - hwc->last_period = hwc->sample_period; - local64_set(&hwc->period_left, hwc->sample_period); - } - } - - return 0; -} - -static void metag_pmu_enable_counter(struct hw_perf_event *event, int idx) -{ - struct cpu_hw_events *events = this_cpu_ptr(&cpu_hw_events); - unsigned int config = event->config; - unsigned int tmp = config & 0xf0; - unsigned long flags; - - raw_spin_lock_irqsave(&events->pmu_lock, flags); - - /* - * Check if we're enabling the instruction counter (index of - * MAX_HWEVENTS - 1) - */ - if (METAG_INST_COUNTER == idx) { - WARN_ONCE((config != 0x100), - "invalid configuration (%d) for counter (%d)\n", - config, idx); - local64_set(&event->prev_count, __core_reg_get(TXTACTCYC)); - goto unlock; - } - - /* Check for a core internal or performance channel event. */ - if (tmp) { - /* PERF_ICORE/PERF_CHAN only exist since Meta2 */ -#ifdef METAC_2_1 - void *perf_addr; - - /* - * Anything other than a cycle count will write the low- - * nibble to the correct counter register. - */ - switch (tmp) { - case 0xd0: - perf_addr = (void *)PERF_ICORE(idx); - break; - - case 0xf0: - perf_addr = (void *)PERF_CHAN(idx); - break; - - default: - perf_addr = NULL; - break; - } - - if (perf_addr) - metag_out32((config & 0x0f), perf_addr); -#endif - - /* - * Now we use the high nibble as the performance event to - * to count. - */ - config = tmp >> 4; - } - - tmp = ((config & 0xf) << 28) | - ((1 << 24) << hard_processor_id()); - if (metag_pmu->max_period) - /* - * Cores supporting overflow interrupts may have had the counter - * set to a specific value that needs preserving. - */ - tmp |= metag_in32(PERF_COUNT(idx)) & 0x00ffffff; - else - /* - * Older cores reset the counter on write, so prev_count needs - * resetting too so we can calculate a correct delta. - */ - local64_set(&event->prev_count, 0); - - metag_out32(tmp, PERF_COUNT(idx)); -unlock: - raw_spin_unlock_irqrestore(&events->pmu_lock, flags); -} - -static void metag_pmu_disable_counter(struct hw_perf_event *event, int idx) -{ - struct cpu_hw_events *events = this_cpu_ptr(&cpu_hw_events); - unsigned int tmp = 0; - unsigned long flags; - - /* - * The cycle counter can't be disabled per se, as it's a hardware - * thread register which is always counting. We merely return if this - * is the counter we're attempting to disable. - */ - if (METAG_INST_COUNTER == idx) - return; - - /* - * The counter value _should_ have been read prior to disabling, - * as if we're running on an early core then the value gets reset to - * 0, and any read after that would be useless. On the newer cores, - * however, it's better to read-modify-update this for purposes of - * the overflow interrupt. - * Here we remove the thread id AND the event nibble (there are at - * least two events that count events that are core global and ignore - * the thread id mask). This only works because we don't mix thread - * performance counts, and event 0x00 requires a thread id mask! - */ - raw_spin_lock_irqsave(&events->pmu_lock, flags); - - tmp = metag_in32(PERF_COUNT(idx)); - tmp &= 0x00ffffff; - metag_out32(tmp, PERF_COUNT(idx)); - - raw_spin_unlock_irqrestore(&events->pmu_lock, flags); -} - -static u64 metag_pmu_read_counter(int idx) -{ - u32 tmp = 0; - - if (METAG_INST_COUNTER == idx) { - tmp = __core_reg_get(TXTACTCYC); - goto out; - } - - tmp = metag_in32(PERF_COUNT(idx)) & 0x00ffffff; -out: - return tmp; -} - -static void metag_pmu_write_counter(int idx, u32 val) -{ - struct cpu_hw_events *events = this_cpu_ptr(&cpu_hw_events); - u32 tmp = 0; - unsigned long flags; - - /* - * This _shouldn't_ happen, but if it does, then we can just - * ignore the write, as the register is read-only and clear-on-write. - */ - if (METAG_INST_COUNTER == idx) - return; - - /* - * We'll keep the thread mask and event id, and just update the - * counter itself. Also , we should bound the value to 24-bits. - */ - raw_spin_lock_irqsave(&events->pmu_lock, flags); - - val &= 0x00ffffff; - tmp = metag_in32(PERF_COUNT(idx)) & 0xff000000; - val |= tmp; - metag_out32(val, PERF_COUNT(idx)); - - raw_spin_unlock_irqrestore(&events->pmu_lock, flags); -} - -static int metag_pmu_event_map(int idx) -{ - return metag_general_events[idx]; -} - -static irqreturn_t metag_pmu_counter_overflow(int irq, void *dev) -{ - int idx = (int)dev; - struct cpu_hw_events *cpuhw = this_cpu_ptr(&cpu_hw_events); - struct perf_event *event = cpuhw->events[idx]; - struct hw_perf_event *hwc = &event->hw; - struct pt_regs *regs = get_irq_regs(); - struct perf_sample_data sampledata; - unsigned long flags; - u32 counter = 0; - - /* - * We need to stop the core temporarily from generating another - * interrupt while we disable this counter. However, we don't want - * to flag the counter as free - */ - __global_lock2(flags); - counter = metag_in32(PERF_COUNT(idx)); - metag_out32((counter & 0x00ffffff), PERF_COUNT(idx)); - __global_unlock2(flags); - - /* Update the counts and reset the sample period */ - metag_pmu_event_update(event, hwc, idx); - perf_sample_data_init(&sampledata, 0, hwc->last_period); - metag_pmu_event_set_period(event, hwc, idx); - - /* - * Enable the counter again once core overflow processing has - * completed. Note the counter value may have been modified while it was - * inactive to set it up ready for the next interrupt. - */ - if (!perf_event_overflow(event, &sampledata, regs)) { - __global_lock2(flags); - counter = (counter & 0xff000000) | - (metag_in32(PERF_COUNT(idx)) & 0x00ffffff); - metag_out32(counter, PERF_COUNT(idx)); - __global_unlock2(flags); - } - - return IRQ_HANDLED; -} - -static struct metag_pmu _metag_pmu = { - .handle_irq = metag_pmu_counter_overflow, - .enable = metag_pmu_enable_counter, - .disable = metag_pmu_disable_counter, - .read = metag_pmu_read_counter, - .write = metag_pmu_write_counter, - .event_map = metag_pmu_event_map, - .cache_events = &metag_pmu_cache_events, - .max_period = MAX_PERIOD, - .max_events = MAX_HWEVENTS, -}; - -/* PMU CPU hotplug notifier */ -static int metag_pmu_starting_cpu(unsigned int cpu) -{ - struct cpu_hw_events *cpuc = &per_cpu(cpu_hw_events, cpu); - - memset(cpuc, 0, sizeof(struct cpu_hw_events)); - raw_spin_lock_init(&cpuc->pmu_lock); - - return 0; -} - -/* PMU Initialisation */ -static int __init init_hw_perf_events(void) -{ - int ret = 0, cpu; - u32 version = *(u32 *)METAC_ID; - int major = (version & METAC_ID_MAJOR_BITS) >> METAC_ID_MAJOR_S; - int min_rev = (version & (METAC_ID_MINOR_BITS | METAC_ID_REV_BITS)) - >> METAC_ID_REV_S; - - /* Not a Meta 2 core, then not supported */ - if (0x02 > major) { - pr_info("no hardware counter support available\n"); - goto out; - } else if (0x02 == major) { - metag_pmu = &_metag_pmu; - - if (min_rev < 0x0104) { - /* - * A core without overflow interrupts, and clear-on- - * write counters. - */ - metag_pmu->handle_irq = NULL; - metag_pmu->write = NULL; - metag_pmu->max_period = 0; - } - - metag_pmu->name = "meta2"; - metag_pmu->version = version; - metag_pmu->pmu = pmu; - } - - pr_info("enabled with %s PMU driver, %d counters available\n", - metag_pmu->name, metag_pmu->max_events); - - /* - * Early cores have "limited" counters - they have no overflow - * interrupts - and so are unable to do sampling without extra work - * and timer assistance. - */ - if (metag_pmu->max_period == 0) { - metag_pmu->pmu.capabilities |= PERF_PMU_CAP_NO_INTERRUPT; - } - - /* Initialise the active events and reservation mutex */ - atomic_set(&metag_pmu->active_events, 0); - mutex_init(&metag_pmu->reserve_mutex); - - /* Clear the counters */ - metag_out32(0, PERF_COUNT(0)); - metag_out32(0, PERF_COUNT(1)); - - cpuhp_setup_state(CPUHP_AP_PERF_METAG_STARTING, - "perf/metag:starting", metag_pmu_starting_cpu, - NULL); - - ret = perf_pmu_register(&pmu, metag_pmu->name, PERF_TYPE_RAW); - if (ret) - cpuhp_remove_state_nocalls(CPUHP_AP_PERF_METAG_STARTING); - return ret; -} -early_initcall(init_hw_perf_events); diff --git a/arch/metag/kernel/perf/perf_event.h b/arch/metag/kernel/perf/perf_event.h deleted file mode 100644 index fd10a1345b67e..0000000000000 --- a/arch/metag/kernel/perf/perf_event.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Meta performance counter support. - * Copyright (C) 2012 Imagination Technologies Ltd - * - * This file is subject to 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 METAG_PERF_EVENT_H_ -#define METAG_PERF_EVENT_H_ - -#include -#include -#include - -/* For performance counter definitions */ -#include - -/* - * The Meta core has two performance counters, with 24-bit resolution. Newer - * cores generate an overflow interrupt on transition from 0xffffff to 0. - * - * Each counter consists of the counter id, hardware thread id, and the count - * itself; each counter can be assigned to multiple hardware threads at any - * one time, with the returned count being an aggregate of events. A small - * number of events are thread global, i.e. they count the aggregate of all - * threads' events, regardless of the thread selected. - * - * Newer cores can store an arbitrary 24-bit number in the counter, whereas - * older cores will clear the counter bits on write. - * - * We also have a pseudo-counter in the form of the thread active cycles - * counter (which, incidentally, is also bound to - */ - -#define MAX_HWEVENTS 3 -#define MAX_PERIOD ((1UL << 24) - 1) -#define METAG_INST_COUNTER (MAX_HWEVENTS - 1) - -/** - * struct cpu_hw_events - a processor core's performance events - * @events: an array of perf_events active for a given index. - * @used_mask: a bitmap of in-use counters. - * @pmu_lock: a perf counter lock - * - * This is a per-cpu/core structure that maintains a record of its - * performance counters' state. - */ -struct cpu_hw_events { - struct perf_event *events[MAX_HWEVENTS]; - unsigned long used_mask[BITS_TO_LONGS(MAX_HWEVENTS)]; - raw_spinlock_t pmu_lock; -}; - -/** - * struct metag_pmu - the Meta PMU structure - * @pmu: core pmu structure - * @name: pmu name - * @version: core version - * @handle_irq: overflow interrupt handler - * @enable: enable a counter - * @disable: disable a counter - * @read: read the value of a counter - * @write: write a value to a counter - * @event_map: kernel event to counter event id map - * @cache_events: kernel cache counter to core cache counter map - * @max_period: maximum value of the counter before overflow - * @max_events: maximum number of counters available at any one time - * @active_events: number of active counters - * @reserve_mutex: counter reservation mutex - * - * This describes the main functionality and data used by the performance - * event core. - */ -struct metag_pmu { - struct pmu pmu; - const char *name; - u32 version; - irqreturn_t (*handle_irq)(int irq_num, void *dev); - void (*enable)(struct hw_perf_event *evt, int idx); - void (*disable)(struct hw_perf_event *evt, int idx); - u64 (*read)(int idx); - void (*write)(int idx, u32 val); - int (*event_map)(int idx); - const int (*cache_events)[PERF_COUNT_HW_CACHE_MAX] - [PERF_COUNT_HW_CACHE_OP_MAX] - [PERF_COUNT_HW_CACHE_RESULT_MAX]; - u32 max_period; - int max_events; - atomic_t active_events; - struct mutex reserve_mutex; -}; - -/* Convenience macros for accessing the perf counters */ -/* Define some convenience accessors */ -#define PERF_COUNT(x) (PERF_COUNT0 + (sizeof(u64) * (x))) -#define PERF_ICORE(x) (PERF_ICORE0 + (sizeof(u64) * (x))) -#define PERF_CHAN(x) (PERF_CHAN0 + (sizeof(u64) * (x))) - -/* Cache index macros */ -#define C(x) PERF_COUNT_HW_CACHE_##x -#define CACHE_OP_UNSUPPORTED 0xfffe -#define CACHE_OP_NONSENSE 0xffff - -#endif diff --git a/arch/metag/kernel/perf_callchain.c b/arch/metag/kernel/perf_callchain.c deleted file mode 100644 index d325ba101de01..0000000000000 --- a/arch/metag/kernel/perf_callchain.c +++ /dev/null @@ -1,97 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Perf callchain handling code. - * - * Based on the ARM perf implementation. - */ - -#include -#include -#include -#include -#include -#include - -static bool is_valid_call(unsigned long calladdr) -{ - unsigned int callinsn; - - /* Check the possible return address is aligned. */ - if (!(calladdr & 0x3)) { - if (!get_user(callinsn, (unsigned int *)calladdr)) { - /* Check for CALLR or SWAP PC,D1RtP. */ - if ((callinsn & 0xff000000) == 0xab000000 || - callinsn == 0xa3200aa0) - return true; - } - } - return false; -} - -static struct metag_frame __user * -user_backtrace(struct metag_frame __user *user_frame, - struct perf_callchain_entry_ctx *entry) -{ - struct metag_frame frame; - unsigned long calladdr; - - /* We cannot rely on having frame pointers in user code. */ - while (1) { - /* Also check accessibility of one struct frame beyond */ - if (!access_ok(VERIFY_READ, user_frame, sizeof(frame))) - return 0; - if (__copy_from_user_inatomic(&frame, user_frame, - sizeof(frame))) - return 0; - - --user_frame; - - calladdr = frame.lr - 4; - if (is_valid_call(calladdr)) { - perf_callchain_store(entry, calladdr); - return user_frame; - } - } - - return 0; -} - -void -perf_callchain_user(struct perf_callchain_entry_ctx *entry, struct pt_regs *regs) -{ - unsigned long sp = regs->ctx.AX[0].U0; - struct metag_frame __user *frame; - - frame = (struct metag_frame __user *)sp; - - --frame; - - while ((entry->nr < entry->max_stack) && frame) - frame = user_backtrace(frame, entry); -} - -/* - * Gets called by walk_stackframe() for every stackframe. This will be called - * whist unwinding the stackframe and is like a subroutine return so we use - * the PC. - */ -static int -callchain_trace(struct stackframe *fr, - void *data) -{ - struct perf_callchain_entry_ctx *entry = data; - perf_callchain_store(entry, fr->pc); - return 0; -} - -void -perf_callchain_kernel(struct perf_callchain_entry_ctx *entry, struct pt_regs *regs) -{ - struct stackframe fr; - - fr.fp = regs->ctx.AX[1].U0; - fr.sp = regs->ctx.AX[0].U0; - fr.lr = regs->ctx.DX[4].U1; - fr.pc = regs->ctx.CurrPC; - walk_stackframe(&fr, callchain_trace, entry); -} diff --git a/arch/metag/kernel/process.c b/arch/metag/kernel/process.c deleted file mode 100644 index 0909834c83a7d..0000000000000 --- a/arch/metag/kernel/process.c +++ /dev/null @@ -1,448 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Copyright (C) 2005,2006,2007,2008,2009,2010,2011 Imagination Technologies - * - * This file contains the architecture-dependent parts of process handling. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * Wait for the next interrupt and enable local interrupts - */ -void arch_cpu_idle(void) -{ - int tmp; - - /* - * Quickly jump straight into the interrupt entry point without actually - * triggering an interrupt. When TXSTATI gets read the processor will - * block until an interrupt is triggered. - */ - asm volatile (/* Switch into ISTAT mode */ - "RTH\n\t" - /* Enable local interrupts */ - "MOV TXMASKI, %1\n\t" - /* - * We can't directly "SWAP PC, PCX", so we swap via a - * temporary. Essentially we do: - * PCX_new = 1f (the place to continue execution) - * PC = PCX_old - */ - "ADD %0, CPC0, #(1f-.)\n\t" - "SWAP PCX, %0\n\t" - "MOV PC, %0\n" - /* Continue execution here with interrupts enabled */ - "1:" - : "=a" (tmp) - : "r" (get_trigger_mask())); -} - -#ifdef CONFIG_HOTPLUG_CPU -void arch_cpu_idle_dead(void) -{ - cpu_die(); -} -#endif - -void (*pm_power_off)(void); -EXPORT_SYMBOL(pm_power_off); - -void (*soc_restart)(char *cmd); -void (*soc_halt)(void); - -void machine_restart(char *cmd) -{ - if (soc_restart) - soc_restart(cmd); - hard_processor_halt(HALT_OK); -} - -void machine_halt(void) -{ - if (soc_halt) - soc_halt(); - smp_send_stop(); - hard_processor_halt(HALT_OK); -} - -void machine_power_off(void) -{ - if (pm_power_off) - pm_power_off(); - smp_send_stop(); - hard_processor_halt(HALT_OK); -} - -#define FLAG_Z 0x8 -#define FLAG_N 0x4 -#define FLAG_O 0x2 -#define FLAG_C 0x1 - -void show_regs(struct pt_regs *regs) -{ - int i; - const char *AX0_names[] = {"A0StP", "A0FrP"}; - const char *AX1_names[] = {"A1GbP", "A1LbP"}; - - const char *DX0_names[] = { - "D0Re0", - "D0Ar6", - "D0Ar4", - "D0Ar2", - "D0FrT", - "D0.5 ", - "D0.6 ", - "D0.7 " - }; - - const char *DX1_names[] = { - "D1Re0", - "D1Ar5", - "D1Ar3", - "D1Ar1", - "D1RtP", - "D1.5 ", - "D1.6 ", - "D1.7 " - }; - - show_regs_print_info(KERN_INFO); - - pr_info(" pt_regs @ %p\n", regs); - pr_info(" SaveMask = 0x%04hx\n", regs->ctx.SaveMask); - pr_info(" Flags = 0x%04hx (%c%c%c%c)\n", regs->ctx.Flags, - regs->ctx.Flags & FLAG_Z ? 'Z' : 'z', - regs->ctx.Flags & FLAG_N ? 'N' : 'n', - regs->ctx.Flags & FLAG_O ? 'O' : 'o', - regs->ctx.Flags & FLAG_C ? 'C' : 'c'); - pr_info(" TXRPT = 0x%08x\n", regs->ctx.CurrRPT); - pr_info(" PC = 0x%08x\n", regs->ctx.CurrPC); - - /* AX regs */ - for (i = 0; i < 2; i++) { - pr_info(" %s = 0x%08x ", - AX0_names[i], - regs->ctx.AX[i].U0); - printk(" %s = 0x%08x\n", - AX1_names[i], - regs->ctx.AX[i].U1); - } - - if (regs->ctx.SaveMask & TBICTX_XEXT_BIT) - pr_warn(" Extended state present - AX2.[01] will be WRONG\n"); - - /* Special place with AXx.2 */ - pr_info(" A0.2 = 0x%08x ", - regs->ctx.Ext.AX2.U0); - printk(" A1.2 = 0x%08x\n", - regs->ctx.Ext.AX2.U1); - - /* 'extended' AX regs (nominally, just AXx.3) */ - for (i = 0; i < (TBICTX_AX_REGS - 3); i++) { - pr_info(" A0.%d = 0x%08x ", i + 3, regs->ctx.AX3[i].U0); - printk(" A1.%d = 0x%08x\n", i + 3, regs->ctx.AX3[i].U1); - } - - for (i = 0; i < 8; i++) { - pr_info(" %s = 0x%08x ", DX0_names[i], regs->ctx.DX[i].U0); - printk(" %s = 0x%08x\n", DX1_names[i], regs->ctx.DX[i].U1); - } - - show_trace(NULL, (unsigned long *)regs->ctx.AX[0].U0, regs); -} - -/* - * Copy architecture-specific thread state - */ -int copy_thread(unsigned long clone_flags, unsigned long usp, - unsigned long kthread_arg, struct task_struct *tsk) -{ - struct pt_regs *childregs = task_pt_regs(tsk); - void *kernel_context = ((void *) childregs + - sizeof(struct pt_regs)); - unsigned long global_base; - - BUG_ON(((unsigned long)childregs) & 0x7); - BUG_ON(((unsigned long)kernel_context) & 0x7); - - memset(&tsk->thread.kernel_context, 0, - sizeof(tsk->thread.kernel_context)); - - tsk->thread.kernel_context = __TBISwitchInit(kernel_context, - ret_from_fork, - 0, 0); - - if (unlikely(tsk->flags & PF_KTHREAD)) { - /* - * Make sure we don't leak any kernel data to child's regs - * if kernel thread becomes a userspace thread in the future - */ - memset(childregs, 0 , sizeof(struct pt_regs)); - - global_base = __core_reg_get(A1GbP); - childregs->ctx.AX[0].U1 = (unsigned long) global_base; - childregs->ctx.AX[0].U0 = (unsigned long) kernel_context; - /* Set D1Ar1=kthread_arg and D1RtP=usp (fn) */ - childregs->ctx.DX[4].U1 = usp; - childregs->ctx.DX[3].U1 = kthread_arg; - tsk->thread.int_depth = 2; - return 0; - } - - /* - * Get a pointer to where the new child's register block should have - * been pushed. - * The Meta's stack grows upwards, and the context is the the first - * thing to be pushed by TBX (phew) - */ - *childregs = *current_pt_regs(); - /* Set the correct stack for the clone mode */ - if (usp) - childregs->ctx.AX[0].U0 = ALIGN(usp, 8); - tsk->thread.int_depth = 1; - - /* set return value for child process */ - childregs->ctx.DX[0].U0 = 0; - - /* The TLS pointer is passed as an argument to sys_clone. */ - if (clone_flags & CLONE_SETTLS) - tsk->thread.tls_ptr = - (__force void __user *)childregs->ctx.DX[1].U1; - -#ifdef CONFIG_METAG_FPU - if (tsk->thread.fpu_context) { - struct meta_fpu_context *ctx; - - ctx = kmemdup(tsk->thread.fpu_context, - sizeof(struct meta_fpu_context), GFP_ATOMIC); - tsk->thread.fpu_context = ctx; - } -#endif - -#ifdef CONFIG_METAG_DSP - if (tsk->thread.dsp_context) { - struct meta_ext_context *ctx; - int i; - - ctx = kmemdup(tsk->thread.dsp_context, - sizeof(struct meta_ext_context), GFP_ATOMIC); - for (i = 0; i < 2; i++) - ctx->ram[i] = kmemdup(ctx->ram[i], ctx->ram_sz[i], - GFP_ATOMIC); - tsk->thread.dsp_context = ctx; - } -#endif - - return 0; -} - -#ifdef CONFIG_METAG_FPU -static void alloc_fpu_context(struct thread_struct *thread) -{ - thread->fpu_context = kzalloc(sizeof(struct meta_fpu_context), - GFP_ATOMIC); -} - -static void clear_fpu(struct thread_struct *thread) -{ - thread->user_flags &= ~TBICTX_FPAC_BIT; - kfree(thread->fpu_context); - thread->fpu_context = NULL; -} -#else -static void clear_fpu(struct thread_struct *thread) -{ -} -#endif - -#ifdef CONFIG_METAG_DSP -static void clear_dsp(struct thread_struct *thread) -{ - if (thread->dsp_context) { - kfree(thread->dsp_context->ram[0]); - kfree(thread->dsp_context->ram[1]); - - kfree(thread->dsp_context); - - thread->dsp_context = NULL; - } - - __core_reg_set(D0.8, 0); -} -#else -static void clear_dsp(struct thread_struct *thread) -{ -} -#endif - -struct task_struct *__sched __switch_to(struct task_struct *prev, - struct task_struct *next) -{ - TBIRES to, from; - - to.Switch.pCtx = next->thread.kernel_context; - to.Switch.pPara = prev; - -#ifdef CONFIG_METAG_FPU - if (prev->thread.user_flags & TBICTX_FPAC_BIT) { - struct pt_regs *regs = task_pt_regs(prev); - TBIRES state; - - state.Sig.SaveMask = prev->thread.user_flags; - state.Sig.pCtx = ®s->ctx; - - if (!prev->thread.fpu_context) - alloc_fpu_context(&prev->thread); - if (prev->thread.fpu_context) - __TBICtxFPUSave(state, prev->thread.fpu_context); - } - /* - * Force a restore of the FPU context next time this process is - * scheduled. - */ - if (prev->thread.fpu_context) - prev->thread.fpu_context->needs_restore = true; -#endif - - - from = __TBISwitch(to, &prev->thread.kernel_context); - - /* Restore TLS pointer for this process. */ - set_gateway_tls(current->thread.tls_ptr); - - return (struct task_struct *) from.Switch.pPara; -} - -void flush_thread(void) -{ - clear_fpu(¤t->thread); - clear_dsp(¤t->thread); -} - -/* - * Free current thread data structures etc. - */ -void exit_thread(struct task_struct *tsk) -{ - clear_fpu(&tsk->thread); - clear_dsp(&tsk->thread); -} - -/* TODO: figure out how to unwind the kernel stack here to figure out - * where we went to sleep. */ -unsigned long get_wchan(struct task_struct *p) -{ - return 0; -} - -int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu) -{ - /* Returning 0 indicates that the FPU state was not stored (as it was - * not in use) */ - return 0; -} - -#ifdef CONFIG_METAG_USER_TCM - -#define ELF_MIN_ALIGN PAGE_SIZE - -#define ELF_PAGESTART(_v) ((_v) & ~(unsigned long)(ELF_MIN_ALIGN-1)) -#define ELF_PAGEOFFSET(_v) ((_v) & (ELF_MIN_ALIGN-1)) -#define ELF_PAGEALIGN(_v) (((_v) + ELF_MIN_ALIGN - 1) & ~(ELF_MIN_ALIGN - 1)) - -#define BAD_ADDR(x) ((unsigned long)(x) >= TASK_SIZE) - -unsigned long __metag_elf_map(struct file *filep, unsigned long addr, - struct elf_phdr *eppnt, int prot, int type, - unsigned long total_size) -{ - unsigned long map_addr, size; - unsigned long page_off = ELF_PAGEOFFSET(eppnt->p_vaddr); - unsigned long raw_size = eppnt->p_filesz + page_off; - unsigned long off = eppnt->p_offset - page_off; - unsigned int tcm_tag; - addr = ELF_PAGESTART(addr); - size = ELF_PAGEALIGN(raw_size); - - /* mmap() will return -EINVAL if given a zero size, but a - * segment with zero filesize is perfectly valid */ - if (!size) - return addr; - - tcm_tag = tcm_lookup_tag(addr); - - if (tcm_tag != TCM_INVALID_TAG) - type &= ~MAP_FIXED; - - /* - * total_size is the size of the ELF (interpreter) image. - * The _first_ mmap needs to know the full size, otherwise - * randomization might put this image into an overlapping - * position with the ELF binary image. (since size < total_size) - * So we first map the 'big' image - and unmap the remainder at - * the end. (which unmap is needed for ELF images with holes.) - */ - if (total_size) { - total_size = ELF_PAGEALIGN(total_size); - map_addr = vm_mmap(filep, addr, total_size, prot, type, off); - if (!BAD_ADDR(map_addr)) - vm_munmap(map_addr+size, total_size-size); - } else - map_addr = vm_mmap(filep, addr, size, prot, type, off); - - if (!BAD_ADDR(map_addr) && tcm_tag != TCM_INVALID_TAG) { - struct tcm_allocation *tcm; - unsigned long tcm_addr; - - tcm = kmalloc(sizeof(*tcm), GFP_KERNEL); - if (!tcm) - return -ENOMEM; - - tcm_addr = tcm_alloc(tcm_tag, raw_size); - if (tcm_addr != addr) { - kfree(tcm); - return -ENOMEM; - } - - tcm->tag = tcm_tag; - tcm->addr = tcm_addr; - tcm->size = raw_size; - - list_add(&tcm->list, ¤t->mm->context.tcm); - - eppnt->p_vaddr = map_addr; - if (copy_from_user((void *) addr, (void __user *) map_addr, - raw_size)) - return -EFAULT; - } - - return map_addr; -} -#endif diff --git a/arch/metag/kernel/ptrace.c b/arch/metag/kernel/ptrace.c deleted file mode 100644 index e615603a4b0ae..0000000000000 --- a/arch/metag/kernel/ptrace.c +++ /dev/null @@ -1,427 +0,0 @@ -/* - * Copyright (C) 2005-2012 Imagination Technologies Ltd. - * - * This file is subject to 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#define CREATE_TRACE_POINTS -#include - -/* - * user_regset definitions. - */ - -static unsigned long user_txstatus(const struct pt_regs *regs) -{ - unsigned long data = (unsigned long)regs->ctx.Flags; - - if (regs->ctx.SaveMask & TBICTX_CBUF_BIT) - data |= USER_GP_REGS_STATUS_CATCH_BIT; - - return data; -} - -int metag_gp_regs_copyout(const struct pt_regs *regs, - unsigned int pos, unsigned int count, - void *kbuf, void __user *ubuf) -{ - const void *ptr; - unsigned long data; - int ret; - - /* D{0-1}.{0-7} */ - ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, - regs->ctx.DX, 0, 4*16); - if (ret) - goto out; - /* A{0-1}.{0-1} */ - ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, - regs->ctx.AX, 4*16, 4*20); - if (ret) - goto out; - /* A{0-1}.2 */ - if (regs->ctx.SaveMask & TBICTX_XEXT_BIT) - ptr = regs->ctx.Ext.Ctx.pExt; - else - ptr = ®s->ctx.Ext.AX2; - ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, - ptr, 4*20, 4*22); - if (ret) - goto out; - /* A{0-1}.3 */ - ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, - ®s->ctx.AX3, 4*22, 4*24); - if (ret) - goto out; - /* PC */ - ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, - ®s->ctx.CurrPC, 4*24, 4*25); - if (ret) - goto out; - /* TXSTATUS */ - data = user_txstatus(regs); - ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, - &data, 4*25, 4*26); - if (ret) - goto out; - /* TXRPT, TXBPOBITS, TXMODE */ - ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, - ®s->ctx.CurrRPT, 4*26, 4*29); - if (ret) - goto out; - /* Padding */ - ret = user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf, - 4*29, 4*30); -out: - return ret; -} - -int metag_gp_regs_copyin(struct pt_regs *regs, - unsigned int pos, unsigned int count, - const void *kbuf, const void __user *ubuf) -{ - void *ptr; - unsigned long data; - int ret; - - /* D{0-1}.{0-7} */ - ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, - regs->ctx.DX, 0, 4*16); - if (ret) - goto out; - /* A{0-1}.{0-1} */ - ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, - regs->ctx.AX, 4*16, 4*20); - if (ret) - goto out; - /* A{0-1}.2 */ - if (regs->ctx.SaveMask & TBICTX_XEXT_BIT) - ptr = regs->ctx.Ext.Ctx.pExt; - else - ptr = ®s->ctx.Ext.AX2; - ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, - ptr, 4*20, 4*22); - if (ret) - goto out; - /* A{0-1}.3 */ - ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, - ®s->ctx.AX3, 4*22, 4*24); - if (ret) - goto out; - /* PC */ - ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, - ®s->ctx.CurrPC, 4*24, 4*25); - if (ret) - goto out; - /* TXSTATUS */ - data = user_txstatus(regs); - ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, - &data, 4*25, 4*26); - if (ret) - goto out; - regs->ctx.Flags = data & 0xffff; - if (data & USER_GP_REGS_STATUS_CATCH_BIT) - regs->ctx.SaveMask |= TBICTX_XCBF_BIT | TBICTX_CBUF_BIT; - else - regs->ctx.SaveMask &= ~TBICTX_CBUF_BIT; - /* TXRPT, TXBPOBITS, TXMODE */ - ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, - ®s->ctx.CurrRPT, 4*26, 4*29); -out: - return ret; -} - -static int metag_gp_regs_get(struct task_struct *target, - const struct user_regset *regset, - unsigned int pos, unsigned int count, - void *kbuf, void __user *ubuf) -{ - const struct pt_regs *regs = task_pt_regs(target); - return metag_gp_regs_copyout(regs, pos, count, kbuf, ubuf); -} - -static int metag_gp_regs_set(struct task_struct *target, - const struct user_regset *regset, - unsigned int pos, unsigned int count, - const void *kbuf, const void __user *ubuf) -{ - struct pt_regs *regs = task_pt_regs(target); - return metag_gp_regs_copyin(regs, pos, count, kbuf, ubuf); -} - -int metag_cb_regs_copyout(const struct pt_regs *regs, - unsigned int pos, unsigned int count, - void *kbuf, void __user *ubuf) -{ - int ret; - - /* TXCATCH{0-3} */ - if (regs->ctx.SaveMask & TBICTX_XCBF_BIT) - ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, - regs->extcb0, 0, 4*4); - else - ret = user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf, - 0, 4*4); - return ret; -} - -int metag_cb_regs_copyin(struct pt_regs *regs, - unsigned int pos, unsigned int count, - const void *kbuf, const void __user *ubuf) -{ - int ret; - - /* TXCATCH{0-3} */ - ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, - regs->extcb0, 0, 4*4); - return ret; -} - -static int metag_cb_regs_get(struct task_struct *target, - const struct user_regset *regset, - unsigned int pos, unsigned int count, - void *kbuf, void __user *ubuf) -{ - const struct pt_regs *regs = task_pt_regs(target); - return metag_cb_regs_copyout(regs, pos, count, kbuf, ubuf); -} - -static int metag_cb_regs_set(struct task_struct *target, - const struct user_regset *regset, - unsigned int pos, unsigned int count, - const void *kbuf, const void __user *ubuf) -{ - struct pt_regs *regs = task_pt_regs(target); - return metag_cb_regs_copyin(regs, pos, count, kbuf, ubuf); -} - -int metag_rp_state_copyout(const struct pt_regs *regs, - unsigned int pos, unsigned int count, - void *kbuf, void __user *ubuf) -{ - unsigned long mask; - u64 *ptr; - int ret, i; - - /* Empty read pipeline */ - if (!(regs->ctx.SaveMask & TBICTX_CBRP_BIT)) { - ret = user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf, - 0, 4*13); - goto out; - } - - mask = (regs->ctx.CurrDIVTIME & TXDIVTIME_RPMASK_BITS) >> - TXDIVTIME_RPMASK_S; - - /* Read pipeline entries */ - ptr = (void *)®s->extcb0[1]; - for (i = 0; i < 6; ++i, ++ptr) { - if (mask & (1 << i)) - ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, - ptr, 8*i, 8*(i + 1)); - else - ret = user_regset_copyout_zero(&pos, &count, &kbuf, - &ubuf, 8*i, 8*(i + 1)); - if (ret) - goto out; - } - /* Mask of entries */ - ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, - &mask, 4*12, 4*13); -out: - return ret; -} - -int metag_rp_state_copyin(struct pt_regs *regs, - unsigned int pos, unsigned int count, - const void *kbuf, const void __user *ubuf) -{ - struct user_rp_state rp; - unsigned long long *ptr; - int ret, i; - - if (count < 4*13) - return -EINVAL; - /* Read the entire pipeline before making any changes */ - ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, - &rp, 0, 4*13); - if (ret) - goto out; - - /* Write pipeline entries */ - ptr = (void *)®s->extcb0[1]; - for (i = 0; i < 6; ++i, ++ptr) - if (rp.mask & (1 << i)) - *ptr = rp.entries[i]; - - /* Update RPMask in TXDIVTIME */ - regs->ctx.CurrDIVTIME &= ~TXDIVTIME_RPMASK_BITS; - regs->ctx.CurrDIVTIME |= (rp.mask << TXDIVTIME_RPMASK_S) - & TXDIVTIME_RPMASK_BITS; - - /* Set/clear flags to indicate catch/read pipeline state */ - if (rp.mask) - regs->ctx.SaveMask |= TBICTX_XCBF_BIT | TBICTX_CBRP_BIT; - else - regs->ctx.SaveMask &= ~TBICTX_CBRP_BIT; -out: - return ret; -} - -static int metag_rp_state_get(struct task_struct *target, - const struct user_regset *regset, - unsigned int pos, unsigned int count, - void *kbuf, void __user *ubuf) -{ - const struct pt_regs *regs = task_pt_regs(target); - return metag_rp_state_copyout(regs, pos, count, kbuf, ubuf); -} - -static int metag_rp_state_set(struct task_struct *target, - const struct user_regset *regset, - unsigned int pos, unsigned int count, - const void *kbuf, const void __user *ubuf) -{ - struct pt_regs *regs = task_pt_regs(target); - return metag_rp_state_copyin(regs, pos, count, kbuf, ubuf); -} - -static int metag_tls_get(struct task_struct *target, - const struct user_regset *regset, - unsigned int pos, unsigned int count, - void *kbuf, void __user *ubuf) -{ - void __user *tls = target->thread.tls_ptr; - return user_regset_copyout(&pos, &count, &kbuf, &ubuf, &tls, 0, -1); -} - -static int metag_tls_set(struct task_struct *target, - const struct user_regset *regset, - unsigned int pos, unsigned int count, - const void *kbuf, const void __user *ubuf) -{ - int ret; - void __user *tls = target->thread.tls_ptr; - - ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &tls, 0, -1); - if (ret) - return ret; - - target->thread.tls_ptr = tls; - return ret; -} - -enum metag_regset { - REGSET_GENERAL, - REGSET_CBUF, - REGSET_READPIPE, - REGSET_TLS, -}; - -static const struct user_regset metag_regsets[] = { - [REGSET_GENERAL] = { - .core_note_type = NT_PRSTATUS, - .n = ELF_NGREG, - .size = sizeof(long), - .align = sizeof(long long), - .get = metag_gp_regs_get, - .set = metag_gp_regs_set, - }, - [REGSET_CBUF] = { - .core_note_type = NT_METAG_CBUF, - .n = sizeof(struct user_cb_regs) / sizeof(long), - .size = sizeof(long), - .align = sizeof(long long), - .get = metag_cb_regs_get, - .set = metag_cb_regs_set, - }, - [REGSET_READPIPE] = { - .core_note_type = NT_METAG_RPIPE, - .n = sizeof(struct user_rp_state) / sizeof(long), - .size = sizeof(long), - .align = sizeof(long long), - .get = metag_rp_state_get, - .set = metag_rp_state_set, - }, - [REGSET_TLS] = { - .core_note_type = NT_METAG_TLS, - .n = 1, - .size = sizeof(void *), - .align = sizeof(void *), - .get = metag_tls_get, - .set = metag_tls_set, - }, -}; - -static const struct user_regset_view user_metag_view = { - .name = "metag", - .e_machine = EM_METAG, - .regsets = metag_regsets, - .n = ARRAY_SIZE(metag_regsets) -}; - -const struct user_regset_view *task_user_regset_view(struct task_struct *task) -{ - return &user_metag_view; -} - -/* - * Called by kernel/ptrace.c when detaching.. - * - * Make sure single step bits etc are not set. - */ -void ptrace_disable(struct task_struct *child) -{ - /* nothing to do.. */ -} - -long arch_ptrace(struct task_struct *child, long request, unsigned long addr, - unsigned long data) -{ - int ret; - - switch (request) { - default: - ret = ptrace_request(child, request, addr, data); - break; - } - - return ret; -} - -int syscall_trace_enter(struct pt_regs *regs) -{ - int ret = 0; - - if (test_thread_flag(TIF_SYSCALL_TRACE)) - ret = tracehook_report_syscall_entry(regs); - - if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT))) - trace_sys_enter(regs, regs->ctx.DX[0].U1); - - return ret ? -1 : regs->ctx.DX[0].U1; -} - -void syscall_trace_leave(struct pt_regs *regs) -{ - if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT))) - trace_sys_exit(regs, regs->ctx.DX[0].U1); - - if (test_thread_flag(TIF_SYSCALL_TRACE)) - tracehook_report_syscall_exit(regs, 0); -} diff --git a/arch/metag/kernel/setup.c b/arch/metag/kernel/setup.c deleted file mode 100644 index 1166f1fbfd63d..0000000000000 --- a/arch/metag/kernel/setup.c +++ /dev/null @@ -1,622 +0,0 @@ -/* - * Copyright (C) 2005-2012 Imagination Technologies Ltd. - * - * This file contains the architecture-dependant parts of system setup. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* Priv protect as many registers as possible. */ -#define DEFAULT_PRIV (TXPRIVEXT_COPRO_BITS | \ - TXPRIVEXT_TXTRIGGER_BIT | \ - TXPRIVEXT_TXGBLCREG_BIT | \ - TXPRIVEXT_ILOCK_BIT | \ - TXPRIVEXT_TXITACCYC_BIT | \ - TXPRIVEXT_TXDIVTIME_BIT | \ - TXPRIVEXT_TXAMAREGX_BIT | \ - TXPRIVEXT_TXTIMERI_BIT | \ - TXPRIVEXT_TXSTATUS_BIT | \ - TXPRIVEXT_TXDISABLE_BIT) - -/* Meta2 specific bits. */ -#ifdef CONFIG_METAG_META12 -#define META2_PRIV 0 -#else -#define META2_PRIV (TXPRIVEXT_TXTIMER_BIT | \ - TXPRIVEXT_TRACE_BIT) -#endif - -/* Unaligned access checking bits. */ -#ifdef CONFIG_METAG_UNALIGNED -#define UNALIGNED_PRIV TXPRIVEXT_ALIGNREW_BIT -#else -#define UNALIGNED_PRIV 0 -#endif - -#define PRIV_BITS (DEFAULT_PRIV | \ - META2_PRIV | \ - UNALIGNED_PRIV) - -/* - * Protect access to: - * 0x06000000-0x07ffffff Direct mapped region - * 0x05000000-0x05ffffff MMU table region (Meta1) - * 0x04400000-0x047fffff Cache flush region - * 0x84000000-0x87ffffff Core cache memory region (Meta2) - * - * Allow access to: - * 0x80000000-0x81ffffff Core code memory region (Meta2) - */ -#ifdef CONFIG_METAG_META12 -#define PRIVSYSR_BITS TXPRIVSYSR_ALL_BITS -#else -#define PRIVSYSR_BITS (TXPRIVSYSR_ALL_BITS & ~TXPRIVSYSR_CORECODE_BIT) -#endif - -/* Protect all 0x02xxxxxx and 0x048xxxxx. */ -#define PIOREG_BITS 0xffffffff - -/* - * Protect all 0x04000xx0 (system events) - * except write combiner flush and write fence (system events 4 and 5). - */ -#define PSYREG_BITS 0xfffffffb - - -extern char _heap_start[]; - -#ifdef CONFIG_DA_CONSOLE -/* Our early channel based console driver */ -extern struct console dash_console; -#endif - -const struct machine_desc *machine_desc __initdata; - -/* - * Map a Linux CPU number to a hardware thread ID - * In SMP this will be setup with the correct mapping at startup; in UP this - * will map to the HW thread on which we are running. - */ -u8 cpu_2_hwthread_id[NR_CPUS] __read_mostly = { - [0 ... NR_CPUS-1] = BAD_HWTHREAD_ID -}; -EXPORT_SYMBOL_GPL(cpu_2_hwthread_id); - -/* - * Map a hardware thread ID to a Linux CPU number - * In SMP this will be fleshed out with the correct CPU ID for a particular - * hardware thread. In UP this will be initialised with the boot CPU ID. - */ -u8 hwthread_id_2_cpu[4] __read_mostly = { - [0 ... 3] = BAD_CPU_ID -}; - -/* The relative offset of the MMU mapped memory (from ldlk or bootloader) - * to the real physical memory. This is needed as we have to use the - * physical addresses in the MMU tables (pte entries), and not the virtual - * addresses. - * This variable is used in the __pa() and __va() macros, and should - * probably only be used via them. - */ -unsigned int meta_memoffset; -EXPORT_SYMBOL(meta_memoffset); - -static char __initdata *original_cmd_line; - -DEFINE_PER_CPU(PTBI, pTBI); - -/* - * Mapping are specified as "CPU_ID:HWTHREAD_ID", e.g. - * - * "hwthread_map=0:1,1:2,2:3,3:0" - * - * Linux CPU ID HWTHREAD_ID - * --------------------------- - * 0 1 - * 1 2 - * 2 3 - * 3 0 - */ -static int __init parse_hwthread_map(char *p) -{ - int cpu; - - while (*p) { - cpu = (*p++) - '0'; - if (cpu < 0 || cpu > 9) - goto err_cpu; - - p++; /* skip semi-colon */ - cpu_2_hwthread_id[cpu] = (*p++) - '0'; - if (cpu_2_hwthread_id[cpu] >= 4) - goto err_thread; - hwthread_id_2_cpu[cpu_2_hwthread_id[cpu]] = cpu; - - if (*p == ',') - p++; /* skip comma */ - } - - return 0; -err_cpu: - pr_err("%s: hwthread_map cpu argument out of range\n", __func__); - return -EINVAL; -err_thread: - pr_err("%s: hwthread_map thread argument out of range\n", __func__); - return -EINVAL; -} -early_param("hwthread_map", parse_hwthread_map); - -void __init dump_machine_table(void) -{ - struct machine_desc *p; - const char **compat; - - pr_info("Available machine support:\n\tNAME\t\tCOMPATIBLE LIST\n"); - for_each_machine_desc(p) { - pr_info("\t%s\t[", p->name); - for (compat = p->dt_compat; compat && *compat; ++compat) - printk(" '%s'", *compat); - printk(" ]\n"); - } - - pr_info("\nPlease check your kernel config and/or bootloader.\n"); - - hard_processor_halt(HALT_PANIC); -} - -#ifdef CONFIG_METAG_HALT_ON_PANIC -static int metag_panic_event(struct notifier_block *this, unsigned long event, - void *ptr) -{ - hard_processor_halt(HALT_PANIC); - return NOTIFY_DONE; -} - -static struct notifier_block metag_panic_block = { - metag_panic_event, - NULL, - 0 -}; -#endif - -void __init setup_arch(char **cmdline_p) -{ - unsigned long start_pfn; - unsigned long text_start = (unsigned long)(&_stext); - unsigned long cpu = smp_processor_id(); - unsigned long heap_start, heap_end; - unsigned long start_pte; - PTBI _pTBI; - PTBISEG p_heap; - int heap_id, i; - - metag_cache_probe(); - - metag_da_probe(); -#ifdef CONFIG_DA_CONSOLE - if (metag_da_enabled()) { - /* An early channel based console driver */ - register_console(&dash_console); - add_preferred_console("ttyDA", 1, NULL); - } -#endif - - /* try interpreting the argument as a device tree */ - machine_desc = setup_machine_fdt(original_cmd_line); - /* if it doesn't look like a device tree it must be a command line */ - if (!machine_desc) { -#ifdef CONFIG_METAG_BUILTIN_DTB - /* try the embedded device tree */ - machine_desc = setup_machine_fdt(__dtb_start); - if (!machine_desc) - panic("Invalid embedded device tree."); -#else - /* use the default machine description */ - machine_desc = default_machine_desc(); -#endif -#ifndef CONFIG_CMDLINE_FORCE - /* append the bootloader cmdline to any builtin fdt cmdline */ - if (boot_command_line[0] && original_cmd_line[0]) - strlcat(boot_command_line, " ", COMMAND_LINE_SIZE); - strlcat(boot_command_line, original_cmd_line, - COMMAND_LINE_SIZE); -#endif - } - setup_meta_clocks(machine_desc->clocks); - - *cmdline_p = boot_command_line; - parse_early_param(); - - /* - * Make sure we don't alias in dcache or icache - */ - check_for_cache_aliasing(cpu); - - -#ifdef CONFIG_METAG_HALT_ON_PANIC - atomic_notifier_chain_register(&panic_notifier_list, - &metag_panic_block); -#endif - -#ifdef CONFIG_DUMMY_CONSOLE - conswitchp = &dummy_con; -#endif - - if (!(__core_reg_get(TXSTATUS) & TXSTATUS_PSTAT_BIT)) - panic("Privilege must be enabled for this thread."); - - _pTBI = __TBI(TBID_ISTAT_BIT); - - per_cpu(pTBI, cpu) = _pTBI; - - if (!per_cpu(pTBI, cpu)) - panic("No TBI found!"); - - /* - * Initialize all interrupt vectors to our copy of __TBIUnExpXXX, - * rather than the version from the bootloader. This makes call - * stacks easier to understand and may allow us to unmap the - * bootloader at some point. - */ - for (i = 0; i <= TBID_SIGNUM_MAX; i++) - _pTBI->fnSigs[i] = __TBIUnExpXXX; - - /* A Meta requirement is that the kernel is loaded (virtually) - * at the PAGE_OFFSET. - */ - if (PAGE_OFFSET != text_start) - panic("Kernel not loaded at PAGE_OFFSET (%#x) but at %#lx.", - PAGE_OFFSET, text_start); - - start_pte = mmu_read_second_level_page(text_start); - - /* - * Kernel pages should have the PRIV bit set by the bootloader. - */ - if (!(start_pte & _PAGE_KERNEL)) - panic("kernel pte does not have PRIV set"); - - /* - * See __pa and __va in include/asm/page.h. - * This value is negative when running in local space but the - * calculations work anyway. - */ - meta_memoffset = text_start - (start_pte & PAGE_MASK); - - /* Now lets look at the heap space */ - heap_id = (__TBIThreadId() & TBID_THREAD_BITS) - + TBID_SEG(0, TBID_SEGSCOPE_LOCAL, TBID_SEGTYPE_HEAP); - - p_heap = __TBIFindSeg(NULL, heap_id); - - if (!p_heap) - panic("Could not find heap from TBI!"); - - /* The heap begins at the first full page after the kernel data. */ - heap_start = (unsigned long) &_heap_start; - - /* The heap ends at the end of the heap segment specified with - * ldlk. - */ - if (is_global_space(text_start)) { - pr_debug("WARNING: running in global space!\n"); - heap_end = (unsigned long)p_heap->pGAddr + p_heap->Bytes; - } else { - heap_end = (unsigned long)p_heap->pLAddr + p_heap->Bytes; - } - - ROOT_DEV = Root_RAM0; - - /* init_mm is the mm struct used for the first task. It is then - * cloned for all other tasks spawned from that task. - * - * Note - we are using the virtual addresses here. - */ - init_mm.start_code = (unsigned long)(&_stext); - init_mm.end_code = (unsigned long)(&_etext); - init_mm.end_data = (unsigned long)(&_edata); - init_mm.brk = (unsigned long)heap_start; - - min_low_pfn = PFN_UP(__pa(text_start)); - max_low_pfn = PFN_DOWN(__pa(heap_end)); - - pfn_base = min_low_pfn; - - /* Round max_pfn up to a 4Mb boundary. The free_bootmem_node() - * call later makes sure to keep the rounded up pages marked reserved. - */ - max_pfn = max_low_pfn + ((1 << MAX_ORDER) - 1); - max_pfn &= ~((1 << MAX_ORDER) - 1); - - start_pfn = PFN_UP(__pa(heap_start)); - - if (min_low_pfn & ((1 << MAX_ORDER) - 1)) { - /* Theoretically, we could expand the space that the - * bootmem allocator covers - much as we do for the - * 'high' address, and then tell the bootmem system - * that the lowest chunk is 'not available'. Right - * now it is just much easier to constrain the - * user to always MAX_ORDER align their kernel space. - */ - - panic("Kernel must be %d byte aligned, currently at %#lx.", - 1 << (MAX_ORDER + PAGE_SHIFT), - min_low_pfn << PAGE_SHIFT); - } - -#ifdef CONFIG_HIGHMEM - highstart_pfn = highend_pfn = max_pfn; - high_memory = (void *) __va(PFN_PHYS(highstart_pfn)); -#else - high_memory = (void *)__va(PFN_PHYS(max_pfn)); -#endif - - paging_init(heap_end); - - setup_priv(); - - /* Setup the boot cpu's mapping. The rest will be setup below. */ - cpu_2_hwthread_id[smp_processor_id()] = hard_processor_id(); - hwthread_id_2_cpu[hard_processor_id()] = smp_processor_id(); - - unflatten_and_copy_device_tree(); - -#ifdef CONFIG_SMP - smp_init_cpus(); -#endif - - if (machine_desc->init_early) - machine_desc->init_early(); -} - -static int __init customize_machine(void) -{ - /* customizes platform devices, or adds new ones */ - if (machine_desc->init_machine) - machine_desc->init_machine(); - - return 0; -} -arch_initcall(customize_machine); - -static int __init init_machine_late(void) -{ - if (machine_desc->init_late) - machine_desc->init_late(); - return 0; -} -late_initcall(init_machine_late); - -#ifdef CONFIG_PROC_FS -/* - * Get CPU information for use by the procfs. - */ -static const char *get_cpu_capabilities(unsigned int txenable) -{ -#ifdef CONFIG_METAG_META21 - /* See CORE_ID in META HTP.GP TRM - Architecture Overview 2.1.238 */ - int coreid = metag_in32(METAC_CORE_ID); - unsigned int dsp_type = (coreid >> 3) & 7; - unsigned int fpu_type = (coreid >> 7) & 3; - - switch (dsp_type | fpu_type << 3) { - case (0x00): return "EDSP"; - case (0x01): return "DSP"; - case (0x08): return "EDSP+LFPU"; - case (0x09): return "DSP+LFPU"; - case (0x10): return "EDSP+FPU"; - case (0x11): return "DSP+FPU"; - } - return "UNKNOWN"; - -#else - if (!(txenable & TXENABLE_CLASS_BITS)) - return "DSP"; - else - return ""; -#endif -} - -static int show_cpuinfo(struct seq_file *m, void *v) -{ - const char *cpu; - unsigned int txenable, thread_id, major, minor; - unsigned long clockfreq = get_coreclock(); -#ifdef CONFIG_SMP - int i; - unsigned long lpj; -#endif - - cpu = "META"; - - txenable = __core_reg_get(TXENABLE); - major = (txenable & TXENABLE_MAJOR_REV_BITS) >> TXENABLE_MAJOR_REV_S; - minor = (txenable & TXENABLE_MINOR_REV_BITS) >> TXENABLE_MINOR_REV_S; - thread_id = (txenable >> 8) & 0x3; - -#ifdef CONFIG_SMP - for_each_online_cpu(i) { - lpj = per_cpu(cpu_data, i).loops_per_jiffy; - txenable = core_reg_read(TXUCT_ID, TXENABLE_REGNUM, - cpu_2_hwthread_id[i]); - - seq_printf(m, "CPU:\t\t%s %d.%d (thread %d)\n" - "Clocking:\t%lu.%1luMHz\n" - "BogoMips:\t%lu.%02lu\n" - "Calibration:\t%lu loops\n" - "Capabilities:\t%s\n\n", - cpu, major, minor, i, - clockfreq / 1000000, (clockfreq / 100000) % 10, - lpj / (500000 / HZ), (lpj / (5000 / HZ)) % 100, - lpj, - get_cpu_capabilities(txenable)); - } -#else - seq_printf(m, "CPU:\t\t%s %d.%d (thread %d)\n" - "Clocking:\t%lu.%1luMHz\n" - "BogoMips:\t%lu.%02lu\n" - "Calibration:\t%lu loops\n" - "Capabilities:\t%s\n", - cpu, major, minor, thread_id, - clockfreq / 1000000, (clockfreq / 100000) % 10, - loops_per_jiffy / (500000 / HZ), - (loops_per_jiffy / (5000 / HZ)) % 100, - loops_per_jiffy, - get_cpu_capabilities(txenable)); -#endif /* CONFIG_SMP */ - -#ifdef CONFIG_METAG_L2C - if (meta_l2c_is_present()) { - seq_printf(m, "L2 cache:\t%s\n" - "L2 cache size:\t%d KB\n", - meta_l2c_is_enabled() ? "enabled" : "disabled", - meta_l2c_size() >> 10); - } -#endif - return 0; -} - -static void *c_start(struct seq_file *m, loff_t *pos) -{ - return (void *)(*pos == 0); -} -static void *c_next(struct seq_file *m, void *v, loff_t *pos) -{ - return NULL; -} -static void c_stop(struct seq_file *m, void *v) -{ -} -const struct seq_operations cpuinfo_op = { - .start = c_start, - .next = c_next, - .stop = c_stop, - .show = show_cpuinfo, -}; -#endif /* CONFIG_PROC_FS */ - -void __init metag_start_kernel(char *args) -{ - /* Zero the timer register so timestamps are from the point at - * which the kernel started running. - */ - __core_reg_set(TXTIMER, 0); - - /* Clear the bss. */ - memset(__bss_start, 0, - (unsigned long)__bss_stop - (unsigned long)__bss_start); - - /* Remember where these are for use in setup_arch */ - original_cmd_line = args; - - current_thread_info()->cpu = hard_processor_id(); - - start_kernel(); -} - -/** - * setup_priv() - Set up privilege protection registers. - * - * Set up privilege protection registers such as TXPRIVEXT to prevent userland - * from touching our precious registers and sensitive memory areas. - */ -void setup_priv(void) -{ - unsigned int offset = hard_processor_id() << TXPRIVREG_STRIDE_S; - - __core_reg_set(TXPRIVEXT, PRIV_BITS); - - metag_out32(PRIVSYSR_BITS, T0PRIVSYSR + offset); - metag_out32(PIOREG_BITS, T0PIOREG + offset); - metag_out32(PSYREG_BITS, T0PSYREG + offset); -} - -PTBI pTBI_get(unsigned int cpu) -{ - return per_cpu(pTBI, cpu); -} -EXPORT_SYMBOL(pTBI_get); - -#if defined(CONFIG_METAG_DSP) && defined(CONFIG_METAG_FPU) -static char capabilities[] = "dsp fpu"; -#elif defined(CONFIG_METAG_DSP) -static char capabilities[] = "dsp"; -#elif defined(CONFIG_METAG_FPU) -static char capabilities[] = "fpu"; -#else -static char capabilities[] = ""; -#endif - -static struct ctl_table caps_kern_table[] = { - { - .procname = "capabilities", - .data = capabilities, - .maxlen = sizeof(capabilities), - .mode = 0444, - .proc_handler = proc_dostring, - }, - {} -}; - -static struct ctl_table caps_root_table[] = { - { - .procname = "kernel", - .mode = 0555, - .child = caps_kern_table, - }, - {} -}; - -static int __init capabilities_register_sysctl(void) -{ - struct ctl_table_header *caps_table_header; - - caps_table_header = register_sysctl_table(caps_root_table); - if (!caps_table_header) { - pr_err("Unable to register CAPABILITIES sysctl\n"); - return -ENOMEM; - } - - return 0; -} - -core_initcall(capabilities_register_sysctl); diff --git a/arch/metag/kernel/signal.c b/arch/metag/kernel/signal.c deleted file mode 100644 index e64e8b0a93632..0000000000000 --- a/arch/metag/kernel/signal.c +++ /dev/null @@ -1,336 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Copyright (C) 1991,1992 Linus Torvalds - * Copyright (C) 2005-2012 Imagination Technologies Ltd. - * - * 1997-11-28 Modified for POSIX.1b signals by Richard Henderson - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#define REG_FLAGS ctx.SaveMask -#define REG_RETVAL ctx.DX[0].U0 -#define REG_SYSCALL ctx.DX[0].U1 -#define REG_SP ctx.AX[0].U0 -#define REG_ARG1 ctx.DX[3].U1 -#define REG_ARG2 ctx.DX[3].U0 -#define REG_ARG3 ctx.DX[2].U1 -#define REG_PC ctx.CurrPC -#define REG_RTP ctx.DX[4].U1 - -struct rt_sigframe { - struct siginfo info; - struct ucontext uc; - unsigned long retcode[2]; -}; - -static int restore_sigcontext(struct pt_regs *regs, - struct sigcontext __user *sc) -{ - int err; - - /* Always make any pending restarted system calls return -EINTR */ - current->restart_block.fn = do_no_restart_syscall; - - err = metag_gp_regs_copyin(regs, 0, sizeof(struct user_gp_regs), NULL, - &sc->regs); - if (!err) - err = metag_cb_regs_copyin(regs, 0, - sizeof(struct user_cb_regs), NULL, - &sc->cb); - if (!err) - err = metag_rp_state_copyin(regs, 0, - sizeof(struct user_rp_state), NULL, - &sc->rp); - - /* This is a user-mode context. */ - regs->REG_FLAGS |= TBICTX_PRIV_BIT; - - return err; -} - -long sys_rt_sigreturn(void) -{ - /* NOTE - Meta stack goes UPWARDS - so we wind the stack back */ - struct pt_regs *regs = current_pt_regs(); - struct rt_sigframe __user *frame; - sigset_t set; - - frame = (__force struct rt_sigframe __user *)(regs->REG_SP - - sizeof(*frame)); - - if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) - goto badframe; - - if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) - goto badframe; - - set_current_blocked(&set); - - if (restore_sigcontext(regs, &frame->uc.uc_mcontext)) - goto badframe; - - if (restore_altstack(&frame->uc.uc_stack)) - goto badframe; - - return regs->REG_RETVAL; - -badframe: - force_sig(SIGSEGV, current); - - return 0; -} - -static int setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, - unsigned long mask) -{ - int err; - - err = metag_gp_regs_copyout(regs, 0, sizeof(struct user_gp_regs), NULL, - &sc->regs); - - if (!err) - err = metag_cb_regs_copyout(regs, 0, - sizeof(struct user_cb_regs), NULL, - &sc->cb); - if (!err) - err = metag_rp_state_copyout(regs, 0, - sizeof(struct user_rp_state), NULL, - &sc->rp); - - /* OK, clear that cbuf flag in the old context, or our stored - * catch buffer will be restored when we go to call the signal - * handler. Also clear out the CBRP RA/RD pipe bit incase - * that is pending as well! - * Note that as we have already stored this context, these - * flags will get restored on sigreturn to their original - * state. - */ - regs->REG_FLAGS &= ~(TBICTX_XCBF_BIT | TBICTX_CBUF_BIT | - TBICTX_CBRP_BIT); - - /* Clear out the LSM_STEP bits in case we are in the middle of - * and MSET/MGET. - */ - regs->ctx.Flags &= ~TXSTATUS_LSM_STEP_BITS; - - err |= __put_user(mask, &sc->oldmask); - - return err; -} - -/* - * Determine which stack to use.. - */ -static void __user *get_sigframe(struct ksignal *ksig, unsigned long sp) -{ - sp = sigsp(sp, ksig); - sp = (sp + 7) & ~7; /* 8byte align stack */ - - return (void __user *)sp; -} - -static int setup_rt_frame(struct ksignal *ksig, sigset_t *set, - struct pt_regs *regs) -{ - struct rt_sigframe __user *frame; - int err; - unsigned long code; - - frame = get_sigframe(ksig, regs->REG_SP); - if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) - return -EFAULT; - - err = copy_siginfo_to_user(&frame->info, &ksig->info); - - /* Create the ucontext. */ - err |= __put_user(0, &frame->uc.uc_flags); - err |= __put_user(0, (unsigned long __user *)&frame->uc.uc_link); - err |= __save_altstack(&frame->uc.uc_stack, regs->REG_SP); - err |= setup_sigcontext(&frame->uc.uc_mcontext, - regs, set->sig[0]); - err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); - - if (err) - return -EFAULT; - - /* Set up to return from userspace. */ - - /* MOV D1Re0 (D1.0), #__NR_rt_sigreturn */ - code = 0x03000004 | (__NR_rt_sigreturn << 3); - err |= __put_user(code, (unsigned long __user *)(&frame->retcode[0])); - - /* SWITCH #__METAG_SW_SYS */ - code = __METAG_SW_ENCODING(SYS); - err |= __put_user(code, (unsigned long __user *)(&frame->retcode[1])); - - if (err) - return -EFAULT; - - /* Set up registers for signal handler */ - regs->REG_RTP = (unsigned long) frame->retcode; - regs->REG_SP = (unsigned long) frame + sizeof(*frame); - regs->REG_ARG1 = ksig->sig; - regs->REG_ARG2 = (unsigned long) &frame->info; - regs->REG_ARG3 = (unsigned long) &frame->uc; - regs->REG_PC = (unsigned long) ksig->ka.sa.sa_handler; - - pr_debug("SIG deliver (%s:%d): sp=%p pc=%08x pr=%08x\n", - current->comm, current->pid, frame, regs->REG_PC, - regs->REG_RTP); - - /* Now pass size of 'new code' into sigtramp so we can do a more - * effective cache flush - directed rather than 'full flush'. - */ - flush_cache_sigtramp(regs->REG_RTP, sizeof(frame->retcode)); - - return 0; -} - -static void handle_signal(struct ksignal *ksig, struct pt_regs *regs) -{ - sigset_t *oldset = sigmask_to_save(); - int ret; - - /* Set up the stack frame */ - ret = setup_rt_frame(ksig, oldset, regs); - - signal_setup_done(ret, ksig, test_thread_flag(TIF_SINGLESTEP)); -} - - /* - * Notes for Meta. - * We have moved from the old 2.4.9 SH way of using syscall_nr (in the stored - * context) to passing in the syscall flag on the stack. - * This is because having syscall_nr in our context does not fit with TBX, and - * corrupted the stack. - */ -static int do_signal(struct pt_regs *regs, int syscall) -{ - unsigned int retval = 0, continue_addr = 0, restart_addr = 0; - int restart = 0; - struct ksignal ksig; - - /* - * By the end of rt_sigreturn the context describes the point that the - * signal was taken (which may happen to be just before a syscall if - * it's already been restarted). This should *never* be mistaken for a - * system call in need of restarting. - */ - if (syscall == __NR_rt_sigreturn) - syscall = -1; - - /* Did we come from a system call? */ - if (syscall >= 0) { - continue_addr = regs->REG_PC; - restart_addr = continue_addr - 4; - retval = regs->REG_RETVAL; - - /* - * Prepare for system call restart. We do this here so that a - * debugger will see the already changed PC. - */ - switch (retval) { - case -ERESTART_RESTARTBLOCK: - restart = -2; - case -ERESTARTNOHAND: - case -ERESTARTSYS: - case -ERESTARTNOINTR: - ++restart; - regs->REG_PC = restart_addr; - break; - } - } - - /* - * Get the signal to deliver. When running under ptrace, at this point - * the debugger may change all our registers ... - */ - get_signal(&ksig); - - /* - * Depending on the signal settings we may need to revert the decision - * to restart the system call. But skip this if a debugger has chosen to - * restart at a different PC. - */ - if (regs->REG_PC != restart_addr) - restart = 0; - if (ksig.sig > 0) { - if (unlikely(restart)) { - if (retval == -ERESTARTNOHAND - || retval == -ERESTART_RESTARTBLOCK - || (retval == -ERESTARTSYS - && !(ksig.ka.sa.sa_flags & SA_RESTART))) { - regs->REG_RETVAL = -EINTR; - regs->REG_PC = continue_addr; - } - } - - /* Whee! Actually deliver the signal. */ - handle_signal(&ksig, regs); - return 0; - } - - /* Handlerless -ERESTART_RESTARTBLOCK re-enters via restart_syscall */ - if (unlikely(restart < 0)) - regs->REG_SYSCALL = __NR_restart_syscall; - - /* - * If there's no signal to deliver, we just put the saved sigmask back. - */ - restore_saved_sigmask(); - - return restart; -} - -int do_work_pending(struct pt_regs *regs, unsigned int thread_flags, - int syscall) -{ - do { - if (likely(thread_flags & _TIF_NEED_RESCHED)) { - schedule(); - } else { - if (unlikely(!user_mode(regs))) - return 0; - local_irq_enable(); - if (thread_flags & _TIF_SIGPENDING) { - int restart = do_signal(regs, syscall); - if (unlikely(restart)) { - /* - * Restart without handlers. - * Deal with it without leaving - * the kernel space. - */ - return restart; - } - syscall = -1; - } else { - clear_thread_flag(TIF_NOTIFY_RESUME); - tracehook_notify_resume(regs); - } - } - local_irq_disable(); - thread_flags = current_thread_info()->flags; - } while (thread_flags & _TIF_WORK_MASK); - return 0; -} diff --git a/arch/metag/kernel/smp.c b/arch/metag/kernel/smp.c deleted file mode 100644 index 2dbbb7c66043b..0000000000000 --- a/arch/metag/kernel/smp.c +++ /dev/null @@ -1,668 +0,0 @@ -/* - * Copyright (C) 2009,2010,2011 Imagination Technologies Ltd. - * - * Copyright (C) 2002 ARM Limited, All Rights Reserved. - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define SYSC_DCPART(n) (SYSC_DCPART0 + SYSC_xCPARTn_STRIDE * (n)) -#define SYSC_ICPART(n) (SYSC_ICPART0 + SYSC_xCPARTn_STRIDE * (n)) - -DECLARE_PER_CPU(PTBI, pTBI); - -void *secondary_data_stack; - -/* - * structures for inter-processor calls - * - A collection of single bit ipi messages. - */ -struct ipi_data { - spinlock_t lock; - unsigned long ipi_count; - unsigned long bits; -}; - -static DEFINE_PER_CPU(struct ipi_data, ipi_data) = { - .lock = __SPIN_LOCK_UNLOCKED(ipi_data.lock), -}; - -static DEFINE_SPINLOCK(boot_lock); - -static DECLARE_COMPLETION(cpu_running); - -/* - * "thread" is assumed to be a valid Meta hardware thread ID. - */ -static int boot_secondary(unsigned int thread, struct task_struct *idle) -{ - u32 val; - - /* - * set synchronisation state between this boot processor - * and the secondary one - */ - spin_lock(&boot_lock); - - core_reg_write(TXUPC_ID, 0, thread, (unsigned int)secondary_startup); - core_reg_write(TXUPC_ID, 1, thread, 0); - - /* - * Give the thread privilege (PSTAT) and clear potentially problematic - * bits in the process (namely ISTAT, CBMarker, CBMarkerI, LSM_STEP). - */ - core_reg_write(TXUCT_ID, TXSTATUS_REGNUM, thread, TXSTATUS_PSTAT_BIT); - - /* Clear the minim enable bit. */ - val = core_reg_read(TXUCT_ID, TXPRIVEXT_REGNUM, thread); - core_reg_write(TXUCT_ID, TXPRIVEXT_REGNUM, thread, val & ~0x80); - - /* - * set the ThreadEnable bit (0x1) in the TXENABLE register - * for the specified thread - off it goes! - */ - val = core_reg_read(TXUCT_ID, TXENABLE_REGNUM, thread); - core_reg_write(TXUCT_ID, TXENABLE_REGNUM, thread, val | 0x1); - - /* - * now the secondary core is starting up let it run its - * calibrations, then wait for it to finish - */ - spin_unlock(&boot_lock); - - return 0; -} - -/** - * describe_cachepart_change: describe a change to cache partitions. - * @thread: Hardware thread number. - * @label: Label of cache type, e.g. "dcache" or "icache". - * @sz: Total size of the cache. - * @old: Old cache partition configuration (*CPART* register). - * @new: New cache partition configuration (*CPART* register). - * - * If the cache partition has changed, prints a message to the log describing - * those changes. - */ -static void describe_cachepart_change(unsigned int thread, const char *label, - unsigned int sz, unsigned int old, - unsigned int new) -{ - unsigned int lor1, land1, gor1, gand1; - unsigned int lor2, land2, gor2, gand2; - unsigned int diff = old ^ new; - - if (!diff) - return; - - pr_info("Thread %d: %s partition changed:", thread, label); - if (diff & (SYSC_xCPARTL_OR_BITS | SYSC_xCPARTL_AND_BITS)) { - lor1 = (old & SYSC_xCPARTL_OR_BITS) >> SYSC_xCPARTL_OR_S; - lor2 = (new & SYSC_xCPARTL_OR_BITS) >> SYSC_xCPARTL_OR_S; - land1 = (old & SYSC_xCPARTL_AND_BITS) >> SYSC_xCPARTL_AND_S; - land2 = (new & SYSC_xCPARTL_AND_BITS) >> SYSC_xCPARTL_AND_S; - pr_cont(" L:%#x+%#x->%#x+%#x", - (lor1 * sz) >> 4, - ((land1 + 1) * sz) >> 4, - (lor2 * sz) >> 4, - ((land2 + 1) * sz) >> 4); - } - if (diff & (SYSC_xCPARTG_OR_BITS | SYSC_xCPARTG_AND_BITS)) { - gor1 = (old & SYSC_xCPARTG_OR_BITS) >> SYSC_xCPARTG_OR_S; - gor2 = (new & SYSC_xCPARTG_OR_BITS) >> SYSC_xCPARTG_OR_S; - gand1 = (old & SYSC_xCPARTG_AND_BITS) >> SYSC_xCPARTG_AND_S; - gand2 = (new & SYSC_xCPARTG_AND_BITS) >> SYSC_xCPARTG_AND_S; - pr_cont(" G:%#x+%#x->%#x+%#x", - (gor1 * sz) >> 4, - ((gand1 + 1) * sz) >> 4, - (gor2 * sz) >> 4, - ((gand2 + 1) * sz) >> 4); - } - if (diff & SYSC_CWRMODE_BIT) - pr_cont(" %sWR", - (new & SYSC_CWRMODE_BIT) ? "+" : "-"); - if (diff & SYSC_DCPART_GCON_BIT) - pr_cont(" %sGCOn", - (new & SYSC_DCPART_GCON_BIT) ? "+" : "-"); - pr_cont("\n"); -} - -/** - * setup_smp_cache: ensure cache coherency for new SMP thread. - * @thread: New hardware thread number. - * - * Ensures that coherency is enabled and that the threads share the same cache - * partitions. - */ -static void setup_smp_cache(unsigned int thread) -{ - unsigned int this_thread, lflags; - unsigned int dcsz, dcpart_this, dcpart_old, dcpart_new; - unsigned int icsz, icpart_old, icpart_new; - - /* - * Copy over the current thread's cache partition configuration to the - * new thread so that they share cache partitions. - */ - __global_lock2(lflags); - this_thread = hard_processor_id(); - /* Share dcache partition */ - dcpart_this = metag_in32(SYSC_DCPART(this_thread)); - dcpart_old = metag_in32(SYSC_DCPART(thread)); - dcpart_new = dcpart_this; -#if PAGE_OFFSET < LINGLOBAL_BASE - /* - * For the local data cache to be coherent the threads must also have - * GCOn enabled. - */ - dcpart_new |= SYSC_DCPART_GCON_BIT; - metag_out32(dcpart_new, SYSC_DCPART(this_thread)); -#endif - metag_out32(dcpart_new, SYSC_DCPART(thread)); - /* Share icache partition too */ - icpart_new = metag_in32(SYSC_ICPART(this_thread)); - icpart_old = metag_in32(SYSC_ICPART(thread)); - metag_out32(icpart_new, SYSC_ICPART(thread)); - __global_unlock2(lflags); - - /* - * Log if the cache partitions were altered so the user is aware of any - * potential unintentional cache wastage. - */ - dcsz = get_dcache_size(); - icsz = get_dcache_size(); - describe_cachepart_change(this_thread, "dcache", dcsz, - dcpart_this, dcpart_new); - describe_cachepart_change(thread, "dcache", dcsz, - dcpart_old, dcpart_new); - describe_cachepart_change(thread, "icache", icsz, - icpart_old, icpart_new); -} - -int __cpu_up(unsigned int cpu, struct task_struct *idle) -{ - unsigned int thread = cpu_2_hwthread_id[cpu]; - int ret; - - load_pgd(swapper_pg_dir, thread); - - flush_tlb_all(); - - setup_smp_cache(thread); - - /* - * Tell the secondary CPU where to find its idle thread's stack. - */ - secondary_data_stack = task_stack_page(idle); - - wmb(); - - /* - * Now bring the CPU into our world. - */ - ret = boot_secondary(thread, idle); - if (ret == 0) { - /* - * CPU was successfully started, wait for it - * to come online or time out. - */ - wait_for_completion_timeout(&cpu_running, - msecs_to_jiffies(1000)); - - if (!cpu_online(cpu)) - ret = -EIO; - } - - secondary_data_stack = NULL; - - if (ret) { - pr_crit("CPU%u: processor failed to boot\n", cpu); - - /* - * FIXME: We need to clean up the new idle thread. --rmk - */ - } - - return ret; -} - -#ifdef CONFIG_HOTPLUG_CPU - -/* - * __cpu_disable runs on the processor to be shutdown. - */ -int __cpu_disable(void) -{ - unsigned int cpu = smp_processor_id(); - - /* - * Take this CPU offline. Once we clear this, we can't return, - * and we must not schedule until we're ready to give up the cpu. - */ - set_cpu_online(cpu, false); - - /* - * OK - migrate IRQs away from this CPU - */ - migrate_irqs(); - - /* - * Flush user cache and TLB mappings, and then remove this CPU - * from the vm mask set of all processes. - */ - flush_cache_all(); - local_flush_tlb_all(); - - clear_tasks_mm_cpumask(cpu); - - return 0; -} - -/* - * called on the thread which is asking for a CPU to be shutdown - - * waits until shutdown has completed, or it is timed out. - */ -void __cpu_die(unsigned int cpu) -{ - if (!cpu_wait_death(cpu, 1)) - pr_err("CPU%u: unable to kill\n", cpu); -} - -/* - * Called from the idle thread for the CPU which has been shutdown. - * - * Note that we do not return from this function. If this cpu is - * brought online again it will need to run secondary_startup(). - */ -void cpu_die(void) -{ - local_irq_disable(); - idle_task_exit(); - irq_ctx_exit(smp_processor_id()); - - (void)cpu_report_death(); - - asm ("XOR TXENABLE, D0Re0,D0Re0\n"); -} -#endif /* CONFIG_HOTPLUG_CPU */ - -/* - * Called by both boot and secondaries to move global data into - * per-processor storage. - */ -void smp_store_cpu_info(unsigned int cpuid) -{ - struct cpuinfo_metag *cpu_info = &per_cpu(cpu_data, cpuid); - - cpu_info->loops_per_jiffy = loops_per_jiffy; -} - -/* - * This is the secondary CPU boot entry. We're using this CPUs - * idle thread stack and the global page tables. - */ -asmlinkage void secondary_start_kernel(void) -{ - struct mm_struct *mm = &init_mm; - unsigned int cpu = smp_processor_id(); - - /* - * All kernel threads share the same mm context; grab a - * reference and switch to it. - */ - mmget(mm); - mmgrab(mm); - current->active_mm = mm; - cpumask_set_cpu(cpu, mm_cpumask(mm)); - enter_lazy_tlb(mm, current); - local_flush_tlb_all(); - - /* - * TODO: Some day it might be useful for each Linux CPU to - * have its own TBI structure. That would allow each Linux CPU - * to run different interrupt handlers for the same IRQ - * number. - * - * For now, simply copying the pointer to the boot CPU's TBI - * structure is sufficient because we always want to run the - * same interrupt handler whatever CPU takes the interrupt. - */ - per_cpu(pTBI, cpu) = __TBI(TBID_ISTAT_BIT); - - if (!per_cpu(pTBI, cpu)) - panic("No TBI found!"); - - per_cpu_trap_init(cpu); - irq_ctx_init(cpu); - - preempt_disable(); - - setup_priv(); - - notify_cpu_starting(cpu); - - pr_info("CPU%u (thread %u): Booted secondary processor\n", - cpu, cpu_2_hwthread_id[cpu]); - - calibrate_delay(); - smp_store_cpu_info(cpu); - - /* - * OK, now it's safe to let the boot CPU continue - */ - set_cpu_online(cpu, true); - complete(&cpu_running); - - /* - * Enable local interrupts. - */ - tbi_startup_interrupt(TBID_SIGNUM_TRT); - local_irq_enable(); - - /* - * OK, it's off to the idle thread for us - */ - cpu_startup_entry(CPUHP_AP_ONLINE_IDLE); -} - -void __init smp_cpus_done(unsigned int max_cpus) -{ - int cpu; - unsigned long bogosum = 0; - - for_each_online_cpu(cpu) - bogosum += per_cpu(cpu_data, cpu).loops_per_jiffy; - - pr_info("SMP: Total of %d processors activated (%lu.%02lu BogoMIPS).\n", - num_online_cpus(), - bogosum / (500000/HZ), - (bogosum / (5000/HZ)) % 100); -} - -void __init smp_prepare_cpus(unsigned int max_cpus) -{ - unsigned int cpu = smp_processor_id(); - - init_new_context(current, &init_mm); - current_thread_info()->cpu = cpu; - - smp_store_cpu_info(cpu); - init_cpu_present(cpu_possible_mask); -} - -void __init smp_prepare_boot_cpu(void) -{ - unsigned int cpu = smp_processor_id(); - - per_cpu(pTBI, cpu) = __TBI(TBID_ISTAT_BIT); - - if (!per_cpu(pTBI, cpu)) - panic("No TBI found!"); -} - -static void smp_cross_call(cpumask_t callmap, enum ipi_msg_type msg); - -static void send_ipi_message(const struct cpumask *mask, enum ipi_msg_type msg) -{ - unsigned long flags; - unsigned int cpu; - cpumask_t map; - - cpumask_clear(&map); - local_irq_save(flags); - - for_each_cpu(cpu, mask) { - struct ipi_data *ipi = &per_cpu(ipi_data, cpu); - - spin_lock(&ipi->lock); - - /* - * KICK interrupts are queued in hardware so we'll get - * multiple interrupts if we call smp_cross_call() - * multiple times for one msg. The problem is that we - * only have one bit for each message - we can't queue - * them in software. - * - * The first time through ipi_handler() we'll clear - * the msg bit, having done all the work. But when we - * return we'll get _another_ interrupt (and another, - * and another until we've handled all the queued - * KICKs). Running ipi_handler() when there's no work - * to do is bad because that's how kick handler - * chaining detects who the KICK was intended for. - * See arch/metag/kernel/kick.c for more details. - * - * So only add 'cpu' to 'map' if we haven't already - * queued a KICK interrupt for 'msg'. - */ - if (!(ipi->bits & (1 << msg))) { - ipi->bits |= 1 << msg; - cpumask_set_cpu(cpu, &map); - } - - spin_unlock(&ipi->lock); - } - - /* - * Call the platform specific cross-CPU call function. - */ - smp_cross_call(map, msg); - - local_irq_restore(flags); -} - -void arch_send_call_function_ipi_mask(const struct cpumask *mask) -{ - send_ipi_message(mask, IPI_CALL_FUNC); -} - -void arch_send_call_function_single_ipi(int cpu) -{ - send_ipi_message(cpumask_of(cpu), IPI_CALL_FUNC); -} - -void show_ipi_list(struct seq_file *p) -{ - unsigned int cpu; - - seq_puts(p, "IPI:"); - - for_each_present_cpu(cpu) - seq_printf(p, " %10lu", per_cpu(ipi_data, cpu).ipi_count); - - seq_putc(p, '\n'); -} - -static DEFINE_SPINLOCK(stop_lock); - -/* - * Main handler for inter-processor interrupts - * - * For Meta, the ipimask now only identifies a single - * category of IPI (Bit 1 IPIs have been replaced by a - * different mechanism): - * - * Bit 0 - Inter-processor function call - */ -static int do_IPI(void) -{ - unsigned int cpu = smp_processor_id(); - struct ipi_data *ipi = &per_cpu(ipi_data, cpu); - unsigned long msgs, nextmsg; - int handled = 0; - - ipi->ipi_count++; - - spin_lock(&ipi->lock); - msgs = ipi->bits; - nextmsg = msgs & -msgs; - ipi->bits &= ~nextmsg; - spin_unlock(&ipi->lock); - - if (nextmsg) { - handled = 1; - - nextmsg = ffz(~nextmsg); - switch (nextmsg) { - case IPI_RESCHEDULE: - scheduler_ipi(); - break; - - case IPI_CALL_FUNC: - generic_smp_call_function_interrupt(); - break; - - default: - pr_crit("CPU%u: Unknown IPI message 0x%lx\n", - cpu, nextmsg); - break; - } - } - - return handled; -} - -void smp_send_reschedule(int cpu) -{ - send_ipi_message(cpumask_of(cpu), IPI_RESCHEDULE); -} - -static void stop_this_cpu(void *data) -{ - unsigned int cpu = smp_processor_id(); - - if (system_state <= SYSTEM_RUNNING) { - spin_lock(&stop_lock); - pr_crit("CPU%u: stopping\n", cpu); - dump_stack(); - spin_unlock(&stop_lock); - } - - set_cpu_online(cpu, false); - - local_irq_disable(); - - hard_processor_halt(HALT_OK); -} - -void smp_send_stop(void) -{ - smp_call_function(stop_this_cpu, NULL, 0); -} - -/* - * not supported here - */ -int setup_profiling_timer(unsigned int multiplier) -{ - return -EINVAL; -} - -/* - * We use KICKs for inter-processor interrupts. - * - * For every CPU in "callmap" the IPI data must already have been - * stored in that CPU's "ipi_data" member prior to calling this - * function. - */ -static void kick_raise_softirq(cpumask_t callmap, unsigned int irq) -{ - int cpu; - - for_each_cpu(cpu, &callmap) { - unsigned int thread; - - thread = cpu_2_hwthread_id[cpu]; - - BUG_ON(thread == BAD_HWTHREAD_ID); - - metag_out32(1, T0KICKI + (thread * TnXKICK_STRIDE)); - } -} - -static TBIRES ipi_handler(TBIRES State, int SigNum, int Triggers, - int Inst, PTBI pTBI, int *handled) -{ - *handled = do_IPI(); - - return State; -} - -static struct kick_irq_handler ipi_irq = { - .func = ipi_handler, -}; - -static void smp_cross_call(cpumask_t callmap, enum ipi_msg_type msg) -{ - kick_raise_softirq(callmap, 1); -} - -static inline unsigned int get_core_count(void) -{ - int i; - unsigned int ret = 0; - - for (i = 0; i < CONFIG_NR_CPUS; i++) { - if (core_reg_read(TXUCT_ID, TXENABLE_REGNUM, i)) - ret++; - } - - return ret; -} - -/* - * Initialise the CPU possible map early - this describes the CPUs - * which may be present or become present in the system. - */ -void __init smp_init_cpus(void) -{ - unsigned int i, ncores = get_core_count(); - - /* If no hwthread_map early param was set use default mapping */ - for (i = 0; i < NR_CPUS; i++) - if (cpu_2_hwthread_id[i] == BAD_HWTHREAD_ID) { - cpu_2_hwthread_id[i] = i; - hwthread_id_2_cpu[i] = i; - } - - for (i = 0; i < ncores; i++) - set_cpu_possible(i, true); - - kick_register_func(&ipi_irq); -} diff --git a/arch/metag/kernel/stacktrace.c b/arch/metag/kernel/stacktrace.c deleted file mode 100644 index 09d67b7f51caf..0000000000000 --- a/arch/metag/kernel/stacktrace.c +++ /dev/null @@ -1,187 +0,0 @@ -#include -#include -#include -#include -#include - -#include - -#if defined(CONFIG_FRAME_POINTER) - -#ifdef CONFIG_KALLSYMS -#include -#include - -static unsigned long tbi_boing_addr; -static unsigned long tbi_boing_size; - -static void tbi_boing_init(void) -{ - /* We need to know where TBIBoingVec is and it's size */ - unsigned long size; - unsigned long offset; - char modname[MODULE_NAME_LEN]; - char name[KSYM_NAME_LEN]; - tbi_boing_addr = kallsyms_lookup_name("___TBIBoingVec"); - if (!tbi_boing_addr) - tbi_boing_addr = 1; - else if (!lookup_symbol_attrs(tbi_boing_addr, &size, - &offset, modname, name)) - tbi_boing_size = size; -} -#endif - -/* - * Unwind the current stack frame and store the new register values in the - * structure passed as argument. Unwinding is equivalent to a function return, - * hence the new PC value rather than LR should be used for backtrace. - */ -int notrace unwind_frame(struct stackframe *frame) -{ - struct metag_frame *fp = (struct metag_frame *)frame->fp; - unsigned long lr; - unsigned long fpnew; - - if (frame->fp & 0x7) - return -EINVAL; - - fpnew = fp->fp; - lr = fp->lr - 4; - -#ifdef CONFIG_KALLSYMS - /* If we've reached TBIBoingVec then we're at an interrupt - * entry point or a syscall entry point. The frame pointer - * points to a pt_regs which can be used to continue tracing on - * the other side of the boing. - */ - if (!tbi_boing_addr) - tbi_boing_init(); - if (tbi_boing_size && lr >= tbi_boing_addr && - lr < tbi_boing_addr + tbi_boing_size) { - struct pt_regs *regs = (struct pt_regs *)fpnew; - if (user_mode(regs)) - return -EINVAL; - fpnew = regs->ctx.AX[1].U0; - lr = regs->ctx.DX[4].U1; - } -#endif - - /* stack grows up, so frame pointers must decrease */ - if (fpnew < (ALIGN_DOWN((unsigned long)fp, THREAD_SIZE) + - sizeof(struct thread_info)) || fpnew >= (unsigned long)fp) - return -EINVAL; - - /* restore the registers from the stack frame */ - frame->fp = fpnew; - frame->pc = lr; - - return 0; -} -#else -int notrace unwind_frame(struct stackframe *frame) -{ - struct metag_frame *sp = (struct metag_frame *)frame->sp; - - if (frame->sp & 0x7) - return -EINVAL; - - while (!kstack_end(sp)) { - unsigned long addr = sp->lr - 4; - sp--; - - if (__kernel_text_address(addr)) { - frame->sp = (unsigned long)sp; - frame->pc = addr; - return 0; - } - } - return -EINVAL; -} -#endif - -void notrace walk_stackframe(struct stackframe *frame, - int (*fn)(struct stackframe *, void *), void *data) -{ - while (1) { - int ret; - - if (fn(frame, data)) - break; - ret = unwind_frame(frame); - if (ret < 0) - break; - } -} -EXPORT_SYMBOL(walk_stackframe); - -#ifdef CONFIG_STACKTRACE -struct stack_trace_data { - struct stack_trace *trace; - unsigned int no_sched_functions; - unsigned int skip; -}; - -static int save_trace(struct stackframe *frame, void *d) -{ - struct stack_trace_data *data = d; - struct stack_trace *trace = data->trace; - unsigned long addr = frame->pc; - - if (data->no_sched_functions && in_sched_functions(addr)) - return 0; - if (data->skip) { - data->skip--; - return 0; - } - - trace->entries[trace->nr_entries++] = addr; - - return trace->nr_entries >= trace->max_entries; -} - -void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace) -{ - struct stack_trace_data data; - struct stackframe frame; - - data.trace = trace; - data.skip = trace->skip; - - if (tsk != current) { -#ifdef CONFIG_SMP - /* - * What guarantees do we have here that 'tsk' is not - * running on another CPU? For now, ignore it as we - * can't guarantee we won't explode. - */ - if (trace->nr_entries < trace->max_entries) - trace->entries[trace->nr_entries++] = ULONG_MAX; - return; -#else - data.no_sched_functions = 1; - frame.fp = thread_saved_fp(tsk); - frame.sp = thread_saved_sp(tsk); - frame.lr = 0; /* recovered from the stack */ - frame.pc = thread_saved_pc(tsk); -#endif - } else { - register unsigned long current_sp asm ("A0StP"); - - data.no_sched_functions = 0; - frame.fp = (unsigned long)__builtin_frame_address(0); - frame.sp = current_sp; - frame.lr = (unsigned long)__builtin_return_address(0); - frame.pc = (unsigned long)save_stack_trace_tsk; - } - - walk_stackframe(&frame, save_trace, &data); - if (trace->nr_entries < trace->max_entries) - trace->entries[trace->nr_entries++] = ULONG_MAX; -} - -void save_stack_trace(struct stack_trace *trace) -{ - save_stack_trace_tsk(current, trace); -} -EXPORT_SYMBOL_GPL(save_stack_trace); -#endif diff --git a/arch/metag/kernel/sys_metag.c b/arch/metag/kernel/sys_metag.c deleted file mode 100644 index 27d96499dd384..0000000000000 --- a/arch/metag/kernel/sys_metag.c +++ /dev/null @@ -1,181 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * This file contains various random system calls that - * have a non-standard calling sequence on the Linux/Meta - * platform. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define merge_64(hi, lo) ((((unsigned long long)(hi)) << 32) + \ - ((lo) & 0xffffffffUL)) - -int metag_mmap_check(unsigned long addr, unsigned long len, - unsigned long flags) -{ - /* We can't have people trying to write to the bottom of the - * memory map, there are mysterious unspecified things there that - * we don't want people trampling on. - */ - if ((flags & MAP_FIXED) && (addr < TASK_UNMAPPED_BASE)) - return -EINVAL; - - return 0; -} - -asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, - unsigned long prot, unsigned long flags, - unsigned long fd, unsigned long pgoff) -{ - /* The shift for mmap2 is constant, regardless of PAGE_SIZE setting. */ - if (pgoff & ((1 << (PAGE_SHIFT - 12)) - 1)) - return -EINVAL; - - pgoff >>= PAGE_SHIFT - 12; - - return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff); -} - -asmlinkage int sys_metag_setglobalbit(char __user *addr, int mask) -{ - char tmp; - int ret = 0; - unsigned int flags; - - if (!((__force unsigned int)addr >= LINCORE_BASE)) - return -EFAULT; - - __global_lock2(flags); - - metag_data_cache_flush((__force void *)addr, sizeof(mask)); - - ret = __get_user(tmp, addr); - if (ret) - goto out; - tmp |= mask; - ret = __put_user(tmp, addr); - - metag_data_cache_flush((__force void *)addr, sizeof(mask)); - -out: - __global_unlock2(flags); - - return ret; -} - -#define TXDEFR_FPU_MASK ((0x1f << 16) | 0x1f) - -asmlinkage void sys_metag_set_fpu_flags(unsigned int flags) -{ - unsigned int temp; - - flags &= TXDEFR_FPU_MASK; - - temp = __core_reg_get(TXDEFR); - temp &= ~TXDEFR_FPU_MASK; - temp |= flags; - __core_reg_set(TXDEFR, temp); -} - -asmlinkage int sys_metag_set_tls(void __user *ptr) -{ - current->thread.tls_ptr = ptr; - set_gateway_tls(ptr); - - return 0; -} - -asmlinkage void *sys_metag_get_tls(void) -{ - return (__force void *)current->thread.tls_ptr; -} - -asmlinkage long sys_truncate64_metag(const char __user *path, unsigned long lo, - unsigned long hi) -{ - return sys_truncate64(path, merge_64(hi, lo)); -} - -asmlinkage long sys_ftruncate64_metag(unsigned int fd, unsigned long lo, - unsigned long hi) -{ - return sys_ftruncate64(fd, merge_64(hi, lo)); -} - -asmlinkage long sys_fadvise64_64_metag(int fd, unsigned long offs_lo, - unsigned long offs_hi, - unsigned long len_lo, - unsigned long len_hi, int advice) -{ - return sys_fadvise64_64(fd, merge_64(offs_hi, offs_lo), - merge_64(len_hi, len_lo), advice); -} - -asmlinkage long sys_readahead_metag(int fd, unsigned long lo, unsigned long hi, - size_t count) -{ - return sys_readahead(fd, merge_64(hi, lo), count); -} - -asmlinkage ssize_t sys_pread64_metag(unsigned long fd, char __user *buf, - size_t count, unsigned long lo, - unsigned long hi) -{ - return sys_pread64(fd, buf, count, merge_64(hi, lo)); -} - -asmlinkage ssize_t sys_pwrite64_metag(unsigned long fd, char __user *buf, - size_t count, unsigned long lo, - unsigned long hi) -{ - return sys_pwrite64(fd, buf, count, merge_64(hi, lo)); -} - -asmlinkage long sys_sync_file_range_metag(int fd, unsigned long offs_lo, - unsigned long offs_hi, - unsigned long len_lo, - unsigned long len_hi, - unsigned int flags) -{ - return sys_sync_file_range(fd, merge_64(offs_hi, offs_lo), - merge_64(len_hi, len_lo), flags); -} - -/* Provide the actual syscall number to call mapping. */ -#undef __SYSCALL -#define __SYSCALL(nr, call) [nr] = (call), - -/* - * We need wrappers for anything with unaligned 64bit arguments - */ -#define sys_truncate64 sys_truncate64_metag -#define sys_ftruncate64 sys_ftruncate64_metag -#define sys_fadvise64_64 sys_fadvise64_64_metag -#define sys_readahead sys_readahead_metag -#define sys_pread64 sys_pread64_metag -#define sys_pwrite64 sys_pwrite64_metag -#define sys_sync_file_range sys_sync_file_range_metag - -/* - * Note that we can't include here since the header - * guard will defeat us; checks for __SYSCALL as well. - */ -const void *sys_call_table[__NR_syscalls] = { - [0 ... __NR_syscalls-1] = sys_ni_syscall, -#include -}; diff --git a/arch/metag/kernel/tbiunexp.S b/arch/metag/kernel/tbiunexp.S deleted file mode 100644 index 2664808086c73..0000000000000 --- a/arch/metag/kernel/tbiunexp.S +++ /dev/null @@ -1,23 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* Pass a breakpoint through to Codescape */ - -#include - - .text - .global ___TBIUnExpXXX - .type ___TBIUnExpXXX,function -___TBIUnExpXXX: - TSTT D0Ar2,#TBICTX_CRIT_BIT ! Result of nestable int call? - BZ $LTBINormCase ! UnExpXXX at background level - MOV D0Re0,TXMASKI ! Read TXMASKI - XOR TXMASKI,D1Re0,D1Re0 ! Turn off BGNDHALT handling! - OR D0Ar2,D0Ar2,D0Re0 ! Preserve bits cleared -$LTBINormCase: - MSETL [A0StP],D0Ar6,D0Ar4,D0Ar2 ! Save args on stack - SETL [A0StP++],D0Ar2,D1Ar1 ! Init area for returned values - SWITCH #0xC20208 ! Total stack frame size 8 Dwords - ! write back size 2 Dwords - GETL D0Re0,D1Re0,[--A0StP] ! Get result - SUB A0StP,A0StP,#(8*3) ! Recover stack frame - MOV PC,D1RtP - .size ___TBIUnExpXXX,.-___TBIUnExpXXX diff --git a/arch/metag/kernel/tcm.c b/arch/metag/kernel/tcm.c deleted file mode 100644 index 1d7b4e33b1147..0000000000000 --- a/arch/metag/kernel/tcm.c +++ /dev/null @@ -1,152 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Copyright (C) 2010 Imagination Technologies Ltd. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -struct tcm_pool { - struct list_head list; - unsigned int tag; - unsigned long start; - unsigned long end; - struct gen_pool *pool; -}; - -static LIST_HEAD(pool_list); - -static struct tcm_pool *find_pool(unsigned int tag) -{ - struct list_head *lh; - struct tcm_pool *pool; - - list_for_each(lh, &pool_list) { - pool = list_entry(lh, struct tcm_pool, list); - if (pool->tag == tag) - return pool; - } - - return NULL; -} - -/** - * tcm_alloc - allocate memory from a TCM pool - * @tag: tag of the pool to allocate memory from - * @len: number of bytes to be allocated - * - * Allocate the requested number of bytes from the pool matching - * the specified tag. Returns the address of the allocated memory - * or zero on failure. - */ -unsigned long tcm_alloc(unsigned int tag, size_t len) -{ - unsigned long vaddr; - struct tcm_pool *pool; - - pool = find_pool(tag); - if (!pool) - return 0; - - vaddr = gen_pool_alloc(pool->pool, len); - if (!vaddr) - return 0; - - return vaddr; -} - -/** - * tcm_free - free a block of memory to a TCM pool - * @tag: tag of the pool to free memory to - * @addr: address of the memory to be freed - * @len: number of bytes to be freed - * - * Free the requested number of bytes at a specific address to the - * pool matching the specified tag. - */ -void tcm_free(unsigned int tag, unsigned long addr, size_t len) -{ - struct tcm_pool *pool; - - pool = find_pool(tag); - if (!pool) - return; - gen_pool_free(pool->pool, addr, len); -} - -/** - * tcm_lookup_tag - find the tag matching an address - * @p: memory address to lookup the tag for - * - * Find the tag of the tcm memory region that contains the - * specified address. Returns %TCM_INVALID_TAG if no such - * memory region could be found. - */ -unsigned int tcm_lookup_tag(unsigned long p) -{ - struct list_head *lh; - struct tcm_pool *pool; - unsigned long addr = (unsigned long) p; - - list_for_each(lh, &pool_list) { - pool = list_entry(lh, struct tcm_pool, list); - if (addr >= pool->start && addr < pool->end) - return pool->tag; - } - - return TCM_INVALID_TAG; -} - -/** - * tcm_add_region - add a memory region to TCM pool list - * @reg: descriptor of region to be added - * - * Add a region of memory to the TCM pool list. Returns 0 on success. - */ -int __init tcm_add_region(struct tcm_region *reg) -{ - struct tcm_pool *pool; - - pool = kmalloc(sizeof(*pool), GFP_KERNEL); - if (!pool) { - pr_err("Failed to alloc memory for TCM pool!\n"); - return -ENOMEM; - } - - pool->tag = reg->tag; - pool->start = reg->res.start; - pool->end = reg->res.end; - - /* - * 2^3 = 8 bytes granularity to allow for 64bit access alignment. - * -1 = NUMA node specifier. - */ - pool->pool = gen_pool_create(3, -1); - - if (!pool->pool) { - pr_err("Failed to create TCM pool!\n"); - kfree(pool); - return -ENOMEM; - } - - if (gen_pool_add(pool->pool, reg->res.start, - reg->res.end - reg->res.start + 1, -1)) { - pr_err("Failed to add memory to TCM pool!\n"); - return -ENOMEM; - } - pr_info("Added %s TCM pool (%08x bytes @ %08x)\n", - reg->res.name, reg->res.end - reg->res.start + 1, - reg->res.start); - - list_add_tail(&pool->list, &pool_list); - - return 0; -} diff --git a/arch/metag/kernel/time.c b/arch/metag/kernel/time.c deleted file mode 100644 index 1e809e3b43d14..0000000000000 --- a/arch/metag/kernel/time.c +++ /dev/null @@ -1,26 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Copyright (C) 2005-2013 Imagination Technologies Ltd. - * - * This file contains the Meta-specific time handling details. - * - */ - -#include -#include -#include -#include - -void __init time_init(void) -{ -#ifdef CONFIG_COMMON_CLK - /* Init clocks from device tree */ - of_clk_init(NULL); -#endif - - /* Init meta clocks, particularly the core clock */ - init_metag_clocks(); - - /* Set up the timer clock sources */ - metag_generic_timer_init(); -} diff --git a/arch/metag/kernel/topology.c b/arch/metag/kernel/topology.c deleted file mode 100644 index 4ba595701f7d8..0000000000000 --- a/arch/metag/kernel/topology.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2007 Paul Mundt - * Copyright (C) 2010 Imagination Technolohies Ltd. - * - * This file is subject to 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 -#include -#include -#include -#include -#include -#include - -#include - -DEFINE_PER_CPU(struct cpuinfo_metag, cpu_data); - -cpumask_t cpu_core_map[NR_CPUS]; -EXPORT_SYMBOL(cpu_core_map); - -static cpumask_t cpu_coregroup_map(unsigned int cpu) -{ - return *cpu_possible_mask; -} - -const struct cpumask *cpu_coregroup_mask(unsigned int cpu) -{ - return &cpu_core_map[cpu]; -} - -int arch_update_cpu_topology(void) -{ - unsigned int cpu; - - for_each_possible_cpu(cpu) - cpu_core_map[cpu] = cpu_coregroup_map(cpu); - - return 0; -} - -static int __init topology_init(void) -{ - int i, ret; - -#ifdef CONFIG_NEED_MULTIPLE_NODES - for_each_online_node(i) - register_one_node(i); -#endif - - for_each_present_cpu(i) { - struct cpuinfo_metag *cpuinfo = &per_cpu(cpu_data, i); -#ifdef CONFIG_HOTPLUG_CPU - cpuinfo->cpu.hotpluggable = 1; -#endif - ret = register_cpu(&cpuinfo->cpu, i); - if (unlikely(ret)) - pr_warn("%s: register_cpu %d failed (%d)\n", - __func__, i, ret); - } - -#if defined(CONFIG_NUMA) && !defined(CONFIG_SMP) - /* - * In the UP case, make sure the CPU association is still - * registered under each node. Without this, sysfs fails - * to make the connection between nodes other than node0 - * and cpu0. - */ - for_each_online_node(i) - if (i != numa_node_id()) - register_cpu_under_node(raw_smp_processor_id(), i); -#endif - - return 0; -} -subsys_initcall(topology_init); diff --git a/arch/metag/kernel/traps.c b/arch/metag/kernel/traps.c deleted file mode 100644 index 3b62b1b0c0b50..0000000000000 --- a/arch/metag/kernel/traps.c +++ /dev/null @@ -1,992 +0,0 @@ -/* - * Meta exception handling. - * - * Copyright (C) 2005,2006,2007,2008,2009,2012 Imagination Technologies Ltd. - * - * This file is subject to 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* Passing syscall arguments as long long is quicker. */ -typedef unsigned int (*LPSYSCALL) (unsigned long long, - unsigned long long, - unsigned long long); - -/* - * Users of LNKSET should compare the bus error bits obtained from DEFR - * against TXDEFR_LNKSET_SUCCESS only as the failure code will vary between - * different cores revisions. - */ -#define TXDEFR_LNKSET_SUCCESS 0x02000000 -#define TXDEFR_LNKSET_FAILURE 0x04000000 - -/* - * Our global TBI handle. Initialised from setup.c/setup_arch. - */ -DECLARE_PER_CPU(PTBI, pTBI); - -#ifdef CONFIG_SMP -static DEFINE_PER_CPU(unsigned int, trigger_mask); -#else -unsigned int global_trigger_mask; -EXPORT_SYMBOL(global_trigger_mask); -#endif - -unsigned long per_cpu__stack_save[NR_CPUS]; - -static const char * const trap_names[] = { - [TBIXXF_SIGNUM_IIF] = "Illegal instruction fault", - [TBIXXF_SIGNUM_PGF] = "Privilege violation", - [TBIXXF_SIGNUM_DHF] = "Unaligned data access fault", - [TBIXXF_SIGNUM_IGF] = "Code fetch general read failure", - [TBIXXF_SIGNUM_DGF] = "Data access general read/write fault", - [TBIXXF_SIGNUM_IPF] = "Code fetch page fault", - [TBIXXF_SIGNUM_DPF] = "Data access page fault", - [TBIXXF_SIGNUM_IHF] = "Instruction breakpoint", - [TBIXXF_SIGNUM_DWF] = "Read-only data access fault", -}; - -const char *trap_name(int trapno) -{ - if (trapno >= 0 && trapno < ARRAY_SIZE(trap_names) - && trap_names[trapno]) - return trap_names[trapno]; - return "Unknown fault"; -} - -static DEFINE_SPINLOCK(die_lock); - -void __noreturn die(const char *str, struct pt_regs *regs, - long err, unsigned long addr) -{ - static int die_counter; - - oops_enter(); - - spin_lock_irq(&die_lock); - console_verbose(); - bust_spinlocks(1); - pr_err("%s: err %04lx (%s) addr %08lx [#%d]\n", str, err & 0xffff, - trap_name(err & 0xffff), addr, ++die_counter); - - print_modules(); - show_regs(regs); - - pr_err("Process: %s (pid: %d, stack limit = %p)\n", current->comm, - task_pid_nr(current), task_stack_page(current) + THREAD_SIZE); - - bust_spinlocks(0); - add_taint(TAINT_DIE, LOCKDEP_NOW_UNRELIABLE); - if (kexec_should_crash(current)) - crash_kexec(regs); - - if (in_interrupt()) - panic("Fatal exception in interrupt"); - - if (panic_on_oops) - panic("Fatal exception"); - - spin_unlock_irq(&die_lock); - oops_exit(); - do_exit(SIGSEGV); -} - -#ifdef CONFIG_METAG_DSP -/* - * The ECH encoding specifies the size of a DSPRAM as, - * - * "slots" / 4 - * - * A "slot" is the size of two DSPRAM bank entries; an entry from - * DSPRAM bank A and an entry from DSPRAM bank B. One DSPRAM bank - * entry is 4 bytes. - */ -#define SLOT_SZ 8 -static inline unsigned int decode_dspram_size(unsigned int size) -{ - unsigned int _sz = size & 0x7f; - - return _sz * SLOT_SZ * 4; -} - -static void dspram_save(struct meta_ext_context *dsp_ctx, - unsigned int ramA_sz, unsigned int ramB_sz) -{ - unsigned int ram_sz[2]; - int i; - - ram_sz[0] = ramA_sz; - ram_sz[1] = ramB_sz; - - for (i = 0; i < 2; i++) { - if (ram_sz[i] != 0) { - unsigned int sz; - - if (i == 0) - sz = decode_dspram_size(ram_sz[i] >> 8); - else - sz = decode_dspram_size(ram_sz[i]); - - if (dsp_ctx->ram[i] == NULL) { - dsp_ctx->ram[i] = kmalloc(sz, GFP_KERNEL); - - if (dsp_ctx->ram[i] == NULL) - panic("couldn't save DSP context"); - } else { - if (ram_sz[i] > dsp_ctx->ram_sz[i]) { - kfree(dsp_ctx->ram[i]); - - dsp_ctx->ram[i] = kmalloc(sz, - GFP_KERNEL); - - if (dsp_ctx->ram[i] == NULL) - panic("couldn't save DSP context"); - } - } - - if (i == 0) - __TBIDspramSaveA(ram_sz[i], dsp_ctx->ram[i]); - else - __TBIDspramSaveB(ram_sz[i], dsp_ctx->ram[i]); - - dsp_ctx->ram_sz[i] = ram_sz[i]; - } - } -} -#endif /* CONFIG_METAG_DSP */ - -/* - * Allow interrupts to be nested and save any "extended" register - * context state, e.g. DSP regs and RAMs. - */ -static void nest_interrupts(TBIRES State, unsigned long mask) -{ -#ifdef CONFIG_METAG_DSP - struct meta_ext_context *dsp_ctx; - unsigned int D0_8; - - /* - * D0.8 may contain an ECH encoding. The upper 16 bits - * tell us what DSP resources the current process is - * using. OR the bits into the SaveMask so that - * __TBINestInts() knows what resources to save as - * part of this context. - * - * Don't save the context if we're nesting interrupts in the - * kernel because the kernel doesn't use DSP hardware. - */ - D0_8 = __core_reg_get(D0.8); - - if (D0_8 && (State.Sig.SaveMask & TBICTX_PRIV_BIT)) { - State.Sig.SaveMask |= (D0_8 >> 16); - - dsp_ctx = current->thread.dsp_context; - if (dsp_ctx == NULL) { - dsp_ctx = kzalloc(sizeof(*dsp_ctx), GFP_KERNEL); - if (dsp_ctx == NULL) - panic("couldn't save DSP context: ENOMEM"); - - current->thread.dsp_context = dsp_ctx; - } - - current->thread.user_flags |= (D0_8 & 0xffff0000); - __TBINestInts(State, &dsp_ctx->regs, mask); - dspram_save(dsp_ctx, D0_8 & 0x7f00, D0_8 & 0x007f); - } else - __TBINestInts(State, NULL, mask); -#else - __TBINestInts(State, NULL, mask); -#endif -} - -void head_end(TBIRES State, unsigned long mask) -{ - unsigned int savemask = (unsigned short)State.Sig.SaveMask; - unsigned int ctx_savemask = (unsigned short)State.Sig.pCtx->SaveMask; - - if (savemask & TBICTX_PRIV_BIT) { - ctx_savemask |= TBICTX_PRIV_BIT; - current->thread.user_flags = savemask; - } - - /* Always undo the sleep bit */ - ctx_savemask &= ~TBICTX_WAIT_BIT; - - /* Always save the catch buffer and RD pipe if they are dirty */ - savemask |= TBICTX_XCBF_BIT; - - /* Only save the catch and RD if we have not already done so. - * Note - the RD bits are in the pCtx only, and not in the - * State.SaveMask. - */ - if ((savemask & TBICTX_CBUF_BIT) || - (ctx_savemask & TBICTX_CBRP_BIT)) { - /* Have we already saved the buffers though? - * - See TestTrack 5071 */ - if (ctx_savemask & TBICTX_XCBF_BIT) { - /* Strip off the bits so the call to __TBINestInts - * won't save the buffers again. */ - savemask &= ~TBICTX_CBUF_BIT; - ctx_savemask &= ~TBICTX_CBRP_BIT; - } - } - -#ifdef CONFIG_METAG_META21 - { - unsigned int depth, txdefr; - - /* - * Save TXDEFR state. - * - * The process may have been interrupted after a LNKSET, but - * before it could read the DEFR state, so we mustn't lose that - * state or it could end up retrying an atomic operation that - * succeeded. - * - * All interrupts are disabled at this point so we - * don't need to perform any locking. We must do this - * dance before we use LNKGET or LNKSET. - */ - BUG_ON(current->thread.int_depth > HARDIRQ_BITS); - - depth = current->thread.int_depth++; - - txdefr = __core_reg_get(TXDEFR); - - txdefr &= TXDEFR_BUS_STATE_BITS; - if (txdefr & TXDEFR_LNKSET_SUCCESS) - current->thread.txdefr_failure &= ~(1 << depth); - else - current->thread.txdefr_failure |= (1 << depth); - } -#endif - - State.Sig.SaveMask = savemask; - State.Sig.pCtx->SaveMask = ctx_savemask; - - nest_interrupts(State, mask); - -#ifdef CONFIG_METAG_POISON_CATCH_BUFFERS - /* Poison the catch registers. This shows up any mistakes we have - * made in their handling MUCH quicker. - */ - __core_reg_set(TXCATCH0, 0x87650021); - __core_reg_set(TXCATCH1, 0x87654322); - __core_reg_set(TXCATCH2, 0x87654323); - __core_reg_set(TXCATCH3, 0x87654324); -#endif /* CONFIG_METAG_POISON_CATCH_BUFFERS */ -} - -TBIRES tail_end_sys(TBIRES State, int syscall, int *restart) -{ - struct pt_regs *regs = (struct pt_regs *)State.Sig.pCtx; - unsigned long flags; - - local_irq_disable(); - - if (user_mode(regs)) { - flags = current_thread_info()->flags; - if (flags & _TIF_WORK_MASK && - do_work_pending(regs, flags, syscall)) { - *restart = 1; - return State; - } - -#ifdef CONFIG_METAG_FPU - if (current->thread.fpu_context && - current->thread.fpu_context->needs_restore) { - __TBICtxFPURestore(State, current->thread.fpu_context); - /* - * Clearing this bit ensures the FP unit is not made - * active again unless it is used. - */ - State.Sig.SaveMask &= ~TBICTX_FPAC_BIT; - current->thread.fpu_context->needs_restore = false; - } - State.Sig.TrigMask |= TBI_TRIG_BIT(TBID_SIGNUM_DFR); -#endif - } - - /* TBI will turn interrupts back on at some point. */ - if (!irqs_disabled_flags((unsigned long)State.Sig.TrigMask)) - trace_hardirqs_on(); - -#ifdef CONFIG_METAG_DSP - /* - * If we previously saved an extended context then restore it - * now. Otherwise, clear D0.8 because this process is not - * using DSP hardware. - */ - if (State.Sig.pCtx->SaveMask & TBICTX_XEXT_BIT) { - unsigned int D0_8; - struct meta_ext_context *dsp_ctx = current->thread.dsp_context; - - /* Make sure we're going to return to userland. */ - BUG_ON(current->thread.int_depth != 1); - - if (dsp_ctx->ram_sz[0] > 0) - __TBIDspramRestoreA(dsp_ctx->ram_sz[0], - dsp_ctx->ram[0]); - if (dsp_ctx->ram_sz[1] > 0) - __TBIDspramRestoreB(dsp_ctx->ram_sz[1], - dsp_ctx->ram[1]); - - State.Sig.SaveMask |= State.Sig.pCtx->SaveMask; - __TBICtxRestore(State, current->thread.dsp_context); - D0_8 = __core_reg_get(D0.8); - D0_8 |= current->thread.user_flags & 0xffff0000; - D0_8 |= (dsp_ctx->ram_sz[1] | dsp_ctx->ram_sz[0]) & 0xffff; - __core_reg_set(D0.8, D0_8); - } else - __core_reg_set(D0.8, 0); -#endif /* CONFIG_METAG_DSP */ - -#ifdef CONFIG_METAG_META21 - { - unsigned int depth, txdefr; - - /* - * If there hasn't been a LNKSET since the last LNKGET then the - * link flag will be set, causing the next LNKSET to succeed if - * the addresses match. The two LNK operations may not be a pair - * (e.g. see atomic_read()), so the LNKSET should fail. - * We use a conditional-never LNKSET to clear the link flag - * without side effects. - */ - asm volatile("LNKSETDNV [D0Re0],D0Re0"); - - depth = --current->thread.int_depth; - - BUG_ON(user_mode(regs) && depth); - - txdefr = __core_reg_get(TXDEFR); - - txdefr &= ~TXDEFR_BUS_STATE_BITS; - - /* Do we need to restore a failure code into TXDEFR? */ - if (current->thread.txdefr_failure & (1 << depth)) - txdefr |= (TXDEFR_LNKSET_FAILURE | TXDEFR_BUS_TRIG_BIT); - else - txdefr |= (TXDEFR_LNKSET_SUCCESS | TXDEFR_BUS_TRIG_BIT); - - __core_reg_set(TXDEFR, txdefr); - } -#endif - return State; -} - -#ifdef CONFIG_SMP -/* - * If we took an interrupt in the middle of __kuser_get_tls then we need - * to rewind the PC to the start of the function in case the process - * gets migrated to another thread (SMP only) and it reads the wrong tls - * data. - */ -static inline void _restart_critical_section(TBIRES State) -{ - unsigned long get_tls_start; - unsigned long get_tls_end; - - get_tls_start = (unsigned long)__kuser_get_tls - - (unsigned long)&__user_gateway_start; - - get_tls_start += USER_GATEWAY_PAGE; - - get_tls_end = (unsigned long)__kuser_get_tls_end - - (unsigned long)&__user_gateway_start; - - get_tls_end += USER_GATEWAY_PAGE; - - if ((State.Sig.pCtx->CurrPC >= get_tls_start) && - (State.Sig.pCtx->CurrPC < get_tls_end)) - State.Sig.pCtx->CurrPC = get_tls_start; -} -#else -/* - * If we took an interrupt in the middle of - * __kuser_cmpxchg then we need to rewind the PC to the - * start of the function. - */ -static inline void _restart_critical_section(TBIRES State) -{ - unsigned long cmpxchg_start; - unsigned long cmpxchg_end; - - cmpxchg_start = (unsigned long)__kuser_cmpxchg - - (unsigned long)&__user_gateway_start; - - cmpxchg_start += USER_GATEWAY_PAGE; - - cmpxchg_end = (unsigned long)__kuser_cmpxchg_end - - (unsigned long)&__user_gateway_start; - - cmpxchg_end += USER_GATEWAY_PAGE; - - if ((State.Sig.pCtx->CurrPC >= cmpxchg_start) && - (State.Sig.pCtx->CurrPC < cmpxchg_end)) - State.Sig.pCtx->CurrPC = cmpxchg_start; -} -#endif - -/* Used by kick_handler() */ -void restart_critical_section(TBIRES State) -{ - _restart_critical_section(State); -} - -TBIRES trigger_handler(TBIRES State, int SigNum, int Triggers, int Inst, - PTBI pTBI) -{ - head_end(State, ~INTS_OFF_MASK); - - /* If we interrupted user code handle any critical sections. */ - if (State.Sig.SaveMask & TBICTX_PRIV_BIT) - _restart_critical_section(State); - - trace_hardirqs_off(); - - do_IRQ(SigNum, (struct pt_regs *)State.Sig.pCtx); - - return tail_end(State); -} - -static unsigned int load_fault(PTBICTXEXTCB0 pbuf) -{ - return pbuf->CBFlags & TXCATCH0_READ_BIT; -} - -static unsigned long fault_address(PTBICTXEXTCB0 pbuf) -{ - return pbuf->CBAddr; -} - -static void unhandled_fault(struct pt_regs *regs, unsigned long addr, - int signo, int code, int trapno) -{ - if (user_mode(regs)) { - siginfo_t info; - - if (show_unhandled_signals && unhandled_signal(current, signo) - && printk_ratelimit()) { - - pr_info("pid %d unhandled fault: pc 0x%08x, addr 0x%08lx, trap %d (%s)\n", - current->pid, regs->ctx.CurrPC, addr, - trapno, trap_name(trapno)); - print_vma_addr(" in ", regs->ctx.CurrPC); - print_vma_addr(" rtp in ", regs->ctx.DX[4].U1); - printk("\n"); - show_regs(regs); - } - - info.si_signo = signo; - info.si_errno = 0; - info.si_code = code; - info.si_addr = (__force void __user *)addr; - info.si_trapno = trapno; - force_sig_info(signo, &info, current); - } else { - die("Oops", regs, trapno, addr); - } -} - -static int handle_data_fault(PTBICTXEXTCB0 pcbuf, struct pt_regs *regs, - unsigned int data_address, int trapno) -{ - int ret; - - ret = do_page_fault(regs, data_address, !load_fault(pcbuf), trapno); - - return ret; -} - -static unsigned long get_inst_fault_address(struct pt_regs *regs) -{ - return regs->ctx.CurrPC; -} - -TBIRES fault_handler(TBIRES State, int SigNum, int Triggers, - int Inst, PTBI pTBI) -{ - struct pt_regs *regs = (struct pt_regs *)State.Sig.pCtx; - PTBICTXEXTCB0 pcbuf = (PTBICTXEXTCB0)®s->extcb0; - unsigned long data_address; - - head_end(State, ~INTS_OFF_MASK); - - /* Hardware breakpoint or data watch */ - if ((SigNum == TBIXXF_SIGNUM_IHF) || - ((SigNum == TBIXXF_SIGNUM_DHF) && - (pcbuf[0].CBFlags & (TXCATCH0_WATCH1_BIT | - TXCATCH0_WATCH0_BIT)))) { - State = __TBIUnExpXXX(State, SigNum, Triggers, Inst, - pTBI); - return tail_end(State); - } - - local_irq_enable(); - - data_address = fault_address(pcbuf); - - switch (SigNum) { - case TBIXXF_SIGNUM_IGF: - /* 1st-level entry invalid (instruction fetch) */ - case TBIXXF_SIGNUM_IPF: { - /* 2nd-level entry invalid (instruction fetch) */ - unsigned long addr = get_inst_fault_address(regs); - do_page_fault(regs, addr, 0, SigNum); - break; - } - - case TBIXXF_SIGNUM_DGF: - /* 1st-level entry invalid (data access) */ - case TBIXXF_SIGNUM_DPF: - /* 2nd-level entry invalid (data access) */ - case TBIXXF_SIGNUM_DWF: - /* Write to read only page */ - handle_data_fault(pcbuf, regs, data_address, SigNum); - break; - - case TBIXXF_SIGNUM_IIF: - /* Illegal instruction */ - unhandled_fault(regs, regs->ctx.CurrPC, SIGILL, ILL_ILLOPC, - SigNum); - break; - - case TBIXXF_SIGNUM_DHF: - /* Unaligned access */ - unhandled_fault(regs, data_address, SIGBUS, BUS_ADRALN, - SigNum); - break; - case TBIXXF_SIGNUM_PGF: - /* Privilege violation */ - unhandled_fault(regs, data_address, SIGSEGV, SEGV_ACCERR, - SigNum); - break; - default: - BUG(); - break; - } - - return tail_end(State); -} - -static bool switch_is_syscall(unsigned int inst) -{ - return inst == __METAG_SW_ENCODING(SYS); -} - -static bool switch_is_legacy_syscall(unsigned int inst) -{ - return inst == __METAG_SW_ENCODING(SYS_LEGACY); -} - -static inline void step_over_switch(struct pt_regs *regs, unsigned int inst) -{ - regs->ctx.CurrPC += 4; -} - -static inline int test_syscall_work(void) -{ - return current_thread_info()->flags & _TIF_WORK_SYSCALL_MASK; -} - -TBIRES switch1_handler(TBIRES State, int SigNum, int Triggers, - int Inst, PTBI pTBI) -{ - struct pt_regs *regs = (struct pt_regs *)State.Sig.pCtx; - unsigned int sysnumber; - unsigned long long a1_a2, a3_a4, a5_a6; - LPSYSCALL syscall_entry; - int restart; - - head_end(State, ~INTS_OFF_MASK); - - /* - * If this is not a syscall SWITCH it could be a breakpoint. - */ - if (!switch_is_syscall(Inst)) { - /* - * Alert the user if they're trying to use legacy system - * calls. This suggests they need to update their C - * library and build against up to date kernel headers. - */ - if (switch_is_legacy_syscall(Inst)) - pr_warn_once("WARNING: A legacy syscall was made. Your userland needs updating.\n"); - /* - * We don't know how to handle the SWITCH and cannot - * safely ignore it, so treat all unknown switches - * (including breakpoints) as traps. - */ - force_sig(SIGTRAP, current); - return tail_end(State); - } - - local_irq_enable(); - -restart_syscall: - restart = 0; - sysnumber = regs->ctx.DX[0].U1; - - if (test_syscall_work()) - sysnumber = syscall_trace_enter(regs); - - /* Skip over the SWITCH instruction - or you just get 'stuck' on it! */ - step_over_switch(regs, Inst); - - if (sysnumber >= __NR_syscalls) { - pr_debug("unknown syscall number: %d\n", sysnumber); - syscall_entry = (LPSYSCALL) sys_ni_syscall; - } else { - syscall_entry = (LPSYSCALL) sys_call_table[sysnumber]; - } - - /* Use 64bit loads for speed. */ - a5_a6 = *(unsigned long long *)®s->ctx.DX[1]; - a3_a4 = *(unsigned long long *)®s->ctx.DX[2]; - a1_a2 = *(unsigned long long *)®s->ctx.DX[3]; - - /* here is the actual call to the syscall handler functions */ - regs->ctx.DX[0].U0 = syscall_entry(a1_a2, a3_a4, a5_a6); - - if (test_syscall_work()) - syscall_trace_leave(regs); - - State = tail_end_sys(State, sysnumber, &restart); - /* Handlerless restarts shouldn't go via userland */ - if (restart) - goto restart_syscall; - return State; -} - -TBIRES switchx_handler(TBIRES State, int SigNum, int Triggers, - int Inst, PTBI pTBI) -{ - struct pt_regs *regs = (struct pt_regs *)State.Sig.pCtx; - - /* - * This can be caused by any user process simply executing an unusual - * SWITCH instruction. If there's no DA, __TBIUnExpXXX will cause the - * thread to stop, so signal a SIGTRAP instead. - */ - head_end(State, ~INTS_OFF_MASK); - if (user_mode(regs)) - force_sig(SIGTRAP, current); - else - State = __TBIUnExpXXX(State, SigNum, Triggers, Inst, pTBI); - return tail_end(State); -} - -#ifdef CONFIG_METAG_META21 -TBIRES fpe_handler(TBIRES State, int SigNum, int Triggers, int Inst, PTBI pTBI) -{ - struct pt_regs *regs = (struct pt_regs *)State.Sig.pCtx; - unsigned int error_state = Triggers; - siginfo_t info; - - head_end(State, ~INTS_OFF_MASK); - - local_irq_enable(); - - info.si_signo = SIGFPE; - - if (error_state & TXSTAT_FPE_INVALID_BIT) - info.si_code = FPE_FLTINV; - else if (error_state & TXSTAT_FPE_DIVBYZERO_BIT) - info.si_code = FPE_FLTDIV; - else if (error_state & TXSTAT_FPE_OVERFLOW_BIT) - info.si_code = FPE_FLTOVF; - else if (error_state & TXSTAT_FPE_UNDERFLOW_BIT) - info.si_code = FPE_FLTUND; - else if (error_state & TXSTAT_FPE_INEXACT_BIT) - info.si_code = FPE_FLTRES; - else - info.si_code = FPE_FIXME; - info.si_errno = 0; - info.si_addr = (__force void __user *)regs->ctx.CurrPC; - force_sig_info(SIGFPE, &info, current); - - return tail_end(State); -} -#endif - -#ifdef CONFIG_METAG_SUSPEND_MEM -struct traps_context { - PTBIAPIFN fnSigs[TBID_SIGNUM_MAX + 1]; -}; - -static struct traps_context *metag_traps_context; - -int traps_save_context(void) -{ - unsigned long cpu = smp_processor_id(); - PTBI _pTBI = per_cpu(pTBI, cpu); - struct traps_context *context; - - context = kzalloc(sizeof(*context), GFP_ATOMIC); - if (!context) - return -ENOMEM; - - memcpy(context->fnSigs, (void *)_pTBI->fnSigs, sizeof(context->fnSigs)); - - metag_traps_context = context; - return 0; -} - -int traps_restore_context(void) -{ - unsigned long cpu = smp_processor_id(); - PTBI _pTBI = per_cpu(pTBI, cpu); - struct traps_context *context = metag_traps_context; - - metag_traps_context = NULL; - - memcpy((void *)_pTBI->fnSigs, context->fnSigs, sizeof(context->fnSigs)); - - kfree(context); - return 0; -} -#endif - -#ifdef CONFIG_SMP -static inline unsigned int _get_trigger_mask(void) -{ - unsigned long cpu = smp_processor_id(); - return per_cpu(trigger_mask, cpu); -} - -unsigned int get_trigger_mask(void) -{ - return _get_trigger_mask(); -} -EXPORT_SYMBOL(get_trigger_mask); - -static void set_trigger_mask(unsigned int mask) -{ - unsigned long cpu = smp_processor_id(); - per_cpu(trigger_mask, cpu) = mask; -} - -void arch_local_irq_enable(void) -{ - preempt_disable(); - arch_local_irq_restore(_get_trigger_mask()); - preempt_enable_no_resched(); -} -EXPORT_SYMBOL(arch_local_irq_enable); -#else -static void set_trigger_mask(unsigned int mask) -{ - global_trigger_mask = mask; -} -#endif - -void per_cpu_trap_init(unsigned long cpu) -{ - TBIRES int_context; - unsigned int thread = cpu_2_hwthread_id[cpu]; - - set_trigger_mask(TBI_INTS_INIT(thread) | /* interrupts */ - TBI_TRIG_BIT(TBID_SIGNUM_LWK) | /* low level kick */ - TBI_TRIG_BIT(TBID_SIGNUM_SW1)); - - /* non-priv - use current stack */ - int_context.Sig.pCtx = NULL; - /* Start with interrupts off */ - int_context.Sig.TrigMask = INTS_OFF_MASK; - int_context.Sig.SaveMask = 0; - - /* And call __TBIASyncTrigger() */ - __TBIASyncTrigger(int_context); -} - -void __init trap_init(void) -{ - unsigned long cpu = smp_processor_id(); - PTBI _pTBI = per_cpu(pTBI, cpu); - - _pTBI->fnSigs[TBID_SIGNUM_XXF] = fault_handler; - _pTBI->fnSigs[TBID_SIGNUM_SW0] = switchx_handler; - _pTBI->fnSigs[TBID_SIGNUM_SW1] = switch1_handler; - _pTBI->fnSigs[TBID_SIGNUM_SW2] = switchx_handler; - _pTBI->fnSigs[TBID_SIGNUM_SW3] = switchx_handler; - _pTBI->fnSigs[TBID_SIGNUM_LWK] = kick_handler; - -#ifdef CONFIG_METAG_META21 - _pTBI->fnSigs[TBID_SIGNUM_DFR] = __TBIHandleDFR; - _pTBI->fnSigs[TBID_SIGNUM_FPE] = fpe_handler; -#endif - - per_cpu_trap_init(cpu); -} - -void tbi_startup_interrupt(int irq) -{ - unsigned long cpu = smp_processor_id(); - PTBI _pTBI = per_cpu(pTBI, cpu); - - BUG_ON(irq > TBID_SIGNUM_MAX); - - /* For TR1 and TR2, the thread id is encoded in the irq number */ - if (irq >= TBID_SIGNUM_T10 && irq < TBID_SIGNUM_TR3) - cpu = hwthread_id_2_cpu[(irq - TBID_SIGNUM_T10) % 4]; - - set_trigger_mask(get_trigger_mask() | TBI_TRIG_BIT(irq)); - - _pTBI->fnSigs[irq] = trigger_handler; -} - -void tbi_shutdown_interrupt(int irq) -{ - unsigned long cpu = smp_processor_id(); - PTBI _pTBI = per_cpu(pTBI, cpu); - - BUG_ON(irq > TBID_SIGNUM_MAX); - - set_trigger_mask(get_trigger_mask() & ~TBI_TRIG_BIT(irq)); - - _pTBI->fnSigs[irq] = __TBIUnExpXXX; -} - -int ret_from_fork(TBIRES arg) -{ - struct task_struct *prev = arg.Switch.pPara; - struct task_struct *tsk = current; - struct pt_regs *regs = task_pt_regs(tsk); - int (*fn)(void *); - TBIRES Next; - - schedule_tail(prev); - - if (tsk->flags & PF_KTHREAD) { - fn = (void *)regs->ctx.DX[4].U1; - BUG_ON(!fn); - - fn((void *)regs->ctx.DX[3].U1); - } - - if (test_syscall_work()) - syscall_trace_leave(regs); - - preempt_disable(); - - Next.Sig.TrigMask = get_trigger_mask(); - Next.Sig.SaveMask = 0; - Next.Sig.pCtx = ®s->ctx; - - set_gateway_tls(current->thread.tls_ptr); - - preempt_enable_no_resched(); - - /* And interrupts should come back on when we resume the real usermode - * code. Call __TBIASyncResume() - */ - __TBIASyncResume(tail_end(Next)); - /* ASyncResume should NEVER return */ - BUG(); - return 0; -} - -void show_trace(struct task_struct *tsk, unsigned long *sp, - struct pt_regs *regs) -{ - unsigned long addr; -#ifdef CONFIG_FRAME_POINTER - unsigned long fp, fpnew; - unsigned long stack; -#endif - - if (regs && user_mode(regs)) - return; - - printk("\nCall trace: "); -#ifdef CONFIG_KALLSYMS - printk("\n"); -#endif - - if (!tsk) - tsk = current; - -#ifdef CONFIG_FRAME_POINTER - if (regs) { - print_ip_sym(regs->ctx.CurrPC); - fp = regs->ctx.AX[1].U0; - } else { - fp = __core_reg_get(A0FrP); - } - - /* detect when the frame pointer has been used for other purposes and - * doesn't point to the stack (it may point completely elsewhere which - * kstack_end may not detect). - */ - stack = (unsigned long)task_stack_page(tsk); - while (fp >= stack && fp + 8 <= stack + THREAD_SIZE) { - addr = __raw_readl((unsigned long *)(fp + 4)) - 4; - if (kernel_text_address(addr)) - print_ip_sym(addr); - else - break; - /* stack grows up, so frame pointers must decrease */ - fpnew = __raw_readl((unsigned long *)(fp + 0)); - if (fpnew >= fp) - break; - fp = fpnew; - } -#else - while (!kstack_end(sp)) { - addr = (*sp--) - 4; - if (kernel_text_address(addr)) - print_ip_sym(addr); - } -#endif - - printk("\n"); - - debug_show_held_locks(tsk); -} - -void show_stack(struct task_struct *tsk, unsigned long *sp) -{ - if (!tsk) - tsk = current; - if (tsk == current) - sp = (unsigned long *)current_stack_pointer; - else - sp = (unsigned long *)tsk->thread.kernel_context->AX[0].U0; - - show_trace(tsk, sp, NULL); -} diff --git a/arch/metag/kernel/user_gateway.S b/arch/metag/kernel/user_gateway.S deleted file mode 100644 index 7833fb8f9ddd6..0000000000000 --- a/arch/metag/kernel/user_gateway.S +++ /dev/null @@ -1,98 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Copyright (C) 2010 Imagination Technologies Ltd. - * - * This file contains code that can be accessed from userspace and can - * access certain kernel data structures without the overhead of a system - * call. - */ - -#include -#include - -/* - * User helpers. - * - * These are segment of kernel provided user code reachable from user space - * at a fixed address in kernel memory. This is used to provide user space - * with some operations which require kernel help because of unimplemented - * native feature and/or instructions in some Meta CPUs. The idea is for - * this code to be executed directly in user mode for best efficiency but - * which is too intimate with the kernel counter part to be left to user - * libraries. The kernel reserves the right to change this code as needed - * without warning. Only the entry points and their results are guaranteed - * to be stable. - * - * Each segment is 64-byte aligned. This mechanism should be used only for - * for things that are really small and justified, and not be abused freely. - */ - .text - .global ___user_gateway_start -___user_gateway_start: - - /* get_tls - * Offset: 0 - * Description: Get the TLS pointer for this process. - */ - .global ___kuser_get_tls - .type ___kuser_get_tls,function -___kuser_get_tls: - MOVT D1Ar1,#HI(USER_GATEWAY_PAGE + USER_GATEWAY_TLS) - ADD D1Ar1,D1Ar1,#LO(USER_GATEWAY_PAGE + USER_GATEWAY_TLS) - MOV D1Ar3,TXENABLE - AND D1Ar3,D1Ar3,#(TXENABLE_THREAD_BITS) - LSR D1Ar3,D1Ar3,#(TXENABLE_THREAD_S - 2) - GETD D0Re0,[D1Ar1+D1Ar3] -___kuser_get_tls_end: /* Beyond this point the read will complete */ - MOV PC,D1RtP - .size ___kuser_get_tls,.-___kuser_get_tls - .global ___kuser_get_tls_end - - /* cmpxchg - * Offset: 64 - * Description: Replace the value at 'ptr' with 'newval' if the current - * value is 'oldval'. Return zero if we succeeded, - * non-zero otherwise. - * - * Reference prototype: - * - * int __kuser_cmpxchg(int oldval, int newval, unsigned long *ptr) - * - */ - .balign 64 - .global ___kuser_cmpxchg - .type ___kuser_cmpxchg,function -___kuser_cmpxchg: -#ifdef CONFIG_SMP - /* - * We must use LNKGET/LNKSET with an SMP kernel because the other method - * does not provide atomicity across multiple CPUs. - */ -0: LNKGETD D0Re0,[D1Ar3] - CMP D0Re0,D1Ar1 - LNKSETDZ [D1Ar3],D0Ar2 - BNZ 1f - DEFR D0Re0,TXSTAT - ANDT D0Re0,D0Re0,#HI(0x3f000000) - CMPT D0Re0,#HI(0x02000000) - BNE 0b -#ifdef CONFIG_METAG_LNKGET_AROUND_CACHE - DCACHE [D1Ar3], D0Re0 -#endif -1: MOV D0Re0,#1 - XORZ D0Re0,D0Re0,D0Re0 - MOV PC,D1RtP -#else - GETD D0Re0,[D1Ar3] - CMP D0Re0,D1Ar1 - SETDZ [D1Ar3],D0Ar2 -___kuser_cmpxchg_end: /* Beyond this point the write will complete */ - MOV D0Re0,#1 - XORZ D0Re0,D0Re0,D0Re0 - MOV PC,D1RtP -#endif /* CONFIG_SMP */ - .size ___kuser_cmpxchg,.-___kuser_cmpxchg - .global ___kuser_cmpxchg_end - - .global ___user_gateway_end -___user_gateway_end: diff --git a/arch/metag/kernel/vmlinux.lds.S b/arch/metag/kernel/vmlinux.lds.S deleted file mode 100644 index 1efadae2ea8e3..0000000000000 --- a/arch/metag/kernel/vmlinux.lds.S +++ /dev/null @@ -1,74 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* ld script to make Meta Linux kernel */ - -#include -#include -#include - -#include - -OUTPUT_FORMAT("elf32-metag", "elf32-metag", "elf32-metag") -OUTPUT_ARCH(metag) -ENTRY(__start) - -_jiffies = _jiffies_64; -SECTIONS -{ - . = CONFIG_PAGE_OFFSET; - _text = .; - __text = .; - __stext = .; - HEAD_TEXT_SECTION - .text : { - TEXT_TEXT - SCHED_TEXT - CPUIDLE_TEXT - LOCK_TEXT - KPROBES_TEXT - IRQENTRY_TEXT - SOFTIRQENTRY_TEXT - *(.text.*) - *(.gnu.warning) - } - - __etext = .; /* End of text section */ - - __sdata = .; - RO_DATA_SECTION(PAGE_SIZE) - RW_DATA_SECTION(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE) - __edata = .; /* End of data section */ - - EXCEPTION_TABLE(16) - NOTES - - . = ALIGN(PAGE_SIZE); /* Init code and data */ - ___init_begin = .; - INIT_TEXT_SECTION(PAGE_SIZE) - INIT_DATA_SECTION(16) - - .init.arch.info : { - ___arch_info_begin = .; - *(.arch.info.init) - ___arch_info_end = .; - } - - PERCPU_SECTION(L1_CACHE_BYTES) - - ___init_end = .; - - BSS_SECTION(0, PAGE_SIZE, 0) - - __end = .; - - . = ALIGN(PAGE_SIZE); - __heap_start = .; - - DWARF_DEBUG - - /* When something in the kernel is NOT compiled as a module, the - * module cleanup code and data are put into these segments. Both - * can then be thrown away, as cleanup code is never called unless - * it's a module. - */ - DISCARDS -} diff --git a/arch/metag/lib/Makefile b/arch/metag/lib/Makefile deleted file mode 100644 index 3982850d692cd..0000000000000 --- a/arch/metag/lib/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# -# Makefile for Meta-specific library files. -# - -lib-y += usercopy.o -lib-y += copy_page.o -lib-y += clear_page.o -lib-y += memcpy.o -lib-y += memmove.o -lib-y += memset.o -lib-y += delay.o -lib-y += div64.o -lib-y += muldi3.o -lib-y += ashrdi3.o -lib-y += ashldi3.o -lib-y += lshrdi3.o -lib-y += divsi3.o -lib-y += modsi3.o -lib-y += cmpdi2.o -lib-y += ucmpdi2.o -lib-y += ip_fast_csum.o -lib-y += checksum.o diff --git a/arch/metag/lib/ashldi3.S b/arch/metag/lib/ashldi3.S deleted file mode 100644 index 5055df9e5c7bd..0000000000000 --- a/arch/metag/lib/ashldi3.S +++ /dev/null @@ -1,34 +0,0 @@ -! SPDX-License-Identifier: GPL-2.0 -! Copyright (C) 2012 by Imagination Technologies Ltd. -! -! 64-bit arithmetic shift left routine. -! - - .text - .global ___ashldi3 - .type ___ashldi3,function - -___ashldi3: - MOV D0Re0,D0Ar2 - MOV D1Re0,D1Ar1 - CMP D1Ar3,#0 ! COUNT == 0 - MOVEQ PC,D1RtP ! Yes, return - - SUBS D0Ar4,D1Ar3,#32 ! N = COUNT - 32 - BGE $L10 - -!! Shift < 32 - NEG D0Ar4,D0Ar4 ! N = - N - LSL D1Re0,D1Re0,D1Ar3 ! HI = HI << COUNT - LSR D0Ar6,D0Re0,D0Ar4 ! TMP= LO >> -(COUNT - 32) - OR D1Re0,D1Re0,D0Ar6 ! HI = HI | TMP - SWAP D0Ar4,D1Ar3 - LSL D0Re0,D0Re0,D0Ar4 ! LO = LO << COUNT - MOV PC,D1RtP - -$L10: -!! Shift >= 32 - LSL D1Re0,D0Re0,D0Ar4 ! HI = LO << N - MOV D0Re0,#0 ! LO = 0 - MOV PC,D1RtP - .size ___ashldi3,.-___ashldi3 diff --git a/arch/metag/lib/ashrdi3.S b/arch/metag/lib/ashrdi3.S deleted file mode 100644 index 0c838fd9da859..0000000000000 --- a/arch/metag/lib/ashrdi3.S +++ /dev/null @@ -1,34 +0,0 @@ -! SPDX-License-Identifier: GPL-2.0 -! Copyright (C) 2012 by Imagination Technologies Ltd. -! -! 64-bit arithmetic shift right routine. -! - - .text - .global ___ashrdi3 - .type ___ashrdi3,function - -___ashrdi3: - MOV D0Re0,D0Ar2 - MOV D1Re0,D1Ar1 - CMP D1Ar3,#0 ! COUNT == 0 - MOVEQ PC,D1RtP ! Yes, return - - MOV D0Ar4,D1Ar3 - SUBS D1Ar3,D1Ar3,#32 ! N = COUNT - 32 - BGE $L20 - -!! Shift < 32 - NEG D1Ar3,D1Ar3 ! N = - N - LSR D0Re0,D0Re0,D0Ar4 ! LO = LO >> COUNT - LSL D0Ar6,D1Re0,D1Ar3 ! TMP= HI << -(COUNT - 32) - OR D0Re0,D0Re0,D0Ar6 ! LO = LO | TMP - SWAP D1Ar3,D0Ar4 - ASR D1Re0,D1Re0,D1Ar3 ! HI = HI >> COUNT - MOV PC,D1RtP -$L20: -!! Shift >= 32 - ASR D0Re0,D1Re0,D1Ar3 ! LO = HI >> N - ASR D1Re0,D1Re0,#31 ! HI = HI >> 31 - MOV PC,D1RtP - .size ___ashrdi3,.-___ashrdi3 diff --git a/arch/metag/lib/checksum.c b/arch/metag/lib/checksum.c deleted file mode 100644 index 5d6a98a05e9d1..0000000000000 --- a/arch/metag/lib/checksum.c +++ /dev/null @@ -1,167 +0,0 @@ -/* - * - * 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, - * Arnt Gulbrandsen, - * Tom May, - * Andreas Schwab, - * 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 -#include - -#include - -static inline unsigned short from32to16(unsigned int 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 int do_csum(const unsigned char *buff, int len) -{ - int odd; - unsigned int result = 0; - - if (len <= 0) - goto out; - odd = 1 & (unsigned long) buff; - if (odd) { -#ifdef __LITTLE_ENDIAN - result += (*buff << 8); -#else - result = *buff; -#endif - len--; - buff++; - } - if (len >= 2) { - if (2 & (unsigned long) buff) { - result += *(unsigned short *) buff; - len -= 2; - buff += 2; - } - if (len >= 4) { - const unsigned char *end = buff + ((unsigned)len & ~3); - unsigned int carry = 0; - do { - unsigned int w = *(unsigned int *) buff; - buff += 4; - result += carry; - result += w; - carry = (w > result); - } while (buff < end); - result += carry; - result = (result & 0xffff) + (result >> 16); - } - if (len & 2) { - result += *(unsigned short *) buff; - buff += 2; - } - } - if (len & 1) -#ifdef __LITTLE_ENDIAN - result += *buff; -#else - result += (*buff << 8); -#endif - result = from32to16(result); - if (odd) - result = ((result >> 8) & 0xff) | ((result & 0xff) << 8); -out: - return result; -} -EXPORT_SYMBOL(ip_fast_csum); - -/* - * 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 - */ -__wsum csum_partial(const void *buff, int len, __wsum wsum) -{ - unsigned int sum = (__force unsigned int)wsum; - unsigned int result = do_csum(buff, len); - - /* add in old sum, and carry.. */ - result += sum; - if (sum > result) - result += 1; - return (__force __wsum)result; -} - -/* - * this routine is used for miscellaneous IP-like checksums, mainly - * in icmp.c - */ -__sum16 ip_compute_csum(const void *buff, int len) -{ - return (__force __sum16)~do_csum(buff, len); -} -EXPORT_SYMBOL(ip_compute_csum); - -/* - * copy from fs while checksumming, otherwise like csum_partial - */ -__wsum -csum_partial_copy_from_user(const void __user *src, void *dst, int len, - __wsum sum, int *csum_err) -{ - int missing; - - missing = __copy_from_user(dst, src, len); - if (missing) { - memset(dst + len - missing, 0, missing); - *csum_err = -EFAULT; - } else - *csum_err = 0; - - return csum_partial(dst, len, sum); -} -EXPORT_SYMBOL(csum_partial_copy_from_user); - -/* - * copy from ds while checksumming, otherwise like csum_partial - */ -__wsum -csum_partial_copy(const void *src, void *dst, int len, __wsum sum) -{ - memcpy(dst, src, len); - return csum_partial(dst, len, sum); -} -EXPORT_SYMBOL(csum_partial_copy); diff --git a/arch/metag/lib/clear_page.S b/arch/metag/lib/clear_page.S deleted file mode 100644 index 87756a5d13678..0000000000000 --- a/arch/metag/lib/clear_page.S +++ /dev/null @@ -1,18 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ - ! Copyright 2007,2008,2009 Imagination Technologies Ltd. - -#include - - .text - .global _clear_page - .type _clear_page,function - !! D1Ar1 - page -_clear_page: - MOV TXRPT,#((PAGE_SIZE / 8) - 1) - MOV D0Re0,#0 - MOV D1Re0,#0 -$Lclear_page_loop: - SETL [D1Ar1++],D0Re0,D1Re0 - BR $Lclear_page_loop - MOV PC,D1RtP - .size _clear_page,.-_clear_page diff --git a/arch/metag/lib/cmpdi2.S b/arch/metag/lib/cmpdi2.S deleted file mode 100644 index ab70bd94fd81e..0000000000000 --- a/arch/metag/lib/cmpdi2.S +++ /dev/null @@ -1,33 +0,0 @@ -! SPDX-License-Identifier: GPL-2.0 -! Copyright (C) 2012 by Imagination Technologies Ltd. -! -! 64-bit signed compare routine. -! - - .text - .global ___cmpdi2 - .type ___cmpdi2,function - -! low high -! s64 a (D0Ar2, D1Ar1) -! s64 b (D0Ar4, D1Ar3) -___cmpdi2: - ! start at 1 (equal) and conditionally increment or decrement - MOV D0Re0,#1 - - ! high words differ? - CMP D1Ar1,D1Ar3 - BNE $Lhigh_differ - - ! unsigned compare low words - CMP D0Ar2,D0Ar4 - SUBLO D0Re0,D0Re0,#1 - ADDHI D0Re0,D0Re0,#1 - MOV PC,D1RtP - -$Lhigh_differ: - ! signed compare high words - SUBLT D0Re0,D0Re0,#1 - ADDGT D0Re0,D0Re0,#1 - MOV PC,D1RtP - .size ___cmpdi2,.-___cmpdi2 diff --git a/arch/metag/lib/copy_page.S b/arch/metag/lib/copy_page.S deleted file mode 100644 index abbc75e94374c..0000000000000 --- a/arch/metag/lib/copy_page.S +++ /dev/null @@ -1,21 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ - ! Copyright 2007,2008 Imagination Technologies Ltd. - -#include - - .text - .global _copy_page - .type _copy_page,function - !! D1Ar1 - to - !! D0Ar2 - from -_copy_page: - MOV D0FrT,#PAGE_SIZE -$Lcopy_page_loop: - GETL D0Re0,D1Re0,[D0Ar2++] - GETL D0Ar6,D1Ar5,[D0Ar2++] - SETL [D1Ar1++],D0Re0,D1Re0 - SETL [D1Ar1++],D0Ar6,D1Ar5 - SUBS D0FrT,D0FrT,#16 - BNZ $Lcopy_page_loop - MOV PC,D1RtP - .size _copy_page,.-_copy_page diff --git a/arch/metag/lib/delay.c b/arch/metag/lib/delay.c deleted file mode 100644 index 6754012a261ff..0000000000000 --- a/arch/metag/lib/delay.c +++ /dev/null @@ -1,57 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Precise Delay Loops for Meta - * - * Copyright (C) 1993 Linus Torvalds - * Copyright (C) 1997 Martin Mares - * Copyright (C) 2007,2009 Imagination Technologies Ltd. - * - */ - -#include -#include -#include - -#include -#include - -/* - * TXTACTCYC is only 24 bits, so on chips with fast clocks it will wrap - * many times per-second. If it does wrap __delay will return prematurely, - * but this is only likely with large delay values. - * - * We also can't implement read_current_timer() with TXTACTCYC due to - * this wrapping behaviour. - */ -#define rdtimer(t) t = __core_reg_get(TXTACTCYC) - -void __delay(unsigned long loops) -{ - unsigned long bclock, now; - - rdtimer(bclock); - do { - asm("NOP"); - rdtimer(now); - } while ((now-bclock) < loops); -} -EXPORT_SYMBOL(__delay); - -inline void __const_udelay(unsigned long xloops) -{ - u64 loops = (u64)xloops * (u64)loops_per_jiffy * HZ; - __delay(loops >> 32); -} -EXPORT_SYMBOL(__const_udelay); - -void __udelay(unsigned long usecs) -{ - __const_udelay(usecs * 0x000010c7); /* 2**32 / 1000000 (rounded up) */ -} -EXPORT_SYMBOL(__udelay); - -void __ndelay(unsigned long nsecs) -{ - __const_udelay(nsecs * 0x00005); /* 2**32 / 1000000000 (rounded up) */ -} -EXPORT_SYMBOL(__ndelay); diff --git a/arch/metag/lib/div64.S b/arch/metag/lib/div64.S deleted file mode 100644 index 55eece273a6b8..0000000000000 --- a/arch/metag/lib/div64.S +++ /dev/null @@ -1,109 +0,0 @@ -! SPDX-License-Identifier: GPL-2.0 -! Copyright (C) 2012 Imagination Technologies Ltd. -! -! Signed/unsigned 64-bit division routines. -! - - .text - .global _div_u64 - .type _div_u64,function - -_div_u64: -$L1: - ORS A0.3,D1Ar3,D0Ar4 - BNE $L3 -$L2: - MOV D0Re0,D0Ar2 - MOV D1Re0,D1Ar1 - MOV PC,D1RtP -$L3: - CMP D1Ar3,D1Ar1 - CMPEQ D0Ar4,D0Ar2 - MOV D0Re0,#1 - MOV D1Re0,#0 - BHS $L6 -$L4: - ADDS D0Ar6,D0Ar4,D0Ar4 - ADD D1Ar5,D1Ar3,D1Ar3 - ADDCS D1Ar5,D1Ar5,#1 - CMP D1Ar5,D1Ar3 - CMPEQ D0Ar6,D0Ar4 - BLO $L6 -$L5: - MOV D0Ar4,D0Ar6 - MOV D1Ar3,D1Ar5 - ADDS D0Re0,D0Re0,D0Re0 - ADD D1Re0,D1Re0,D1Re0 - ADDCS D1Re0,D1Re0,#1 - CMP D1Ar3,D1Ar1 - CMPEQ D0Ar4,D0Ar2 - BLO $L4 -$L6: - ORS A0.3,D1Re0,D0Re0 - MOV D0Ar6,#0 - MOV D1Ar5,D0Ar6 - BEQ $L10 -$L7: - CMP D1Ar1,D1Ar3 - CMPEQ D0Ar2,D0Ar4 - BLO $L9 -$L8: - ADDS D0Ar6,D0Ar6,D0Re0 - ADD D1Ar5,D1Ar5,D1Re0 - ADDCS D1Ar5,D1Ar5,#1 - - SUBS D0Ar2,D0Ar2,D0Ar4 - SUB D1Ar1,D1Ar1,D1Ar3 - SUBCS D1Ar1,D1Ar1,#1 -$L9: - LSL A0.3,D1Re0,#31 - LSR D0Re0,D0Re0,#1 - LSR D1Re0,D1Re0,#1 - OR D0Re0,D0Re0,A0.3 - LSL A0.3,D1Ar3,#31 - LSR D0Ar4,D0Ar4,#1 - LSR D1Ar3,D1Ar3,#1 - OR D0Ar4,D0Ar4,A0.3 - ORS A0.3,D1Re0,D0Re0 - BNE $L7 -$L10: - MOV D0Re0,D0Ar6 - MOV D1Re0,D1Ar5 - MOV PC,D1RtP - .size _div_u64,.-_div_u64 - - .text - .global _div_s64 - .type _div_s64,function -_div_s64: - MSETL [A0StP],D0FrT,D0.5 - XOR D0.5,D0Ar2,D0Ar4 - XOR D1.5,D1Ar1,D1Ar3 - TSTT D1Ar1,#HI(0x80000000) - BZ $L25 - - NEGS D0Ar2,D0Ar2 - NEG D1Ar1,D1Ar1 - SUBCS D1Ar1,D1Ar1,#1 -$L25: - TSTT D1Ar3,#HI(0x80000000) - BZ $L27 - - NEGS D0Ar4,D0Ar4 - NEG D1Ar3,D1Ar3 - SUBCS D1Ar3,D1Ar3,#1 -$L27: - CALLR D1RtP,_div_u64 - TSTT D1.5,#HI(0x80000000) - BZ $L29 - - NEGS D0Re0,D0Re0 - NEG D1Re0,D1Re0 - SUBCS D1Re0,D1Re0,#1 -$L29: - - GETL D0FrT,D1RtP,[A0StP+#(-16)] - GETL D0.5,D1.5,[A0StP+#(-8)] - SUB A0StP,A0StP,#16 - MOV PC,D1RtP - .size _div_s64,.-_div_s64 diff --git a/arch/metag/lib/divsi3.S b/arch/metag/lib/divsi3.S deleted file mode 100644 index 9e31abefb1606..0000000000000 --- a/arch/metag/lib/divsi3.S +++ /dev/null @@ -1,101 +0,0 @@ -! SPDX-License-Identifier: GPL-2.0 -! Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 -! Imagination Technologies Ltd -! -! Integer divide routines. -! - - .text - .global ___udivsi3 - .type ___udivsi3,function - .align 2 -___udivsi3: -!! -!! Since core is signed divide case, just set control variable -!! - MOV D1Re0,D0Ar2 ! Au already in A1Ar1, Bu -> D1Re0 - MOV D0Re0,#0 ! Result is 0 - MOV D0Ar4,#0 ! Return positive result - B $LIDMCUStart - .size ___udivsi3,.-___udivsi3 - -!! -!! 32-bit division signed i/p - passed signed 32-bit numbers -!! - .global ___divsi3 - .type ___divsi3,function - .align 2 -___divsi3: -!! -!! A already in D1Ar1, B already in D0Ar2 -> make B abs(B) -!! - MOV D1Re0,D0Ar2 ! A already in A1Ar1, B -> D1Re0 - MOV D0Re0,#0 ! Result is 0 - XOR D0Ar4,D1Ar1,D1Re0 ! D0Ar4 -ive if result is -ive - ABS D1Ar1,D1Ar1 ! abs(A) -> Au - ABS D1Re0,D1Re0 ! abs(B) -> Bu -$LIDMCUStart: - CMP D1Ar1,D1Re0 ! Is ( Au > Bu )? - LSR D1Ar3,D1Ar1,#2 ! Calculate (Au & (~3)) >> 2 - CMPHI D1Re0,D1Ar3 ! OR ( (Au & (~3)) <= (Bu << 2) )? - LSLSHI D1Ar3,D1Re0,#1 ! Buq = Bu << 1 - BLS $LIDMCUSetup ! Yes: Do normal divide -!! -!! Quick divide setup can assume that CurBit only needs to start at 2 -!! -$LIDMCQuick: - CMP D1Ar1,D1Ar3 ! ( A >= Buq )? - ADDCC D0Re0,D0Re0,#2 ! If yes result += 2 - SUBCC D1Ar1,D1Ar1,D1Ar3 ! and A -= Buq - CMP D1Ar1,D1Re0 ! ( A >= Bu )? - ADDCC D0Re0,D0Re0,#1 ! If yes result += 1 - SUBCC D1Ar1,D1Ar1,D1Re0 ! and A -= Bu - ORS D0Ar4,D0Ar4,D0Ar4 ! Return neg result? - NEG D0Ar2,D0Re0 ! Calculate neg result - MOVMI D0Re0,D0Ar2 ! Yes: Take neg result -$LIDMCRet: - MOV PC,D1RtP -!! -!! Setup for general unsigned divide code -!! -!! D0Re0 is used to form the result, already set to Zero -!! D1Re0 is the input Bu value, this gets trashed -!! D0Ar6 is curbit which is set to 1 at the start and shifted up -!! D0Ar4 is negative if we should return a negative result -!! D1Ar1 is the input Au value, eventually this holds the remainder -!! -$LIDMCUSetup: - CMP D1Ar1,D1Re0 ! Is ( Au < Bu )? - MOV D0Ar6,#1 ! Set curbit to 1 - BCS $LIDMCRet ! Yes: Return 0 remainder Au -!! -!! Calculate alignment using FFB instruction -!! - FFB D1Ar5,D1Ar1 ! Find first bit of Au - ANDN D1Ar5,D1Ar5,#31 ! Handle exceptional case. - ORN D1Ar5,D1Ar5,#31 ! if N bit set, set to 31 - FFB D1Ar3,D1Re0 ! Find first bit of Bu - ANDN D1Ar3,D1Ar3,#31 ! Handle exceptional case. - ORN D1Ar3,D1Ar3,#31 ! if N bit set, set to 31 - SUBS D1Ar3,D1Ar5,D1Ar3 ! calculate diff, ffbA - ffbB - MOV D0Ar2,D1Ar3 ! copy into bank 0 - LSLGT D1Re0,D1Re0,D1Ar3 ! ( > 0) ? left shift B - LSLGT D0Ar6,D0Ar6,D0Ar2 ! ( > 0) ? left shift curbit -!! -!! Now we start the divide proper, logic is -!! -!! if ( A >= B ) add curbit to result and subtract B from A -!! shift curbit and B down by 1 in either case -!! -$LIDMCLoop: - CMP D1Ar1, D1Re0 ! ( A >= B )? - ADDCC D0Re0, D0Re0, D0Ar6 ! If yes result += curbit - SUBCC D1Ar1, D1Ar1, D1Re0 ! and A -= B - LSRS D0Ar6, D0Ar6, #1 ! Shift down curbit, is it zero? - LSR D1Re0, D1Re0, #1 ! Shift down B - BNZ $LIDMCLoop ! Was single bit in curbit lost? - ORS D0Ar4,D0Ar4,D0Ar4 ! Return neg result? - NEG D0Ar2,D0Re0 ! Calculate neg result - MOVMI D0Re0,D0Ar2 ! Yes: Take neg result - MOV PC,D1RtP - .size ___divsi3,.-___divsi3 diff --git a/arch/metag/lib/ip_fast_csum.S b/arch/metag/lib/ip_fast_csum.S deleted file mode 100644 index 441f489d6a81c..0000000000000 --- a/arch/metag/lib/ip_fast_csum.S +++ /dev/null @@ -1,33 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ - - .text -/* - * This is a version of ip_compute_csum() optimized for IP headers, - * which always checksum on 4 octet boundaries. - * - * extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl); - * - */ - .global _ip_fast_csum - .type _ip_fast_csum,function -_ip_fast_csum: - !! TXRPT needs loops - 1 - SUBS TXRPT,D0Ar2,#1 - MOV D0Re0,#0 - BLO $Lfast_csum_exit -$Lfast_csum_loop: - GETD D1Ar3,[D1Ar1++] - ADDS D0Re0,D0Re0,D1Ar3 - ADDCS D0Re0,D0Re0,#1 - BR $Lfast_csum_loop - LSR D0Ar4,D0Re0,#16 - AND D0Re0,D0Re0,#0xffff - AND D0Ar4,D0Ar4,#0xffff - ADD D0Re0,D0Re0,D0Ar4 - LSR D0Ar4,D0Re0,#16 - ADD D0Re0,D0Re0,D0Ar4 - XOR D0Re0,D0Re0,#-1 - AND D0Re0,D0Re0,#0xffff -$Lfast_csum_exit: - MOV PC,D1RtP - .size _ip_fast_csum,.-_ip_fast_csum diff --git a/arch/metag/lib/lshrdi3.S b/arch/metag/lib/lshrdi3.S deleted file mode 100644 index cf7ffc9b377fe..0000000000000 --- a/arch/metag/lib/lshrdi3.S +++ /dev/null @@ -1,34 +0,0 @@ -! SPDX-License-Identifier: GPL-2.0 -! Copyright (C) 2012 by Imagination Technologies Ltd. -! -! 64-bit logical shift right routine. -! - - .text - .global ___lshrdi3 - .type ___lshrdi3,function - -___lshrdi3: - MOV D0Re0,D0Ar2 - MOV D1Re0,D1Ar1 - CMP D1Ar3,#0 ! COUNT == 0 - MOVEQ PC,D1RtP ! Yes, return - - MOV D0Ar4,D1Ar3 - SUBS D1Ar3,D1Ar3,#32 ! N = COUNT - 32 - BGE $L30 - -!! Shift < 32 - NEG D1Ar3,D1Ar3 ! N = - N - LSR D0Re0,D0Re0,D0Ar4 ! LO = LO >> COUNT - LSL D0Ar6,D1Re0,D1Ar3 ! TMP= HI << -(COUNT - 32) - OR D0Re0,D0Re0,D0Ar6 ! LO = LO | TMP - SWAP D1Ar3,D0Ar4 - LSR D1Re0,D1Re0,D1Ar3 ! HI = HI >> COUNT - MOV PC,D1RtP -$L30: -!! Shift >= 32 - LSR D0Re0,D1Re0,D1Ar3 ! LO = HI >> N - MOV D1Re0,#0 ! HI = 0 - MOV PC,D1RtP - .size ___lshrdi3,.-___lshrdi3 diff --git a/arch/metag/lib/memcpy.S b/arch/metag/lib/memcpy.S deleted file mode 100644 index c2e8395f94562..0000000000000 --- a/arch/metag/lib/memcpy.S +++ /dev/null @@ -1,186 +0,0 @@ -! SPDX-License-Identifier: GPL-2.0 -! Copyright (C) 2008-2012 Imagination Technologies Ltd. - - .text - .global _memcpy - .type _memcpy,function -! D1Ar1 dst -! D0Ar2 src -! D1Ar3 cnt -! D0Re0 dst -_memcpy: - CMP D1Ar3, #16 - MOV A1.2, D0Ar2 ! source pointer - MOV A0.2, D1Ar1 ! destination pointer - MOV A0.3, D1Ar1 ! for return value -! If there are less than 16 bytes to copy use the byte copy loop - BGE $Llong_copy - -$Lbyte_copy: -! Simply copy a byte at a time - SUBS TXRPT, D1Ar3, #1 - BLT $Lend -$Lloop_byte: - GETB D1Re0, [A1.2++] - SETB [A0.2++], D1Re0 - BR $Lloop_byte - -$Lend: -! Finally set return value and return - MOV D0Re0, A0.3 - MOV PC, D1RtP - -$Llong_copy: - ANDS D1Ar5, D1Ar1, #7 ! test destination alignment - BZ $Laligned_dst - -! The destination address is not 8 byte aligned. We will copy bytes from -! the source to the destination until the remaining data has an 8 byte -! destination address alignment (i.e we should never copy more than 7 -! bytes here). -$Lalign_dst: - GETB D0Re0, [A1.2++] - ADD D1Ar5, D1Ar5, #1 ! dest is aligned when D1Ar5 reaches #8 - SUB D1Ar3, D1Ar3, #1 ! decrement count of remaining bytes - SETB [A0.2++], D0Re0 - CMP D1Ar5, #8 - BNE $Lalign_dst - -! We have at least (16 - 7) = 9 bytes to copy - calculate the number of 8 byte -! blocks, then jump to the unaligned copy loop or fall through to the aligned -! copy loop as appropriate. -$Laligned_dst: - MOV D0Ar4, A1.2 - LSR D1Ar5, D1Ar3, #3 ! D1Ar5 = number of 8 byte blocks - ANDS D0Ar4, D0Ar4, #7 ! test source alignment - BNZ $Lunaligned_copy ! if unaligned, use unaligned copy loop - -! Both source and destination are 8 byte aligned - the easy case. -$Laligned_copy: - LSRS D1Ar5, D1Ar3, #5 ! D1Ar5 = number of 32 byte blocks - BZ $Lbyte_copy - SUB TXRPT, D1Ar5, #1 - -$Laligned_32: - GETL D0Re0, D1Re0, [A1.2++] - GETL D0Ar6, D1Ar5, [A1.2++] - SETL [A0.2++], D0Re0, D1Re0 - SETL [A0.2++], D0Ar6, D1Ar5 - GETL D0Re0, D1Re0, [A1.2++] - GETL D0Ar6, D1Ar5, [A1.2++] - SETL [A0.2++], D0Re0, D1Re0 - SETL [A0.2++], D0Ar6, D1Ar5 - BR $Laligned_32 - -! If there are any remaining bytes use the byte copy loop, otherwise we are done - ANDS D1Ar3, D1Ar3, #0x1f - BNZ $Lbyte_copy - B $Lend - -! The destination is 8 byte aligned but the source is not, and there are 8 -! or more bytes to be copied. -$Lunaligned_copy: -! Adjust the source pointer (A1.2) to the 8 byte boundary before its -! current value - MOV D0Ar4, A1.2 - MOV D0Ar6, A1.2 - ANDMB D0Ar4, D0Ar4, #0xfff8 - MOV A1.2, D0Ar4 -! Save the number of bytes of mis-alignment in D0Ar4 for use later - SUBS D0Ar6, D0Ar6, D0Ar4 - MOV D0Ar4, D0Ar6 -! if there is no mis-alignment after all, use the aligned copy loop - BZ $Laligned_copy - -! prefetch 8 bytes - GETL D0Re0, D1Re0, [A1.2] - - SUB TXRPT, D1Ar5, #1 - -! There are 3 mis-alignment cases to be considered. Less than 4 bytes, exactly -! 4 bytes, and more than 4 bytes. - CMP D0Ar6, #4 - BLT $Lunaligned_1_2_3 ! use 1-3 byte mis-alignment loop - BZ $Lunaligned_4 ! use 4 byte mis-alignment loop - -! The mis-alignment is more than 4 bytes -$Lunaligned_5_6_7: - SUB D0Ar6, D0Ar6, #4 -! Calculate the bit offsets required for the shift operations necesssary -! to align the data. -! D0Ar6 = bit offset, D1Ar5 = (32 - bit offset) - MULW D0Ar6, D0Ar6, #8 - MOV D1Ar5, #32 - SUB D1Ar5, D1Ar5, D0Ar6 -! Move data 4 bytes before we enter the main loop - MOV D0Re0, D1Re0 - -$Lloop_5_6_7: - GETL D0Ar2, D1Ar1, [++A1.2] -! form 64-bit data in D0Re0, D1Re0 - LSR D0Re0, D0Re0, D0Ar6 - MOV D1Re0, D0Ar2 - LSL D1Re0, D1Re0, D1Ar5 - ADD D0Re0, D0Re0, D1Re0 - - LSR D0Ar2, D0Ar2, D0Ar6 - LSL D1Re0, D1Ar1, D1Ar5 - ADD D1Re0, D1Re0, D0Ar2 - - SETL [A0.2++], D0Re0, D1Re0 - MOV D0Re0, D1Ar1 - BR $Lloop_5_6_7 - - B $Lunaligned_end - -$Lunaligned_1_2_3: -! Calculate the bit offsets required for the shift operations necesssary -! to align the data. -! D0Ar6 = bit offset, D1Ar5 = (32 - bit offset) - MULW D0Ar6, D0Ar6, #8 - MOV D1Ar5, #32 - SUB D1Ar5, D1Ar5, D0Ar6 - -$Lloop_1_2_3: -! form 64-bit data in D0Re0,D1Re0 - LSR D0Re0, D0Re0, D0Ar6 - LSL D1Ar1, D1Re0, D1Ar5 - ADD D0Re0, D0Re0, D1Ar1 - MOV D0Ar2, D1Re0 - LSR D0FrT, D0Ar2, D0Ar6 - GETL D0Ar2, D1Ar1, [++A1.2] - - MOV D1Re0, D0Ar2 - LSL D1Re0, D1Re0, D1Ar5 - ADD D1Re0, D1Re0, D0FrT - - SETL [A0.2++], D0Re0, D1Re0 - MOV D0Re0, D0Ar2 - MOV D1Re0, D1Ar1 - BR $Lloop_1_2_3 - - B $Lunaligned_end - -! The 4 byte mis-alignment case - this does not require any shifting, just a -! shuffling of registers. -$Lunaligned_4: - MOV D0Re0, D1Re0 -$Lloop_4: - GETL D0Ar2, D1Ar1, [++A1.2] - MOV D1Re0, D0Ar2 - SETL [A0.2++], D0Re0, D1Re0 - MOV D0Re0, D1Ar1 - BR $Lloop_4 - -$Lunaligned_end: -! If there are no remaining bytes to copy, we are done. - ANDS D1Ar3, D1Ar3, #7 - BZ $Lend -! Re-adjust the source pointer (A1.2) back to the actual (unaligned) byte -! address of the remaining bytes, and fall through to the byte copy loop. - MOV D0Ar6, A1.2 - ADD D1Ar5, D0Ar4, D0Ar6 - MOV A1.2, D1Ar5 - B $Lbyte_copy - - .size _memcpy,.-_memcpy diff --git a/arch/metag/lib/memmove.S b/arch/metag/lib/memmove.S deleted file mode 100644 index 934abda0e6800..0000000000000 --- a/arch/metag/lib/memmove.S +++ /dev/null @@ -1,346 +0,0 @@ -! SPDX-License-Identifier: GPL-2.0 -! Copyright (C) 2008-2012 Imagination Technologies Ltd. - - .text - .global _memmove - .type _memmove,function -! D1Ar1 dst -! D0Ar2 src -! D1Ar3 cnt -! D0Re0 dst -_memmove: - CMP D1Ar3, #0 - MOV D0Re0, D1Ar1 - BZ $LEND2 - MSETL [A0StP], D0.5, D0.6, D0.7 - MOV D1Ar5, D0Ar2 - CMP D1Ar1, D1Ar5 - BLT $Lforwards_copy - SUB D0Ar4, D1Ar1, D1Ar3 - ADD D0Ar4, D0Ar4, #1 - CMP D0Ar2, D0Ar4 - BLT $Lforwards_copy - ! should copy backwards - MOV D1Re0, D0Ar2 - ! adjust pointer to the end of mem - ADD D0Ar2, D1Re0, D1Ar3 - ADD D1Ar1, D1Ar1, D1Ar3 - - MOV A1.2, D0Ar2 - MOV A0.2, D1Ar1 - CMP D1Ar3, #8 - BLT $Lbbyte_loop - - MOV D0Ar4, D0Ar2 - MOV D1Ar5, D1Ar1 - - ! test 8 byte alignment - ANDS D1Ar5, D1Ar5, #7 - BNE $Lbdest_unaligned - - ANDS D0Ar4, D0Ar4, #7 - BNE $Lbsrc_unaligned - - LSR D1Ar5, D1Ar3, #3 - -$Lbaligned_loop: - GETL D0Re0, D1Re0, [--A1.2] - SETL [--A0.2], D0Re0, D1Re0 - SUBS D1Ar5, D1Ar5, #1 - BNE $Lbaligned_loop - - ANDS D1Ar3, D1Ar3, #7 - BZ $Lbbyte_loop_exit -$Lbbyte_loop: - GETB D1Re0, [--A1.2] - SETB [--A0.2], D1Re0 - SUBS D1Ar3, D1Ar3, #1 - BNE $Lbbyte_loop -$Lbbyte_loop_exit: - MOV D0Re0, A0.2 -$LEND: - SUB A0.2, A0StP, #24 - MGETL D0.5, D0.6, D0.7, [A0.2] - SUB A0StP, A0StP, #24 -$LEND2: - MOV PC, D1RtP - -$Lbdest_unaligned: - GETB D0Re0, [--A1.2] - SETB [--A0.2], D0Re0 - SUBS D1Ar5, D1Ar5, #1 - SUB D1Ar3, D1Ar3, #1 - BNE $Lbdest_unaligned - CMP D1Ar3, #8 - BLT $Lbbyte_loop -$Lbsrc_unaligned: - LSR D1Ar5, D1Ar3, #3 - ! adjust A1.2 - MOV D0Ar4, A1.2 - ! save original address - MOV D0Ar6, A1.2 - - ADD D0Ar4, D0Ar4, #7 - ANDMB D0Ar4, D0Ar4, #0xfff8 - ! new address is the 8-byte aligned one above the original - MOV A1.2, D0Ar4 - - ! A0.2 dst 64-bit is aligned - ! measure the gap size - SUB D0Ar6, D0Ar4, D0Ar6 - MOVS D0Ar4, D0Ar6 - ! keep this information for the later adjustment - ! both aligned - BZ $Lbaligned_loop - - ! prefetch - GETL D0Re0, D1Re0, [--A1.2] - - CMP D0Ar6, #4 - BLT $Lbunaligned_1_2_3 - ! 32-bit aligned - BZ $Lbaligned_4 - - SUB D0Ar6, D0Ar6, #4 - ! D1.6 stores the gap size in bits - MULW D1.6, D0Ar6, #8 - MOV D0.6, #32 - ! D0.6 stores the complement of the gap size - SUB D0.6, D0.6, D1.6 - -$Lbunaligned_5_6_7: - GETL D0.7, D1.7, [--A1.2] - ! form 64-bit data in D0Re0, D1Re0 - MOV D1Re0, D0Re0 - ! D1Re0 << gap-size - LSL D1Re0, D1Re0, D1.6 - MOV D0Re0, D1.7 - ! D0Re0 >> complement - LSR D0Re0, D0Re0, D0.6 - MOV D1.5, D0Re0 - ! combine the both - ADD D1Re0, D1Re0, D1.5 - - MOV D1.5, D1.7 - LSL D1.5, D1.5, D1.6 - MOV D0Re0, D0.7 - LSR D0Re0, D0Re0, D0.6 - MOV D0.5, D1.5 - ADD D0Re0, D0Re0, D0.5 - - SETL [--A0.2], D0Re0, D1Re0 - MOV D0Re0, D0.7 - MOV D1Re0, D1.7 - SUBS D1Ar5, D1Ar5, #1 - BNE $Lbunaligned_5_6_7 - - ANDS D1Ar3, D1Ar3, #7 - BZ $Lbbyte_loop_exit - ! Adjust A1.2 - ! A1.2 <- A1.2 +8 - gapsize - ADD A1.2, A1.2, #8 - SUB A1.2, A1.2, D0Ar4 - B $Lbbyte_loop - -$Lbunaligned_1_2_3: - MULW D1.6, D0Ar6, #8 - MOV D0.6, #32 - SUB D0.6, D0.6, D1.6 - -$Lbunaligned_1_2_3_loop: - GETL D0.7, D1.7, [--A1.2] - ! form 64-bit data in D0Re0, D1Re0 - LSL D1Re0, D1Re0, D1.6 - ! save D0Re0 for later use - MOV D0.5, D0Re0 - LSR D0Re0, D0Re0, D0.6 - MOV D1.5, D0Re0 - ADD D1Re0, D1Re0, D1.5 - - ! orignal data in D0Re0 - MOV D1.5, D0.5 - LSL D1.5, D1.5, D1.6 - MOV D0Re0, D1.7 - LSR D0Re0, D0Re0, D0.6 - MOV D0.5, D1.5 - ADD D0Re0, D0Re0, D0.5 - - SETL [--A0.2], D0Re0, D1Re0 - MOV D0Re0, D0.7 - MOV D1Re0, D1.7 - SUBS D1Ar5, D1Ar5, #1 - BNE $Lbunaligned_1_2_3_loop - - ANDS D1Ar3, D1Ar3, #7 - BZ $Lbbyte_loop_exit - ! Adjust A1.2 - ADD A1.2, A1.2, #8 - SUB A1.2, A1.2, D0Ar4 - B $Lbbyte_loop - -$Lbaligned_4: - GETL D0.7, D1.7, [--A1.2] - MOV D1Re0, D0Re0 - MOV D0Re0, D1.7 - SETL [--A0.2], D0Re0, D1Re0 - MOV D0Re0, D0.7 - MOV D1Re0, D1.7 - SUBS D1Ar5, D1Ar5, #1 - BNE $Lbaligned_4 - ANDS D1Ar3, D1Ar3, #7 - BZ $Lbbyte_loop_exit - ! Adjust A1.2 - ADD A1.2, A1.2, #8 - SUB A1.2, A1.2, D0Ar4 - B $Lbbyte_loop - -$Lforwards_copy: - MOV A1.2, D0Ar2 - MOV A0.2, D1Ar1 - CMP D1Ar3, #8 - BLT $Lfbyte_loop - - MOV D0Ar4, D0Ar2 - MOV D1Ar5, D1Ar1 - - ANDS D1Ar5, D1Ar5, #7 - BNE $Lfdest_unaligned - - ANDS D0Ar4, D0Ar4, #7 - BNE $Lfsrc_unaligned - - LSR D1Ar5, D1Ar3, #3 - -$Lfaligned_loop: - GETL D0Re0, D1Re0, [A1.2++] - SUBS D1Ar5, D1Ar5, #1 - SETL [A0.2++], D0Re0, D1Re0 - BNE $Lfaligned_loop - - ANDS D1Ar3, D1Ar3, #7 - BZ $Lfbyte_loop_exit -$Lfbyte_loop: - GETB D1Re0, [A1.2++] - SETB [A0.2++], D1Re0 - SUBS D1Ar3, D1Ar3, #1 - BNE $Lfbyte_loop -$Lfbyte_loop_exit: - MOV D0Re0, D1Ar1 - B $LEND - -$Lfdest_unaligned: - GETB D0Re0, [A1.2++] - ADD D1Ar5, D1Ar5, #1 - SUB D1Ar3, D1Ar3, #1 - SETB [A0.2++], D0Re0 - CMP D1Ar5, #8 - BNE $Lfdest_unaligned - CMP D1Ar3, #8 - BLT $Lfbyte_loop -$Lfsrc_unaligned: - ! adjust A1.2 - LSR D1Ar5, D1Ar3, #3 - - MOV D0Ar4, A1.2 - MOV D0Ar6, A1.2 - ANDMB D0Ar4, D0Ar4, #0xfff8 - MOV A1.2, D0Ar4 - - ! A0.2 dst 64-bit is aligned - SUB D0Ar6, D0Ar6, D0Ar4 - ! keep the information for the later adjustment - MOVS D0Ar4, D0Ar6 - - ! both aligned - BZ $Lfaligned_loop - - ! prefetch - GETL D0Re0, D1Re0, [A1.2] - - CMP D0Ar6, #4 - BLT $Lfunaligned_1_2_3 - BZ $Lfaligned_4 - - SUB D0Ar6, D0Ar6, #4 - MULW D0.6, D0Ar6, #8 - MOV D1.6, #32 - SUB D1.6, D1.6, D0.6 - -$Lfunaligned_5_6_7: - GETL D0.7, D1.7, [++A1.2] - ! form 64-bit data in D0Re0, D1Re0 - MOV D0Re0, D1Re0 - LSR D0Re0, D0Re0, D0.6 - MOV D1Re0, D0.7 - LSL D1Re0, D1Re0, D1.6 - MOV D0.5, D1Re0 - ADD D0Re0, D0Re0, D0.5 - - MOV D0.5, D0.7 - LSR D0.5, D0.5, D0.6 - MOV D1Re0, D1.7 - LSL D1Re0, D1Re0, D1.6 - MOV D1.5, D0.5 - ADD D1Re0, D1Re0, D1.5 - - SETL [A0.2++], D0Re0, D1Re0 - MOV D0Re0, D0.7 - MOV D1Re0, D1.7 - SUBS D1Ar5, D1Ar5, #1 - BNE $Lfunaligned_5_6_7 - - ANDS D1Ar3, D1Ar3, #7 - BZ $Lfbyte_loop_exit - ! Adjust A1.2 - ADD A1.2, A1.2, D0Ar4 - B $Lfbyte_loop - -$Lfunaligned_1_2_3: - MULW D0.6, D0Ar6, #8 - MOV D1.6, #32 - SUB D1.6, D1.6, D0.6 - -$Lfunaligned_1_2_3_loop: - GETL D0.7, D1.7, [++A1.2] - ! form 64-bit data in D0Re0, D1Re0 - LSR D0Re0, D0Re0, D0.6 - MOV D1.5, D1Re0 - LSL D1Re0, D1Re0, D1.6 - MOV D0.5, D1Re0 - ADD D0Re0, D0Re0, D0.5 - - MOV D0.5, D1.5 - LSR D0.5, D0.5, D0.6 - MOV D1Re0, D0.7 - LSL D1Re0, D1Re0, D1.6 - MOV D1.5, D0.5 - ADD D1Re0, D1Re0, D1.5 - - SETL [A0.2++], D0Re0, D1Re0 - MOV D0Re0, D0.7 - MOV D1Re0, D1.7 - SUBS D1Ar5, D1Ar5, #1 - BNE $Lfunaligned_1_2_3_loop - - ANDS D1Ar3, D1Ar3, #7 - BZ $Lfbyte_loop_exit - ! Adjust A1.2 - ADD A1.2, A1.2, D0Ar4 - B $Lfbyte_loop - -$Lfaligned_4: - GETL D0.7, D1.7, [++A1.2] - MOV D0Re0, D1Re0 - MOV D1Re0, D0.7 - SETL [A0.2++], D0Re0, D1Re0 - MOV D0Re0, D0.7 - MOV D1Re0, D1.7 - SUBS D1Ar5, D1Ar5, #1 - BNE $Lfaligned_4 - ANDS D1Ar3, D1Ar3, #7 - BZ $Lfbyte_loop_exit - ! Adjust A1.2 - ADD A1.2, A1.2, D0Ar4 - B $Lfbyte_loop - - .size _memmove,.-_memmove diff --git a/arch/metag/lib/memset.S b/arch/metag/lib/memset.S deleted file mode 100644 index 6ee246d831c77..0000000000000 --- a/arch/metag/lib/memset.S +++ /dev/null @@ -1,87 +0,0 @@ -! SPDX-License-Identifier: GPL-2.0 -! Copyright (C) 2008-2012 Imagination Technologies Ltd. - - .text - .global _memset - .type _memset,function -! D1Ar1 dst -! D0Ar2 c -! D1Ar3 cnt -! D0Re0 dst -_memset: - AND D0Ar2,D0Ar2,#0xFF ! Ensure a byte input value - MULW D0Ar2,D0Ar2,#0x0101 ! Duplicate byte value into 0-15 - ANDS D0Ar4,D1Ar1,#7 ! Extract bottom LSBs of dst - LSL D0Re0,D0Ar2,#16 ! Duplicate byte value into 16-31 - ADD A0.2,D0Ar2,D0Re0 ! Duplicate byte value into 4 (A0.2) - MOV D0Re0,D1Ar1 ! Return dst - BZ $LLongStub ! if start address is aligned - ! start address is not aligned on an 8 byte boundary, so we - ! need the number of bytes up to the next 8 byte address - ! boundary, or the length of the string if less than 8, in D1Ar5 - MOV D0Ar2,#8 ! Need 8 - N in D1Ar5 ... - SUB D1Ar5,D0Ar2,D0Ar4 ! ... subtract N - CMP D1Ar3,D1Ar5 - MOVMI D1Ar5,D1Ar3 - B $LByteStub ! dst is mis-aligned, do $LByteStub - -! -! Preamble to LongLoop which generates 4*8 bytes per interation (5 cycles) -! -$LLongStub: - LSRS D0Ar2,D1Ar3,#5 - AND D1Ar3,D1Ar3,#0x1F - MOV A1.2,A0.2 - BEQ $LLongishStub - SUB TXRPT,D0Ar2,#1 - CMP D1Ar3,#0 -$LLongLoop: - SETL [D1Ar1++],A0.2,A1.2 - SETL [D1Ar1++],A0.2,A1.2 - SETL [D1Ar1++],A0.2,A1.2 - SETL [D1Ar1++],A0.2,A1.2 - BR $LLongLoop - BZ $Lexit -! -! Preamble to LongishLoop which generates 1*8 bytes per interation (2 cycles) -! -$LLongishStub: - LSRS D0Ar2,D1Ar3,#3 - AND D1Ar3,D1Ar3,#0x7 - MOV D1Ar5,D1Ar3 - BEQ $LByteStub - SUB TXRPT,D0Ar2,#1 - CMP D1Ar3,#0 -$LLongishLoop: - SETL [D1Ar1++],A0.2,A1.2 - BR $LLongishLoop - BZ $Lexit -! -! This does a byte structured burst of up to 7 bytes -! -! D1Ar1 should point to the location required -! D1Ar3 should be the remaining total byte count -! D1Ar5 should be burst size (<= D1Ar3) -! -$LByteStub: - SUBS D1Ar3,D1Ar3,D1Ar5 ! Reduce count - ADD D1Ar1,D1Ar1,D1Ar5 ! Advance pointer to end of area - MULW D1Ar5,D1Ar5,#4 ! Scale to (1*4), (2*4), (3*4) - SUB D1Ar5,D1Ar5,#(8*4) ! Rebase to -(7*4), -(6*4), -(5*4), ... - MOV A1.2,D1Ar5 - SUB PC,CPC1,A1.2 ! Jump into table below - SETB [D1Ar1+#(-7)],A0.2 - SETB [D1Ar1+#(-6)],A0.2 - SETB [D1Ar1+#(-5)],A0.2 - SETB [D1Ar1+#(-4)],A0.2 - SETB [D1Ar1+#(-3)],A0.2 - SETB [D1Ar1+#(-2)],A0.2 - SETB [D1Ar1+#(-1)],A0.2 -! -! Return if all data has been output, otherwise do $LLongStub -! - BNZ $LLongStub -$Lexit: - MOV PC,D1RtP - .size _memset,.-_memset - diff --git a/arch/metag/lib/modsi3.S b/arch/metag/lib/modsi3.S deleted file mode 100644 index d65a2e5b31547..0000000000000 --- a/arch/metag/lib/modsi3.S +++ /dev/null @@ -1,39 +0,0 @@ -! SPDX-License-Identifier: GPL-2.0 -! Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 -! Imagination Technologies Ltd -! -! Integer modulus routines. -! -!! -!! 32-bit modulus unsigned i/p - passed unsigned 32-bit numbers -!! - .text - .global ___umodsi3 - .type ___umodsi3,function - .align 2 -___umodsi3: - MOV D0FrT,D1RtP ! Save original return address - CALLR D1RtP,___udivsi3 - MOV D1RtP,D0FrT ! Recover return address - MOV D0Re0,D1Ar1 ! Return remainder - MOV PC,D1RtP - .size ___umodsi3,.-___umodsi3 - -!! -!! 32-bit modulus signed i/p - passed signed 32-bit numbers -!! - .global ___modsi3 - .type ___modsi3,function - .align 2 -___modsi3: - MOV D0FrT,D1RtP ! Save original return address - MOV A0.2,D1Ar1 ! Save A in A0.2 - CALLR D1RtP,___divsi3 - MOV D1RtP,D0FrT ! Recover return address - MOV D1Re0,A0.2 ! Recover A - MOV D0Re0,D1Ar1 ! Return remainder - ORS D1Re0,D1Re0,D1Re0 ! Was A negative? - NEG D1Ar1,D1Ar1 ! Negate remainder - MOVMI D0Re0,D1Ar1 ! Return neg remainder - MOV PC, D1RtP - .size ___modsi3,.-___modsi3 diff --git a/arch/metag/lib/muldi3.S b/arch/metag/lib/muldi3.S deleted file mode 100644 index 9d106790244de..0000000000000 --- a/arch/metag/lib/muldi3.S +++ /dev/null @@ -1,45 +0,0 @@ -! SPDX-License-Identifier: GPL-2.0 -! Copyright (C) 2012 by Imagination Technologies Ltd. -! -! 64-bit multiply routine. -! - -! -! 64-bit signed/unsigned multiply -! -! A = D1Ar1:D0Ar2 = a 2^48 + b 2^32 + c 2^16 + d 2^0 -! -! B = D1Ar3:D0Ar4 = w 2^48 + x 2^32 + y 2^16 + z 2^0 -! - .text - .global ___muldi3 - .type ___muldi3,function - -___muldi3: - MULD D1Re0,D1Ar1,D0Ar4 ! (a 2^48 + b 2^32)(y 2^16 + z 2^0) - MULD D0Re0,D0Ar2,D1Ar3 ! (w 2^48 + x 2^32)(c 2^16 + d 2^0) - ADD D1Re0,D1Re0,D0Re0 - - MULW D0Re0,D0Ar2,D0Ar4 ! (d 2^0) * (z 2^0) - - RTDW D0Ar2,D0Ar2 - MULW D0Ar6,D0Ar2,D0Ar4 ! (c 2^16)(z 2^0) - LSR D1Ar5,D0Ar6,#16 - LSL D0Ar6,D0Ar6,#16 - ADDS D0Re0,D0Re0,D0Ar6 - ADDCS D1Re0,D1Re0,#1 - RTDW D0Ar4,D0Ar4 - ADD D1Re0,D1Re0,D1Ar5 - - MULW D0Ar6,D0Ar2,D0Ar4 ! (c 2^16)(y 2^16) - ADD D1Re0,D1Re0,D0Ar6 - - RTDW D0Ar2,D0Ar2 - MULW D0Ar6,D0Ar2,D0Ar4 ! (d 2^0)(y 2^16) - LSR D1Ar5,D0Ar6,#16 - LSL D0Ar6,D0Ar6,#16 - ADDS D0Re0,D0Re0,D0Ar6 - ADD D1Re0,D1Re0,D1Ar5 - ADDCS D1Re0,D1Re0,#1 - MOV PC, D1RtP - .size ___muldi3,.-___muldi3 diff --git a/arch/metag/lib/ucmpdi2.S b/arch/metag/lib/ucmpdi2.S deleted file mode 100644 index 46f5686db8b1c..0000000000000 --- a/arch/metag/lib/ucmpdi2.S +++ /dev/null @@ -1,28 +0,0 @@ -! SPDX-License-Identifier: GPL-2.0 -! Copyright (C) 2012 by Imagination Technologies Ltd. -! -! 64-bit unsigned compare routine. -! - - .text - .global ___ucmpdi2 - .type ___ucmpdi2,function - -! low high -! u64 a (D0Ar2, D1Ar1) -! u64 b (D0Ar4, D1Ar3) -___ucmpdi2: - ! start at 1 (equal) and conditionally increment or decrement - MOV D0Re0,#1 - - ! high words - CMP D1Ar1,D1Ar3 - ! or if equal, low words - CMPEQ D0Ar2,D0Ar4 - - ! unsigned compare - SUBLO D0Re0,D0Re0,#1 - ADDHI D0Re0,D0Re0,#1 - - MOV PC,D1RtP - .size ___ucmpdi2,.-___ucmpdi2 diff --git a/arch/metag/lib/usercopy.c b/arch/metag/lib/usercopy.c deleted file mode 100644 index a48ef522c02dc..0000000000000 --- a/arch/metag/lib/usercopy.c +++ /dev/null @@ -1,1257 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * User address space access functions. - * The non-inlined parts of asm-metag/uaccess.h are here. - * - * Copyright (C) 2006, Imagination Technologies. - * Copyright (C) 2000, Axis Communications AB. - * - * Written by Hans-Peter Nilsson. - * Pieces used from memcpy, originally by Kenny Ranerup long time ago. - * Modified for Meta by Will Newton. - */ - -#include -#include -#include /* def of L1_CACHE_BYTES */ - -#define USE_RAPF -#define RAPF_MIN_BUF_SIZE (3*L1_CACHE_BYTES) - - -/* The "double write" in this code is because the Meta will not fault - * immediately unless the memory pipe is forced to by e.g. a data stall or - * another memory op. The second write should be discarded by the write - * combiner so should have virtually no cost. - */ - -#define __asm_copy_user_cont(to, from, ret, COPY, FIXUP, TENTRY) \ - asm volatile ( \ - COPY \ - "1:\n" \ - " .section .fixup,\"ax\"\n" \ - FIXUP \ - " MOVT D1Ar1,#HI(1b)\n" \ - " JUMP D1Ar1,#LO(1b)\n" \ - " .previous\n" \ - " .section __ex_table,\"a\"\n" \ - TENTRY \ - " .previous\n" \ - : "=r" (to), "=r" (from), "=r" (ret) \ - : "0" (to), "1" (from), "2" (ret) \ - : "D1Ar1", "memory") - - -#define __asm_copy_to_user_1(to, from, ret) \ - __asm_copy_user_cont(to, from, ret, \ - " GETB D1Ar1,[%1++]\n" \ - " SETB [%0],D1Ar1\n" \ - "2: SETB [%0++],D1Ar1\n", \ - "3: ADD %2,%2,#1\n", \ - " .long 2b,3b\n") - -#define __asm_copy_to_user_2x_cont(to, from, ret, COPY, FIXUP, TENTRY) \ - __asm_copy_user_cont(to, from, ret, \ - " GETW D1Ar1,[%1++]\n" \ - " SETW [%0],D1Ar1\n" \ - "2: SETW [%0++],D1Ar1\n" COPY, \ - "3: ADD %2,%2,#2\n" FIXUP, \ - " .long 2b,3b\n" TENTRY) - -#define __asm_copy_to_user_2(to, from, ret) \ - __asm_copy_to_user_2x_cont(to, from, ret, "", "", "") - -#define __asm_copy_to_user_3(to, from, ret) \ - __asm_copy_to_user_2x_cont(to, from, ret, \ - " GETB D1Ar1,[%1++]\n" \ - " SETB [%0],D1Ar1\n" \ - "4: SETB [%0++],D1Ar1\n", \ - "5: ADD %2,%2,#1\n", \ - " .long 4b,5b\n") - -#define __asm_copy_to_user_4x_cont(to, from, ret, COPY, FIXUP, TENTRY) \ - __asm_copy_user_cont(to, from, ret, \ - " GETD D1Ar1,[%1++]\n" \ - " SETD [%0],D1Ar1\n" \ - "2: SETD [%0++],D1Ar1\n" COPY, \ - "3: ADD %2,%2,#4\n" FIXUP, \ - " .long 2b,3b\n" TENTRY) - -#define __asm_copy_to_user_4(to, from, ret) \ - __asm_copy_to_user_4x_cont(to, from, ret, "", "", "") - -#define __asm_copy_to_user_5(to, from, ret) \ - __asm_copy_to_user_4x_cont(to, from, ret, \ - " GETB D1Ar1,[%1++]\n" \ - " SETB [%0],D1Ar1\n" \ - "4: SETB [%0++],D1Ar1\n", \ - "5: ADD %2,%2,#1\n", \ - " .long 4b,5b\n") - -#define __asm_copy_to_user_6x_cont(to, from, ret, COPY, FIXUP, TENTRY) \ - __asm_copy_to_user_4x_cont(to, from, ret, \ - " GETW D1Ar1,[%1++]\n" \ - " SETW [%0],D1Ar1\n" \ - "4: SETW [%0++],D1Ar1\n" COPY, \ - "5: ADD %2,%2,#2\n" FIXUP, \ - " .long 4b,5b\n" TENTRY) - -#define __asm_copy_to_user_6(to, from, ret) \ - __asm_copy_to_user_6x_cont(to, from, ret, "", "", "") - -#define __asm_copy_to_user_7(to, from, ret) \ - __asm_copy_to_user_6x_cont(to, from, ret, \ - " GETB D1Ar1,[%1++]\n" \ - " SETB [%0],D1Ar1\n" \ - "6: SETB [%0++],D1Ar1\n", \ - "7: ADD %2,%2,#1\n", \ - " .long 6b,7b\n") - -#define __asm_copy_to_user_8x_cont(to, from, ret, COPY, FIXUP, TENTRY) \ - __asm_copy_to_user_4x_cont(to, from, ret, \ - " GETD D1Ar1,[%1++]\n" \ - " SETD [%0],D1Ar1\n" \ - "4: SETD [%0++],D1Ar1\n" COPY, \ - "5: ADD %2,%2,#4\n" FIXUP, \ - " .long 4b,5b\n" TENTRY) - -#define __asm_copy_to_user_8(to, from, ret) \ - __asm_copy_to_user_8x_cont(to, from, ret, "", "", "") - -#define __asm_copy_to_user_9(to, from, ret) \ - __asm_copy_to_user_8x_cont(to, from, ret, \ - " GETB D1Ar1,[%1++]\n" \ - " SETB [%0],D1Ar1\n" \ - "6: SETB [%0++],D1Ar1\n", \ - "7: ADD %2,%2,#1\n", \ - " .long 6b,7b\n") - -#define __asm_copy_to_user_10x_cont(to, from, ret, COPY, FIXUP, TENTRY) \ - __asm_copy_to_user_8x_cont(to, from, ret, \ - " GETW D1Ar1,[%1++]\n" \ - " SETW [%0],D1Ar1\n" \ - "6: SETW [%0++],D1Ar1\n" COPY, \ - "7: ADD %2,%2,#2\n" FIXUP, \ - " .long 6b,7b\n" TENTRY) - -#define __asm_copy_to_user_10(to, from, ret) \ - __asm_copy_to_user_10x_cont(to, from, ret, "", "", "") - -#define __asm_copy_to_user_11(to, from, ret) \ - __asm_copy_to_user_10x_cont(to, from, ret, \ - " GETB D1Ar1,[%1++]\n" \ - " SETB [%0],D1Ar1\n" \ - "8: SETB [%0++],D1Ar1\n", \ - "9: ADD %2,%2,#1\n", \ - " .long 8b,9b\n") - -#define __asm_copy_to_user_12x_cont(to, from, ret, COPY, FIXUP, TENTRY) \ - __asm_copy_to_user_8x_cont(to, from, ret, \ - " GETD D1Ar1,[%1++]\n" \ - " SETD [%0],D1Ar1\n" \ - "6: SETD [%0++],D1Ar1\n" COPY, \ - "7: ADD %2,%2,#4\n" FIXUP, \ - " .long 6b,7b\n" TENTRY) -#define __asm_copy_to_user_12(to, from, ret) \ - __asm_copy_to_user_12x_cont(to, from, ret, "", "", "") - -#define __asm_copy_to_user_13(to, from, ret) \ - __asm_copy_to_user_12x_cont(to, from, ret, \ - " GETB D1Ar1,[%1++]\n" \ - " SETB [%0],D1Ar1\n" \ - "8: SETB [%0++],D1Ar1\n", \ - "9: ADD %2,%2,#1\n", \ - " .long 8b,9b\n") - -#define __asm_copy_to_user_14x_cont(to, from, ret, COPY, FIXUP, TENTRY) \ - __asm_copy_to_user_12x_cont(to, from, ret, \ - " GETW D1Ar1,[%1++]\n" \ - " SETW [%0],D1Ar1\n" \ - "8: SETW [%0++],D1Ar1\n" COPY, \ - "9: ADD %2,%2,#2\n" FIXUP, \ - " .long 8b,9b\n" TENTRY) - -#define __asm_copy_to_user_14(to, from, ret) \ - __asm_copy_to_user_14x_cont(to, from, ret, "", "", "") - -#define __asm_copy_to_user_15(to, from, ret) \ - __asm_copy_to_user_14x_cont(to, from, ret, \ - " GETB D1Ar1,[%1++]\n" \ - " SETB [%0],D1Ar1\n" \ - "10: SETB [%0++],D1Ar1\n", \ - "11: ADD %2,%2,#1\n", \ - " .long 10b,11b\n") - -#define __asm_copy_to_user_16x_cont(to, from, ret, COPY, FIXUP, TENTRY) \ - __asm_copy_to_user_12x_cont(to, from, ret, \ - " GETD D1Ar1,[%1++]\n" \ - " SETD [%0],D1Ar1\n" \ - "8: SETD [%0++],D1Ar1\n" COPY, \ - "9: ADD %2,%2,#4\n" FIXUP, \ - " .long 8b,9b\n" TENTRY) - -#define __asm_copy_to_user_16(to, from, ret) \ - __asm_copy_to_user_16x_cont(to, from, ret, "", "", "") - -#define __asm_copy_to_user_8x64(to, from, ret) \ - asm volatile ( \ - " GETL D0Ar2,D1Ar1,[%1++]\n" \ - " SETL [%0],D0Ar2,D1Ar1\n" \ - "2: SETL [%0++],D0Ar2,D1Ar1\n" \ - "1:\n" \ - " .section .fixup,\"ax\"\n" \ - "3: ADD %2,%2,#8\n" \ - " MOVT D0Ar2,#HI(1b)\n" \ - " JUMP D0Ar2,#LO(1b)\n" \ - " .previous\n" \ - " .section __ex_table,\"a\"\n" \ - " .long 2b,3b\n" \ - " .previous\n" \ - : "=r" (to), "=r" (from), "=r" (ret) \ - : "0" (to), "1" (from), "2" (ret) \ - : "D1Ar1", "D0Ar2", "memory") - -/* - * optimized copying loop using RAPF when 64 bit aligned - * - * n will be automatically decremented inside the loop - * ret will be left intact. if error occurs we will rewind - * so that the original non optimized code will fill up - * this value correctly. - * - * on fault: - * > n will hold total number of uncopied bytes - * - * > {'to','from'} will be rewind back so that - * the non-optimized code will do the proper fix up - * - * DCACHE drops the cacheline which helps in reducing cache - * pollution. - * - * We introduce an extra SETL at the end of the loop to - * ensure we don't fall off the loop before we catch all - * erros. - * - * NOTICE: - * LSM_STEP in TXSTATUS must be cleared in fix up code. - * since we're using M{S,G}ETL, a fault might happen at - * any address in the middle of M{S,G}ETL causing - * the value of LSM_STEP to be incorrect which can - * cause subsequent use of M{S,G}ET{L,D} to go wrong. - * ie: if LSM_STEP was 1 when a fault occurs, the - * next call to M{S,G}ET{L,D} will skip the first - * copy/getting as it think that the first 1 has already - * been done. - * - */ -#define __asm_copy_user_64bit_rapf_loop( \ - to, from, ret, n, id, FIXUP) \ - asm volatile ( \ - ".balign 8\n" \ - " MOV RAPF, %1\n" \ - " MSETL [A0StP++], D0Ar6, D0FrT, D0.5, D0.6, D0.7\n" \ - " MOV D0Ar6, #0\n" \ - " LSR D1Ar5, %3, #6\n" \ - " SUB TXRPT, D1Ar5, #2\n" \ - " MOV RAPF, %1\n" \ - "$Lloop"id":\n" \ - " ADD RAPF, %1, #64\n" \ - "21: MGETL D0FrT, D0.5, D0.6, D0.7, [%1++]\n" \ - "22: MSETL [%0++], D0FrT, D0.5, D0.6, D0.7\n" \ - "23: SUB %3, %3, #32\n" \ - "24: MGETL D0FrT, D0.5, D0.6, D0.7, [%1++]\n" \ - "25: MSETL [%0++], D0FrT, D0.5, D0.6, D0.7\n" \ - "26: SUB %3, %3, #32\n" \ - " DCACHE [%1+#-64], D0Ar6\n" \ - " BR $Lloop"id"\n" \ - \ - " MOV RAPF, %1\n" \ - "27: MGETL D0FrT, D0.5, D0.6, D0.7, [%1++]\n" \ - "28: MSETL [%0++], D0FrT, D0.5, D0.6, D0.7\n" \ - "29: SUB %3, %3, #32\n" \ - "30: MGETL D0FrT, D0.5, D0.6, D0.7, [%1++]\n" \ - "31: MSETL [%0++], D0FrT, D0.5, D0.6, D0.7\n" \ - "32: SETL [%0+#-8], D0.7, D1.7\n" \ - " SUB %3, %3, #32\n" \ - "1: DCACHE [%1+#-64], D0Ar6\n" \ - " GETL D0Ar6, D1Ar5, [A0StP+#-40]\n" \ - " GETL D0FrT, D1RtP, [A0StP+#-32]\n" \ - " GETL D0.5, D1.5, [A0StP+#-24]\n" \ - " GETL D0.6, D1.6, [A0StP+#-16]\n" \ - " GETL D0.7, D1.7, [A0StP+#-8]\n" \ - " SUB A0StP, A0StP, #40\n" \ - " .section .fixup,\"ax\"\n" \ - "3: MOV D0Ar2, TXSTATUS\n" \ - " MOV D1Ar1, TXSTATUS\n" \ - " AND D1Ar1, D1Ar1, #0xFFFFF8FF\n" \ - " MOV TXSTATUS, D1Ar1\n" \ - FIXUP \ - " MOVT D0Ar2, #HI(1b)\n" \ - " JUMP D0Ar2, #LO(1b)\n" \ - " .previous\n" \ - " .section __ex_table,\"a\"\n" \ - " .long 21b,3b\n" \ - " .long 22b,3b\n" \ - " .long 23b,3b\n" \ - " .long 24b,3b\n" \ - " .long 25b,3b\n" \ - " .long 26b,3b\n" \ - " .long 27b,3b\n" \ - " .long 28b,3b\n" \ - " .long 29b,3b\n" \ - " .long 30b,3b\n" \ - " .long 31b,3b\n" \ - " .long 32b,3b\n" \ - " .previous\n" \ - : "=r" (to), "=r" (from), "=r" (ret), "=d" (n) \ - : "0" (to), "1" (from), "2" (ret), "3" (n) \ - : "D1Ar1", "D0Ar2", "cc", "memory") - -/* rewind 'to' and 'from' pointers when a fault occurs - * - * Rationale: - * A fault always occurs on writing to user buffer. A fault - * is at a single address, so we need to rewind by only 4 - * bytes. - * Since we do a complete read from kernel buffer before - * writing, we need to rewind it also. The amount to be - * rewind equals the number of faulty writes in MSETD - * which is: [4 - (LSM_STEP-1)]*8 - * LSM_STEP is bits 10:8 in TXSTATUS which is already read - * and stored in D0Ar2 - * - * NOTE: If a fault occurs at the last operation in M{G,S}ETL - * LSM_STEP will be 0. ie: we do 4 writes in our case, if - * a fault happens at the 4th write, LSM_STEP will be 0 - * instead of 4. The code copes with that. - * - * n is updated by the number of successful writes, which is: - * n = n - (LSM_STEP-1)*8 - */ -#define __asm_copy_to_user_64bit_rapf_loop(to, from, ret, n, id)\ - __asm_copy_user_64bit_rapf_loop(to, from, ret, n, id, \ - "LSR D0Ar2, D0Ar2, #8\n" \ - "ANDS D0Ar2, D0Ar2, #0x7\n" \ - "ADDZ D0Ar2, D0Ar2, #4\n" \ - "SUB D0Ar2, D0Ar2, #1\n" \ - "MOV D1Ar1, #4\n" \ - "SUB D0Ar2, D1Ar1, D0Ar2\n" \ - "LSL D0Ar2, D0Ar2, #3\n" \ - "LSL D1Ar1, D1Ar1, #3\n" \ - "SUB D1Ar1, D1Ar1, D0Ar2\n" \ - "SUB %0, %0, #8\n" \ - "SUB %1, %1,D0Ar2\n" \ - "SUB %3, %3, D1Ar1\n") - -/* - * optimized copying loop using RAPF when 32 bit aligned - * - * n will be automatically decremented inside the loop - * ret will be left intact. if error occurs we will rewind - * so that the original non optimized code will fill up - * this value correctly. - * - * on fault: - * > n will hold total number of uncopied bytes - * - * > {'to','from'} will be rewind back so that - * the non-optimized code will do the proper fix up - * - * DCACHE drops the cacheline which helps in reducing cache - * pollution. - * - * We introduce an extra SETD at the end of the loop to - * ensure we don't fall off the loop before we catch all - * erros. - * - * NOTICE: - * LSM_STEP in TXSTATUS must be cleared in fix up code. - * since we're using M{S,G}ETL, a fault might happen at - * any address in the middle of M{S,G}ETL causing - * the value of LSM_STEP to be incorrect which can - * cause subsequent use of M{S,G}ET{L,D} to go wrong. - * ie: if LSM_STEP was 1 when a fault occurs, the - * next call to M{S,G}ET{L,D} will skip the first - * copy/getting as it think that the first 1 has already - * been done. - * - */ -#define __asm_copy_user_32bit_rapf_loop( \ - to, from, ret, n, id, FIXUP) \ - asm volatile ( \ - ".balign 8\n" \ - " MOV RAPF, %1\n" \ - " MSETL [A0StP++], D0Ar6, D0FrT, D0.5, D0.6, D0.7\n" \ - " MOV D0Ar6, #0\n" \ - " LSR D1Ar5, %3, #6\n" \ - " SUB TXRPT, D1Ar5, #2\n" \ - " MOV RAPF, %1\n" \ - "$Lloop"id":\n" \ - " ADD RAPF, %1, #64\n" \ - "21: MGETD D0FrT, D0.5, D0.6, D0.7, [%1++]\n" \ - "22: MSETD [%0++], D0FrT, D0.5, D0.6, D0.7\n" \ - "23: SUB %3, %3, #16\n" \ - "24: MGETD D0FrT, D0.5, D0.6, D0.7, [%1++]\n" \ - "25: MSETD [%0++], D0FrT, D0.5, D0.6, D0.7\n" \ - "26: SUB %3, %3, #16\n" \ - "27: MGETD D0FrT, D0.5, D0.6, D0.7, [%1++]\n" \ - "28: MSETD [%0++], D0FrT, D0.5, D0.6, D0.7\n" \ - "29: SUB %3, %3, #16\n" \ - "30: MGETD D0FrT, D0.5, D0.6, D0.7, [%1++]\n" \ - "31: MSETD [%0++], D0FrT, D0.5, D0.6, D0.7\n" \ - "32: SUB %3, %3, #16\n" \ - " DCACHE [%1+#-64], D0Ar6\n" \ - " BR $Lloop"id"\n" \ - \ - " MOV RAPF, %1\n" \ - "33: MGETD D0FrT, D0.5, D0.6, D0.7, [%1++]\n" \ - "34: MSETD [%0++], D0FrT, D0.5, D0.6, D0.7\n" \ - "35: SUB %3, %3, #16\n" \ - "36: MGETD D0FrT, D0.5, D0.6, D0.7, [%1++]\n" \ - "37: MSETD [%0++], D0FrT, D0.5, D0.6, D0.7\n" \ - "38: SUB %3, %3, #16\n" \ - "39: MGETD D0FrT, D0.5, D0.6, D0.7, [%1++]\n" \ - "40: MSETD [%0++], D0FrT, D0.5, D0.6, D0.7\n" \ - "41: SUB %3, %3, #16\n" \ - "42: MGETD D0FrT, D0.5, D0.6, D0.7, [%1++]\n" \ - "43: MSETD [%0++], D0FrT, D0.5, D0.6, D0.7\n" \ - "44: SETD [%0+#-4], D0.7\n" \ - " SUB %3, %3, #16\n" \ - "1: DCACHE [%1+#-64], D0Ar6\n" \ - " GETL D0Ar6, D1Ar5, [A0StP+#-40]\n" \ - " GETL D0FrT, D1RtP, [A0StP+#-32]\n" \ - " GETL D0.5, D1.5, [A0StP+#-24]\n" \ - " GETL D0.6, D1.6, [A0StP+#-16]\n" \ - " GETL D0.7, D1.7, [A0StP+#-8]\n" \ - " SUB A0StP, A0StP, #40\n" \ - " .section .fixup,\"ax\"\n" \ - "3: MOV D0Ar2, TXSTATUS\n" \ - " MOV D1Ar1, TXSTATUS\n" \ - " AND D1Ar1, D1Ar1, #0xFFFFF8FF\n" \ - " MOV TXSTATUS, D1Ar1\n" \ - FIXUP \ - " MOVT D0Ar2, #HI(1b)\n" \ - " JUMP D0Ar2, #LO(1b)\n" \ - " .previous\n" \ - " .section __ex_table,\"a\"\n" \ - " .long 21b,3b\n" \ - " .long 22b,3b\n" \ - " .long 23b,3b\n" \ - " .long 24b,3b\n" \ - " .long 25b,3b\n" \ - " .long 26b,3b\n" \ - " .long 27b,3b\n" \ - " .long 28b,3b\n" \ - " .long 29b,3b\n" \ - " .long 30b,3b\n" \ - " .long 31b,3b\n" \ - " .long 32b,3b\n" \ - " .long 33b,3b\n" \ - " .long 34b,3b\n" \ - " .long 35b,3b\n" \ - " .long 36b,3b\n" \ - " .long 37b,3b\n" \ - " .long 38b,3b\n" \ - " .long 39b,3b\n" \ - " .long 40b,3b\n" \ - " .long 41b,3b\n" \ - " .long 42b,3b\n" \ - " .long 43b,3b\n" \ - " .long 44b,3b\n" \ - " .previous\n" \ - : "=r" (to), "=r" (from), "=r" (ret), "=d" (n) \ - : "0" (to), "1" (from), "2" (ret), "3" (n) \ - : "D1Ar1", "D0Ar2", "cc", "memory") - -/* rewind 'to' and 'from' pointers when a fault occurs - * - * Rationale: - * A fault always occurs on writing to user buffer. A fault - * is at a single address, so we need to rewind by only 4 - * bytes. - * Since we do a complete read from kernel buffer before - * writing, we need to rewind it also. The amount to be - * rewind equals the number of faulty writes in MSETD - * which is: [4 - (LSM_STEP-1)]*4 - * LSM_STEP is bits 10:8 in TXSTATUS which is already read - * and stored in D0Ar2 - * - * NOTE: If a fault occurs at the last operation in M{G,S}ETL - * LSM_STEP will be 0. ie: we do 4 writes in our case, if - * a fault happens at the 4th write, LSM_STEP will be 0 - * instead of 4. The code copes with that. - * - * n is updated by the number of successful writes, which is: - * n = n - (LSM_STEP-1)*4 - */ -#define __asm_copy_to_user_32bit_rapf_loop(to, from, ret, n, id)\ - __asm_copy_user_32bit_rapf_loop(to, from, ret, n, id, \ - "LSR D0Ar2, D0Ar2, #8\n" \ - "ANDS D0Ar2, D0Ar2, #0x7\n" \ - "ADDZ D0Ar2, D0Ar2, #4\n" \ - "SUB D0Ar2, D0Ar2, #1\n" \ - "MOV D1Ar1, #4\n" \ - "SUB D0Ar2, D1Ar1, D0Ar2\n" \ - "LSL D0Ar2, D0Ar2, #2\n" \ - "LSL D1Ar1, D1Ar1, #2\n" \ - "SUB D1Ar1, D1Ar1, D0Ar2\n" \ - "SUB %0, %0, #4\n" \ - "SUB %1, %1, D0Ar2\n" \ - "SUB %3, %3, D1Ar1\n") - -unsigned long raw_copy_to_user(void __user *pdst, const void *psrc, - unsigned long n) -{ - register char __user *dst asm ("A0.2") = pdst; - register const char *src asm ("A1.2") = psrc; - unsigned long retn = 0; - - if (n == 0) - return 0; - - if ((unsigned long) src & 1) { - __asm_copy_to_user_1(dst, src, retn); - n--; - if (retn) - return retn + n; - } - if ((unsigned long) dst & 1) { - /* Worst case - byte copy */ - while (n > 0) { - __asm_copy_to_user_1(dst, src, retn); - n--; - if (retn) - return retn + n; - } - } - if (((unsigned long) src & 2) && n >= 2) { - __asm_copy_to_user_2(dst, src, retn); - n -= 2; - if (retn) - return retn + n; - } - if ((unsigned long) dst & 2) { - /* Second worst case - word copy */ - while (n >= 2) { - __asm_copy_to_user_2(dst, src, retn); - n -= 2; - if (retn) - return retn + n; - } - } - -#ifdef USE_RAPF - /* 64 bit copy loop */ - if (!(((unsigned long) src | (__force unsigned long) dst) & 7)) { - if (n >= RAPF_MIN_BUF_SIZE) { - /* copy user using 64 bit rapf copy */ - __asm_copy_to_user_64bit_rapf_loop(dst, src, retn, - n, "64cu"); - } - while (n >= 8) { - __asm_copy_to_user_8x64(dst, src, retn); - n -= 8; - if (retn) - return retn + n; - } - } - if (n >= RAPF_MIN_BUF_SIZE) { - /* copy user using 32 bit rapf copy */ - __asm_copy_to_user_32bit_rapf_loop(dst, src, retn, n, "32cu"); - } -#else - /* 64 bit copy loop */ - if (!(((unsigned long) src | (__force unsigned long) dst) & 7)) { - while (n >= 8) { - __asm_copy_to_user_8x64(dst, src, retn); - n -= 8; - if (retn) - return retn + n; - } - } -#endif - - while (n >= 16) { - __asm_copy_to_user_16(dst, src, retn); - n -= 16; - if (retn) - return retn + n; - } - - while (n >= 4) { - __asm_copy_to_user_4(dst, src, retn); - n -= 4; - if (retn) - return retn + n; - } - - switch (n) { - case 0: - break; - case 1: - __asm_copy_to_user_1(dst, src, retn); - break; - case 2: - __asm_copy_to_user_2(dst, src, retn); - break; - case 3: - __asm_copy_to_user_3(dst, src, retn); - break; - } - - /* - * If we get here, retn correctly reflects the number of failing - * bytes. - */ - return retn; -} -EXPORT_SYMBOL(raw_copy_to_user); - -#define __asm_copy_from_user_1(to, from, ret) \ - __asm_copy_user_cont(to, from, ret, \ - " GETB D1Ar1,[%1++]\n" \ - "2: SETB [%0++],D1Ar1\n", \ - "3: ADD %2,%2,#1\n", \ - " .long 2b,3b\n") - -#define __asm_copy_from_user_2x_cont(to, from, ret, COPY, FIXUP, TENTRY) \ - __asm_copy_user_cont(to, from, ret, \ - " GETW D1Ar1,[%1++]\n" \ - "2: SETW [%0++],D1Ar1\n" COPY, \ - "3: ADD %2,%2,#2\n" FIXUP, \ - " .long 2b,3b\n" TENTRY) - -#define __asm_copy_from_user_2(to, from, ret) \ - __asm_copy_from_user_2x_cont(to, from, ret, "", "", "") - -#define __asm_copy_from_user_3(to, from, ret) \ - __asm_copy_from_user_2x_cont(to, from, ret, \ - " GETB D1Ar1,[%1++]\n" \ - "4: SETB [%0++],D1Ar1\n", \ - "5: ADD %2,%2,#1\n", \ - " .long 4b,5b\n") - -#define __asm_copy_from_user_4x_cont(to, from, ret, COPY, FIXUP, TENTRY) \ - __asm_copy_user_cont(to, from, ret, \ - " GETD D1Ar1,[%1++]\n" \ - "2: SETD [%0++],D1Ar1\n" COPY, \ - "3: ADD %2,%2,#4\n" FIXUP, \ - " .long 2b,3b\n" TENTRY) - -#define __asm_copy_from_user_4(to, from, ret) \ - __asm_copy_from_user_4x_cont(to, from, ret, "", "", "") - -#define __asm_copy_from_user_8x64(to, from, ret) \ - asm volatile ( \ - " GETL D0Ar2,D1Ar1,[%1++]\n" \ - "2: SETL [%0++],D0Ar2,D1Ar1\n" \ - "1:\n" \ - " .section .fixup,\"ax\"\n" \ - "3: ADD %2,%2,#8\n" \ - " MOVT D0Ar2,#HI(1b)\n" \ - " JUMP D0Ar2,#LO(1b)\n" \ - " .previous\n" \ - " .section __ex_table,\"a\"\n" \ - " .long 2b,3b\n" \ - " .previous\n" \ - : "=a" (to), "=r" (from), "=r" (ret) \ - : "0" (to), "1" (from), "2" (ret) \ - : "D1Ar1", "D0Ar2", "memory") - -/* rewind 'from' pointer when a fault occurs - * - * Rationale: - * A fault occurs while reading from user buffer, which is the - * source. - * Since we don't write to kernel buffer until we read first, - * the kernel buffer is at the right state and needn't be - * corrected, but the source must be rewound to the beginning of - * the block, which is LSM_STEP*8 bytes. - * LSM_STEP is bits 10:8 in TXSTATUS which is already read - * and stored in D0Ar2 - * - * NOTE: If a fault occurs at the last operation in M{G,S}ETL - * LSM_STEP will be 0. ie: we do 4 writes in our case, if - * a fault happens at the 4th write, LSM_STEP will be 0 - * instead of 4. The code copes with that. - */ -#define __asm_copy_from_user_64bit_rapf_loop(to, from, ret, n, id) \ - __asm_copy_user_64bit_rapf_loop(to, from, ret, n, id, \ - "LSR D0Ar2, D0Ar2, #5\n" \ - "ANDS D0Ar2, D0Ar2, #0x38\n" \ - "ADDZ D0Ar2, D0Ar2, #32\n" \ - "SUB %1, %1, D0Ar2\n") - -/* rewind 'from' pointer when a fault occurs - * - * Rationale: - * A fault occurs while reading from user buffer, which is the - * source. - * Since we don't write to kernel buffer until we read first, - * the kernel buffer is at the right state and needn't be - * corrected, but the source must be rewound to the beginning of - * the block, which is LSM_STEP*4 bytes. - * LSM_STEP is bits 10:8 in TXSTATUS which is already read - * and stored in D0Ar2 - * - * NOTE: If a fault occurs at the last operation in M{G,S}ETL - * LSM_STEP will be 0. ie: we do 4 writes in our case, if - * a fault happens at the 4th write, LSM_STEP will be 0 - * instead of 4. The code copes with that. - */ -#define __asm_copy_from_user_32bit_rapf_loop(to, from, ret, n, id) \ - __asm_copy_user_32bit_rapf_loop(to, from, ret, n, id, \ - "LSR D0Ar2, D0Ar2, #6\n" \ - "ANDS D0Ar2, D0Ar2, #0x1c\n" \ - "ADDZ D0Ar2, D0Ar2, #16\n" \ - "SUB %1, %1, D0Ar2\n") - - -/* - * Copy from user to kernel. The return-value is the number of bytes that were - * inaccessible. - */ -unsigned long raw_copy_from_user(void *pdst, const void __user *psrc, - unsigned long n) -{ - register char *dst asm ("A0.2") = pdst; - register const char __user *src asm ("A1.2") = psrc; - unsigned long retn = 0; - - if (n == 0) - return 0; - - if ((unsigned long) src & 1) { - __asm_copy_from_user_1(dst, src, retn); - n--; - if (retn) - return retn + n; - } - if ((unsigned long) dst & 1) { - /* Worst case - byte copy */ - while (n > 0) { - __asm_copy_from_user_1(dst, src, retn); - n--; - if (retn) - return retn + n; - } - } - if (((unsigned long) src & 2) && n >= 2) { - __asm_copy_from_user_2(dst, src, retn); - n -= 2; - if (retn) - return retn + n; - } - if ((unsigned long) dst & 2) { - /* Second worst case - word copy */ - while (n >= 2) { - __asm_copy_from_user_2(dst, src, retn); - n -= 2; - if (retn) - return retn + n; - } - } - -#ifdef USE_RAPF - /* 64 bit copy loop */ - if (!(((unsigned long) src | (unsigned long) dst) & 7)) { - if (n >= RAPF_MIN_BUF_SIZE) { - /* Copy using fast 64bit rapf */ - __asm_copy_from_user_64bit_rapf_loop(dst, src, retn, - n, "64cuz"); - } - while (n >= 8) { - __asm_copy_from_user_8x64(dst, src, retn); - n -= 8; - if (retn) - return retn + n; - } - } - - if (n >= RAPF_MIN_BUF_SIZE) { - /* Copy using fast 32bit rapf */ - __asm_copy_from_user_32bit_rapf_loop(dst, src, retn, - n, "32cuz"); - } -#else - /* 64 bit copy loop */ - if (!(((unsigned long) src | (unsigned long) dst) & 7)) { - while (n >= 8) { - __asm_copy_from_user_8x64(dst, src, retn); - n -= 8; - if (retn) - return retn + n; - } - } -#endif - - while (n >= 4) { - __asm_copy_from_user_4(dst, src, retn); - n -= 4; - - if (retn) - return retn + n; - } - - /* If we get here, there were no memory read faults. */ - switch (n) { - /* These copies are at least "naturally aligned" (so we don't - have to check each byte), due to the src alignment code. - The *_3 case *will* get the correct count for retn. */ - case 0: - /* This case deliberately left in (if you have doubts check the - generated assembly code). */ - break; - case 1: - __asm_copy_from_user_1(dst, src, retn); - break; - case 2: - __asm_copy_from_user_2(dst, src, retn); - break; - case 3: - __asm_copy_from_user_3(dst, src, retn); - break; - } - - /* If we get here, retn correctly reflects the number of failing - bytes. */ - return retn; -} -EXPORT_SYMBOL(raw_copy_from_user); - -#define __asm_clear_8x64(to, ret) \ - asm volatile ( \ - " MOV D0Ar2,#0\n" \ - " MOV D1Ar1,#0\n" \ - " SETL [%0],D0Ar2,D1Ar1\n" \ - "2: SETL [%0++],D0Ar2,D1Ar1\n" \ - "1:\n" \ - " .section .fixup,\"ax\"\n" \ - "3: ADD %1,%1,#8\n" \ - " MOVT D0Ar2,#HI(1b)\n" \ - " JUMP D0Ar2,#LO(1b)\n" \ - " .previous\n" \ - " .section __ex_table,\"a\"\n" \ - " .long 2b,3b\n" \ - " .previous\n" \ - : "=r" (to), "=r" (ret) \ - : "0" (to), "1" (ret) \ - : "D1Ar1", "D0Ar2", "memory") - -/* Zero userspace. */ - -#define __asm_clear(to, ret, CLEAR, FIXUP, TENTRY) \ - asm volatile ( \ - " MOV D1Ar1,#0\n" \ - CLEAR \ - "1:\n" \ - " .section .fixup,\"ax\"\n" \ - FIXUP \ - " MOVT D1Ar1,#HI(1b)\n" \ - " JUMP D1Ar1,#LO(1b)\n" \ - " .previous\n" \ - " .section __ex_table,\"a\"\n" \ - TENTRY \ - " .previous" \ - : "=r" (to), "=r" (ret) \ - : "0" (to), "1" (ret) \ - : "D1Ar1", "memory") - -#define __asm_clear_1(to, ret) \ - __asm_clear(to, ret, \ - " SETB [%0],D1Ar1\n" \ - "2: SETB [%0++],D1Ar1\n", \ - "3: ADD %1,%1,#1\n", \ - " .long 2b,3b\n") - -#define __asm_clear_2(to, ret) \ - __asm_clear(to, ret, \ - " SETW [%0],D1Ar1\n" \ - "2: SETW [%0++],D1Ar1\n", \ - "3: ADD %1,%1,#2\n", \ - " .long 2b,3b\n") - -#define __asm_clear_3(to, ret) \ - __asm_clear(to, ret, \ - "2: SETW [%0++],D1Ar1\n" \ - " SETB [%0],D1Ar1\n" \ - "3: SETB [%0++],D1Ar1\n", \ - "4: ADD %1,%1,#2\n" \ - "5: ADD %1,%1,#1\n", \ - " .long 2b,4b\n" \ - " .long 3b,5b\n") - -#define __asm_clear_4x_cont(to, ret, CLEAR, FIXUP, TENTRY) \ - __asm_clear(to, ret, \ - " SETD [%0],D1Ar1\n" \ - "2: SETD [%0++],D1Ar1\n" CLEAR, \ - "3: ADD %1,%1,#4\n" FIXUP, \ - " .long 2b,3b\n" TENTRY) - -#define __asm_clear_4(to, ret) \ - __asm_clear_4x_cont(to, ret, "", "", "") - -#define __asm_clear_8x_cont(to, ret, CLEAR, FIXUP, TENTRY) \ - __asm_clear_4x_cont(to, ret, \ - " SETD [%0],D1Ar1\n" \ - "4: SETD [%0++],D1Ar1\n" CLEAR, \ - "5: ADD %1,%1,#4\n" FIXUP, \ - " .long 4b,5b\n" TENTRY) - -#define __asm_clear_8(to, ret) \ - __asm_clear_8x_cont(to, ret, "", "", "") - -#define __asm_clear_12x_cont(to, ret, CLEAR, FIXUP, TENTRY) \ - __asm_clear_8x_cont(to, ret, \ - " SETD [%0],D1Ar1\n" \ - "6: SETD [%0++],D1Ar1\n" CLEAR, \ - "7: ADD %1,%1,#4\n" FIXUP, \ - " .long 6b,7b\n" TENTRY) - -#define __asm_clear_12(to, ret) \ - __asm_clear_12x_cont(to, ret, "", "", "") - -#define __asm_clear_16x_cont(to, ret, CLEAR, FIXUP, TENTRY) \ - __asm_clear_12x_cont(to, ret, \ - " SETD [%0],D1Ar1\n" \ - "8: SETD [%0++],D1Ar1\n" CLEAR, \ - "9: ADD %1,%1,#4\n" FIXUP, \ - " .long 8b,9b\n" TENTRY) - -#define __asm_clear_16(to, ret) \ - __asm_clear_16x_cont(to, ret, "", "", "") - -unsigned long __do_clear_user(void __user *pto, unsigned long pn) -{ - register char __user *dst asm ("D0Re0") = pto; - register unsigned long n asm ("D1Re0") = pn; - register unsigned long retn asm ("D0Ar6") = 0; - - if ((unsigned long) dst & 1) { - __asm_clear_1(dst, retn); - n--; - } - - if ((unsigned long) dst & 2) { - __asm_clear_2(dst, retn); - n -= 2; - } - - /* 64 bit copy loop */ - if (!((__force unsigned long) dst & 7)) { - while (n >= 8) { - __asm_clear_8x64(dst, retn); - n -= 8; - } - } - - while (n >= 16) { - __asm_clear_16(dst, retn); - n -= 16; - } - - while (n >= 4) { - __asm_clear_4(dst, retn); - n -= 4; - } - - switch (n) { - case 0: - break; - case 1: - __asm_clear_1(dst, retn); - break; - case 2: - __asm_clear_2(dst, retn); - break; - case 3: - __asm_clear_3(dst, retn); - break; - } - - return retn; -} -EXPORT_SYMBOL(__do_clear_user); - -unsigned char __get_user_asm_b(const void __user *addr, long *err) -{ - register unsigned char x asm ("D0Re0") = 0; - asm volatile ( - " GETB %0,[%2]\n" - "1:\n" - " GETB %0,[%2]\n" - "2:\n" - " .section .fixup,\"ax\"\n" - "3: MOV D0FrT,%3\n" - " SETD [%1],D0FrT\n" - " MOVT D0FrT,#HI(2b)\n" - " JUMP D0FrT,#LO(2b)\n" - " .previous\n" - " .section __ex_table,\"a\"\n" - " .long 1b,3b\n" - " .previous\n" - : "=r" (x) - : "r" (err), "r" (addr), "P" (-EFAULT) - : "D0FrT"); - return x; -} -EXPORT_SYMBOL(__get_user_asm_b); - -unsigned short __get_user_asm_w(const void __user *addr, long *err) -{ - register unsigned short x asm ("D0Re0") = 0; - asm volatile ( - " GETW %0,[%2]\n" - "1:\n" - " GETW %0,[%2]\n" - "2:\n" - " .section .fixup,\"ax\"\n" - "3: MOV D0FrT,%3\n" - " SETD [%1],D0FrT\n" - " MOVT D0FrT,#HI(2b)\n" - " JUMP D0FrT,#LO(2b)\n" - " .previous\n" - " .section __ex_table,\"a\"\n" - " .long 1b,3b\n" - " .previous\n" - : "=r" (x) - : "r" (err), "r" (addr), "P" (-EFAULT) - : "D0FrT"); - return x; -} -EXPORT_SYMBOL(__get_user_asm_w); - -unsigned int __get_user_asm_d(const void __user *addr, long *err) -{ - register unsigned int x asm ("D0Re0") = 0; - asm volatile ( - " GETD %0,[%2]\n" - "1:\n" - " GETD %0,[%2]\n" - "2:\n" - " .section .fixup,\"ax\"\n" - "3: MOV D0FrT,%3\n" - " SETD [%1],D0FrT\n" - " MOVT D0FrT,#HI(2b)\n" - " JUMP D0FrT,#LO(2b)\n" - " .previous\n" - " .section __ex_table,\"a\"\n" - " .long 1b,3b\n" - " .previous\n" - : "=r" (x) - : "r" (err), "r" (addr), "P" (-EFAULT) - : "D0FrT"); - return x; -} -EXPORT_SYMBOL(__get_user_asm_d); - -unsigned long long __get_user_asm_l(const void __user *addr, long *err) -{ - register unsigned long long x asm ("D0Re0") = 0; - asm volatile ( - " GETL %0,%t0,[%2]\n" - "1:\n" - " GETL %0,%t0,[%2]\n" - "2:\n" - " .section .fixup,\"ax\"\n" - "3: MOV D0FrT,%3\n" - " SETD [%1],D0FrT\n" - " MOVT D0FrT,#HI(2b)\n" - " JUMP D0FrT,#LO(2b)\n" - " .previous\n" - " .section __ex_table,\"a\"\n" - " .long 1b,3b\n" - " .previous\n" - : "=r" (x) - : "r" (err), "r" (addr), "P" (-EFAULT) - : "D0FrT"); - return x; -} -EXPORT_SYMBOL(__get_user_asm_l); - -long __put_user_asm_b(unsigned int x, void __user *addr) -{ - register unsigned int err asm ("D0Re0") = 0; - asm volatile ( - " MOV %0,#0\n" - " SETB [%2],%1\n" - "1:\n" - " SETB [%2],%1\n" - "2:\n" - ".section .fixup,\"ax\"\n" - "3: MOV %0,%3\n" - " MOVT D0FrT,#HI(2b)\n" - " JUMP D0FrT,#LO(2b)\n" - ".previous\n" - ".section __ex_table,\"a\"\n" - " .long 1b,3b\n" - ".previous" - : "=r"(err) - : "d" (x), "a" (addr), "P"(-EFAULT) - : "D0FrT"); - return err; -} -EXPORT_SYMBOL(__put_user_asm_b); - -long __put_user_asm_w(unsigned int x, void __user *addr) -{ - register unsigned int err asm ("D0Re0") = 0; - asm volatile ( - " MOV %0,#0\n" - " SETW [%2],%1\n" - "1:\n" - " SETW [%2],%1\n" - "2:\n" - ".section .fixup,\"ax\"\n" - "3: MOV %0,%3\n" - " MOVT D0FrT,#HI(2b)\n" - " JUMP D0FrT,#LO(2b)\n" - ".previous\n" - ".section __ex_table,\"a\"\n" - " .long 1b,3b\n" - ".previous" - : "=r"(err) - : "d" (x), "a" (addr), "P"(-EFAULT) - : "D0FrT"); - return err; -} -EXPORT_SYMBOL(__put_user_asm_w); - -long __put_user_asm_d(unsigned int x, void __user *addr) -{ - register unsigned int err asm ("D0Re0") = 0; - asm volatile ( - " MOV %0,#0\n" - " SETD [%2],%1\n" - "1:\n" - " SETD [%2],%1\n" - "2:\n" - ".section .fixup,\"ax\"\n" - "3: MOV %0,%3\n" - " MOVT D0FrT,#HI(2b)\n" - " JUMP D0FrT,#LO(2b)\n" - ".previous\n" - ".section __ex_table,\"a\"\n" - " .long 1b,3b\n" - ".previous" - : "=r"(err) - : "d" (x), "a" (addr), "P"(-EFAULT) - : "D0FrT"); - return err; -} -EXPORT_SYMBOL(__put_user_asm_d); - -long __put_user_asm_l(unsigned long long x, void __user *addr) -{ - register unsigned int err asm ("D0Re0") = 0; - asm volatile ( - " MOV %0,#0\n" - " SETL [%2],%1,%t1\n" - "1:\n" - " SETL [%2],%1,%t1\n" - "2:\n" - ".section .fixup,\"ax\"\n" - "3: MOV %0,%3\n" - " MOVT D0FrT,#HI(2b)\n" - " JUMP D0FrT,#LO(2b)\n" - ".previous\n" - ".section __ex_table,\"a\"\n" - " .long 1b,3b\n" - ".previous" - : "=r"(err) - : "d" (x), "a" (addr), "P"(-EFAULT) - : "D0FrT"); - return err; -} -EXPORT_SYMBOL(__put_user_asm_l); - -long strnlen_user(const char __user *src, long count) -{ - long res; - - if (!access_ok(VERIFY_READ, src, 0)) - return 0; - - asm volatile (" MOV D0Ar4, %1\n" - " MOV D0Ar6, %2\n" - "0:\n" - " SUBS D0FrT, D0Ar6, #0\n" - " SUB D0Ar6, D0Ar6, #1\n" - " BLE 2f\n" - " GETB D0FrT, [D0Ar4+#1++]\n" - "1:\n" - " TST D0FrT, #255\n" - " BNE 0b\n" - "2:\n" - " SUB %0, %2, D0Ar6\n" - "3:\n" - " .section .fixup,\"ax\"\n" - "4:\n" - " MOV %0, #0\n" - " MOVT D0FrT,#HI(3b)\n" - " JUMP D0FrT,#LO(3b)\n" - " .previous\n" - " .section __ex_table,\"a\"\n" - " .long 1b,4b\n" - " .previous\n" - : "=r" (res) - : "r" (src), "r" (count) - : "D0FrT", "D0Ar4", "D0Ar6", "cc"); - - return res; -} -EXPORT_SYMBOL(strnlen_user); - -long __strncpy_from_user(char *dst, const char __user *src, long count) -{ - long res; - - if (count == 0) - return 0; - - /* - * Currently, in 2.4.0-test9, most ports use a simple byte-copy loop. - * So do we. - * - * This code is deduced from: - * - * char tmp2; - * long tmp1, tmp3; - * tmp1 = count; - * while ((*dst++ = (tmp2 = *src++)) != 0 - * && --tmp1) - * ; - * - * res = count - tmp1; - * - * with tweaks. - */ - - asm volatile (" MOV %0,%3\n" - "1:\n" - " GETB D0FrT,[%2++]\n" - "2:\n" - " CMP D0FrT,#0\n" - " SETB [%1++],D0FrT\n" - " BEQ 3f\n" - " SUBS %0,%0,#1\n" - " BNZ 1b\n" - "3:\n" - " SUB %0,%3,%0\n" - "4:\n" - " .section .fixup,\"ax\"\n" - "5:\n" - " MOV %0,%7\n" - " MOVT D0FrT,#HI(4b)\n" - " JUMP D0FrT,#LO(4b)\n" - " .previous\n" - " .section __ex_table,\"a\"\n" - " .long 2b,5b\n" - " .previous" - : "=r" (res), "=r" (dst), "=r" (src), "=r" (count) - : "3" (count), "1" (dst), "2" (src), "P" (-EFAULT) - : "D0FrT", "memory", "cc"); - - return res; -} -EXPORT_SYMBOL(__strncpy_from_user); diff --git a/arch/metag/mm/Kconfig b/arch/metag/mm/Kconfig deleted file mode 100644 index 9d4b2c67dcc1e..0000000000000 --- a/arch/metag/mm/Kconfig +++ /dev/null @@ -1,147 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -menu "Memory management options" - -config PAGE_OFFSET - hex "Kernel page offset address" - default "0x40000000" - help - This option allows you to set the virtual address at which the - kernel will be mapped to. -endmenu - -config KERNEL_4M_PAGES - bool "Map kernel with 4MB pages" - depends on METAG_META21_MMU - default y - help - Map the kernel with large pages to reduce TLB pressure. - -choice - prompt "User page size" - default PAGE_SIZE_4K - -config PAGE_SIZE_4K - bool "4kB" - help - This is the default page size used by all Meta cores. - -config PAGE_SIZE_8K - bool "8kB" - depends on METAG_META21_MMU - help - This enables 8kB pages as supported by Meta 2.x and later MMUs. - -config PAGE_SIZE_16K - bool "16kB" - depends on METAG_META21_MMU - help - This enables 16kB pages as supported by Meta 2.x and later MMUs. - -endchoice - -config NUMA - bool "Non Uniform Memory Access (NUMA) Support" - select ARCH_WANT_NUMA_VARIABLE_LOCALITY - help - Some Meta systems have MMU-mappable on-chip memories with - lower latencies than main memory. This enables support for - these blocks by binding them to nodes and allowing - memory policies to be used for prioritizing and controlling - allocation behaviour. - -config FORCE_MAX_ZONEORDER - int "Maximum zone order" - range 10 32 - default "10" - help - The kernel memory allocator divides physically contiguous memory - blocks into "zones", where each zone is a power of two number of - pages. This option selects the largest power of two that the kernel - keeps in the memory allocator. If you need to allocate very large - blocks of physically contiguous memory, then you may need to - increase this value. - - This config option is actually maximum order plus one. For example, - a value of 11 means that the largest free memory block is 2^10 pages. - - The page size is not necessarily 4KB. Keep this in mind - when choosing a value for this option. - -config METAG_L2C - bool "Level 2 Cache Support" - depends on METAG_META21 - help - Press y here to enable support for the Meta Level 2 (L2) cache. This - will enable the cache at start up if it hasn't already been enabled - by the bootloader. - - If the bootloader enables the L2 you must press y here to ensure the - kernel takes the appropriate actions to keep the cache coherent. - -config NODES_SHIFT - int - default "1" - depends on NEED_MULTIPLE_NODES - -config ARCH_FLATMEM_ENABLE - def_bool y - depends on !NUMA - -config ARCH_SPARSEMEM_ENABLE - def_bool y - select SPARSEMEM_STATIC - -config ARCH_SPARSEMEM_DEFAULT - def_bool y - -config ARCH_SELECT_MEMORY_MODEL - def_bool y - -config SYS_SUPPORTS_HUGETLBFS - def_bool y - depends on METAG_META21_MMU - -choice - prompt "HugeTLB page size" - depends on METAG_META21_MMU && HUGETLB_PAGE - default HUGETLB_PAGE_SIZE_1M - -config HUGETLB_PAGE_SIZE_8K - bool "8kB" - depends on PAGE_SIZE_4K - -config HUGETLB_PAGE_SIZE_16K - bool "16kB" - depends on PAGE_SIZE_4K || PAGE_SIZE_8K - -config HUGETLB_PAGE_SIZE_32K - bool "32kB" - -config HUGETLB_PAGE_SIZE_64K - bool "64kB" - -config HUGETLB_PAGE_SIZE_128K - bool "128kB" - -config HUGETLB_PAGE_SIZE_256K - bool "256kB" - -config HUGETLB_PAGE_SIZE_512K - bool "512kB" - -config HUGETLB_PAGE_SIZE_1M - bool "1MB" - -config HUGETLB_PAGE_SIZE_2M - bool "2MB" - -config HUGETLB_PAGE_SIZE_4M - bool "4MB" - -endchoice - -config METAG_COREMEM - bool - default y if SUSPEND - -source "mm/Kconfig" diff --git a/arch/metag/mm/Makefile b/arch/metag/mm/Makefile deleted file mode 100644 index 0c7c91ba9fb96..0000000000000 --- a/arch/metag/mm/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# -# Makefile for the linux Meta-specific parts of the memory manager. -# - -obj-y += cache.o -obj-y += extable.o -obj-y += fault.o -obj-y += init.o -obj-y += ioremap.o -obj-y += maccess.o - -mmu-y := mmu-meta1.o -mmu-$(CONFIG_METAG_META21_MMU) := mmu-meta2.o -obj-y += $(mmu-y) - -obj-$(CONFIG_HIGHMEM) += highmem.o -obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o -obj-$(CONFIG_METAG_L2C) += l2cache.o -obj-$(CONFIG_NUMA) += numa.o diff --git a/arch/metag/mm/cache.c b/arch/metag/mm/cache.c deleted file mode 100644 index a62285284ab8f..0000000000000 --- a/arch/metag/mm/cache.c +++ /dev/null @@ -1,521 +0,0 @@ -/* - * arch/metag/mm/cache.c - * - * Copyright (C) 2001, 2002, 2005, 2007, 2012 Imagination Technologies. - * - * 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. - * - * Cache control code - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#define DEFAULT_CACHE_WAYS_LOG2 2 - -/* - * Size of a set in the caches. Initialised for default 16K stride, adjusted - * according to values passed through TBI global heap segment via LDLK (on ATP) - * or config registers (on HTP/MTP) - */ -static int dcache_set_shift = METAG_TBI_CACHE_SIZE_BASE_LOG2 - - DEFAULT_CACHE_WAYS_LOG2; -static int icache_set_shift = METAG_TBI_CACHE_SIZE_BASE_LOG2 - - DEFAULT_CACHE_WAYS_LOG2; -/* - * The number of sets in the caches. Initialised for HTP/ATP, adjusted - * according to NOMMU setting in config registers - */ -static unsigned char dcache_sets_log2 = DEFAULT_CACHE_WAYS_LOG2; -static unsigned char icache_sets_log2 = DEFAULT_CACHE_WAYS_LOG2; - -#ifndef CONFIG_METAG_META12 -/** - * metag_lnkget_probe() - Probe whether lnkget/lnkset go around the cache - */ -static volatile u32 lnkget_testdata[16] __initdata __aligned(64); - -#define LNKGET_CONSTANT 0xdeadbeef - -static void __init metag_lnkget_probe(void) -{ - int temp; - long flags; - - /* - * It's conceivable the user has configured a globally coherent cache - * shared with non-Linux hardware threads, so use LOCK2 to prevent them - * from executing and causing cache eviction during the test. - */ - __global_lock2(flags); - - /* read a value to bring it into the cache */ - (void)lnkget_testdata[0]; - lnkget_testdata[0] = 0; - - /* lnkget/lnkset it to modify it */ - asm volatile( - "1: LNKGETD %0, [%1]\n" - " LNKSETD [%1], %2\n" - " DEFR %0, TXSTAT\n" - " ANDT %0, %0, #HI(0x3f000000)\n" - " CMPT %0, #HI(0x02000000)\n" - " BNZ 1b\n" - : "=&d" (temp) - : "da" (&lnkget_testdata[0]), "bd" (LNKGET_CONSTANT) - : "cc"); - - /* re-read it to see if the cached value changed */ - temp = lnkget_testdata[0]; - - __global_unlock2(flags); - - /* flush the cache line to fix any incoherency */ - __builtin_dcache_flush((void *)&lnkget_testdata[0]); - -#if defined(CONFIG_METAG_LNKGET_AROUND_CACHE) - /* if the cache is right, LNKGET_AROUND_CACHE is unnecessary */ - if (temp == LNKGET_CONSTANT) - pr_info("LNKGET/SET go through cache but CONFIG_METAG_LNKGET_AROUND_CACHE=y\n"); -#elif defined(CONFIG_METAG_ATOMICITY_LNKGET) - /* - * if the cache is wrong, LNKGET_AROUND_CACHE is really necessary - * because the kernel is configured to use LNKGET/SET for atomicity - */ - WARN(temp != LNKGET_CONSTANT, - "LNKGET/SET go around cache but CONFIG_METAG_LNKGET_AROUND_CACHE=n\n" - "Expect kernel failure as it's used for atomicity primitives\n"); -#elif defined(CONFIG_SMP) - /* - * if the cache is wrong, LNKGET_AROUND_CACHE should be used or the - * gateway page won't flush and userland could break. - */ - WARN(temp != LNKGET_CONSTANT, - "LNKGET/SET go around cache but CONFIG_METAG_LNKGET_AROUND_CACHE=n\n" - "Expect userland failure as it's used for user gateway page\n"); -#else - /* - * if the cache is wrong, LNKGET_AROUND_CACHE is set wrong, but it - * doesn't actually matter as it doesn't have any effect on !SMP && - * !ATOMICITY_LNKGET. - */ - if (temp != LNKGET_CONSTANT) - pr_warn("LNKGET/SET go around cache but CONFIG_METAG_LNKGET_AROUND_CACHE=n\n"); -#endif -} -#endif /* !CONFIG_METAG_META12 */ - -/** - * metag_cache_probe() - Probe L1 cache configuration. - * - * Probe the L1 cache configuration to aid the L1 physical cache flushing - * functions. - */ -void __init metag_cache_probe(void) -{ -#ifndef CONFIG_METAG_META12 - int coreid = metag_in32(METAC_CORE_ID); - int config = metag_in32(METAC_CORE_CONFIG2); - int cfgcache = coreid & METAC_COREID_CFGCACHE_BITS; - - if (cfgcache == METAC_COREID_CFGCACHE_TYPE0 || - cfgcache == METAC_COREID_CFGCACHE_PRIVNOMMU) { - icache_sets_log2 = 1; - dcache_sets_log2 = 1; - } - - /* For normal size caches, the smallest size is 4Kb. - For small caches, the smallest size is 64b */ - icache_set_shift = (config & METAC_CORECFG2_ICSMALL_BIT) - ? 6 : 12; - icache_set_shift += (config & METAC_CORE_C2ICSZ_BITS) - >> METAC_CORE_C2ICSZ_S; - icache_set_shift -= icache_sets_log2; - - dcache_set_shift = (config & METAC_CORECFG2_DCSMALL_BIT) - ? 6 : 12; - dcache_set_shift += (config & METAC_CORECFG2_DCSZ_BITS) - >> METAC_CORECFG2_DCSZ_S; - dcache_set_shift -= dcache_sets_log2; - - metag_lnkget_probe(); -#else - /* Extract cache sizes from global heap segment */ - unsigned long val, u; - int width, shift, addend; - PTBISEG seg; - - seg = __TBIFindSeg(NULL, TBID_SEG(TBID_THREAD_GLOBAL, - TBID_SEGSCOPE_GLOBAL, - TBID_SEGTYPE_HEAP)); - if (seg != NULL) { - val = seg->Data[1]; - - /* Work out width of I-cache size bit-field */ - u = ((unsigned long) METAG_TBI_ICACHE_SIZE_BITS) - >> METAG_TBI_ICACHE_SIZE_S; - width = 0; - while (u & 1) { - width++; - u >>= 1; - } - /* Extract sign-extended size addend value */ - shift = 32 - (METAG_TBI_ICACHE_SIZE_S + width); - addend = (long) ((val & METAG_TBI_ICACHE_SIZE_BITS) - << shift) - >> (shift + METAG_TBI_ICACHE_SIZE_S); - /* Now calculate I-cache set size */ - icache_set_shift = (METAG_TBI_CACHE_SIZE_BASE_LOG2 - - DEFAULT_CACHE_WAYS_LOG2) - + addend; - - /* Similarly for D-cache */ - u = ((unsigned long) METAG_TBI_DCACHE_SIZE_BITS) - >> METAG_TBI_DCACHE_SIZE_S; - width = 0; - while (u & 1) { - width++; - u >>= 1; - } - shift = 32 - (METAG_TBI_DCACHE_SIZE_S + width); - addend = (long) ((val & METAG_TBI_DCACHE_SIZE_BITS) - << shift) - >> (shift + METAG_TBI_DCACHE_SIZE_S); - dcache_set_shift = (METAG_TBI_CACHE_SIZE_BASE_LOG2 - - DEFAULT_CACHE_WAYS_LOG2) - + addend; - } -#endif -} - -static void metag_phys_data_cache_flush(const void *start) -{ - unsigned long flush0, flush1, flush2, flush3; - int loops, step; - int thread; - int part, offset; - int set_shift; - - /* Use a sequence of writes to flush the cache region requested */ - thread = (__core_reg_get(TXENABLE) & TXENABLE_THREAD_BITS) - >> TXENABLE_THREAD_S; - - /* Cache is broken into sets which lie in contiguous RAMs */ - set_shift = dcache_set_shift; - - /* Move to the base of the physical cache flush region */ - flush0 = LINSYSCFLUSH_DCACHE_LINE; - step = 64; - - /* Get partition data for this thread */ - part = metag_in32(SYSC_DCPART0 + - (SYSC_xCPARTn_STRIDE * thread)); - - if ((int)start < 0) - /* Access Global vs Local partition */ - part >>= SYSC_xCPARTG_AND_S - - SYSC_xCPARTL_AND_S; - - /* Extract offset and move SetOff */ - offset = (part & SYSC_xCPARTL_OR_BITS) - >> SYSC_xCPARTL_OR_S; - flush0 += (offset << (set_shift - 4)); - - /* Shrink size */ - part = (part & SYSC_xCPARTL_AND_BITS) - >> SYSC_xCPARTL_AND_S; - loops = ((part + 1) << (set_shift - 4)); - - /* Reduce loops by step of cache line size */ - loops /= step; - - flush1 = flush0 + (1 << set_shift); - flush2 = flush0 + (2 << set_shift); - flush3 = flush0 + (3 << set_shift); - - if (dcache_sets_log2 == 1) { - flush2 = flush1; - flush3 = flush1 + step; - flush1 = flush0 + step; - step <<= 1; - loops >>= 1; - } - - /* Clear loops ways in cache */ - while (loops-- != 0) { - /* Clear the ways. */ -#if 0 - /* - * GCC doesn't generate very good code for this so we - * provide inline assembly instead. - */ - metag_out8(0, flush0); - metag_out8(0, flush1); - metag_out8(0, flush2); - metag_out8(0, flush3); - - flush0 += step; - flush1 += step; - flush2 += step; - flush3 += step; -#else - asm volatile ( - "SETB\t[%0+%4++],%5\n" - "SETB\t[%1+%4++],%5\n" - "SETB\t[%2+%4++],%5\n" - "SETB\t[%3+%4++],%5\n" - : "+e" (flush0), - "+e" (flush1), - "+e" (flush2), - "+e" (flush3) - : "e" (step), "a" (0)); -#endif - } -} - -void metag_data_cache_flush_all(const void *start) -{ - if ((metag_in32(SYSC_CACHE_MMU_CONFIG) & SYSC_CMMUCFG_DC_ON_BIT) == 0) - /* No need to flush the data cache it's not actually enabled */ - return; - - metag_phys_data_cache_flush(start); -} - -void metag_data_cache_flush(const void *start, int bytes) -{ - unsigned long flush0; - int loops, step; - - if ((metag_in32(SYSC_CACHE_MMU_CONFIG) & SYSC_CMMUCFG_DC_ON_BIT) == 0) - /* No need to flush the data cache it's not actually enabled */ - return; - - if (bytes >= 4096) { - metag_phys_data_cache_flush(start); - return; - } - - /* Use linear cache flush mechanism on META IP */ - flush0 = (int)start; - loops = ((int)start & (DCACHE_LINE_BYTES - 1)) + bytes + - (DCACHE_LINE_BYTES - 1); - loops >>= DCACHE_LINE_S; - -#define PRIM_FLUSH(addr, offset) do { \ - int __addr = ((int) (addr)) + ((offset) * 64); \ - __builtin_dcache_flush((void *)(__addr)); \ - } while (0) - -#define LOOP_INC (4*64) - - do { - /* By default stop */ - step = 0; - - switch (loops) { - /* Drop Thru Cases! */ - default: - PRIM_FLUSH(flush0, 3); - loops -= 4; - step = 1; - case 3: - PRIM_FLUSH(flush0, 2); - case 2: - PRIM_FLUSH(flush0, 1); - case 1: - PRIM_FLUSH(flush0, 0); - flush0 += LOOP_INC; - case 0: - break; - } - } while (step); -} -EXPORT_SYMBOL(metag_data_cache_flush); - -static void metag_phys_code_cache_flush(const void *start, int bytes) -{ - unsigned long flush0, flush1, flush2, flush3, end_set; - int loops, step; - int thread; - int set_shift, set_size; - int part, offset; - - /* Use a sequence of writes to flush the cache region requested */ - thread = (__core_reg_get(TXENABLE) & TXENABLE_THREAD_BITS) - >> TXENABLE_THREAD_S; - set_shift = icache_set_shift; - - /* Move to the base of the physical cache flush region */ - flush0 = LINSYSCFLUSH_ICACHE_LINE; - step = 64; - - /* Get partition code for this thread */ - part = metag_in32(SYSC_ICPART0 + - (SYSC_xCPARTn_STRIDE * thread)); - - if ((int)start < 0) - /* Access Global vs Local partition */ - part >>= SYSC_xCPARTG_AND_S-SYSC_xCPARTL_AND_S; - - /* Extract offset and move SetOff */ - offset = (part & SYSC_xCPARTL_OR_BITS) - >> SYSC_xCPARTL_OR_S; - flush0 += (offset << (set_shift - 4)); - - /* Shrink size */ - part = (part & SYSC_xCPARTL_AND_BITS) - >> SYSC_xCPARTL_AND_S; - loops = ((part + 1) << (set_shift - 4)); - - /* Where does the Set end? */ - end_set = flush0 + loops; - set_size = loops; - -#ifdef CONFIG_METAG_META12 - if ((bytes < 4096) && (bytes < loops)) { - /* Unreachable on HTP/MTP */ - /* Only target the sets that could be relavent */ - flush0 += (loops - step) & ((int) start); - loops = (((int) start) & (step-1)) + bytes + step - 1; - } -#endif - - /* Reduce loops by step of cache line size */ - loops /= step; - - flush1 = flush0 + (1<>= 1; - } - - /* Clear loops ways in cache */ - while (loops-- != 0) { -#if 0 - /* - * GCC doesn't generate very good code for this so we - * provide inline assembly instead. - */ - /* Clear the ways */ - metag_out8(0, flush0); - metag_out8(0, flush1); - metag_out8(0, flush2); - metag_out8(0, flush3); - - flush0 += step; - flush1 += step; - flush2 += step; - flush3 += step; -#else - asm volatile ( - "SETB\t[%0+%4++],%5\n" - "SETB\t[%1+%4++],%5\n" - "SETB\t[%2+%4++],%5\n" - "SETB\t[%3+%4++],%5\n" - : "+e" (flush0), - "+e" (flush1), - "+e" (flush2), - "+e" (flush3) - : "e" (step), "a" (0)); -#endif - - if (flush0 == end_set) { - /* Wrap within Set 0 */ - flush0 -= set_size; - flush1 -= set_size; - flush2 -= set_size; - flush3 -= set_size; - } - } -} - -void metag_code_cache_flush_all(const void *start) -{ - if ((metag_in32(SYSC_CACHE_MMU_CONFIG) & SYSC_CMMUCFG_IC_ON_BIT) == 0) - /* No need to flush the code cache it's not actually enabled */ - return; - - metag_phys_code_cache_flush(start, 4096); -} -EXPORT_SYMBOL(metag_code_cache_flush_all); - -void metag_code_cache_flush(const void *start, int bytes) -{ -#ifndef CONFIG_METAG_META12 - void *flush; - int loops, step; -#endif /* !CONFIG_METAG_META12 */ - - if ((metag_in32(SYSC_CACHE_MMU_CONFIG) & SYSC_CMMUCFG_IC_ON_BIT) == 0) - /* No need to flush the code cache it's not actually enabled */ - return; - -#ifdef CONFIG_METAG_META12 - /* CACHEWD isn't available on Meta1, so always do full cache flush */ - metag_phys_code_cache_flush(start, bytes); - -#else /* CONFIG_METAG_META12 */ - /* If large size do full physical cache flush */ - if (bytes >= 4096) { - metag_phys_code_cache_flush(start, bytes); - return; - } - - /* Use linear cache flush mechanism on META IP */ - flush = (void *)((int)start & ~(ICACHE_LINE_BYTES-1)); - loops = ((int)start & (ICACHE_LINE_BYTES-1)) + bytes + - (ICACHE_LINE_BYTES-1); - loops >>= ICACHE_LINE_S; - -#define PRIM_IFLUSH(addr, offset) \ - __builtin_meta2_cachewd(((addr) + ((offset) * 64)), CACHEW_ICACHE_BIT) - -#define LOOP_INC (4*64) - - do { - /* By default stop */ - step = 0; - - switch (loops) { - /* Drop Thru Cases! */ - default: - PRIM_IFLUSH(flush, 3); - loops -= 4; - step = 1; - case 3: - PRIM_IFLUSH(flush, 2); - case 2: - PRIM_IFLUSH(flush, 1); - case 1: - PRIM_IFLUSH(flush, 0); - flush += LOOP_INC; - case 0: - break; - } - } while (step); -#endif /* !CONFIG_METAG_META12 */ -} -EXPORT_SYMBOL(metag_code_cache_flush); diff --git a/arch/metag/mm/extable.c b/arch/metag/mm/extable.c deleted file mode 100644 index 9b92d3ad7f9c5..0000000000000 --- a/arch/metag/mm/extable.c +++ /dev/null @@ -1,15 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#include -#include - -int fixup_exception(struct pt_regs *regs) -{ - const struct exception_table_entry *fixup; - unsigned long pc = instruction_pointer(regs); - - fixup = search_exception_tables(pc); - if (fixup) - regs->ctx.CurrPC = fixup->fixup; - - return fixup != NULL; -} diff --git a/arch/metag/mm/fault.c b/arch/metag/mm/fault.c deleted file mode 100644 index de54fe686080b..0000000000000 --- a/arch/metag/mm/fault.c +++ /dev/null @@ -1,247 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Meta page fault handling. - * - * Copyright (C) 2005-2012 Imagination Technologies Ltd. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -/* Clear any pending catch buffer state. */ -static void clear_cbuf_entry(struct pt_regs *regs, unsigned long addr, - unsigned int trapno) -{ - PTBICTXEXTCB0 cbuf = regs->extcb0; - - switch (trapno) { - /* Instruction fetch faults leave no catch buffer state. */ - case TBIXXF_SIGNUM_IGF: - case TBIXXF_SIGNUM_IPF: - return; - default: - if (cbuf[0].CBAddr == addr) { - cbuf[0].CBAddr = 0; - cbuf[0].CBFlags &= ~TXCATCH0_FAULT_BITS; - - /* And, as this is the ONLY catch entry, we - * need to clear the cbuf bit from the context! - */ - regs->ctx.SaveMask &= ~(TBICTX_CBUF_BIT | - TBICTX_XCBF_BIT); - - return; - } - pr_err("Failed to clear cbuf entry!\n"); - } -} - -int show_unhandled_signals = 1; - -int do_page_fault(struct pt_regs *regs, unsigned long address, - unsigned int write_access, unsigned int trapno) -{ - struct task_struct *tsk; - struct mm_struct *mm; - struct vm_area_struct *vma, *prev_vma; - siginfo_t info; - int fault; - unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE; - - tsk = current; - - if ((address >= VMALLOC_START) && (address < VMALLOC_END)) { - /* - * Synchronize this task's top level page-table - * with the 'reference' page table. - * - * Do _not_ use "tsk" here. We might be inside - * an interrupt in the middle of a task switch.. - */ - int offset = pgd_index(address); - pgd_t *pgd, *pgd_k; - pud_t *pud, *pud_k; - pmd_t *pmd, *pmd_k; - pte_t *pte_k; - - pgd = ((pgd_t *)mmu_get_base()) + offset; - pgd_k = swapper_pg_dir + offset; - - /* This will never happen with the folded page table. */ - if (!pgd_present(*pgd)) { - if (!pgd_present(*pgd_k)) - goto bad_area_nosemaphore; - set_pgd(pgd, *pgd_k); - return 0; - } - - pud = pud_offset(pgd, address); - pud_k = pud_offset(pgd_k, address); - if (!pud_present(*pud_k)) - goto bad_area_nosemaphore; - set_pud(pud, *pud_k); - - pmd = pmd_offset(pud, address); - pmd_k = pmd_offset(pud_k, address); - if (!pmd_present(*pmd_k)) - goto bad_area_nosemaphore; - set_pmd(pmd, *pmd_k); - - pte_k = pte_offset_kernel(pmd_k, address); - if (!pte_present(*pte_k)) - goto bad_area_nosemaphore; - - /* May only be needed on Chorus2 */ - flush_tlb_all(); - return 0; - } - - mm = tsk->mm; - - if (faulthandler_disabled() || !mm) - goto no_context; - - if (user_mode(regs)) - flags |= FAULT_FLAG_USER; -retry: - down_read(&mm->mmap_sem); - - vma = find_vma_prev(mm, address, &prev_vma); - - if (!vma || address < vma->vm_start) - goto check_expansion; - -good_area: - if (write_access) { - if (!(vma->vm_flags & VM_WRITE)) - goto bad_area; - flags |= FAULT_FLAG_WRITE; - } else { - if (!(vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE))) - goto bad_area; - } - - /* - * If for any reason at all we couldn't handle the fault, - * make sure we exit gracefully rather than endlessly redo - * the fault. - */ - fault = handle_mm_fault(vma, address, flags); - - if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current)) - return 0; - - if (unlikely(fault & VM_FAULT_ERROR)) { - if (fault & VM_FAULT_OOM) - goto out_of_memory; - else if (fault & VM_FAULT_SIGSEGV) - goto bad_area; - else if (fault & VM_FAULT_SIGBUS) - goto do_sigbus; - BUG(); - } - if (flags & FAULT_FLAG_ALLOW_RETRY) { - if (fault & VM_FAULT_MAJOR) - tsk->maj_flt++; - else - tsk->min_flt++; - if (fault & VM_FAULT_RETRY) { - flags &= ~FAULT_FLAG_ALLOW_RETRY; - flags |= FAULT_FLAG_TRIED; - - /* - * No need to up_read(&mm->mmap_sem) as we would - * have already released it in __lock_page_or_retry - * in mm/filemap.c. - */ - - goto retry; - } - } - - up_read(&mm->mmap_sem); - return 0; - -check_expansion: - vma = prev_vma; - if (vma && (expand_stack(vma, address) == 0)) - goto good_area; - -bad_area: - up_read(&mm->mmap_sem); - -bad_area_nosemaphore: - if (user_mode(regs)) { - info.si_signo = SIGSEGV; - info.si_errno = 0; - info.si_code = SEGV_MAPERR; - info.si_addr = (__force void __user *)address; - info.si_trapno = trapno; - - if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) && - printk_ratelimit()) { - printk("%s%s[%d]: segfault at %lx pc %08x sp %08x write %d trap %#x (%s)", - task_pid_nr(tsk) > 1 ? KERN_INFO : KERN_EMERG, - tsk->comm, task_pid_nr(tsk), address, - regs->ctx.CurrPC, regs->ctx.AX[0].U0, - write_access, trapno, trap_name(trapno)); - print_vma_addr(" in ", regs->ctx.CurrPC); - print_vma_addr(" rtp in ", regs->ctx.DX[4].U1); - printk("\n"); - show_regs(regs); - } - force_sig_info(SIGSEGV, &info, tsk); - return 1; - } - goto no_context; - -do_sigbus: - up_read(&mm->mmap_sem); - - /* - * Send a sigbus, regardless of whether we were in kernel - * or user mode. - */ - info.si_signo = SIGBUS; - info.si_errno = 0; - info.si_code = BUS_ADRERR; - info.si_addr = (__force void __user *)address; - info.si_trapno = trapno; - force_sig_info(SIGBUS, &info, tsk); - - /* Kernel mode? Handle exceptions or die */ - if (!user_mode(regs)) - goto no_context; - - return 1; - - /* - * We ran out of memory, or some other thing happened to us that made - * us unable to handle the page fault gracefully. - */ -out_of_memory: - up_read(&mm->mmap_sem); - if (user_mode(regs)) { - pagefault_out_of_memory(); - return 1; - } - -no_context: - /* Are we prepared to handle this kernel fault? */ - if (fixup_exception(regs)) { - clear_cbuf_entry(regs, address, trapno); - return 1; - } - - die("Oops", regs, (write_access << 15) | trapno, address); - do_exit(SIGKILL); -} diff --git a/arch/metag/mm/highmem.c b/arch/metag/mm/highmem.c deleted file mode 100644 index 83527fc7c8a74..0000000000000 --- a/arch/metag/mm/highmem.c +++ /dev/null @@ -1,122 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#include -#include -#include -#include -#include -#include -#include - -static pte_t *kmap_pte; - -unsigned long highstart_pfn, highend_pfn; - -void *kmap(struct page *page) -{ - might_sleep(); - if (!PageHighMem(page)) - return page_address(page); - return kmap_high(page); -} -EXPORT_SYMBOL(kmap); - -void kunmap(struct page *page) -{ - BUG_ON(in_interrupt()); - if (!PageHighMem(page)) - return; - kunmap_high(page); -} -EXPORT_SYMBOL(kunmap); - -/* - * kmap_atomic/kunmap_atomic is significantly faster than kmap/kunmap because - * no global lock is needed and because the kmap code must perform a global TLB - * invalidation when the kmap pool wraps. - * - * However when holding an atomic kmap is is not legal to sleep, so atomic - * kmaps are appropriate for short, tight code paths only. - */ - -void *kmap_atomic(struct page *page) -{ - enum fixed_addresses idx; - unsigned long vaddr; - int type; - - preempt_disable(); - pagefault_disable(); - if (!PageHighMem(page)) - return page_address(page); - - type = kmap_atomic_idx_push(); - idx = type + KM_TYPE_NR * smp_processor_id(); - vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); -#ifdef CONFIG_DEBUG_HIGHMEM - BUG_ON(!pte_none(*(kmap_pte - idx))); -#endif - set_pte(kmap_pte - idx, mk_pte(page, PAGE_KERNEL)); - - return (void *)vaddr; -} -EXPORT_SYMBOL(kmap_atomic); - -void __kunmap_atomic(void *kvaddr) -{ - unsigned long vaddr = (unsigned long) kvaddr & PAGE_MASK; - int idx, type; - - if (kvaddr >= (void *)FIXADDR_START) { - type = kmap_atomic_idx(); - idx = type + KM_TYPE_NR * smp_processor_id(); - - /* - * Force other mappings to Oops if they'll try to access this - * pte without first remap it. Keeping stale mappings around - * is a bad idea also, in case the page changes cacheability - * attributes or becomes a protected page in a hypervisor. - */ - pte_clear(&init_mm, vaddr, kmap_pte-idx); - flush_tlb_kernel_range(vaddr, vaddr + PAGE_SIZE); - - kmap_atomic_idx_pop(); - } - - pagefault_enable(); - preempt_enable(); -} -EXPORT_SYMBOL(__kunmap_atomic); - -/* - * This is the same as kmap_atomic() but can map memory that doesn't - * have a struct page associated with it. - */ -void *kmap_atomic_pfn(unsigned long pfn) -{ - enum fixed_addresses idx; - unsigned long vaddr; - int type; - - preempt_disable(); - pagefault_disable(); - - type = kmap_atomic_idx_push(); - idx = type + KM_TYPE_NR * smp_processor_id(); - vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); -#ifdef CONFIG_DEBUG_HIGHMEM - BUG_ON(!pte_none(*(kmap_pte - idx))); -#endif - set_pte(kmap_pte - idx, pfn_pte(pfn, PAGE_KERNEL)); - flush_tlb_kernel_range(vaddr, vaddr + PAGE_SIZE); - - return (void *)vaddr; -} - -void __init kmap_init(void) -{ - unsigned long kmap_vstart; - - /* cache the first kmap pte */ - kmap_vstart = __fix_to_virt(FIX_KMAP_BEGIN); - kmap_pte = kmap_get_fixmap_pte(kmap_vstart); -} diff --git a/arch/metag/mm/hugetlbpage.c b/arch/metag/mm/hugetlbpage.c deleted file mode 100644 index 012ee4c80dc7a..0000000000000 --- a/arch/metag/mm/hugetlbpage.c +++ /dev/null @@ -1,251 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * arch/metag/mm/hugetlbpage.c - * - * METAG HugeTLB page support. - * - * Cloned from SuperH - * - * Cloned from sparc64 by Paul Mundt. - * - * Copyright (C) 2002, 2003 David S. Miller (davem@redhat.com) - */ - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -/* - * If the arch doesn't supply something else, assume that hugepage - * size aligned regions are ok without further preparation. - */ -int prepare_hugepage_range(struct file *file, unsigned long addr, - unsigned long len) -{ - struct mm_struct *mm = current->mm; - struct hstate *h = hstate_file(file); - struct vm_area_struct *vma; - - if (len & ~huge_page_mask(h)) - return -EINVAL; - if (addr & ~huge_page_mask(h)) - return -EINVAL; - if (TASK_SIZE - len < addr) - return -EINVAL; - - vma = find_vma(mm, ALIGN_HUGEPT(addr)); - if (vma && !(vma->vm_flags & MAP_HUGETLB)) - return -EINVAL; - - vma = find_vma(mm, addr); - if (vma) { - if (addr + len > vma->vm_start) - return -EINVAL; - if (!(vma->vm_flags & MAP_HUGETLB) && - (ALIGN_HUGEPT(addr + len) > vma->vm_start)) - return -EINVAL; - } - return 0; -} - -pte_t *huge_pte_alloc(struct mm_struct *mm, - unsigned long addr, unsigned long sz) -{ - pgd_t *pgd; - pud_t *pud; - pmd_t *pmd; - pte_t *pte; - - pgd = pgd_offset(mm, addr); - pud = pud_offset(pgd, addr); - pmd = pmd_offset(pud, addr); - pte = pte_alloc_map(mm, pmd, addr); - pgd->pgd &= ~_PAGE_SZ_MASK; - pgd->pgd |= _PAGE_SZHUGE; - - return pte; -} - -pte_t *huge_pte_offset(struct mm_struct *mm, - unsigned long addr, unsigned long sz) -{ - pgd_t *pgd; - pud_t *pud; - pmd_t *pmd; - pte_t *pte = NULL; - - pgd = pgd_offset(mm, addr); - pud = pud_offset(pgd, addr); - pmd = pmd_offset(pud, addr); - pte = pte_offset_kernel(pmd, addr); - - return pte; -} - -int pmd_huge(pmd_t pmd) -{ - return pmd_page_shift(pmd) > PAGE_SHIFT; -} - -int pud_huge(pud_t pud) -{ - return 0; -} - -struct page *follow_huge_pmd(struct mm_struct *mm, unsigned long address, - pmd_t *pmd, int write) -{ - return NULL; -} - -#ifdef HAVE_ARCH_HUGETLB_UNMAPPED_AREA - -/* - * Look for an unmapped area starting after another hugetlb vma. - * There are guaranteed to be no huge pte's spare if all the huge pages are - * full size (4MB), so in that case compile out this search. - */ -#if HPAGE_SHIFT == HUGEPT_SHIFT -static inline unsigned long -hugetlb_get_unmapped_area_existing(unsigned long len) -{ - return 0; -} -#else -static unsigned long -hugetlb_get_unmapped_area_existing(unsigned long len) -{ - struct mm_struct *mm = current->mm; - struct vm_area_struct *vma; - unsigned long start_addr, addr; - int after_huge; - - if (mm->context.part_huge) { - start_addr = mm->context.part_huge; - after_huge = 1; - } else { - start_addr = TASK_UNMAPPED_BASE; - after_huge = 0; - } -new_search: - addr = start_addr; - - for (vma = find_vma(mm, addr); ; vma = vma->vm_next) { - if ((!vma && !after_huge) || TASK_SIZE - len < addr) { - /* - * Start a new search - just in case we missed - * some holes. - */ - if (start_addr != TASK_UNMAPPED_BASE) { - start_addr = TASK_UNMAPPED_BASE; - goto new_search; - } - return 0; - } - /* skip ahead if we've aligned right over some vmas */ - if (vma && vma->vm_end <= addr) - continue; - /* space before the next vma? */ - if (after_huge && (!vma || ALIGN_HUGEPT(addr + len) - <= vma->vm_start)) { - unsigned long end = addr + len; - if (end & HUGEPT_MASK) - mm->context.part_huge = end; - else if (addr == mm->context.part_huge) - mm->context.part_huge = 0; - return addr; - } - if (vma->vm_flags & MAP_HUGETLB) { - /* space after a huge vma in 2nd level page table? */ - if (vma->vm_end & HUGEPT_MASK) { - after_huge = 1; - /* no need to align to the next PT block */ - addr = vma->vm_end; - continue; - } - } - after_huge = 0; - addr = ALIGN_HUGEPT(vma->vm_end); - } -} -#endif - -/* Do a full search to find an area without any nearby normal pages. */ -static unsigned long -hugetlb_get_unmapped_area_new_pmd(unsigned long len) -{ - struct vm_unmapped_area_info info; - - info.flags = 0; - info.length = len; - info.low_limit = TASK_UNMAPPED_BASE; - info.high_limit = TASK_SIZE; - info.align_mask = PAGE_MASK & HUGEPT_MASK; - info.align_offset = 0; - return vm_unmapped_area(&info); -} - -unsigned long -hugetlb_get_unmapped_area(struct file *file, unsigned long addr, - unsigned long len, unsigned long pgoff, unsigned long flags) -{ - struct hstate *h = hstate_file(file); - - if (len & ~huge_page_mask(h)) - return -EINVAL; - if (len > TASK_SIZE) - return -ENOMEM; - - if (flags & MAP_FIXED) { - if (prepare_hugepage_range(file, addr, len)) - return -EINVAL; - return addr; - } - - if (addr) { - addr = ALIGN(addr, huge_page_size(h)); - if (!prepare_hugepage_range(file, addr, len)) - return addr; - } - - /* - * Look for an existing hugetlb vma with space after it (this is to to - * minimise fragmentation caused by huge pages. - */ - addr = hugetlb_get_unmapped_area_existing(len); - if (addr) - return addr; - - /* - * Find an unmapped naturally aligned set of 4MB blocks that we can use - * for huge pages. - */ - return hugetlb_get_unmapped_area_new_pmd(len); -} - -#endif /*HAVE_ARCH_HUGETLB_UNMAPPED_AREA*/ - -/* necessary for boot time 4MB huge page allocation */ -static __init int setup_hugepagesz(char *opt) -{ - unsigned long ps = memparse(opt, &opt); - if (ps == (1 << HPAGE_SHIFT)) { - hugetlb_add_hstate(HPAGE_SHIFT - PAGE_SHIFT); - } else { - hugetlb_bad_size(); - pr_err("hugepagesz: Unsupported page size %lu M\n", - ps >> 20); - return 0; - } - return 1; -} -__setup("hugepagesz=", setup_hugepagesz); diff --git a/arch/metag/mm/init.c b/arch/metag/mm/init.c deleted file mode 100644 index 0e2ca90589983..0000000000000 --- a/arch/metag/mm/init.c +++ /dev/null @@ -1,408 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Copyright (C) 2005,2006,2007,2008,2009,2010 Imagination Technologies - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -unsigned long pfn_base; -EXPORT_SYMBOL(pfn_base); - -pgd_t swapper_pg_dir[PTRS_PER_PGD] __page_aligned_data; - -unsigned long empty_zero_page; -EXPORT_SYMBOL(empty_zero_page); - -extern char __user_gateway_start; -extern char __user_gateway_end; - -void *gateway_page; - -/* - * Insert the gateway page into a set of page tables, creating the - * page tables if necessary. - */ -static void insert_gateway_page(pgd_t *pgd, unsigned long address) -{ - pud_t *pud; - pmd_t *pmd; - pte_t *pte; - - BUG_ON(!pgd_present(*pgd)); - - pud = pud_offset(pgd, address); - BUG_ON(!pud_present(*pud)); - - pmd = pmd_offset(pud, address); - if (!pmd_present(*pmd)) { - pte = alloc_bootmem_pages(PAGE_SIZE); - set_pmd(pmd, __pmd(_PAGE_TABLE | __pa(pte))); - } - - pte = pte_offset_kernel(pmd, address); - set_pte(pte, pfn_pte(__pa(gateway_page) >> PAGE_SHIFT, PAGE_READONLY)); -} - -/* Alloc and map a page in a known location accessible to userspace. */ -static void __init user_gateway_init(void) -{ - unsigned long address = USER_GATEWAY_PAGE; - int offset = pgd_index(address); - pgd_t *pgd; - - gateway_page = alloc_bootmem_pages(PAGE_SIZE); - - pgd = swapper_pg_dir + offset; - insert_gateway_page(pgd, address); - -#ifdef CONFIG_METAG_META12 - /* - * Insert the gateway page into our current page tables even - * though we've already inserted it into our reference page - * table (swapper_pg_dir). This is because with a META1 mmu we - * copy just the user address range and not the gateway page - * entry on context switch, see switch_mmu(). - */ - pgd = (pgd_t *)mmu_get_base() + offset; - insert_gateway_page(pgd, address); -#endif /* CONFIG_METAG_META12 */ - - BUG_ON((&__user_gateway_end - &__user_gateway_start) > PAGE_SIZE); - - gateway_page += (address & ~PAGE_MASK); - - memcpy(gateway_page, &__user_gateway_start, - &__user_gateway_end - &__user_gateway_start); - - /* - * We don't need to flush the TLB here, there should be no mapping - * present at boot for this address and only valid mappings are in - * the TLB (apart from on Meta 1.x, but those cached invalid - * mappings should be impossible to hit here). - * - * We don't flush the code cache here even though we have written - * code through the data cache and they may not be coherent. At - * this point we assume there is no stale data in the code cache - * for this address so there is no need to flush. - */ -} - -static void __init allocate_pgdat(unsigned int nid) -{ - unsigned long start_pfn, end_pfn; -#ifdef CONFIG_NEED_MULTIPLE_NODES - unsigned long phys; -#endif - - get_pfn_range_for_nid(nid, &start_pfn, &end_pfn); - -#ifdef CONFIG_NEED_MULTIPLE_NODES - phys = __memblock_alloc_base(sizeof(struct pglist_data), - SMP_CACHE_BYTES, end_pfn << PAGE_SHIFT); - /* Retry with all of system memory */ - if (!phys) - phys = __memblock_alloc_base(sizeof(struct pglist_data), - SMP_CACHE_BYTES, - memblock_end_of_DRAM()); - if (!phys) - panic("Can't allocate pgdat for node %d\n", nid); - - NODE_DATA(nid) = __va(phys); - memset(NODE_DATA(nid), 0, sizeof(struct pglist_data)); - - NODE_DATA(nid)->bdata = &bootmem_node_data[nid]; -#endif - - NODE_DATA(nid)->node_start_pfn = start_pfn; - NODE_DATA(nid)->node_spanned_pages = end_pfn - start_pfn; -} - -static void __init bootmem_init_one_node(unsigned int nid) -{ - unsigned long total_pages, paddr; - unsigned long end_pfn; - struct pglist_data *p; - - p = NODE_DATA(nid); - - /* Nothing to do.. */ - if (!p->node_spanned_pages) - return; - - end_pfn = pgdat_end_pfn(p); -#ifdef CONFIG_HIGHMEM - if (end_pfn > max_low_pfn) - end_pfn = max_low_pfn; -#endif - - total_pages = bootmem_bootmap_pages(end_pfn - p->node_start_pfn); - - paddr = memblock_alloc(total_pages << PAGE_SHIFT, PAGE_SIZE); - if (!paddr) - panic("Can't allocate bootmap for nid[%d]\n", nid); - - init_bootmem_node(p, paddr >> PAGE_SHIFT, p->node_start_pfn, end_pfn); - - free_bootmem_with_active_regions(nid, end_pfn); - - /* - * XXX Handle initial reservations for the system memory node - * only for the moment, we'll refactor this later for handling - * reservations in other nodes. - */ - if (nid == 0) { - struct memblock_region *reg; - - /* Reserve the sections we're already using. */ - for_each_memblock(reserved, reg) { - unsigned long size = reg->size; - -#ifdef CONFIG_HIGHMEM - /* ...but not highmem */ - if (PFN_DOWN(reg->base) >= highstart_pfn) - continue; - - if (PFN_UP(reg->base + size) > highstart_pfn) - size = (highstart_pfn - PFN_DOWN(reg->base)) - << PAGE_SHIFT; -#endif - - reserve_bootmem(reg->base, size, BOOTMEM_DEFAULT); - } - } - - sparse_memory_present_with_active_regions(nid); -} - -static void __init do_init_bootmem(void) -{ - struct memblock_region *reg; - int i; - - /* Add active regions with valid PFNs. */ - for_each_memblock(memory, reg) { - unsigned long start_pfn, end_pfn; - start_pfn = memblock_region_memory_base_pfn(reg); - end_pfn = memblock_region_memory_end_pfn(reg); - memblock_set_node(PFN_PHYS(start_pfn), - PFN_PHYS(end_pfn - start_pfn), - &memblock.memory, 0); - } - - /* All of system RAM sits in node 0 for the non-NUMA case */ - allocate_pgdat(0); - node_set_online(0); - - soc_mem_setup(); - - for_each_online_node(i) - bootmem_init_one_node(i); - - sparse_init(); -} - -extern char _heap_start[]; - -static void __init init_and_reserve_mem(void) -{ - unsigned long start_pfn, heap_start; - u64 base = min_low_pfn << PAGE_SHIFT; - u64 size = (max_low_pfn << PAGE_SHIFT) - base; - - heap_start = (unsigned long) &_heap_start; - - memblock_add(base, size); - - /* - * Partially used pages are not usable - thus - * we are rounding upwards: - */ - start_pfn = PFN_UP(__pa(heap_start)); - - /* - * Reserve the kernel text. - */ - memblock_reserve(base, (PFN_PHYS(start_pfn) + PAGE_SIZE - 1) - base); - -#ifdef CONFIG_HIGHMEM - /* - * Add & reserve highmem, so page structures are initialised. - */ - base = highstart_pfn << PAGE_SHIFT; - size = (highend_pfn << PAGE_SHIFT) - base; - if (size) { - memblock_add(base, size); - memblock_reserve(base, size); - } -#endif -} - -#ifdef CONFIG_HIGHMEM -/* - * Ensure we have allocated page tables in swapper_pg_dir for the - * fixed mappings range from 'start' to 'end'. - */ -static void __init allocate_pgtables(unsigned long start, unsigned long end) -{ - pgd_t *pgd; - pmd_t *pmd; - pte_t *pte; - int i, j; - unsigned long vaddr; - - vaddr = start; - i = pgd_index(vaddr); - j = pmd_index(vaddr); - pgd = swapper_pg_dir + i; - - for ( ; (i < PTRS_PER_PGD) && (vaddr != end); pgd++, i++) { - pmd = (pmd_t *)pgd; - for (; (j < PTRS_PER_PMD) && (vaddr != end); pmd++, j++) { - vaddr += PMD_SIZE; - - if (!pmd_none(*pmd)) - continue; - - pte = (pte_t *)alloc_bootmem_low_pages(PAGE_SIZE); - pmd_populate_kernel(&init_mm, pmd, pte); - } - j = 0; - } -} - -static void __init fixedrange_init(void) -{ - unsigned long vaddr, end; - pgd_t *pgd; - pud_t *pud; - pmd_t *pmd; - pte_t *pte; - - /* - * Fixed mappings: - */ - vaddr = __fix_to_virt(__end_of_fixed_addresses - 1) & PMD_MASK; - end = (FIXADDR_TOP + PMD_SIZE - 1) & PMD_MASK; - allocate_pgtables(vaddr, end); - - /* - * Permanent kmaps: - */ - vaddr = PKMAP_BASE; - allocate_pgtables(vaddr, vaddr + PAGE_SIZE*LAST_PKMAP); - - pgd = swapper_pg_dir + pgd_index(vaddr); - pud = pud_offset(pgd, vaddr); - pmd = pmd_offset(pud, vaddr); - pte = pte_offset_kernel(pmd, vaddr); - pkmap_page_table = pte; -} -#endif /* CONFIG_HIGHMEM */ - -/* - * paging_init() continues the virtual memory environment setup which - * was begun by the code in arch/metag/kernel/setup.c. - */ -void __init paging_init(unsigned long mem_end) -{ - unsigned long max_zone_pfns[MAX_NR_ZONES]; - int nid; - - init_and_reserve_mem(); - - memblock_allow_resize(); - - memblock_dump_all(); - - nodes_clear(node_online_map); - - init_new_context(&init_task, &init_mm); - - memset(swapper_pg_dir, 0, sizeof(swapper_pg_dir)); - - do_init_bootmem(); - mmu_init(mem_end); - -#ifdef CONFIG_HIGHMEM - fixedrange_init(); - kmap_init(); -#endif - - /* Initialize the zero page to a bootmem page, already zeroed. */ - empty_zero_page = (unsigned long)alloc_bootmem_pages(PAGE_SIZE); - - user_gateway_init(); - - memset(max_zone_pfns, 0, sizeof(max_zone_pfns)); - - for_each_online_node(nid) { - pg_data_t *pgdat = NODE_DATA(nid); - unsigned long low, start_pfn; - - start_pfn = pgdat->bdata->node_min_pfn; - low = pgdat->bdata->node_low_pfn; - - if (max_zone_pfns[ZONE_NORMAL] < low) - max_zone_pfns[ZONE_NORMAL] = low; - -#ifdef CONFIG_HIGHMEM - max_zone_pfns[ZONE_HIGHMEM] = highend_pfn; -#endif - pr_info("Node %u: start_pfn = 0x%lx, low = 0x%lx\n", - nid, start_pfn, low); - } - - free_area_init_nodes(max_zone_pfns); -} - -void __init mem_init(void) -{ -#ifdef CONFIG_HIGHMEM - unsigned long tmp; - - /* - * Explicitly reset zone->managed_pages because highmem pages are - * freed before calling free_all_bootmem(); - */ - reset_all_zones_managed_pages(); - for (tmp = highstart_pfn; tmp < highend_pfn; tmp++) - free_highmem_page(pfn_to_page(tmp)); -#endif /* CONFIG_HIGHMEM */ - - free_all_bootmem(); - mem_init_print_info(NULL); -} - -void free_initmem(void) -{ - free_initmem_default(POISON_FREE_INITMEM); -} - -#ifdef CONFIG_BLK_DEV_INITRD -void free_initrd_mem(unsigned long start, unsigned long end) -{ - free_reserved_area((void *)start, (void *)end, POISON_FREE_INITMEM, - "initrd"); -} -#endif diff --git a/arch/metag/mm/ioremap.c b/arch/metag/mm/ioremap.c deleted file mode 100644 index df2b59cb02eb1..0000000000000 --- a/arch/metag/mm/ioremap.c +++ /dev/null @@ -1,90 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Re-map IO memory to kernel address space so that we can access it. - * Needed for memory-mapped I/O devices mapped outside our normal DRAM - * window (that is, all memory-mapped I/O devices). - * - * Copyright (C) 1995,1996 Linus Torvalds - * - * Meta port based on CRIS-port by Axis Communications AB - */ - -#include -#include -#include -#include -#include - -#include - -/* - * Remap an arbitrary physical address space into the kernel virtual - * address space. Needed when the kernel wants to access high addresses - * directly. - * - * NOTE! We need to allow non-page-aligned mappings too: we will obviously - * have to convert them into an offset in a page-aligned mapping, but the - * caller shouldn't need to know that small detail. - */ -void __iomem *__ioremap(unsigned long phys_addr, size_t size, - unsigned long flags) -{ - unsigned long addr; - struct vm_struct *area; - unsigned long offset, last_addr; - pgprot_t prot; - - /* Don't allow wraparound or zero size */ - last_addr = phys_addr + size - 1; - if (!size || last_addr < phys_addr) - return NULL; - - /* Custom region addresses are accessible and uncached by default. */ - if (phys_addr >= LINSYSCUSTOM_BASE && - phys_addr < (LINSYSCUSTOM_BASE + LINSYSCUSTOM_LIMIT)) - return (__force void __iomem *) phys_addr; - - /* - * Mappings have to be page-aligned - */ - offset = phys_addr & ~PAGE_MASK; - phys_addr &= PAGE_MASK; - size = PAGE_ALIGN(last_addr+1) - phys_addr; - prot = __pgprot(_PAGE_PRESENT | _PAGE_WRITE | _PAGE_DIRTY | - _PAGE_ACCESSED | _PAGE_KERNEL | _PAGE_CACHE_WIN0 | - flags); - - /* - * Ok, go for it.. - */ - area = get_vm_area(size, VM_IOREMAP); - if (!area) - return NULL; - area->phys_addr = phys_addr; - addr = (unsigned long) area->addr; - if (ioremap_page_range(addr, addr + size, phys_addr, prot)) { - vunmap((void *) addr); - return NULL; - } - return (__force void __iomem *) (offset + (char *)addr); -} -EXPORT_SYMBOL(__ioremap); - -void __iounmap(void __iomem *addr) -{ - struct vm_struct *p; - - if ((__force unsigned long)addr >= LINSYSCUSTOM_BASE && - (__force unsigned long)addr < (LINSYSCUSTOM_BASE + - LINSYSCUSTOM_LIMIT)) - return; - - p = remove_vm_area((void *)(PAGE_MASK & (unsigned long __force)addr)); - if (unlikely(!p)) { - pr_err("iounmap: bad address %p\n", addr); - return; - } - - kfree(p); -} -EXPORT_SYMBOL(__iounmap); diff --git a/arch/metag/mm/l2cache.c b/arch/metag/mm/l2cache.c deleted file mode 100644 index addffc58989c8..0000000000000 --- a/arch/metag/mm/l2cache.c +++ /dev/null @@ -1,193 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#include -#include -#include - -#include -#include - -/* If non-0, then initialise the L2 cache */ -static int l2cache_init = 1; -/* If non-0, then initialise the L2 cache prefetch */ -static int l2cache_init_pf = 1; - -int l2c_pfenable; - -static volatile u32 l2c_testdata[16] __initdata __aligned(64); - -static int __init parse_l2cache(char *p) -{ - char *cp = p; - - if (get_option(&cp, &l2cache_init) != 1) { - pr_err("Bad l2cache parameter (%s)\n", p); - return 1; - } - return 0; -} -early_param("l2cache", parse_l2cache); - -static int __init parse_l2cache_pf(char *p) -{ - char *cp = p; - - if (get_option(&cp, &l2cache_init_pf) != 1) { - pr_err("Bad l2cache_pf parameter (%s)\n", p); - return 1; - } - return 0; -} -early_param("l2cache_pf", parse_l2cache_pf); - -static int __init meta_l2c_setup(void) -{ - /* - * If the L2 cache isn't even present, don't do anything, but say so in - * the log. - */ - if (!meta_l2c_is_present()) { - pr_info("L2 Cache: Not present\n"); - return 0; - } - - /* - * Check whether the line size is recognised. - */ - if (!meta_l2c_linesize()) { - pr_warn_once("L2 Cache: unknown line size id (config=0x%08x)\n", - meta_l2c_config()); - } - - /* - * Initialise state. - */ - l2c_pfenable = _meta_l2c_pf_is_enabled(); - - /* - * Enable the L2 cache and print to log whether it was already enabled - * by the bootloader. - */ - if (l2cache_init) { - pr_info("L2 Cache: Enabling... "); - if (meta_l2c_enable()) - pr_cont("already enabled\n"); - else - pr_cont("done\n"); - } else { - pr_info("L2 Cache: Not enabling\n"); - } - - /* - * Enable L2 cache prefetch. - */ - if (l2cache_init_pf) { - pr_info("L2 Cache: Enabling prefetch... "); - if (meta_l2c_pf_enable(1)) - pr_cont("already enabled\n"); - else - pr_cont("done\n"); - } else { - pr_info("L2 Cache: Not enabling prefetch\n"); - } - - return 0; -} -core_initcall(meta_l2c_setup); - -int meta_l2c_disable(void) -{ - unsigned long flags; - int en; - - if (!meta_l2c_is_present()) - return 1; - - /* - * Prevent other threads writing during the writeback, otherwise the - * writes will get "lost" when the L2 is disabled. - */ - __global_lock2(flags); - en = meta_l2c_is_enabled(); - if (likely(en)) { - _meta_l2c_pf_enable(0); - wr_fence(); - _meta_l2c_purge(); - _meta_l2c_enable(0); - } - __global_unlock2(flags); - - return !en; -} - -int meta_l2c_enable(void) -{ - unsigned long flags; - int en; - - if (!meta_l2c_is_present()) - return 0; - - /* - * Init (clearing the L2) can happen while the L2 is disabled, so other - * threads are safe to continue executing, however we must not init the - * cache if it's already enabled (dirty lines would be discarded), so - * this operation should still be atomic with other threads. - */ - __global_lock1(flags); - en = meta_l2c_is_enabled(); - if (likely(!en)) { - _meta_l2c_init(); - _meta_l2c_enable(1); - _meta_l2c_pf_enable(l2c_pfenable); - } - __global_unlock1(flags); - - return en; -} - -int meta_l2c_pf_enable(int pfenable) -{ - unsigned long flags; - int en = l2c_pfenable; - - if (!meta_l2c_is_present()) - return 0; - - /* - * We read modify write the enable register, so this operation must be - * atomic with other threads. - */ - __global_lock1(flags); - en = l2c_pfenable; - l2c_pfenable = pfenable; - if (meta_l2c_is_enabled()) - _meta_l2c_pf_enable(pfenable); - __global_unlock1(flags); - - return en; -} - -int meta_l2c_flush(void) -{ - unsigned long flags; - int en; - - /* - * Prevent other threads writing during the writeback. This also - * involves read modify writes. - */ - __global_lock2(flags); - en = meta_l2c_is_enabled(); - if (likely(en)) { - _meta_l2c_pf_enable(0); - wr_fence(); - _meta_l2c_purge(); - _meta_l2c_enable(0); - _meta_l2c_init(); - _meta_l2c_enable(1); - _meta_l2c_pf_enable(l2c_pfenable); - } - __global_unlock2(flags); - - return !en; -} diff --git a/arch/metag/mm/maccess.c b/arch/metag/mm/maccess.c deleted file mode 100644 index c22755165df99..0000000000000 --- a/arch/metag/mm/maccess.c +++ /dev/null @@ -1,69 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * safe read and write memory routines callable while atomic - * - * Copyright 2012 Imagination Technologies - */ - -#include -#include - -/* - * The generic probe_kernel_write() uses the user copy code which can split the - * writes if the source is unaligned, and repeats writes to make exceptions - * precise. We override it here to avoid these things happening to memory mapped - * IO memory where they could have undesired effects. - * Due to the use of CACHERD instruction this only works on Meta2 onwards. - */ -#ifdef CONFIG_METAG_META21 -long probe_kernel_write(void *dst, const void *src, size_t size) -{ - unsigned long ldst = (unsigned long)dst; - void __iomem *iodst = (void __iomem *)dst; - unsigned long lsrc = (unsigned long)src; - const u8 *psrc = (u8 *)src; - unsigned int pte, i; - u8 bounce[8] __aligned(8); - - if (!size) - return 0; - - /* Use the write combine bit to decide is the destination is MMIO. */ - pte = __builtin_meta2_cacherd(dst); - - /* Check the mapping is valid and writeable. */ - if ((pte & (MMCU_ENTRY_WR_BIT | MMCU_ENTRY_VAL_BIT)) - != (MMCU_ENTRY_WR_BIT | MMCU_ENTRY_VAL_BIT)) - return -EFAULT; - - /* Fall back to generic version for cases we're not interested in. */ - if (pte & MMCU_ENTRY_WRC_BIT || /* write combined memory */ - (ldst & (size - 1)) || /* destination unaligned */ - size > 8 || /* more than max write size */ - (size & (size - 1))) /* non power of 2 size */ - return __probe_kernel_write(dst, src, size); - - /* If src is unaligned, copy to the aligned bounce buffer first. */ - if (lsrc & (size - 1)) { - for (i = 0; i < size; ++i) - bounce[i] = psrc[i]; - psrc = bounce; - } - - switch (size) { - case 1: - writeb(*psrc, iodst); - break; - case 2: - writew(*(const u16 *)psrc, iodst); - break; - case 4: - writel(*(const u32 *)psrc, iodst); - break; - case 8: - writeq(*(const u64 *)psrc, iodst); - break; - } - return 0; -} -#endif diff --git a/arch/metag/mm/mmu-meta1.c b/arch/metag/mm/mmu-meta1.c deleted file mode 100644 index 53190b13dc544..0000000000000 --- a/arch/metag/mm/mmu-meta1.c +++ /dev/null @@ -1,157 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Copyright (C) 2005,2006,2007,2008,2009 Imagination Technologies - * - * Meta 1 MMU handling code. - * - */ - -#include -#include -#include - -#include - -#define DM3_BASE (LINSYSDIRECT_BASE + (MMCU_DIRECTMAPn_ADDR_SCALE * 3)) - -/* - * This contains the physical address of the top level 2k pgd table. - */ -static unsigned long mmu_base_phys; - -/* - * Given a physical address, return a mapped virtual address that can be used - * to access that location. - * In practice, we use the DirectMap region to make this happen. - */ -static unsigned long map_addr(unsigned long phys) -{ - static unsigned long dm_base = 0xFFFFFFFF; - int offset; - - offset = phys - dm_base; - - /* Are we in the current map range ? */ - if ((offset < 0) || (offset >= MMCU_DIRECTMAPn_ADDR_SCALE)) { - /* Calculate new DM area */ - dm_base = phys & ~(MMCU_DIRECTMAPn_ADDR_SCALE - 1); - - /* Actually map it in! */ - metag_out32(dm_base, MMCU_DIRECTMAP3_ADDR); - - /* And calculate how far into that area our reference is */ - offset = phys - dm_base; - } - - return DM3_BASE + offset; -} - -/* - * Return the physical address of the base of our pgd table. - */ -static inline unsigned long __get_mmu_base(void) -{ - unsigned long base_phys; - unsigned int stride; - - if (is_global_space(PAGE_OFFSET)) - stride = 4; - else - stride = hard_processor_id(); /* [0..3] */ - - base_phys = metag_in32(MMCU_TABLE_PHYS_ADDR); - base_phys += (0x800 * stride); - - return base_phys; -} - -/* Given a virtual address, return the virtual address of the relevant pgd */ -static unsigned long pgd_entry_addr(unsigned long virt) -{ - unsigned long pgd_phys; - unsigned long pgd_virt; - - if (!mmu_base_phys) - mmu_base_phys = __get_mmu_base(); - - /* - * Are we trying to map a global address. If so, then index - * the global pgd table instead of our local one. - */ - if (is_global_space(virt)) { - /* Scale into 2gig map */ - virt &= ~0x80000000; - } - - /* Base of the pgd table plus our 4Meg entry, 4bytes each */ - pgd_phys = mmu_base_phys + ((virt >> PGDIR_SHIFT) * 4); - - pgd_virt = map_addr(pgd_phys); - - return pgd_virt; -} - -/* Given a virtual address, return the virtual address of the relevant pte */ -static unsigned long pgtable_entry_addr(unsigned long virt) -{ - unsigned long pgtable_phys; - unsigned long pgtable_virt, pte_virt; - - /* Find the physical address of the 4MB page table*/ - pgtable_phys = metag_in32(pgd_entry_addr(virt)) & MMCU_ENTRY_ADDR_BITS; - - /* Map it to a virtual address */ - pgtable_virt = map_addr(pgtable_phys); - - /* And index into it for our pte */ - pte_virt = pgtable_virt + ((virt >> PAGE_SHIFT) & 0x3FF) * 4; - - return pte_virt; -} - -unsigned long mmu_read_first_level_page(unsigned long vaddr) -{ - return metag_in32(pgd_entry_addr(vaddr)); -} - -unsigned long mmu_read_second_level_page(unsigned long vaddr) -{ - return metag_in32(pgtable_entry_addr(vaddr)); -} - -unsigned long mmu_get_base(void) -{ - static unsigned long __base; - - /* Find the base of our MMU pgd table */ - if (!__base) - __base = pgd_entry_addr(0); - - return __base; -} - -void __init mmu_init(unsigned long mem_end) -{ - unsigned long entry, addr; - pgd_t *p_swapper_pg_dir; - - /* - * Now copy over any MMU pgd entries already in the mmu page tables - * over to our root init process (swapper_pg_dir) map. This map is - * then inherited by all other processes, which means all processes - * inherit a map of the kernel space. - */ - addr = PAGE_OFFSET; - entry = pgd_index(PAGE_OFFSET); - p_swapper_pg_dir = pgd_offset_k(0) + entry; - - while (addr <= META_MEMORY_LIMIT) { - unsigned long pgd_entry; - /* copy over the current MMU value */ - pgd_entry = mmu_read_first_level_page(addr); - pgd_val(*p_swapper_pg_dir) = pgd_entry; - - p_swapper_pg_dir++; - addr += PGDIR_SIZE; - } -} diff --git a/arch/metag/mm/mmu-meta2.c b/arch/metag/mm/mmu-meta2.c deleted file mode 100644 index 8b668a69c9806..0000000000000 --- a/arch/metag/mm/mmu-meta2.c +++ /dev/null @@ -1,208 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Copyright (C) 2008,2009,2010,2011 Imagination Technologies Ltd. - * - * Meta 2 enhanced mode MMU handling code. - * - */ - -#include -#include -#include -#include -#include -#include - -#include -#include - -unsigned long mmu_read_first_level_page(unsigned long vaddr) -{ - unsigned int cpu = hard_processor_id(); - unsigned long offset, linear_base, linear_limit; - unsigned int phys0; - pgd_t *pgd, entry; - - if (is_global_space(vaddr)) - vaddr &= ~0x80000000; - - offset = vaddr >> PGDIR_SHIFT; - - phys0 = metag_in32(mmu_phys0_addr(cpu)); - - /* Top bit of linear base is always zero. */ - linear_base = (phys0 >> PGDIR_SHIFT) & 0x1ff; - - /* Limit in the range 0 (4MB) to 9 (2GB). */ - linear_limit = 1 << ((phys0 >> 8) & 0xf); - linear_limit += linear_base; - - /* - * If offset is below linear base or above the limit then no - * mapping exists. - */ - if (offset < linear_base || offset > linear_limit) - return 0; - - offset -= linear_base; - pgd = (pgd_t *)mmu_get_base(); - entry = pgd[offset]; - - return pgd_val(entry); -} - -unsigned long mmu_read_second_level_page(unsigned long vaddr) -{ - return __builtin_meta2_cacherd((void *)(vaddr & PAGE_MASK)); -} - -unsigned long mmu_get_base(void) -{ - unsigned int cpu = hard_processor_id(); - unsigned long stride; - - stride = cpu * LINSYSMEMTnX_STRIDE; - - /* - * Bits 18:2 of the MMCU_TnLocal_TABLE_PHYS1 register should be - * used as an offset to the start of the top-level pgd table. - */ - stride += (metag_in32(mmu_phys1_addr(cpu)) & 0x7fffc); - - if (is_global_space(PAGE_OFFSET)) - stride += LINSYSMEMTXG_OFFSET; - - return LINSYSMEMT0L_BASE + stride; -} - -#define FIRST_LEVEL_MASK 0xffffffc0 -#define SECOND_LEVEL_MASK 0xfffff000 -#define SECOND_LEVEL_ALIGN 64 - -static void repriv_mmu_tables(void) -{ - unsigned long phys0_addr; - unsigned int g; - - /* - * Check that all the mmu table regions are priv protected, and if not - * fix them and emit a warning. If we left them without priv protection - * then userland processes would have access to a 2M window into - * physical memory near where the page tables are. - */ - phys0_addr = MMCU_T0LOCAL_TABLE_PHYS0; - for (g = 0; g < 2; ++g) { - unsigned int t, phys0; - unsigned long flags; - for (t = 0; t < 4; ++t) { - __global_lock2(flags); - phys0 = metag_in32(phys0_addr); - if ((phys0 & _PAGE_PRESENT) && !(phys0 & _PAGE_PRIV)) { - pr_warn("Fixing priv protection on T%d %s MMU table region\n", - t, - g ? "global" : "local"); - phys0 |= _PAGE_PRIV; - metag_out32(phys0, phys0_addr); - } - __global_unlock2(flags); - - phys0_addr += MMCU_TnX_TABLE_PHYSX_STRIDE; - } - - phys0_addr += MMCU_TXG_TABLE_PHYSX_OFFSET - - 4*MMCU_TnX_TABLE_PHYSX_STRIDE; - } -} - -#ifdef CONFIG_METAG_SUSPEND_MEM -static void mmu_resume(void) -{ - /* - * If a full suspend to RAM has happened then the original bad MMU table - * priv may have been restored, so repriv them again. - */ - repriv_mmu_tables(); -} -#else -#define mmu_resume NULL -#endif /* CONFIG_METAG_SUSPEND_MEM */ - -static struct syscore_ops mmu_syscore_ops = { - .resume = mmu_resume, -}; - -void __init mmu_init(unsigned long mem_end) -{ - unsigned long entry, addr; - pgd_t *p_swapper_pg_dir; -#ifdef CONFIG_KERNEL_4M_PAGES - unsigned long mem_size = mem_end - PAGE_OFFSET; - unsigned int pages = DIV_ROUND_UP(mem_size, 1 << 22); - unsigned int second_level_entry = 0; - unsigned long *second_level_table; -#endif - - /* - * Now copy over any MMU pgd entries already in the mmu page tables - * over to our root init process (swapper_pg_dir) map. This map is - * then inherited by all other processes, which means all processes - * inherit a map of the kernel space. - */ - addr = META_MEMORY_BASE; - entry = pgd_index(META_MEMORY_BASE); - p_swapper_pg_dir = pgd_offset_k(0) + entry; - - while (entry < (PTRS_PER_PGD - pgd_index(META_MEMORY_BASE))) { - unsigned long pgd_entry; - /* copy over the current MMU value */ - pgd_entry = mmu_read_first_level_page(addr); - pgd_val(*p_swapper_pg_dir) = pgd_entry; - - p_swapper_pg_dir++; - addr += PGDIR_SIZE; - entry++; - } - -#ifdef CONFIG_KERNEL_4M_PAGES - /* - * At this point we can also map the kernel with 4MB pages to - * reduce TLB pressure. - */ - second_level_table = alloc_bootmem_pages(SECOND_LEVEL_ALIGN * pages); - - addr = PAGE_OFFSET; - entry = pgd_index(PAGE_OFFSET); - p_swapper_pg_dir = pgd_offset_k(0) + entry; - - while (pages > 0) { - unsigned long phys_addr, second_level_phys; - pte_t *pte = (pte_t *)&second_level_table[second_level_entry]; - - phys_addr = __pa(addr); - - second_level_phys = __pa(pte); - - pgd_val(*p_swapper_pg_dir) = ((second_level_phys & - FIRST_LEVEL_MASK) | - _PAGE_SZ_4M | - _PAGE_PRESENT); - - pte_val(*pte) = ((phys_addr & SECOND_LEVEL_MASK) | - _PAGE_PRESENT | _PAGE_DIRTY | - _PAGE_ACCESSED | _PAGE_WRITE | - _PAGE_CACHEABLE | _PAGE_KERNEL); - - p_swapper_pg_dir++; - addr += PGDIR_SIZE; - /* Second level pages must be 64byte aligned. */ - second_level_entry += (SECOND_LEVEL_ALIGN / - sizeof(unsigned long)); - pages--; - } - load_pgd(swapper_pg_dir, hard_processor_id()); - flush_tlb_all(); -#endif - - repriv_mmu_tables(); - register_syscore_ops(&mmu_syscore_ops); -} diff --git a/arch/metag/mm/numa.c b/arch/metag/mm/numa.c deleted file mode 100644 index 67b46c2950728..0000000000000 --- a/arch/metag/mm/numa.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Multiple memory node support for Meta machines - * - * Copyright (C) 2007 Paul Mundt - * Copyright (C) 2010 Imagination Technologies Ltd. - * - * This file is subject to 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 -#include -#include -#include -#include -#include -#include - -struct pglist_data *node_data[MAX_NUMNODES] __read_mostly; -EXPORT_SYMBOL_GPL(node_data); - -extern char _heap_start[]; - -/* - * On Meta machines the conventional approach is to stash system RAM - * in node 0, and other memory blocks in to node 1 and up, ordered by - * latency. Each node's pgdat is node-local at the beginning of the node, - * immediately followed by the node mem map. - */ -void __init setup_bootmem_node(int nid, unsigned long start, unsigned long end) -{ - unsigned long bootmap_pages, bootmem_paddr; - unsigned long start_pfn, end_pfn; - unsigned long pgdat_paddr; - - /* Don't allow bogus node assignment */ - BUG_ON(nid >= MAX_NUMNODES || nid <= 0); - - start_pfn = start >> PAGE_SHIFT; - end_pfn = end >> PAGE_SHIFT; - - memblock_add(start, end - start); - - memblock_set_node(PFN_PHYS(start_pfn), - PFN_PHYS(end_pfn - start_pfn), - &memblock.memory, nid); - - /* Node-local pgdat */ - pgdat_paddr = memblock_alloc_base(sizeof(struct pglist_data), - SMP_CACHE_BYTES, end); - NODE_DATA(nid) = __va(pgdat_paddr); - memset(NODE_DATA(nid), 0, sizeof(struct pglist_data)); - - NODE_DATA(nid)->bdata = &bootmem_node_data[nid]; - NODE_DATA(nid)->node_start_pfn = start_pfn; - NODE_DATA(nid)->node_spanned_pages = end_pfn - start_pfn; - - /* Node-local bootmap */ - bootmap_pages = bootmem_bootmap_pages(end_pfn - start_pfn); - bootmem_paddr = memblock_alloc_base(bootmap_pages << PAGE_SHIFT, - PAGE_SIZE, end); - init_bootmem_node(NODE_DATA(nid), bootmem_paddr >> PAGE_SHIFT, - start_pfn, end_pfn); - - free_bootmem_with_active_regions(nid, end_pfn); - - /* Reserve the pgdat and bootmap space with the bootmem allocator */ - reserve_bootmem_node(NODE_DATA(nid), pgdat_paddr & PAGE_MASK, - sizeof(struct pglist_data), BOOTMEM_DEFAULT); - reserve_bootmem_node(NODE_DATA(nid), bootmem_paddr, - bootmap_pages << PAGE_SHIFT, BOOTMEM_DEFAULT); - - /* It's up */ - node_set_online(nid); - - /* Kick sparsemem */ - sparse_memory_present_with_active_regions(nid); -} - -void __init __weak soc_mem_setup(void) -{ -} diff --git a/arch/metag/oprofile/Makefile b/arch/metag/oprofile/Makefile deleted file mode 100644 index dc92a4a3d6181..0000000000000 --- a/arch/metag/oprofile/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -obj-$(CONFIG_OPROFILE) += oprofile.o - -oprofile-core-y += buffer_sync.o -oprofile-core-y += cpu_buffer.o -oprofile-core-y += event_buffer.o -oprofile-core-y += oprof.o -oprofile-core-y += oprofile_files.o -oprofile-core-y += oprofile_stats.o -oprofile-core-y += oprofilefs.o -oprofile-core-y += timer_int.o -oprofile-core-$(CONFIG_HW_PERF_EVENTS) += oprofile_perf.o - -oprofile-y += backtrace.o -oprofile-y += common.o -oprofile-y += $(addprefix ../../../drivers/oprofile/,$(oprofile-core-y)) - -ccflags-y += -Werror diff --git a/arch/metag/oprofile/backtrace.c b/arch/metag/oprofile/backtrace.c deleted file mode 100644 index 7cc3f37cb40e4..0000000000000 --- a/arch/metag/oprofile/backtrace.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (C) 2010-2013 Imagination Technologies Ltd. - * - * This file is subject to 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 -#include -#include -#include - -#include "backtrace.h" - -static void user_backtrace_fp(unsigned long __user *fp, unsigned int depth) -{ - while (depth-- && access_ok(VERIFY_READ, fp, 8)) { - unsigned long addr; - unsigned long __user *fpnew; - if (__copy_from_user_inatomic(&addr, fp + 1, sizeof(addr))) - break; - addr -= 4; - - oprofile_add_trace(addr); - - /* stack grows up, so frame pointers must decrease */ - if (__copy_from_user_inatomic(&fpnew, fp + 0, sizeof(fpnew))) - break; - if (fpnew >= fp) - break; - fp = fpnew; - } -} - -static int kernel_backtrace_frame(struct stackframe *frame, void *data) -{ - unsigned int *depth = data; - - oprofile_add_trace(frame->pc); - - /* decrement depth and stop if we reach 0 */ - if ((*depth)-- == 0) - return 1; - - /* otherwise onto the next frame */ - return 0; -} - -void metag_backtrace(struct pt_regs * const regs, unsigned int depth) -{ - if (user_mode(regs)) { - unsigned long *fp = (unsigned long *)regs->ctx.AX[1].U0; - user_backtrace_fp((unsigned long __user __force *)fp, depth); - } else { - struct stackframe frame; - frame.fp = regs->ctx.AX[1].U0; /* A0FrP */ - frame.sp = user_stack_pointer(regs); /* A0StP */ - frame.lr = 0; /* from stack */ - frame.pc = regs->ctx.CurrPC; /* PC */ - walk_stackframe(&frame, &kernel_backtrace_frame, &depth); - } -} diff --git a/arch/metag/oprofile/backtrace.h b/arch/metag/oprofile/backtrace.h deleted file mode 100644 index 60adb862aa2cb..0000000000000 --- a/arch/metag/oprofile/backtrace.h +++ /dev/null @@ -1,7 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _METAG_OPROFILE_BACKTRACE_H -#define _METAG_OPROFILE_BACKTRACE_H - -void metag_backtrace(struct pt_regs * const regs, unsigned int depth); - -#endif diff --git a/arch/metag/oprofile/common.c b/arch/metag/oprofile/common.c deleted file mode 100644 index ba26152b3c006..0000000000000 --- a/arch/metag/oprofile/common.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * arch/metag/oprofile/common.c - * - * Copyright (C) 2013 Imagination Technologies Ltd. - * - * Based on arch/sh/oprofile/common.c: - * - * Copyright (C) 2003 - 2010 Paul Mundt - * - * Based on arch/mips/oprofile/common.c: - * - * Copyright (C) 2004, 2005 Ralf Baechle - * Copyright (C) 2005 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 -#include -#include -#include -#include - -#include "backtrace.h" - -#ifdef CONFIG_HW_PERF_EVENTS -/* - * This will need to be reworked when multiple PMUs are supported. - */ -static char *metag_pmu_op_name; - -char *op_name_from_perf_id(void) -{ - return metag_pmu_op_name; -} - -int __init oprofile_arch_init(struct oprofile_operations *ops) -{ - ops->backtrace = metag_backtrace; - - if (perf_num_counters() == 0) - return -ENODEV; - - metag_pmu_op_name = kasprintf(GFP_KERNEL, "metag/%s", - perf_pmu_name()); - if (unlikely(!metag_pmu_op_name)) - return -ENOMEM; - - return oprofile_perf_init(ops); -} - -void oprofile_arch_exit(void) -{ - oprofile_perf_exit(); - kfree(metag_pmu_op_name); -} -#else -int __init oprofile_arch_init(struct oprofile_operations *ops) -{ - ops->backtrace = metag_backtrace; - /* fall back to timer interrupt PC sampling */ - return -ENODEV; -} -void oprofile_arch_exit(void) {} -#endif /* CONFIG_HW_PERF_EVENTS */ diff --git a/arch/metag/tbx/Makefile b/arch/metag/tbx/Makefile deleted file mode 100644 index 98bc5453cf245..0000000000000 --- a/arch/metag/tbx/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# -# Makefile for TBX library files.. -# - -asflags-y += -mmetac=2.1 -Wa,-mfpu=metac21 -mdsp -asflags-$(CONFIG_SMP) += -DTBX_PERCPU_SP_SAVE - -ccflags-y += -mmetac=2.1 - -lib-y += tbicore.o -lib-y += tbictx.o -lib-y += tbidefr.o -lib-y += tbilogf.o -lib-y += tbipcx.o -lib-y += tbiroot.o -lib-y += tbisoft.o -lib-y += tbistring.o -lib-y += tbitimer.o - -lib-$(CONFIG_METAG_DSP) += tbidspram.o -lib-$(CONFIG_METAG_FPU) += tbictxfpu.o diff --git a/arch/metag/tbx/tbicore.S b/arch/metag/tbx/tbicore.S deleted file mode 100644 index a0838ebcb4334..0000000000000 --- a/arch/metag/tbx/tbicore.S +++ /dev/null @@ -1,136 +0,0 @@ -/* - * tbicore.S - * - * Copyright (C) 2001, 2002, 2007, 2012 Imagination Technologies. - * - * 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. - * - * Core functions needed to support use of the thread binary interface for META - * processors - */ - - .file "tbicore.S" -/* Get data structures and defines from the TBI C header */ -#include -#include -#include - - .data - .balign 8 - .global ___pTBISegs - .type ___pTBISegs,object -___pTBISegs: - .quad 0 /* Segment list pointer with it's */ - .size ___pTBISegs,.-___pTBISegs - /* own id or spin-lock location */ -/* - * Return ___pTBISegs value specific to privilege level - not very complicated - * at the moment - * - * Register Usage: D0Re0 is the result, D1Re0 is used as a scratch - */ - .text - .balign 4 - .global ___TBISegList - .type ___TBISegList,function -___TBISegList: - MOVT A1LbP,#HI(___pTBISegs) - ADD A1LbP,A1LbP,#LO(___pTBISegs) - GETL D0Re0,D1Re0,[A1LbP] - MOV PC,D1RtP - .size ___TBISegList,.-___TBISegList - -/* - * Search the segment list for a match given Id, pStart can be NULL - * - * Register Usage: D1Ar1 is pSeg, D0Ar2 is Id, D0Re0 is the result - * D0Ar4, D1Ar3 are used as a scratch - * NB: The PSTAT bit if Id in D0Ar2 may be toggled - */ - .text - .balign 4 - .global ___TBIFindSeg - .type ___TBIFindSeg,function -___TBIFindSeg: - MOVT A1LbP,#HI(___pTBISegs) - ADD A1LbP,A1LbP,#LO(___pTBISegs) - GETL D1Ar3,D0Ar4,[A1LbP] /* Read segment list head */ - MOV D0Re0,TXSTATUS /* What priv level are we at? */ - CMP D1Ar1,#0 /* Is pStart provided? */ -/* Disable privilege adaption for now */ - ANDT D0Re0,D0Re0,#0 /*HI(TXSTATUS_PSTAT_BIT) ; Is PSTAT set? Zero if not */ - LSL D0Re0,D0Re0,#(TBID_PSTAT_S-TXSTATUS_PSTAT_S) - XOR D0Ar2,D0Ar2,D0Re0 /* Toggle Id PSTAT if privileged */ - MOVNZ D1Ar3,D1Ar1 /* Use pStart if provided */ -$LFindSegLoop: - ADDS D0Re0,D1Ar3,#0 /* End of list? Load result into D0Re0 */ - MOVZ PC,D1RtP /* If result is NULL we leave */ - GETL D1Ar3,D0Ar4,[D1Ar3] /* Read pLink and Id */ - CMP D0Ar4,D0Ar2 /* Does it match? */ - BNZ $LFindSegLoop /* Loop if there is no match */ - TST D0Re0,D0Re0 /* Clear zero flag - we found it! */ - MOV PC,D1RtP /* Return */ - .size ___TBIFindSeg,.-___TBIFindSeg - -/* Useful offsets to encode the lower bits of the lock/unlock addresses */ -#define UON (LINSYSEVENT_WR_ATOMIC_LOCK & 0xFFF8) -#define UOFF (LINSYSEVENT_WR_ATOMIC_UNLOCK & 0xFFF8) - -/* - * Perform a whole spin-lock sequence as used by the TBISignal routine - * - * Register Usage: D1Ar1 is pLock, D0Ar2 is Mask, D0Re0 is the result - * (All other usage due to ___TBIPoll - D0Ar6, D1Re0) - */ - .text - .balign 4 - .global ___TBISpin - .type ___TBISpin,function -___TBISpin: - SETL [A0StP++],D0FrT,D1RtP /* Save our return address */ - ORS D0Re0,D0Re0,#1 /* Clear zero flag */ - MOV D1RtP,PC /* Setup return address to form loop */ -$LSpinLoop: - BNZ ___TBIPoll /* Keep repeating if fail to set */ - GETL D0FrT,D1RtP,[--A0StP] /* Restore return address */ - MOV PC,D1RtP /* Return */ - .size ___TBISpin,.-___TBISpin - -/* - * Perform an attempt to gain access to a spin-lock and set some bits - * - * Register Usage: D1Ar1 is pLock, D0Ar2 is Mask, D0Re0 is the result - * !!On return Zero flag is SET if we are sucessfull!! - * A0.3 is used to hold base address of system event region - * D1Re0 use to hold TXMASKI while interrupts are off - */ - .text - .balign 4 - .global ___TBIPoll - .type ___TBIPoll,function -___TBIPoll: - MOV D1Re0,#0 /* Prepare to disable ints */ - MOVT A0.3,#HI(LINSYSEVENT_WR_ATOMIC_LOCK) - SWAP D1Re0,TXMASKI /* Really stop ints */ - LOCK2 /* Gain all locks */ - SET [A0.3+#UON],D1RtP /* Stop shared memory access too */ - DCACHE [D1Ar1],A0.3 /* Flush Cache line */ - GETD D0Re0,[D1Ar1] /* Get new state from memory or hit */ - DCACHE [D1Ar1],A0.3 /* Flush Cache line */ - GETD D0Re0,[D1Ar1] /* Get current state */ - TST D0Re0,D0Ar2 /* Are we clear to send? */ - ORZ D0Re0,D0Re0,D0Ar2 /* Yes: So set bits and */ - SETDZ [D1Ar1],D0Re0 /* transmit new state */ - SET [A0.3+#UOFF],D1RtP /* Allow shared memory access */ - LOCK0 /* Release all locks */ - MOV TXMASKI,D1Re0 /* Allow ints */ -$LPollEnd: - XORNZ D0Re0,D0Re0,D0Re0 /* No: Generate zero result */ - MOV PC,D1RtP /* Return (NZ indicates failure) */ - .size ___TBIPoll,.-___TBIPoll - -/* - * End of tbicore.S - */ diff --git a/arch/metag/tbx/tbictx.S b/arch/metag/tbx/tbictx.S deleted file mode 100644 index 19af983a13ae9..0000000000000 --- a/arch/metag/tbx/tbictx.S +++ /dev/null @@ -1,366 +0,0 @@ -/* - * tbictx.S - * - * Copyright (C) 2001, 2002, 2007, 2012 Imagination Technologies. - * - * 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. - * - * Explicit state save and restore routines forming part of the thread binary - * interface for META processors - */ - - .file "tbictx.S" -#include -#include - -#ifdef METAC_1_0 -/* Ax.4 is NOT saved in XAX3 */ -#define A0_4 -#else -/* Ax.4 is saved in XAX4 */ -#define A0_4 A0.4, -#endif - - -/* Size of the TBICTX structure */ -#define TBICTX_BYTES ((TBICTX_AX_REGS*8)+TBICTX_AX) - -/* - * TBIRES __TBINestInts( TBIRES State, void *pExt, int NoNestMask ) - */ - .text - .balign 4 - .global ___TBINestInts - .type ___TBINestInts,function -___TBINestInts: - XOR D0Ar4,D0Ar4,#-1 /* D0Ar4 = ~TrigBit */ - AND D0Ar4,D0Ar4,#0xFFFF /* D0Ar4 &= 0xFFFF */ - MOV D0Ar6,TXMASKI /* BGNDHALT currently enabled? */ - TSTT D0Ar2,#TBICTX_XDX8_BIT+TBICTX_XAXX_BIT+TBICTX_XHL2_BIT+TBICTX_XTDP_BIT+TBICTX_XCBF_BIT - AND D0Ar4,D0Ar2,D0Ar4 /* D0Ar4 = Ints to allow */ - XOR D0Ar2,D0Ar2,D0Ar4 /* Less Ints in TrigMask */ - BNZ ___TBINestInts2 /* Jump if ctx save required! */ - TSTT D0Ar2,#TBICTX_CBUF_BIT+TBICTX_CBRP_BIT /* Is catch state dirty? */ - OR D0Ar4,D0Ar4,D0Ar6 /* Or in TXMASKI BGNDHALT if set */ - TSTNZ D0Ar4,D0Ar4 /* Yes: AND triggers enabled */ - MOV D0Re0,D0Ar2 /* Update State argument */ - MOV D1Re0,D1Ar1 /* with less Ints in TrigMask */ - MOVZ TXMASKI,D0Ar4 /* Early return: Enable Ints */ - MOVZ PC,D1RtP /* Early return */ - .size ___TBINestInts,.-___TBINestInts -/* - * Drop thru into sub-function- - */ - .global ___TBINestInts2 - .type ___TBINestInts2,function -___TBINestInts2: - MOV D0FrT,A0FrP /* Full entry sequence so we */ - ADD A0FrP,A0StP,#0 /* can make sub-calls */ - MSETL [A0StP],D0FrT,D0.5,D0.6 /* and preserve our result */ - ORT D0Ar2,D0Ar2,#TBICTX_XCBF_BIT /* Add in XCBF save request */ - MOV D0.5,D0Ar2 /* Save State in DX.5 */ - MOV D1.5,D1Ar1 - OR D0.6,D0Ar4,D0Ar6 /* Save TrigMask in D0.6 */ - MOVT D1RtP,#HI(___TBICtxSave) /* Save catch buffer */ - CALL D1RtP,#LO(___TBICtxSave) - MOV TXMASKI,D0.6 /* Allow Ints */ - MOV D0Re0,D0.5 /* Return State */ - MOV D1Re0,D1.5 - MGETL D0FrT,D0.5,D0.6,[A0FrP] /* Full exit sequence */ - SUB A0StP,A0FrP,#(8*3) - MOV A0FrP,D0FrT - MOV PC,D1RtP - .size ___TBINestInts2,.-___TBINestInts2 - -/* - * void *__TBICtxSave( TBIRES State, void *pExt ) - * - * D0Ar2 contains TBICTX_*_BIT values that control what - * extended data is to be saved beyond the end of D1Ar1. - * These bits must be ored into the SaveMask of this structure. - * - * Virtually all possible scratch registers are used. - * - * The D1Ar1 parameter is only used as the basis for saving - * CBUF state. - */ -/* - * If TBICTX_XEXT_BIT is specified in State. then State.pCtx->Ext is - * utilised to save the base address of the context save area and - * the extended states saved. The XEXT flag then indicates that the - * original state of the A0.2 and A1.2 registers from TBICTX.Ext.AX2 - * are stored as the first part of the extended state structure. - */ - .balign 4 - .global ___TBICtxSave - .type ___TBICtxSave,function -___TBICtxSave: - GETD D0Re0,[D1Ar1+#TBICTX_SaveMask-2] /* Get SaveMask */ - TSTT D0Ar2,#TBICTX_XDX8_BIT+TBICTX_XAXX_BIT+TBICTX_XHL2_BIT+TBICTX_XTDP_BIT+TBICTX_XEXT_BIT - /* Just XCBF to save? */ - MOV A0.2,D1Ar3 /* Save pointer into A0.2 */ - MOV A1.2,D1RtP /* Free off D0FrT:D1RtP pair */ - BZ $LCtxSaveCBUF /* Yes: Only XCBF may be saved */ - TSTT D0Ar2,#TBICTX_XEXT_BIT /* Extended base-state model? */ - BZ $LCtxSaveXDX8 - GETL D0Ar6,D1Ar5,[D1Ar1+#TBICTX_Ext_AX2] /* Get A0.2, A1.2 state */ - MOV D0Ar4,D0Ar2 /* Extract Ctx.SaveFlags value */ - ANDMT D0Ar4,D0Ar4,#TBICTX_XDX8_BIT+TBICTX_XAXX_BIT+TBICTX_XHL2_BIT+TBICTX_XTDP_BIT+TBICTX_XEXT_BIT - SETD [D1Ar1+#TBICTX_Ext_Ctx_pExt],A0.2 - SETD [D1Ar1+#TBICTX_Ext_Ctx_SaveMask-2],D0Ar4 - SETL [A0.2++],D0Ar6,D1Ar5 /* Save A0.2, A1.2 state */ -$LCtxSaveXDX8: - TSTT D0Ar2,#TBICTX_XDX8_BIT /* Save extended DX regs? */ - BZ $LCtxSaveXAXX -/* - * Save 8 extra DX registers - */ - MSETL [A0.2],D0.8,D0.9,D0.10,D0.11,D0.12,D0.13,D0.14,D0.15 -$LCtxSaveXAXX: - TSTT D0Ar2,#TBICTX_XAXX_BIT /* Save extended AX regs? */ - SWAP D0Re0,A0.2 /* pDst into D0Re0 */ - BZ $LCtxSaveXHL2 -/* - * Save 4 extra AX registers - */ - MSETL [D0Re0], A0_4 A0.5,A0.6,A0.7 /* Save 8*3 bytes */ -$LCtxSaveXHL2: - TSTT D0Ar2,#TBICTX_XHL2_BIT /* Save hardware-loop regs? */ - SWAP D0Re0,A0.2 /* pDst back into A0.2 */ - MOV D0Ar6,TXL1START - MOV D1Ar5,TXL2START - BZ $LCtxSaveXTDP -/* - * Save hardware loop registers - */ - SETL [A0.2++],D0Ar6,D1Ar5 /* Save 8*1 bytes */ - MOV D0Ar6,TXL1END - MOV D1Ar5,TXL2END - MOV D0FrT,TXL1COUNT - MOV D1RtP,TXL2COUNT - MSETL [A0.2],D0Ar6,D0FrT /* Save 8*2 bytes */ -/* - * Clear loop counters to disable any current loops - */ - XOR TXL1COUNT,D0FrT,D0FrT - XOR TXL2COUNT,D1RtP,D1RtP -$LCtxSaveXTDP: - TSTT D0Ar2,#TBICTX_XTDP_BIT /* Save per-thread DSP regs? */ - BZ $LCtxSaveCBUF -/* - * Save per-thread DSP registers; ACC.0, PR.0, PI.1-3 (PI.0 is zero) - */ -#ifndef CTX_NO_DSP -D SETL [A0.2++],AC0.0,AC1.0 /* Save ACx.0 lower 32-bits */ -DH SETL [A0.2++],AC0.0,AC1.0 /* Save ACx.0 upper 32-bits */ -D SETL [A0.2++],D0AR.0,D1AR.0 /* Save DSP RAM registers */ -D SETL [A0.2++],D0AR.1,D1AR.1 -D SETL [A0.2++],D0AW.0,D1AW.0 -D SETL [A0.2++],D0AW.1,D1AW.1 -D SETL [A0.2++],D0BR.0,D1BR.0 -D SETL [A0.2++],D0BR.1,D1BR.1 -D SETL [A0.2++],D0BW.0,D1BW.0 -D SETL [A0.2++],D0BW.1,D1BW.1 -D SETL [A0.2++],D0ARI.0,D1ARI.0 -D SETL [A0.2++],D0ARI.1,D1ARI.1 -D SETL [A0.2++],D0AWI.0,D1AWI.0 -D SETL [A0.2++],D0AWI.1,D1AWI.1 -D SETL [A0.2++],D0BRI.0,D1BRI.0 -D SETL [A0.2++],D0BRI.1,D1BRI.1 -D SETL [A0.2++],D0BWI.0,D1BWI.0 -D SETL [A0.2++],D0BWI.1,D1BWI.1 -D SETD [A0.2++],T0 -D SETD [A0.2++],T1 -D SETD [A0.2++],T2 -D SETD [A0.2++],T3 -D SETD [A0.2++],T4 -D SETD [A0.2++],T5 -D SETD [A0.2++],T6 -D SETD [A0.2++],T7 -D SETD [A0.2++],T8 -D SETD [A0.2++],T9 -D SETD [A0.2++],TA -D SETD [A0.2++],TB -D SETD [A0.2++],TC -D SETD [A0.2++],TD -D SETD [A0.2++],TE -D SETD [A0.2++],TF -#else - ADD A0.2,A0.2,#(8*18+4*16) -#endif - MOV D0Ar6,TXMRSIZE - MOV D1Ar5,TXDRSIZE - SETL [A0.2++],D0Ar6,D1Ar5 /* Save 8*1 bytes */ - -$LCtxSaveCBUF: -#ifdef TBI_1_3 - MOV D0Ar4,D0Re0 /* Copy Ctx Flags */ - ANDT D0Ar4,D0Ar4,#TBICTX_XCBF_BIT /* mask XCBF if already set */ - XOR D0Ar4,D0Ar4,#-1 - AND D0Ar2,D0Ar2,D0Ar4 /* remove XCBF if already set */ -#endif - TSTT D0Ar2,#TBICTX_XCBF_BIT /* Want to save CBUF? */ - ANDT D0Ar2,D0Ar2,#TBICTX_XDX8_BIT+TBICTX_XAXX_BIT+TBICTX_XHL2_BIT+TBICTX_XTDP_BIT+TBICTX_XEXT_BIT - OR D0Ar2,D0Ar2,D0Re0 /* Generate new SaveMask */ - SETD [D1Ar1+#TBICTX_SaveMask-2],D0Ar2/* Add in bits saved to TBICTX */ - MOV D0Re0,A0.2 /* Return end of save area */ - MOV D0Ar4,TXDIVTIME /* Get TXDIVTIME */ - MOVZ PC,A1.2 /* No: Early return */ - TSTT D0Ar2,#TBICTX_CBUF_BIT+TBICTX_CBRP_BIT /* Need to save CBUF? */ - MOVZ PC,A1.2 /* No: Early return */ - ORT D0Ar2,D0Ar2,#TBICTX_XCBF_BIT - SETD [D1Ar1+#TBICTX_SaveMask-2],D0Ar2/* Add in XCBF bit to TBICTX */ - ADD A0.2,D1Ar1,#TBICTX_BYTES /* Dump CBUF state after TBICTX */ -/* - * Save CBUF - */ - SETD [A0.2+# 0],TXCATCH0 /* Restore TXCATCHn */ - SETD [A0.2+# 4],TXCATCH1 - TSTT D0Ar2,#TBICTX_CBRP_BIT /* ... RDDIRTY was/is set */ - SETD [A0.2+# 8],TXCATCH2 - SETD [A0.2+#12],TXCATCH3 - BZ $LCtxSaveComplete - SETL [A0.2+#(2*8)],RD /* Save read pipeline */ - SETL [A0.2+#(3*8)],RD /* Save read pipeline */ - SETL [A0.2+#(4*8)],RD /* Save read pipeline */ - SETL [A0.2+#(5*8)],RD /* Save read pipeline */ - SETL [A0.2+#(6*8)],RD /* Save read pipeline */ - SETL [A0.2+#(7*8)],RD /* Save read pipeline */ - AND TXDIVTIME,D0Ar4,#TXDIVTIME_DIV_BITS /* Clear RPDIRTY */ -$LCtxSaveComplete: - MOV PC,A1.2 /* Return */ - .size ___TBICtxSave,.-___TBICtxSave - -/* - * void *__TBICtxRestore( TBIRES State, void *pExt ) - * - * D0Ar2 contains TBICTX_*_BIT values that control what - * extended data is to be recovered from D1Ar3 (pExt). - * - * Virtually all possible scratch registers are used. - */ -/* - * If TBICTX_XEXT_BIT is specified in State. Then the saved state of - * the orginal A0.2 and A1.2 is restored from pExt and the XEXT - * related flags are removed from State.pCtx->SaveMask. - * - */ - .balign 4 - .global ___TBICtxRestore - .type ___TBICtxRestore,function -___TBICtxRestore: - GETD D0Ar6,[D1Ar1+#TBICTX_CurrMODE] /* Get TXMODE Value */ - ANDST D0Ar2,D0Ar2,#TBICTX_XDX8_BIT+TBICTX_XAXX_BIT+TBICTX_XHL2_BIT+TBICTX_XTDP_BIT+TBICTX_XEXT_BIT - MOV D1Re0,D0Ar2 /* Keep flags in D1Re0 */ - MOV D0Re0,D1Ar3 /* D1Ar3 is default result */ - MOVZ PC,D1RtP /* Early return, nothing to do */ - ANDT D0Ar6,D0Ar6,#0xE000 /* Top bits of TXMODE required */ - MOV A0.3,D0Ar6 /* Save TXMODE for later */ - TSTT D1Re0,#TBICTX_XEXT_BIT /* Check for XEXT bit */ - BZ $LCtxRestXDX8 - GETD D0Ar4,[D1Ar1+#TBICTX_SaveMask-2]/* Get current SaveMask */ - GETL D0Ar6,D1Ar5,[D0Re0++] /* Restore A0.2, A1.2 state */ - ANDMT D0Ar4,D0Ar4,#(0xFFFF-(TBICTX_XDX8_BIT+TBICTX_XAXX_BIT+TBICTX_XHL2_BIT+TBICTX_XTDP_BIT+TBICTX_XEXT_BIT)) - SETD [D1Ar1+#TBICTX_SaveMask-2],D0Ar4/* New SaveMask */ -#ifdef METAC_1_0 - SETD [D1Ar1+#TBICTX_Ext_AX2_U0],D0Ar6 - MOV D0Ar6,D1Ar1 - SETD [D0Ar6+#TBICTX_Ext_AX2_U1],D1Ar5 -#else - SETL [D1Ar1+#TBICTX_Ext_AX2],D0Ar6,D1Ar5 -#endif -$LCtxRestXDX8: - TSTT D1Re0,#TBICTX_XDX8_BIT /* Get extended DX regs? */ - MOV A1.2,D1RtP /* Free off D1RtP register */ - BZ $LCtxRestXAXX -/* - * Restore 8 extra DX registers - */ - MGETL D0.8,D0.9,D0.10,D0.11,D0.12,D0.13,D0.14,D0.15,[D0Re0] -$LCtxRestXAXX: - TSTT D1Re0,#TBICTX_XAXX_BIT /* Get extended AX regs? */ - BZ $LCtxRestXHL2 -/* - * Restore 3 extra AX registers - */ - MGETL A0_4 A0.5,A0.6,A0.7,[D0Re0] /* Get 8*3 bytes */ -$LCtxRestXHL2: - TSTT D1Re0,#TBICTX_XHL2_BIT /* Get hardware-loop regs? */ - BZ $LCtxRestXTDP -/* - * Get hardware loop registers - */ - MGETL D0Ar6,D0Ar4,D0Ar2,[D0Re0] /* Get 8*3 bytes */ - MOV TXL1START,D0Ar6 - MOV TXL2START,D1Ar5 - MOV TXL1END,D0Ar4 - MOV TXL2END,D1Ar3 - MOV TXL1COUNT,D0Ar2 - MOV TXL2COUNT,D1Ar1 -$LCtxRestXTDP: - TSTT D1Re0,#TBICTX_XTDP_BIT /* Get per-thread DSP regs? */ - MOVZ PC,A1.2 /* No: Early return */ -/* - * Get per-thread DSP registers; ACC.0, PR.0, PI.1-3 (PI.0 is zero) - */ - MOV A0.2,D0Re0 - GETL D0Ar6,D1Ar5,[D0Re0++#((16*4)+(18*8))] -#ifndef CTX_NO_DSP -D GETL AC0.0,AC1.0,[A0.2++] /* Restore ACx.0 lower 32-bits */ -DH GETL AC0.0,AC1.0,[A0.2++] /* Restore ACx.0 upper 32-bits */ -#else - ADD A0.2,A0.2,#(2*8) -#endif - ADD D0Re0,D0Re0,#(2*4) - MOV TXMODE,A0.3 /* Some TXMODE bits needed */ - MOV TXMRSIZE,D0Ar6 - MOV TXDRSIZE,D1Ar5 -#ifndef CTX_NO_DSP -D GETL D0AR.0,D1AR.0,[A0.2++] /* Restore DSP RAM registers */ -D GETL D0AR.1,D1AR.1,[A0.2++] -D GETL D0AW.0,D1AW.0,[A0.2++] -D GETL D0AW.1,D1AW.1,[A0.2++] -D GETL D0BR.0,D1BR.0,[A0.2++] -D GETL D0BR.1,D1BR.1,[A0.2++] -D GETL D0BW.0,D1BW.0,[A0.2++] -D GETL D0BW.1,D1BW.1,[A0.2++] -#else - ADD A0.2,A0.2,#(8*8) -#endif - MOV TXMODE,#0 /* Restore TXMODE */ -#ifndef CTX_NO_DSP -D GETL D0ARI.0,D1ARI.0,[A0.2++] -D GETL D0ARI.1,D1ARI.1,[A0.2++] -D GETL D0AWI.0,D1AWI.0,[A0.2++] -D GETL D0AWI.1,D1AWI.1,[A0.2++] -D GETL D0BRI.0,D1BRI.0,[A0.2++] -D GETL D0BRI.1,D1BRI.1,[A0.2++] -D GETL D0BWI.0,D1BWI.0,[A0.2++] -D GETL D0BWI.1,D1BWI.1,[A0.2++] -D GETD T0,[A0.2++] -D GETD T1,[A0.2++] -D GETD T2,[A0.2++] -D GETD T3,[A0.2++] -D GETD T4,[A0.2++] -D GETD T5,[A0.2++] -D GETD T6,[A0.2++] -D GETD T7,[A0.2++] -D GETD T8,[A0.2++] -D GETD T9,[A0.2++] -D GETD TA,[A0.2++] -D GETD TB,[A0.2++] -D GETD TC,[A0.2++] -D GETD TD,[A0.2++] -D GETD TE,[A0.2++] -D GETD TF,[A0.2++] -#else - ADD A0.2,A0.2,#(8*8+4*16) -#endif - MOV PC,A1.2 /* Return */ - .size ___TBICtxRestore,.-___TBICtxRestore - -/* - * End of tbictx.S - */ diff --git a/arch/metag/tbx/tbictxfpu.S b/arch/metag/tbx/tbictxfpu.S deleted file mode 100644 index e773bea3e7bd0..0000000000000 --- a/arch/metag/tbx/tbictxfpu.S +++ /dev/null @@ -1,190 +0,0 @@ -/* - * tbictxfpu.S - * - * Copyright (C) 2009, 2012 Imagination Technologies. - * - * 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. - * - * Explicit state save and restore routines forming part of the thread binary - * interface for META processors - */ - - .file "tbifpuctx.S" - -#include -#include - -#ifdef TBI_1_4 -/* - * void *__TBICtxFPUSave( TBIRES State, void *pExt ) - * - * D0Ar2 contains TBICTX_*_BIT values that control what - * extended data is to be saved. - * These bits must be ored into the SaveMask of this structure. - * - * Virtually all possible scratch registers are used. - */ - .text - .balign 4 - .global ___TBICtxFPUSave - .type ___TBICtxFPUSave,function -___TBICtxFPUSave: - - /* D1Ar1:D0Ar2 - State - * D1Ar3 - pExt - * D0Ar4 - Value of METAC_CORE_ID - * D1Ar5 - Scratch - * D0Ar6 - Scratch - */ - - /* If the FPAC bit isnt set then there is nothing to do */ - TSTT D0Ar2,#TBICTX_FPAC_BIT - MOVZ PC, D1RtP - - /* Obtain the Core config */ - MOVT D0Ar4, #HI(METAC_CORE_ID) - ADD D0Ar4, D0Ar4, #LO(METAC_CORE_ID) - GETD D0Ar4, [D0Ar4] - - /* Detect FX.8 - FX.15 and add to core config */ - MOV D0Ar6, TXENABLE - AND D0Ar6, D0Ar6, #(TXENABLE_CLASSALT_FPUR8 << TXENABLE_CLASS_S) - AND D0Ar4, D0Ar4, #LO(0x0000FFFF) - ORT D0Ar4, D0Ar4, #HI(TBICTX_CFGFPU_FX16_BIT) - XOR D0Ar4, D0Ar4, D0Ar6 - - /* Save the relevant bits to the buffer */ - SETD [D1Ar3++], D0Ar4 - - /* Save the relevant bits of TXDEFR (Assumes TXDEFR is coherent) ... */ - MOV D0Ar6, TXDEFR - LSR D0Re0, D0Ar6, #8 - AND D0Re0, D0Re0, #LO(TXDEFR_FPE_FE_BITS>>8) - AND D0Ar6, D0Ar6, #LO(TXDEFR_FPE_ICTRL_BITS) - OR D0Re0, D0Re0, D0Ar6 - - /* ... along with relevant bits of TXMODE to buffer */ - MOV D0Ar6, TXMODE - ANDT D0Ar6, D0Ar6, #HI(TXMODE_FPURMODE_BITS) - ORT D0Ar6, D0Ar6, #HI(TXMODE_FPURMODEWRITE_BIT) - OR D0Ar6, D0Ar6, D0Re0 - SETD [D1Ar3++], D0Ar6 - - GETD D0Ar6,[D1Ar1+#TBICTX_SaveMask-2] /* Get the current SaveMask */ - /* D0Ar6 - pCtx->SaveMask */ - - TSTT D0Ar4, #HI(TBICTX_CFGFPU_FX16_BIT) /* Perform test here for extended FPU registers - * to avoid stalls - */ - /* Save the standard FPU registers */ -F MSETL [D1Ar3++], FX.0, FX.2, FX.4, FX.6 - - /* Save the extended FPU registers if they are present */ - BZ $Lskip_save_fx8_fx16 -F MSETL [D1Ar3++], FX.8, FX.10, FX.12, FX.14 -$Lskip_save_fx8_fx16: - - /* Save the FPU Accumulator if it is present */ - TST D0Ar4, #METAC_COREID_NOFPACC_BIT - BNZ $Lskip_save_fpacc -F SETL [D1Ar3++], ACF.0 -F SETL [D1Ar3++], ACF.1 -F SETL [D1Ar3++], ACF.2 -$Lskip_save_fpacc: - - /* Update pCtx->SaveMask */ - ANDT D0Ar2, D0Ar2, #TBICTX_FPAC_BIT - OR D0Ar6, D0Ar6, D0Ar2 - SETD [D1Ar1+#TBICTX_SaveMask-2],D0Ar6/* Add in XCBF bit to TBICTX */ - - MOV D0Re0, D1Ar3 /* Return end of save area */ - MOV PC, D1RtP - - .size ___TBICtxFPUSave,.-___TBICtxFPUSave - -/* - * void *__TBICtxFPURestore( TBIRES State, void *pExt ) - * - * D0Ar2 contains TBICTX_*_BIT values that control what - * extended data is to be recovered from D1Ar3 (pExt). - * - * Virtually all possible scratch registers are used. - */ -/* - * If TBICTX_XEXT_BIT is specified in State. Then the saved state of - * the orginal A0.2 and A1.2 is restored from pExt and the XEXT - * related flags are removed from State.pCtx->SaveMask. - * - */ - .balign 4 - .global ___TBICtxFPURestore - .type ___TBICtxFPURestore,function -___TBICtxFPURestore: - - /* D1Ar1:D0Ar2 - State - * D1Ar3 - pExt - * D0Ar4 - Value of METAC_CORE_ID - * D1Ar5 - Scratch - * D0Ar6 - Scratch - * D1Re0 - Scratch - */ - - /* If the FPAC bit isnt set then there is nothing to do */ - TSTT D0Ar2,#TBICTX_FPAC_BIT - MOVZ PC, D1RtP - - /* Obtain the relevant bits of the Core config */ - GETD D0Ar4, [D1Ar3++] - - /* Restore FPU related parts of TXDEFR. Assumes TXDEFR is coherent */ - GETD D1Ar5, [D1Ar3++] - MOV D0Ar6, D1Ar5 - LSL D1Re0, D1Ar5, #8 - ANDT D1Re0, D1Re0, #HI(TXDEFR_FPE_FE_BITS|TXDEFR_FPE_ICTRL_BITS) - AND D1Ar5, D1Ar5, #LO(TXDEFR_FPE_FE_BITS|TXDEFR_FPE_ICTRL_BITS) - OR D1Re0, D1Re0, D1Ar5 - - MOV D1Ar5, TXDEFR - ANDMT D1Ar5, D1Ar5, #HI(~(TXDEFR_FPE_FE_BITS|TXDEFR_FPE_ICTRL_BITS)) - ANDMB D1Ar5, D1Ar5, #LO(~(TXDEFR_FPE_FE_BITS|TXDEFR_FPE_ICTRL_BITS)) - OR D1Re0, D1Re0, D1Ar5 - MOV TXDEFR, D1Re0 - - /* Restore relevant bits of TXMODE */ - MOV D1Ar5, TXMODE - ANDMT D1Ar5, D1Ar5, #HI(~TXMODE_FPURMODE_BITS) - ANDT D0Ar6, D0Ar6, #HI(TXMODE_FPURMODE_BITS|TXMODE_FPURMODEWRITE_BIT) - OR D0Ar6, D0Ar6, D1Ar5 - MOV TXMODE, D0Ar6 - - TSTT D0Ar4, #HI(TBICTX_CFGFPU_FX16_BIT) /* Perform test here for extended FPU registers - * to avoid stalls - */ - /* Save the standard FPU registers */ -F MGETL FX.0, FX.2, FX.4, FX.6, [D1Ar3++] - - /* Save the extended FPU registers if they are present */ - BZ $Lskip_restore_fx8_fx16 -F MGETL FX.8, FX.10, FX.12, FX.14, [D1Ar3++] -$Lskip_restore_fx8_fx16: - - /* Save the FPU Accumulator if it is present */ - TST D0Ar4, #METAC_COREID_NOFPACC_BIT - BNZ $Lskip_restore_fpacc -F GETL ACF.0, [D1Ar3++] -F GETL ACF.1, [D1Ar3++] -F GETL ACF.2, [D1Ar3++] -$Lskip_restore_fpacc: - - MOV D0Re0, D1Ar3 /* Return end of save area */ - MOV PC, D1RtP - - .size ___TBICtxFPURestore,.-___TBICtxFPURestore - -#endif /* TBI_1_4 */ - -/* - * End of tbictx.S - */ diff --git a/arch/metag/tbx/tbidefr.S b/arch/metag/tbx/tbidefr.S deleted file mode 100644 index 8f0902b22f703..0000000000000 --- a/arch/metag/tbx/tbidefr.S +++ /dev/null @@ -1,175 +0,0 @@ -/* - * tbidefr.S - * - * Copyright (C) 2009, 2012 Imagination Technologies. - * - * 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. - * - * Routing deferred exceptions - */ - -#include -#include - - .text - .balign 4 - .global ___TBIHandleDFR - .type ___TBIHandleDFR,function -/* D1Ar1:D0Ar2 -- State - * D0Ar3 -- SigNum - * D0Ar4 -- Triggers - * D1Ar5 -- Inst - * D0Ar6 -- pTBI (volatile) - */ -___TBIHandleDFR: -#ifdef META_BUG_MBN100212 - MSETL [A0StP++], D0FrT, D0.5 - - /* D1Ar1,D0Ar2,D1Ar5,D0Ar6 -- Arguments to handler, must be preserved - * D0Ar4 -- The deferred exceptions - * D1Ar3 -- As per D0Ar4 but just the trigger bits - * D0.5 -- The bgnd deferred exceptions - * D1.5 -- TXDEFR with bgnd re-added - */ - - /* - Collect the pending deferred exceptions using TXSTAT, - * (ack's the bgnd exceptions as a side-effect) - * - Manually collect remaining (interrupt) deferred exceptions - * using TXDEFR - * - Replace the triggers (from TXSTATI) with the int deferred - * exceptions DEFR ..., TXSTATI would have returned if it was valid - * from bgnd code - * - Reconstruct TXDEFR by or'ing bgnd deferred exceptions (except - * the DEFER bit) and the int deferred exceptions. This will be - * restored later - */ - DEFR D0.5, TXSTAT - MOV D1.5, TXDEFR - ANDT D0.5, D0.5, #HI(0xFFFF0000) - MOV D1Ar3, D1.5 - ANDT D1Ar3, D1Ar3, #HI(0xFFFF0000) - OR D0Ar4, D1Ar3, #TXSTAT_DEFER_BIT - OR D1.5, D1.5, D0.5 - - /* Mask off anything unrelated to the deferred exception triggers */ - ANDT D1Ar3, D1Ar3, #HI(TXSTAT_BUSERR_BIT | TXSTAT_FPE_BITS) - - /* Can assume that at least one exception happened since this - * handler wouldnt have been called otherwise. - * - * Replace the signal number and at the same time, prepare - * the mask to acknowledge the exception - * - * D1Re0 -- The bits to acknowledge - * D1Ar3 -- The signal number - * D1RtP -- Scratch to deal with non-conditional insns - */ - MOVT D1Re0, #HI(TXSTAT_FPE_BITS & ~TXSTAT_FPE_DENORMAL_BIT) - MOV D1RtP, #TXSTAT_FPE_INVALID_S - FFB D1Ar3, D1Ar3 - CMP D1Ar3, #TXSTAT_FPE_INVALID_S - MOVLE D1Ar3, D1RtP /* Collapse FPE triggers to a single signal */ - MOV D1RtP, #1 - LSLGT D1Re0, D1RtP, D1Ar3 - - /* Get the handler using the signal number - * - * D1Ar3 -- The signal number - * D0Re0 -- Offset into TBI struct containing handler address - * D1Re0 -- Mask of triggers to keep - * D1RtP -- Address of handler - */ - SUB D1Ar3, D1Ar3, #(TXSTAT_FPE_INVALID_S - TBID_SIGNUM_FPE) - LSL D0Re0, D1Ar3, #2 - XOR D1Re0, D1Re0, #-1 /* Prepare mask for acknowledge (avoids stall) */ - ADD D0Re0,D0Re0,#TBI_fnSigs - GETD D1RtP, [D0Ar6+D0Re0] - - /* Acknowledge triggers */ - AND D1.5, D1.5, D1Re0 - - /* Restore remaining exceptions - * Do this here in case the handler enables nested interrupts - * - * D1.5 -- TXDEFR with this exception ack'd - */ - MOV TXDEFR, D1.5 - - /* Call the handler */ - SWAP D1RtP, PC - - GETL D0.5, D1.5, [--A0StP] - GETL D0FrT, D1RtP, [--A0StP] - MOV PC,D1RtP -#else /* META_BUG_MBN100212 */ - - /* D1Ar1,D0Ar2,D1Ar5,D0Ar6 -- Arguments to handler, must be preserved - * D0Ar4 -- The deferred exceptions - * D1Ar3 -- As per D0Ar4 but just the trigger bits - */ - - /* - Collect the pending deferred exceptions using TXSTAT, - * (ack's the interrupt exceptions as a side-effect) - */ - DEFR D0Ar4, TXSTATI - - /* Mask off anything unrelated to the deferred exception triggers */ - MOV D1Ar3, D0Ar4 - ANDT D1Ar3, D1Ar3, #HI(TXSTAT_BUSERR_BIT | TXSTAT_FPE_BITS) - - /* Can assume that at least one exception happened since this - * handler wouldnt have been called otherwise. - * - * Replace the signal number and at the same time, prepare - * the mask to acknowledge the exception - * - * The unusual code for 1<= 20, we can reuse the bottom 12-bits - * of D1Re0 (using 'ORGT r,#1') in the knowledge that the top 20-bits will - * be discarded without affecting the result. - * - * D1Re0 -- The bits to acknowledge - * D1Ar3 -- The signal number - */ - MOVT D1Re0, #HI(TXSTAT_FPE_BITS & ~TXSTAT_FPE_DENORMAL_BIT) - MOV D0Re0, #TXSTAT_FPE_INVALID_S - FFB D1Ar3, D1Ar3 - CMP D1Ar3, #TXSTAT_FPE_INVALID_S - MOVLE D1Ar3, D0Re0 /* Collapse FPE triggers to a single signal */ - ORGT D1Re0, D1Re0, #1 - LSLGT D1Re0, D1Re0, D1Ar3 - - SUB D1Ar3, D1Ar3, #(TXSTAT_FPE_INVALID_S - TBID_SIGNUM_FPE) - - /* Acknowledge triggers and restore remaining exceptions - * Do this here in case the handler enables nested interrupts - * - * (x | y) ^ y == x & ~y. It avoids the restrictive XOR ...,#-1 insn - * and is the same length - */ - MOV D0Re0, TXDEFR - OR D0Re0, D0Re0, D1Re0 - XOR TXDEFR, D0Re0, D1Re0 - - /* Get the handler using the signal number - * - * D1Ar3 -- The signal number - * D0Re0 -- Address of handler - */ - LSL D0Re0, D1Ar3, #2 - ADD D0Re0,D0Re0,#TBI_fnSigs - GETD D0Re0, [D0Ar6+D0Re0] - - /* Tailcall the handler */ - MOV PC,D0Re0 - -#endif /* META_BUG_MBN100212 */ - .size ___TBIHandleDFR,.-___TBIHandleDFR -/* - * End of tbidefr.S - */ diff --git a/arch/metag/tbx/tbidspram.S b/arch/metag/tbx/tbidspram.S deleted file mode 100644 index 2f27c03722124..0000000000000 --- a/arch/metag/tbx/tbidspram.S +++ /dev/null @@ -1,161 +0,0 @@ -/* - * tbidspram.S - * - * Copyright (C) 2009, 2012 Imagination Technologies. - * - * 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. - * - * Explicit state save and restore routines forming part of the thread binary - * interface for META processors - */ - - .file "tbidspram.S" - -/* These aren't generally useful to a user so for now, they arent publically available */ -#define _TBIECH_DSPRAM_DUA_S 8 -#define _TBIECH_DSPRAM_DUA_BITS 0x7f00 -#define _TBIECH_DSPRAM_DUB_S 0 -#define _TBIECH_DSPRAM_DUB_BITS 0x007f - -/* - * void *__TBIDspramSaveA( short DspramSizes, void *pExt ) - */ - .text - .balign 4 - .global ___TBIDspramSaveA - .type ___TBIDspramSaveA,function -___TBIDspramSaveA: - - SETL [A0StP++], D0.5, D1.5 - MOV A0.3, D0Ar2 - - /* D1Ar1 - Dspram Sizes - * A0.4 - Pointer to buffer - */ - - /* Save the specified amount of dspram DUA */ -DL MOV D0AR.0, #0 - LSR D1Ar1, D1Ar1, #_TBIECH_DSPRAM_DUA_S - AND D1Ar1, D1Ar1, #(_TBIECH_DSPRAM_DUA_BITS >> _TBIECH_DSPRAM_DUA_S) - SUB TXRPT, D1Ar1, #1 -$L1: -DL MOV D0Re0, [D0AR.0++] -DL MOV D0Ar6, [D0AR.0++] -DL MOV D0Ar4, [D0AR.0++] -DL MOV D0.5, [D0AR.0++] - MSETL [A0.3++], D0Re0, D0Ar6, D0Ar4, D0.5 - - BR $L1 - - GETL D0.5, D1.5, [--A0StP] - MOV PC, D1RtP - - .size ___TBIDspramSaveA,.-___TBIDspramSaveA - -/* - * void *__TBIDspramSaveB( short DspramSizes, void *pExt ) - */ - .balign 4 - .global ___TBIDspramSaveB - .type ___TBIDspramSaveB,function -___TBIDspramSaveB: - - SETL [A0StP++], D0.5, D1.5 - MOV A0.3, D0Ar2 - - /* D1Ar1 - Dspram Sizes - * A0.3 - Pointer to buffer - */ - - /* Save the specified amount of dspram DUA */ -DL MOV D0BR.0, #0 - LSR D1Ar1, D1Ar1, #_TBIECH_DSPRAM_DUB_S - AND D1Ar1, D1Ar1, #(_TBIECH_DSPRAM_DUB_BITS >> _TBIECH_DSPRAM_DUB_S) - SUB TXRPT, D1Ar1, #1 -$L2: -DL MOV D0Re0, [D0BR.0++] -DL MOV D0Ar6, [D0BR.0++] -DL MOV D0Ar4, [D0BR.0++] -DL MOV D0.5, [D0BR.0++] - MSETL [A0.3++], D0Re0, D0Ar6, D0Ar4, D0.5 - - BR $L2 - - GETL D0.5, D1.5, [--A0StP] - MOV PC, D1RtP - - .size ___TBIDspramSaveB,.-___TBIDspramSaveB - -/* - * void *__TBIDspramRestoreA( short DspramSizes, void *pExt ) - */ - .balign 4 - .global ___TBIDspramRestoreA - .type ___TBIDspramRestoreA,function -___TBIDspramRestoreA: - - SETL [A0StP++], D0.5, D1.5 - MOV A0.3, D0Ar2 - - /* D1Ar1 - Dspram Sizes - * A0.3 - Pointer to buffer - */ - - /* Restore the specified amount of dspram DUA */ -DL MOV D0AW.0, #0 - LSR D1Ar1, D1Ar1, #_TBIECH_DSPRAM_DUA_S - AND D1Ar1, D1Ar1, #(_TBIECH_DSPRAM_DUA_BITS >> _TBIECH_DSPRAM_DUA_S) - SUB TXRPT, D1Ar1, #1 -$L3: - MGETL D0Re0, D0Ar6, D0Ar4, D0.5, [A0.3++] -DL MOV [D0AW.0++], D0Re0 -DL MOV [D0AW.0++], D0Ar6 -DL MOV [D0AW.0++], D0Ar4 -DL MOV [D0AW.0++], D0.5 - - BR $L3 - - GETL D0.5, D1.5, [--A0StP] - MOV PC, D1RtP - - .size ___TBIDspramRestoreA,.-___TBIDspramRestoreA - -/* - * void *__TBIDspramRestoreB( short DspramSizes, void *pExt ) - */ - .balign 4 - .global ___TBIDspramRestoreB - .type ___TBIDspramRestoreB,function -___TBIDspramRestoreB: - - SETL [A0StP++], D0.5, D1.5 - MOV A0.3, D0Ar2 - - /* D1Ar1 - Dspram Sizes - * A0.3 - Pointer to buffer - */ - - /* Restore the specified amount of dspram DUA */ -DL MOV D0BW.0, #0 - LSR D1Ar1, D1Ar1, #_TBIECH_DSPRAM_DUB_S - AND D1Ar1, D1Ar1, #(_TBIECH_DSPRAM_DUB_BITS >> _TBIECH_DSPRAM_DUB_S) - SUB TXRPT, D1Ar1, #1 -$L4: - MGETL D0Re0, D0Ar6, D0Ar4, D0.5, [A0.3++] -DL MOV [D0BW.0++], D0Re0 -DL MOV [D0BW.0++], D0Ar6 -DL MOV [D0BW.0++], D0Ar4 -DL MOV [D0BW.0++], D0.5 - - BR $L4 - - GETL D0.5, D1.5, [--A0StP] - MOV PC, D1RtP - - .size ___TBIDspramRestoreB,.-___TBIDspramRestoreB - -/* - * End of tbidspram.S - */ diff --git a/arch/metag/tbx/tbilogf.S b/arch/metag/tbx/tbilogf.S deleted file mode 100644 index 4a34d80657db2..0000000000000 --- a/arch/metag/tbx/tbilogf.S +++ /dev/null @@ -1,48 +0,0 @@ -/* - * tbilogf.S - * - * Copyright (C) 2001, 2002, 2007, 2012 Imagination Technologies. - * - * 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. - * - * Defines __TBILogF trap code for debugging messages and __TBICont for debug - * assert to be implemented on. - */ - - .file "tbilogf.S" - -/* - * Perform console printf using external debugger or host support - */ - .text - .balign 4 - .global ___TBILogF - .type ___TBILogF,function -___TBILogF: - MSETL [A0StP],D0Ar6,D0Ar4,D0Ar2 - SWITCH #0xC10020 - MOV D0Re0,#0 - SUB A0StP,A0StP,#24 - MOV PC,D1RtP - .size ___TBILogF,.-___TBILogF - -/* - * Perform wait for continue under control of the debugger - */ - .text - .balign 4 - .global ___TBICont - .type ___TBICont,function -___TBICont: - MOV D0Ar6,#1 - MSETL [A0StP],D0Ar6,D0Ar4,D0Ar2 - SWITCH #0xC30006 /* Returns if we are to continue */ - SUB A0StP,A0StP,#(8*3) - MOV PC,D1RtP /* Return */ - .size ___TBICont,.-___TBICont - -/* - * End of tbilogf.S - */ diff --git a/arch/metag/tbx/tbipcx.S b/arch/metag/tbx/tbipcx.S deleted file mode 100644 index 163c79ac913b9..0000000000000 --- a/arch/metag/tbx/tbipcx.S +++ /dev/null @@ -1,451 +0,0 @@ -/* - * tbipcx.S - * - * Copyright (C) 2001, 2002, 2007, 2009, 2012 Imagination Technologies. - * - * 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. - * - * Asyncronous trigger handling including exceptions - */ - - .file "tbipcx.S" -#include -#include - -/* BEGIN HACK */ -/* define these for now while doing initial conversion to GAS - will fix properly later */ - -/* Signal identifiers always have the TBID_SIGNAL_BIT set and contain the - following related bit-fields */ -#define TBID_SIGNUM_S 2 - -/* END HACK */ - -#ifdef METAC_1_0 -/* Ax.4 is saved in TBICTX */ -#define A0_4 ,A0.4 -#else -/* Ax.4 is NOT saved in TBICTX */ -#define A0_4 -#endif - -/* Size of the TBICTX structure */ -#define TBICTX_BYTES ((TBICTX_AX_REGS*8)+TBICTX_AX) - -#ifdef METAC_1_1 -#ifndef BOOTROM -#ifndef SPECIAL_BUILD -/* Jump straight into the boot ROM version of this code */ -#define CODE_USES_BOOTROM -#endif -#endif -#endif - -/* Define space needed for CATCH buffer state in traditional units */ -#define CATCH_ENTRIES 5 -#define CATCH_ENTRY_BYTES 16 - -#ifndef CODE_USES_BOOTROM -#define A0GblIStP A0.15 /* PTBICTX for current thread in PRIV system */ -#define A1GblIGbP A1.15 /* Interrupt A1GbP value in PRIV system */ -#endif - -/* - * TBIRES __TBIASyncTrigger( TBIRES State ) - */ - .text - .balign 4 - .global ___TBIASyncTrigger - .type ___TBIASyncTrigger,function -___TBIASyncTrigger: -#ifdef CODE_USES_BOOTROM - MOVT D0Re0,#HI(LINCORE_BASE) - JUMP D0Re0,#0xA0 -#else - MOV D0FrT,A0FrP /* Boing entry sequence */ - ADD A0FrP,A0StP,#0 - SETL [A0StP++],D0FrT,D1RtP - MOV D0Re0,PCX /* Check for repeat call */ - MOVT D0FrT,#HI(___TBIBoingRTI+4) - ADD D0FrT,D0FrT,#LO(___TBIBoingRTI+4) - CMP D0Re0,D0FrT - BEQ ___TBIBoingExit /* Already set up - come out */ - ADD D1Ar1,D1Ar1,#7 /* PRIV system stack here */ - MOV A0.2,A0StP /* else push context here */ - MOVS D0Re0,D0Ar2 /* Return in user mode? */ - ANDMB D1Ar1,D1Ar1,#0xfff8 /* align priv stack to 64-bit */ - MOV D1Re0,D1Ar1 /* and set result to arg */ - MOVMI A0.2,D1Ar1 /* use priv stack if PRIV set */ -/* - * Generate an initial TBICTX to return to our own current call context - */ - MOVT D1Ar5,#HI(___TBIBoingExit) /* Go here to return */ - ADD D1Ar5,D1Ar5,#LO(___TBIBoingExit) - ADD A0.3,A0.2,#TBICTX_DX /* DX Save area */ - ANDT D0Ar2,D0Ar2,#TBICTX_PRIV_BIT /* Extract PRIV bit */ - MOVT D0Ar6,#TBICTX_SOFT_BIT /* Only soft thread state */ - ADD D0Ar6,D0Ar6,D0Ar2 /* Add in PRIV bit if requested */ - SETL [A0.2],D0Ar6,D1Ar5 /* Push header fields */ - ADD D0FrT,A0.2,#TBICTX_AX /* Address AX save area */ - MSETL [A0.3],D0Re0,D0Ar6,D0Ar4,D0Ar2,D0FrT,D0.5,D0.6,D0.7 - MOV D0Ar6,#0 - MOV D1Ar5,#0 - SETL [A0.3++],D0Ar6,D1Ar5 /* Zero CT register states */ - SETL [A0.3++],D0Ar6,D1Ar5 - MSETL [D0FrT],A0StP,A0FrP,A0.2,A0.3 A0_4 /* Save AX regs */ - MOV A0FrP,A0.2 /* Restore me! */ - B ___TBIResume - .size ___TBIASyncTrigger,.-___TBIASyncTrigger - -/* - * Optimised return to handler for META Core - */ -___TBIBoingRTH: - RTH /* Go to background level */ - MOVT A0.2, #HI($Lpcx_target) - ADD A0.2,A0.2,#LO($Lpcx_target) - MOV PCX,A0.2 /* Setup PCX for interrupts */ - MOV PC,D1Re0 /* Jump to handler */ -/* - * This is where the code below needs to jump to wait for outermost interrupt - * event in a non-privilege mode system (single shared interrupt stack). - */ -___TBIBoingPCX: - MGETL A0StP,A0FrP,A0.2,A0.3 A0_4,[D1Re0] /* Restore AX regs */ - MOV TXSTATUS,D0Re0 /* Restore flags */ - GETL D0Re0,D1Re0,[D1Re0+#TBICTX_DX-TBICTX_BYTES] -___TBIBoingRTI: - RTI /* Wait for interrupt */ -$Lpcx_target: -/* - * Save initial interrupt state on current stack - */ - SETL [A0StP+#TBICTX_DX],D0Re0,D1Re0 /* Save key registers */ - ADD D1Re0,A0StP,#TBICTX_AX /* Address AX save area */ - MOV D0Re0,TXSTATUS /* Read TXSTATUS into D0Re0 */ - MOV TXSTATUS,#0 /* Clear TXSTATUS */ - MSETL [D1Re0],A0StP,A0FrP,A0.2,A0.3 A0_4 /* Save AX critical regs */ -/* - * Register state at this point is- - * - * D0Re0 - Old TXSTATUS with PRIV and CBUF bits set if appropriate - * A0StP - Is call stack frame and base of TBICTX being generated - * A1GbP - Is valid static access link - */ -___TBIBoing: - LOCK0 /* Make sure we have no locks! */ - ADD A1.2,A0StP,#TBICTX_DX+(8*1) /* Address DX.1 save area */ - MOV A0FrP,A0StP /* Setup frame pointer */ - MSETL [A1.2],D0Ar6,D0Ar4,D0Ar2,D0FrT,D0.5,D0.6,D0.7 - MOV D0Ar4,TXRPT /* Save critical CT regs */ - MOV D1Ar3,TXBPOBITS - MOV D1Ar1,TXDIVTIME /* Calc catch buffer pSrc */ - MOV D0Ar2,TXMODE - MOV TXMODE,#0 /* Clear TXMODE */ -#ifdef TXDIVTIME_RPDIRTY_BIT - TSTT D1Ar1,#HI(TXDIVTIME_RPDIRTY_BIT)/* NZ = RPDIRTY */ - MOVT D0Ar6,#TBICTX_CBRP_BIT - ORNZ D0Re0,D0Re0,D0Ar6 /* Set CBRP if RPDIRTY set */ -#endif - MSETL [A1.2],D0Ar4,D0Ar2 /* Save CT regs state */ - MOV D0Ar2,D0Re0 /* Copy TXSTATUS */ - ANDMT D0Ar2,D0Ar2,#TBICTX_CBUF_BIT+TBICTX_CBRP_BIT -#ifdef TBI_1_4 - MOVT D1Ar1,#TBICTX_FPAC_BIT /* Copy FPActive into FPAC */ - TSTT D0Re0,#HI(TXSTATUS_FPACTIVE_BIT) - ORNZ D0Ar2,D0Ar2,D1Ar1 -#endif - MOV D1Ar1,PCX /* Read CurrPC */ - ORT D0Ar2,D0Ar2,#TBICTX_CRIT_BIT /* SaveMask + CRIT bit */ - SETL [A0FrP+#TBICTX_Flags],D0Ar2,D1Ar1 /* Set pCtx header fields */ -/* - * Completed context save, now we need to make a call to an interrupt handler - * - * D0Re0 - holds PRIV, WAIT, CBUF flags, HALT reason if appropriate - * A0FrP - interrupt stack frame and base of TBICTX being generated - * A0StP - same as A0FrP - */ -___TBIBoingWait: - /* Reserve space for TBICTX and CBUF */ - ADD A0StP,A0StP,#TBICTX_BYTES+(CATCH_ENTRY_BYTES*CATCH_ENTRIES) - MOV D0Ar4,TXSTATI /* Read the Triggers data */ - MOV D1Ar3,TXDIVTIME /* Read IRQEnc bits */ - MOV D0Ar2,D0Re0 /* Copy PRIV and WAIT flags */ - ANDT D0Ar2,D0Ar2,#TBICTX_PRIV_BIT+TBICTX_WAIT_BIT+TBICTX_CBUF_BIT -#ifdef TBI_1_4 - MOVT D1Ar5,#TBICTX_FPAC_BIT /* Copy FPActive into FPAC */ - TSTT D0Re0,#HI(TXSTATUS_FPACTIVE_BIT) - ORNZ D0Ar2,D0Ar2,D1Ar5 -#endif - ANDT D1Ar3,D1Ar3,#HI(TXDIVTIME_IRQENC_BITS) - LSR D1Ar3,D1Ar3,#TXDIVTIME_IRQENC_S - AND TXSTATI,D0Ar4,#TXSTATI_BGNDHALT_BIT/* Ack any HALT seen */ - ANDS D0Ar4,D0Ar4,#0xFFFF-TXSTATI_BGNDHALT_BIT /* Only seen HALT? */ - ORT D0Ar2,D0Ar2,#TBICTX_CRIT_BIT /* Set CRIT */ -#ifndef BOOTROM - MOVT A1LbP,#HI(___pTBIs) - ADD A1LbP,A1LbP,#LO(___pTBIs) - GETL D1Ar5,D0Ar6,[A1LbP] /* D0Ar6 = ___pTBIs[1] */ -#else -/* - * For BOOTROM support ___pTBIs must be allocated at offset 0 vs A1GbP - */ - GETL D1Ar5,D0Ar6,[A1GbP] /* D0Ar6 = ___pTBIs[1] */ -#endif - BZ ___TBIBoingHalt /* Yes: Service HALT */ -/* - * Encode interrupt as signal vector, strip away same/lower TXMASKI bits - */ - MOV D1Ar1,#1 /* Generate mask for this bit */ - MOV D0Re0,TXMASKI /* Get interrupt mask */ - LSL TXSTATI,D1Ar1,D1Ar3 /* Acknowledge trigger */ - AND TXMASKI,D0Re0,#TXSTATI_BGNDHALT_BIT /* Only allow HALTs */ - OR D0Ar2,D0Ar2,D0Re0 /* Set TBIRES.Sig.TrigMask */ - ADD D1Ar3,D1Ar3,#TBID_SIGNUM_TRT /* Offset into interrupt sigs */ - LSL D0Re0,D1Ar3,#TBID_SIGNUM_S /* Generate offset from SigNum */ -/* - * This is a key moment we are about to call the handler, register state is - * as follows- - * - * D0Re0 - Handler vector (SigNum< bit 0 */ - ADD RA,D0Ar4,#(0*8) /* Re-read read pipeline */ - ADDNZ RA,D0Ar4,D0Ar2 /* If Bit 0 set issue RA */ - LSRS D1Ar3,D1Ar3,#2 /* Bit 1 -> C, Bit 2 -> Bit 0 */ - ADD D0Ar2,D0Ar2,#8 - ADDCS RA,D0Ar4,D0Ar2 /* If C issue RA */ - ADD D0Ar2,D0Ar2,#8 - ADDNZ RA,D0Ar4,D0Ar2 /* If Bit 0 set issue RA */ - LSRS D1Ar3,D1Ar3,#2 /* Bit 1 -> C, Bit 2 -> Bit 0 */ - ADD D0Ar2,D0Ar2,#8 - ADDCS RA,D0Ar4,D0Ar2 /* If C issue RA */ - ADD D0Ar2,D0Ar2,#8 - ADDNZ RA,D0Ar4,D0Ar2 /* If Bit 0 set issue RA */ - MOV TXDIVTIME,A1.3 /* Set RPDIRTY again */ -___TBIResCrit: - LSLS D1Ar5,D0Re0,#1 /* Test XCBF (MI) & PRIV (CS)? */ -#ifdef TBI_1_4 - ANDT D1Ar5,D1Ar5,#(TBICTX_FPAC_BIT*2) - LSL D0Ar6,D1Ar5,#3 /* Convert FPAC into FPACTIVE */ -#endif - ANDMT D0Re0,D0Re0,#TBICTX_CBUF_BIT /* Keep CBUF bit from SaveMask */ -#ifdef TBI_1_4 - OR D0Re0,D0Re0,D0Ar6 /* Combine FPACTIVE with others */ -#endif - MGETL D0Ar6,D0Ar4,D0Ar2,D0FrT,D0.5,D0.6,D0.7,[A0StP] /* Restore DX */ - MOV TXRPT,A0.2 /* Restore CT regs */ - MOV TXBPOBITS,A1.2 - MOV TXMODE,A0.3 - BCC ___TBIBoingPCX /* Do non-PRIV wait! */ - MOV A1GblIGbP,A1GbP /* Save A1GbP too */ - MGETL A0StP,A0FrP,A0.2,A0.3 A0_4,[D1Re0] /* Restore AX regs */ -/* - * Wait for the first interrupt/exception trigger in a privilege mode system - * (interrupt stack area for current TASK to be pointed to by A0GblIStP - * or per_cpu__stack_save[hwthread_id]). - */ - MOV TXSTATUS,D0Re0 /* Restore flags */ - MOV D0Re0,TXPRIVEXT /* Set TXPRIVEXT_TXTOGGLEI_BIT */ - SUB D1Re0,D1Re0,#TBICTX_BYTES /* TBICTX is top of int stack */ -#ifdef TBX_PERCPU_SP_SAVE - SWAP D1Ar3,A1GbP - MOV D1Ar3,TXENABLE /* Which thread are we? */ - AND D1Ar3,D1Ar3,#TXENABLE_THREAD_BITS - LSR D1Ar3,D1Ar3,#TXENABLE_THREAD_S-2 - ADDT D1Ar3,D1Ar3,#HI(_per_cpu__stack_save) - ADD D1Ar3,D1Ar3,#LO(_per_cpu__stack_save) - SETD [D1Ar3],D1Re0 - SWAP D1Ar3,A1GbP -#else - MOV A0GblIStP, D1Re0 -#endif - OR D0Re0,D0Re0,#TXPRIVEXT_TXTOGGLEI_BIT - MOV TXPRIVEXT,D0Re0 /* Cannot set TXPRIVEXT if !priv */ - GETL D0Re0,D1Re0,[D1Re0+#TBICTX_DX] - RTI /* Wait for interrupt */ -/* - * Save initial interrupt state on A0GblIStP, switch to A0GblIStP if - * BOOTROM code, save and switch to [A1GbP] otherwise. - */ -___TBIBoingPCXP: -#ifdef TBX_PERCPU_SP_SAVE - SWAP D1Ar3,A1GbP /* Get PRIV stack base */ - MOV D1Ar3,TXENABLE /* Which thread are we? */ - AND D1Ar3,D1Ar3,#TXENABLE_THREAD_BITS - LSR D1Ar3,D1Ar3,#TXENABLE_THREAD_S-2 - ADDT D1Ar3,D1Ar3,#HI(_per_cpu__stack_save) - ADD D1Ar3,D1Ar3,#LO(_per_cpu__stack_save) - GETD D1Ar3,[D1Ar3] -#else - SWAP D1Ar3,A0GblIStP /* Get PRIV stack base */ -#endif - SETL [D1Ar3+#TBICTX_DX],D0Re0,D1Re0 /* Save key registers */ - MOV D0Re0,TXPRIVEXT /* Clear TXPRIVEXT_TXTOGGLEI_BIT */ - ADD D1Re0,D1Ar3,#TBICTX_AX /* Address AX save area */ - ANDMB D0Re0,D0Re0,#0xFFFF-TXPRIVEXT_TXTOGGLEI_BIT - MOV TXPRIVEXT,D0Re0 /* Cannot set TXPRIVEXT if !priv */ - MOV D0Re0,TXSTATUS /* Read TXSTATUS into D0Re0 */ - MOV TXSTATUS,#0 /* Clear TXSTATUS */ - MSETL [D1Re0],A0StP,A0FrP,A0.2,A0.3 A0_4 /* Save AX critical regs */ - MOV A0StP,D1Ar3 /* Switch stacks */ -#ifdef TBX_PERCPU_SP_SAVE - MOV D1Ar3,A1GbP /* Get D1Ar2 back */ -#else - MOV D1Ar3,A0GblIStP /* Get D1Ar2 back */ -#endif - ORT D0Re0,D0Re0,#TBICTX_PRIV_BIT /* Add PRIV to TXSTATUS */ - MOV A1GbP,A1GblIGbP /* Restore A1GbP */ - B ___TBIBoing /* Enter common handler code */ -/* - * At this point we know it's a background HALT case we are handling. - * The restored TXSTATUS always needs to have zero in the reason bits. - */ -___TBIBoingHalt: - MOV D0Ar4,TXMASKI /* Get interrupt mask */ - ANDST D0Re0,D0Re0,#HI(TXSTATUS_MAJOR_HALT_BITS+TXSTATUS_MEM_FAULT_BITS) - AND TXMASKI,D0Ar4,#TXSTATI_BGNDHALT_BIT /* Only allow HALTs */ - AND D0Ar4,D0Ar4,#0xFFFF-TXSTATI_BGNDHALT_BIT /* What ints are off? */ - OR D0Ar2,D0Ar2,D0Ar4 /* Set TBIRES.Sig.TrigMask */ - MOV D0Ar4,#TXSTATI_BGNDHALT_BIT /* This was the trigger state */ - LSR D1Ar3,D0Re0,#TXSTATUS_MAJOR_HALT_S - MOV D0Re0,#TBID_SIGNUM_XXF<> 1)/* Shifted mask for large MINIM */ - ANDT D1Ar1,D1Ar1,#HI(0xFFE00000) /* Static mask for small MINIM */ - BZ $Llarge_minim /* If large MINIM */ -$Lsmall_minim: - TSTT D1Ar3,#HI(0x00100000 >> 1) - ANDMT D1Ar3,D1Ar3,#HI(0x001FFFFF >> 1)/* Correct shifted mask for large MINIM */ - ADDZ D1Ar1,D1Ar1,D1Ar3 /* If META rgn, add twice to undo LSR #1 */ - B $Lrecombine -$Llarge_minim: - ANDST D1Ar1,D1Ar1,#HI(0xFF800000) /* Correct static mask for small MINIM */ - /* Z=0 (Cannot place code at NULL) */ -$Lrecombine: - ADD D1Ar1,D1Ar1,D1Ar3 /* Combine static and shifted parts */ -$Lmeta: - GETW D1Ar5,[D1Ar1++] /* META: lo-16, MINIM: lo-16 (all-16 if short) */ - GETW D1Ar3,[D1Ar1] /* META: hi-16, MINIM: hi-16 (only if long) */ - MOV D1Re0,D1Ar5 - XOR D1Re0,D1Re0,#0x4000 - LSLSNZ D1Re0,D1Re0,#(32-14) /* MINIM: If long C=0, if short C=1 */ - LSLCC D1Ar3,D1Ar3,#16 /* META/MINIM long: Move hi-16 up */ - LSLCS D1Ar3,D1Ar5,#16 /* MINIM short: Dup all-16 */ - ADD D1Ar5,D1Ar5,D1Ar3 /* ALL: Combine both 16-bit parts */ -#else - GETD D1Ar5,[D1Ar1] /* Read instruction for switch */ -#endif - LSR D1Ar3,D1Ar5,#22 /* Convert into signal number */ - AND D1Ar3,D1Ar3,#TBID_SIGNUM_SW3-TBID_SIGNUM_SW0 - LSL D0Re0,D1Ar3,#TBID_SIGNUM_S /* Generate offset from SigNum */ - B ___TBIBoingVec /* Jump to switch handler */ -/* - * Exit from TBIASyncTrigger call - */ -___TBIBoingExit: - GETL D0FrT,D1RtP,[A0FrP++] /* Restore state from frame */ - SUB A0StP,A0FrP,#8 /* Unwind stack */ - MOV A0FrP,D0FrT /* Last memory read completes */ - MOV PC,D1RtP /* Return to caller */ -#endif /* ifdef CODE_USES_BOOTROM */ - .size ___TBIResume,.-___TBIResume - -#ifndef BOOTROM -/* - * void __TBIASyncResume( TBIRES State ) - */ - .text - .balign 4 - .global ___TBIASyncResume - .type ___TBIASyncResume,function -___TBIASyncResume: -/* - * Perform CRIT|SOFT state restore and execute background thread. - */ - MOV D1Ar3,D1Ar1 /* Restore this context */ - MOV D0Re0,D0Ar2 /* Carry in additional triggers */ - /* Reserve space for TBICTX */ - ADD D1Ar3,D1Ar3,#TBICTX_BYTES+(CATCH_ENTRY_BYTES*CATCH_ENTRIES) - MOV A0StP,D1Ar3 /* Enter with protection of */ - MOV A0FrP,D1Ar1 /* TBICTX on our stack */ -#ifdef CODE_USES_BOOTROM - MOVT D1Ar1,#HI(LINCORE_BASE) - JUMP D1Ar1,#0xA4 -#else - B ___TBIResume -#endif - .size ___TBIASyncResume,.-___TBIASyncResume -#endif /* ifndef BOOTROM */ - -/* - * End of tbipcx.S - */ diff --git a/arch/metag/tbx/tbiroot.S b/arch/metag/tbx/tbiroot.S deleted file mode 100644 index 7d84daf1340b5..0000000000000 --- a/arch/metag/tbx/tbiroot.S +++ /dev/null @@ -1,87 +0,0 @@ -/* - * tbiroot.S - * - * Copyright (C) 2001, 2002, 2012 Imagination Technologies. - * - * 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. - * - * Module that creates and via ___TBI function returns a TBI Root Block for - * interrupt and background processing on the current thread. - */ - - .file "tbiroot.S" -#include - -/* - * Get data structures and defines from the TBI C header - */ -#include - - -/* If signals need to be exchanged we must create a TBI Root Block */ - - .data - .balign 8 - .global ___pTBIs - .type ___pTBIs,object -___pTBIs: - .long 0 /* Bgnd+Int root block ptrs */ - .long 0 - .size ___pTBIs,.-___pTBIs - - -/* - * Return ___pTBIs value specific to execution level with promotion/demotion - * - * Register Usage: D1Ar1 is Id, D0Re0 is the primary result - * D1Re0 is secondary result (___pTBIs for other exec level) - */ - .text - .balign 4 - .global ___TBI - .type ___TBI,function -___TBI: - TSTT D1Ar1,#HI(TBID_ISTAT_BIT) /* Bgnd or Int level? */ - MOVT A1LbP,#HI(___pTBIs) - ADD A1LbP,A1LbP,#LO(___pTBIs) - GETL D0Re0,D1Re0,[A1LbP] /* Base of root block table */ - SWAPNZ D0Re0,D1Re0 /* Swap if asked */ - MOV PC,D1RtP - .size ___TBI,.-___TBI - - -/* - * Return identifier of the current thread in TBI segment or signal format with - * secondary mask to indicate privilege and interrupt level of thread - */ - .text - .balign 4 - .global ___TBIThrdPrivId - .type ___TBIThrdPrivId,function -___TBIThrdPrivId: - .global ___TBIThreadId - .type ___TBIThreadId,function -___TBIThreadId: -#ifndef METAC_0_1 - MOV D1Re0,TXSTATUS /* Are we privileged or int? */ - MOV D0Re0,TXENABLE /* Which thread are we? */ -/* Disable privilege adaption for now */ - ANDT D1Re0,D1Re0,#HI(TXSTATUS_ISTAT_BIT) /* +TXSTATUS_PSTAT_BIT) */ - LSL D1Re0,D1Re0,#TBID_ISTAT_S-TXSTATUS_ISTAT_S - AND D0Re0,D0Re0,#TXENABLE_THREAD_BITS - LSL D0Re0,D0Re0,#TBID_THREAD_S-TXENABLE_THREAD_S -#else -/* Thread 0 only */ - XOR D0Re0,D0Re0,D0Re0 - XOR D1Re0,D1Re0,D1Re0 -#endif - MOV PC,D1RtP /* Return */ - .size ___TBIThrdPrivId,.-___TBIThrdPrivId - .size ___TBIThreadId,.-___TBIThreadId - - -/* - * End of tbiroot.S - */ diff --git a/arch/metag/tbx/tbisoft.S b/arch/metag/tbx/tbisoft.S deleted file mode 100644 index b04f50df8d913..0000000000000 --- a/arch/metag/tbx/tbisoft.S +++ /dev/null @@ -1,237 +0,0 @@ -/* - * tbisoft.S - * - * Copyright (C) 2001, 2002, 2007, 2012 Imagination Technologies. - * - * 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. - * - * Support for soft threads and soft context switches - */ - - .file "tbisoft.S" - -#include - -#ifdef METAC_1_0 -/* Ax.4 is saved in TBICTX */ -#define A0_4 ,A0.4 -#define D0_5 ,D0.5 -#else -/* Ax.4 is NOT saved in TBICTX */ -#define A0_4 -#define D0_5 -#endif - -/* Size of the TBICTX structure */ -#define TBICTX_BYTES ((TBICTX_AX_REGS*8)+TBICTX_AX) - - .text - .balign 4 - .global ___TBISwitchTail - .type ___TBISwitchTail,function -___TBISwitchTail: - B $LSwitchTail - .size ___TBISwitchTail,.-___TBISwitchTail - -/* - * TBIRES __TBIJumpX( TBIX64 ArgsA, PTBICTX *rpSaveCtx, int TrigsMask, - * void (*fnMain)(), void *pStack ); - * - * This is a combination of __TBISwitch and __TBIJump with the context of - * the calling thread being saved in the rpSaveCtx location with a drop-thru - * effect into the __TBIJump logic. ArgsB passes via __TBIJump to the - * routine eventually invoked will reflect the rpSaveCtx value specified. - */ - .text - .balign 4 - .global ___TBIJumpX - .type ___TBIJumpX,function -___TBIJumpX: - CMP D1RtP,#-1 - B $LSwitchStart - .size ___TBIJumpX,.-___TBIJumpX - -/* - * TBIRES __TBISwitch( TBIRES Switch, PTBICTX *rpSaveCtx ) - * - * Software synchronous context switch between soft threads, save only the - * registers which are actually valid on call entry. - * - * A0FrP, D0RtP, D0.5, D0.6, D0.7 - Saved on stack - * A1GbP is global to all soft threads so not virtualised - * A0StP is then saved as the base of the TBICTX of the thread - * - */ - .text - .balign 4 - .global ___TBISwitch - .type ___TBISwitch,function -___TBISwitch: - XORS D0Re0,D0Re0,D0Re0 /* Set ZERO flag */ -$LSwitchStart: - MOV D0FrT,A0FrP /* Boing entry sequence */ - ADD A0FrP,A0StP,#0 - SETL [A0StP+#8++],D0FrT,D1RtP -/* - * Save current frame state - we save all regs because we don't want - * uninitialised crap in the TBICTX structure that the asynchronous resumption - * of a thread will restore. - */ - MOVT D1Re0,#HI($LSwitchExit) /* ASync resume point here */ - ADD D1Re0,D1Re0,#LO($LSwitchExit) - SETD [D1Ar3],A0StP /* Record pCtx of this thread */ - MOVT D0Re0,#TBICTX_SOFT_BIT /* Only soft thread state */ - SETL [A0StP++],D0Re0,D1Re0 /* Push header fields */ - ADD D0FrT,A0StP,#TBICTX_AX-TBICTX_DX /* Address AX save area */ - MOV D0Re0,#0 /* Setup 0:0 result for ASync */ - MOV D1Re0,#0 /* resume of the thread */ - MSETL [A0StP],D0Re0,D0Ar6,D0Ar4,D0Ar2,D0FrT,D0.5,D0.6,D0.7 - SETL [A0StP++],D0Re0,D1Re0 /* Zero CurrRPT, CurrBPOBITS, */ - SETL [A0StP++],D0Re0,D1Re0 /* Zero CurrMODE, CurrDIVTIME */ - ADD A0StP,A0StP,#(TBICTX_AX_REGS*8) /* Reserve AX save space */ - MSETL [D0FrT],A0StP,A0FrP,A0.2,A0.3 A0_4 /* Save AX regs */ - BNZ ___TBIJump -/* - * NextThread MUST be in TBICTX_SOFT_BIT state! - */ -$LSwitchTail: - MOV D0Re0,D0Ar2 /* Result from args */ - MOV D1Re0,D1Ar1 - ADD D1RtP,D1Ar1,#TBICTX_AX - MGETL A0StP,A0FrP,[D1RtP] /* Get frame values */ -$LSwitchCmn: - ADD A0.2,D1Ar1,#TBICTX_DX+(8*5) - MGETL D0.5,D0.6,D0.7,[A0.2] /* Get caller-saved DX regs */ -$LSwitchExit: - GETL D0FrT,D1RtP,[A0FrP++] /* Restore state from frame */ - SUB A0StP,A0FrP,#8 /* Unwind stack */ - MOV A0FrP,D0FrT /* Last memory read completes */ - MOV PC,D1RtP /* Return to caller */ - .size ___TBISwitch,.-___TBISwitch - -/* - * void __TBISyncResume( TBIRES State, int TrigMask ); - * - * This routine causes the TBICTX structure specified in State.Sig.pCtx to - * be restored. This implies that execution will not return to the caller. - * The State.Sig.TrigMask field will be ored into TXMASKI during the - * context switch such that any immediately occurring interrupts occur in - * the context of the newly specified task. The State.Sig.SaveMask parameter - * is ignored. - */ - .text - .balign 4 - .global ___TBISyncResume - .type ___TBISyncResume,function -___TBISyncResume: - MOV D0Re0,D0Ar2 /* Result from args */ - MOV D1Re0,D1Ar1 - XOR D1Ar5,D1Ar5,D1Ar5 /* D1Ar5 = 0 */ - ADD D1RtP,D1Ar1,#TBICTX_AX - SWAP D1Ar5,TXMASKI /* D1Ar5 <-> TXMASKI */ - MGETL A0StP,A0FrP,[D1RtP] /* Get frame values */ - OR TXMASKI,D1Ar5,D1Ar3 /* New TXMASKI */ - B $LSwitchCmn - .size ___TBISyncResume,.-___TBISyncResume - -/* - * void __TBIJump( TBIX64 ArgsA, TBIX32 ArgsB, int TrigsMask, - * void (*fnMain)(), void *pStack ); - * - * Jump directly to a new routine on an arbitrary stack with arbitrary args - * oring bits back into TXMASKI on route. - */ - .text - .balign 4 - .global ___TBIJump - .type ___TBIJump,function -___TBIJump: - XOR D0Re0,D0Re0,D0Re0 /* D0Re0 = 0 */ - MOV A0StP,D0Ar6 /* Stack = Frame */ - SWAP D0Re0,TXMASKI /* D0Re0 <-> TXMASKI */ - MOV A0FrP,D0Ar6 - MOVT A1LbP,#HI(__exit) - ADD A1LbP,A1LbP,#LO(__exit) - MOV D1RtP,A1LbP /* D1RtP = __exit */ - OR TXMASKI,D0Re0,D0Ar4 /* New TXMASKI */ - MOV PC,D1Ar5 /* Jump to fnMain */ - .size ___TBIJump,.-___TBIJump - -/* - * PTBICTX __TBISwitchInit( void *pStack, int (*fnMain)(), - * .... 4 extra 32-bit args .... ); - * - * Generate a new soft thread context ready for it's first outing. - * - * D1Ar1 - Region of memory to be used as the new soft thread stack - * D0Ar2 - Main line routine for new soft thread - * D1Ar3, D0Ar4, D1Ar5, D0Ar6 - arguments to be passed on stack - * The routine returns the initial PTBICTX value for the new thread - */ - .text - .balign 4 - .global ___TBISwitchInit - .type ___TBISwitchInit,function -___TBISwitchInit: - MOV D0FrT,A0FrP /* Need save return point */ - ADD A0FrP,A0StP,#0 - SETL [A0StP++],D0FrT,D1RtP /* Save return to caller */ - MOVT A1LbP,#HI(__exit) - ADD A1LbP,A1LbP,#LO(__exit) - MOV D1RtP,A1LbP /* Get address of __exit */ - ADD D1Ar1,D1Ar1,#7 /* Align stack to 64-bits */ - ANDMB D1Ar1,D1Ar1,#0xfff8 /* by rounding base up */ - MOV A0.2,D1Ar1 /* A0.2 is new stack */ - MOV D0FrT,D1Ar1 /* Initial puesdo-frame pointer */ - SETL [A0.2++],D0FrT,D1RtP /* Save return to __exit */ - MOV D1RtP,D0Ar2 - SETL [A0.2++],D0FrT,D1RtP /* Save return to fnMain */ - ADD D0FrT,D0FrT,#8 /* Advance puesdo-frame pointer */ - MSETL [A0.2],D0Ar6,D0Ar4 /* Save extra initial args */ - MOVT D1RtP,#HI(___TBIStart) /* Start up code for new stack */ - ADD D1RtP,D1RtP,#LO(___TBIStart) - SETL [A0.2++],D0FrT,D1RtP /* Save return to ___TBIStart */ - ADD D0FrT,D0FrT,#(8*3) /* Advance puesdo-frame pointer */ - MOV D0Re0,A0.2 /* Return pCtx for new thread */ - MOV D1Re0,#0 /* pCtx:0 is default Arg1:Arg2 */ -/* - * Generate initial TBICTX state - */ - MOVT D1Ar1,#HI($LSwitchExit) /* Async restore code */ - ADD D1Ar1,D1Ar1,#LO($LSwitchExit) - MOVT D0Ar2,#TBICTX_SOFT_BIT /* Only soft thread state */ - ADD D0Ar6,A0.2,#TBICTX_BYTES /* New A0StP */ - MOV D1Ar5,A1GbP /* Same A1GbP */ - MOV D0Ar4,D0FrT /* Initial A0FrP */ - MOV D1Ar3,A1LbP /* Same A1LbP */ - SETL [A0.2++],D0Ar2,D1Ar1 /* Set header fields */ - MSETL [A0.2],D0Re0,D0Ar6,D0Ar4,D0Ar2,D0FrT,D0.5,D0.6,D0.7 - MOV D0Ar2,#0 /* Zero values */ - MOV D1Ar1,#0 - SETL [A0.2++],D0Ar2,D1Ar1 /* Zero CurrRPT, CurrBPOBITS, */ - SETL [A0.2++],D0Ar2,D1Ar1 /* CurrMODE, and pCurrCBuf */ - MSETL [A0.2],D0Ar6,D0Ar4,D0Ar2,D0FrT D0_5 /* Set DX and then AX regs */ - B $LSwitchExit /* All done! */ - .size ___TBISwitchInit,.-___TBISwitchInit - - .text - .balign 4 - .global ___TBIStart - .type ___TBIStart,function -___TBIStart: - MOV D1Ar1,D1Re0 /* Pass TBIRES args to call */ - MOV D0Ar2,D0Re0 - MGETL D0Re0,D0Ar6,D0Ar4,[A0FrP] /* Get hidden args */ - SUB A0StP,A0FrP,#(8*3) /* Entry stack pointer */ - MOV A0FrP,D0Re0 /* Entry frame pointer */ - MOVT A1LbP,#HI(__exit) - ADD A1LbP,A1LbP,#LO(__exit) - MOV D1RtP,A1LbP /* D1RtP = __exit */ - MOV PC,D1Re0 /* Jump into fnMain */ - .size ___TBIStart,.-___TBIStart - -/* - * End of tbisoft.S - */ diff --git a/arch/metag/tbx/tbistring.c b/arch/metag/tbx/tbistring.c deleted file mode 100644 index f90cd08220658..0000000000000 --- a/arch/metag/tbx/tbistring.c +++ /dev/null @@ -1,114 +0,0 @@ -/* - * tbistring.c - * - * Copyright (C) 2001, 2002, 2003, 2005, 2007, 2012 Imagination Technologies. - * - * 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. - * - * String table functions provided as part of the thread binary interface for - * Meta processors - */ - -#include -#include -#include - -/* - * There are not any functions to modify the string table currently, if these - * are required at some later point I suggest having a seperate module and - * ensuring that creating new entries does not interfere with reading old - * entries in any way. - */ - -const TBISTR *__TBIFindStr(const TBISTR *start, - const char *str, int match_len) -{ - const TBISTR *search = start; - bool exact = true; - const TBISEG *seg; - - if (match_len < 0) { - /* Make match_len always positive for the inner loop */ - match_len = -match_len; - exact = false; - } else { - /* - * Also support historic behaviour, which expected match_len to - * include null terminator - */ - if (match_len && str[match_len-1] == '\0') - match_len--; - } - - if (!search) { - /* Find global string table segment */ - seg = __TBIFindSeg(NULL, TBID_SEG(TBID_THREAD_GLOBAL, - TBID_SEGSCOPE_GLOBAL, - TBID_SEGTYPE_STRING)); - - if (!seg || seg->Bytes < sizeof(TBISTR)) - /* No string table! */ - return NULL; - - /* Start of string table */ - search = seg->pGAddr; - } - - for (;;) { - while (!search->Tag) - /* Allow simple gaps which are just zero initialised */ - search = (const TBISTR *)((const char *)search + 8); - - if (search->Tag == METAG_TBI_STRE) { - /* Reached the end of the table */ - search = NULL; - break; - } - - if ((search->Len >= match_len) && - (!exact || (search->Len == match_len + 1)) && - (search->Tag != METAG_TBI_STRG)) { - /* Worth searching */ - if (!strncmp(str, (const char *)search->String, - match_len)) - break; - } - - /* Next entry */ - search = (const TBISTR *)((const char *)search + search->Bytes); - } - - return search; -} - -const void *__TBITransStr(const char *str, int len) -{ - const TBISTR *search = NULL; - const void *res = NULL; - - for (;;) { - /* Search onwards */ - search = __TBIFindStr(search, str, len); - - /* No translation returns NULL */ - if (!search) - break; - - /* Skip matching entries with no translation data */ - if (search->TransLen != METAG_TBI_STRX) { - /* Calculate base of translation string */ - res = (const char *)search->String + - ((search->Len + 7) & ~7); - break; - } - - /* Next entry */ - search = (const TBISTR *)((const char *)search + search->Bytes); - } - - /* Return base address of translation data or NULL */ - return res; -} -EXPORT_SYMBOL(__TBITransStr); diff --git a/arch/metag/tbx/tbitimer.S b/arch/metag/tbx/tbitimer.S deleted file mode 100644 index 5dbeddeee7ba2..0000000000000 --- a/arch/metag/tbx/tbitimer.S +++ /dev/null @@ -1,207 +0,0 @@ -/* - * tbitimer.S - * - * Copyright (C) 2001, 2002, 2007, 2012 Imagination Technologies. - * - * 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. - * - * TBI timer support routines and data values - */ - - .file "tbitimer.S" -/* - * Get data structures and defines from the main C header - */ -#include - - .data - .balign 8 - .global ___TBITimeB - .type ___TBITimeB,object -___TBITimeB: - .quad 0 /* Background 'lost' ticks */ - .size ___TBITimeB,.-___TBITimeB - - .data - .balign 8 - .global ___TBITimeI - .type ___TBITimeI,object -___TBITimeI: - .quad 0 /* Interrupt 'lost' ticks */ - .size ___TBITimeI,.-___TBITimeI - - .data - .balign 8 - .global ___TBITimes - .type ___TBITimes,object -___TBITimes: - .long ___TBITimeB /* Table of 'lost' tick values */ - .long ___TBITimeI - .size ___TBITimes,.-___TBITimes - -/* - * Flag bits for control of ___TBITimeCore - */ -#define TIMER_SET_BIT 1 -#define TIMER_ADD_BIT 2 - -/* - * Initialise or stop timer support - * - * Register Usage: D1Ar1 holds Id, D1Ar2 is initial delay or 0 - * D0FrT is used to call ___TBITimeCore - * D0Re0 is used for the result which is TXSTAT_TIMER_BIT - * D0Ar4, D1Ar5, D0Ar6 are all used as scratch - * Other registers are those set by ___TBITimeCore - * A0.3 is assumed to point at ___TBITime(I/B) - */ - .text - .balign 4 - .global ___TBITimerCtrl - .type ___TBITimerCtrl,function -___TBITimerCtrl: - MOV D1Ar5,#TIMER_SET_BIT /* Timer SET request */ - MOVT D0FrT,#HI(___TBITimeCore) /* Get timer core reg values */ - CALL D0FrT,#LO(___TBITimeCore) /* and perform register update */ - NEGS D0Ar6,D0Ar2 /* Set flags from time-stamp */ - ASR D1Ar5,D0Ar6,#31 /* Sign extend D0Ar6 into D1Ar5 */ - SETLNZ [A0.3],D0Ar6,D1Ar5 /* ___TBITime(B/I)=-Start if enable */ - MOV PC,D1RtP /* Return */ - .size ___TBITimerCtrl,.-___TBITimerCtrl - -/* - * Return ___TBITimeStamp value - * - * Register Usage: D1Ar1 holds Id - * D0FrT is used to call ___TBITimeCore - * D0Re0, D1Re0 is used for the result - * D1Ar3, D0Ar4, D1Ar5 - * Other registers are those set by ___TBITimeCore - * D0Ar6 is assumed to be the timer value read - * A0.3 is assumed to point at ___TBITime(I/B) - */ - .text - .balign 4 - .global ___TBITimeStamp - .type ___TBITimeStamp,function -___TBITimeStamp: - MOV D1Ar5,#0 /* Timer GET request */ - MOVT D0FrT,#HI(___TBITimeCore) /* Get timer core reg values */ - CALL D0FrT,#LO(___TBITimeCore) /* with no register update */ - ADDS D0Re0,D0Ar4,D0Ar6 /* Add current time value */ - ADD D1Re0,D1Ar3,D1Ar5 /* to 64-bit signed extend time */ - ADDCS D1Re0,D1Re0,#1 /* Support borrow too */ - MOV PC,D1RtP /* Return */ - .size ___TBITimeStamp,.-___TBITimeStamp - -/* - * Perform ___TBITimerAdd logic - * - * Register Usage: D1Ar1 holds Id, D0Ar2 holds value to be added to the timer - * D0Re0 is used for the result - new TIMER value - * D1Ar5, D0Ar6 are used as scratch - * Other registers are those set by ___TBITimeCore - * D0Ar6 is assumed to be the timer value read - * D0Ar4, D1Ar3 is the current value of ___TBITime(B/I) - */ - .text - .balign 4 - .global ___TBITimerAdd - .type ___TBITimerAdd,function -___TBITimerAdd: - MOV D1Ar5,#TIMER_ADD_BIT /* Timer ADD request */ - MOVT D0FrT,#HI(___TBITimeCore) /* Get timer core reg values */ - CALL D0FrT,#LO(___TBITimeCore) /* with no register update */ - ADD D0Re0,D0Ar2,D0Ar6 /* Regenerate new value = result */ - NEG D0Ar2,D0Ar2 /* Negate delta */ - ASR D1Re0,D0Ar2,#31 /* Sign extend negated delta */ - ADDS D0Ar4,D0Ar4,D0Ar2 /* Add time added to ... */ - ADD D1Ar3,D1Ar3,D1Re0 /* ... real timer ... */ - ADDCS D1Ar3,D1Ar3,#1 /* ... with carry */ - SETL [A0.3],D0Ar4,D1Ar3 /* Update ___TBITime(B/I) */ - MOV PC,D1RtP /* Return */ - .size ___TBITimerAdd,.-___TBITimerAdd - -#ifdef TBI_1_4 -/* - * Perform ___TBITimerDeadline logic - * NB: Delays are positive compared to the Wait values which are -ive - * - * Register Usage: D1Ar1 holds Id - * D0Ar2 holds Delay requested - * D0Re0 is used for the result - old TIMER Delay value - * D1Ar5, D0Ar6 are used as scratch - * Other registers are those set by ___TBITimeCore - * D0Ar6 is assumed to be the timer value read - * D0Ar4, D1Ar3 is the current value of ___TBITime(B/I) - * - */ - .text - .type ___TBITimerDeadline,function - .global ___TBITimerDeadline - .align 2 -___TBITimerDeadline: - MOV D1Ar5,#TIMER_SET_BIT /* Timer SET request */ - MOVT D0FrT,#HI(___TBITimeCore) /* Get timer core reg values */ - CALL D0FrT,#LO(___TBITimeCore) /* with no register update */ - MOV D0Re0,D0Ar6 /* Old value read = result */ - SUB D0Ar2,D0Ar6,D0Ar2 /* Delta from (old - new) */ - ASR D1Re0,D0Ar2,#31 /* Sign extend delta */ - ADDS D0Ar4,D0Ar4,D0Ar2 /* Add time added to ... */ - ADD D1Ar3,D1Ar3,D1Re0 /* ... real timer ... */ - ADDCS D1Ar3,D1Ar3,#1 /* ... with carry */ - SETL [A0.3],D0Ar4,D1Ar3 /* Update ___TBITime(B/I) */ - MOV PC,D1RtP /* Return */ - .size ___TBITimerDeadline,.-___TBITimerDeadline -#endif /* TBI_1_4 */ - -/* - * Perform core timer access logic - * - * Register Usage: D1Ar1 holds Id, D0Ar2 holds input value for SET and - * input value for ADD - * D1Ar5 controls op as SET or ADD as bit values - * On return D0Ar6, D1Ar5 holds the old 64-bit timer value - * A0.3 is setup to point at ___TBITime(I/B) - * A1.3 is setup to point at ___TBITimes - * D0Ar4, D1Ar3 is setup to value of ___TBITime(I/B) - */ - .text - .balign 4 - .global ___TBITimeCore - .type ___TBITimeCore,function -___TBITimeCore: -#ifndef METAC_0_1 - TSTT D1Ar1,#HI(TBID_ISTAT_BIT) /* Interrupt level timer? */ -#endif - MOVT A1LbP,#HI(___TBITimes) - ADD A1LbP,A1LbP,#LO(___TBITimes) - MOV A1.3,A1LbP /* Get ___TBITimes address */ -#ifndef METAC_0_1 - BNZ $LTimeCoreI /* Yes: Service TXTIMERI! */ -#endif - LSRS D1Ar5,D1Ar5,#1 /* Carry = SET, Zero = !ADD */ - GETD A0.3,[A1.3+#0] /* A0.3 == &___TBITimeB */ - MOV D0Ar6,TXTIMER /* Always GET old value */ - MOVCS TXTIMER,D0Ar2 /* Conditional SET operation */ - ADDNZ TXTIMER,D0Ar2,D0Ar6 /* Conditional ADD operation */ -#ifndef METAC_0_1 - B $LTimeCoreEnd -$LTimeCoreI: - LSRS D1Ar5,D1Ar5,#1 /* Carry = SET, Zero = !ADD */ - GETD A0.3,[A1.3+#4] /* A0.3 == &___TBITimeI */ - MOV D0Ar6,TXTIMERI /* Always GET old value */ - MOVCS TXTIMERI,D0Ar2 /* Conditional SET operation */ - ADDNZ TXTIMERI,D0Ar2,D0Ar6 /* Conditional ADD operation */ -$LTimeCoreEnd: -#endif - ASR D1Ar5,D0Ar6,#31 /* Sign extend D0Ar6 into D1Ar5 */ - GETL D0Ar4,D1Ar3,[A0.3] /* Read ___TBITime(B/I) */ - MOV PC,D0FrT /* Return quickly */ - .size ___TBITimeCore,.-___TBITimeCore - -/* - * End of tbitimer.S - */ -- GitLab From 298910619d13e9c04680e923fef1e5bbc1790d10 Mon Sep 17 00:00:00 2001 From: James Hogan Date: Tue, 24 Oct 2017 13:14:50 +0100 Subject: [PATCH 02/74] docs: Remove metag docs Now that arch/metag/ has been removed, remove Meta architecture specific documentation from the Documentation/ directory. Signed-off-by: James Hogan Cc: Jonathan Corbet Cc: linux-metag@vger.kernel.org Cc: linux-doc@vger.kernel.org --- Documentation/00-INDEX | 2 - .../admin-guide/kernel-parameters.txt | 4 - .../devicetree/bindings/metag/meta.txt | 30 -- Documentation/metag/00-INDEX | 4 - Documentation/metag/kernel-ABI.txt | 256 ------------------ 5 files changed, 296 deletions(-) delete mode 100644 Documentation/devicetree/bindings/metag/meta.txt delete mode 100644 Documentation/metag/00-INDEX delete mode 100644 Documentation/metag/kernel-ABI.txt diff --git a/Documentation/00-INDEX b/Documentation/00-INDEX index 7f3a0728ccf27..eae1e7193f50e 100644 --- a/Documentation/00-INDEX +++ b/Documentation/00-INDEX @@ -276,8 +276,6 @@ memory-hotplug.txt - Hotpluggable memory support, how to use and current status. men-chameleon-bus.txt - info on MEN chameleon bus. -metag/ - - directory with info about Linux on Meta architecture. mic/ - Intel Many Integrated Core (MIC) architecture device driver. mips/ diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 1d1d53f85ddd7..30a8d06358985 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -1347,10 +1347,6 @@ If specified, z/VM IUCV HVC accepts connections from listed z/VM user IDs only. - hwthread_map= [METAG] Comma-separated list of Linux cpu id to - hardware thread id mappings. - Format: : - keep_bootcon [KNL] Do not unregister boot console at start. This is only useful for debugging when something happens in the window diff --git a/Documentation/devicetree/bindings/metag/meta.txt b/Documentation/devicetree/bindings/metag/meta.txt deleted file mode 100644 index f4457f57ab087..0000000000000 --- a/Documentation/devicetree/bindings/metag/meta.txt +++ /dev/null @@ -1,30 +0,0 @@ -* Meta Processor Binding - -This binding specifies what properties must be available in the device tree -representation of a Meta Processor Core, which is the root node in the tree. - -Required properties: - - - compatible: Specifies the compatibility list for the Meta processor. - The type shall be and the value shall include "img,meta". - -Optional properties: - - - clocks: Clock consumer specifiers as described in - Documentation/devicetree/bindings/clock/clock-bindings.txt - - - clock-names: Clock consumer names as described in - Documentation/devicetree/bindings/clock/clock-bindings.txt. - -Clocks are identified by name. Valid clocks are: - - - "core": The Meta core clock from which the Meta timers are derived. - -* Examples - -/ { - compatible = "toumaz,tz1090", "img,meta"; - - clocks = <&meta_core_clk>; - clock-names = "core"; -}; diff --git a/Documentation/metag/00-INDEX b/Documentation/metag/00-INDEX deleted file mode 100644 index db11c513bd5c6..0000000000000 --- a/Documentation/metag/00-INDEX +++ /dev/null @@ -1,4 +0,0 @@ -00-INDEX - - this file -kernel-ABI.txt - - Documents metag ABI details diff --git a/Documentation/metag/kernel-ABI.txt b/Documentation/metag/kernel-ABI.txt deleted file mode 100644 index 6282166031981..0000000000000 --- a/Documentation/metag/kernel-ABI.txt +++ /dev/null @@ -1,256 +0,0 @@ - ========================== - KERNEL ABIS FOR METAG ARCH - ========================== - -This document describes the Linux ABIs for the metag architecture, and has the -following sections: - - (*) Outline of registers - (*) Userland registers - (*) Kernel registers - (*) System call ABI - (*) Calling conventions - - -==================== -OUTLINE OF REGISTERS -==================== - -The main Meta core registers are arranged in units: - - UNIT Type DESCRIPTION GP EXT PRIV GLOBAL - ======= ======= =============== ======= ======= ======= ======= - CT Special Control unit - D0 General Data unit 0 0-7 8-15 16-31 16-31 - D1 General Data unit 1 0-7 8-15 16-31 16-31 - A0 General Address unit 0 0-3 4-7 8-15 8-15 - A1 General Address unit 1 0-3 4-7 8-15 8-15 - PC Special PC unit 0 1 - PORT Special Ports - TR Special Trigger unit 0-7 - TT Special Trace unit 0-5 - FX General FP unit 0-15 - -GP registers form part of the main context. - -Extended context registers (EXT) may not be present on all hardware threads and -can be context switched if support is enabled and the appropriate bits are set -in e.g. the D0.8 register to indicate what extended state to preserve. - -Global registers are shared between threads and are privilege protected. - -See arch/metag/include/asm/metag_regs.h for definitions relating to core -registers and the fields and bits they contain. See the TRMs for further details -about special registers. - -Several special registers are preserved in the main context, these are the -interesting ones: - - REG (ALIAS) PURPOSE - ======================= =============================================== - CT.1 (TXMODE) Processor mode bits (particularly for DSP) - CT.2 (TXSTATUS) Condition flags and LSM_STEP (MGET/MSET step) - CT.3 (TXRPT) Branch repeat counter - PC.0 (PC) Program counter - -Some of the general registers have special purposes in the ABI and therefore -have aliases: - - D0 REG (ALIAS) PURPOSE D1 REG (ALIAS) PURPOSE - =============== =============== =============== ======================= - D0.0 (D0Re0) 32bit result D1.0 (D1Re0) Top half of 64bit result - D0.1 (D0Ar6) Argument 6 D1.1 (D1Ar5) Argument 5 - D0.2 (D0Ar4) Argument 4 D1.2 (D1Ar3) Argument 3 - D0.3 (D0Ar2) Argument 2 D1.3 (D1Ar1) Argument 1 - D0.4 (D0FrT) Frame temp D1.4 (D1RtP) Return pointer - D0.5 Call preserved D1.5 Call preserved - D0.6 Call preserved D1.6 Call preserved - D0.7 Call preserved D1.7 Call preserved - - A0 REG (ALIAS) PURPOSE A1 REG (ALIAS) PURPOSE - =============== =============== =============== ======================= - A0.0 (A0StP) Stack pointer A1.0 (A1GbP) Global base pointer - A0.1 (A0FrP) Frame pointer A1.1 (A1LbP) Local base pointer - A0.2 A1.2 - A0.3 A1.3 - - -================== -USERLAND REGISTERS -================== - -All the general purpose D0, D1, A0, A1 registers are preserved when entering the -kernel (including asynchronous events such as interrupts and timer ticks) except -the following which have special purposes in the ABI: - - REGISTERS WHEN STATUS PURPOSE - =============== ======= =============== =============================== - D0.8 DSP Preserved ECH, determines what extended - DSP state to preserve. - A0.0 (A0StP) ALWAYS Preserved Stack >= A0StP may be clobbered - at any time by the creation of a - signal frame. - A1.0 (A1GbP) SMP Clobbered Used as temporary for loading - kernel stack pointer and saving - core context. - A0.15 !SMP Protected Stores kernel stack pointer. - A1.15 ALWAYS Protected Stores kernel base pointer. - -On UP A0.15 is used to store the kernel stack pointer for storing the userland -context. A0.15 is global between hardware threads though which means it cannot -be used on SMP for this purpose. Since no protected local registers are -available A1GbP is reserved for use as a temporary to allow a percpu stack -pointer to be loaded for storing the rest of the context. - - -================ -KERNEL REGISTERS -================ - -When in the kernel the following registers have special purposes in the ABI: - - REGISTERS WHEN STATUS PURPOSE - =============== ======= =============== =============================== - A0.0 (A0StP) ALWAYS Preserved Stack >= A0StP may be clobbered - at any time by the creation of - an irq signal frame. - A1.0 (A1GbP) ALWAYS Preserved Reserved (kernel base pointer). - - -=============== -SYSTEM CALL ABI -=============== - -When a system call is made, the following registers are effective: - - REGISTERS CALL RETURN - =============== ======================= =============================== - D0.0 (D0Re0) Return value (or -errno) - D1.0 (D1Re0) System call number Clobbered - D0.1 (D0Ar6) Syscall arg #6 Preserved - D1.1 (D1Ar5) Syscall arg #5 Preserved - D0.2 (D0Ar4) Syscall arg #4 Preserved - D1.2 (D1Ar3) Syscall arg #3 Preserved - D0.3 (D0Ar2) Syscall arg #2 Preserved - D1.3 (D1Ar1) Syscall arg #1 Preserved - -Due to the limited number of argument registers and some system calls with badly -aligned 64-bit arguments, 64-bit values are always packed in consecutive -arguments, even if this is contrary to the normal calling conventions (where the -two halves would go in a matching pair of data registers). - -For example fadvise64_64 usually has the signature: - - long sys_fadvise64_64(i32 fd, i64 offs, i64 len, i32 advice); - -But for metag fadvise64_64 is wrapped so that the 64-bit arguments are packed: - - long sys_fadvise64_64_metag(i32 fd, i32 offs_lo, - i32 offs_hi, i32 len_lo, - i32 len_hi, i32 advice) - -So the arguments are packed in the registers like this: - - D0 REG (ALIAS) VALUE D1 REG (ALIAS) VALUE - =============== =============== =============== ======================= - D0.1 (D0Ar6) advice D1.1 (D1Ar5) hi(len) - D0.2 (D0Ar4) lo(len) D1.2 (D1Ar3) hi(offs) - D0.3 (D0Ar2) lo(offs) D1.3 (D1Ar1) fd - - -=================== -CALLING CONVENTIONS -=================== - -These calling conventions apply to both user and kernel code. The stack grows -from low addresses to high addresses in the metag ABI. The stack pointer (A0StP) -should always point to the next free address on the stack and should at all -times be 64-bit aligned. The following registers are effective at the point of a -call: - - REGISTERS CALL RETURN - =============== ======================= =============================== - D0.0 (D0Re0) 32bit return value - D1.0 (D1Re0) Upper half of 64bit return value - D0.1 (D0Ar6) 32bit argument #6 Clobbered - D1.1 (D1Ar5) 32bit argument #5 Clobbered - D0.2 (D0Ar4) 32bit argument #4 Clobbered - D1.2 (D1Ar3) 32bit argument #3 Clobbered - D0.3 (D0Ar2) 32bit argument #2 Clobbered - D1.3 (D1Ar1) 32bit argument #1 Clobbered - D0.4 (D0FrT) Clobbered - D1.4 (D1RtP) Return pointer Clobbered - D{0-1}.{5-7} Preserved - A0.0 (A0StP) Stack pointer Preserved - A1.0 (A0GbP) Preserved - A0.1 (A0FrP) Frame pointer Preserved - A1.1 (A0LbP) Preserved - A{0-1},{2-3} Clobbered - -64-bit arguments are placed in matching pairs of registers (i.e. the same -register number in both D0 and D1 units), with the least significant half in D0 -and the most significant half in D1, leaving a gap where necessary. Further -arguments are stored on the stack in reverse order (earlier arguments at higher -addresses): - - ADDRESS 0 1 2 3 4 5 6 7 - =============== ===== ===== ===== ===== ===== ===== ===== ===== - A0StP --> - A0StP-0x08 32bit argument #8 32bit argument #7 - A0StP-0x10 32bit argument #10 32bit argument #9 - -Function prologues tend to look a bit like this: - - /* If frame pointer in use, move it to frame temp register so it can be - easily pushed onto stack */ - MOV D0FrT,A0FrP - - /* If frame pointer in use, set it to stack pointer */ - ADD A0FrP,A0StP,#0 - - /* Preserve D0FrT, D1RtP, D{0-1}.{5-7} on stack, incrementing A0StP */ - MSETL [A0StP++],D0FrT,D0.5,D0.6,D0.7 - - /* Allocate some stack space for local variables */ - ADD A0StP,A0StP,#0x10 - -At this point the stack would look like this: - - ADDRESS 0 1 2 3 4 5 6 7 - =============== ===== ===== ===== ===== ===== ===== ===== ===== - A0StP --> - A0StP-0x08 - A0StP-0x10 - A0StP-0x18 Old D0.7 Old D1.7 - A0StP-0x20 Old D0.6 Old D1.6 - A0StP-0x28 Old D0.5 Old D1.5 - A0FrP --> Old A0FrP (frame ptr) Old D1RtP (return ptr) - A0FrP-0x08 32bit argument #8 32bit argument #7 - A0FrP-0x10 32bit argument #10 32bit argument #9 - -Function epilogues tend to differ depending on the use of a frame pointer. An -example of a frame pointer epilogue: - - /* Restore D0FrT, D1RtP, D{0-1}.{5-7} from stack, incrementing A0FrP */ - MGETL D0FrT,D0.5,D0.6,D0.7,[A0FrP++] - /* Restore stack pointer to where frame pointer was before increment */ - SUB A0StP,A0FrP,#0x20 - /* Restore frame pointer from frame temp */ - MOV A0FrP,D0FrT - /* Return to caller via restored return pointer */ - MOV PC,D1RtP - -If the function hasn't touched the frame pointer, MGETL cannot be safely used -with A0StP as it always increments and that would expose the stack to clobbering -by interrupts (kernel) or signals (user). Therefore it's common to see the MGETL -split into separate GETL instructions: - - /* Restore D0FrT, D1RtP, D{0-1}.{5-7} from stack */ - GETL D0FrT,D1RtP,[A0StP+#-0x30] - GETL D0.5,D1.5,[A0StP+#-0x28] - GETL D0.6,D1.6,[A0StP+#-0x20] - GETL D0.7,D1.7,[A0StP+#-0x18] - /* Restore stack pointer */ - SUB A0StP,A0StP,#0x30 - /* Return to caller via restored return pointer */ - MOV PC,D1RtP -- GitLab From 6a7676852ec9ed1ea80e262076c7a915923108c3 Mon Sep 17 00:00:00 2001 From: James Hogan Date: Tue, 24 Oct 2017 16:35:09 +0100 Subject: [PATCH 03/74] docs: Remove remaining references to metag Remove any remaining references to the Meta architecture in Documentation/, primarily from Documentation/features/. Signed-off-by: James Hogan Cc: Jonathan Corbet Cc: linux-metag@vger.kernel.org Cc: linux-doc@vger.kernel.org --- Documentation/dev-tools/kmemleak.rst | 2 +- Documentation/features/core/BPF-JIT/arch-support.txt | 1 - .../features/core/generic-idle-thread/arch-support.txt | 1 - Documentation/features/core/jump-labels/arch-support.txt | 1 - Documentation/features/core/tracehook/arch-support.txt | 1 - Documentation/features/debug/KASAN/arch-support.txt | 1 - Documentation/features/debug/gcov-profile-all/arch-support.txt | 1 - Documentation/features/debug/kgdb/arch-support.txt | 1 - Documentation/features/debug/kprobes-on-ftrace/arch-support.txt | 1 - Documentation/features/debug/kprobes/arch-support.txt | 1 - Documentation/features/debug/kretprobes/arch-support.txt | 1 - Documentation/features/debug/optprobes/arch-support.txt | 1 - Documentation/features/debug/stackprotector/arch-support.txt | 1 - Documentation/features/debug/uprobes/arch-support.txt | 1 - Documentation/features/debug/user-ret-profiler/arch-support.txt | 1 - Documentation/features/io/dma-api-debug/arch-support.txt | 1 - Documentation/features/io/dma-contiguous/arch-support.txt | 1 - Documentation/features/io/sg-chain/arch-support.txt | 1 - Documentation/features/lib/strncasecmp/arch-support.txt | 1 - Documentation/features/locking/cmpxchg-local/arch-support.txt | 1 - Documentation/features/locking/lockdep/arch-support.txt | 1 - Documentation/features/locking/queued-rwlocks/arch-support.txt | 1 - .../features/locking/queued-spinlocks/arch-support.txt | 1 - Documentation/features/locking/rwsem-optimized/arch-support.txt | 1 - Documentation/features/perf/kprobes-event/arch-support.txt | 1 - Documentation/features/perf/perf-regs/arch-support.txt | 1 - Documentation/features/perf/perf-stackdump/arch-support.txt | 1 - .../features/sched/membarrier-sync-core/arch-support.txt | 1 - Documentation/features/sched/numa-balancing/arch-support.txt | 1 - Documentation/features/seccomp/seccomp-filter/arch-support.txt | 1 - .../features/time/arch-tick-broadcast/arch-support.txt | 1 - Documentation/features/time/clockevents/arch-support.txt | 1 - Documentation/features/time/context-tracking/arch-support.txt | 1 - Documentation/features/time/irq-time-acct/arch-support.txt | 1 - Documentation/features/time/modern-timekeeping/arch-support.txt | 1 - Documentation/features/time/virt-cpuacct/arch-support.txt | 1 - Documentation/features/vm/ELF-ASLR/arch-support.txt | 1 - Documentation/features/vm/PG_uncached/arch-support.txt | 1 - Documentation/features/vm/THP/arch-support.txt | 1 - Documentation/features/vm/TLB/arch-support.txt | 1 - Documentation/features/vm/huge-vmap/arch-support.txt | 1 - Documentation/features/vm/ioremap_prot/arch-support.txt | 1 - Documentation/features/vm/numa-memblock/arch-support.txt | 1 - Documentation/features/vm/pte_special/arch-support.txt | 1 - 44 files changed, 1 insertion(+), 44 deletions(-) diff --git a/Documentation/dev-tools/kmemleak.rst b/Documentation/dev-tools/kmemleak.rst index cb88626591786..e6f51260ff328 100644 --- a/Documentation/dev-tools/kmemleak.rst +++ b/Documentation/dev-tools/kmemleak.rst @@ -8,7 +8,7 @@ with the difference that the orphan objects are not freed but only reported via /sys/kernel/debug/kmemleak. A similar method is used by the Valgrind tool (``memcheck --leak-check``) to detect the memory leaks in user-space applications. -Kmemleak is supported on x86, arm, powerpc, sparc, sh, microblaze, ppc, mips, s390, metag and tile. +Kmemleak is supported on x86, arm, powerpc, sparc, sh, microblaze, ppc, mips, s390 and tile. Usage ----- diff --git a/Documentation/features/core/BPF-JIT/arch-support.txt b/Documentation/features/core/BPF-JIT/arch-support.txt index 5575d2d09625a..b0634ec01881a 100644 --- a/Documentation/features/core/BPF-JIT/arch-support.txt +++ b/Documentation/features/core/BPF-JIT/arch-support.txt @@ -19,7 +19,6 @@ | ia64: | TODO | | m32r: | TODO | | m68k: | TODO | - | metag: | TODO | | microblaze: | TODO | | mips: | ok | | mn10300: | TODO | diff --git a/Documentation/features/core/generic-idle-thread/arch-support.txt b/Documentation/features/core/generic-idle-thread/arch-support.txt index abb5f271a792e..e2a1a385efd38 100644 --- a/Documentation/features/core/generic-idle-thread/arch-support.txt +++ b/Documentation/features/core/generic-idle-thread/arch-support.txt @@ -19,7 +19,6 @@ | ia64: | ok | | m32r: | TODO | | m68k: | TODO | - | metag: | ok | | microblaze: | TODO | | mips: | ok | | mn10300: | TODO | diff --git a/Documentation/features/core/jump-labels/arch-support.txt b/Documentation/features/core/jump-labels/arch-support.txt index dbdaffcc51107..dafcea38fe5e9 100644 --- a/Documentation/features/core/jump-labels/arch-support.txt +++ b/Documentation/features/core/jump-labels/arch-support.txt @@ -19,7 +19,6 @@ | ia64: | TODO | | m32r: | TODO | | m68k: | TODO | - | metag: | TODO | | microblaze: | TODO | | mips: | ok | | mn10300: | TODO | diff --git a/Documentation/features/core/tracehook/arch-support.txt b/Documentation/features/core/tracehook/arch-support.txt index dfb638c2f8421..3d7886fcb6a9c 100644 --- a/Documentation/features/core/tracehook/arch-support.txt +++ b/Documentation/features/core/tracehook/arch-support.txt @@ -19,7 +19,6 @@ | ia64: | ok | | m32r: | TODO | | m68k: | TODO | - | metag: | ok | | microblaze: | TODO | | mips: | ok | | mn10300: | ok | diff --git a/Documentation/features/debug/KASAN/arch-support.txt b/Documentation/features/debug/KASAN/arch-support.txt index 3406fae833c3c..63598b0e8ea63 100644 --- a/Documentation/features/debug/KASAN/arch-support.txt +++ b/Documentation/features/debug/KASAN/arch-support.txt @@ -19,7 +19,6 @@ | ia64: | TODO | | m32r: | TODO | | m68k: | TODO | - | metag: | TODO | | microblaze: | TODO | | mips: | TODO | | mn10300: | TODO | diff --git a/Documentation/features/debug/gcov-profile-all/arch-support.txt b/Documentation/features/debug/gcov-profile-all/arch-support.txt index 830dbe801aafb..13b3b3dfe7f24 100644 --- a/Documentation/features/debug/gcov-profile-all/arch-support.txt +++ b/Documentation/features/debug/gcov-profile-all/arch-support.txt @@ -19,7 +19,6 @@ | ia64: | TODO | | m32r: | TODO | | m68k: | TODO | - | metag: | TODO | | microblaze: | ok | | mips: | TODO | | mn10300: | TODO | diff --git a/Documentation/features/debug/kgdb/arch-support.txt b/Documentation/features/debug/kgdb/arch-support.txt index 0217bf6e942d2..cb4792cf0f98c 100644 --- a/Documentation/features/debug/kgdb/arch-support.txt +++ b/Documentation/features/debug/kgdb/arch-support.txt @@ -19,7 +19,6 @@ | ia64: | TODO | | m32r: | TODO | | m68k: | TODO | - | metag: | TODO | | microblaze: | ok | | mips: | ok | | mn10300: | ok | diff --git a/Documentation/features/debug/kprobes-on-ftrace/arch-support.txt b/Documentation/features/debug/kprobes-on-ftrace/arch-support.txt index 1e84be3c142e0..2046539489fe1 100644 --- a/Documentation/features/debug/kprobes-on-ftrace/arch-support.txt +++ b/Documentation/features/debug/kprobes-on-ftrace/arch-support.txt @@ -19,7 +19,6 @@ | ia64: | TODO | | m32r: | TODO | | m68k: | TODO | - | metag: | TODO | | microblaze: | TODO | | mips: | TODO | | mn10300: | TODO | diff --git a/Documentation/features/debug/kprobes/arch-support.txt b/Documentation/features/debug/kprobes/arch-support.txt index 529f66eda679a..bfb3546a70d0f 100644 --- a/Documentation/features/debug/kprobes/arch-support.txt +++ b/Documentation/features/debug/kprobes/arch-support.txt @@ -19,7 +19,6 @@ | ia64: | ok | | m32r: | TODO | | m68k: | TODO | - | metag: | TODO | | microblaze: | TODO | | mips: | ok | | mn10300: | TODO | diff --git a/Documentation/features/debug/kretprobes/arch-support.txt b/Documentation/features/debug/kretprobes/arch-support.txt index 43353242e4396..cb2213bfadc5e 100644 --- a/Documentation/features/debug/kretprobes/arch-support.txt +++ b/Documentation/features/debug/kretprobes/arch-support.txt @@ -19,7 +19,6 @@ | ia64: | ok | | m32r: | TODO | | m68k: | TODO | - | metag: | TODO | | microblaze: | TODO | | mips: | ok | | mn10300: | TODO | diff --git a/Documentation/features/debug/optprobes/arch-support.txt b/Documentation/features/debug/optprobes/arch-support.txt index f559f1ba5416d..219aa64ca3f5c 100644 --- a/Documentation/features/debug/optprobes/arch-support.txt +++ b/Documentation/features/debug/optprobes/arch-support.txt @@ -19,7 +19,6 @@ | ia64: | TODO | | m32r: | TODO | | m68k: | TODO | - | metag: | TODO | | microblaze: | TODO | | mips: | TODO | | mn10300: | TODO | diff --git a/Documentation/features/debug/stackprotector/arch-support.txt b/Documentation/features/debug/stackprotector/arch-support.txt index 59a4c9ffb7f3c..904864c3f18c8 100644 --- a/Documentation/features/debug/stackprotector/arch-support.txt +++ b/Documentation/features/debug/stackprotector/arch-support.txt @@ -19,7 +19,6 @@ | ia64: | TODO | | m32r: | TODO | | m68k: | TODO | - | metag: | TODO | | microblaze: | TODO | | mips: | ok | | mn10300: | TODO | diff --git a/Documentation/features/debug/uprobes/arch-support.txt b/Documentation/features/debug/uprobes/arch-support.txt index 53ed42b0e7e59..d092f000e6bba 100644 --- a/Documentation/features/debug/uprobes/arch-support.txt +++ b/Documentation/features/debug/uprobes/arch-support.txt @@ -19,7 +19,6 @@ | ia64: | TODO | | m32r: | TODO | | m68k: | TODO | - | metag: | TODO | | microblaze: | TODO | | mips: | ok | | mn10300: | TODO | diff --git a/Documentation/features/debug/user-ret-profiler/arch-support.txt b/Documentation/features/debug/user-ret-profiler/arch-support.txt index 149443936de9f..9e9e195b6d301 100644 --- a/Documentation/features/debug/user-ret-profiler/arch-support.txt +++ b/Documentation/features/debug/user-ret-profiler/arch-support.txt @@ -19,7 +19,6 @@ | ia64: | TODO | | m32r: | TODO | | m68k: | TODO | - | metag: | TODO | | microblaze: | TODO | | mips: | TODO | | mn10300: | TODO | diff --git a/Documentation/features/io/dma-api-debug/arch-support.txt b/Documentation/features/io/dma-api-debug/arch-support.txt index 6be920643be66..ba9e169859c47 100644 --- a/Documentation/features/io/dma-api-debug/arch-support.txt +++ b/Documentation/features/io/dma-api-debug/arch-support.txt @@ -19,7 +19,6 @@ | ia64: | ok | | m32r: | TODO | | m68k: | TODO | - | metag: | TODO | | microblaze: | ok | | mips: | ok | | mn10300: | TODO | diff --git a/Documentation/features/io/dma-contiguous/arch-support.txt b/Documentation/features/io/dma-contiguous/arch-support.txt index 0eb08e1e32b80..35b501f2c117e 100644 --- a/Documentation/features/io/dma-contiguous/arch-support.txt +++ b/Documentation/features/io/dma-contiguous/arch-support.txt @@ -19,7 +19,6 @@ | ia64: | TODO | | m32r: | TODO | | m68k: | TODO | - | metag: | TODO | | microblaze: | TODO | | mips: | ok | | mn10300: | TODO | diff --git a/Documentation/features/io/sg-chain/arch-support.txt b/Documentation/features/io/sg-chain/arch-support.txt index 514ad3468aa59..42c078dff18b7 100644 --- a/Documentation/features/io/sg-chain/arch-support.txt +++ b/Documentation/features/io/sg-chain/arch-support.txt @@ -19,7 +19,6 @@ | ia64: | ok | | m32r: | TODO | | m68k: | TODO | - | metag: | TODO | | microblaze: | TODO | | mips: | TODO | | mn10300: | TODO | diff --git a/Documentation/features/lib/strncasecmp/arch-support.txt b/Documentation/features/lib/strncasecmp/arch-support.txt index 532c6f0fc15c0..b10c21f14739d 100644 --- a/Documentation/features/lib/strncasecmp/arch-support.txt +++ b/Documentation/features/lib/strncasecmp/arch-support.txt @@ -19,7 +19,6 @@ | ia64: | TODO | | m32r: | TODO | | m68k: | TODO | - | metag: | TODO | | microblaze: | TODO | | mips: | TODO | | mn10300: | TODO | diff --git a/Documentation/features/locking/cmpxchg-local/arch-support.txt b/Documentation/features/locking/cmpxchg-local/arch-support.txt index f3eec26c8cf80..3b87fd37bae85 100644 --- a/Documentation/features/locking/cmpxchg-local/arch-support.txt +++ b/Documentation/features/locking/cmpxchg-local/arch-support.txt @@ -19,7 +19,6 @@ | ia64: | TODO | | m32r: | TODO | | m68k: | TODO | - | metag: | TODO | | microblaze: | TODO | | mips: | TODO | | mn10300: | TODO | diff --git a/Documentation/features/locking/lockdep/arch-support.txt b/Documentation/features/locking/lockdep/arch-support.txt index 9756abc680a7e..cefcd720f04ed 100644 --- a/Documentation/features/locking/lockdep/arch-support.txt +++ b/Documentation/features/locking/lockdep/arch-support.txt @@ -19,7 +19,6 @@ | ia64: | TODO | | m32r: | TODO | | m68k: | TODO | - | metag: | ok | | microblaze: | ok | | mips: | ok | | mn10300: | TODO | diff --git a/Documentation/features/locking/queued-rwlocks/arch-support.txt b/Documentation/features/locking/queued-rwlocks/arch-support.txt index 62f4ee5c156c4..da6c7e37141c4 100644 --- a/Documentation/features/locking/queued-rwlocks/arch-support.txt +++ b/Documentation/features/locking/queued-rwlocks/arch-support.txt @@ -19,7 +19,6 @@ | ia64: | TODO | | m32r: | TODO | | m68k: | TODO | - | metag: | TODO | | microblaze: | TODO | | mips: | TODO | | mn10300: | TODO | diff --git a/Documentation/features/locking/queued-spinlocks/arch-support.txt b/Documentation/features/locking/queued-spinlocks/arch-support.txt index 321b32f6e63c5..1e5dbcdd1c762 100644 --- a/Documentation/features/locking/queued-spinlocks/arch-support.txt +++ b/Documentation/features/locking/queued-spinlocks/arch-support.txt @@ -19,7 +19,6 @@ | ia64: | TODO | | m32r: | TODO | | m68k: | TODO | - | metag: | TODO | | microblaze: | TODO | | mips: | TODO | | mn10300: | TODO | diff --git a/Documentation/features/locking/rwsem-optimized/arch-support.txt b/Documentation/features/locking/rwsem-optimized/arch-support.txt index 79bfa4d6e41ff..b79e92288112a 100644 --- a/Documentation/features/locking/rwsem-optimized/arch-support.txt +++ b/Documentation/features/locking/rwsem-optimized/arch-support.txt @@ -19,7 +19,6 @@ | ia64: | ok | | m32r: | TODO | | m68k: | TODO | - | metag: | TODO | | microblaze: | TODO | | mips: | TODO | | mn10300: | TODO | diff --git a/Documentation/features/perf/kprobes-event/arch-support.txt b/Documentation/features/perf/kprobes-event/arch-support.txt index 00f1606bbf457..6418ccc6fc345 100644 --- a/Documentation/features/perf/kprobes-event/arch-support.txt +++ b/Documentation/features/perf/kprobes-event/arch-support.txt @@ -19,7 +19,6 @@ | ia64: | TODO | | m32r: | TODO | | m68k: | TODO | - | metag: | TODO | | microblaze: | TODO | | mips: | ok | | mn10300: | TODO | diff --git a/Documentation/features/perf/perf-regs/arch-support.txt b/Documentation/features/perf/perf-regs/arch-support.txt index 7d516eacf7b92..3b3392ac6466d 100644 --- a/Documentation/features/perf/perf-regs/arch-support.txt +++ b/Documentation/features/perf/perf-regs/arch-support.txt @@ -19,7 +19,6 @@ | ia64: | TODO | | m32r: | TODO | | m68k: | TODO | - | metag: | TODO | | microblaze: | TODO | | mips: | TODO | | mn10300: | TODO | diff --git a/Documentation/features/perf/perf-stackdump/arch-support.txt b/Documentation/features/perf/perf-stackdump/arch-support.txt index f974b8df5d825..4594cb28fbc8b 100644 --- a/Documentation/features/perf/perf-stackdump/arch-support.txt +++ b/Documentation/features/perf/perf-stackdump/arch-support.txt @@ -19,7 +19,6 @@ | ia64: | TODO | | m32r: | TODO | | m68k: | TODO | - | metag: | TODO | | microblaze: | TODO | | mips: | TODO | | mn10300: | TODO | diff --git a/Documentation/features/sched/membarrier-sync-core/arch-support.txt b/Documentation/features/sched/membarrier-sync-core/arch-support.txt index 2c815a7f1ba70..42eaab4d439d5 100644 --- a/Documentation/features/sched/membarrier-sync-core/arch-support.txt +++ b/Documentation/features/sched/membarrier-sync-core/arch-support.txt @@ -42,7 +42,6 @@ | ia64: | TODO | | m32r: | TODO | | m68k: | TODO | - | metag: | TODO | | microblaze: | TODO | | mips: | TODO | | mn10300: | TODO | diff --git a/Documentation/features/sched/numa-balancing/arch-support.txt b/Documentation/features/sched/numa-balancing/arch-support.txt index 1d3c0f6691525..4e67833aae661 100644 --- a/Documentation/features/sched/numa-balancing/arch-support.txt +++ b/Documentation/features/sched/numa-balancing/arch-support.txt @@ -19,7 +19,6 @@ | ia64: | TODO | | m32r: | .. | | m68k: | .. | - | metag: | .. | | microblaze: | .. | | mips: | TODO | | mn10300: | .. | diff --git a/Documentation/features/seccomp/seccomp-filter/arch-support.txt b/Documentation/features/seccomp/seccomp-filter/arch-support.txt index a32d5b2076791..c5d8b397a6938 100644 --- a/Documentation/features/seccomp/seccomp-filter/arch-support.txt +++ b/Documentation/features/seccomp/seccomp-filter/arch-support.txt @@ -19,7 +19,6 @@ | ia64: | TODO | | m32r: | TODO | | m68k: | TODO | - | metag: | TODO | | microblaze: | TODO | | mips: | ok | | mn10300: | TODO | diff --git a/Documentation/features/time/arch-tick-broadcast/arch-support.txt b/Documentation/features/time/arch-tick-broadcast/arch-support.txt index caee8f64d1bca..9e4999136881d 100644 --- a/Documentation/features/time/arch-tick-broadcast/arch-support.txt +++ b/Documentation/features/time/arch-tick-broadcast/arch-support.txt @@ -19,7 +19,6 @@ | ia64: | TODO | | m32r: | TODO | | m68k: | TODO | - | metag: | TODO | | microblaze: | TODO | | mips: | ok | | mn10300: | TODO | diff --git a/Documentation/features/time/clockevents/arch-support.txt b/Documentation/features/time/clockevents/arch-support.txt index 1cd87f6cd07da..f90cb64c640b5 100644 --- a/Documentation/features/time/clockevents/arch-support.txt +++ b/Documentation/features/time/clockevents/arch-support.txt @@ -19,7 +19,6 @@ | ia64: | TODO | | m32r: | TODO | | m68k: | ok | - | metag: | ok | | microblaze: | ok | | mips: | ok | | mn10300: | ok | diff --git a/Documentation/features/time/context-tracking/arch-support.txt b/Documentation/features/time/context-tracking/arch-support.txt index e6d7c7b2253c8..eb4e5d32a2e90 100644 --- a/Documentation/features/time/context-tracking/arch-support.txt +++ b/Documentation/features/time/context-tracking/arch-support.txt @@ -19,7 +19,6 @@ | ia64: | TODO | | m32r: | TODO | | m68k: | TODO | - | metag: | TODO | | microblaze: | TODO | | mips: | ok | | mn10300: | TODO | diff --git a/Documentation/features/time/irq-time-acct/arch-support.txt b/Documentation/features/time/irq-time-acct/arch-support.txt index 15c6071788aec..02b7441f360fb 100644 --- a/Documentation/features/time/irq-time-acct/arch-support.txt +++ b/Documentation/features/time/irq-time-acct/arch-support.txt @@ -19,7 +19,6 @@ | ia64: | .. | | m32r: | TODO | | m68k: | TODO | - | metag: | TODO | | microblaze: | TODO | | mips: | ok | | mn10300: | TODO | diff --git a/Documentation/features/time/modern-timekeeping/arch-support.txt b/Documentation/features/time/modern-timekeeping/arch-support.txt index baee7611ba3d6..b3eb6fe6bc27a 100644 --- a/Documentation/features/time/modern-timekeeping/arch-support.txt +++ b/Documentation/features/time/modern-timekeeping/arch-support.txt @@ -19,7 +19,6 @@ | ia64: | ok | | m32r: | TODO | | m68k: | TODO | - | metag: | ok | | microblaze: | ok | | mips: | ok | | mn10300: | ok | diff --git a/Documentation/features/time/virt-cpuacct/arch-support.txt b/Documentation/features/time/virt-cpuacct/arch-support.txt index 9129530cb73c7..a1bd77fd723a2 100644 --- a/Documentation/features/time/virt-cpuacct/arch-support.txt +++ b/Documentation/features/time/virt-cpuacct/arch-support.txt @@ -19,7 +19,6 @@ | ia64: | ok | | m32r: | TODO | | m68k: | TODO | - | metag: | TODO | | microblaze: | TODO | | mips: | ok | | mn10300: | TODO | diff --git a/Documentation/features/vm/ELF-ASLR/arch-support.txt b/Documentation/features/vm/ELF-ASLR/arch-support.txt index f6829af3255f3..3f926177833c3 100644 --- a/Documentation/features/vm/ELF-ASLR/arch-support.txt +++ b/Documentation/features/vm/ELF-ASLR/arch-support.txt @@ -19,7 +19,6 @@ | ia64: | TODO | | m32r: | TODO | | m68k: | TODO | - | metag: | TODO | | microblaze: | TODO | | mips: | ok | | mn10300: | TODO | diff --git a/Documentation/features/vm/PG_uncached/arch-support.txt b/Documentation/features/vm/PG_uncached/arch-support.txt index 1a09ea99d486c..4c8f65d525d77 100644 --- a/Documentation/features/vm/PG_uncached/arch-support.txt +++ b/Documentation/features/vm/PG_uncached/arch-support.txt @@ -19,7 +19,6 @@ | ia64: | ok | | m32r: | TODO | | m68k: | TODO | - | metag: | TODO | | microblaze: | TODO | | mips: | TODO | | mn10300: | TODO | diff --git a/Documentation/features/vm/THP/arch-support.txt b/Documentation/features/vm/THP/arch-support.txt index d170e6236503a..d121dc2e3e5e3 100644 --- a/Documentation/features/vm/THP/arch-support.txt +++ b/Documentation/features/vm/THP/arch-support.txt @@ -19,7 +19,6 @@ | ia64: | TODO | | m32r: | .. | | m68k: | .. | - | metag: | TODO | | microblaze: | .. | | mips: | ok | | mn10300: | .. | diff --git a/Documentation/features/vm/TLB/arch-support.txt b/Documentation/features/vm/TLB/arch-support.txt index abfab4080a913..af233d2d82cf6 100644 --- a/Documentation/features/vm/TLB/arch-support.txt +++ b/Documentation/features/vm/TLB/arch-support.txt @@ -19,7 +19,6 @@ | ia64: | TODO | | m32r: | TODO | | m68k: | .. | - | metag: | TODO | | microblaze: | .. | | mips: | TODO | | mn10300: | TODO | diff --git a/Documentation/features/vm/huge-vmap/arch-support.txt b/Documentation/features/vm/huge-vmap/arch-support.txt index f81f09b22b08c..45c74fbe68050 100644 --- a/Documentation/features/vm/huge-vmap/arch-support.txt +++ b/Documentation/features/vm/huge-vmap/arch-support.txt @@ -19,7 +19,6 @@ | ia64: | TODO | | m32r: | TODO | | m68k: | TODO | - | metag: | TODO | | microblaze: | TODO | | mips: | TODO | | mn10300: | TODO | diff --git a/Documentation/features/vm/ioremap_prot/arch-support.txt b/Documentation/features/vm/ioremap_prot/arch-support.txt index 0cc3e11c42e2e..6cd436af0cc8f 100644 --- a/Documentation/features/vm/ioremap_prot/arch-support.txt +++ b/Documentation/features/vm/ioremap_prot/arch-support.txt @@ -19,7 +19,6 @@ | ia64: | TODO | | m32r: | TODO | | m68k: | TODO | - | metag: | TODO | | microblaze: | TODO | | mips: | TODO | | mn10300: | TODO | diff --git a/Documentation/features/vm/numa-memblock/arch-support.txt b/Documentation/features/vm/numa-memblock/arch-support.txt index 9a3fdac42ce12..2db895856da67 100644 --- a/Documentation/features/vm/numa-memblock/arch-support.txt +++ b/Documentation/features/vm/numa-memblock/arch-support.txt @@ -19,7 +19,6 @@ | ia64: | ok | | m32r: | TODO | | m68k: | .. | - | metag: | ok | | microblaze: | ok | | mips: | ok | | mn10300: | TODO | diff --git a/Documentation/features/vm/pte_special/arch-support.txt b/Documentation/features/vm/pte_special/arch-support.txt index dfaa39e664fff..ccb15b6da42fd 100644 --- a/Documentation/features/vm/pte_special/arch-support.txt +++ b/Documentation/features/vm/pte_special/arch-support.txt @@ -19,7 +19,6 @@ | ia64: | TODO | | m32r: | TODO | | m68k: | TODO | - | metag: | TODO | | microblaze: | TODO | | mips: | TODO | | mn10300: | TODO | -- GitLab From 5f171577b4f35b44795a73bde8cf2c49b4073925 Mon Sep 17 00:00:00 2001 From: James Hogan Date: Tue, 24 Oct 2017 16:52:32 +0100 Subject: [PATCH 04/74] Drop a bunch of metag references Now that arch/metag/ has been removed, drop a bunch of metag references in various codes across the whole tree: - VM_GROWSUP and __VM_ARCH_SPECIFIC_1. - MT_METAG_* ELF note types. - METAG Kconfig dependencies (FRAME_POINTER) and ranges (MAX_STACK_SIZE_MB). - metag cases in tools (checkstack.pl, recordmcount.c, perf). Signed-off-by: James Hogan Acked-by: Steven Rostedt (VMware) Acked-by: Peter Zijlstra (Intel) Reviewed-by: Guenter Roeck Cc: Ingo Molnar Cc: Arnaldo Carvalho de Melo Cc: Alexander Shishkin Cc: Jiri Olsa Cc: Namhyung Kim Cc: linux-mm@kvack.org Cc: linux-metag@vger.kernel.org --- include/linux/cpuhotplug.h | 1 - include/linux/mm.h | 2 -- include/trace/events/mmflags.h | 2 +- include/uapi/linux/elf.h | 3 --- lib/Kconfig.debug | 2 +- mm/Kconfig | 7 +++---- scripts/checkstack.pl | 4 ---- scripts/recordmcount.c | 20 -------------------- tools/perf/perf-sys.h | 4 ---- 9 files changed, 5 insertions(+), 40 deletions(-) diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h index 5172ad0daa7cc..c7a950681f3a4 100644 --- a/include/linux/cpuhotplug.h +++ b/include/linux/cpuhotplug.h @@ -108,7 +108,6 @@ enum cpuhp_state { CPUHP_AP_PERF_X86_CQM_STARTING, CPUHP_AP_PERF_X86_CSTATE_STARTING, CPUHP_AP_PERF_XTENSA_STARTING, - CPUHP_AP_PERF_METAG_STARTING, CPUHP_AP_MIPS_OP_LOONGSON3_STARTING, CPUHP_AP_ARM_SDEI_STARTING, CPUHP_AP_ARM_VFP_STARTING, diff --git a/include/linux/mm.h b/include/linux/mm.h index ad06d42adb1a2..ccac10682ce58 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -241,8 +241,6 @@ extern unsigned int kobjsize(const void *objp); # define VM_SAO VM_ARCH_1 /* Strong Access Ordering (powerpc) */ #elif defined(CONFIG_PARISC) # define VM_GROWSUP VM_ARCH_1 -#elif defined(CONFIG_METAG) -# define VM_GROWSUP VM_ARCH_1 #elif defined(CONFIG_IA64) # define VM_GROWSUP VM_ARCH_1 #elif !defined(CONFIG_MMU) diff --git a/include/trace/events/mmflags.h b/include/trace/events/mmflags.h index dbe1bb058c090..a81cffb76d890 100644 --- a/include/trace/events/mmflags.h +++ b/include/trace/events/mmflags.h @@ -115,7 +115,7 @@ IF_HAVE_PG_IDLE(PG_idle, "idle" ) #define __VM_ARCH_SPECIFIC_1 {VM_PAT, "pat" } #elif defined(CONFIG_PPC) #define __VM_ARCH_SPECIFIC_1 {VM_SAO, "sao" } -#elif defined(CONFIG_PARISC) || defined(CONFIG_METAG) || defined(CONFIG_IA64) +#elif defined(CONFIG_PARISC) || defined(CONFIG_IA64) #define __VM_ARCH_SPECIFIC_1 {VM_GROWSUP, "growsup" } #elif !defined(CONFIG_MMU) #define __VM_ARCH_SPECIFIC_1 {VM_MAPPED_COPY,"mappedcopy" } diff --git a/include/uapi/linux/elf.h b/include/uapi/linux/elf.h index 3bf73fb58045d..e2535d6dcec79 100644 --- a/include/uapi/linux/elf.h +++ b/include/uapi/linux/elf.h @@ -420,9 +420,6 @@ typedef struct elf64_shdr { #define NT_ARM_HW_WATCH 0x403 /* ARM hardware watchpoint registers */ #define NT_ARM_SYSTEM_CALL 0x404 /* ARM system call number */ #define NT_ARM_SVE 0x405 /* ARM Scalable Vector Extension registers */ -#define NT_METAG_CBUF 0x500 /* Metag catch buffer registers */ -#define NT_METAG_RPIPE 0x501 /* Metag read pipeline state */ -#define NT_METAG_TLS 0x502 /* Metag TLS pointer */ #define NT_ARC_V2 0x600 /* ARCv2 accumulator/extra registers */ /* Note header in a PT_NOTE section */ diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 6088408ef26c5..d1c523e408e93 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -356,7 +356,7 @@ config FRAME_POINTER bool "Compile the kernel with frame pointers" depends on DEBUG_KERNEL && \ (CRIS || M68K || FRV || UML || \ - SUPERH || BLACKFIN || MN10300 || METAG) || \ + SUPERH || BLACKFIN || MN10300) || \ ARCH_WANT_FRAME_POINTERS default y if (DEBUG_INFO && UML) || ARCH_WANT_FRAME_POINTERS help diff --git a/mm/Kconfig b/mm/Kconfig index c782e8fb7235c..abefa573bcd86 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -627,15 +627,14 @@ config GENERIC_EARLY_IOREMAP config MAX_STACK_SIZE_MB int "Maximum user stack size for 32-bit processes (MB)" default 80 - range 8 256 if METAG range 8 2048 depends on STACK_GROWSUP && (!64BIT || COMPAT) help This is the maximum stack size in Megabytes in the VM layout of 32-bit user processes when the stack grows upwards (currently only on parisc - and metag arch). The stack will be located at the highest memory - address minus the given value, unless the RLIMIT_STACK hard limit is - changed to a smaller value in which case that is used. + arch). The stack will be located at the highest memory address minus + the given value, unless the RLIMIT_STACK hard limit is changed to a + smaller value in which case that is used. A sane initial value is 80 MB. diff --git a/scripts/checkstack.pl b/scripts/checkstack.pl index cb993801e4b23..eeb9ac8dbcfb4 100755 --- a/scripts/checkstack.pl +++ b/scripts/checkstack.pl @@ -64,10 +64,6 @@ my (@stack, $re, $dre, $x, $xs, $funcre); # 2b6c: 4e56 fb70 linkw %fp,#-1168 # 1df770: defc ffe4 addaw #-28,%sp $re = qr/.*(?:linkw %fp,|addaw )#-([0-9]{1,4})(?:,%sp)?$/o; - } elsif ($arch eq 'metag') { - #400026fc: 40 00 00 82 ADD A0StP,A0StP,#0x8 - $re = qr/.*ADD.*A0StP,A0StP,\#(0x$x{1,8})/o; - $funcre = qr/^$x* <[^\$](.*)>:$/; } elsif ($arch eq 'mips64') { #8800402c: 67bdfff0 daddiu sp,sp,-16 $re = qr/.*daddiu.*sp,sp,-(([0-9]{2}|[3-9])[0-9]{2})/o; diff --git a/scripts/recordmcount.c b/scripts/recordmcount.c index 16e086dcc5676..8c9691c3329e0 100644 --- a/scripts/recordmcount.c +++ b/scripts/recordmcount.c @@ -33,20 +33,6 @@ #include #include -/* - * glibc synced up and added the metag number but didn't add the relocations. - * Work around this in a crude manner for now. - */ -#ifndef EM_METAG -#define EM_METAG 174 -#endif -#ifndef R_METAG_ADDR32 -#define R_METAG_ADDR32 2 -#endif -#ifndef R_METAG_NONE -#define R_METAG_NONE 3 -#endif - #ifndef EM_AARCH64 #define EM_AARCH64 183 #define R_AARCH64_NONE 0 @@ -538,12 +524,6 @@ do_file(char const *const fname) gpfx = '_'; break; case EM_IA_64: reltype = R_IA64_IMM64; gpfx = '_'; break; - case EM_METAG: reltype = R_METAG_ADDR32; - altmcount = "_mcount_wrapper"; - rel_type_nop = R_METAG_NONE; - /* We happen to have the same requirement as MIPS */ - is_fake_mcount32 = MIPS32_is_fake_mcount; - break; case EM_MIPS: /* reltype: e_class */ gpfx = '_'; break; case EM_PPC: reltype = R_PPC_ADDR32; gpfx = '_'; break; case EM_PPC64: reltype = R_PPC64_ADDR64; gpfx = '_'; break; diff --git a/tools/perf/perf-sys.h b/tools/perf/perf-sys.h index 36673f98d66ba..3eb7a39169f63 100644 --- a/tools/perf/perf-sys.h +++ b/tools/perf/perf-sys.h @@ -46,10 +46,6 @@ #define CPUINFO_PROC {"Processor"} #endif -#ifdef __metag__ -#define CPUINFO_PROC {"CPU"} -#endif - #ifdef __xtensa__ #define CPUINFO_PROC {"core ID"} #endif -- GitLab From df46bb1909d92eedccd4216c88e43f75cb0b2901 Mon Sep 17 00:00:00 2001 From: James Hogan Date: Wed, 21 Feb 2018 15:31:32 +0000 Subject: [PATCH 05/74] irqchip: Remove metag irqchip drivers Now that arch/metag/ has been removed, remove the two metag irqchip drivers. They are of no value without the architecture code. - irq-metag: Meta internal (HWSTATMETA) interrupt code. - irq-metag-ext: Meta External interrupt code. Signed-off-by: James Hogan Cc: Thomas Gleixner Cc: Jason Cooper Cc: Marc Zyngier Cc: linux-metag@vger.kernel.org --- drivers/irqchip/Makefile | 2 - drivers/irqchip/irq-metag-ext.c | 871 ------------------------------ drivers/irqchip/irq-metag.c | 343 ------------ include/linux/irqchip/metag-ext.h | 34 -- include/linux/irqchip/metag.h | 25 - 5 files changed, 1275 deletions(-) delete mode 100644 drivers/irqchip/irq-metag-ext.c delete mode 100644 drivers/irqchip/irq-metag.c delete mode 100644 include/linux/irqchip/metag-ext.h delete mode 100644 include/linux/irqchip/metag.h diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile index d27e3e3619e04..b5b1f4c934139 100644 --- a/drivers/irqchip/Makefile +++ b/drivers/irqchip/Makefile @@ -15,8 +15,6 @@ obj-$(CONFIG_IRQ_MXS) += irq-mxs.o obj-$(CONFIG_ARCH_TEGRA) += irq-tegra.o obj-$(CONFIG_ARCH_S3C24XX) += irq-s3c24xx.o obj-$(CONFIG_DW_APB_ICTL) += irq-dw-apb-ictl.o -obj-$(CONFIG_METAG) += irq-metag-ext.o -obj-$(CONFIG_METAG_PERFCOUNTER_IRQS) += irq-metag.o obj-$(CONFIG_CLPS711X_IRQCHIP) += irq-clps711x.o obj-$(CONFIG_OMPIC) += irq-ompic.o obj-$(CONFIG_OR1K_PIC) += irq-or1k-pic.o diff --git a/drivers/irqchip/irq-metag-ext.c b/drivers/irqchip/irq-metag-ext.c deleted file mode 100644 index e67483161f0fb..0000000000000 --- a/drivers/irqchip/irq-metag-ext.c +++ /dev/null @@ -1,871 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Meta External interrupt code. - * - * Copyright (C) 2005-2012 Imagination Technologies Ltd. - * - * External interrupts on Meta are configured at two-levels, in the CPU core and - * in the external trigger block. Interrupts from SoC peripherals are - * multiplexed onto a single Meta CPU "trigger" - traditionally it has always - * been trigger 2 (TR2). For info on how de-multiplexing happens check out - * meta_intc_irq_demux(). - */ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#define HWSTAT_STRIDE 8 -#define HWVEC_BLK_STRIDE 0x1000 - -/** - * struct meta_intc_priv - private meta external interrupt data - * @nr_banks: Number of interrupt banks - * @domain: IRQ domain for all banks of external IRQs - * @unmasked: Record of unmasked IRQs - * @levels_altered: Record of altered level bits - */ -struct meta_intc_priv { - unsigned int nr_banks; - struct irq_domain *domain; - - unsigned long unmasked[4]; - -#ifdef CONFIG_METAG_SUSPEND_MEM - unsigned long levels_altered[4]; -#endif -}; - -/* Private data for the one and only external interrupt controller */ -static struct meta_intc_priv meta_intc_priv; - -/** - * meta_intc_offset() - Get the offset into the bank of a hardware IRQ number - * @hw: Hardware IRQ number (within external trigger block) - * - * Returns: Bit offset into the IRQ's bank registers - */ -static unsigned int meta_intc_offset(irq_hw_number_t hw) -{ - return hw & 0x1f; -} - -/** - * meta_intc_bank() - Get the bank number of a hardware IRQ number - * @hw: Hardware IRQ number (within external trigger block) - * - * Returns: Bank number indicating which register the IRQ's bits are - */ -static unsigned int meta_intc_bank(irq_hw_number_t hw) -{ - return hw >> 5; -} - -/** - * meta_intc_stat_addr() - Get the address of a HWSTATEXT register - * @hw: Hardware IRQ number (within external trigger block) - * - * Returns: Address of a HWSTATEXT register containing the status bit for - * the specified hardware IRQ number - */ -static void __iomem *meta_intc_stat_addr(irq_hw_number_t hw) -{ - return (void __iomem *)(HWSTATEXT + - HWSTAT_STRIDE * meta_intc_bank(hw)); -} - -/** - * meta_intc_level_addr() - Get the address of a HWLEVELEXT register - * @hw: Hardware IRQ number (within external trigger block) - * - * Returns: Address of a HWLEVELEXT register containing the sense bit for - * the specified hardware IRQ number - */ -static void __iomem *meta_intc_level_addr(irq_hw_number_t hw) -{ - return (void __iomem *)(HWLEVELEXT + - HWSTAT_STRIDE * meta_intc_bank(hw)); -} - -/** - * meta_intc_mask_addr() - Get the address of a HWMASKEXT register - * @hw: Hardware IRQ number (within external trigger block) - * - * Returns: Address of a HWMASKEXT register containing the mask bit for the - * specified hardware IRQ number - */ -static void __iomem *meta_intc_mask_addr(irq_hw_number_t hw) -{ - return (void __iomem *)(HWMASKEXT + - HWSTAT_STRIDE * meta_intc_bank(hw)); -} - -/** - * meta_intc_vec_addr() - Get the vector address of a hardware interrupt - * @hw: Hardware IRQ number (within external trigger block) - * - * Returns: Address of a HWVECEXT register controlling the core trigger to - * vector the IRQ onto - */ -static inline void __iomem *meta_intc_vec_addr(irq_hw_number_t hw) -{ - return (void __iomem *)(HWVEC0EXT + - HWVEC_BLK_STRIDE * meta_intc_bank(hw) + - HWVECnEXT_STRIDE * meta_intc_offset(hw)); -} - -/** - * meta_intc_startup_irq() - set up an external irq - * @data: data for the external irq to start up - * - * Multiplex interrupts for irq onto TR2. Clear any pending interrupts and - * unmask irq, both using the appropriate callbacks. - */ -static unsigned int meta_intc_startup_irq(struct irq_data *data) -{ - irq_hw_number_t hw = data->hwirq; - void __iomem *vec_addr = meta_intc_vec_addr(hw); - int thread = hard_processor_id(); - - /* Perform any necessary acking. */ - if (data->chip->irq_ack) - data->chip->irq_ack(data); - - /* Wire up this interrupt to the core with HWVECxEXT. */ - metag_out32(TBI_TRIG_VEC(TBID_SIGNUM_TR2(thread)), vec_addr); - - /* Perform any necessary unmasking. */ - data->chip->irq_unmask(data); - - return 0; -} - -/** - * meta_intc_shutdown_irq() - turn off an external irq - * @data: data for the external irq to turn off - * - * Mask irq using the appropriate callback and stop muxing it onto TR2. - */ -static void meta_intc_shutdown_irq(struct irq_data *data) -{ - irq_hw_number_t hw = data->hwirq; - void __iomem *vec_addr = meta_intc_vec_addr(hw); - - /* Mask the IRQ */ - data->chip->irq_mask(data); - - /* - * Disable the IRQ at the core by removing the interrupt from - * the HW vector mapping. - */ - metag_out32(0, vec_addr); -} - -/** - * meta_intc_ack_irq() - acknowledge an external irq - * @data: data for the external irq to ack - * - * Clear down an edge interrupt in the status register. - */ -static void meta_intc_ack_irq(struct irq_data *data) -{ - irq_hw_number_t hw = data->hwirq; - unsigned int bit = 1 << meta_intc_offset(hw); - void __iomem *stat_addr = meta_intc_stat_addr(hw); - - /* Ack the int, if it is still 'on'. - * NOTE - this only works for edge triggered interrupts. - */ - if (metag_in32(stat_addr) & bit) - metag_out32(bit, stat_addr); -} - -/** - * record_irq_is_masked() - record the IRQ masked so it doesn't get handled - * @data: data for the external irq to record - * - * This should get called whenever an external IRQ is masked (by whichever - * callback is used). It records the IRQ masked so that it doesn't get handled - * if it still shows up in the status register. - */ -static void record_irq_is_masked(struct irq_data *data) -{ - struct meta_intc_priv *priv = &meta_intc_priv; - irq_hw_number_t hw = data->hwirq; - - clear_bit(meta_intc_offset(hw), &priv->unmasked[meta_intc_bank(hw)]); -} - -/** - * record_irq_is_unmasked() - record the IRQ unmasked so it can be handled - * @data: data for the external irq to record - * - * This should get called whenever an external IRQ is unmasked (by whichever - * callback is used). It records the IRQ unmasked so that it gets handled if it - * shows up in the status register. - */ -static void record_irq_is_unmasked(struct irq_data *data) -{ - struct meta_intc_priv *priv = &meta_intc_priv; - irq_hw_number_t hw = data->hwirq; - - set_bit(meta_intc_offset(hw), &priv->unmasked[meta_intc_bank(hw)]); -} - -/* - * For use by wrapper IRQ drivers - */ - -/** - * meta_intc_mask_irq_simple() - minimal mask used by wrapper IRQ drivers - * @data: data for the external irq being masked - * - * This should be called by any wrapper IRQ driver mask functions. it doesn't do - * any masking but records the IRQ as masked so that the core code knows the - * mask has taken place. It is the callers responsibility to ensure that the IRQ - * won't trigger an interrupt to the core. - */ -void meta_intc_mask_irq_simple(struct irq_data *data) -{ - record_irq_is_masked(data); -} - -/** - * meta_intc_unmask_irq_simple() - minimal unmask used by wrapper IRQ drivers - * @data: data for the external irq being unmasked - * - * This should be called by any wrapper IRQ driver unmask functions. it doesn't - * do any unmasking but records the IRQ as unmasked so that the core code knows - * the unmask has taken place. It is the callers responsibility to ensure that - * the IRQ can now trigger an interrupt to the core. - */ -void meta_intc_unmask_irq_simple(struct irq_data *data) -{ - record_irq_is_unmasked(data); -} - - -/** - * meta_intc_mask_irq() - mask an external irq using HWMASKEXT - * @data: data for the external irq to mask - * - * This is a default implementation of a mask function which makes use of the - * HWMASKEXT registers available in newer versions. - * - * Earlier versions without these registers should use SoC level IRQ masking - * which call the meta_intc_*_simple() functions above, or if that isn't - * available should use the fallback meta_intc_*_nomask() functions below. - */ -static void meta_intc_mask_irq(struct irq_data *data) -{ - irq_hw_number_t hw = data->hwirq; - unsigned int bit = 1 << meta_intc_offset(hw); - void __iomem *mask_addr = meta_intc_mask_addr(hw); - unsigned long flags; - - record_irq_is_masked(data); - - /* update the interrupt mask */ - __global_lock2(flags); - metag_out32(metag_in32(mask_addr) & ~bit, mask_addr); - __global_unlock2(flags); -} - -/** - * meta_intc_unmask_irq() - unmask an external irq using HWMASKEXT - * @data: data for the external irq to unmask - * - * This is a default implementation of an unmask function which makes use of the - * HWMASKEXT registers available on new versions. It should be paired with - * meta_intc_mask_irq() above. - */ -static void meta_intc_unmask_irq(struct irq_data *data) -{ - irq_hw_number_t hw = data->hwirq; - unsigned int bit = 1 << meta_intc_offset(hw); - void __iomem *mask_addr = meta_intc_mask_addr(hw); - unsigned long flags; - - record_irq_is_unmasked(data); - - /* update the interrupt mask */ - __global_lock2(flags); - metag_out32(metag_in32(mask_addr) | bit, mask_addr); - __global_unlock2(flags); -} - -/** - * meta_intc_mask_irq_nomask() - mask an external irq by unvectoring - * @data: data for the external irq to mask - * - * This is the version of the mask function for older versions which don't have - * HWMASKEXT registers, or a SoC level means of masking IRQs. Instead the IRQ is - * unvectored from the core and retriggered if necessary later. - */ -static void meta_intc_mask_irq_nomask(struct irq_data *data) -{ - irq_hw_number_t hw = data->hwirq; - void __iomem *vec_addr = meta_intc_vec_addr(hw); - - record_irq_is_masked(data); - - /* there is no interrupt mask, so unvector the interrupt */ - metag_out32(0, vec_addr); -} - -/** - * meta_intc_unmask_edge_irq_nomask() - unmask an edge irq by revectoring - * @data: data for the external irq to unmask - * - * This is the version of the unmask function for older versions which don't - * have HWMASKEXT registers, or a SoC level means of masking IRQs. Instead the - * IRQ is revectored back to the core and retriggered if necessary. - * - * The retriggering done by this function is specific to edge interrupts. - */ -static void meta_intc_unmask_edge_irq_nomask(struct irq_data *data) -{ - irq_hw_number_t hw = data->hwirq; - unsigned int bit = 1 << meta_intc_offset(hw); - void __iomem *stat_addr = meta_intc_stat_addr(hw); - void __iomem *vec_addr = meta_intc_vec_addr(hw); - unsigned int thread = hard_processor_id(); - - record_irq_is_unmasked(data); - - /* there is no interrupt mask, so revector the interrupt */ - metag_out32(TBI_TRIG_VEC(TBID_SIGNUM_TR2(thread)), vec_addr); - - /* - * Re-trigger interrupt - * - * Writing a 1 toggles, and a 0->1 transition triggers. We only - * retrigger if the status bit is already set, which means we - * need to clear it first. Retriggering is fundamentally racy - * because if the interrupt fires again after we clear it we - * could end up clearing it again and the interrupt handler - * thinking it hasn't fired. Therefore we need to keep trying to - * retrigger until the bit is set. - */ - if (metag_in32(stat_addr) & bit) { - metag_out32(bit, stat_addr); - while (!(metag_in32(stat_addr) & bit)) - metag_out32(bit, stat_addr); - } -} - -/** - * meta_intc_unmask_level_irq_nomask() - unmask a level irq by revectoring - * @data: data for the external irq to unmask - * - * This is the version of the unmask function for older versions which don't - * have HWMASKEXT registers, or a SoC level means of masking IRQs. Instead the - * IRQ is revectored back to the core and retriggered if necessary. - * - * The retriggering done by this function is specific to level interrupts. - */ -static void meta_intc_unmask_level_irq_nomask(struct irq_data *data) -{ - irq_hw_number_t hw = data->hwirq; - unsigned int bit = 1 << meta_intc_offset(hw); - void __iomem *stat_addr = meta_intc_stat_addr(hw); - void __iomem *vec_addr = meta_intc_vec_addr(hw); - unsigned int thread = hard_processor_id(); - - record_irq_is_unmasked(data); - - /* there is no interrupt mask, so revector the interrupt */ - metag_out32(TBI_TRIG_VEC(TBID_SIGNUM_TR2(thread)), vec_addr); - - /* Re-trigger interrupt */ - /* Writing a 1 triggers interrupt */ - if (metag_in32(stat_addr) & bit) - metag_out32(bit, stat_addr); -} - -/** - * meta_intc_irq_set_type() - set the type of an external irq - * @data: data for the external irq to set the type of - * @flow_type: new irq flow type - * - * Set the flow type of an external interrupt. This updates the irq chip and irq - * handler depending on whether the irq is edge or level sensitive (the polarity - * is ignored), and also sets up the bit in HWLEVELEXT so the hardware knows - * when to trigger. - */ -static int meta_intc_irq_set_type(struct irq_data *data, unsigned int flow_type) -{ -#ifdef CONFIG_METAG_SUSPEND_MEM - struct meta_intc_priv *priv = &meta_intc_priv; -#endif - irq_hw_number_t hw = data->hwirq; - unsigned int bit = 1 << meta_intc_offset(hw); - void __iomem *level_addr = meta_intc_level_addr(hw); - unsigned long flags; - unsigned int level; - - /* update the chip/handler */ - if (flow_type & IRQ_TYPE_LEVEL_MASK) - irq_set_chip_handler_name_locked(data, &meta_intc_level_chip, - handle_level_irq, NULL); - else - irq_set_chip_handler_name_locked(data, &meta_intc_edge_chip, - handle_edge_irq, NULL); - - /* and clear/set the bit in HWLEVELEXT */ - __global_lock2(flags); - level = metag_in32(level_addr); - if (flow_type & IRQ_TYPE_LEVEL_MASK) - level |= bit; - else - level &= ~bit; - metag_out32(level, level_addr); -#ifdef CONFIG_METAG_SUSPEND_MEM - priv->levels_altered[meta_intc_bank(hw)] |= bit; -#endif - __global_unlock2(flags); - - return 0; -} - -/** - * meta_intc_irq_demux() - external irq de-multiplexer - * @desc: the interrupt description structure for this irq - * - * The cpu receives an interrupt on TR2 when a SoC interrupt has occurred. It is - * this function's job to demux this irq and figure out exactly which external - * irq needs servicing. - * - * Whilst using TR2 to detect external interrupts is a software convention it is - * (hopefully) unlikely to change. - */ -static void meta_intc_irq_demux(struct irq_desc *desc) -{ - struct meta_intc_priv *priv = &meta_intc_priv; - irq_hw_number_t hw; - unsigned int bank, irq_no, status; - void __iomem *stat_addr = meta_intc_stat_addr(0); - - /* - * Locate which interrupt has caused our handler to run. - */ - for (bank = 0; bank < priv->nr_banks; ++bank) { - /* Which interrupts are currently pending in this bank? */ -recalculate: - status = metag_in32(stat_addr) & priv->unmasked[bank]; - - for (hw = bank*32; status; status >>= 1, ++hw) { - if (status & 0x1) { - /* - * Map the hardware IRQ number to a virtual - * Linux IRQ number. - */ - irq_no = irq_linear_revmap(priv->domain, hw); - - /* - * Only fire off external interrupts that are - * registered to be handled by the kernel. - * Other external interrupts are probably being - * handled by other Meta hardware threads. - */ - generic_handle_irq(irq_no); - - /* - * The handler may have re-enabled interrupts - * which could have caused a nested invocation - * of this code and make the copy of the - * status register we are using invalid. - */ - goto recalculate; - } - } - stat_addr += HWSTAT_STRIDE; - } -} - -#ifdef CONFIG_SMP -/** - * meta_intc_set_affinity() - set the affinity for an interrupt - * @data: data for the external irq to set the affinity of - * @cpumask: cpu mask representing cpus which can handle the interrupt - * @force: whether to force (ignored) - * - * Revector the specified external irq onto a specific cpu's TR2 trigger, so - * that that cpu tends to be the one who handles it. - */ -static int meta_intc_set_affinity(struct irq_data *data, - const struct cpumask *cpumask, bool force) -{ - irq_hw_number_t hw = data->hwirq; - void __iomem *vec_addr = meta_intc_vec_addr(hw); - unsigned int cpu, thread; - - /* - * Wire up this interrupt from HWVECxEXT to the Meta core. - * - * Note that we can't wire up HWVECxEXT to interrupt more than - * one cpu (the interrupt code doesn't support it), so we just - * pick the first cpu we find in 'cpumask'. - */ - cpu = cpumask_any_and(cpumask, cpu_online_mask); - thread = cpu_2_hwthread_id[cpu]; - - metag_out32(TBI_TRIG_VEC(TBID_SIGNUM_TR2(thread)), vec_addr); - - irq_data_update_effective_affinity(data, cpumask_of(cpu)); - - return 0; -} -#else -#define meta_intc_set_affinity NULL -#endif - -#ifdef CONFIG_PM_SLEEP -#define META_INTC_CHIP_FLAGS (IRQCHIP_MASK_ON_SUSPEND \ - | IRQCHIP_SKIP_SET_WAKE) -#else -#define META_INTC_CHIP_FLAGS 0 -#endif - -/* public edge/level irq chips which SoCs can override */ - -struct irq_chip meta_intc_edge_chip = { - .irq_startup = meta_intc_startup_irq, - .irq_shutdown = meta_intc_shutdown_irq, - .irq_ack = meta_intc_ack_irq, - .irq_mask = meta_intc_mask_irq, - .irq_unmask = meta_intc_unmask_irq, - .irq_set_type = meta_intc_irq_set_type, - .irq_set_affinity = meta_intc_set_affinity, - .flags = META_INTC_CHIP_FLAGS, -}; - -struct irq_chip meta_intc_level_chip = { - .irq_startup = meta_intc_startup_irq, - .irq_shutdown = meta_intc_shutdown_irq, - .irq_set_type = meta_intc_irq_set_type, - .irq_mask = meta_intc_mask_irq, - .irq_unmask = meta_intc_unmask_irq, - .irq_set_affinity = meta_intc_set_affinity, - .flags = META_INTC_CHIP_FLAGS, -}; - -/** - * meta_intc_map() - map an external irq - * @d: irq domain of external trigger block - * @irq: virtual irq number - * @hw: hardware irq number within external trigger block - * - * This sets up a virtual irq for a specified hardware interrupt. The irq chip - * and handler is configured, using the HWLEVELEXT registers to determine - * edge/level flow type. These registers will have been set when the irq type is - * set (or set to a default at init time). - */ -static int meta_intc_map(struct irq_domain *d, unsigned int irq, - irq_hw_number_t hw) -{ - unsigned int bit = 1 << meta_intc_offset(hw); - void __iomem *level_addr = meta_intc_level_addr(hw); - - /* Go by the current sense in the HWLEVELEXT register */ - if (metag_in32(level_addr) & bit) - irq_set_chip_and_handler(irq, &meta_intc_level_chip, - handle_level_irq); - else - irq_set_chip_and_handler(irq, &meta_intc_edge_chip, - handle_edge_irq); - - irqd_set_single_target(irq_desc_get_irq_data(irq_to_desc(irq))); - return 0; -} - -static const struct irq_domain_ops meta_intc_domain_ops = { - .map = meta_intc_map, - .xlate = irq_domain_xlate_twocell, -}; - -#ifdef CONFIG_METAG_SUSPEND_MEM - -/** - * struct meta_intc_context - suspend context - * @levels: State of HWLEVELEXT registers - * @masks: State of HWMASKEXT registers - * @vectors: State of HWVECEXT registers - * @txvecint: State of TxVECINT registers - * - * This structure stores the IRQ state across suspend. - */ -struct meta_intc_context { - u32 levels[4]; - u32 masks[4]; - u8 vectors[4*32]; - - u8 txvecint[4][4]; -}; - -/* suspend context */ -static struct meta_intc_context *meta_intc_context; - -/** - * meta_intc_suspend() - store irq state - * - * To avoid interfering with other threads we only save the IRQ state of IRQs in - * use by Linux. - */ -static int meta_intc_suspend(void) -{ - struct meta_intc_priv *priv = &meta_intc_priv; - int i, j; - irq_hw_number_t hw; - unsigned int bank; - unsigned long flags; - struct meta_intc_context *context; - void __iomem *level_addr, *mask_addr, *vec_addr; - u32 mask, bit; - - context = kzalloc(sizeof(*context), GFP_ATOMIC); - if (!context) - return -ENOMEM; - - hw = 0; - level_addr = meta_intc_level_addr(0); - mask_addr = meta_intc_mask_addr(0); - for (bank = 0; bank < priv->nr_banks; ++bank) { - vec_addr = meta_intc_vec_addr(hw); - - /* create mask of interrupts in use */ - mask = 0; - for (bit = 1; bit; bit <<= 1) { - i = irq_linear_revmap(priv->domain, hw); - /* save mapped irqs which are enabled or have actions */ - if (i && (!irqd_irq_disabled(irq_get_irq_data(i)) || - irq_has_action(i))) { - mask |= bit; - - /* save trigger vector */ - context->vectors[hw] = metag_in32(vec_addr); - } - - ++hw; - vec_addr += HWVECnEXT_STRIDE; - } - - /* save level state if any IRQ levels altered */ - if (priv->levels_altered[bank]) - context->levels[bank] = metag_in32(level_addr); - /* save mask state if any IRQs in use */ - if (mask) - context->masks[bank] = metag_in32(mask_addr); - - level_addr += HWSTAT_STRIDE; - mask_addr += HWSTAT_STRIDE; - } - - /* save trigger matrixing */ - __global_lock2(flags); - for (i = 0; i < 4; ++i) - for (j = 0; j < 4; ++j) - context->txvecint[i][j] = metag_in32(T0VECINT_BHALT + - TnVECINT_STRIDE*i + - 8*j); - __global_unlock2(flags); - - meta_intc_context = context; - return 0; -} - -/** - * meta_intc_resume() - restore saved irq state - * - * Restore the saved IRQ state and drop it. - */ -static void meta_intc_resume(void) -{ - struct meta_intc_priv *priv = &meta_intc_priv; - int i, j; - irq_hw_number_t hw; - unsigned int bank; - unsigned long flags; - struct meta_intc_context *context = meta_intc_context; - void __iomem *level_addr, *mask_addr, *vec_addr; - u32 mask, bit, tmp; - - meta_intc_context = NULL; - - hw = 0; - level_addr = meta_intc_level_addr(0); - mask_addr = meta_intc_mask_addr(0); - for (bank = 0; bank < priv->nr_banks; ++bank) { - vec_addr = meta_intc_vec_addr(hw); - - /* create mask of interrupts in use */ - mask = 0; - for (bit = 1; bit; bit <<= 1) { - i = irq_linear_revmap(priv->domain, hw); - /* restore mapped irqs, enabled or with actions */ - if (i && (!irqd_irq_disabled(irq_get_irq_data(i)) || - irq_has_action(i))) { - mask |= bit; - - /* restore trigger vector */ - metag_out32(context->vectors[hw], vec_addr); - } - - ++hw; - vec_addr += HWVECnEXT_STRIDE; - } - - if (mask) { - /* restore mask state */ - __global_lock2(flags); - tmp = metag_in32(mask_addr); - tmp = (tmp & ~mask) | (context->masks[bank] & mask); - metag_out32(tmp, mask_addr); - __global_unlock2(flags); - } - - mask = priv->levels_altered[bank]; - if (mask) { - /* restore level state */ - __global_lock2(flags); - tmp = metag_in32(level_addr); - tmp = (tmp & ~mask) | (context->levels[bank] & mask); - metag_out32(tmp, level_addr); - __global_unlock2(flags); - } - - level_addr += HWSTAT_STRIDE; - mask_addr += HWSTAT_STRIDE; - } - - /* restore trigger matrixing */ - __global_lock2(flags); - for (i = 0; i < 4; ++i) { - for (j = 0; j < 4; ++j) { - metag_out32(context->txvecint[i][j], - T0VECINT_BHALT + - TnVECINT_STRIDE*i + - 8*j); - } - } - __global_unlock2(flags); - - kfree(context); -} - -static struct syscore_ops meta_intc_syscore_ops = { - .suspend = meta_intc_suspend, - .resume = meta_intc_resume, -}; - -static void __init meta_intc_init_syscore_ops(struct meta_intc_priv *priv) -{ - register_syscore_ops(&meta_intc_syscore_ops); -} -#else -#define meta_intc_init_syscore_ops(priv) do {} while (0) -#endif - -/** - * meta_intc_init_cpu() - register with a Meta cpu - * @priv: private interrupt controller data - * @cpu: the CPU to register on - * - * Configure @cpu's TR2 irq so that we can demux external irqs. - */ -static void __init meta_intc_init_cpu(struct meta_intc_priv *priv, int cpu) -{ - unsigned int thread = cpu_2_hwthread_id[cpu]; - unsigned int signum = TBID_SIGNUM_TR2(thread); - int irq = tbisig_map(signum); - - /* Register the multiplexed IRQ handler */ - irq_set_chained_handler(irq, meta_intc_irq_demux); - irq_set_irq_type(irq, IRQ_TYPE_LEVEL_LOW); -} - -/** - * meta_intc_no_mask() - indicate lack of HWMASKEXT registers - * - * Called from SoC code (or init code below) to dynamically indicate the lack of - * HWMASKEXT registers (for example depending on some SoC revision register). - * This alters the irq mask and unmask callbacks to use the fallback - * unvectoring/retriggering technique instead of using HWMASKEXT registers. - */ -void __init meta_intc_no_mask(void) -{ - meta_intc_edge_chip.irq_mask = meta_intc_mask_irq_nomask; - meta_intc_edge_chip.irq_unmask = meta_intc_unmask_edge_irq_nomask; - meta_intc_level_chip.irq_mask = meta_intc_mask_irq_nomask; - meta_intc_level_chip.irq_unmask = meta_intc_unmask_level_irq_nomask; -} - -/** - * init_external_IRQ() - initialise the external irq controller - * - * Set up the external irq controller using device tree properties. This is - * called from init_IRQ(). - */ -int __init init_external_IRQ(void) -{ - struct meta_intc_priv *priv = &meta_intc_priv; - struct device_node *node; - int ret, cpu; - u32 val; - bool no_masks = false; - - node = of_find_compatible_node(NULL, NULL, "img,meta-intc"); - if (!node) - return -ENOENT; - - /* Get number of banks */ - ret = of_property_read_u32(node, "num-banks", &val); - if (ret) { - pr_err("meta-intc: No num-banks property found\n"); - return ret; - } - if (val < 1 || val > 4) { - pr_err("meta-intc: num-banks (%u) out of range\n", val); - return -EINVAL; - } - priv->nr_banks = val; - - /* Are any mask registers present? */ - if (of_get_property(node, "no-mask", NULL)) - no_masks = true; - - /* No HWMASKEXT registers present? */ - if (no_masks) - meta_intc_no_mask(); - - /* Set up an IRQ domain */ - /* - * This is a legacy IRQ domain for now until all the platform setup code - * has been converted to devicetree. - */ - priv->domain = irq_domain_add_linear(node, priv->nr_banks*32, - &meta_intc_domain_ops, priv); - if (unlikely(!priv->domain)) { - pr_err("meta-intc: cannot add IRQ domain\n"); - return -ENOMEM; - } - - /* Setup TR2 for all cpus. */ - for_each_possible_cpu(cpu) - meta_intc_init_cpu(priv, cpu); - - /* Set up system suspend/resume callbacks */ - meta_intc_init_syscore_ops(priv); - - pr_info("meta-intc: External IRQ controller initialised (%u IRQs)\n", - priv->nr_banks*32); - - return 0; -} diff --git a/drivers/irqchip/irq-metag.c b/drivers/irqchip/irq-metag.c deleted file mode 100644 index 857b946747eb4..0000000000000 --- a/drivers/irqchip/irq-metag.c +++ /dev/null @@ -1,343 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Meta internal (HWSTATMETA) interrupt code. - * - * Copyright (C) 2011-2012 Imagination Technologies Ltd. - * - * This code is based on the code in SoC/common/irq.c and SoC/comet/irq.c - * The code base could be generalised/merged as a lot of the functionality is - * similar. Until this is done, we try to keep the code simple here. - */ - -#include -#include -#include - -#include -#include - -#define PERF0VECINT 0x04820580 -#define PERF1VECINT 0x04820588 -#define PERF0TRIG_OFFSET 16 -#define PERF1TRIG_OFFSET 17 - -/** - * struct metag_internal_irq_priv - private meta internal interrupt data - * @domain: IRQ domain for all internal Meta IRQs (HWSTATMETA) - * @unmasked: Record of unmasked IRQs - */ -struct metag_internal_irq_priv { - struct irq_domain *domain; - - unsigned long unmasked; -}; - -/* Private data for the one and only internal interrupt controller */ -static struct metag_internal_irq_priv metag_internal_irq_priv; - -static unsigned int metag_internal_irq_startup(struct irq_data *data); -static void metag_internal_irq_shutdown(struct irq_data *data); -static void metag_internal_irq_ack(struct irq_data *data); -static void metag_internal_irq_mask(struct irq_data *data); -static void metag_internal_irq_unmask(struct irq_data *data); -#ifdef CONFIG_SMP -static int metag_internal_irq_set_affinity(struct irq_data *data, - const struct cpumask *cpumask, bool force); -#endif - -static struct irq_chip internal_irq_edge_chip = { - .name = "HWSTATMETA-IRQ", - .irq_startup = metag_internal_irq_startup, - .irq_shutdown = metag_internal_irq_shutdown, - .irq_ack = metag_internal_irq_ack, - .irq_mask = metag_internal_irq_mask, - .irq_unmask = metag_internal_irq_unmask, -#ifdef CONFIG_SMP - .irq_set_affinity = metag_internal_irq_set_affinity, -#endif -}; - -/* - * metag_hwvec_addr - get the address of *VECINT regs of irq - * - * This function is a table of supported triggers on HWSTATMETA - * Could do with a structure, but better keep it simple. Changes - * in this code should be rare. - */ -static inline void __iomem *metag_hwvec_addr(irq_hw_number_t hw) -{ - void __iomem *addr; - - switch (hw) { - case PERF0TRIG_OFFSET: - addr = (void __iomem *)PERF0VECINT; - break; - case PERF1TRIG_OFFSET: - addr = (void __iomem *)PERF1VECINT; - break; - default: - addr = NULL; - break; - } - return addr; -} - -/* - * metag_internal_startup - setup an internal irq - * @irq: the irq to startup - * - * Multiplex interrupts for @irq onto TR1. Clear any pending - * interrupts. - */ -static unsigned int metag_internal_irq_startup(struct irq_data *data) -{ - /* Clear (toggle) the bit in HWSTATMETA for our interrupt. */ - metag_internal_irq_ack(data); - - /* Enable the interrupt by unmasking it */ - metag_internal_irq_unmask(data); - - return 0; -} - -/* - * metag_internal_irq_shutdown - turn off the irq - * @irq: the irq number to turn off - * - * Mask @irq and clear any pending interrupts. - * Stop muxing @irq onto TR1. - */ -static void metag_internal_irq_shutdown(struct irq_data *data) -{ - /* Disable the IRQ at the core by masking it. */ - metag_internal_irq_mask(data); - - /* Clear (toggle) the bit in HWSTATMETA for our interrupt. */ - metag_internal_irq_ack(data); -} - -/* - * metag_internal_irq_ack - acknowledge irq - * @irq: the irq to ack - */ -static void metag_internal_irq_ack(struct irq_data *data) -{ - irq_hw_number_t hw = data->hwirq; - unsigned int bit = 1 << hw; - - if (metag_in32(HWSTATMETA) & bit) - metag_out32(bit, HWSTATMETA); -} - -/** - * metag_internal_irq_mask() - mask an internal irq by unvectoring - * @data: data for the internal irq to mask - * - * HWSTATMETA has no mask register. Instead the IRQ is unvectored from the core - * and retriggered if necessary later. - */ -static void metag_internal_irq_mask(struct irq_data *data) -{ - struct metag_internal_irq_priv *priv = &metag_internal_irq_priv; - irq_hw_number_t hw = data->hwirq; - void __iomem *vec_addr = metag_hwvec_addr(hw); - - clear_bit(hw, &priv->unmasked); - - /* there is no interrupt mask, so unvector the interrupt */ - metag_out32(0, vec_addr); -} - -/** - * meta_intc_unmask_edge_irq_nomask() - unmask an edge irq by revectoring - * @data: data for the internal irq to unmask - * - * HWSTATMETA has no mask register. Instead the IRQ is revectored back to the - * core and retriggered if necessary. - */ -static void metag_internal_irq_unmask(struct irq_data *data) -{ - struct metag_internal_irq_priv *priv = &metag_internal_irq_priv; - irq_hw_number_t hw = data->hwirq; - unsigned int bit = 1 << hw; - void __iomem *vec_addr = metag_hwvec_addr(hw); - unsigned int thread = hard_processor_id(); - - set_bit(hw, &priv->unmasked); - - /* there is no interrupt mask, so revector the interrupt */ - metag_out32(TBI_TRIG_VEC(TBID_SIGNUM_TR1(thread)), vec_addr); - - /* - * Re-trigger interrupt - * - * Writing a 1 toggles, and a 0->1 transition triggers. We only - * retrigger if the status bit is already set, which means we - * need to clear it first. Retriggering is fundamentally racy - * because if the interrupt fires again after we clear it we - * could end up clearing it again and the interrupt handler - * thinking it hasn't fired. Therefore we need to keep trying to - * retrigger until the bit is set. - */ - if (metag_in32(HWSTATMETA) & bit) { - metag_out32(bit, HWSTATMETA); - while (!(metag_in32(HWSTATMETA) & bit)) - metag_out32(bit, HWSTATMETA); - } -} - -#ifdef CONFIG_SMP -/* - * metag_internal_irq_set_affinity - set the affinity for an interrupt - */ -static int metag_internal_irq_set_affinity(struct irq_data *data, - const struct cpumask *cpumask, bool force) -{ - unsigned int cpu, thread; - irq_hw_number_t hw = data->hwirq; - /* - * Wire up this interrupt from *VECINT to the Meta core. - * - * Note that we can't wire up *VECINT to interrupt more than - * one cpu (the interrupt code doesn't support it), so we just - * pick the first cpu we find in 'cpumask'. - */ - cpu = cpumask_any_and(cpumask, cpu_online_mask); - thread = cpu_2_hwthread_id[cpu]; - - metag_out32(TBI_TRIG_VEC(TBID_SIGNUM_TR1(thread)), - metag_hwvec_addr(hw)); - - return 0; -} -#endif - -/* - * metag_internal_irq_demux - irq de-multiplexer - * @irq: the interrupt number - * @desc: the interrupt description structure for this irq - * - * The cpu receives an interrupt on TR1 when an interrupt has - * occurred. It is this function's job to demux this irq and - * figure out exactly which trigger needs servicing. - */ -static void metag_internal_irq_demux(struct irq_desc *desc) -{ - struct metag_internal_irq_priv *priv = irq_desc_get_handler_data(desc); - irq_hw_number_t hw; - unsigned int irq_no; - u32 status; - -recalculate: - status = metag_in32(HWSTATMETA) & priv->unmasked; - - for (hw = 0; status != 0; status >>= 1, ++hw) { - if (status & 0x1) { - /* - * Map the hardware IRQ number to a virtual Linux IRQ - * number. - */ - irq_no = irq_linear_revmap(priv->domain, hw); - - /* - * Only fire off interrupts that are - * registered to be handled by the kernel. - * Other interrupts are probably being - * handled by other Meta hardware threads. - */ - generic_handle_irq(irq_no); - - /* - * The handler may have re-enabled interrupts - * which could have caused a nested invocation - * of this code and make the copy of the - * status register we are using invalid. - */ - goto recalculate; - } - } -} - -/** - * internal_irq_map() - Map an internal meta IRQ to a virtual IRQ number. - * @hw: Number of the internal IRQ. Must be in range. - * - * Returns: The virtual IRQ number of the Meta internal IRQ specified by - * @hw. - */ -int internal_irq_map(unsigned int hw) -{ - struct metag_internal_irq_priv *priv = &metag_internal_irq_priv; - if (!priv->domain) - return -ENODEV; - return irq_create_mapping(priv->domain, hw); -} - -/** - * metag_internal_irq_init_cpu - regsister with the Meta cpu - * @cpu: the CPU to register on - * - * Configure @cpu's TR1 irq so that we can demux irqs. - */ -static void metag_internal_irq_init_cpu(struct metag_internal_irq_priv *priv, - int cpu) -{ - unsigned int thread = cpu_2_hwthread_id[cpu]; - unsigned int signum = TBID_SIGNUM_TR1(thread); - int irq = tbisig_map(signum); - - /* Register the multiplexed IRQ handler */ - irq_set_chained_handler_and_data(irq, metag_internal_irq_demux, priv); - irq_set_irq_type(irq, IRQ_TYPE_LEVEL_LOW); -} - -/** - * metag_internal_intc_map() - map an internal irq - * @d: irq domain of internal trigger block - * @irq: virtual irq number - * @hw: hardware irq number within internal trigger block - * - * This sets up a virtual irq for a specified hardware interrupt. The irq chip - * and handler is configured. - */ -static int metag_internal_intc_map(struct irq_domain *d, unsigned int irq, - irq_hw_number_t hw) -{ - /* only register interrupt if it is mapped */ - if (!metag_hwvec_addr(hw)) - return -EINVAL; - - irq_set_chip_and_handler(irq, &internal_irq_edge_chip, - handle_edge_irq); - return 0; -} - -static const struct irq_domain_ops metag_internal_intc_domain_ops = { - .map = metag_internal_intc_map, -}; - -/** - * metag_internal_irq_register - register internal IRQs - * - * Register the irq chip and handler function for all internal IRQs - */ -int __init init_internal_IRQ(void) -{ - struct metag_internal_irq_priv *priv = &metag_internal_irq_priv; - unsigned int cpu; - - /* Set up an IRQ domain */ - priv->domain = irq_domain_add_linear(NULL, 32, - &metag_internal_intc_domain_ops, - priv); - if (unlikely(!priv->domain)) { - pr_err("meta-internal-intc: cannot add IRQ domain\n"); - return -ENOMEM; - } - - /* Setup TR1 for all cpus. */ - for_each_possible_cpu(cpu) - metag_internal_irq_init_cpu(priv, cpu); - - return 0; -}; diff --git a/include/linux/irqchip/metag-ext.h b/include/linux/irqchip/metag-ext.h deleted file mode 100644 index d120496370b97..0000000000000 --- a/include/linux/irqchip/metag-ext.h +++ /dev/null @@ -1,34 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Copyright (C) 2012 Imagination Technologies - */ - -#ifndef _LINUX_IRQCHIP_METAG_EXT_H_ -#define _LINUX_IRQCHIP_METAG_EXT_H_ - -struct irq_data; -struct platform_device; - -/* called from core irq code at init */ -int init_external_IRQ(void); - -/* - * called from SoC init_irq() callback to dynamically indicate the lack of - * HWMASKEXT registers. - */ -void meta_intc_no_mask(void); - -/* - * These allow SoCs to specialise the interrupt controller from their init_irq - * callbacks. - */ - -extern struct irq_chip meta_intc_edge_chip; -extern struct irq_chip meta_intc_level_chip; - -/* this should be called in the mask callback */ -void meta_intc_mask_irq_simple(struct irq_data *data); -/* this should be called in the unmask callback */ -void meta_intc_unmask_irq_simple(struct irq_data *data); - -#endif /* _LINUX_IRQCHIP_METAG_EXT_H_ */ diff --git a/include/linux/irqchip/metag.h b/include/linux/irqchip/metag.h deleted file mode 100644 index 0adcf449e4e4c..0000000000000 --- a/include/linux/irqchip/metag.h +++ /dev/null @@ -1,25 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Copyright (C) 2011 Imagination Technologies - */ - -#ifndef _LINUX_IRQCHIP_METAG_H_ -#define _LINUX_IRQCHIP_METAG_H_ - -#include - -#ifdef CONFIG_METAG_PERFCOUNTER_IRQS -extern int init_internal_IRQ(void); -extern int internal_irq_map(unsigned int hw); -#else -static inline int init_internal_IRQ(void) -{ - return 0; -} -static inline int internal_irq_map(unsigned int hw) -{ - return -EINVAL; -} -#endif - -#endif /* _LINUX_IRQCHIP_METAG_H_ */ -- GitLab From b79a732504ad2d6552458eaf72b4ed807da88340 Mon Sep 17 00:00:00 2001 From: James Hogan Date: Wed, 21 Feb 2018 15:42:32 +0000 Subject: [PATCH 06/74] clocksource: Remove metag generic timer driver Now that arch/metag/ has been removed, remove the metag generic per-thread timer driver. It is of no value without the architecture code. Signed-off-by: James Hogan Acked-by: Daniel Lezcano Cc: Thomas Gleixner Cc: linux-metag@vger.kernel.org --- drivers/clocksource/Kconfig | 5 - drivers/clocksource/Makefile | 1 - drivers/clocksource/metag_generic.c | 161 ---------------------------- include/clocksource/metag_generic.h | 21 ---- include/linux/cpuhotplug.h | 1 - 5 files changed, 189 deletions(-) delete mode 100644 drivers/clocksource/metag_generic.c delete mode 100644 include/clocksource/metag_generic.h diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig index b3b4ed9b68742..f99dbc2f7ee4e 100644 --- a/drivers/clocksource/Kconfig +++ b/drivers/clocksource/Kconfig @@ -391,11 +391,6 @@ config ATMEL_ST help Support for the Atmel ST timer. -config CLKSRC_METAG_GENERIC - def_bool y if METAG - help - This option enables support for the Meta per-thread timers. - config CLKSRC_EXYNOS_MCT bool "Exynos multi core timer driver" if COMPILE_TEST depends on ARM || ARM64 diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile index d6dec4489d66e..a2d47e9ecf91a 100644 --- a/drivers/clocksource/Makefile +++ b/drivers/clocksource/Makefile @@ -61,7 +61,6 @@ obj-$(CONFIG_ARM_ARCH_TIMER) += arm_arch_timer.o obj-$(CONFIG_ARM_GLOBAL_TIMER) += arm_global_timer.o obj-$(CONFIG_ARMV7M_SYSTICK) += armv7m_systick.o obj-$(CONFIG_ARM_TIMER_SP804) += timer-sp804.o -obj-$(CONFIG_CLKSRC_METAG_GENERIC) += metag_generic.o obj-$(CONFIG_ARCH_HAS_TICK_BROADCAST) += dummy_timer.o obj-$(CONFIG_KEYSTONE_TIMER) += timer-keystone.o obj-$(CONFIG_INTEGRATOR_AP_TIMER) += timer-integrator-ap.o diff --git a/drivers/clocksource/metag_generic.c b/drivers/clocksource/metag_generic.c deleted file mode 100644 index 3e5fa2f62d5f8..0000000000000 --- a/drivers/clocksource/metag_generic.c +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright (C) 2005-2013 Imagination Technologies Ltd. - * - * 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. - * - * 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, see . - * - * - * Support for Meta per-thread timers. - * - * Meta hardware threads have 2 timers. The background timer (TXTIMER) is used - * as a free-running time base (hz clocksource), and the interrupt timer - * (TXTIMERI) is used for the timer interrupt (clock event). Both counters - * traditionally count at approximately 1MHz. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#define HARDWARE_FREQ 1000000 /* 1MHz */ -#define HARDWARE_DIV 1 /* divide by 1 = 1MHz clock */ -#define HARDWARE_TO_NS_SHIFT 10 /* convert ticks to ns */ - -static unsigned int hwtimer_freq = HARDWARE_FREQ; -static DEFINE_PER_CPU(struct clock_event_device, local_clockevent); -static DEFINE_PER_CPU(char [11], local_clockevent_name); - -static int metag_timer_set_next_event(unsigned long delta, - struct clock_event_device *dev) -{ - __core_reg_set(TXTIMERI, -delta); - return 0; -} - -static u64 metag_clocksource_read(struct clocksource *cs) -{ - return __core_reg_get(TXTIMER); -} - -static struct clocksource clocksource_metag = { - .name = "META", - .rating = 200, - .mask = CLOCKSOURCE_MASK(32), - .read = metag_clocksource_read, - .flags = CLOCK_SOURCE_IS_CONTINUOUS, -}; - -static irqreturn_t metag_timer_interrupt(int irq, void *dummy) -{ - struct clock_event_device *evt = this_cpu_ptr(&local_clockevent); - - evt->event_handler(evt); - - return IRQ_HANDLED; -} - -static struct irqaction metag_timer_irq = { - .name = "META core timer", - .handler = metag_timer_interrupt, - .flags = IRQF_TIMER | IRQF_IRQPOLL | IRQF_PERCPU, -}; - -unsigned long long sched_clock(void) -{ - unsigned long long ticks = __core_reg_get(TXTIMER); - return ticks << HARDWARE_TO_NS_SHIFT; -} - -static int arch_timer_starting_cpu(unsigned int cpu) -{ - unsigned int txdivtime; - struct clock_event_device *clk = &per_cpu(local_clockevent, cpu); - char *name = per_cpu(local_clockevent_name, cpu); - - txdivtime = __core_reg_get(TXDIVTIME); - - txdivtime &= ~TXDIVTIME_DIV_BITS; - txdivtime |= (HARDWARE_DIV & TXDIVTIME_DIV_BITS); - - __core_reg_set(TXDIVTIME, txdivtime); - - sprintf(name, "META %d", cpu); - clk->name = name; - clk->features = CLOCK_EVT_FEAT_ONESHOT, - - clk->rating = 200, - clk->shift = 12, - clk->irq = tbisig_map(TBID_SIGNUM_TRT), - clk->set_next_event = metag_timer_set_next_event, - - clk->mult = div_sc(hwtimer_freq, NSEC_PER_SEC, clk->shift); - clk->max_delta_ns = clockevent_delta2ns(0x7fffffff, clk); - clk->max_delta_ticks = 0x7fffffff; - clk->min_delta_ns = clockevent_delta2ns(0xf, clk); - clk->min_delta_ticks = 0xf; - clk->cpumask = cpumask_of(cpu); - - clockevents_register_device(clk); - - /* - * For all non-boot CPUs we need to synchronize our free - * running clock (TXTIMER) with the boot CPU's clock. - * - * While this won't be accurate, it should be close enough. - */ - if (cpu) { - unsigned int thread0 = cpu_2_hwthread_id[0]; - unsigned long val; - - val = core_reg_read(TXUCT_ID, TXTIMER_REGNUM, thread0); - __core_reg_set(TXTIMER, val); - } - return 0; -} - -int __init metag_generic_timer_init(void) -{ - /* - * On Meta 2 SoCs, the actual frequency of the timer is based on the - * Meta core clock speed divided by an integer, so it is only - * approximately 1MHz. Calculating the real frequency here drastically - * reduces clock skew on these SoCs. - */ -#ifdef CONFIG_METAG_META21 - hwtimer_freq = get_coreclock() / (metag_in32(EXPAND_TIMER_DIV) + 1); -#endif - pr_info("Timer frequency: %u Hz\n", hwtimer_freq); - - clocksource_register_hz(&clocksource_metag, hwtimer_freq); - - setup_irq(tbisig_map(TBID_SIGNUM_TRT), &metag_timer_irq); - - /* Hook cpu boot to configure the CPU's timers */ - return cpuhp_setup_state(CPUHP_AP_METAG_TIMER_STARTING, - "clockevents/metag:starting", - arch_timer_starting_cpu, NULL); -} diff --git a/include/clocksource/metag_generic.h b/include/clocksource/metag_generic.h deleted file mode 100644 index ac17e7d06cfb8..0000000000000 --- a/include/clocksource/metag_generic.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (C) 2013 Imaginaton Technologies Ltd. - * - * 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. - * - * 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, see . - */ -#ifndef __CLKSOURCE_METAG_GENERIC_H -#define __CLKSOURCE_METAG_GENERIC_H - -extern int metag_generic_timer_init(void); - -#endif /* __CLKSOURCE_METAG_GENERIC_H */ diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h index c7a950681f3a4..5b211fe295f06 100644 --- a/include/linux/cpuhotplug.h +++ b/include/linux/cpuhotplug.h @@ -121,7 +121,6 @@ enum cpuhp_state { CPUHP_AP_JCORE_TIMER_STARTING, CPUHP_AP_EXYNOS4_MCT_TIMER_STARTING, CPUHP_AP_ARM_TWD_STARTING, - CPUHP_AP_METAG_TIMER_STARTING, CPUHP_AP_QCOM_TIMER_STARTING, CPUHP_AP_ARMADA_TIMER_STARTING, CPUHP_AP_MARCO_TIMER_STARTING, -- GitLab From 5ba484e79f1370fda5e43cd0da1f2a2a59895e81 Mon Sep 17 00:00:00 2001 From: James Hogan Date: Wed, 21 Feb 2018 15:37:54 +0000 Subject: [PATCH 07/74] tty: Remove metag DA TTY and console driver Now that arch/metag/ has been removed, remove the metag DA TTY and console driver. It is of no value without the architecture code. Signed-off-by: James Hogan Acked-by: Greg Kroah-Hartman Cc: Jiri Slaby Cc: linux-metag@vger.kernel.org --- drivers/tty/Kconfig | 13 - drivers/tty/Makefile | 1 - drivers/tty/metag_da.c | 665 ----------------------------------------- 3 files changed, 679 deletions(-) delete mode 100644 drivers/tty/metag_da.c diff --git a/drivers/tty/Kconfig b/drivers/tty/Kconfig index b811442c5ce67..75a71ebcb369d 100644 --- a/drivers/tty/Kconfig +++ b/drivers/tty/Kconfig @@ -402,19 +402,6 @@ config GOLDFISH_TTY_EARLY_CONSOLE default y if GOLDFISH_TTY=y select SERIAL_EARLYCON -config DA_TTY - bool "DA TTY" - depends on METAG_DA - select SERIAL_NONSTANDARD - help - This enables a TTY on a Dash channel. - -config DA_CONSOLE - bool "DA Console" - depends on DA_TTY - help - This enables a console on a Dash channel. - config MIPS_EJTAG_FDC_TTY bool "MIPS EJTAG Fast Debug Channel TTY" depends on MIPS_CDMM diff --git a/drivers/tty/Makefile b/drivers/tty/Makefile index 8ce3a8661b316..47c71f43a3979 100644 --- a/drivers/tty/Makefile +++ b/drivers/tty/Makefile @@ -32,7 +32,6 @@ obj-$(CONFIG_SYNCLINKMP) += synclinkmp.o obj-$(CONFIG_SYNCLINK) += synclink.o obj-$(CONFIG_PPC_EPAPR_HV_BYTECHAN) += ehv_bytechan.o obj-$(CONFIG_GOLDFISH_TTY) += goldfish.o -obj-$(CONFIG_DA_TTY) += metag_da.o obj-$(CONFIG_MIPS_EJTAG_FDC_TTY) += mips_ejtag_fdc.o obj-$(CONFIG_VCC) += vcc.o diff --git a/drivers/tty/metag_da.c b/drivers/tty/metag_da.c deleted file mode 100644 index 99eaed4b2dbcd..0000000000000 --- a/drivers/tty/metag_da.c +++ /dev/null @@ -1,665 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * dashtty.c - tty driver for Dash channels interface. - * - * Copyright (C) 2007,2008,2012 Imagination Technologies - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -/* Channel error codes */ -#define CONAOK 0 -#define CONERR 1 -#define CONBAD 2 -#define CONPRM 3 -#define CONADR 4 -#define CONCNT 5 -#define CONCBF 6 -#define CONCBE 7 -#define CONBSY 8 - -/* Default channel for the console */ -#define CONSOLE_CHANNEL 1 - -#define NUM_TTY_CHANNELS 6 - -/* Auto allocate */ -#define DA_TTY_MAJOR 0 - -/* A speedy poll rate helps the userland debug process connection response. - * But, if you set it too high then no other userland processes get much - * of a look in. - */ -#define DA_TTY_POLL (HZ / 50) - -/* - * A short put delay improves latency but has a high throughput overhead - */ -#define DA_TTY_PUT_DELAY (HZ / 100) - -static atomic_t num_channels_need_poll = ATOMIC_INIT(0); - -static struct timer_list poll_timer; - -static struct tty_driver *channel_driver; - -static struct timer_list put_timer; -static struct task_struct *dashtty_thread; - -/* - * The console_poll parameter determines whether the console channel should be - * polled for input. - * By default the console channel isn't polled at all, in order to avoid the - * overhead, but that means it isn't possible to have a login on /dev/console. - */ -static bool console_poll; -module_param(console_poll, bool, S_IRUGO); - -#define RX_BUF_SIZE 1024 - -enum { - INCHR = 1, - OUTCHR, - RDBUF, - WRBUF, - RDSTAT -}; - -/** - * struct dashtty_port - Wrapper struct for dashtty tty_port. - * @port: TTY port data - * @rx_lock: Lock for rx_buf. - * This protects between the poll timer and user context. - * It's also held during read SWITCH operations. - * @rx_buf: Read buffer - * @xmit_lock: Lock for xmit_*, and port.xmit_buf. - * This protects between user context and kernel thread. - * It's also held during write SWITCH operations. - * @xmit_cnt: Size of xmit buffer contents - * @xmit_head: Head of xmit buffer where data is written - * @xmit_tail: Tail of xmit buffer where data is read - * @xmit_empty: Completion for xmit buffer being empty - */ -struct dashtty_port { - struct tty_port port; - spinlock_t rx_lock; - void *rx_buf; - struct mutex xmit_lock; - unsigned int xmit_cnt; - unsigned int xmit_head; - unsigned int xmit_tail; - struct completion xmit_empty; -}; - -static struct dashtty_port dashtty_ports[NUM_TTY_CHANNELS]; - -static atomic_t dashtty_xmit_cnt = ATOMIC_INIT(0); -static wait_queue_head_t dashtty_waitqueue; - -/* - * Low-level DA channel access routines - */ -static int chancall(int in_bios_function, int in_channel, - int in_arg2, void *in_arg3, - void *in_arg4) -{ - register int bios_function asm("D1Ar1") = in_bios_function; - register int channel asm("D0Ar2") = in_channel; - register int arg2 asm("D1Ar3") = in_arg2; - register void *arg3 asm("D0Ar4") = in_arg3; - register void *arg4 asm("D1Ar5") = in_arg4; - register int bios_call asm("D0Ar6") = 3; - register int result asm("D0Re0"); - - asm volatile ( - "MSETL [A0StP++], %6,%4,%2\n\t" - "ADD A0StP, A0StP, #8\n\t" - "SWITCH #0x0C30208\n\t" - "GETD %0, [A0StP+#-8]\n\t" - "SUB A0StP, A0StP, #(4*6)+8\n\t" - : "=d" (result) /* outs */ - : "d" (bios_function), - "d" (channel), - "d" (arg2), - "d" (arg3), - "d" (arg4), - "d" (bios_call) /* ins */ - : "memory"); - - return result; -} - -/* - * Attempts to fetch count bytes from channel and returns actual count. - */ -static int fetch_data(unsigned int channel) -{ - struct dashtty_port *dport = &dashtty_ports[channel]; - int received = 0; - - spin_lock_bh(&dport->rx_lock); - /* check the port isn't being shut down */ - if (!dport->rx_buf) - goto unlock; - if (chancall(RDBUF, channel, RX_BUF_SIZE, - (void *)dport->rx_buf, &received) == CONAOK) { - if (received) { - int space; - unsigned char *cbuf; - - space = tty_prepare_flip_string(&dport->port, &cbuf, - received); - - if (space <= 0) - goto unlock; - - memcpy(cbuf, dport->rx_buf, space); - tty_flip_buffer_push(&dport->port); - } - } -unlock: - spin_unlock_bh(&dport->rx_lock); - - return received; -} - -/** - * find_channel_to_poll() - Returns number of the next channel to poll. - * Returns: The number of the next channel to poll, or -1 if none need - * polling. - */ -static int find_channel_to_poll(void) -{ - static int last_polled_channel; - int last = last_polled_channel; - int chan; - struct dashtty_port *dport; - - for (chan = last + 1; ; ++chan) { - if (chan >= NUM_TTY_CHANNELS) - chan = 0; - - dport = &dashtty_ports[chan]; - if (dport->rx_buf) { - last_polled_channel = chan; - return chan; - } - - if (chan == last) - break; - } - return -1; -} - -/** - * put_channel_data() - Write out a block of channel data. - * @chan: DA channel number. - * - * Write a single block of data out to the debug adapter. If the circular buffer - * is wrapped then only the first block is written. - * - * Returns: 1 if the remote buffer was too full to accept data. - * 0 otherwise. - */ -static int put_channel_data(unsigned int chan) -{ - struct dashtty_port *dport; - struct tty_struct *tty; - int number_written; - unsigned int count = 0; - - dport = &dashtty_ports[chan]; - mutex_lock(&dport->xmit_lock); - if (dport->xmit_cnt) { - count = min((unsigned int)(SERIAL_XMIT_SIZE - dport->xmit_tail), - dport->xmit_cnt); - chancall(WRBUF, chan, count, - dport->port.xmit_buf + dport->xmit_tail, - &number_written); - dport->xmit_cnt -= number_written; - if (!dport->xmit_cnt) { - /* reset pointers to avoid wraps */ - dport->xmit_head = 0; - dport->xmit_tail = 0; - complete(&dport->xmit_empty); - } else { - dport->xmit_tail += number_written; - if (dport->xmit_tail >= SERIAL_XMIT_SIZE) - dport->xmit_tail -= SERIAL_XMIT_SIZE; - } - atomic_sub(number_written, &dashtty_xmit_cnt); - } - mutex_unlock(&dport->xmit_lock); - - /* if we've made more data available, wake up tty */ - if (count && number_written) { - tty = tty_port_tty_get(&dport->port); - if (tty) { - tty_wakeup(tty); - tty_kref_put(tty); - } - } - - /* did the write fail? */ - return count && !number_written; -} - -/** - * put_data() - Kernel thread to write out blocks of channel data to DA. - * @arg: Unused. - * - * This kernel thread runs while @dashtty_xmit_cnt != 0, and loops over the - * channels to write out any buffered data. If any of the channels stall due to - * the remote buffer being full, a hold off happens to allow the debugger to - * drain the buffer. - */ -static int put_data(void *arg) -{ - unsigned int chan, stall; - - __set_current_state(TASK_RUNNING); - while (!kthread_should_stop()) { - /* - * For each channel see if there's anything to transmit in the - * port's xmit_buf. - */ - stall = 0; - for (chan = 0; chan < NUM_TTY_CHANNELS; ++chan) - stall += put_channel_data(chan); - - /* - * If some of the buffers are full, hold off for a short while - * to allow them to empty. - */ - if (stall) - msleep(25); - - wait_event_interruptible(dashtty_waitqueue, - atomic_read(&dashtty_xmit_cnt)); - } - - return 0; -} - -/* - * This gets called every DA_TTY_POLL and polls the channels for data - */ -static void dashtty_timer(struct timer_list *poll_timer) -{ - int channel; - - /* If there are no ports open do nothing and don't poll again. */ - if (!atomic_read(&num_channels_need_poll)) - return; - - channel = find_channel_to_poll(); - - /* Did we find a channel to poll? */ - if (channel >= 0) - fetch_data(channel); - - mod_timer(poll_timer, jiffies + DA_TTY_POLL); -} - -static void add_poll_timer(struct timer_list *poll_timer) -{ - timer_setup(poll_timer, dashtty_timer, TIMER_PINNED); - poll_timer->expires = jiffies + DA_TTY_POLL; - - /* - * Always attach the timer to the boot CPU. The DA channels are per-CPU - * so all polling should be from a single CPU. - */ - add_timer_on(poll_timer, 0); -} - -static int dashtty_port_activate(struct tty_port *port, struct tty_struct *tty) -{ - struct dashtty_port *dport = container_of(port, struct dashtty_port, - port); - void *rx_buf; - - /* Allocate the buffer we use for writing data */ - if (tty_port_alloc_xmit_buf(port) < 0) - goto err; - - /* Allocate the buffer we use for reading data */ - rx_buf = kzalloc(RX_BUF_SIZE, GFP_KERNEL); - if (!rx_buf) - goto err_free_xmit; - - spin_lock_bh(&dport->rx_lock); - dport->rx_buf = rx_buf; - spin_unlock_bh(&dport->rx_lock); - - /* - * Don't add the poll timer if we're opening a console. This - * avoids the overhead of polling the Dash but means it is not - * possible to have a login on /dev/console. - * - */ - if (console_poll || dport != &dashtty_ports[CONSOLE_CHANNEL]) - if (atomic_inc_return(&num_channels_need_poll) == 1) - add_poll_timer(&poll_timer); - - return 0; -err_free_xmit: - tty_port_free_xmit_buf(port); -err: - return -ENOMEM; -} - -static void dashtty_port_shutdown(struct tty_port *port) -{ - struct dashtty_port *dport = container_of(port, struct dashtty_port, - port); - void *rx_buf; - unsigned int count; - - /* stop reading */ - if (console_poll || dport != &dashtty_ports[CONSOLE_CHANNEL]) - if (atomic_dec_and_test(&num_channels_need_poll)) - del_timer_sync(&poll_timer); - - mutex_lock(&dport->xmit_lock); - count = dport->xmit_cnt; - mutex_unlock(&dport->xmit_lock); - if (count) { - /* - * There's still data to write out, so wake and wait for the - * writer thread to drain the buffer. - */ - del_timer(&put_timer); - wake_up_interruptible(&dashtty_waitqueue); - wait_for_completion(&dport->xmit_empty); - } - - /* Null the read buffer (timer could still be running!) */ - spin_lock_bh(&dport->rx_lock); - rx_buf = dport->rx_buf; - dport->rx_buf = NULL; - spin_unlock_bh(&dport->rx_lock); - /* Free the read buffer */ - kfree(rx_buf); - - /* Free the write buffer */ - tty_port_free_xmit_buf(port); -} - -static const struct tty_port_operations dashtty_port_ops = { - .activate = dashtty_port_activate, - .shutdown = dashtty_port_shutdown, -}; - -static int dashtty_install(struct tty_driver *driver, struct tty_struct *tty) -{ - return tty_port_install(&dashtty_ports[tty->index].port, driver, tty); -} - -static int dashtty_open(struct tty_struct *tty, struct file *filp) -{ - return tty_port_open(tty->port, tty, filp); -} - -static void dashtty_close(struct tty_struct *tty, struct file *filp) -{ - return tty_port_close(tty->port, tty, filp); -} - -static void dashtty_hangup(struct tty_struct *tty) -{ - int channel; - struct dashtty_port *dport; - - channel = tty->index; - dport = &dashtty_ports[channel]; - - /* drop any data in the xmit buffer */ - mutex_lock(&dport->xmit_lock); - if (dport->xmit_cnt) { - atomic_sub(dport->xmit_cnt, &dashtty_xmit_cnt); - dport->xmit_cnt = 0; - dport->xmit_head = 0; - dport->xmit_tail = 0; - complete(&dport->xmit_empty); - } - mutex_unlock(&dport->xmit_lock); - - tty_port_hangup(tty->port); -} - -/** - * dashtty_put_timer() - Delayed wake up of kernel thread. - * @ignored: unused - * - * This timer function wakes up the kernel thread if any data exists in the - * buffers. It is used to delay the expensive writeout until the writer has - * stopped writing. - */ -static void dashtty_put_timer(struct timer_list *unused) -{ - if (atomic_read(&dashtty_xmit_cnt)) - wake_up_interruptible(&dashtty_waitqueue); -} - -static int dashtty_write(struct tty_struct *tty, const unsigned char *buf, - int total) -{ - int channel, count, block; - struct dashtty_port *dport; - - /* Determine the channel */ - channel = tty->index; - dport = &dashtty_ports[channel]; - - /* - * Write to output buffer. - * - * The reason that we asynchronously write the buffer is because if we - * were to write the buffer synchronously then because DA channels are - * per-CPU the buffer would be written to the channel of whatever CPU - * we're running on. - * - * What we actually want to happen is have all input and output done on - * one CPU. - */ - mutex_lock(&dport->xmit_lock); - /* work out how many bytes we can write to the xmit buffer */ - total = min(total, (int)(SERIAL_XMIT_SIZE - dport->xmit_cnt)); - atomic_add(total, &dashtty_xmit_cnt); - dport->xmit_cnt += total; - /* write the actual bytes (may need splitting if it wraps) */ - for (count = total; count; count -= block) { - block = min(count, (int)(SERIAL_XMIT_SIZE - dport->xmit_head)); - memcpy(dport->port.xmit_buf + dport->xmit_head, buf, block); - dport->xmit_head += block; - if (dport->xmit_head >= SERIAL_XMIT_SIZE) - dport->xmit_head -= SERIAL_XMIT_SIZE; - buf += block; - } - count = dport->xmit_cnt; - /* xmit buffer no longer empty? */ - if (count) - reinit_completion(&dport->xmit_empty); - mutex_unlock(&dport->xmit_lock); - - if (total) { - /* - * If the buffer is full, wake up the kthread, otherwise allow - * some more time for the buffer to fill up a bit before waking - * it. - */ - if (count == SERIAL_XMIT_SIZE) { - del_timer(&put_timer); - wake_up_interruptible(&dashtty_waitqueue); - } else { - mod_timer(&put_timer, jiffies + DA_TTY_PUT_DELAY); - } - } - return total; -} - -static int dashtty_write_room(struct tty_struct *tty) -{ - struct dashtty_port *dport; - int channel; - int room; - - channel = tty->index; - dport = &dashtty_ports[channel]; - - /* report the space in the xmit buffer */ - mutex_lock(&dport->xmit_lock); - room = SERIAL_XMIT_SIZE - dport->xmit_cnt; - mutex_unlock(&dport->xmit_lock); - - return room; -} - -static int dashtty_chars_in_buffer(struct tty_struct *tty) -{ - struct dashtty_port *dport; - int channel; - int chars; - - channel = tty->index; - dport = &dashtty_ports[channel]; - - /* report the number of bytes in the xmit buffer */ - mutex_lock(&dport->xmit_lock); - chars = dport->xmit_cnt; - mutex_unlock(&dport->xmit_lock); - - return chars; -} - -static const struct tty_operations dashtty_ops = { - .install = dashtty_install, - .open = dashtty_open, - .close = dashtty_close, - .hangup = dashtty_hangup, - .write = dashtty_write, - .write_room = dashtty_write_room, - .chars_in_buffer = dashtty_chars_in_buffer, -}; - -static int __init dashtty_init(void) -{ - int ret; - int nport; - struct dashtty_port *dport; - - if (!metag_da_enabled()) - return -ENODEV; - - channel_driver = tty_alloc_driver(NUM_TTY_CHANNELS, - TTY_DRIVER_REAL_RAW); - if (IS_ERR(channel_driver)) - return PTR_ERR(channel_driver); - - channel_driver->driver_name = "metag_da"; - channel_driver->name = "ttyDA"; - channel_driver->major = DA_TTY_MAJOR; - channel_driver->minor_start = 0; - channel_driver->type = TTY_DRIVER_TYPE_SERIAL; - channel_driver->subtype = SERIAL_TYPE_NORMAL; - channel_driver->init_termios = tty_std_termios; - channel_driver->init_termios.c_cflag |= CLOCAL; - - tty_set_operations(channel_driver, &dashtty_ops); - for (nport = 0; nport < NUM_TTY_CHANNELS; nport++) { - dport = &dashtty_ports[nport]; - tty_port_init(&dport->port); - dport->port.ops = &dashtty_port_ops; - spin_lock_init(&dport->rx_lock); - mutex_init(&dport->xmit_lock); - /* the xmit buffer starts empty, i.e. completely written */ - init_completion(&dport->xmit_empty); - complete(&dport->xmit_empty); - } - - timer_setup(&put_timer, dashtty_put_timer, 0); - - init_waitqueue_head(&dashtty_waitqueue); - dashtty_thread = kthread_create(put_data, NULL, "ttyDA"); - if (IS_ERR(dashtty_thread)) { - pr_err("Couldn't create dashtty thread\n"); - ret = PTR_ERR(dashtty_thread); - goto err_destroy_ports; - } - /* - * Bind the writer thread to the boot CPU so it can't migrate. - * DA channels are per-CPU and we want all channel I/O to be on a single - * predictable CPU. - */ - kthread_bind(dashtty_thread, 0); - wake_up_process(dashtty_thread); - - ret = tty_register_driver(channel_driver); - - if (ret < 0) { - pr_err("Couldn't install dashtty driver: err %d\n", - ret); - goto err_stop_kthread; - } - - return 0; - -err_stop_kthread: - kthread_stop(dashtty_thread); -err_destroy_ports: - for (nport = 0; nport < NUM_TTY_CHANNELS; nport++) { - dport = &dashtty_ports[nport]; - tty_port_destroy(&dport->port); - } - put_tty_driver(channel_driver); - return ret; -} -device_initcall(dashtty_init); - -#ifdef CONFIG_DA_CONSOLE - -static void dash_console_write(struct console *co, const char *s, - unsigned int count) -{ - int actually_written; - - chancall(WRBUF, CONSOLE_CHANNEL, count, (void *)s, &actually_written); -} - -static struct tty_driver *dash_console_device(struct console *c, int *index) -{ - *index = c->index; - return channel_driver; -} - -struct console dash_console = { - .name = "ttyDA", - .write = dash_console_write, - .device = dash_console_device, - .flags = CON_PRINTBUFFER, - .index = 1, -}; - -#endif -- GitLab From 0b658a1e9a58bdbe4863256a02f0b19f42de7acc Mon Sep 17 00:00:00 2001 From: James Hogan Date: Tue, 24 Oct 2017 13:12:51 +0100 Subject: [PATCH 08/74] MAINTAINERS/CREDITS: Drop METAG ARCHITECTURE The core Meta architecture support has now been removed, so drop the MAINTAINERS entry and add an entry to CREDITS. Signed-off-by: James Hogan Cc: linux-metag@vger.kernel.org --- CREDITS | 5 +++++ MAINTAINERS | 14 -------------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/CREDITS b/CREDITS index a3ec0c7441724..989cda91c427d 100644 --- a/CREDITS +++ b/CREDITS @@ -1564,6 +1564,11 @@ W: http://www.carumba.com/ D: bug toaster (A1 sauce makes all the difference) D: Random linux hacker +N: James Hogan +E: jhogan@kernel.org +D: Metag architecture maintainer +D: TZ1090 SoC maintainer + N: Tim Hockin E: thockin@hockin.org W: http://www.hockin.org/~thockin diff --git a/MAINTAINERS b/MAINTAINERS index 9a7f76eadae9a..d5ddf19e76bb3 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -9081,20 +9081,6 @@ F: drivers/media/platform/meson/ao-cec.c F: Documentation/devicetree/bindings/media/meson-ao-cec.txt T: git git://linuxtv.org/media_tree.git -METAG ARCHITECTURE -M: James Hogan -L: linux-metag@vger.kernel.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/jhogan/metag.git -S: Odd Fixes -F: arch/metag/ -F: Documentation/metag/ -F: Documentation/devicetree/bindings/metag/ -F: Documentation/devicetree/bindings/interrupt-controller/img,* -F: drivers/clocksource/metag_generic.c -F: drivers/irqchip/irq-metag.c -F: drivers/irqchip/irq-metag-ext.c -F: drivers/tty/metag_da.c - MICROBLAZE ARCHITECTURE M: Michal Simek W: http://www.monstr.eu/fdt/ -- GitLab From b9b2909093ede6f0cea2beff201264f431504de3 Mon Sep 17 00:00:00 2001 From: James Hogan Date: Wed, 21 Feb 2018 16:38:06 +0000 Subject: [PATCH 09/74] watchdog: imgpdc: Drop METAG dependency Now that arch/metag/ has been removed, remove the METAG dependency from the IMG IR device driver. The hardware is also present on MIPS SoCs so the driver still has value. Signed-off-by: James Hogan Acked-by: Guenter Roeck Cc: Wim Van Sebroeck Cc: linux-watchdog@vger.kernel.org Cc: linux-metag@vger.kernel.org --- drivers/watchdog/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index aff773bcebdb5..152268010c45f 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -1602,7 +1602,7 @@ config BCM7038_WDT config IMGPDC_WDT tristate "Imagination Technologies PDC Watchdog Timer" depends on HAS_IOMEM - depends on METAG || MIPS || COMPILE_TEST + depends on MIPS || COMPILE_TEST select WATCHDOG_CORE help Driver for Imagination Technologies PowerDown Controller -- GitLab From 43e951e744462bf10c2dc8548263095ed4aa9e7d Mon Sep 17 00:00:00 2001 From: James Hogan Date: Wed, 21 Feb 2018 16:02:10 +0000 Subject: [PATCH 10/74] media: img-ir: Drop METAG dependency Now that arch/metag/ has been removed, remove the METAG dependency from the IMG IR device driver. The hardware is also present on MIPS SoCs so the driver still has value. Signed-off-by: James Hogan Acked-by: Sean Young Cc: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org Cc: linux-metag@vger.kernel.org --- drivers/media/rc/img-ir/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/rc/img-ir/Kconfig b/drivers/media/rc/img-ir/Kconfig index a896d3c83a1c3..d2c6617d468e4 100644 --- a/drivers/media/rc/img-ir/Kconfig +++ b/drivers/media/rc/img-ir/Kconfig @@ -1,7 +1,7 @@ config IR_IMG tristate "ImgTec IR Decoder" depends on RC_CORE - depends on METAG || MIPS || COMPILE_TEST + depends on MIPS || COMPILE_TEST select IR_IMG_HW if !IR_IMG_RAW help Say Y or M here if you want to use the ImgTec infrared decoder -- GitLab From 8d06c3302635f0ab426937f2bb10e9b9c34087e4 Mon Sep 17 00:00:00 2001 From: James Hogan Date: Wed, 21 Feb 2018 15:54:54 +0000 Subject: [PATCH 11/74] i2c: img-scb: Drop METAG dependency Now that arch/metag/ has been removed, remove the METAG dependency from the IMG SCB I2C device driver. The hardware is also present on MIPS SoCs so the driver still has value. Signed-off-by: James Hogan Acked-by: Wolfram Sang Cc: linux-i2c@vger.kernel.org Cc: linux-metag@vger.kernel.org --- drivers/i2c/busses/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index a9805c7cb305a..94f419489a0b6 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig @@ -635,7 +635,7 @@ config I2C_IBM_IIC config I2C_IMG tristate "Imagination Technologies I2C SCB Controller" - depends on MIPS || METAG || COMPILE_TEST + depends on MIPS || COMPILE_TEST help Say Y here if you want to use the IMG I2C SCB controller, available on the TZ1090 and other IMG SoCs. -- GitLab From 739d875dd6982618020d30f58f8acf10f6076e6d Mon Sep 17 00:00:00 2001 From: David Howells Date: Thu, 8 Mar 2018 09:48:46 +0000 Subject: [PATCH 12/74] mn10300: Remove the architecture Remove the MN10300 arch as the hardware is defunct. Suggested-by: Arnd Bergmann Signed-off-by: David Howells cc: Masahiro Yamada cc: linux-am33-list@redhat.com Signed-off-by: Arnd Bergmann --- Documentation/00-INDEX | 2 - .../features/core/BPF-JIT/arch-support.txt | 1 - .../core/generic-idle-thread/arch-support.txt | 1 - .../core/jump-labels/arch-support.txt | 1 - .../features/core/tracehook/arch-support.txt | 1 - .../features/debug/KASAN/arch-support.txt | 1 - .../debug/gcov-profile-all/arch-support.txt | 1 - .../features/debug/kgdb/arch-support.txt | 1 - .../debug/kprobes-on-ftrace/arch-support.txt | 1 - .../features/debug/kprobes/arch-support.txt | 1 - .../debug/kretprobes/arch-support.txt | 1 - .../features/debug/optprobes/arch-support.txt | 1 - .../debug/stackprotector/arch-support.txt | 1 - .../features/debug/uprobes/arch-support.txt | 1 - .../debug/user-ret-profiler/arch-support.txt | 1 - .../io/dma-api-debug/arch-support.txt | 1 - .../io/dma-contiguous/arch-support.txt | 1 - .../features/io/sg-chain/arch-support.txt | 1 - .../features/lib/strncasecmp/arch-support.txt | 1 - .../locking/cmpxchg-local/arch-support.txt | 1 - .../features/locking/lockdep/arch-support.txt | 1 - .../locking/queued-rwlocks/arch-support.txt | 1 - .../locking/queued-spinlocks/arch-support.txt | 1 - .../locking/rwsem-optimized/arch-support.txt | 1 - .../perf/kprobes-event/arch-support.txt | 1 - .../features/perf/perf-regs/arch-support.txt | 1 - .../perf/perf-stackdump/arch-support.txt | 1 - .../membarrier-sync-core/arch-support.txt | 1 - .../sched/numa-balancing/arch-support.txt | 1 - .../seccomp/seccomp-filter/arch-support.txt | 1 - .../time/arch-tick-broadcast/arch-support.txt | 1 - .../time/clockevents/arch-support.txt | 1 - .../time/context-tracking/arch-support.txt | 1 - .../time/irq-time-acct/arch-support.txt | 1 - .../time/modern-timekeeping/arch-support.txt | 1 - .../time/virt-cpuacct/arch-support.txt | 1 - .../features/vm/ELF-ASLR/arch-support.txt | 1 - .../features/vm/PG_uncached/arch-support.txt | 1 - .../features/vm/THP/arch-support.txt | 1 - .../features/vm/TLB/arch-support.txt | 1 - .../features/vm/huge-vmap/arch-support.txt | 1 - .../features/vm/ioremap_prot/arch-support.txt | 1 - .../vm/numa-memblock/arch-support.txt | 1 - .../features/vm/pte_special/arch-support.txt | 1 - Documentation/mn10300/ABI.txt | 149 -- .../mn10300/compartmentalisation.txt | 60 - MAINTAINERS | 8 - arch/mn10300/Kconfig | 499 ----- arch/mn10300/Kconfig.debug | 156 -- arch/mn10300/Makefile | 99 - arch/mn10300/boot/.gitignore | 1 - arch/mn10300/boot/Makefile | 28 - arch/mn10300/boot/compressed/Makefile | 22 - arch/mn10300/boot/compressed/head.S | 151 -- arch/mn10300/boot/compressed/misc.c | 393 ---- arch/mn10300/boot/compressed/misc.h | 18 - arch/mn10300/boot/compressed/vmlinux.lds | 9 - arch/mn10300/boot/install.sh | 67 - arch/mn10300/boot/tools/build.c | 191 -- arch/mn10300/configs/asb2303_defconfig | 67 - arch/mn10300/configs/asb2364_defconfig | 87 - arch/mn10300/include/asm/Kbuild | 13 - arch/mn10300/include/asm/asm-offsets.h | 1 - arch/mn10300/include/asm/atomic.h | 161 -- arch/mn10300/include/asm/bitops.h | 232 -- arch/mn10300/include/asm/bug.h | 37 - arch/mn10300/include/asm/bugs.h | 20 - arch/mn10300/include/asm/busctl-regs.h | 151 -- arch/mn10300/include/asm/cache.h | 60 - arch/mn10300/include/asm/cacheflush.h | 164 -- arch/mn10300/include/asm/checksum.h | 79 - arch/mn10300/include/asm/cmpxchg.h | 115 - arch/mn10300/include/asm/cpu-regs.h | 353 --- arch/mn10300/include/asm/current.h | 37 - arch/mn10300/include/asm/debugger.h | 43 - arch/mn10300/include/asm/delay.h | 19 - arch/mn10300/include/asm/div64.h | 115 - arch/mn10300/include/asm/dma-mapping.h | 21 - arch/mn10300/include/asm/dma.h | 117 - arch/mn10300/include/asm/dmactl-regs.h | 16 - arch/mn10300/include/asm/elf.h | 153 -- arch/mn10300/include/asm/emergency-restart.h | 1 - arch/mn10300/include/asm/exceptions.h | 121 -- arch/mn10300/include/asm/fpu.h | 132 -- arch/mn10300/include/asm/frame.inc | 97 - arch/mn10300/include/asm/ftrace.h | 1 - arch/mn10300/include/asm/futex.h | 1 - arch/mn10300/include/asm/gdb-stub.h | 182 -- arch/mn10300/include/asm/hardirq.h | 49 - arch/mn10300/include/asm/highmem.h | 131 -- arch/mn10300/include/asm/hw_irq.h | 14 - arch/mn10300/include/asm/intctl-regs.h | 71 - arch/mn10300/include/asm/io.h | 325 --- arch/mn10300/include/asm/irq.h | 40 - arch/mn10300/include/asm/irq_regs.h | 28 - arch/mn10300/include/asm/irqflags.h | 215 -- arch/mn10300/include/asm/kdebug.h | 22 - arch/mn10300/include/asm/kgdb.h | 81 - arch/mn10300/include/asm/kmap_types.h | 7 - arch/mn10300/include/asm/kprobes.h | 55 - arch/mn10300/include/asm/linkage.h | 20 - arch/mn10300/include/asm/local.h | 1 - arch/mn10300/include/asm/local64.h | 1 - arch/mn10300/include/asm/mc146818rtc.h | 1 - arch/mn10300/include/asm/mmu.h | 20 - arch/mn10300/include/asm/mmu_context.h | 163 -- arch/mn10300/include/asm/module.h | 22 - arch/mn10300/include/asm/nmi.h | 16 - arch/mn10300/include/asm/page.h | 130 -- arch/mn10300/include/asm/page_offset.h | 12 - arch/mn10300/include/asm/pci.h | 84 - arch/mn10300/include/asm/percpu.h | 1 - arch/mn10300/include/asm/pgalloc.h | 56 - arch/mn10300/include/asm/pgtable.h | 494 ----- arch/mn10300/include/asm/pio-regs.h | 233 -- arch/mn10300/include/asm/processor.h | 171 -- arch/mn10300/include/asm/ptrace.h | 26 - arch/mn10300/include/asm/reset-regs.h | 60 - arch/mn10300/include/asm/rtc-regs.h | 86 - arch/mn10300/include/asm/rtc.h | 28 - arch/mn10300/include/asm/rwlock.h | 125 -- arch/mn10300/include/asm/serial-regs.h | 191 -- arch/mn10300/include/asm/serial.h | 36 - arch/mn10300/include/asm/setup.h | 18 - arch/mn10300/include/asm/shmparam.h | 7 - arch/mn10300/include/asm/signal.h | 33 - arch/mn10300/include/asm/smp.h | 109 - arch/mn10300/include/asm/smsc911x.h | 1 - arch/mn10300/include/asm/spinlock.h | 180 -- arch/mn10300/include/asm/spinlock_types.h | 21 - arch/mn10300/include/asm/string.h | 32 - arch/mn10300/include/asm/switch_to.h | 49 - arch/mn10300/include/asm/syscall.h | 117 - arch/mn10300/include/asm/termios.h | 14 - arch/mn10300/include/asm/thread_info.h | 160 -- arch/mn10300/include/asm/timer-regs.h | 452 ---- arch/mn10300/include/asm/timex.h | 34 - arch/mn10300/include/asm/tlb.h | 34 - arch/mn10300/include/asm/tlbflush.h | 154 -- arch/mn10300/include/asm/topology.h | 1 - arch/mn10300/include/asm/types.h | 22 - arch/mn10300/include/asm/uaccess.h | 297 --- arch/mn10300/include/asm/ucontext.h | 22 - arch/mn10300/include/asm/unaligned.h | 20 - arch/mn10300/include/asm/unistd.h | 47 - arch/mn10300/include/asm/user.h | 53 - arch/mn10300/include/asm/vga.h | 17 - arch/mn10300/include/asm/xor.h | 1 - arch/mn10300/include/uapi/asm/Kbuild | 6 - arch/mn10300/include/uapi/asm/auxvec.h | 4 - arch/mn10300/include/uapi/asm/bitsperlong.h | 2 - arch/mn10300/include/uapi/asm/byteorder.h | 7 - arch/mn10300/include/uapi/asm/errno.h | 2 - arch/mn10300/include/uapi/asm/fcntl.h | 2 - arch/mn10300/include/uapi/asm/ioctl.h | 2 - arch/mn10300/include/uapi/asm/ioctls.h | 7 - arch/mn10300/include/uapi/asm/ipcbuf.h | 2 - arch/mn10300/include/uapi/asm/kvm_para.h | 2 - arch/mn10300/include/uapi/asm/mman.h | 7 - arch/mn10300/include/uapi/asm/msgbuf.h | 32 - arch/mn10300/include/uapi/asm/param.h | 19 - arch/mn10300/include/uapi/asm/posix_types.h | 46 - arch/mn10300/include/uapi/asm/ptrace.h | 85 - arch/mn10300/include/uapi/asm/resource.h | 2 - arch/mn10300/include/uapi/asm/sembuf.h | 26 - arch/mn10300/include/uapi/asm/setup.h | 5 - arch/mn10300/include/uapi/asm/shmbuf.h | 43 - arch/mn10300/include/uapi/asm/sigcontext.h | 53 - arch/mn10300/include/uapi/asm/signal.h | 126 -- arch/mn10300/include/uapi/asm/socket.h | 108 - arch/mn10300/include/uapi/asm/sockios.h | 14 - arch/mn10300/include/uapi/asm/stat.h | 79 - arch/mn10300/include/uapi/asm/statfs.h | 1 - arch/mn10300/include/uapi/asm/swab.h | 43 - arch/mn10300/include/uapi/asm/termbits.h | 202 -- arch/mn10300/include/uapi/asm/termios.h | 84 - arch/mn10300/include/uapi/asm/types.h | 12 - arch/mn10300/include/uapi/asm/unistd.h | 355 --- arch/mn10300/kernel/Makefile | 29 - arch/mn10300/kernel/asm-offsets.c | 108 - arch/mn10300/kernel/cevt-mn10300.c | 137 -- arch/mn10300/kernel/csrc-mn10300.c | 34 - arch/mn10300/kernel/entry.S | 772 ------- arch/mn10300/kernel/fpu-low.S | 258 --- arch/mn10300/kernel/fpu-nofpu-low.S | 39 - arch/mn10300/kernel/fpu-nofpu.c | 31 - arch/mn10300/kernel/fpu.c | 177 -- arch/mn10300/kernel/gdb-io-serial-low.S | 91 - arch/mn10300/kernel/gdb-io-serial.c | 174 -- arch/mn10300/kernel/gdb-io-ttysm-low.S | 93 - arch/mn10300/kernel/gdb-io-ttysm.c | 303 --- arch/mn10300/kernel/gdb-low.S | 115 - arch/mn10300/kernel/gdb-stub.c | 1924 ----------------- arch/mn10300/kernel/head.S | 442 ---- arch/mn10300/kernel/internal.h | 40 - arch/mn10300/kernel/io.c | 30 - arch/mn10300/kernel/irq.c | 356 --- arch/mn10300/kernel/kgdb.c | 502 ----- arch/mn10300/kernel/kprobes.c | 656 ------ arch/mn10300/kernel/mn10300-debug.c | 58 - arch/mn10300/kernel/mn10300-serial-low.S | 194 -- arch/mn10300/kernel/mn10300-serial.c | 1790 --------------- arch/mn10300/kernel/mn10300-serial.h | 130 -- arch/mn10300/kernel/mn10300-watchdog-low.S | 66 - arch/mn10300/kernel/mn10300-watchdog.c | 205 -- arch/mn10300/kernel/mn10300_ksyms.c | 39 - arch/mn10300/kernel/module.c | 156 -- arch/mn10300/kernel/process.c | 175 -- arch/mn10300/kernel/profile-low.S | 72 - arch/mn10300/kernel/profile.c | 51 - arch/mn10300/kernel/ptrace.c | 386 ---- arch/mn10300/kernel/rtc.c | 46 - arch/mn10300/kernel/setup.c | 283 --- arch/mn10300/kernel/sigframe.h | 33 - arch/mn10300/kernel/signal.c | 431 ---- arch/mn10300/kernel/smp-low.S | 97 - arch/mn10300/kernel/smp.c | 1186 ---------- arch/mn10300/kernel/switch_to.S | 179 -- arch/mn10300/kernel/sys_mn10300.c | 33 - arch/mn10300/kernel/time.c | 125 -- arch/mn10300/kernel/traps.c | 615 ------ arch/mn10300/kernel/vmlinux.lds.S | 94 - arch/mn10300/lib/Makefile | 7 - arch/mn10300/lib/__ashldi3.S | 51 - arch/mn10300/lib/__ashrdi3.S | 52 - arch/mn10300/lib/__lshrdi3.S | 52 - arch/mn10300/lib/__ucmpdi2.S | 43 - arch/mn10300/lib/ashrdi3.c | 61 - arch/mn10300/lib/bitops.c | 50 - arch/mn10300/lib/checksum.c | 100 - arch/mn10300/lib/delay.c | 51 - arch/mn10300/lib/do_csum.S | 157 -- arch/mn10300/lib/internal.h | 15 - arch/mn10300/lib/lshrdi3.c | 60 - arch/mn10300/lib/memcpy.S | 135 -- arch/mn10300/lib/memmove.S | 160 -- arch/mn10300/lib/memset.S | 121 -- arch/mn10300/lib/negdi2.c | 57 - arch/mn10300/lib/usercopy.c | 142 -- arch/mn10300/mm/Kconfig.cache | 148 -- arch/mn10300/mm/Makefile | 32 - arch/mn10300/mm/cache-dbg-flush-by-reg.S | 160 -- arch/mn10300/mm/cache-dbg-flush-by-tag.S | 114 - arch/mn10300/mm/cache-dbg-inv-by-reg.S | 69 - arch/mn10300/mm/cache-dbg-inv-by-tag.S | 120 - arch/mn10300/mm/cache-dbg-inv.S | 47 - arch/mn10300/mm/cache-disabled.c | 21 - arch/mn10300/mm/cache-flush-by-reg.S | 308 --- arch/mn10300/mm/cache-flush-by-tag.S | 250 --- arch/mn10300/mm/cache-flush-icache.c | 155 -- arch/mn10300/mm/cache-inv-by-reg.S | 350 --- arch/mn10300/mm/cache-inv-by-tag.S | 276 --- arch/mn10300/mm/cache-inv-icache.c | 129 -- arch/mn10300/mm/cache-smp-flush.c | 156 -- arch/mn10300/mm/cache-smp-inv.c | 153 -- arch/mn10300/mm/cache-smp.c | 105 - arch/mn10300/mm/cache-smp.h | 69 - arch/mn10300/mm/cache.c | 54 - arch/mn10300/mm/cache.inc | 133 -- arch/mn10300/mm/dma-alloc.c | 128 -- arch/mn10300/mm/extable.c | 26 - arch/mn10300/mm/fault.c | 414 ---- arch/mn10300/mm/init.c | 136 -- arch/mn10300/mm/misalignment.c | 966 --------- arch/mn10300/mm/mmu-context.c | 62 - arch/mn10300/mm/pgtable.c | 174 -- arch/mn10300/mm/tlb-mn10300.S | 220 -- arch/mn10300/mm/tlb-smp.c | 213 -- arch/mn10300/oprofile/Makefile | 14 - arch/mn10300/oprofile/op_model_null.c | 22 - arch/mn10300/proc-mn103e010/Makefile | 5 - .../proc-mn103e010/include/proc/cache.h | 43 - .../proc-mn103e010/include/proc/clock.h | 16 - .../proc-mn103e010/include/proc/dmactl-regs.h | 102 - .../proc-mn103e010/include/proc/intctl-regs.h | 30 - .../mn10300/proc-mn103e010/include/proc/irq.h | 34 - .../proc-mn103e010/include/proc/proc.h | 18 - arch/mn10300/proc-mn103e010/proc-init.c | 115 - arch/mn10300/proc-mn2ws0050/Makefile | 5 - .../proc-mn2ws0050/include/proc/cache.h | 49 - .../proc-mn2ws0050/include/proc/clock.h | 20 - .../proc-mn2ws0050/include/proc/dmactl-regs.h | 103 - .../proc-mn2ws0050/include/proc/intctl-regs.h | 30 - .../mn10300/proc-mn2ws0050/include/proc/irq.h | 49 - .../proc-mn2ws0050/include/proc/nand-regs.h | 120 - .../proc-mn2ws0050/include/proc/proc.h | 18 - .../proc-mn2ws0050/include/proc/smp-regs.h | 51 - arch/mn10300/proc-mn2ws0050/proc-init.c | 134 -- arch/mn10300/unit-asb2303/Makefile | 6 - arch/mn10300/unit-asb2303/flash.c | 99 - .../mn10300/unit-asb2303/include/unit/clock.h | 24 - arch/mn10300/unit-asb2303/include/unit/leds.h | 43 - .../unit-asb2303/include/unit/serial.h | 141 -- .../unit-asb2303/include/unit/smc91111.h | 50 - .../mn10300/unit-asb2303/include/unit/timex.h | 146 -- arch/mn10300/unit-asb2303/leds.c | 52 - arch/mn10300/unit-asb2303/smc91111.c | 53 - arch/mn10300/unit-asb2303/unit-init.c | 68 - arch/mn10300/unit-asb2305/Makefile | 8 - .../mn10300/unit-asb2305/include/unit/clock.h | 24 - arch/mn10300/unit-asb2305/include/unit/leds.h | 51 - .../unit-asb2305/include/unit/serial.h | 125 -- .../mn10300/unit-asb2305/include/unit/timex.h | 146 -- arch/mn10300/unit-asb2305/leds.c | 124 -- arch/mn10300/unit-asb2305/pci-asb2305.c | 212 -- arch/mn10300/unit-asb2305/pci-asb2305.h | 65 - arch/mn10300/unit-asb2305/pci-irq.c | 46 - arch/mn10300/unit-asb2305/pci.c | 505 ----- arch/mn10300/unit-asb2305/unit-init.c | 63 - arch/mn10300/unit-asb2364/Makefile | 12 - .../mn10300/unit-asb2364/include/unit/clock.h | 29 - .../unit-asb2364/include/unit/fpga-regs.h | 53 - arch/mn10300/unit-asb2364/include/unit/irq.h | 35 - arch/mn10300/unit-asb2364/include/unit/leds.h | 54 - .../unit-asb2364/include/unit/serial.h | 151 -- .../unit-asb2364/include/unit/smsc911x.h | 171 -- .../mn10300/unit-asb2364/include/unit/timex.h | 155 -- arch/mn10300/unit-asb2364/irq-fpga.c | 108 - arch/mn10300/unit-asb2364/leds.c | 98 - arch/mn10300/unit-asb2364/smsc911x.c | 58 - arch/mn10300/unit-asb2364/unit-init.c | 132 -- crypto/sha3_generic.c | 2 +- drivers/input/joystick/analog.c | 2 +- drivers/net/ethernet/smsc/Kconfig | 6 +- drivers/net/ethernet/smsc/smc91x.h | 8 - drivers/rtc/Kconfig | 2 +- drivers/rtc/rtc-cmos.c | 2 +- drivers/staging/speakup/Kconfig | 2 +- drivers/video/console/Kconfig | 2 +- include/asm-generic/atomic.h | 2 - include/asm-generic/barrier.h | 2 +- include/asm-generic/exec.h | 2 +- include/asm-generic/io.h | 2 +- include/asm-generic/pci_iomap.h | 2 +- include/asm-generic/switch_to.h | 2 +- include/linux/ide.h | 2 +- init/Kconfig | 2 +- lib/Kconfig.debug | 2 +- lib/test_user_copy.c | 1 - scripts/mod/modpost.c | 7 +- .../mn10300/include/uapi/asm/bitsperlong.h | 1 - tools/arch/mn10300/include/uapi/asm/mman.h | 7 - tools/include/asm-generic/barrier.h | 2 +- 343 files changed, 21 insertions(+), 34163 deletions(-) delete mode 100644 Documentation/mn10300/ABI.txt delete mode 100644 Documentation/mn10300/compartmentalisation.txt delete mode 100644 arch/mn10300/Kconfig delete mode 100644 arch/mn10300/Kconfig.debug delete mode 100644 arch/mn10300/Makefile delete mode 100644 arch/mn10300/boot/.gitignore delete mode 100644 arch/mn10300/boot/Makefile delete mode 100644 arch/mn10300/boot/compressed/Makefile delete mode 100644 arch/mn10300/boot/compressed/head.S delete mode 100644 arch/mn10300/boot/compressed/misc.c delete mode 100644 arch/mn10300/boot/compressed/misc.h delete mode 100644 arch/mn10300/boot/compressed/vmlinux.lds delete mode 100644 arch/mn10300/boot/install.sh delete mode 100644 arch/mn10300/boot/tools/build.c delete mode 100644 arch/mn10300/configs/asb2303_defconfig delete mode 100644 arch/mn10300/configs/asb2364_defconfig delete mode 100644 arch/mn10300/include/asm/Kbuild delete mode 100644 arch/mn10300/include/asm/asm-offsets.h delete mode 100644 arch/mn10300/include/asm/atomic.h delete mode 100644 arch/mn10300/include/asm/bitops.h delete mode 100644 arch/mn10300/include/asm/bug.h delete mode 100644 arch/mn10300/include/asm/bugs.h delete mode 100644 arch/mn10300/include/asm/busctl-regs.h delete mode 100644 arch/mn10300/include/asm/cache.h delete mode 100644 arch/mn10300/include/asm/cacheflush.h delete mode 100644 arch/mn10300/include/asm/checksum.h delete mode 100644 arch/mn10300/include/asm/cmpxchg.h delete mode 100644 arch/mn10300/include/asm/cpu-regs.h delete mode 100644 arch/mn10300/include/asm/current.h delete mode 100644 arch/mn10300/include/asm/debugger.h delete mode 100644 arch/mn10300/include/asm/delay.h delete mode 100644 arch/mn10300/include/asm/div64.h delete mode 100644 arch/mn10300/include/asm/dma-mapping.h delete mode 100644 arch/mn10300/include/asm/dma.h delete mode 100644 arch/mn10300/include/asm/dmactl-regs.h delete mode 100644 arch/mn10300/include/asm/elf.h delete mode 100644 arch/mn10300/include/asm/emergency-restart.h delete mode 100644 arch/mn10300/include/asm/exceptions.h delete mode 100644 arch/mn10300/include/asm/fpu.h delete mode 100644 arch/mn10300/include/asm/frame.inc delete mode 100644 arch/mn10300/include/asm/ftrace.h delete mode 100644 arch/mn10300/include/asm/futex.h delete mode 100644 arch/mn10300/include/asm/gdb-stub.h delete mode 100644 arch/mn10300/include/asm/hardirq.h delete mode 100644 arch/mn10300/include/asm/highmem.h delete mode 100644 arch/mn10300/include/asm/hw_irq.h delete mode 100644 arch/mn10300/include/asm/intctl-regs.h delete mode 100644 arch/mn10300/include/asm/io.h delete mode 100644 arch/mn10300/include/asm/irq.h delete mode 100644 arch/mn10300/include/asm/irq_regs.h delete mode 100644 arch/mn10300/include/asm/irqflags.h delete mode 100644 arch/mn10300/include/asm/kdebug.h delete mode 100644 arch/mn10300/include/asm/kgdb.h delete mode 100644 arch/mn10300/include/asm/kmap_types.h delete mode 100644 arch/mn10300/include/asm/kprobes.h delete mode 100644 arch/mn10300/include/asm/linkage.h delete mode 100644 arch/mn10300/include/asm/local.h delete mode 100644 arch/mn10300/include/asm/local64.h delete mode 100644 arch/mn10300/include/asm/mc146818rtc.h delete mode 100644 arch/mn10300/include/asm/mmu.h delete mode 100644 arch/mn10300/include/asm/mmu_context.h delete mode 100644 arch/mn10300/include/asm/module.h delete mode 100644 arch/mn10300/include/asm/nmi.h delete mode 100644 arch/mn10300/include/asm/page.h delete mode 100644 arch/mn10300/include/asm/page_offset.h delete mode 100644 arch/mn10300/include/asm/pci.h delete mode 100644 arch/mn10300/include/asm/percpu.h delete mode 100644 arch/mn10300/include/asm/pgalloc.h delete mode 100644 arch/mn10300/include/asm/pgtable.h delete mode 100644 arch/mn10300/include/asm/pio-regs.h delete mode 100644 arch/mn10300/include/asm/processor.h delete mode 100644 arch/mn10300/include/asm/ptrace.h delete mode 100644 arch/mn10300/include/asm/reset-regs.h delete mode 100644 arch/mn10300/include/asm/rtc-regs.h delete mode 100644 arch/mn10300/include/asm/rtc.h delete mode 100644 arch/mn10300/include/asm/rwlock.h delete mode 100644 arch/mn10300/include/asm/serial-regs.h delete mode 100644 arch/mn10300/include/asm/serial.h delete mode 100644 arch/mn10300/include/asm/setup.h delete mode 100644 arch/mn10300/include/asm/shmparam.h delete mode 100644 arch/mn10300/include/asm/signal.h delete mode 100644 arch/mn10300/include/asm/smp.h delete mode 100644 arch/mn10300/include/asm/smsc911x.h delete mode 100644 arch/mn10300/include/asm/spinlock.h delete mode 100644 arch/mn10300/include/asm/spinlock_types.h delete mode 100644 arch/mn10300/include/asm/string.h delete mode 100644 arch/mn10300/include/asm/switch_to.h delete mode 100644 arch/mn10300/include/asm/syscall.h delete mode 100644 arch/mn10300/include/asm/termios.h delete mode 100644 arch/mn10300/include/asm/thread_info.h delete mode 100644 arch/mn10300/include/asm/timer-regs.h delete mode 100644 arch/mn10300/include/asm/timex.h delete mode 100644 arch/mn10300/include/asm/tlb.h delete mode 100644 arch/mn10300/include/asm/tlbflush.h delete mode 100644 arch/mn10300/include/asm/topology.h delete mode 100644 arch/mn10300/include/asm/types.h delete mode 100644 arch/mn10300/include/asm/uaccess.h delete mode 100644 arch/mn10300/include/asm/ucontext.h delete mode 100644 arch/mn10300/include/asm/unaligned.h delete mode 100644 arch/mn10300/include/asm/unistd.h delete mode 100644 arch/mn10300/include/asm/user.h delete mode 100644 arch/mn10300/include/asm/vga.h delete mode 100644 arch/mn10300/include/asm/xor.h delete mode 100644 arch/mn10300/include/uapi/asm/Kbuild delete mode 100644 arch/mn10300/include/uapi/asm/auxvec.h delete mode 100644 arch/mn10300/include/uapi/asm/bitsperlong.h delete mode 100644 arch/mn10300/include/uapi/asm/byteorder.h delete mode 100644 arch/mn10300/include/uapi/asm/errno.h delete mode 100644 arch/mn10300/include/uapi/asm/fcntl.h delete mode 100644 arch/mn10300/include/uapi/asm/ioctl.h delete mode 100644 arch/mn10300/include/uapi/asm/ioctls.h delete mode 100644 arch/mn10300/include/uapi/asm/ipcbuf.h delete mode 100644 arch/mn10300/include/uapi/asm/kvm_para.h delete mode 100644 arch/mn10300/include/uapi/asm/mman.h delete mode 100644 arch/mn10300/include/uapi/asm/msgbuf.h delete mode 100644 arch/mn10300/include/uapi/asm/param.h delete mode 100644 arch/mn10300/include/uapi/asm/posix_types.h delete mode 100644 arch/mn10300/include/uapi/asm/ptrace.h delete mode 100644 arch/mn10300/include/uapi/asm/resource.h delete mode 100644 arch/mn10300/include/uapi/asm/sembuf.h delete mode 100644 arch/mn10300/include/uapi/asm/setup.h delete mode 100644 arch/mn10300/include/uapi/asm/shmbuf.h delete mode 100644 arch/mn10300/include/uapi/asm/sigcontext.h delete mode 100644 arch/mn10300/include/uapi/asm/signal.h delete mode 100644 arch/mn10300/include/uapi/asm/socket.h delete mode 100644 arch/mn10300/include/uapi/asm/sockios.h delete mode 100644 arch/mn10300/include/uapi/asm/stat.h delete mode 100644 arch/mn10300/include/uapi/asm/statfs.h delete mode 100644 arch/mn10300/include/uapi/asm/swab.h delete mode 100644 arch/mn10300/include/uapi/asm/termbits.h delete mode 100644 arch/mn10300/include/uapi/asm/termios.h delete mode 100644 arch/mn10300/include/uapi/asm/types.h delete mode 100644 arch/mn10300/include/uapi/asm/unistd.h delete mode 100644 arch/mn10300/kernel/Makefile delete mode 100644 arch/mn10300/kernel/asm-offsets.c delete mode 100644 arch/mn10300/kernel/cevt-mn10300.c delete mode 100644 arch/mn10300/kernel/csrc-mn10300.c delete mode 100644 arch/mn10300/kernel/entry.S delete mode 100644 arch/mn10300/kernel/fpu-low.S delete mode 100644 arch/mn10300/kernel/fpu-nofpu-low.S delete mode 100644 arch/mn10300/kernel/fpu-nofpu.c delete mode 100644 arch/mn10300/kernel/fpu.c delete mode 100644 arch/mn10300/kernel/gdb-io-serial-low.S delete mode 100644 arch/mn10300/kernel/gdb-io-serial.c delete mode 100644 arch/mn10300/kernel/gdb-io-ttysm-low.S delete mode 100644 arch/mn10300/kernel/gdb-io-ttysm.c delete mode 100644 arch/mn10300/kernel/gdb-low.S delete mode 100644 arch/mn10300/kernel/gdb-stub.c delete mode 100644 arch/mn10300/kernel/head.S delete mode 100644 arch/mn10300/kernel/internal.h delete mode 100644 arch/mn10300/kernel/io.c delete mode 100644 arch/mn10300/kernel/irq.c delete mode 100644 arch/mn10300/kernel/kgdb.c delete mode 100644 arch/mn10300/kernel/kprobes.c delete mode 100644 arch/mn10300/kernel/mn10300-debug.c delete mode 100644 arch/mn10300/kernel/mn10300-serial-low.S delete mode 100644 arch/mn10300/kernel/mn10300-serial.c delete mode 100644 arch/mn10300/kernel/mn10300-serial.h delete mode 100644 arch/mn10300/kernel/mn10300-watchdog-low.S delete mode 100644 arch/mn10300/kernel/mn10300-watchdog.c delete mode 100644 arch/mn10300/kernel/mn10300_ksyms.c delete mode 100644 arch/mn10300/kernel/module.c delete mode 100644 arch/mn10300/kernel/process.c delete mode 100644 arch/mn10300/kernel/profile-low.S delete mode 100644 arch/mn10300/kernel/profile.c delete mode 100644 arch/mn10300/kernel/ptrace.c delete mode 100644 arch/mn10300/kernel/rtc.c delete mode 100644 arch/mn10300/kernel/setup.c delete mode 100644 arch/mn10300/kernel/sigframe.h delete mode 100644 arch/mn10300/kernel/signal.c delete mode 100644 arch/mn10300/kernel/smp-low.S delete mode 100644 arch/mn10300/kernel/smp.c delete mode 100644 arch/mn10300/kernel/switch_to.S delete mode 100644 arch/mn10300/kernel/sys_mn10300.c delete mode 100644 arch/mn10300/kernel/time.c delete mode 100644 arch/mn10300/kernel/traps.c delete mode 100644 arch/mn10300/kernel/vmlinux.lds.S delete mode 100644 arch/mn10300/lib/Makefile delete mode 100644 arch/mn10300/lib/__ashldi3.S delete mode 100644 arch/mn10300/lib/__ashrdi3.S delete mode 100644 arch/mn10300/lib/__lshrdi3.S delete mode 100644 arch/mn10300/lib/__ucmpdi2.S delete mode 100644 arch/mn10300/lib/ashrdi3.c delete mode 100644 arch/mn10300/lib/bitops.c delete mode 100644 arch/mn10300/lib/checksum.c delete mode 100644 arch/mn10300/lib/delay.c delete mode 100644 arch/mn10300/lib/do_csum.S delete mode 100644 arch/mn10300/lib/internal.h delete mode 100644 arch/mn10300/lib/lshrdi3.c delete mode 100644 arch/mn10300/lib/memcpy.S delete mode 100644 arch/mn10300/lib/memmove.S delete mode 100644 arch/mn10300/lib/memset.S delete mode 100644 arch/mn10300/lib/negdi2.c delete mode 100644 arch/mn10300/lib/usercopy.c delete mode 100644 arch/mn10300/mm/Kconfig.cache delete mode 100644 arch/mn10300/mm/Makefile delete mode 100644 arch/mn10300/mm/cache-dbg-flush-by-reg.S delete mode 100644 arch/mn10300/mm/cache-dbg-flush-by-tag.S delete mode 100644 arch/mn10300/mm/cache-dbg-inv-by-reg.S delete mode 100644 arch/mn10300/mm/cache-dbg-inv-by-tag.S delete mode 100644 arch/mn10300/mm/cache-dbg-inv.S delete mode 100644 arch/mn10300/mm/cache-disabled.c delete mode 100644 arch/mn10300/mm/cache-flush-by-reg.S delete mode 100644 arch/mn10300/mm/cache-flush-by-tag.S delete mode 100644 arch/mn10300/mm/cache-flush-icache.c delete mode 100644 arch/mn10300/mm/cache-inv-by-reg.S delete mode 100644 arch/mn10300/mm/cache-inv-by-tag.S delete mode 100644 arch/mn10300/mm/cache-inv-icache.c delete mode 100644 arch/mn10300/mm/cache-smp-flush.c delete mode 100644 arch/mn10300/mm/cache-smp-inv.c delete mode 100644 arch/mn10300/mm/cache-smp.c delete mode 100644 arch/mn10300/mm/cache-smp.h delete mode 100644 arch/mn10300/mm/cache.c delete mode 100644 arch/mn10300/mm/cache.inc delete mode 100644 arch/mn10300/mm/dma-alloc.c delete mode 100644 arch/mn10300/mm/extable.c delete mode 100644 arch/mn10300/mm/fault.c delete mode 100644 arch/mn10300/mm/init.c delete mode 100644 arch/mn10300/mm/misalignment.c delete mode 100644 arch/mn10300/mm/mmu-context.c delete mode 100644 arch/mn10300/mm/pgtable.c delete mode 100644 arch/mn10300/mm/tlb-mn10300.S delete mode 100644 arch/mn10300/mm/tlb-smp.c delete mode 100644 arch/mn10300/oprofile/Makefile delete mode 100644 arch/mn10300/oprofile/op_model_null.c delete mode 100644 arch/mn10300/proc-mn103e010/Makefile delete mode 100644 arch/mn10300/proc-mn103e010/include/proc/cache.h delete mode 100644 arch/mn10300/proc-mn103e010/include/proc/clock.h delete mode 100644 arch/mn10300/proc-mn103e010/include/proc/dmactl-regs.h delete mode 100644 arch/mn10300/proc-mn103e010/include/proc/intctl-regs.h delete mode 100644 arch/mn10300/proc-mn103e010/include/proc/irq.h delete mode 100644 arch/mn10300/proc-mn103e010/include/proc/proc.h delete mode 100644 arch/mn10300/proc-mn103e010/proc-init.c delete mode 100644 arch/mn10300/proc-mn2ws0050/Makefile delete mode 100644 arch/mn10300/proc-mn2ws0050/include/proc/cache.h delete mode 100644 arch/mn10300/proc-mn2ws0050/include/proc/clock.h delete mode 100644 arch/mn10300/proc-mn2ws0050/include/proc/dmactl-regs.h delete mode 100644 arch/mn10300/proc-mn2ws0050/include/proc/intctl-regs.h delete mode 100644 arch/mn10300/proc-mn2ws0050/include/proc/irq.h delete mode 100644 arch/mn10300/proc-mn2ws0050/include/proc/nand-regs.h delete mode 100644 arch/mn10300/proc-mn2ws0050/include/proc/proc.h delete mode 100644 arch/mn10300/proc-mn2ws0050/include/proc/smp-regs.h delete mode 100644 arch/mn10300/proc-mn2ws0050/proc-init.c delete mode 100644 arch/mn10300/unit-asb2303/Makefile delete mode 100644 arch/mn10300/unit-asb2303/flash.c delete mode 100644 arch/mn10300/unit-asb2303/include/unit/clock.h delete mode 100644 arch/mn10300/unit-asb2303/include/unit/leds.h delete mode 100644 arch/mn10300/unit-asb2303/include/unit/serial.h delete mode 100644 arch/mn10300/unit-asb2303/include/unit/smc91111.h delete mode 100644 arch/mn10300/unit-asb2303/include/unit/timex.h delete mode 100644 arch/mn10300/unit-asb2303/leds.c delete mode 100644 arch/mn10300/unit-asb2303/smc91111.c delete mode 100644 arch/mn10300/unit-asb2303/unit-init.c delete mode 100644 arch/mn10300/unit-asb2305/Makefile delete mode 100644 arch/mn10300/unit-asb2305/include/unit/clock.h delete mode 100644 arch/mn10300/unit-asb2305/include/unit/leds.h delete mode 100644 arch/mn10300/unit-asb2305/include/unit/serial.h delete mode 100644 arch/mn10300/unit-asb2305/include/unit/timex.h delete mode 100644 arch/mn10300/unit-asb2305/leds.c delete mode 100644 arch/mn10300/unit-asb2305/pci-asb2305.c delete mode 100644 arch/mn10300/unit-asb2305/pci-asb2305.h delete mode 100644 arch/mn10300/unit-asb2305/pci-irq.c delete mode 100644 arch/mn10300/unit-asb2305/pci.c delete mode 100644 arch/mn10300/unit-asb2305/unit-init.c delete mode 100644 arch/mn10300/unit-asb2364/Makefile delete mode 100644 arch/mn10300/unit-asb2364/include/unit/clock.h delete mode 100644 arch/mn10300/unit-asb2364/include/unit/fpga-regs.h delete mode 100644 arch/mn10300/unit-asb2364/include/unit/irq.h delete mode 100644 arch/mn10300/unit-asb2364/include/unit/leds.h delete mode 100644 arch/mn10300/unit-asb2364/include/unit/serial.h delete mode 100644 arch/mn10300/unit-asb2364/include/unit/smsc911x.h delete mode 100644 arch/mn10300/unit-asb2364/include/unit/timex.h delete mode 100644 arch/mn10300/unit-asb2364/irq-fpga.c delete mode 100644 arch/mn10300/unit-asb2364/leds.c delete mode 100644 arch/mn10300/unit-asb2364/smsc911x.c delete mode 100644 arch/mn10300/unit-asb2364/unit-init.c delete mode 100644 tools/arch/mn10300/include/uapi/asm/bitsperlong.h delete mode 100644 tools/arch/mn10300/include/uapi/asm/mman.h diff --git a/Documentation/00-INDEX b/Documentation/00-INDEX index eae1e7193f50e..bd7e2d08d7904 100644 --- a/Documentation/00-INDEX +++ b/Documentation/00-INDEX @@ -284,8 +284,6 @@ misc-devices/ - directory with info about devices using the misc dev subsystem mmc/ - directory with info about the MMC subsystem -mn10300/ - - directory with info about the mn10300 architecture port mtd/ - directory with info about memory technology devices (flash) namespaces/ diff --git a/Documentation/features/core/BPF-JIT/arch-support.txt b/Documentation/features/core/BPF-JIT/arch-support.txt index b0634ec01881a..544eb1dd5fe1c 100644 --- a/Documentation/features/core/BPF-JIT/arch-support.txt +++ b/Documentation/features/core/BPF-JIT/arch-support.txt @@ -21,7 +21,6 @@ | m68k: | TODO | | microblaze: | TODO | | mips: | ok | - | mn10300: | TODO | | nios2: | TODO | | openrisc: | TODO | | parisc: | TODO | diff --git a/Documentation/features/core/generic-idle-thread/arch-support.txt b/Documentation/features/core/generic-idle-thread/arch-support.txt index e2a1a385efd38..c7f8626faca29 100644 --- a/Documentation/features/core/generic-idle-thread/arch-support.txt +++ b/Documentation/features/core/generic-idle-thread/arch-support.txt @@ -21,7 +21,6 @@ | m68k: | TODO | | microblaze: | TODO | | mips: | ok | - | mn10300: | TODO | | nios2: | TODO | | openrisc: | TODO | | parisc: | ok | diff --git a/Documentation/features/core/jump-labels/arch-support.txt b/Documentation/features/core/jump-labels/arch-support.txt index dafcea38fe5e9..647b0ab5a78d9 100644 --- a/Documentation/features/core/jump-labels/arch-support.txt +++ b/Documentation/features/core/jump-labels/arch-support.txt @@ -21,7 +21,6 @@ | m68k: | TODO | | microblaze: | TODO | | mips: | ok | - | mn10300: | TODO | | nios2: | TODO | | openrisc: | TODO | | parisc: | TODO | diff --git a/Documentation/features/core/tracehook/arch-support.txt b/Documentation/features/core/tracehook/arch-support.txt index 3d7886fcb6a9c..c95ba6d79ceec 100644 --- a/Documentation/features/core/tracehook/arch-support.txt +++ b/Documentation/features/core/tracehook/arch-support.txt @@ -21,7 +21,6 @@ | m68k: | TODO | | microblaze: | TODO | | mips: | ok | - | mn10300: | ok | | nios2: | ok | | openrisc: | ok | | parisc: | ok | diff --git a/Documentation/features/debug/KASAN/arch-support.txt b/Documentation/features/debug/KASAN/arch-support.txt index 63598b0e8ea63..fbb5afe458486 100644 --- a/Documentation/features/debug/KASAN/arch-support.txt +++ b/Documentation/features/debug/KASAN/arch-support.txt @@ -21,7 +21,6 @@ | m68k: | TODO | | microblaze: | TODO | | mips: | TODO | - | mn10300: | TODO | | nios2: | TODO | | openrisc: | TODO | | parisc: | TODO | diff --git a/Documentation/features/debug/gcov-profile-all/arch-support.txt b/Documentation/features/debug/gcov-profile-all/arch-support.txt index 13b3b3dfe7f24..a35c5057585b6 100644 --- a/Documentation/features/debug/gcov-profile-all/arch-support.txt +++ b/Documentation/features/debug/gcov-profile-all/arch-support.txt @@ -21,7 +21,6 @@ | m68k: | TODO | | microblaze: | ok | | mips: | TODO | - | mn10300: | TODO | | nios2: | TODO | | openrisc: | TODO | | parisc: | TODO | diff --git a/Documentation/features/debug/kgdb/arch-support.txt b/Documentation/features/debug/kgdb/arch-support.txt index cb4792cf0f98c..afb31a2505cb1 100644 --- a/Documentation/features/debug/kgdb/arch-support.txt +++ b/Documentation/features/debug/kgdb/arch-support.txt @@ -21,7 +21,6 @@ | m68k: | TODO | | microblaze: | ok | | mips: | ok | - | mn10300: | ok | | nios2: | ok | | openrisc: | TODO | | parisc: | TODO | diff --git a/Documentation/features/debug/kprobes-on-ftrace/arch-support.txt b/Documentation/features/debug/kprobes-on-ftrace/arch-support.txt index 2046539489fe1..4144979bc0227 100644 --- a/Documentation/features/debug/kprobes-on-ftrace/arch-support.txt +++ b/Documentation/features/debug/kprobes-on-ftrace/arch-support.txt @@ -21,7 +21,6 @@ | m68k: | TODO | | microblaze: | TODO | | mips: | TODO | - | mn10300: | TODO | | nios2: | TODO | | openrisc: | TODO | | parisc: | TODO | diff --git a/Documentation/features/debug/kprobes/arch-support.txt b/Documentation/features/debug/kprobes/arch-support.txt index bfb3546a70d0f..7ec1a185e7139 100644 --- a/Documentation/features/debug/kprobes/arch-support.txt +++ b/Documentation/features/debug/kprobes/arch-support.txt @@ -21,7 +21,6 @@ | m68k: | TODO | | microblaze: | TODO | | mips: | ok | - | mn10300: | TODO | | nios2: | TODO | | openrisc: | TODO | | parisc: | TODO | diff --git a/Documentation/features/debug/kretprobes/arch-support.txt b/Documentation/features/debug/kretprobes/arch-support.txt index cb2213bfadc5e..fa9009c08b1f5 100644 --- a/Documentation/features/debug/kretprobes/arch-support.txt +++ b/Documentation/features/debug/kretprobes/arch-support.txt @@ -21,7 +21,6 @@ | m68k: | TODO | | microblaze: | TODO | | mips: | ok | - | mn10300: | TODO | | nios2: | TODO | | openrisc: | TODO | | parisc: | TODO | diff --git a/Documentation/features/debug/optprobes/arch-support.txt b/Documentation/features/debug/optprobes/arch-support.txt index 219aa64ca3f5c..38adefbe2edf4 100644 --- a/Documentation/features/debug/optprobes/arch-support.txt +++ b/Documentation/features/debug/optprobes/arch-support.txt @@ -21,7 +21,6 @@ | m68k: | TODO | | microblaze: | TODO | | mips: | TODO | - | mn10300: | TODO | | nios2: | TODO | | openrisc: | TODO | | parisc: | TODO | diff --git a/Documentation/features/debug/stackprotector/arch-support.txt b/Documentation/features/debug/stackprotector/arch-support.txt index 904864c3f18c8..2965ae0ca1395 100644 --- a/Documentation/features/debug/stackprotector/arch-support.txt +++ b/Documentation/features/debug/stackprotector/arch-support.txt @@ -21,7 +21,6 @@ | m68k: | TODO | | microblaze: | TODO | | mips: | ok | - | mn10300: | TODO | | nios2: | TODO | | openrisc: | TODO | | parisc: | TODO | diff --git a/Documentation/features/debug/uprobes/arch-support.txt b/Documentation/features/debug/uprobes/arch-support.txt index d092f000e6bba..5da0bc2e7e1ea 100644 --- a/Documentation/features/debug/uprobes/arch-support.txt +++ b/Documentation/features/debug/uprobes/arch-support.txt @@ -21,7 +21,6 @@ | m68k: | TODO | | microblaze: | TODO | | mips: | ok | - | mn10300: | TODO | | nios2: | TODO | | openrisc: | TODO | | parisc: | TODO | diff --git a/Documentation/features/debug/user-ret-profiler/arch-support.txt b/Documentation/features/debug/user-ret-profiler/arch-support.txt index 9e9e195b6d301..a45ced203f323 100644 --- a/Documentation/features/debug/user-ret-profiler/arch-support.txt +++ b/Documentation/features/debug/user-ret-profiler/arch-support.txt @@ -21,7 +21,6 @@ | m68k: | TODO | | microblaze: | TODO | | mips: | TODO | - | mn10300: | TODO | | nios2: | TODO | | openrisc: | TODO | | parisc: | TODO | diff --git a/Documentation/features/io/dma-api-debug/arch-support.txt b/Documentation/features/io/dma-api-debug/arch-support.txt index ba9e169859c47..411ec941e46c1 100644 --- a/Documentation/features/io/dma-api-debug/arch-support.txt +++ b/Documentation/features/io/dma-api-debug/arch-support.txt @@ -21,7 +21,6 @@ | m68k: | TODO | | microblaze: | ok | | mips: | ok | - | mn10300: | TODO | | nios2: | TODO | | openrisc: | TODO | | parisc: | TODO | diff --git a/Documentation/features/io/dma-contiguous/arch-support.txt b/Documentation/features/io/dma-contiguous/arch-support.txt index 35b501f2c117e..3b65953a96a97 100644 --- a/Documentation/features/io/dma-contiguous/arch-support.txt +++ b/Documentation/features/io/dma-contiguous/arch-support.txt @@ -21,7 +21,6 @@ | m68k: | TODO | | microblaze: | TODO | | mips: | ok | - | mn10300: | TODO | | nios2: | TODO | | openrisc: | TODO | | parisc: | TODO | diff --git a/Documentation/features/io/sg-chain/arch-support.txt b/Documentation/features/io/sg-chain/arch-support.txt index 42c078dff18b7..65e9368c69a7d 100644 --- a/Documentation/features/io/sg-chain/arch-support.txt +++ b/Documentation/features/io/sg-chain/arch-support.txt @@ -21,7 +21,6 @@ | m68k: | TODO | | microblaze: | TODO | | mips: | TODO | - | mn10300: | TODO | | nios2: | TODO | | openrisc: | TODO | | parisc: | TODO | diff --git a/Documentation/features/lib/strncasecmp/arch-support.txt b/Documentation/features/lib/strncasecmp/arch-support.txt index b10c21f14739d..cee48bd07b080 100644 --- a/Documentation/features/lib/strncasecmp/arch-support.txt +++ b/Documentation/features/lib/strncasecmp/arch-support.txt @@ -21,7 +21,6 @@ | m68k: | TODO | | microblaze: | TODO | | mips: | TODO | - | mn10300: | TODO | | nios2: | TODO | | openrisc: | TODO | | parisc: | TODO | diff --git a/Documentation/features/locking/cmpxchg-local/arch-support.txt b/Documentation/features/locking/cmpxchg-local/arch-support.txt index 3b87fd37bae85..a83465dc0db59 100644 --- a/Documentation/features/locking/cmpxchg-local/arch-support.txt +++ b/Documentation/features/locking/cmpxchg-local/arch-support.txt @@ -21,7 +21,6 @@ | m68k: | TODO | | microblaze: | TODO | | mips: | TODO | - | mn10300: | TODO | | nios2: | TODO | | openrisc: | TODO | | parisc: | TODO | diff --git a/Documentation/features/locking/lockdep/arch-support.txt b/Documentation/features/locking/lockdep/arch-support.txt index cefcd720f04ed..e5d51c585a909 100644 --- a/Documentation/features/locking/lockdep/arch-support.txt +++ b/Documentation/features/locking/lockdep/arch-support.txt @@ -21,7 +21,6 @@ | m68k: | TODO | | microblaze: | ok | | mips: | ok | - | mn10300: | TODO | | nios2: | TODO | | openrisc: | TODO | | parisc: | TODO | diff --git a/Documentation/features/locking/queued-rwlocks/arch-support.txt b/Documentation/features/locking/queued-rwlocks/arch-support.txt index da6c7e37141c4..5cae3a63a44e5 100644 --- a/Documentation/features/locking/queued-rwlocks/arch-support.txt +++ b/Documentation/features/locking/queued-rwlocks/arch-support.txt @@ -21,7 +21,6 @@ | m68k: | TODO | | microblaze: | TODO | | mips: | TODO | - | mn10300: | TODO | | nios2: | TODO | | openrisc: | TODO | | parisc: | TODO | diff --git a/Documentation/features/locking/queued-spinlocks/arch-support.txt b/Documentation/features/locking/queued-spinlocks/arch-support.txt index 1e5dbcdd1c762..cb227de0bbf98 100644 --- a/Documentation/features/locking/queued-spinlocks/arch-support.txt +++ b/Documentation/features/locking/queued-spinlocks/arch-support.txt @@ -21,7 +21,6 @@ | m68k: | TODO | | microblaze: | TODO | | mips: | TODO | - | mn10300: | TODO | | nios2: | TODO | | openrisc: | TODO | | parisc: | TODO | diff --git a/Documentation/features/locking/rwsem-optimized/arch-support.txt b/Documentation/features/locking/rwsem-optimized/arch-support.txt index b79e92288112a..ee70c9c52627c 100644 --- a/Documentation/features/locking/rwsem-optimized/arch-support.txt +++ b/Documentation/features/locking/rwsem-optimized/arch-support.txt @@ -21,7 +21,6 @@ | m68k: | TODO | | microblaze: | TODO | | mips: | TODO | - | mn10300: | TODO | | nios2: | TODO | | openrisc: | TODO | | parisc: | TODO | diff --git a/Documentation/features/perf/kprobes-event/arch-support.txt b/Documentation/features/perf/kprobes-event/arch-support.txt index 6418ccc6fc345..52f54e64e993c 100644 --- a/Documentation/features/perf/kprobes-event/arch-support.txt +++ b/Documentation/features/perf/kprobes-event/arch-support.txt @@ -21,7 +21,6 @@ | m68k: | TODO | | microblaze: | TODO | | mips: | ok | - | mn10300: | TODO | | nios2: | TODO | | openrisc: | TODO | | parisc: | TODO | diff --git a/Documentation/features/perf/perf-regs/arch-support.txt b/Documentation/features/perf/perf-regs/arch-support.txt index 3b3392ac6466d..e4294aed38bfc 100644 --- a/Documentation/features/perf/perf-regs/arch-support.txt +++ b/Documentation/features/perf/perf-regs/arch-support.txt @@ -21,7 +21,6 @@ | m68k: | TODO | | microblaze: | TODO | | mips: | TODO | - | mn10300: | TODO | | nios2: | TODO | | openrisc: | TODO | | parisc: | TODO | diff --git a/Documentation/features/perf/perf-stackdump/arch-support.txt b/Documentation/features/perf/perf-stackdump/arch-support.txt index 4594cb28fbc8b..b12117a9aa4d1 100644 --- a/Documentation/features/perf/perf-stackdump/arch-support.txt +++ b/Documentation/features/perf/perf-stackdump/arch-support.txt @@ -21,7 +21,6 @@ | m68k: | TODO | | microblaze: | TODO | | mips: | TODO | - | mn10300: | TODO | | nios2: | TODO | | openrisc: | TODO | | parisc: | TODO | diff --git a/Documentation/features/sched/membarrier-sync-core/arch-support.txt b/Documentation/features/sched/membarrier-sync-core/arch-support.txt index 42eaab4d439d5..0f419ecfbce64 100644 --- a/Documentation/features/sched/membarrier-sync-core/arch-support.txt +++ b/Documentation/features/sched/membarrier-sync-core/arch-support.txt @@ -44,7 +44,6 @@ | m68k: | TODO | | microblaze: | TODO | | mips: | TODO | - | mn10300: | TODO | | nios2: | TODO | | openrisc: | TODO | | parisc: | TODO | diff --git a/Documentation/features/sched/numa-balancing/arch-support.txt b/Documentation/features/sched/numa-balancing/arch-support.txt index 4e67833aae661..0454186733689 100644 --- a/Documentation/features/sched/numa-balancing/arch-support.txt +++ b/Documentation/features/sched/numa-balancing/arch-support.txt @@ -21,7 +21,6 @@ | m68k: | .. | | microblaze: | .. | | mips: | TODO | - | mn10300: | .. | | nios2: | .. | | openrisc: | .. | | parisc: | .. | diff --git a/Documentation/features/seccomp/seccomp-filter/arch-support.txt b/Documentation/features/seccomp/seccomp-filter/arch-support.txt index c5d8b397a6938..c08a330e51d2e 100644 --- a/Documentation/features/seccomp/seccomp-filter/arch-support.txt +++ b/Documentation/features/seccomp/seccomp-filter/arch-support.txt @@ -21,7 +21,6 @@ | m68k: | TODO | | microblaze: | TODO | | mips: | ok | - | mn10300: | TODO | | nios2: | TODO | | openrisc: | TODO | | parisc: | TODO | diff --git a/Documentation/features/time/arch-tick-broadcast/arch-support.txt b/Documentation/features/time/arch-tick-broadcast/arch-support.txt index 9e4999136881d..da91b576ede8d 100644 --- a/Documentation/features/time/arch-tick-broadcast/arch-support.txt +++ b/Documentation/features/time/arch-tick-broadcast/arch-support.txt @@ -21,7 +21,6 @@ | m68k: | TODO | | microblaze: | TODO | | mips: | ok | - | mn10300: | TODO | | nios2: | TODO | | openrisc: | TODO | | parisc: | TODO | diff --git a/Documentation/features/time/clockevents/arch-support.txt b/Documentation/features/time/clockevents/arch-support.txt index f90cb64c640b5..d76322a766686 100644 --- a/Documentation/features/time/clockevents/arch-support.txt +++ b/Documentation/features/time/clockevents/arch-support.txt @@ -21,7 +21,6 @@ | m68k: | ok | | microblaze: | ok | | mips: | ok | - | mn10300: | ok | | nios2: | ok | | openrisc: | ok | | parisc: | TODO | diff --git a/Documentation/features/time/context-tracking/arch-support.txt b/Documentation/features/time/context-tracking/arch-support.txt index eb4e5d32a2e90..09582d171c84d 100644 --- a/Documentation/features/time/context-tracking/arch-support.txt +++ b/Documentation/features/time/context-tracking/arch-support.txt @@ -21,7 +21,6 @@ | m68k: | TODO | | microblaze: | TODO | | mips: | ok | - | mn10300: | TODO | | nios2: | TODO | | openrisc: | TODO | | parisc: | TODO | diff --git a/Documentation/features/time/irq-time-acct/arch-support.txt b/Documentation/features/time/irq-time-acct/arch-support.txt index 02b7441f360fb..5df0285b6fc47 100644 --- a/Documentation/features/time/irq-time-acct/arch-support.txt +++ b/Documentation/features/time/irq-time-acct/arch-support.txt @@ -21,7 +21,6 @@ | m68k: | TODO | | microblaze: | TODO | | mips: | ok | - | mn10300: | TODO | | nios2: | TODO | | openrisc: | TODO | | parisc: | .. | diff --git a/Documentation/features/time/modern-timekeeping/arch-support.txt b/Documentation/features/time/modern-timekeeping/arch-support.txt index b3eb6fe6bc27a..0f8c7e4084b0c 100644 --- a/Documentation/features/time/modern-timekeeping/arch-support.txt +++ b/Documentation/features/time/modern-timekeeping/arch-support.txt @@ -21,7 +21,6 @@ | m68k: | TODO | | microblaze: | ok | | mips: | ok | - | mn10300: | ok | | nios2: | ok | | openrisc: | ok | | parisc: | ok | diff --git a/Documentation/features/time/virt-cpuacct/arch-support.txt b/Documentation/features/time/virt-cpuacct/arch-support.txt index a1bd77fd723a2..c0af0a37444dc 100644 --- a/Documentation/features/time/virt-cpuacct/arch-support.txt +++ b/Documentation/features/time/virt-cpuacct/arch-support.txt @@ -21,7 +21,6 @@ | m68k: | TODO | | microblaze: | TODO | | mips: | ok | - | mn10300: | TODO | | nios2: | TODO | | openrisc: | TODO | | parisc: | ok | diff --git a/Documentation/features/vm/ELF-ASLR/arch-support.txt b/Documentation/features/vm/ELF-ASLR/arch-support.txt index 3f926177833c3..72c3124ffd1f9 100644 --- a/Documentation/features/vm/ELF-ASLR/arch-support.txt +++ b/Documentation/features/vm/ELF-ASLR/arch-support.txt @@ -21,7 +21,6 @@ | m68k: | TODO | | microblaze: | TODO | | mips: | ok | - | mn10300: | TODO | | nios2: | TODO | | openrisc: | TODO | | parisc: | TODO | diff --git a/Documentation/features/vm/PG_uncached/arch-support.txt b/Documentation/features/vm/PG_uncached/arch-support.txt index 4c8f65d525d77..46c62a1d7dda0 100644 --- a/Documentation/features/vm/PG_uncached/arch-support.txt +++ b/Documentation/features/vm/PG_uncached/arch-support.txt @@ -21,7 +21,6 @@ | m68k: | TODO | | microblaze: | TODO | | mips: | TODO | - | mn10300: | TODO | | nios2: | TODO | | openrisc: | TODO | | parisc: | TODO | diff --git a/Documentation/features/vm/THP/arch-support.txt b/Documentation/features/vm/THP/arch-support.txt index d121dc2e3e5e3..eaace2054bb4b 100644 --- a/Documentation/features/vm/THP/arch-support.txt +++ b/Documentation/features/vm/THP/arch-support.txt @@ -21,7 +21,6 @@ | m68k: | .. | | microblaze: | .. | | mips: | ok | - | mn10300: | .. | | nios2: | .. | | openrisc: | .. | | parisc: | TODO | diff --git a/Documentation/features/vm/TLB/arch-support.txt b/Documentation/features/vm/TLB/arch-support.txt index af233d2d82cf6..b1088eaaff3fa 100644 --- a/Documentation/features/vm/TLB/arch-support.txt +++ b/Documentation/features/vm/TLB/arch-support.txt @@ -21,7 +21,6 @@ | m68k: | .. | | microblaze: | .. | | mips: | TODO | - | mn10300: | TODO | | nios2: | .. | | openrisc: | .. | | parisc: | TODO | diff --git a/Documentation/features/vm/huge-vmap/arch-support.txt b/Documentation/features/vm/huge-vmap/arch-support.txt index 45c74fbe68050..6e4e5295ee2af 100644 --- a/Documentation/features/vm/huge-vmap/arch-support.txt +++ b/Documentation/features/vm/huge-vmap/arch-support.txt @@ -21,7 +21,6 @@ | m68k: | TODO | | microblaze: | TODO | | mips: | TODO | - | mn10300: | TODO | | nios2: | TODO | | openrisc: | TODO | | parisc: | TODO | diff --git a/Documentation/features/vm/ioremap_prot/arch-support.txt b/Documentation/features/vm/ioremap_prot/arch-support.txt index 6cd436af0cc8f..185e0654389f0 100644 --- a/Documentation/features/vm/ioremap_prot/arch-support.txt +++ b/Documentation/features/vm/ioremap_prot/arch-support.txt @@ -21,7 +21,6 @@ | m68k: | TODO | | microblaze: | TODO | | mips: | TODO | - | mn10300: | TODO | | nios2: | TODO | | openrisc: | TODO | | parisc: | TODO | diff --git a/Documentation/features/vm/numa-memblock/arch-support.txt b/Documentation/features/vm/numa-memblock/arch-support.txt index 2db895856da67..de7f891fb2a87 100644 --- a/Documentation/features/vm/numa-memblock/arch-support.txt +++ b/Documentation/features/vm/numa-memblock/arch-support.txt @@ -21,7 +21,6 @@ | m68k: | .. | | microblaze: | ok | | mips: | ok | - | mn10300: | TODO | | nios2: | .. | | openrisc: | .. | | parisc: | .. | diff --git a/Documentation/features/vm/pte_special/arch-support.txt b/Documentation/features/vm/pte_special/arch-support.txt index ccb15b6da42fd..8587fe975feaa 100644 --- a/Documentation/features/vm/pte_special/arch-support.txt +++ b/Documentation/features/vm/pte_special/arch-support.txt @@ -21,7 +21,6 @@ | m68k: | TODO | | microblaze: | TODO | | mips: | TODO | - | mn10300: | TODO | | nios2: | TODO | | openrisc: | TODO | | parisc: | TODO | diff --git a/Documentation/mn10300/ABI.txt b/Documentation/mn10300/ABI.txt deleted file mode 100644 index d3507bad428d0..0000000000000 --- a/Documentation/mn10300/ABI.txt +++ /dev/null @@ -1,149 +0,0 @@ - ========================= - MN10300 FUNCTION CALL ABI - ========================= - -======= -GENERAL -======= - -The MN10300/AM33 kernel runs in little-endian mode; big-endian mode is not -supported. - -The stack grows downwards, and should always be 32-bit aligned. There are -separate stack pointer registers for userspace and the kernel. - - -================ -ARGUMENT PASSING -================ - -The first two arguments (assuming up to 32-bits per argument) to a function are -passed in the D0 and D1 registers respectively; all other arguments are passed -on the stack. - -If 64-bit arguments are being passed, then they are never split between -registers and the stack. If the first argument is a 64-bit value, it will be -passed in D0:D1. If the first argument is not a 64-bit value, but the second -is, the second will be passed entirely on the stack and D1 will be unused. - -Arguments smaller than 32-bits are not coalesced within a register or a stack -word. For example, two byte-sized arguments will always be passed in separate -registers or word-sized stack slots. - - -================= -CALLING FUNCTIONS -================= - -The caller must allocate twelve bytes on the stack for the callee's use before -it inserts a CALL instruction. The CALL instruction will write into the TOS -word, but won't actually modify the stack pointer; similarly, the RET -instruction reads from the TOS word of the stack, but doesn't move the stack -pointer beyond it. - - - Stack: - | | - | | - |---------------| SP+20 - | 4th Arg | - |---------------| SP+16 - | 3rd Arg | - |---------------| SP+12 - | D1 Save Slot | - |---------------| SP+8 - | D0 Save Slot | - |---------------| SP+4 - | Return Addr | - |---------------| SP - | | - | | - - -The caller must leave space on the stack (hence an allocation of twelve bytes) -in which the callee may store the first two arguments. - - -============ -RETURN VALUE -============ - -The return value is passed in D0 for an integer (or D0:D1 for a 64-bit value), -or A0 for a pointer. - -If the return value is a value larger than 64-bits, or is a structure or an -array, then a hidden first argument will be passed to the callee by the caller: -this will point to a piece of memory large enough to hold the result of the -function. In this case, the callee will return the value in that piece of -memory, and no value will be returned in D0 or A0. - - -=================== -REGISTER CLOBBERING -=================== - -The values in certain registers may be clobbered by the callee, and other -values must be saved: - - Clobber: D0-D1, A0-A1, E0-E3 - Save: D2-D3, A2-A3, E4-E7, SP - -All other non-supervisor-only registers are clobberable (such as MDR, MCRL, -MCRH). - - -================= -SPECIAL REGISTERS -================= - -Certain ordinary registers may carry special usage for the compiler: - - A3: Frame pointer - E2: TLS pointer - - -========== -KERNEL ABI -========== - -The kernel may use a slightly different ABI internally. - - (*) E2 - - If CONFIG_MN10300_CURRENT_IN_E2 is defined, then the current task pointer - will be kept in the E2 register, and that register will be marked - unavailable for the compiler to use as a scratch register. - - Normally the kernel uses something like: - - MOV SP,An - AND 0xFFFFE000,An - MOV (An),Rm // Rm holds current - MOV (yyy,Rm) // Access current->yyy - - To find the address of current; but since this option permits current to - be carried globally in an register, it can use: - - MOV (yyy,E2) // Access current->yyy - - instead. - - -=============== -SYSTEM CALL ABI -=============== - -System calls are called with the following convention: - - REGISTER ENTRY EXIT - =============== ======================= ======================= - D0 Syscall number Return value - A0 1st syscall argument Saved - D1 2nd syscall argument Saved - A3 3rd syscall argument Saved - A2 4th syscall argument Saved - D3 5th syscall argument Saved - D2 6th syscall argument Saved - -All other registers are saved. The layout is a consequence of the way the MOVM -instruction stores registers onto the stack. diff --git a/Documentation/mn10300/compartmentalisation.txt b/Documentation/mn10300/compartmentalisation.txt deleted file mode 100644 index 8958b51dac4bb..0000000000000 --- a/Documentation/mn10300/compartmentalisation.txt +++ /dev/null @@ -1,60 +0,0 @@ - ========================================= - PART-SPECIFIC SOURCE COMPARTMENTALISATION - ========================================= - -The sources for various parts are compartmentalised at two different levels: - - (1) Processor level - - The "processor level" is a CPU core plus the other on-silicon - peripherals. - - Processor-specific header files are divided among directories in a similar - way to the CPU level: - - (*) include/asm-mn10300/proc-mn103e010/ - - Support for the AM33v2 CPU core. - - The appropriate processor is selected by a CONFIG_MN10300_PROC_YYYY option - from the "Processor support" choice menu in the arch/mn10300/Kconfig file. - - - (2) Unit level - - The "unit level" is a processor plus all the external peripherals - controlled by that processor. - - Unit-specific header files are divided among directories in a similar way - to the CPU level; not only that, but specific sources may also be - segregated into separate directories under the arch directory: - - (*) include/asm-mn10300/unit-asb2303/ - (*) arch/mn10300/unit-asb2303/ - - Support for the ASB2303 board with an ASB2308 daughter board. - - (*) include/asm-mn10300/unit-asb2305/ - (*) arch/mn10300/unit-asb2305/ - - Support for the ASB2305 board. - - The appropriate processor is selected by a CONFIG_MN10300_UNIT_ZZZZ option - from the "Unit type" choice menu in the arch/mn10300/Kconfig file. - - -============ -COMPILE TIME -============ - -When the kernel is compiled, symbolic links will be made in the asm header file -directory for this arch: - - include/asm-mn10300/proc => include/asm-mn10300/proc-YYYY/ - include/asm-mn10300/unit => include/asm-mn10300/unit-ZZZZ/ - -So that the header files contained in those directories can be accessed without -lots of #ifdef-age. - -The appropriate arch/mn10300/unit-ZZZZ directory will also be entered by the -compilation process; all other unit-specific directories will be ignored. diff --git a/MAINTAINERS b/MAINTAINERS index 313754bf39e17..69123be5bb64b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -10394,14 +10394,6 @@ L: platform-driver-x86@vger.kernel.org S: Maintained F: drivers/platform/x86/panasonic-laptop.c -PANASONIC MN10300/AM33/AM34 PORT -M: David Howells -L: linux-am33-list@redhat.com (moderated for non-subscribers) -W: ftp://ftp.redhat.com/pub/redhat/gnupro/AM33/ -S: Maintained -F: Documentation/mn10300/ -F: arch/mn10300/ - PARALLEL LCD/KEYPAD PANEL DRIVER M: Willy Tarreau M: Ksenija Stanojevic diff --git a/arch/mn10300/Kconfig b/arch/mn10300/Kconfig deleted file mode 100644 index e9d8d60bd28b4..0000000000000 --- a/arch/mn10300/Kconfig +++ /dev/null @@ -1,499 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -config MN10300 - def_bool y - select HAVE_EXIT_THREAD - select HAVE_OPROFILE - select HAVE_UID16 - select GENERIC_IRQ_SHOW - select ARCH_WANT_IPC_PARSE_VERSION - select HAVE_ARCH_TRACEHOOK - select HAVE_ARCH_KGDB - select GENERIC_ATOMIC64 - select HAVE_NMI_WATCHDOG if MN10300_WD_TIMER - select VIRT_TO_BUS - select GENERIC_CLOCKEVENTS - select MODULES_USE_ELF_RELA - select OLD_SIGSUSPEND3 - select OLD_SIGACTION - select HAVE_DEBUG_STACKOVERFLOW - select ARCH_NO_COHERENT_DMA_MMAP - -config AM33_2 - def_bool n - -config AM33_3 - def_bool n - -config AM34_2 - def_bool n - select MN10300_HAS_ATOMIC_OPS_UNIT - select MN10300_HAS_CACHE_SNOOP - -config ERRATUM_NEED_TO_RELOAD_MMUCTR - def_bool y if AM33_3 || AM34_2 - -config MMU - def_bool y - -config HIGHMEM - def_bool n - -config NUMA - def_bool n - -config RWSEM_GENERIC_SPINLOCK - def_bool y - -config RWSEM_XCHGADD_ALGORITHM - bool - -config GENERIC_CALIBRATE_DELAY - def_bool y - -config GENERIC_HWEIGHT - def_bool y - -config GENERIC_BUG - def_bool y - depends on BUG - -config QUICKLIST - def_bool y - -config ARCH_HAS_ILOG2_U32 - def_bool y - -config HOTPLUG_CPU - def_bool n - -source "init/Kconfig" - -source "kernel/Kconfig.freezer" - - -menu "Panasonic MN10300 system setup" - -choice - prompt "Unit type" - default MN10300_UNIT_ASB2303 - help - This option specifies board for which the kernel will be - compiled. It affects the external peripherals catered for. - -config MN10300_UNIT_ASB2303 - bool "ASB2303" - -config MN10300_UNIT_ASB2305 - bool "ASB2305" - -config MN10300_UNIT_ASB2364 - bool "ASB2364" - select SMSC911X_ARCH_HOOKS if SMSC911X - -endchoice - -choice - prompt "Processor support" - default MN10300_PROC_MN103E010 - help - This option specifies the processor for which the kernel will be - compiled. It affects the on-chip peripherals catered for. - -config MN10300_PROC_MN103E010 - bool "MN103E010" - depends on MN10300_UNIT_ASB2303 || MN10300_UNIT_ASB2305 - select AM33_2 - select MN10300_PROC_HAS_TTYSM0 - select MN10300_PROC_HAS_TTYSM1 - select MN10300_PROC_HAS_TTYSM2 - -config MN10300_PROC_MN2WS0050 - bool "MN2WS0050" - depends on MN10300_UNIT_ASB2364 - select AM34_2 - select MN10300_PROC_HAS_TTYSM0 - select MN10300_PROC_HAS_TTYSM1 - select MN10300_PROC_HAS_TTYSM2 - -endchoice - -config MN10300_HAS_ATOMIC_OPS_UNIT - def_bool n - help - This should be enabled if the processor has an atomic ops unit - capable of doing LL/SC equivalent operations. - -config FPU - bool "FPU present" - default y - depends on MN10300_PROC_MN103E010 || MN10300_PROC_MN2WS0050 - -config LAZY_SAVE_FPU - bool "Save FPU state lazily" - default y - depends on FPU && !SMP - help - Enable this to be lazy in the saving of the FPU state to the owning - task's thread struct. This is useful if most tasks on the system - don't use the FPU as only those tasks that use it will pass it - between them, and the state needn't be saved for a task that isn't - using it. - - This can't be so easily used on SMP as the process that owns the FPU - state on a CPU may be currently running on another CPU, so for the - moment, it is disabled. - -source "arch/mn10300/mm/Kconfig.cache" - -config MN10300_TLB_USE_PIDR - def_bool y - -menu "Memory layout options" - -config KERNEL_RAM_BASE_ADDRESS - hex "Base address of kernel RAM" - default "0x90000000" - -config INTERRUPT_VECTOR_BASE - hex "Base address of vector table" - default "0x90000000" - help - The base address of the vector table will be programmed into - the TBR register. It must be on 16MiB address boundary. - -config KERNEL_TEXT_ADDRESS - hex "Base address of kernel" - default "0x90001000" - -config KERNEL_ZIMAGE_BASE_ADDRESS - hex "Base address of compressed vmlinux image" - default "0x50700000" - -config BOOT_STACK_OFFSET - hex - default "0xF00" if SMP - default "0xFF0" if !SMP - -config BOOT_STACK_SIZE - hex - depends on SMP - default "0x100" -endmenu - -config SMP - bool "Symmetric multi-processing support" - default y - depends on MN10300_PROC_MN2WS0050 - ---help--- - This enables support for systems with more than one CPU. If you have - a system with only one CPU, say N. If you have a system with more - than one CPU, say Y. - - If you say N here, the kernel will run on uni- and multiprocessor - machines, but will use only one CPU of a multiprocessor machine. If - you say Y here, the kernel will run on many, but not all, - uniprocessor machines. On a uniprocessor machine, the kernel - will run faster if you say N here. - - See also , - and the SMP-HOWTO available at - . - - If you don't know what to do here, say N. - -config NR_CPUS - int - depends on SMP - default "2" - -source "kernel/Kconfig.preempt" - -config MN10300_CURRENT_IN_E2 - bool "Hold current task address in E2 register" - depends on !SMP - default y - help - This option removes the E2/R2 register from the set available to gcc - for normal use and instead uses it to store the address of the - current process's task_struct whilst in the kernel. - - This means the kernel doesn't need to calculate the address each time - "current" is used (take SP, AND with mask and dereference pointer - just to get the address), and instead can just use E2+offset - addressing each time. - - This has no effect on userspace. - -config MN10300_USING_JTAG - bool "Using JTAG to debug kernel" - default y - help - This options indicates that JTAG will be used to debug the kernel. It - suppresses the use of certain hardware debugging features, such as - single-stepping, which are taken over completely by the JTAG unit. - -source "kernel/Kconfig.hz" - -config MN10300_RTC - bool "Using MN10300 RTC" - depends on MN10300_PROC_MN103E010 || MN10300_PROC_MN2WS0050 - select RTC_CLASS - select RTC_DRV_CMOS - select RTC_SYSTOHC - default n - help - This option enables support for the RTC, thus enabling time to be - tracked, even when system is powered down. This is available on-chip - on the MN103E010. - -config MN10300_WD_TIMER - bool "Using MN10300 watchdog timer" - default y - help - This options indicates that the watchdog timer will be used. - -config PCI - bool "Use PCI" - depends on MN10300_UNIT_ASB2305 - default y - select GENERIC_PCI_IOMAP - help - Some systems (such as the ASB2305) have PCI onboard. If you have one - of these boards and you wish to use the PCI facilities, say Y here. - - The PCI-HOWTO, available from - , contains valuable - information about which PCI hardware does work under Linux and which - doesn't. - -source "drivers/pci/Kconfig" - -source "drivers/pcmcia/Kconfig" - -menu "MN10300 internal serial options" - -config MN10300_PROC_HAS_TTYSM0 - bool - default n - -config MN10300_PROC_HAS_TTYSM1 - bool - default n - -config MN10300_PROC_HAS_TTYSM2 - bool - default n - -config MN10300_TTYSM - bool "Support for ttySM serial ports" - depends on MN10300 - default y - select SERIAL_CORE - help - This option enables support for the on-chip serial ports that the - MN10300 has available. - -config MN10300_TTYSM_CONSOLE - bool "Support for console on ttySM serial ports" - depends on MN10300_TTYSM - select SERIAL_CORE_CONSOLE - help - This option enables support for a console on the on-chip serial ports - that the MN10300 has available. - -# -# /dev/ttySM0 -# -config MN10300_TTYSM0 - bool "Enable SIF0 (/dev/ttySM0)" - depends on MN10300_TTYSM && MN10300_PROC_HAS_TTYSM0 - help - Enable access to SIF0 through /dev/ttySM0 or gdb-stub - -choice - prompt "Select the timer to supply the clock for SIF0" - default MN10300_TTYSM0_TIMER8 - depends on MN10300_TTYSM0 - -config MN10300_TTYSM0_TIMER8 - bool "Use timer 8 (16-bit)" - -config MN10300_TTYSM0_TIMER2 - bool "Use timer 2 (8-bit)" - -endchoice - -# -# /dev/ttySM1 -# -config MN10300_TTYSM1 - bool "Enable SIF1 (/dev/ttySM1)" - depends on MN10300_TTYSM && MN10300_PROC_HAS_TTYSM1 - help - Enable access to SIF1 through /dev/ttySM1 or gdb-stub - -choice - prompt "Select the timer to supply the clock for SIF1" - default MN10300_TTYSM1_TIMER12 \ - if !(AM33_2 || AM33_3) - default MN10300_TTYSM1_TIMER9 \ - if AM33_2 || AM33_3 - depends on MN10300_TTYSM1 - -config MN10300_TTYSM1_TIMER12 - bool "Use timer 12 (16-bit)" - depends on !(AM33_2 || AM33_3) - -config MN10300_TTYSM1_TIMER9 - bool "Use timer 9 (16-bit)" - depends on AM33_2 || AM33_3 - -config MN10300_TTYSM1_TIMER3 - bool "Use timer 3 (8-bit)" - depends on AM33_2 || AM33_3 - -endchoice - -# -# /dev/ttySM2 -# -config MN10300_TTYSM2 - bool "Enable SIF2 (/dev/ttySM2)" - depends on MN10300_TTYSM && MN10300_PROC_HAS_TTYSM2 - help - Enable access to SIF2 through /dev/ttySM2 or gdb-stub - -choice - prompt "Select the timer to supply the clock for SIF2" - default MN10300_TTYSM2_TIMER3 \ - if !(AM33_2 || AM33_3) - default MN10300_TTYSM2_TIMER10 \ - if AM33_2 || AM33_3 - depends on MN10300_TTYSM2 - -config MN10300_TTYSM2_TIMER9 - bool "Use timer 9 (16-bit)" - depends on !(AM33_2 || AM33_3) - -config MN10300_TTYSM2_TIMER1 - bool "Use timer 1 (8-bit)" - depends on !(AM33_2 || AM33_3) - -config MN10300_TTYSM2_TIMER3 - bool "Use timer 3 (8-bit)" - depends on !(AM33_2 || AM33_3) - -config MN10300_TTYSM2_TIMER10 - bool "Use timer 10 (16-bit)" - depends on AM33_2 || AM33_3 - -endchoice - -config MN10300_TTYSM2_CTS - bool "Enable the use of the CTS line /dev/ttySM2" - depends on MN10300_TTYSM2 && AM33_2 - -endmenu - -menu "Interrupt request priority options" - -comment "[!] NOTE: A lower number/level indicates a higher priority (0 is highest, 6 is lowest)" - -comment "____Non-maskable interrupt levels____" -comment "The following must be set to a higher priority than local_irq_disable() and on-chip serial" - -config DEBUGGER_IRQ_LEVEL - int "DEBUGGER interrupt priority" - depends on KERNEL_DEBUGGER - range 0 1 if LINUX_CLI_LEVEL = 2 - range 0 2 if LINUX_CLI_LEVEL = 3 - range 0 3 if LINUX_CLI_LEVEL = 4 - range 0 4 if LINUX_CLI_LEVEL = 5 - range 0 5 if LINUX_CLI_LEVEL = 6 - default 0 - -comment "The following must be set to a higher priority than local_irq_disable()" - -config MN10300_SERIAL_IRQ_LEVEL - int "MN10300 on-chip serial interrupt priority" - depends on MN10300_TTYSM - range 1 1 if LINUX_CLI_LEVEL = 2 - range 1 2 if LINUX_CLI_LEVEL = 3 - range 1 3 if LINUX_CLI_LEVEL = 4 - range 1 4 if LINUX_CLI_LEVEL = 5 - range 1 5 if LINUX_CLI_LEVEL = 6 - default 1 - -comment "-" -comment "____Maskable interrupt levels____" - -config LINUX_CLI_LEVEL - int "The highest interrupt priority excluded by local_irq_disable() (2-6)" - range 2 6 - default 2 - help - local_irq_disable() doesn't actually disable maskable interrupts - - what it does is restrict the levels of interrupt which are permitted - (a lower level indicates a higher priority) by lowering the value in - EPSW.IM from 7. Any interrupt is permitted for which the level is - lower than EPSW.IM. - - Certain interrupts, such as DEBUGGER and virtual MN10300 on-chip - serial DMA interrupts are allowed to interrupt normal disabled - sections. - -comment "The following must be set to a equal to or lower priority than LINUX_CLI_LEVEL" - -config TIMER_IRQ_LEVEL - int "Kernel timer interrupt priority" - range LINUX_CLI_LEVEL 6 - default 4 - -config PCI_IRQ_LEVEL - int "PCI interrupt priority" - depends on PCI - range LINUX_CLI_LEVEL 6 - default 5 - -config ETHERNET_IRQ_LEVEL - int "Ethernet interrupt priority" - depends on SMC91X || SMC911X || SMSC911X - range LINUX_CLI_LEVEL 6 - default 6 - -config EXT_SERIAL_IRQ_LEVEL - int "External serial port interrupt priority" - depends on SERIAL_8250 - range LINUX_CLI_LEVEL 6 - default 6 - -endmenu - -source "mm/Kconfig" - -menu "Power management options" -source kernel/power/Kconfig -endmenu - -endmenu - - -menu "Executable formats" - -source "fs/Kconfig.binfmt" - -endmenu - -source "net/Kconfig" - -source "drivers/Kconfig" - -source "fs/Kconfig" - -source "arch/mn10300/Kconfig.debug" - -source "security/Kconfig" - -source "crypto/Kconfig" - -source "lib/Kconfig" diff --git a/arch/mn10300/Kconfig.debug b/arch/mn10300/Kconfig.debug deleted file mode 100644 index 37ada651f7567..0000000000000 --- a/arch/mn10300/Kconfig.debug +++ /dev/null @@ -1,156 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -menu "Kernel hacking" - -source "lib/Kconfig.debug" - -config DEBUG_DECOMPRESS_KERNEL - bool "Using serial port during decompressing kernel" - depends on DEBUG_KERNEL - default n - help - If you say Y here you will confirm the start and the end of - decompressing Linux seeing "Uncompressing Linux... " and - "Ok, booting the kernel.\n" on console. - -config TEST_MISALIGNMENT_HANDLER - bool "Run tests on the misalignment handler" - depends on DEBUG_KERNEL - default n - help - If you say Y here the kernel will execute a list of misaligned memory - accesses to make sure the misalignment handler deals them with - correctly. If it does not, the kernel will throw a BUG. - -config KPROBES - bool "Kprobes" - depends on DEBUG_KERNEL - help - Kprobes allows you to trap at almost any kernel address and - execute a callback function. register_kprobe() establishes - a probepoint and specifies the callback. Kprobes is useful - for kernel debugging, non-intrusive instrumentation and testing. - If in doubt, say "N". - -config GDBSTUB - bool "Remote GDB kernel debugging" - depends on DEBUG_KERNEL && DEPRECATED - select DEBUG_INFO - select FRAME_POINTER - help - If you say Y here, it will be possible to remotely debug the kernel - using gdb. This enlarges your kernel ELF image disk size by several - megabytes and requires a machine with more than 16 MB, better 32 MB - RAM to avoid excessive linking time. This is only useful for kernel - hackers. If unsure, say N. - - This is deprecated in favour of KGDB and will be removed in a later - version. - -config GDBSTUB_IMMEDIATE - bool "Break into GDB stub immediately" - depends on GDBSTUB - help - If you say Y here, GDB stub will break into the program as soon as - possible, leaving the program counter at the beginning of - start_kernel() in init/main.c. - -config GDBSTUB_ALLOW_SINGLE_STEP - bool "Allow software single-stepping in GDB stub" - depends on GDBSTUB && !SMP && !PREEMPT - help - Allow GDB stub to perform software single-stepping through the - kernel. This doesn't work very well on SMP or preemptible kernels as - it uses temporary breakpoints to emulate single-stepping. - -config GDB_CONSOLE - bool "Console output to GDB" - depends on GDBSTUB - help - If you are using GDB for remote debugging over a serial port and - would like kernel messages to be formatted into GDB $O packets so - that GDB prints them as program output, say 'Y'. - -config GDBSTUB_DEBUGGING - bool "Debug GDB stub by messages to serial port" - depends on GDBSTUB - help - This causes debugging messages to be displayed at various points - during execution of the GDB stub routines. Such messages will be - displayed on ttyS0 if that isn't the GDB stub's port, or ttySM0 - otherwise. - -config GDBSTUB_DEBUG_ENTRY - bool "Debug GDB stub entry" - depends on GDBSTUB_DEBUGGING - help - This option causes information to be displayed about entry to or exit - from the main GDB stub routine. - -config GDBSTUB_DEBUG_PROTOCOL - bool "Debug GDB stub protocol" - depends on GDBSTUB_DEBUGGING - help - This option causes information to be displayed about the GDB remote - protocol messages generated exchanged with GDB. - -config GDBSTUB_DEBUG_IO - bool "Debug GDB stub I/O" - depends on GDBSTUB_DEBUGGING - help - This option causes information to be displayed about GDB stub's - low-level I/O. - -config GDBSTUB_DEBUG_BREAKPOINT - bool "Debug GDB stub breakpoint management" - depends on GDBSTUB_DEBUGGING - help - This option causes information to be displayed about GDB stub's - breakpoint management. - -choice - prompt "GDB stub port" - default GDBSTUB_ON_TTYSM0 - depends on GDBSTUB - help - Select the serial port used for GDB-stub. - -config GDBSTUB_ON_TTYSM0 - bool "/dev/ttySM0 [SIF0]" - depends on MN10300_TTYSM0 - select GDBSTUB_ON_TTYSMx - -config GDBSTUB_ON_TTYSM1 - bool "/dev/ttySM1 [SIF1]" - depends on MN10300_TTYSM1 - select GDBSTUB_ON_TTYSMx - -config GDBSTUB_ON_TTYSM2 - bool "/dev/ttySM2 [SIF2]" - depends on MN10300_TTYSM2 - select GDBSTUB_ON_TTYSMx - -config GDBSTUB_ON_TTYS0 - bool "/dev/ttyS0" - select GDBSTUB_ON_TTYSx - -config GDBSTUB_ON_TTYS1 - bool "/dev/ttyS1" - select GDBSTUB_ON_TTYSx - -endchoice - -config GDBSTUB_ON_TTYSMx - bool - depends on GDBSTUB_ON_TTYSM0 || GDBSTUB_ON_TTYSM1 || GDBSTUB_ON_TTYSM2 - default y - -config GDBSTUB_ON_TTYSx - bool - depends on GDBSTUB_ON_TTYS0 || GDBSTUB_ON_TTYS1 - default y - -endmenu - -config KERNEL_DEBUGGER - def_bool y - depends on GDBSTUB || KGDB diff --git a/arch/mn10300/Makefile b/arch/mn10300/Makefile deleted file mode 100644 index 3f1ea5ddc4026..0000000000000 --- a/arch/mn10300/Makefile +++ /dev/null @@ -1,99 +0,0 @@ -############################################################################### -# -# MN10300 Kernel makefile system specifications -# -# Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. -# Modified by David Howells (dhowells@redhat.com) -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public Licence -# as published by the Free Software Foundation; either version -# 2 of the Licence, or (at your option) any later version. -# -############################################################################### - -KBUILD_DEFCONFIG := asb2303_defconfig - -CCSPECS := $(shell $(CC) -v 2>&1 | grep "^Reading specs from " | head -1 | cut -c20-) -CCDIR := $(strip $(patsubst %/specs,%,$(CCSPECS))) -KBUILD_CPPFLAGS += -nostdinc -I$(CCDIR)/include - -LDFLAGS := -OBJCOPYFLAGS := -O binary -R .note -R .comment -R .GCC-command-line -R .note.gnu.build-id -S -#LDFLAGS_vmlinux := -Map linkmap.txt -CHECKFLAGS += - -PROCESSOR := unset -UNIT := unset - -KBUILD_CFLAGS += -mam33 -DCPU=AM33 $(call cc-option,-mmem-funcs,) -KBUILD_AFLAGS += -mam33 -DCPU=AM33 - -ifeq ($(CONFIG_MN10300_CURRENT_IN_E2),y) -KBUILD_CFLAGS += -ffixed-e2 -fcall-saved-e5 -endif - -ifeq ($(CONFIG_MN10300_PROC_MN103E010),y) -PROCESSOR := mn103e010 -endif -ifeq ($(CONFIG_MN10300_PROC_MN2WS0050),y) -PROCESSOR := mn2ws0050 -endif - -ifeq ($(CONFIG_MN10300_UNIT_ASB2303),y) -UNIT := asb2303 -endif -ifeq ($(CONFIG_MN10300_UNIT_ASB2305),y) -UNIT := asb2305 -endif -ifeq ($(CONFIG_MN10300_UNIT_ASB2364),y) -UNIT := asb2364 -endif - - -head-y := arch/mn10300/kernel/head.o - -core-y += arch/mn10300/kernel/ arch/mn10300/mm/ - -ifneq ($(PROCESSOR),unset) -core-y += arch/mn10300/proc-$(PROCESSOR)/ -endif -ifneq ($(UNIT),unset) -core-y += arch/mn10300/unit-$(UNIT)/ -endif -libs-y += arch/mn10300/lib/ - -drivers-$(CONFIG_OPROFILE) += arch/mn10300/oprofile/ - -boot := arch/mn10300/boot - -.PHONY: zImage - -KBUILD_IMAGE := $(boot)/zImage -CLEAN_FILES += $(boot)/zImage -CLEAN_FILES += $(boot)/compressed/vmlinux -CLEAN_FILES += $(boot)/compressed/vmlinux.bin -CLEAN_FILES += $(boot)/compressed/vmlinux.bin.gz - -zImage: vmlinux - $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ - -all: zImage - -bootstrap: - $(Q)$(MAKEBOOT) bootstrap - -archclean: - $(Q)$(MAKE) $(clean)=arch/mn10300/proc-mn103e010 - $(Q)$(MAKE) $(clean)=arch/mn10300/unit-asb2303 - $(Q)$(MAKE) $(clean)=arch/mn10300/unit-asb2305 - -define archhelp - echo '* zImage - Compressed kernel image (arch/$(ARCH)/boot/zImage)' -endef - -# -# include the appropriate processor- and unit-specific headers -# -KBUILD_CPPFLAGS += -I$(srctree)/arch/mn10300/proc-$(PROCESSOR)/include -KBUILD_CPPFLAGS += -I$(srctree)/arch/mn10300/unit-$(UNIT)/include diff --git a/arch/mn10300/boot/.gitignore b/arch/mn10300/boot/.gitignore deleted file mode 100644 index b6718de236934..0000000000000 --- a/arch/mn10300/boot/.gitignore +++ /dev/null @@ -1 +0,0 @@ -zImage diff --git a/arch/mn10300/boot/Makefile b/arch/mn10300/boot/Makefile deleted file mode 100644 index 36c9caf8ea0aa..0000000000000 --- a/arch/mn10300/boot/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -# MN10300 kernel compressor and wrapper -# -# Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd. -# Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. -# Written by David Howells (dhowells@redhat.com) -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public Licence -# as published by the Free Software Foundation; either version -# 2 of the Licence, or (at your option) any later version. -# - -targets := vmlinux.bin zImage - -subdir- := compressed - -# --------------------------------------------------------------------------- - - -$(obj)/zImage: $(obj)/compressed/vmlinux FORCE - $(call if_changed,objcopy) - @echo 'Kernel: $@ is ready' - -$(obj)/vmlinux.bin: $(obj)/compressed/vmlinux FORCE - $(call if_changed,objcopy) - -$(obj)/compressed/vmlinux: FORCE - $(Q)$(MAKE) $(build)=$(obj)/compressed IMAGE_OFFSET=$(IMAGE_OFFSET) $@ diff --git a/arch/mn10300/boot/compressed/Makefile b/arch/mn10300/boot/compressed/Makefile deleted file mode 100644 index 9b9a48fc8e532..0000000000000 --- a/arch/mn10300/boot/compressed/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# -# Create a compressed vmlinux image from the original vmlinux -# - -targets := vmlinux vmlinux.bin vmlinux.bin.gz head.o misc.o piggy.o - -LDFLAGS_vmlinux := -Ttext $(CONFIG_KERNEL_ZIMAGE_BASE_ADDRESS) -e startup_32 - -$(obj)/vmlinux: $(obj)/head.o $(obj)/misc.o $(obj)/piggy.o FORCE - $(call if_changed,ld) - -$(obj)/vmlinux.bin: vmlinux FORCE - $(call if_changed,objcopy) - -$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE - $(call if_changed,gzip) - -LDFLAGS_piggy.o := -r --format binary --oformat elf32-am33lin -T - -$(obj)/piggy.o: $(obj)/vmlinux.lds $(obj)/vmlinux.bin.gz FORCE - $(call if_changed,ld) diff --git a/arch/mn10300/boot/compressed/head.S b/arch/mn10300/boot/compressed/head.S deleted file mode 100644 index 7b50345b9e840..0000000000000 --- a/arch/mn10300/boot/compressed/head.S +++ /dev/null @@ -1,151 +0,0 @@ -/* Boot entry point for a compressed MN10300 kernel - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - .section .text - -#define DEBUG - -#include -#include -#include -#ifdef CONFIG_SMP -#include -#endif - - .globl startup_32 -startup_32: -#ifdef CONFIG_SMP - # - # Secondary CPUs jump directly to the kernel entry point - # - # Must save primary CPU's D0-D2 registers as they hold boot parameters - # - mov (CPUID), d3 - and CPUID_MASK,d3 - beq startup_primary - mov CONFIG_KERNEL_TEXT_ADDRESS,a0 - jmp (a0) - -startup_primary: -#endif /* CONFIG_SMP */ - - # first save parameters from bootloader - mov param_save_area,a0 - mov d0,(a0) - mov d1,(4,a0) - mov d2,(8,a0) - - mov sp,a3 - mov decomp_stack+0x2000-4,a0 - mov a0,sp - - # invalidate and enable both of the caches - mov CHCTR,a0 - clr d0 - movhu d0,(a0) # turn off first - mov CHCTR_ICINV|CHCTR_DCINV,d0 - movhu d0,(a0) - setlb - mov (a0),d0 - btst CHCTR_ICBUSY|CHCTR_DCBUSY,d0 # wait till not busy - lne - -#ifdef CONFIG_MN10300_CACHE_ENABLED -#ifdef CONFIG_MN10300_CACHE_WBACK - mov CHCTR_ICEN|CHCTR_DCEN|CHCTR_DCWTMD_WRBACK,d0 -#else - mov CHCTR_ICEN|CHCTR_DCEN|CHCTR_DCWTMD_WRTHROUGH,d0 -#endif /* WBACK */ - movhu d0,(a0) # enable -#endif /* !ENABLED */ - - # clear the BSS area - mov __bss_start,a0 - mov _end,a1 - clr d0 -bssclear: - cmp a1,a0 - bge bssclear_end - movbu d0,(a0) - inc a0 - bra bssclear -bssclear_end: - - # decompress the kernel - call decompress_kernel[],0 -#ifdef CONFIG_MN10300_CACHE_WBACK - call mn10300_dcache_flush_inv[],0 -#endif - - # disable caches again - mov CHCTR,a0 - clr d0 - movhu d0,(a0) - setlb - mov (a0),d0 - btst CHCTR_ICBUSY|CHCTR_DCBUSY,d0 # wait till not busy - lne - - mov param_save_area,a0 - mov (a0),d0 - mov (4,a0),d1 - mov (8,a0),d2 - - # jump to the kernel proper entry point - mov a3,sp - mov CONFIG_KERNEL_TEXT_ADDRESS,a0 - jmp (a0) - - -############################################################################### -# -# Cache flush routines -# -############################################################################### -#ifdef CONFIG_MN10300_CACHE_WBACK -mn10300_dcache_flush_inv: - movhu (CHCTR),d0 - btst CHCTR_DCEN,d0 - beq mn10300_dcache_flush_inv_end - - mov L1_CACHE_NENTRIES,d1 - clr a1 - -mn10300_dcache_flush_inv_loop: - mov (DCACHE_PURGE_WAY0(0),a1),d0 # unconditional purge - mov (DCACHE_PURGE_WAY1(0),a1),d0 # unconditional purge - mov (DCACHE_PURGE_WAY2(0),a1),d0 # unconditional purge - mov (DCACHE_PURGE_WAY3(0),a1),d0 # unconditional purge - - add L1_CACHE_BYTES,a1 - add -1,d1 - bne mn10300_dcache_flush_inv_loop - -mn10300_dcache_flush_inv_end: - ret [],0 -#endif /* CONFIG_MN10300_CACHE_WBACK */ - - -############################################################################### -# -# Data areas -# -############################################################################### - .data - .align 4 -param_save_area: - .rept 3 - .word 0 - .endr - - .section .bss - .align 4 -decomp_stack: - .space 0x2000 diff --git a/arch/mn10300/boot/compressed/misc.c b/arch/mn10300/boot/compressed/misc.c deleted file mode 100644 index 42cbd77bd439c..0000000000000 --- a/arch/mn10300/boot/compressed/misc.c +++ /dev/null @@ -1,393 +0,0 @@ -/* MN10300 Miscellaneous helper routines for kernel decompressor - * - * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd. - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Modified by David Howells (dhowells@redhat.com) - * - Derived from arch/x86/boot/compressed/misc_32.c - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include -#include "misc.h" - -#ifndef CONFIG_GDBSTUB_ON_TTYSx -/* display 'Uncompressing Linux... ' messages on ttyS0 or ttyS1 */ -#if 1 /* ttyS0 */ -#define CYG_DEV_BASE 0xA6FB0000 -#else /* ttyS1 */ -#define CYG_DEV_BASE 0xA6FC0000 -#endif - -#define CYG_DEV_THR (*((volatile __u8*)(CYG_DEV_BASE + 0x00))) -#define CYG_DEV_MCR (*((volatile __u8*)(CYG_DEV_BASE + 0x10))) -#define SIO_MCR_DTR 0x01 -#define SIO_MCR_RTS 0x02 -#define CYG_DEV_LSR (*((volatile __u8*)(CYG_DEV_BASE + 0x14))) -#define SIO_LSR_THRE 0x20 /* transmitter holding register empty */ -#define SIO_LSR_TEMT 0x40 /* transmitter register empty */ -#define CYG_DEV_MSR (*((volatile __u8*)(CYG_DEV_BASE + 0x18))) -#define SIO_MSR_CTS 0x10 /* clear to send */ -#define SIO_MSR_DSR 0x20 /* data set ready */ - -#define LSR_WAIT_FOR(STATE) \ - do { while (!(CYG_DEV_LSR & SIO_LSR_##STATE)) {} } while (0) -#define FLOWCTL_QUERY(LINE) \ - ({ CYG_DEV_MSR & SIO_MSR_##LINE; }) -#define FLOWCTL_WAIT_FOR(LINE) \ - do { while (!(CYG_DEV_MSR & SIO_MSR_##LINE)) {} } while (0) -#define FLOWCTL_CLEAR(LINE) \ - do { CYG_DEV_MCR &= ~SIO_MCR_##LINE; } while (0) -#define FLOWCTL_SET(LINE) \ - do { CYG_DEV_MCR |= SIO_MCR_##LINE; } while (0) -#endif - -/* - * gzip declarations - */ - -#define OF(args) args -#define STATIC static - -#undef memset -#undef memcpy - -static inline void *memset(const void *s, int c, size_t n) -{ - int i; - char *ss = (char *) s; - - for (i = 0; i < n; i++) - ss[i] = c; - return (void *)s; -} - -#define memzero(s, n) memset((s), 0, (n)) - -static inline void *memcpy(void *__dest, const void *__src, size_t __n) -{ - int i; - const char *s = __src; - char *d = __dest; - - for (i = 0; i < __n; i++) - d[i] = s[i]; - return __dest; -} - -typedef unsigned char uch; -typedef unsigned short ush; -typedef unsigned long ulg; - -#define WSIZE 0x8000 /* Window size must be at least 32k, and a power of - * two */ - -static uch *inbuf; /* input buffer */ -static uch window[WSIZE]; /* sliding window buffer */ - -static unsigned insize; /* valid bytes in inbuf */ -static unsigned inptr; /* index of next byte to be processed in inbuf */ -static unsigned outcnt; /* bytes in output buffer */ - -/* gzip flag byte */ -#define ASCII_FLAG 0x01 /* bit 0 set: file probably ASCII text */ -#define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */ -#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ -#define ORIG_NAME 0x08 /* bit 3 set: original file name present */ -#define COMMENT 0x10 /* bit 4 set: file comment present */ -#define ENCRYPTED 0x20 /* bit 5 set: file is encrypted */ -#define RESERVED 0xC0 /* bit 6,7: reserved */ - -/* Diagnostic functions */ -#ifdef DEBUG -# define Assert(cond, msg) { if (!(cond)) error(msg); } -# define Trace(x) fprintf x -# define Tracev(x) { if (verbose) fprintf x ; } -# define Tracevv(x) { if (verbose > 1) fprintf x ; } -# define Tracec(c, x) { if (verbose && (c)) fprintf x ; } -# define Tracecv(c, x) { if (verbose > 1 && (c)) fprintf x ; } -#else -# define Assert(cond, msg) -# define Trace(x) -# define Tracev(x) -# define Tracevv(x) -# define Tracec(c, x) -# define Tracecv(c, x) -#endif - -static int fill_inbuf(void); -static void flush_window(void); -static void error(const char *) __attribute__((noreturn)); -static void kputs(const char *); - -static inline unsigned char get_byte(void) -{ - unsigned char ch = inptr < insize ? inbuf[inptr++] : fill_inbuf(); - -#if 0 - char hex[3]; - hex[0] = ((ch & 0x0f) > 9) ? - ((ch & 0x0f) + 'A' - 0xa) : ((ch & 0x0f) + '0'); - hex[1] = ((ch >> 4) > 9) ? - ((ch >> 4) + 'A' - 0xa) : ((ch >> 4) + '0'); - hex[2] = 0; - kputs(hex); -#endif - return ch; -} - -/* - * This is set up by the setup-routine at boot-time - */ -#define EXT_MEM_K (*(unsigned short *)0x90002) -#ifndef STANDARD_MEMORY_BIOS_CALL -#define ALT_MEM_K (*(unsigned long *) 0x901e0) -#endif -#define SCREEN_INFO (*(struct screen_info *)0x90000) - -static long bytes_out; -static uch *output_data; -static unsigned long output_ptr; - - -static unsigned long free_mem_ptr = (unsigned long) &end; -static unsigned long free_mem_end_ptr = (unsigned long) &end + 0x90000; - -#define INPLACE_MOVE_ROUTINE 0x1000 -#define LOW_BUFFER_START 0x2000 -#define LOW_BUFFER_END 0x90000 -#define LOW_BUFFER_SIZE (LOW_BUFFER_END - LOW_BUFFER_START) -#define HEAP_SIZE 0x3000 -static int high_loaded; -static uch *high_buffer_start /* = (uch *)(((ulg)&end) + HEAP_SIZE)*/; - -static char *vidmem = (char *)0xb8000; -static int lines, cols; - -#define BOOTLOADER_INFLATE -#include "../../../../lib/inflate.c" - -static inline void scroll(void) -{ - int i; - - memcpy(vidmem, vidmem + cols * 2, (lines - 1) * cols * 2); - for (i = (lines - 1) * cols * 2; i < lines * cols * 2; i += 2) - vidmem[i] = ' '; -} - -static inline void kputchar(unsigned char ch) -{ -#ifdef CONFIG_MN10300_UNIT_ASB2305 - while (SC0STR & SC01STR_TBF) - continue; - - if (ch == 0x0a) { - SC0TXB = 0x0d; - while (SC0STR & SC01STR_TBF) - continue; - } - - SC0TXB = ch; - -#else - while (SC1STR & SC01STR_TBF) - continue; - - if (ch == 0x0a) { - SC1TXB = 0x0d; - while (SC1STR & SC01STR_TBF) - continue; - } - - SC1TXB = ch; - -#endif -} - -static void kputs(const char *s) -{ -#ifdef CONFIG_DEBUG_DECOMPRESS_KERNEL -#ifndef CONFIG_GDBSTUB_ON_TTYSx - char ch; - - FLOWCTL_SET(DTR); - - while (*s) { - LSR_WAIT_FOR(THRE); - - ch = *s++; - if (ch == 0x0a) { - CYG_DEV_THR = 0x0d; - LSR_WAIT_FOR(THRE); - } - CYG_DEV_THR = ch; - } - - FLOWCTL_CLEAR(DTR); -#else - - for (; *s; s++) - kputchar(*s); - -#endif -#endif /* CONFIG_DEBUG_DECOMPRESS_KERNEL */ -} - -/* =========================================================================== - * Fill the input buffer. This is called only when the buffer is empty - * and at least one byte is really needed. - */ -static int fill_inbuf() -{ - if (insize != 0) - error("ran out of input data\n"); - - inbuf = input_data; - insize = input_len; - inptr = 1; - return inbuf[0]; -} - -/* =========================================================================== - * Write the output window window[0..outcnt-1] and update crc and bytes_out. - * (Used for the decompressed data only.) - */ -static void flush_window_low(void) -{ - ulg c = crc; /* temporary variable */ - unsigned n; - uch *in, *out, ch; - - in = window; - out = &output_data[output_ptr]; - for (n = 0; n < outcnt; n++) { - ch = *out++ = *in++; - c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8); - } - crc = c; - bytes_out += (ulg)outcnt; - output_ptr += (ulg)outcnt; - outcnt = 0; -} - -static void flush_window_high(void) -{ - ulg c = crc; /* temporary variable */ - unsigned n; - uch *in, ch; - in = window; - for (n = 0; n < outcnt; n++) { - ch = *output_data++ = *in++; - if ((ulg) output_data == LOW_BUFFER_END) - output_data = high_buffer_start; - c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8); - } - crc = c; - bytes_out += (ulg)outcnt; - outcnt = 0; -} - -static void flush_window(void) -{ - if (high_loaded) - flush_window_high(); - else - flush_window_low(); -} - -static void error(const char *x) -{ - kputs("\n\n"); - kputs(x); - kputs("\n\n -- System halted"); - - while (1) - /* Halt */; -} - -#define STACK_SIZE (4096) - -long user_stack[STACK_SIZE]; - -struct { - long *a; - short b; -} stack_start = { &user_stack[STACK_SIZE], 0 }; - -void setup_normal_output_buffer(void) -{ -#ifdef STANDARD_MEMORY_BIOS_CALL - if (EXT_MEM_K < 1024) - error("Less than 2MB of memory.\n"); -#else - if ((ALT_MEM_K > EXT_MEM_K ? ALT_MEM_K : EXT_MEM_K) < 1024) - error("Less than 2MB of memory.\n"); -#endif - output_data = (char *) 0x100000; /* Points to 1M */ -} - -struct moveparams { - uch *low_buffer_start; - int lcount; - uch *high_buffer_start; - int hcount; -}; - -void setup_output_buffer_if_we_run_high(struct moveparams *mv) -{ - high_buffer_start = (uch *)(((ulg) &end) + HEAP_SIZE); -#ifdef STANDARD_MEMORY_BIOS_CALL - if (EXT_MEM_K < (3 * 1024)) - error("Less than 4MB of memory.\n"); -#else - if ((ALT_MEM_K > EXT_MEM_K ? ALT_MEM_K : EXT_MEM_K) < (3 * 1024)) - error("Less than 4MB of memory.\n"); -#endif - mv->low_buffer_start = output_data = (char *) LOW_BUFFER_START; - high_loaded = 1; - free_mem_end_ptr = (long) high_buffer_start; - if (0x100000 + LOW_BUFFER_SIZE > (ulg) high_buffer_start) { - high_buffer_start = (uch *)(0x100000 + LOW_BUFFER_SIZE); - mv->hcount = 0; /* say: we need not to move high_buffer */ - } else { - mv->hcount = -1; - } - mv->high_buffer_start = high_buffer_start; -} - -void close_output_buffer_if_we_run_high(struct moveparams *mv) -{ - mv->lcount = bytes_out; - if (bytes_out > LOW_BUFFER_SIZE) { - mv->lcount = LOW_BUFFER_SIZE; - if (mv->hcount) - mv->hcount = bytes_out - LOW_BUFFER_SIZE; - } else { - mv->hcount = 0; - } -} - -#undef DEBUGFLAG -#ifdef DEBUGFLAG -int debugflag; -#endif - -int decompress_kernel(struct moveparams *mv) -{ -#ifdef DEBUGFLAG - while (!debugflag) - barrier(); -#endif - - output_data = (char *) CONFIG_KERNEL_TEXT_ADDRESS; - - makecrc(); - kputs("Uncompressing Linux... "); - gunzip(); - kputs("Ok, booting the kernel.\n"); - return 0; -} diff --git a/arch/mn10300/boot/compressed/misc.h b/arch/mn10300/boot/compressed/misc.h deleted file mode 100644 index da921cd172fba..0000000000000 --- a/arch/mn10300/boot/compressed/misc.h +++ /dev/null @@ -1,18 +0,0 @@ -/* Internal definitions for the MN10300 kernel decompressor - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - -extern int end; - -/* - * vmlinux.lds - */ -extern char input_data[]; -extern int input_len; diff --git a/arch/mn10300/boot/compressed/vmlinux.lds b/arch/mn10300/boot/compressed/vmlinux.lds deleted file mode 100644 index a084903603fe4..0000000000000 --- a/arch/mn10300/boot/compressed/vmlinux.lds +++ /dev/null @@ -1,9 +0,0 @@ -SECTIONS -{ - .data : { - input_len = .; - LONG(input_data_end - input_data) input_data = .; - *(.data) - input_data_end = .; - } -} diff --git a/arch/mn10300/boot/install.sh b/arch/mn10300/boot/install.sh deleted file mode 100644 index abba30971191b..0000000000000 --- a/arch/mn10300/boot/install.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/sh -# -# arch/mn10300/boot/install -c.sh -# -# This file is subject to the terms and conditions of the GNU General Public -# Licence. See the file "COPYING" in the main directory of this archive -# for more details. -# -# Copyright (C) 1995 by Linus Torvalds -# -# Adapted from code in arch/i386/boot/Makefile by H. Peter Anvin -# -# "make install -c" script for i386 architecture -# -# Arguments: -# $1 - kernel version -# $2 - kernel image file -# $3 - kernel map file -# $4 - default install -c path (blank if root directory) -# $5 - boot rom file -# - -# User may have a custom install -c script - -rm -fr $4/../usr/include/linux $4/../usr/include/asm -install -c -m 0755 $2 $4/vmlinuz -install -c -m 0755 $5 $4/boot.rom -install -c -m 0755 -d $4/../usr/include/linux -cd ${srctree}/include/linux -for i in `find . -maxdepth 1 -name '*.h' -print`; do - install -c -m 0644 $i $4/../usr/include/linux -done -install -c -m 0755 -d $4/../usr/include/linux/byteorder -cd ${srctree}/include/linux/byteorder -for i in `find . -name '*.h' -print`; do - install -c -m 0644 $i $4/../usr/include/linux/byteorder -done -install -c -m 0755 -d $4/../usr/include/linux/lockd -cd ${srctree}/include/linux/lockd -for i in `find . -name '*.h' -print`; do - install -c -m 0644 $i $4/../usr/include/linux/lockd -done -install -c -m 0755 -d $4/../usr/include/linux/netfilter_ipv4 -cd ${srctree}/include/linux/netfilter_ipv4 -for i in `find . -name '*.h' -print`; do - install -c -m 0644 $i $4/../usr/include/linux/netfilter_ipv4 -done -install -c -m 0755 -d $4/../usr/include/linux/nfsd -cd ${srctree}/include/linux/nfsd -for i in `find . -name '*.h' -print`; do - install -c -m 0644 $i $4/../usr/include/linux/nfsd/$i -done -install -c -m 0755 -d $4/../usr/include/linux/raid -cd ${srctree}/include/linux/raid -for i in `find . -name '*.h' -print`; do - install -c -m 0644 $i $4/../usr/include/linux/raid -done -install -c -m 0755 -d $4/../usr/include/linux/sunrpc -cd ${srctree}/include/linux/sunrpc -for i in `find . -name '*.h' -print`; do - install -c -m 0644 $i $4/../usr/include/linux/sunrpc -done -install -c -m 0755 -d $4/../usr/include/asm -cd ${srctree}/include/asm -for i in `find . -name '*.h' -print`; do - install -c -m 0644 $i $4/../usr/include/asm -done diff --git a/arch/mn10300/boot/tools/build.c b/arch/mn10300/boot/tools/build.c deleted file mode 100644 index 3ce158fe07b05..0000000000000 --- a/arch/mn10300/boot/tools/build.c +++ /dev/null @@ -1,191 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Copyright (C) 1991, 1992 Linus Torvalds - * Copyright (C) 1997 Martin Mares - */ - -/* - * This file builds a disk-image from three different files: - * - * - bootsect: exactly 512 bytes of 8086 machine code, loads the rest - * - setup: 8086 machine code, sets up system parm - * - system: 80386 code for actual system - * - * It does some checking that all files are of the correct type, and - * just writes the result to stdout, removing headers and padding to - * the right amount. It also writes some system data to stderr. - */ - -/* - * Changes by tytso to allow root device specification - * High loaded stuff by Hans Lermen & Werner Almesberger, Feb. 1996 - * Cross compiling fixes by Gertjan van Wingerde, July 1996 - * Rewritten by Martin Mares, April 1997 - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define DEFAULT_MAJOR_ROOT 0 -#define DEFAULT_MINOR_ROOT 0 - -/* Minimal number of setup sectors (see also bootsect.S) */ -#define SETUP_SECTS 4 - -uint8_t buf[1024]; -int fd; -int is_big_kernel; - -__attribute__((noreturn)) -void die(const char *str, ...) -{ - va_list args; - va_start(args, str); - vfprintf(stderr, str, args); - fputc('\n', stderr); - exit(1); -} - -void file_open(const char *name) -{ - fd = open(name, O_RDONLY, 0); - if (fd < 0) - die("Unable to open `%s': %m", name); -} - -__attribute__((noreturn)) -void usage(void) -{ - die("Usage: build [-b] bootsect setup system [rootdev] [> image]"); -} - -int main(int argc, char **argv) -{ - unsigned int i, c, sz, setup_sectors; - uint32_t sys_size; - uint8_t major_root, minor_root; - struct stat sb; - - if (argc > 2 && !strcmp(argv[1], "-b")) { - is_big_kernel = 1; - argc--, argv++; - } - if ((argc < 4) || (argc > 5)) - usage(); - if (argc > 4) { - if (!strcmp(argv[4], "CURRENT")) { - if (stat("/", &sb)) { - perror("/"); - die("Couldn't stat /"); - } - major_root = major(sb.st_dev); - minor_root = minor(sb.st_dev); - } else if (strcmp(argv[4], "FLOPPY")) { - if (stat(argv[4], &sb)) { - perror(argv[4]); - die("Couldn't stat root device."); - } - major_root = major(sb.st_rdev); - minor_root = minor(sb.st_rdev); - } else { - major_root = 0; - minor_root = 0; - } - } else { - major_root = DEFAULT_MAJOR_ROOT; - minor_root = DEFAULT_MINOR_ROOT; - } - fprintf(stderr, "Root device is (%d, %d)\n", major_root, minor_root); - - file_open(argv[1]); - i = read(fd, buf, sizeof(buf)); - fprintf(stderr, "Boot sector %d bytes.\n", i); - if (i != 512) - die("Boot block must be exactly 512 bytes"); - if (buf[510] != 0x55 || buf[511] != 0xaa) - die("Boot block hasn't got boot flag (0xAA55)"); - buf[508] = minor_root; - buf[509] = major_root; - if (write(1, buf, 512) != 512) - die("Write call failed"); - close(fd); - - /* Copy the setup code */ - file_open(argv[2]); - for (i = 0; (c = read(fd, buf, sizeof(buf))) > 0; i += c) - if (write(1, buf, c) != c) - die("Write call failed"); - if (c != 0) - die("read-error on `setup'"); - close(fd); - - /* Pad unused space with zeros */ - setup_sectors = (i + 511) / 512; - /* for compatibility with ancient versions of LILO. */ - if (setup_sectors < SETUP_SECTS) - setup_sectors = SETUP_SECTS; - fprintf(stderr, "Setup is %d bytes.\n", i); - memset(buf, 0, sizeof(buf)); - while (i < setup_sectors * 512) { - c = setup_sectors * 512 - i; - if (c > sizeof(buf)) - c = sizeof(buf); - if (write(1, buf, c) != c) - die("Write call failed"); - i += c; - } - - file_open(argv[3]); - if (fstat(fd, &sb)) - die("Unable to stat `%s': %m", argv[3]); - sz = sb.st_size; - fprintf(stderr, "System is %d kB\n", sz / 1024); - sys_size = (sz + 15) / 16; - /* 0x28000*16 = 2.5 MB, conservative estimate for the current maximum */ - if (sys_size > (is_big_kernel ? 0x28000 : DEF_SYSSIZE)) - die("System is too big. Try using %smodules.", - is_big_kernel ? "" : "bzImage or "); - if (sys_size > 0xffff) - fprintf(stderr, - "warning: kernel is too big for standalone boot " - "from floppy\n"); - while (sz > 0) { - int l, n; - - l = (sz > sizeof(buf)) ? sizeof(buf) : sz; - n = read(fd, buf, l); - if (n != l) { - if (n < 0) - die("Error reading %s: %m", argv[3]); - else - die("%s: Unexpected EOF", argv[3]); - } - if (write(1, buf, l) != l) - die("Write failed"); - sz -= l; - } - close(fd); - - /* Write sizes to the bootsector */ - if (lseek(1, 497, SEEK_SET) != 497) - die("Output: seek failed"); - buf[0] = setup_sectors; - if (write(1, buf, 1) != 1) - die("Write of setup sector count failed"); - if (lseek(1, 500, SEEK_SET) != 500) - die("Output: seek failed"); - buf[0] = (sys_size & 0xff); - buf[1] = ((sys_size >> 8) & 0xff); - if (write(1, buf, 2) != 2) - die("Write of image length failed"); - - return 0; -} diff --git a/arch/mn10300/configs/asb2303_defconfig b/arch/mn10300/configs/asb2303_defconfig deleted file mode 100644 index d06dae131139c..0000000000000 --- a/arch/mn10300/configs/asb2303_defconfig +++ /dev/null @@ -1,67 +0,0 @@ -CONFIG_SYSVIPC=y -CONFIG_BSD_PROCESS_ACCT=y -CONFIG_TINY_RCU=y -CONFIG_LOG_BUF_SHIFT=14 -# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set -CONFIG_EXPERT=y -# CONFIG_KALLSYMS is not set -# CONFIG_HOTPLUG is not set -# CONFIG_VM_EVENT_COUNTERS is not set -CONFIG_SLAB=y -CONFIG_PROFILING=y -# CONFIG_BLOCK is not set -CONFIG_PREEMPT=y -CONFIG_NO_HZ=y -CONFIG_HIGH_RES_TIMERS=y -CONFIG_MN10300_RTC=y -CONFIG_MN10300_TTYSM_CONSOLE=y -CONFIG_MN10300_TTYSM0=y -CONFIG_MN10300_TTYSM1=y -CONFIG_NET=y -CONFIG_PACKET=y -CONFIG_UNIX=y -CONFIG_INET=y -CONFIG_IP_MULTICAST=y -CONFIG_IP_PNP=y -CONFIG_IP_PNP_BOOTP=y -# CONFIG_INET_XFRM_MODE_TRANSPORT is not set -# CONFIG_INET_XFRM_MODE_TUNNEL is not set -# CONFIG_INET_XFRM_MODE_BEET is not set -# CONFIG_INET_DIAG is not set -# CONFIG_IPV6 is not set -# CONFIG_WIRELESS is not set -CONFIG_MTD=y -CONFIG_MTD_DEBUG=y -CONFIG_MTD_REDBOOT_PARTS=y -CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED=y -CONFIG_MTD_CFI=y -CONFIG_MTD_JEDECPROBE=y -CONFIG_MTD_CFI_ADV_OPTIONS=y -CONFIG_MTD_CFI_GEOMETRY=y -CONFIG_MTD_CFI_I4=y -CONFIG_MTD_CFI_AMDSTD=y -CONFIG_MTD_PHYSMAP=y -CONFIG_NETDEVICES=y -CONFIG_NET_ETHERNET=y -CONFIG_SMC91X=y -# CONFIG_WLAN is not set -# CONFIG_INPUT is not set -# CONFIG_SERIO is not set -# CONFIG_VT is not set -CONFIG_SERIAL_8250=y -CONFIG_SERIAL_8250_CONSOLE=y -CONFIG_SERIAL_8250_EXTENDED=y -CONFIG_SERIAL_8250_SHARE_IRQ=y -# CONFIG_HW_RANDOM is not set -CONFIG_RTC=y -# CONFIG_HWMON is not set -# CONFIG_USB_SUPPORT is not set -CONFIG_PROC_KCORE=y -# CONFIG_PROC_PAGE_MONITOR is not set -CONFIG_TMPFS=y -CONFIG_JFFS2_FS=y -CONFIG_NFS_FS=y -CONFIG_NFS_V3=y -CONFIG_ROOT_NFS=y -CONFIG_MAGIC_SYSRQ=y -CONFIG_STRIP_ASM_SYMS=y diff --git a/arch/mn10300/configs/asb2364_defconfig b/arch/mn10300/configs/asb2364_defconfig deleted file mode 100644 index a84c3153f22a5..0000000000000 --- a/arch/mn10300/configs/asb2364_defconfig +++ /dev/null @@ -1,87 +0,0 @@ -CONFIG_SYSVIPC=y -CONFIG_POSIX_MQUEUE=y -CONFIG_BSD_PROCESS_ACCT=y -CONFIG_TASKSTATS=y -CONFIG_TASK_DELAY_ACCT=y -CONFIG_TASK_XACCT=y -CONFIG_TASK_IO_ACCOUNTING=y -CONFIG_LOG_BUF_SHIFT=14 -CONFIG_CGROUPS=y -CONFIG_CGROUP_FREEZER=y -CONFIG_CGROUP_DEVICE=y -CONFIG_CGROUP_CPUACCT=y -CONFIG_RELAY=y -# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set -CONFIG_EXPERT=y -# CONFIG_KALLSYMS is not set -# CONFIG_VM_EVENT_COUNTERS is not set -CONFIG_SLAB=y -CONFIG_PROFILING=y -CONFIG_MODULES=y -CONFIG_MODULE_UNLOAD=y -# CONFIG_BLOCK is not set -CONFIG_MN10300_UNIT_ASB2364=y -CONFIG_PREEMPT=y -# CONFIG_MN10300_USING_JTAG is not set -CONFIG_NO_HZ=y -CONFIG_HIGH_RES_TIMERS=y -CONFIG_MN10300_TTYSM_CONSOLE=y -CONFIG_MN10300_TTYSM0=y -CONFIG_MN10300_TTYSM0_TIMER2=y -CONFIG_MN10300_TTYSM1=y -CONFIG_NET=y -CONFIG_PACKET=y -CONFIG_UNIX=y -CONFIG_INET=y -CONFIG_IP_MULTICAST=y -CONFIG_IP_PNP=y -CONFIG_IP_PNP_BOOTP=y -# CONFIG_INET_XFRM_MODE_TRANSPORT is not set -# CONFIG_INET_XFRM_MODE_TUNNEL is not set -# CONFIG_INET_XFRM_MODE_BEET is not set -# CONFIG_INET_DIAG is not set -CONFIG_IPV6=y -# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set -# CONFIG_INET6_XFRM_MODE_TUNNEL is not set -# CONFIG_INET6_XFRM_MODE_BEET is not set -CONFIG_CONNECTOR=y -CONFIG_MTD=y -CONFIG_MTD_DEBUG=y -CONFIG_MTD_REDBOOT_PARTS=y -CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED=y -CONFIG_MTD_CFI=y -CONFIG_MTD_JEDECPROBE=y -CONFIG_MTD_CFI_ADV_OPTIONS=y -CONFIG_MTD_CFI_GEOMETRY=y -CONFIG_MTD_CFI_I4=y -CONFIG_MTD_CFI_AMDSTD=y -CONFIG_MTD_PHYSMAP=y -CONFIG_NETDEVICES=y -CONFIG_NET_ETHERNET=y -CONFIG_SMSC911X=y -# CONFIG_INPUT_MOUSEDEV is not set -# CONFIG_INPUT_KEYBOARD is not set -# CONFIG_INPUT_MOUSE is not set -# CONFIG_SERIO is not set -# CONFIG_VT is not set -CONFIG_SERIAL_8250=y -CONFIG_SERIAL_8250_CONSOLE=y -CONFIG_SERIAL_8250_EXTENDED=y -CONFIG_SERIAL_8250_SHARE_IRQ=y -# CONFIG_HW_RANDOM is not set -# CONFIG_HWMON is not set -# CONFIG_USB_SUPPORT is not set -CONFIG_PROC_KCORE=y -# CONFIG_PROC_PAGE_MONITOR is not set -CONFIG_TMPFS=y -CONFIG_TMPFS_POSIX_ACL=y -CONFIG_JFFS2_FS=y -CONFIG_NFS_FS=y -CONFIG_NFS_V3=y -CONFIG_ROOT_NFS=y -CONFIG_MAGIC_SYSRQ=y -CONFIG_STRIP_ASM_SYMS=y -CONFIG_DEBUG_KERNEL=y -CONFIG_DETECT_HUNG_TASK=y -# CONFIG_DEBUG_BUGVERBOSE is not set -CONFIG_DEBUG_INFO=y diff --git a/arch/mn10300/include/asm/Kbuild b/arch/mn10300/include/asm/Kbuild deleted file mode 100644 index 509c45a75d1fa..0000000000000 --- a/arch/mn10300/include/asm/Kbuild +++ /dev/null @@ -1,13 +0,0 @@ - -generic-y += barrier.h -generic-y += device.h -generic-y += exec.h -generic-y += extable.h -generic-y += fb.h -generic-y += irq_work.h -generic-y += mcs_spinlock.h -generic-y += mm-arch-hooks.h -generic-y += preempt.h -generic-y += sections.h -generic-y += trace_clock.h -generic-y += word-at-a-time.h diff --git a/arch/mn10300/include/asm/asm-offsets.h b/arch/mn10300/include/asm/asm-offsets.h deleted file mode 100644 index d370ee36a182b..0000000000000 --- a/arch/mn10300/include/asm/asm-offsets.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/arch/mn10300/include/asm/atomic.h b/arch/mn10300/include/asm/atomic.h deleted file mode 100644 index 36389efd45e8a..0000000000000 --- a/arch/mn10300/include/asm/atomic.h +++ /dev/null @@ -1,161 +0,0 @@ -/* MN10300 Atomic counter operations - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_ATOMIC_H -#define _ASM_ATOMIC_H - -#include -#include -#include - -#ifndef CONFIG_SMP -#include -#else - -/* - * Atomic operations that C can't guarantee us. Useful for - * resource counting etc.. - */ - -#define ATOMIC_INIT(i) { (i) } - -#ifdef __KERNEL__ - -/** - * atomic_read - read atomic variable - * @v: pointer of type atomic_t - * - * Atomically reads the value of @v. Note that the guaranteed - */ -#define atomic_read(v) READ_ONCE((v)->counter) - -/** - * atomic_set - set atomic variable - * @v: pointer of type atomic_t - * @i: required value - * - * Atomically sets the value of @v to @i. Note that the guaranteed - */ -#define atomic_set(v, i) WRITE_ONCE(((v)->counter), (i)) - -#define ATOMIC_OP(op) \ -static inline void atomic_##op(int i, atomic_t *v) \ -{ \ - int retval, status; \ - \ - asm volatile( \ - "1: mov %4,(_AAR,%3) \n" \ - " mov (_ADR,%3),%1 \n" \ - " " #op " %5,%1 \n" \ - " mov %1,(_ADR,%3) \n" \ - " mov (_ADR,%3),%0 \n" /* flush */ \ - " mov (_ASR,%3),%0 \n" \ - " or %0,%0 \n" \ - " bne 1b \n" \ - : "=&r"(status), "=&r"(retval), "=m"(v->counter) \ - : "a"(ATOMIC_OPS_BASE_ADDR), "r"(&v->counter), "r"(i) \ - : "memory", "cc"); \ -} - -#define ATOMIC_OP_RETURN(op) \ -static inline int atomic_##op##_return(int i, atomic_t *v) \ -{ \ - int retval, status; \ - \ - asm volatile( \ - "1: mov %4,(_AAR,%3) \n" \ - " mov (_ADR,%3),%1 \n" \ - " " #op " %5,%1 \n" \ - " mov %1,(_ADR,%3) \n" \ - " mov (_ADR,%3),%0 \n" /* flush */ \ - " mov (_ASR,%3),%0 \n" \ - " or %0,%0 \n" \ - " bne 1b \n" \ - : "=&r"(status), "=&r"(retval), "=m"(v->counter) \ - : "a"(ATOMIC_OPS_BASE_ADDR), "r"(&v->counter), "r"(i) \ - : "memory", "cc"); \ - return retval; \ -} - -#define ATOMIC_FETCH_OP(op) \ -static inline int atomic_fetch_##op(int i, atomic_t *v) \ -{ \ - int retval, status; \ - \ - asm volatile( \ - "1: mov %4,(_AAR,%3) \n" \ - " mov (_ADR,%3),%1 \n" \ - " mov %1,%0 \n" \ - " " #op " %5,%0 \n" \ - " mov %0,(_ADR,%3) \n" \ - " mov (_ADR,%3),%0 \n" /* flush */ \ - " mov (_ASR,%3),%0 \n" \ - " or %0,%0 \n" \ - " bne 1b \n" \ - : "=&r"(status), "=&r"(retval), "=m"(v->counter) \ - : "a"(ATOMIC_OPS_BASE_ADDR), "r"(&v->counter), "r"(i) \ - : "memory", "cc"); \ - return retval; \ -} - -#define ATOMIC_OPS(op) ATOMIC_OP(op) ATOMIC_OP_RETURN(op) ATOMIC_FETCH_OP(op) - -ATOMIC_OPS(add) -ATOMIC_OPS(sub) - -#undef ATOMIC_OPS -#define ATOMIC_OPS(op) ATOMIC_OP(op) ATOMIC_FETCH_OP(op) - -ATOMIC_OPS(and) -ATOMIC_OPS(or) -ATOMIC_OPS(xor) - -#undef ATOMIC_OPS -#undef ATOMIC_FETCH_OP -#undef ATOMIC_OP_RETURN -#undef ATOMIC_OP - -static inline int atomic_add_negative(int i, atomic_t *v) -{ - return atomic_add_return(i, v) < 0; -} - -static inline void atomic_inc(atomic_t *v) -{ - atomic_add_return(1, v); -} - -static inline void atomic_dec(atomic_t *v) -{ - atomic_sub_return(1, v); -} - -#define atomic_dec_return(v) atomic_sub_return(1, (v)) -#define atomic_inc_return(v) atomic_add_return(1, (v)) - -#define atomic_sub_and_test(i, v) (atomic_sub_return((i), (v)) == 0) -#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0) -#define atomic_inc_and_test(v) (atomic_add_return(1, (v)) == 0) - -#define __atomic_add_unless(v, a, u) \ -({ \ - int c, old; \ - c = atomic_read(v); \ - while (c != (u) && (old = atomic_cmpxchg((v), c, c + (a))) != c) \ - c = old; \ - c; \ -}) - -#define atomic_xchg(ptr, v) (xchg(&(ptr)->counter, (v))) -#define atomic_cmpxchg(v, old, new) (cmpxchg(&((v)->counter), (old), (new))) - -#endif /* __KERNEL__ */ -#endif /* CONFIG_SMP */ -#endif /* _ASM_ATOMIC_H */ diff --git a/arch/mn10300/include/asm/bitops.h b/arch/mn10300/include/asm/bitops.h deleted file mode 100644 index fe6f8e2c3617d..0000000000000 --- a/arch/mn10300/include/asm/bitops.h +++ /dev/null @@ -1,232 +0,0 @@ -/* MN10300 bit operations - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - * - * These have to be done with inline assembly: that way the bit-setting - * is guaranteed to be atomic. All bit operations return 0 if the bit - * was cleared before the operation and != 0 if it was not. - * - * bit 0 is the LSB of addr; bit 32 is the LSB of (addr+1). - */ -#ifndef __ASM_BITOPS_H -#define __ASM_BITOPS_H - -#include -#include - -/* - * set bit - */ -#define __set_bit(nr, addr) \ -({ \ - volatile unsigned char *_a = (unsigned char *)(addr); \ - const unsigned shift = (nr) & 7; \ - _a += (nr) >> 3; \ - \ - asm volatile("bset %2,(%1) # set_bit reg" \ - : "=m"(*_a) \ - : "a"(_a), "d"(1 << shift), "m"(*_a) \ - : "memory", "cc"); \ -}) - -#define set_bit(nr, addr) __set_bit((nr), (addr)) - -/* - * clear bit - */ -#define ___clear_bit(nr, addr) \ -({ \ - volatile unsigned char *_a = (unsigned char *)(addr); \ - const unsigned shift = (nr) & 7; \ - _a += (nr) >> 3; \ - \ - asm volatile("bclr %2,(%1) # clear_bit reg" \ - : "=m"(*_a) \ - : "a"(_a), "d"(1 << shift), "m"(*_a) \ - : "memory", "cc"); \ -}) - -#define clear_bit(nr, addr) ___clear_bit((nr), (addr)) - - -static inline void __clear_bit(unsigned long nr, volatile void *addr) -{ - unsigned int *a = (unsigned int *) addr; - int mask; - - a += nr >> 5; - mask = 1 << (nr & 0x1f); - *a &= ~mask; -} - -/* - * test bit - */ -static inline int test_bit(unsigned long nr, const volatile void *addr) -{ - return 1UL & (((const volatile unsigned int *) addr)[nr >> 5] >> (nr & 31)); -} - -/* - * change bit - */ -static inline void __change_bit(unsigned long nr, volatile void *addr) -{ - int mask; - unsigned int *a = (unsigned int *) addr; - - a += nr >> 5; - mask = 1 << (nr & 0x1f); - *a ^= mask; -} - -extern void change_bit(unsigned long nr, volatile void *addr); - -/* - * test and set bit - */ -#define __test_and_set_bit(nr,addr) \ -({ \ - volatile unsigned char *_a = (unsigned char *)(addr); \ - const unsigned shift = (nr) & 7; \ - unsigned epsw; \ - _a += (nr) >> 3; \ - \ - asm volatile("bset %3,(%2) # test_set_bit reg\n" \ - "mov epsw,%1" \ - : "=m"(*_a), "=d"(epsw) \ - : "a"(_a), "d"(1 << shift), "m"(*_a) \ - : "memory", "cc"); \ - \ - !(epsw & EPSW_FLAG_Z); \ -}) - -#define test_and_set_bit(nr, addr) __test_and_set_bit((nr), (addr)) - -/* - * test and clear bit - */ -#define __test_and_clear_bit(nr, addr) \ -({ \ - volatile unsigned char *_a = (unsigned char *)(addr); \ - const unsigned shift = (nr) & 7; \ - unsigned epsw; \ - _a += (nr) >> 3; \ - \ - asm volatile("bclr %3,(%2) # test_clear_bit reg\n" \ - "mov epsw,%1" \ - : "=m"(*_a), "=d"(epsw) \ - : "a"(_a), "d"(1 << shift), "m"(*_a) \ - : "memory", "cc"); \ - \ - !(epsw & EPSW_FLAG_Z); \ -}) - -#define test_and_clear_bit(nr, addr) __test_and_clear_bit((nr), (addr)) - -/* - * test and change bit - */ -static inline int __test_and_change_bit(unsigned long nr, volatile void *addr) -{ - int mask, retval; - unsigned int *a = (unsigned int *)addr; - - a += nr >> 5; - mask = 1 << (nr & 0x1f); - retval = (mask & *a) != 0; - *a ^= mask; - - return retval; -} - -extern int test_and_change_bit(unsigned long nr, volatile void *addr); - -#include - -#ifdef __KERNEL__ - -/** - * __ffs - find first bit set - * @x: the word to search - * - * - return 31..0 to indicate bit 31..0 most least significant bit set - * - if no bits are set in x, the result is undefined - */ -static inline __attribute__((const)) -unsigned long __ffs(unsigned long x) -{ - int bit; - asm("bsch %2,%0" : "=r"(bit) : "0"(0), "r"(x & -x) : "cc"); - return bit; -} - -/* - * special slimline version of fls() for calculating ilog2_u32() - * - note: no protection against n == 0 - */ -static inline __attribute__((const)) -int __ilog2_u32(u32 n) -{ - int bit; - asm("bsch %2,%0" : "=r"(bit) : "0"(0), "r"(n) : "cc"); - return bit; -} - -/** - * fls - find last bit set - * @x: the word to search - * - * This is defined the same way as ffs: - * - return 32..1 to indicate bit 31..0 most significant bit set - * - return 0 to indicate no bits set - */ -static inline __attribute__((const)) -int fls(int x) -{ - return (x != 0) ? __ilog2_u32(x) + 1 : 0; -} - -/** - * __fls - find last (most-significant) set bit in a long word - * @word: the word to search - * - * Undefined if no set bit exists, so code should check against 0 first. - */ -static inline unsigned long __fls(unsigned long word) -{ - return __ilog2_u32(word); -} - -/** - * ffs - find first bit set - * @x: the word to search - * - * - return 32..1 to indicate bit 31..0 most least significant bit set - * - return 0 to indicate no bits set - */ -static inline __attribute__((const)) -int ffs(int x) -{ - /* Note: (x & -x) gives us a mask that is the least significant - * (rightmost) 1-bit of the value in x. - */ - return fls(x & -x); -} - -#include -#include -#include -#include -#include -#include -#include - -#endif /* __KERNEL__ */ -#endif /* __ASM_BITOPS_H */ diff --git a/arch/mn10300/include/asm/bug.h b/arch/mn10300/include/asm/bug.h deleted file mode 100644 index 811414fb002de..0000000000000 --- a/arch/mn10300/include/asm/bug.h +++ /dev/null @@ -1,37 +0,0 @@ -/* MN10300 Kernel bug reporting - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_BUG_H -#define _ASM_BUG_H - -#ifdef CONFIG_BUG - -/* - * Tell the user there is some problem. - */ -#define BUG() \ -do { \ - asm volatile( \ - " syscall 15 \n" \ - "0: \n" \ - " .section __bug_table,\"aw\" \n" \ - " .long 0b,%0,%1 \n" \ - " .previous \n" \ - : \ - : "i"(__FILE__), "i"(__LINE__) \ - ); \ -} while (1) - -#define HAVE_ARCH_BUG -#endif /* CONFIG_BUG */ - -#include - -#endif /* _ASM_BUG_H */ diff --git a/arch/mn10300/include/asm/bugs.h b/arch/mn10300/include/asm/bugs.h deleted file mode 100644 index 31c8bc592b47d..0000000000000 --- a/arch/mn10300/include/asm/bugs.h +++ /dev/null @@ -1,20 +0,0 @@ -/* MN10300 Checks for architecture-dependent bugs - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_BUGS_H -#define _ASM_BUGS_H - -#include - -static inline void __init check_bugs(void) -{ -} - -#endif /* _ASM_BUGS_H */ diff --git a/arch/mn10300/include/asm/busctl-regs.h b/arch/mn10300/include/asm/busctl-regs.h deleted file mode 100644 index 1632aef734012..0000000000000 --- a/arch/mn10300/include/asm/busctl-regs.h +++ /dev/null @@ -1,151 +0,0 @@ -/* AM33v2 on-board bus controller registers - * - * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - -#ifndef _ASM_BUSCTL_REGS_H -#define _ASM_BUSCTL_REGS_H - -#include - -#ifdef __KERNEL__ - -/* bus controller registers */ -#define BCCR __SYSREG(0xc0002000, u32) /* bus controller control reg */ -#define BCCR_B0AD 0x00000003 /* block 0 (80000000-83ffffff) bus allocation */ -#define BCCR_B1AD 0x0000000c /* block 1 (84000000-87ffffff) bus allocation */ -#define BCCR_B2AD 0x00000030 /* block 2 (88000000-8bffffff) bus allocation */ -#define BCCR_B3AD 0x000000c0 /* block 3 (8c000000-8fffffff) bus allocation */ -#define BCCR_B4AD 0x00000300 /* block 4 (90000000-93ffffff) bus allocation */ -#define BCCR_B5AD 0x00000c00 /* block 5 (94000000-97ffffff) bus allocation */ -#define BCCR_B6AD 0x00003000 /* block 6 (98000000-9bffffff) bus allocation */ -#define BCCR_B7AD 0x0000c000 /* block 7 (9c000000-9fffffff) bus allocation */ -#define BCCR_BxAD_EXBUS 0x0 /* - direct to system bus controller */ -#define BCCR_BxAD_OPEXBUS 0x1 /* - direct to memory bus controller */ -#define BCCR_BxAD_OCMBUS 0x2 /* - direct to on chip memory */ -#define BCCR_API 0x00070000 /* bus arbitration priority */ -#define BCCR_API_DMACICD 0x00000000 /* - DMA > CI > CD */ -#define BCCR_API_DMACDCI 0x00010000 /* - DMA > CD > CI */ -#define BCCR_API_CICDDMA 0x00020000 /* - CI > CD > DMA */ -#define BCCR_API_CDCIDMA 0x00030000 /* - CD > CI > DMA */ -#define BCCR_API_ROUNDROBIN 0x00040000 /* - round robin */ -#define BCCR_BEPRI_DMACICD 0x00c00000 /* bus error address priority */ -#define BCCR_BEPRI_DMACDCI 0x00000000 /* - DMA > CI > CD */ -#define BCCR_BEPRI_CICDDMA 0x00400000 /* - DMA > CD > CI */ -#define BCCR_BEPRI_CDCIDMA 0x00800000 /* - CI > CD > DMA */ -#define BCCR_BEPRI 0x00c00000 /* - CD > CI > DMA */ -#define BCCR_TMON 0x03000000 /* timeout value settings */ -#define BCCR_TMON_16IOCLK 0x00000000 /* - 16 IOCLK cycles */ -#define BCCR_TMON_256IOCLK 0x01000000 /* - 256 IOCLK cycles */ -#define BCCR_TMON_4096IOCLK 0x02000000 /* - 4096 IOCLK cycles */ -#define BCCR_TMON_65536IOCLK 0x03000000 /* - 65536 IOCLK cycles */ -#define BCCR_TMOE 0x10000000 /* timeout detection enable */ - -#define BCBERR __SYSREG(0xc0002010, u32) /* bus error source reg */ -#define BCBERR_BESB 0x0000001f /* erroneous access destination space */ -#define BCBERR_BESB_MON 0x00000001 /* - monitor space */ -#define BCBERR_BESB_IO 0x00000002 /* - IO bus */ -#define BCBERR_BESB_EX 0x00000004 /* - EX bus */ -#define BCBERR_BESB_OPEX 0x00000008 /* - OpEX bus */ -#define BCBERR_BESB_OCM 0x00000010 /* - on chip memory */ -#define BCBERR_BERW 0x00000100 /* type of access */ -#define BCBERR_BERW_WRITE 0x00000000 /* - write */ -#define BCBERR_BERW_READ 0x00000100 /* - read */ -#define BCBERR_BESD 0x00000200 /* error detector */ -#define BCBERR_BESD_BCU 0x00000000 /* - BCU detected error */ -#define BCBERR_BESD_SLAVE_BUS 0x00000200 /* - slave bus detected error */ -#define BCBERR_BEBST 0x00000400 /* type of access */ -#define BCBERR_BEBST_SINGLE 0x00000000 /* - single */ -#define BCBERR_BEBST_BURST 0x00000400 /* - burst */ -#define BCBERR_BEME 0x00000800 /* multiple bus error flag */ -#define BCBERR_BEMR 0x00007000 /* master bus that caused the error */ -#define BCBERR_BEMR_NOERROR 0x00000000 /* - no error */ -#define BCBERR_BEMR_CI 0x00001000 /* - CPU instruction fetch bus caused error */ -#define BCBERR_BEMR_CD 0x00002000 /* - CPU data bus caused error */ -#define BCBERR_BEMR_DMA 0x00004000 /* - DMA bus caused error */ - -#define BCBEAR __SYSREGC(0xc0002020, u32) /* bus error address reg */ - -/* system bus controller registers */ -#define SBBASE(X) __SYSREG(0xd8c00100 + (X) * 0x10, u32) /* SBC base addr regs */ -#define SBBASE_BE 0x00000001 /* bank enable */ -#define SBBASE_BAM 0x0000fffe /* bank address mask [31:17] */ -#define SBBASE_BBA 0xfffe0000 /* bank base address [31:17] */ - -#define SBCNTRL0(X) __SYSREG(0xd8c00200 + (X) * 0x10, u32) /* SBC bank ctrl0 regs */ -#define SBCNTRL0_WEH 0x00000f00 /* write enable hold */ -#define SBCNTRL0_REH 0x0000f000 /* read enable hold */ -#define SBCNTRL0_RWH 0x000f0000 /* SRW signal hold */ -#define SBCNTRL0_CSH 0x00f00000 /* chip select hold */ -#define SBCNTRL0_DAH 0x0f000000 /* data hold */ -#define SBCNTRL0_ADH 0xf0000000 /* address hold */ - -#define SBCNTRL1(X) __SYSREG(0xd8c00204 + (X) * 0x10, u32) /* SBC bank ctrl1 regs */ -#define SBCNTRL1_WED 0x00000f00 /* write enable delay */ -#define SBCNTRL1_RED 0x0000f000 /* read enable delay */ -#define SBCNTRL1_RWD 0x000f0000 /* SRW signal delay */ -#define SBCNTRL1_ASW 0x00f00000 /* address strobe width */ -#define SBCNTRL1_CSD 0x0f000000 /* chip select delay */ -#define SBCNTRL1_ASD 0xf0000000 /* address strobe delay */ - -#define SBCNTRL2(X) __SYSREG(0xd8c00208 + (X) * 0x10, u32) /* SBC bank ctrl2 regs */ -#define SBCNTRL2_WC 0x000000ff /* wait count */ -#define SBCNTRL2_BWC 0x00000f00 /* burst wait count */ -#define SBCNTRL2_WM 0x01000000 /* wait mode setting */ -#define SBCNTRL2_WM_FIXEDWAIT 0x00000000 /* - fixed wait access */ -#define SBCNTRL2_WM_HANDSHAKE 0x01000000 /* - handshake access */ -#define SBCNTRL2_BM 0x02000000 /* bus synchronisation mode */ -#define SBCNTRL2_BM_SYNC 0x00000000 /* - synchronous mode */ -#define SBCNTRL2_BM_ASYNC 0x02000000 /* - asynchronous mode */ -#define SBCNTRL2_BW 0x04000000 /* bus width */ -#define SBCNTRL2_BW_32 0x00000000 /* - 32 bits */ -#define SBCNTRL2_BW_16 0x04000000 /* - 16 bits */ -#define SBCNTRL2_RWINV 0x08000000 /* R/W signal invert polarity */ -#define SBCNTRL2_RWINV_NORM 0x00000000 /* - normal (read high) */ -#define SBCNTRL2_RWINV_INV 0x08000000 /* - inverted (read low) */ -#define SBCNTRL2_BT 0x70000000 /* bus type setting */ -#define SBCNTRL2_BT_SRAM 0x00000000 /* - SRAM interface */ -#define SBCNTRL2_BT_ADMUX 0x00000000 /* - addr/data multiplexed interface */ -#define SBCNTRL2_BT_BROM 0x00000000 /* - burst ROM interface */ -#define SBCNTRL2_BTSE 0x80000000 /* burst enable */ - -/* memory bus controller */ -#define SDBASE(X) __SYSREG(0xda000008 + (X) * 0x4, u32) /* MBC base addr regs */ -#define SDBASE_CE 0x00000001 /* chip enable */ -#define SDBASE_CBAM 0x0000fff0 /* chip base address mask [31:20] */ -#define SDBASE_CBAM_SHIFT 16 -#define SDBASE_CBA 0xfff00000 /* chip base address [31:20] */ - -#define SDRAMBUS __SYSREG(0xda000000, u32) /* bus mode control reg */ -#define SDRAMBUS_REFEN 0x00000004 /* refresh enable */ -#define SDRAMBUS_TRC 0x00000018 /* refresh command delay time */ -#define SDRAMBUS_BSTPT 0x00000020 /* burst stop command enable */ -#define SDRAMBUS_PONSEQ 0x00000040 /* power on sequence */ -#define SDRAMBUS_SELFREQ 0x00000080 /* self-refresh mode request */ -#define SDRAMBUS_SELFON 0x00000100 /* self-refresh mode on */ -#define SDRAMBUS_SIZE 0x00030000 /* SDRAM size */ -#define SDRAMBUS_SIZE_64Mbit 0x00010000 /* 64Mbit SDRAM (x16) */ -#define SDRAMBUS_SIZE_128Mbit 0x00020000 /* 128Mbit SDRAM (x16) */ -#define SDRAMBUS_SIZE_256Mbit 0x00030000 /* 256Mbit SDRAM (x16) */ -#define SDRAMBUS_TRASWAIT 0x000c0000 /* row address precharge command cycle number */ -#define SDRAMBUS_REFNUM 0x00300000 /* refresh command number */ -#define SDRAMBUS_BSTWAIT 0x00c00000 /* burst stop command cycle */ -#define SDRAMBUS_SETWAIT 0x03000000 /* mode register setting command cycle */ -#define SDRAMBUS_PREWAIT 0x0c000000 /* precharge command cycle */ -#define SDRAMBUS_RASLATE 0x30000000 /* RAS latency */ -#define SDRAMBUS_CASLATE 0xc0000000 /* CAS latency */ - -#define SDREFCNT __SYSREG(0xda000004, u32) /* refresh period reg */ -#define SDREFCNT_PERI 0x00000fff /* refresh period */ - -#define SDSHDW __SYSREG(0xda000010, u32) /* test reg */ - -#endif /* __KERNEL__ */ - -#endif /* _ASM_BUSCTL_REGS_H */ diff --git a/arch/mn10300/include/asm/cache.h b/arch/mn10300/include/asm/cache.h deleted file mode 100644 index f29cde2cfc91a..0000000000000 --- a/arch/mn10300/include/asm/cache.h +++ /dev/null @@ -1,60 +0,0 @@ -/* MN10300 cache management registers - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - -#ifndef _ASM_CACHE_H -#define _ASM_CACHE_H - -#include -#include - -#ifndef __ASSEMBLY__ -#define L1_CACHE_DISPARITY (L1_CACHE_NENTRIES * L1_CACHE_BYTES) -#else -#define L1_CACHE_DISPARITY L1_CACHE_NENTRIES * L1_CACHE_BYTES -#endif - -#define ARCH_DMA_MINALIGN L1_CACHE_BYTES - -/* data cache purge registers - * - read from the register to unconditionally purge that cache line - * - write address & 0xffffff00 to conditionally purge that cache line - * - clear LSB to request invalidation as well - */ -#define DCACHE_PURGE(WAY, ENTRY) \ - __SYSREG(0xc8400000 + (WAY) * L1_CACHE_WAYDISP + \ - (ENTRY) * L1_CACHE_BYTES, u32) - -#define DCACHE_PURGE_WAY0(ENTRY) \ - __SYSREG(0xc8400000 + 0 * L1_CACHE_WAYDISP + (ENTRY) * L1_CACHE_BYTES, u32) -#define DCACHE_PURGE_WAY1(ENTRY) \ - __SYSREG(0xc8400000 + 1 * L1_CACHE_WAYDISP + (ENTRY) * L1_CACHE_BYTES, u32) -#define DCACHE_PURGE_WAY2(ENTRY) \ - __SYSREG(0xc8400000 + 2 * L1_CACHE_WAYDISP + (ENTRY) * L1_CACHE_BYTES, u32) -#define DCACHE_PURGE_WAY3(ENTRY) \ - __SYSREG(0xc8400000 + 3 * L1_CACHE_WAYDISP + (ENTRY) * L1_CACHE_BYTES, u32) - -/* instruction cache access registers */ -#define ICACHE_DATA(WAY, ENTRY, OFF) \ - __SYSREG(0xc8000000 + (WAY) * L1_CACHE_WAYDISP + \ - (ENTRY) * L1_CACHE_BYTES + (OFF) * 4, u32) -#define ICACHE_TAG(WAY, ENTRY) \ - __SYSREG(0xc8100000 + (WAY) * L1_CACHE_WAYDISP + \ - (ENTRY) * L1_CACHE_BYTES, u32) - -/* data cache access registers */ -#define DCACHE_DATA(WAY, ENTRY, OFF) \ - __SYSREG(0xc8200000 + (WAY) * L1_CACHE_WAYDISP + \ - (ENTRY) * L1_CACHE_BYTES + (OFF) * 4, u32) -#define DCACHE_TAG(WAY, ENTRY) \ - __SYSREG(0xc8300000 + (WAY) * L1_CACHE_WAYDISP + \ - (ENTRY) * L1_CACHE_BYTES, u32) - -#endif /* _ASM_CACHE_H */ diff --git a/arch/mn10300/include/asm/cacheflush.h b/arch/mn10300/include/asm/cacheflush.h deleted file mode 100644 index 6d6df839948f6..0000000000000 --- a/arch/mn10300/include/asm/cacheflush.h +++ /dev/null @@ -1,164 +0,0 @@ -/* MN10300 Cache flushing - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_CACHEFLUSH_H -#define _ASM_CACHEFLUSH_H - -#ifndef __ASSEMBLY__ - -/* Keep includes the same across arches. */ -#include - -/* - * Primitive routines - */ -#ifdef CONFIG_MN10300_CACHE_ENABLED -extern void mn10300_local_icache_inv(void); -extern void mn10300_local_icache_inv_page(unsigned long start); -extern void mn10300_local_icache_inv_range(unsigned long start, unsigned long end); -extern void mn10300_local_icache_inv_range2(unsigned long start, unsigned long size); -extern void mn10300_local_dcache_inv(void); -extern void mn10300_local_dcache_inv_page(unsigned long start); -extern void mn10300_local_dcache_inv_range(unsigned long start, unsigned long end); -extern void mn10300_local_dcache_inv_range2(unsigned long start, unsigned long size); -extern void mn10300_icache_inv(void); -extern void mn10300_icache_inv_page(unsigned long start); -extern void mn10300_icache_inv_range(unsigned long start, unsigned long end); -extern void mn10300_icache_inv_range2(unsigned long start, unsigned long size); -extern void mn10300_dcache_inv(void); -extern void mn10300_dcache_inv_page(unsigned long start); -extern void mn10300_dcache_inv_range(unsigned long start, unsigned long end); -extern void mn10300_dcache_inv_range2(unsigned long start, unsigned long size); -#ifdef CONFIG_MN10300_CACHE_WBACK -extern void mn10300_local_dcache_flush(void); -extern void mn10300_local_dcache_flush_page(unsigned long start); -extern void mn10300_local_dcache_flush_range(unsigned long start, unsigned long end); -extern void mn10300_local_dcache_flush_range2(unsigned long start, unsigned long size); -extern void mn10300_local_dcache_flush_inv(void); -extern void mn10300_local_dcache_flush_inv_page(unsigned long start); -extern void mn10300_local_dcache_flush_inv_range(unsigned long start, unsigned long end); -extern void mn10300_local_dcache_flush_inv_range2(unsigned long start, unsigned long size); -extern void mn10300_dcache_flush(void); -extern void mn10300_dcache_flush_page(unsigned long start); -extern void mn10300_dcache_flush_range(unsigned long start, unsigned long end); -extern void mn10300_dcache_flush_range2(unsigned long start, unsigned long size); -extern void mn10300_dcache_flush_inv(void); -extern void mn10300_dcache_flush_inv_page(unsigned long start); -extern void mn10300_dcache_flush_inv_range(unsigned long start, unsigned long end); -extern void mn10300_dcache_flush_inv_range2(unsigned long start, unsigned long size); -#else -#define mn10300_local_dcache_flush() do {} while (0) -#define mn10300_local_dcache_flush_page(start) do {} while (0) -#define mn10300_local_dcache_flush_range(start, end) do {} while (0) -#define mn10300_local_dcache_flush_range2(start, size) do {} while (0) -#define mn10300_local_dcache_flush_inv() \ - mn10300_local_dcache_inv() -#define mn10300_local_dcache_flush_inv_page(start) \ - mn10300_local_dcache_inv_page(start) -#define mn10300_local_dcache_flush_inv_range(start, end) \ - mn10300_local_dcache_inv_range(start, end) -#define mn10300_local_dcache_flush_inv_range2(start, size) \ - mn10300_local_dcache_inv_range2(start, size) -#define mn10300_dcache_flush() do {} while (0) -#define mn10300_dcache_flush_page(start) do {} while (0) -#define mn10300_dcache_flush_range(start, end) do {} while (0) -#define mn10300_dcache_flush_range2(start, size) do {} while (0) -#define mn10300_dcache_flush_inv() mn10300_dcache_inv() -#define mn10300_dcache_flush_inv_page(start) \ - mn10300_dcache_inv_page((start)) -#define mn10300_dcache_flush_inv_range(start, end) \ - mn10300_dcache_inv_range((start), (end)) -#define mn10300_dcache_flush_inv_range2(start, size) \ - mn10300_dcache_inv_range2((start), (size)) -#endif /* CONFIG_MN10300_CACHE_WBACK */ -#else -#define mn10300_local_icache_inv() do {} while (0) -#define mn10300_local_icache_inv_page(start) do {} while (0) -#define mn10300_local_icache_inv_range(start, end) do {} while (0) -#define mn10300_local_icache_inv_range2(start, size) do {} while (0) -#define mn10300_local_dcache_inv() do {} while (0) -#define mn10300_local_dcache_inv_page(start) do {} while (0) -#define mn10300_local_dcache_inv_range(start, end) do {} while (0) -#define mn10300_local_dcache_inv_range2(start, size) do {} while (0) -#define mn10300_local_dcache_flush() do {} while (0) -#define mn10300_local_dcache_flush_inv_page(start) do {} while (0) -#define mn10300_local_dcache_flush_inv() do {} while (0) -#define mn10300_local_dcache_flush_inv_range(start, end)do {} while (0) -#define mn10300_local_dcache_flush_inv_range2(start, size) do {} while (0) -#define mn10300_local_dcache_flush_page(start) do {} while (0) -#define mn10300_local_dcache_flush_range(start, end) do {} while (0) -#define mn10300_local_dcache_flush_range2(start, size) do {} while (0) -#define mn10300_icache_inv() do {} while (0) -#define mn10300_icache_inv_page(start) do {} while (0) -#define mn10300_icache_inv_range(start, end) do {} while (0) -#define mn10300_icache_inv_range2(start, size) do {} while (0) -#define mn10300_dcache_inv() do {} while (0) -#define mn10300_dcache_inv_page(start) do {} while (0) -#define mn10300_dcache_inv_range(start, end) do {} while (0) -#define mn10300_dcache_inv_range2(start, size) do {} while (0) -#define mn10300_dcache_flush() do {} while (0) -#define mn10300_dcache_flush_inv_page(start) do {} while (0) -#define mn10300_dcache_flush_inv() do {} while (0) -#define mn10300_dcache_flush_inv_range(start, end) do {} while (0) -#define mn10300_dcache_flush_inv_range2(start, size) do {} while (0) -#define mn10300_dcache_flush_page(start) do {} while (0) -#define mn10300_dcache_flush_range(start, end) do {} while (0) -#define mn10300_dcache_flush_range2(start, size) do {} while (0) -#endif /* CONFIG_MN10300_CACHE_ENABLED */ - -/* - * Virtually-indexed cache management (our cache is physically indexed) - */ -#define flush_cache_all() do {} while (0) -#define flush_cache_mm(mm) do {} while (0) -#define flush_cache_dup_mm(mm) do {} while (0) -#define flush_cache_range(mm, start, end) do {} while (0) -#define flush_cache_page(vma, vmaddr, pfn) do {} while (0) -#define flush_cache_vmap(start, end) do {} while (0) -#define flush_cache_vunmap(start, end) do {} while (0) -#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0 -#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) - -/* - * Physically-indexed cache management - */ -#if defined(CONFIG_MN10300_CACHE_FLUSH_ICACHE) -extern void flush_icache_page(struct vm_area_struct *vma, struct page *page); -extern void flush_icache_range(unsigned long start, unsigned long end); -#elif defined(CONFIG_MN10300_CACHE_INV_ICACHE) -static inline void flush_icache_page(struct vm_area_struct *vma, - struct page *page) -{ - mn10300_icache_inv_page(page_to_phys(page)); -} -extern void flush_icache_range(unsigned long start, unsigned long end); -#else -#define flush_icache_range(start, end) do {} while (0) -#define flush_icache_page(vma, pg) do {} while (0) -#endif - - -#define flush_icache_user_range(vma, pg, adr, len) \ - flush_icache_range(adr, adr + len) - -#define copy_to_user_page(vma, page, vaddr, dst, src, len) \ - do { \ - memcpy(dst, src, len); \ - flush_icache_page(vma, page); \ - } while (0) - -#define copy_from_user_page(vma, page, vaddr, dst, src, len) \ - memcpy(dst, src, len) - -#endif /* __ASSEMBLY__ */ - -#endif /* _ASM_CACHEFLUSH_H */ diff --git a/arch/mn10300/include/asm/checksum.h b/arch/mn10300/include/asm/checksum.h deleted file mode 100644 index c80df5b504aca..0000000000000 --- a/arch/mn10300/include/asm/checksum.h +++ /dev/null @@ -1,79 +0,0 @@ -/* MN10300 Optimised checksumming code - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_CHECKSUM_H -#define _ASM_CHECKSUM_H - -extern __wsum csum_partial(const void *buff, int len, __wsum sum); -extern __wsum csum_partial_copy_nocheck(const void *src, void *dst, - int len, __wsum sum); -extern __wsum csum_partial_copy_from_user(const void *src, void *dst, - int len, __wsum sum, - int *err_ptr); -extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl); -extern __wsum csum_partial(const void *buff, int len, __wsum sum); -extern __sum16 ip_compute_csum(const void *buff, int len); - -#define csum_partial_copy_fromuser csum_partial_copy -extern __wsum csum_partial_copy(const void *src, void *dst, int len, - __wsum sum); - -static inline __sum16 csum_fold(__wsum sum) -{ - asm( - " add %1,%0 \n" - " addc 0xffff,%0 \n" - : "=r" (sum) - : "r" (sum << 16), "0" (sum & 0xffff0000) - : "cc" - ); - return (~sum) >> 16; -} - -static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, - __u32 len, __u8 proto, - __wsum sum) -{ - __wsum tmp = (__wsum)((len + proto) << 8); - - asm( - " add %1,%0 \n" - " addc %2,%0 \n" - " addc %3,%0 \n" - " addc 0,%0 \n" - : "=r" (sum) - : "r" (daddr), "r"(saddr), "r"(tmp), "0"(sum) - : "cc" - ); - return sum; -} - -/* - * computes the checksum of the TCP/UDP pseudo-header - * returns a 16-bit checksum, already complemented - */ -static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, - __u32 len, __u8 proto, - __wsum sum) -{ - return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum)); -} - -#undef _HAVE_ARCH_IPV6_CSUM - -/* - * Copy and checksum to user - */ -#define HAVE_CSUM_COPY_USER -extern __wsum csum_and_copy_to_user(const void *src, void *dst, int len, - __wsum sum, int *err_ptr); - - -#endif /* _ASM_CHECKSUM_H */ diff --git a/arch/mn10300/include/asm/cmpxchg.h b/arch/mn10300/include/asm/cmpxchg.h deleted file mode 100644 index 97a4aaf387a67..0000000000000 --- a/arch/mn10300/include/asm/cmpxchg.h +++ /dev/null @@ -1,115 +0,0 @@ -/* MN10300 Atomic xchg/cmpxchg operations - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_CMPXCHG_H -#define _ASM_CMPXCHG_H - -#include - -#ifdef CONFIG_SMP -#ifdef CONFIG_MN10300_HAS_ATOMIC_OPS_UNIT -static inline -unsigned long __xchg(volatile unsigned long *m, unsigned long val) -{ - unsigned long status; - unsigned long oldval; - - asm volatile( - "1: mov %4,(_AAR,%3) \n" - " mov (_ADR,%3),%1 \n" - " mov %5,(_ADR,%3) \n" - " mov (_ADR,%3),%0 \n" /* flush */ - " mov (_ASR,%3),%0 \n" - " or %0,%0 \n" - " bne 1b \n" - : "=&r"(status), "=&r"(oldval), "=m"(*m) - : "a"(ATOMIC_OPS_BASE_ADDR), "r"(m), "r"(val) - : "memory", "cc"); - - return oldval; -} - -static inline unsigned long __cmpxchg(volatile unsigned long *m, - unsigned long old, unsigned long new) -{ - unsigned long status; - unsigned long oldval; - - asm volatile( - "1: mov %4,(_AAR,%3) \n" - " mov (_ADR,%3),%1 \n" - " cmp %5,%1 \n" - " bne 2f \n" - " mov %6,(_ADR,%3) \n" - "2: mov (_ADR,%3),%0 \n" /* flush */ - " mov (_ASR,%3),%0 \n" - " or %0,%0 \n" - " bne 1b \n" - : "=&r"(status), "=&r"(oldval), "=m"(*m) - : "a"(ATOMIC_OPS_BASE_ADDR), "r"(m), - "r"(old), "r"(new) - : "memory", "cc"); - - return oldval; -} -#else /* CONFIG_MN10300_HAS_ATOMIC_OPS_UNIT */ -#error "No SMP atomic operation support!" -#endif /* CONFIG_MN10300_HAS_ATOMIC_OPS_UNIT */ - -#else /* CONFIG_SMP */ - -/* - * Emulate xchg for non-SMP MN10300 - */ -struct __xchg_dummy { unsigned long a[100]; }; -#define __xg(x) ((struct __xchg_dummy *)(x)) - -static inline -unsigned long __xchg(volatile unsigned long *m, unsigned long val) -{ - unsigned long oldval; - unsigned long flags; - - flags = arch_local_cli_save(); - oldval = *m; - *m = val; - arch_local_irq_restore(flags); - return oldval; -} - -/* - * Emulate cmpxchg for non-SMP MN10300 - */ -static inline unsigned long __cmpxchg(volatile unsigned long *m, - unsigned long old, unsigned long new) -{ - unsigned long oldval; - unsigned long flags; - - flags = arch_local_cli_save(); - oldval = *m; - if (oldval == old) - *m = new; - arch_local_irq_restore(flags); - return oldval; -} - -#endif /* CONFIG_SMP */ - -#define xchg(ptr, v) \ - ((__typeof__(*(ptr))) __xchg((unsigned long *)(ptr), \ - (unsigned long)(v))) - -#define cmpxchg(ptr, o, n) \ - ((__typeof__(*(ptr))) __cmpxchg((unsigned long *)(ptr), \ - (unsigned long)(o), \ - (unsigned long)(n))) - -#endif /* _ASM_CMPXCHG_H */ diff --git a/arch/mn10300/include/asm/cpu-regs.h b/arch/mn10300/include/asm/cpu-regs.h deleted file mode 100644 index c54effae2202e..0000000000000 --- a/arch/mn10300/include/asm/cpu-regs.h +++ /dev/null @@ -1,353 +0,0 @@ -/* MN10300 Core system registers - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_CPU_REGS_H -#define _ASM_CPU_REGS_H - -#ifndef __ASSEMBLY__ -#include -#endif - -/* we tell the compiler to pretend to be AM33 so that it doesn't try and use - * the FP regs, but tell the assembler that we're actually allowed AM33v2 - * instructions */ -#ifndef __ASSEMBLY__ -asm(" .am33_2\n"); -#else -.am33_2 -#endif - -#ifdef __KERNEL__ - -#ifndef __ASSEMBLY__ -#define __SYSREG(ADDR, TYPE) (*(volatile TYPE *)(ADDR)) -#define __SYSREGC(ADDR, TYPE) (*(const volatile TYPE *)(ADDR)) -#else -#define __SYSREG(ADDR, TYPE) ADDR -#define __SYSREGC(ADDR, TYPE) ADDR -#endif - -/* CPU registers */ -#define EPSW_FLAG_Z 0x00000001 /* zero flag */ -#define EPSW_FLAG_N 0x00000002 /* negative flag */ -#define EPSW_FLAG_C 0x00000004 /* carry flag */ -#define EPSW_FLAG_V 0x00000008 /* overflow flag */ -#define EPSW_IM 0x00000700 /* interrupt mode */ -#define EPSW_IM_0 0x00000000 /* interrupt mode 0 */ -#define EPSW_IM_1 0x00000100 /* interrupt mode 1 */ -#define EPSW_IM_2 0x00000200 /* interrupt mode 2 */ -#define EPSW_IM_3 0x00000300 /* interrupt mode 3 */ -#define EPSW_IM_4 0x00000400 /* interrupt mode 4 */ -#define EPSW_IM_5 0x00000500 /* interrupt mode 5 */ -#define EPSW_IM_6 0x00000600 /* interrupt mode 6 */ -#define EPSW_IM_7 0x00000700 /* interrupt mode 7 */ -#define EPSW_IE 0x00000800 /* interrupt enable */ -#define EPSW_S 0x00003000 /* software auxiliary bits */ -#define EPSW_T 0x00008000 /* trace enable */ -#define EPSW_nSL 0x00010000 /* not supervisor level */ -#define EPSW_NMID 0x00020000 /* nonmaskable interrupt disable */ -#define EPSW_nAR 0x00040000 /* register bank control */ -#define EPSW_ML 0x00080000 /* monitor level */ -#define EPSW_FE 0x00100000 /* FPU enable */ -#define EPSW_IM_SHIFT 8 /* EPSW_IM_SHIFT determines the interrupt mode */ - -#define NUM2EPSW_IM(num) ((num) << EPSW_IM_SHIFT) - -/* FPU registers */ -#define FPCR_EF_I 0x00000001 /* inexact result FPU exception flag */ -#define FPCR_EF_U 0x00000002 /* underflow FPU exception flag */ -#define FPCR_EF_O 0x00000004 /* overflow FPU exception flag */ -#define FPCR_EF_Z 0x00000008 /* zero divide FPU exception flag */ -#define FPCR_EF_V 0x00000010 /* invalid operand FPU exception flag */ -#define FPCR_EE_I 0x00000020 /* inexact result FPU exception enable */ -#define FPCR_EE_U 0x00000040 /* underflow FPU exception enable */ -#define FPCR_EE_O 0x00000080 /* overflow FPU exception enable */ -#define FPCR_EE_Z 0x00000100 /* zero divide FPU exception enable */ -#define FPCR_EE_V 0x00000200 /* invalid operand FPU exception enable */ -#define FPCR_EC_I 0x00000400 /* inexact result FPU exception cause */ -#define FPCR_EC_U 0x00000800 /* underflow FPU exception cause */ -#define FPCR_EC_O 0x00001000 /* overflow FPU exception cause */ -#define FPCR_EC_Z 0x00002000 /* zero divide FPU exception cause */ -#define FPCR_EC_V 0x00004000 /* invalid operand FPU exception cause */ -#define FPCR_RM 0x00030000 /* rounding mode */ -#define FPCR_RM_NEAREST 0x00000000 /* - round to nearest value */ -#define FPCR_FCC_U 0x00040000 /* FPU unordered condition code */ -#define FPCR_FCC_E 0x00080000 /* FPU equal condition code */ -#define FPCR_FCC_G 0x00100000 /* FPU greater than condition code */ -#define FPCR_FCC_L 0x00200000 /* FPU less than condition code */ -#define FPCR_INIT 0x00000000 /* no exceptions, rounding to nearest */ - -/* CPU control registers */ -#define CPUP __SYSREG(0xc0000020, u16) /* CPU pipeline register */ -#define CPUP_DWBD 0x0020 /* write buffer disable flag */ -#define CPUP_IPFD 0x0040 /* instruction prefetch disable flag */ -#define CPUP_EXM 0x0080 /* exception operation mode */ -#define CPUP_EXM_AM33V1 0x0000 /* - AM33 v1 exception mode */ -#define CPUP_EXM_AM33V2 0x0080 /* - AM33 v2 exception mode */ - -#define CPUM __SYSREG(0xc0000040, u16) /* CPU mode register */ -#define CPUM_SLEEP 0x0004 /* set to enter sleep state */ -#define CPUM_HALT 0x0008 /* set to enter halt state */ -#define CPUM_STOP 0x0010 /* set to enter stop state */ - -#define CPUREV __SYSREGC(0xc0000050, u32) /* CPU revision register */ -#define CPUREV_TYPE 0x0000000f /* CPU type */ -#define CPUREV_TYPE_S 0 -#define CPUREV_TYPE_AM33_1 0x00000000 /* - AM33-1 core, AM33/1.00 arch */ -#define CPUREV_TYPE_AM33_2 0x00000001 /* - AM33-2 core, AM33/2.00 arch */ -#define CPUREV_TYPE_AM34_1 0x00000002 /* - AM34-1 core, AM33/2.00 arch */ -#define CPUREV_TYPE_AM33_3 0x00000003 /* - AM33-3 core, AM33/2.00 arch */ -#define CPUREV_TYPE_AM34_2 0x00000004 /* - AM34-2 core, AM33/3.00 arch */ -#define CPUREV_REVISION 0x000000f0 /* CPU revision */ -#define CPUREV_REVISION_S 4 -#define CPUREV_ICWAY 0x00000f00 /* number of instruction cache ways */ -#define CPUREV_ICWAY_S 8 -#define CPUREV_ICSIZE 0x0000f000 /* instruction cache way size */ -#define CPUREV_ICSIZE_S 12 -#define CPUREV_DCWAY 0x000f0000 /* number of data cache ways */ -#define CPUREV_DCWAY_S 16 -#define CPUREV_DCSIZE 0x00f00000 /* data cache way size */ -#define CPUREV_DCSIZE_S 20 -#define CPUREV_FPUTYPE 0x0f000000 /* FPU core type */ -#define CPUREV_FPUTYPE_NONE 0x00000000 /* - no FPU core implemented */ -#define CPUREV_OCDCTG 0xf0000000 /* on-chip debug function category */ - -#define DCR __SYSREG(0xc0000030, u16) /* Debug control register */ - -/* interrupt/exception control registers */ -#define IVAR0 __SYSREG(0xc0000000, u16) /* interrupt vector 0 */ -#define IVAR1 __SYSREG(0xc0000004, u16) /* interrupt vector 1 */ -#define IVAR2 __SYSREG(0xc0000008, u16) /* interrupt vector 2 */ -#define IVAR3 __SYSREG(0xc000000c, u16) /* interrupt vector 3 */ -#define IVAR4 __SYSREG(0xc0000010, u16) /* interrupt vector 4 */ -#define IVAR5 __SYSREG(0xc0000014, u16) /* interrupt vector 5 */ -#define IVAR6 __SYSREG(0xc0000018, u16) /* interrupt vector 6 */ - -#define TBR __SYSREG(0xc0000024, u32) /* Trap table base */ -#define TBR_TB 0xff000000 /* table base address bits 31-24 */ -#define TBR_INT_CODE 0x00ffffff /* interrupt code */ - -#define DEAR __SYSREG(0xc0000038, u32) /* Data access exception address */ - -#define sISR __SYSREG(0xc0000044, u32) /* Supervisor interrupt status */ -#define sISR_IRQICE 0x00000001 /* ICE interrupt */ -#define sISR_ISTEP 0x00000002 /* single step interrupt */ -#define sISR_MISSA 0x00000004 /* memory access address misalignment fault */ -#define sISR_UNIMP 0x00000008 /* unimplemented instruction execution fault */ -#define sISR_PIEXE 0x00000010 /* program interrupt */ -#define sISR_MEMERR 0x00000020 /* illegal memory access fault */ -#define sISR_IBREAK 0x00000040 /* instraction break interrupt */ -#define sISR_DBSRL 0x00000080 /* debug serial interrupt */ -#define sISR_PERIDB 0x00000100 /* peripheral debug interrupt */ -#define sISR_EXUNIMP 0x00000200 /* unimplemented ex-instruction execution fault */ -#define sISR_OBREAK 0x00000400 /* operand break interrupt */ -#define sISR_PRIV 0x00000800 /* privileged instruction execution fault */ -#define sISR_BUSERR 0x00001000 /* bus error fault */ -#define sISR_DBLFT 0x00002000 /* double fault */ -#define sISR_DBG 0x00008000 /* debug reserved interrupt */ -#define sISR_ITMISS 0x00010000 /* instruction TLB miss */ -#define sISR_DTMISS 0x00020000 /* data TLB miss */ -#define sISR_ITEX 0x00040000 /* instruction TLB access exception */ -#define sISR_DTEX 0x00080000 /* data TLB access exception */ -#define sISR_ILGIA 0x00100000 /* illegal instruction access exception */ -#define sISR_ILGDA 0x00200000 /* illegal data access exception */ -#define sISR_IOIA 0x00400000 /* internal I/O space instruction access excep */ -#define sISR_PRIVA 0x00800000 /* privileged space instruction access excep */ -#define sISR_PRIDA 0x01000000 /* privileged space data access excep */ -#define sISR_DISA 0x02000000 /* data space instruction access excep */ -#define sISR_SYSC 0x04000000 /* system call instruction excep */ -#define sISR_FPUD 0x08000000 /* FPU disabled excep */ -#define sISR_FPUUI 0x10000000 /* FPU unimplemented instruction excep */ -#define sISR_FPUOP 0x20000000 /* FPU operation excep */ -#define sISR_NE 0x80000000 /* multiple synchronous exceptions excep */ - -/* cache control registers */ -#define CHCTR __SYSREG(0xc0000070, u16) /* cache control */ -#define CHCTR_ICEN 0x0001 /* instruction cache enable */ -#define CHCTR_DCEN 0x0002 /* data cache enable */ -#define CHCTR_ICBUSY 0x0004 /* instruction cache busy */ -#define CHCTR_DCBUSY 0x0008 /* data cache busy */ -#define CHCTR_ICINV 0x0010 /* instruction cache invalidate */ -#define CHCTR_DCINV 0x0020 /* data cache invalidate */ -#define CHCTR_DCWTMD 0x0040 /* data cache writing mode */ -#define CHCTR_DCWTMD_WRBACK 0x0000 /* - write back mode */ -#define CHCTR_DCWTMD_WRTHROUGH 0x0040 /* - write through mode */ -#define CHCTR_DCALMD 0x0080 /* data cache allocation mode */ -#define CHCTR_ICWMD 0x0f00 /* instruction cache way mode */ -#define CHCTR_DCWMD 0xf000 /* data cache way mode */ - -#ifdef CONFIG_AM34_2 -#define ICIVCR __SYSREG(0xc0000c00, u32) /* icache area invalidate control */ -#define ICIVCR_ICIVBSY 0x00000008 /* icache area invalidate busy */ -#define ICIVCR_ICI 0x00000001 /* icache area invalidate */ - -#define ICIVMR __SYSREG(0xc0000c04, u32) /* icache area invalidate mask */ - -#define DCPGCR __SYSREG(0xc0000c10, u32) /* data cache area purge control */ -#define DCPGCR_DCPGBSY 0x00000008 /* data cache area purge busy */ -#define DCPGCR_DCP 0x00000002 /* data cache area purge */ -#define DCPGCR_DCI 0x00000001 /* data cache area invalidate */ - -#define DCPGMR __SYSREG(0xc0000c14, u32) /* data cache area purge mask */ -#endif /* CONFIG_AM34_2 */ - -/* MMU control registers */ -#define MMUCTR __SYSREG(0xc0000090, u32) /* MMU control register */ -#define MMUCTR_IRP 0x0000003f /* instruction TLB replace pointer */ -#define MMUCTR_ITE 0x00000040 /* instruction TLB enable */ -#define MMUCTR_IIV 0x00000080 /* instruction TLB invalidate */ -#define MMUCTR_ITL 0x00000700 /* instruction TLB lock pointer */ -#define MMUCTR_ITL_NOLOCK 0x00000000 /* - no lock */ -#define MMUCTR_ITL_LOCK0 0x00000100 /* - entry 0 locked */ -#define MMUCTR_ITL_LOCK0_1 0x00000200 /* - entry 0-1 locked */ -#define MMUCTR_ITL_LOCK0_3 0x00000300 /* - entry 0-3 locked */ -#define MMUCTR_ITL_LOCK0_7 0x00000400 /* - entry 0-7 locked */ -#define MMUCTR_ITL_LOCK0_15 0x00000500 /* - entry 0-15 locked */ -#define MMUCTR_CE 0x00008000 /* cacheable bit enable */ -#define MMUCTR_DRP 0x003f0000 /* data TLB replace pointer */ -#define MMUCTR_DTE 0x00400000 /* data TLB enable */ -#define MMUCTR_DIV 0x00800000 /* data TLB invalidate */ -#define MMUCTR_DTL 0x07000000 /* data TLB lock pointer */ -#define MMUCTR_DTL_NOLOCK 0x00000000 /* - no lock */ -#define MMUCTR_DTL_LOCK0 0x01000000 /* - entry 0 locked */ -#define MMUCTR_DTL_LOCK0_1 0x02000000 /* - entry 0-1 locked */ -#define MMUCTR_DTL_LOCK0_3 0x03000000 /* - entry 0-3 locked */ -#define MMUCTR_DTL_LOCK0_7 0x04000000 /* - entry 0-7 locked */ -#define MMUCTR_DTL_LOCK0_15 0x05000000 /* - entry 0-15 locked */ -#ifdef CONFIG_AM34_2 -#define MMUCTR_WTE 0x80000000 /* write-through cache TLB entry bit enable */ -#endif - -#define PIDR __SYSREG(0xc0000094, u16) /* PID register */ -#define PIDR_PID 0x00ff /* process identifier */ - -#define PTBR __SYSREG(0xc0000098, unsigned long) /* Page table base register */ - -#define IPTEL __SYSREG(0xc00000a0, u32) /* instruction TLB entry */ -#define DPTEL __SYSREG(0xc00000b0, u32) /* data TLB entry */ -#define xPTEL_V 0x00000001 /* TLB entry valid */ -#define xPTEL_UNUSED1 0x00000002 /* unused bit */ -#define xPTEL_UNUSED2 0x00000004 /* unused bit */ -#define xPTEL_C 0x00000008 /* cached if set */ -#define xPTEL_PV 0x00000010 /* page valid */ -#define xPTEL_D 0x00000020 /* dirty */ -#define xPTEL_PR 0x000001c0 /* page protection */ -#define xPTEL_PR_ROK 0x00000000 /* - R/O kernel */ -#define xPTEL_PR_RWK 0x00000100 /* - R/W kernel */ -#define xPTEL_PR_ROK_ROU 0x00000080 /* - R/O kernel and R/O user */ -#define xPTEL_PR_RWK_ROU 0x00000180 /* - R/W kernel and R/O user */ -#define xPTEL_PR_RWK_RWU 0x000001c0 /* - R/W kernel and R/W user */ -#define xPTEL_G 0x00000200 /* global (use PID if 0) */ -#define xPTEL_PS 0x00000c00 /* page size */ -#define xPTEL_PS_4Kb 0x00000000 /* - 4Kb page */ -#define xPTEL_PS_128Kb 0x00000400 /* - 128Kb page */ -#define xPTEL_PS_1Kb 0x00000800 /* - 1Kb page */ -#define xPTEL_PS_4Mb 0x00000c00 /* - 4Mb page */ -#define xPTEL_PPN 0xfffff006 /* physical page number */ - -#define IPTEU __SYSREG(0xc00000a4, u32) /* instruction TLB virtual addr */ -#define DPTEU __SYSREG(0xc00000b4, u32) /* data TLB virtual addr */ -#define xPTEU_VPN 0xfffffc00 /* virtual page number */ -#define xPTEU_PID 0x000000ff /* process identifier to which applicable */ - -#define IPTEL2 __SYSREG(0xc00000a8, u32) /* instruction TLB entry */ -#define DPTEL2 __SYSREG(0xc00000b8, u32) /* data TLB entry */ -#define xPTEL2_V 0x00000001 /* TLB entry valid */ -#define xPTEL2_C 0x00000002 /* cacheable */ -#define xPTEL2_PV 0x00000004 /* page valid */ -#define xPTEL2_D 0x00000008 /* dirty */ -#define xPTEL2_PR 0x00000070 /* page protection */ -#define xPTEL2_PR_ROK 0x00000000 /* - R/O kernel */ -#define xPTEL2_PR_RWK 0x00000040 /* - R/W kernel */ -#define xPTEL2_PR_ROK_ROU 0x00000020 /* - R/O kernel and R/O user */ -#define xPTEL2_PR_RWK_ROU 0x00000060 /* - R/W kernel and R/O user */ -#define xPTEL2_PR_RWK_RWU 0x00000070 /* - R/W kernel and R/W user */ -#define xPTEL2_G 0x00000080 /* global (use PID if 0) */ -#define xPTEL2_PS 0x00000300 /* page size */ -#define xPTEL2_PS_4Kb 0x00000000 /* - 4Kb page */ -#define xPTEL2_PS_128Kb 0x00000100 /* - 128Kb page */ -#define xPTEL2_PS_1Kb 0x00000200 /* - 1Kb page */ -#define xPTEL2_PS_4Mb 0x00000300 /* - 4Mb page */ -#define xPTEL2_CWT 0x00000400 /* cacheable write-through */ -#define xPTEL2_UNUSED1 0x00000800 /* unused bit (broadcast mask) */ -#define xPTEL2_PPN 0xfffff000 /* physical page number */ - -#define xPTEL2_V_BIT 0 /* bit numbers corresponding to above masks */ -#define xPTEL2_C_BIT 1 -#define xPTEL2_PV_BIT 2 -#define xPTEL2_D_BIT 3 -#define xPTEL2_G_BIT 7 -#define xPTEL2_UNUSED1_BIT 11 - -#define MMUFCR __SYSREGC(0xc000009c, u32) /* MMU exception cause */ -#define MMUFCR_IFC __SYSREGC(0xc000009c, u16) /* MMU instruction excep cause */ -#define MMUFCR_DFC __SYSREGC(0xc000009e, u16) /* MMU data exception cause */ -#define MMUFCR_xFC_TLBMISS 0x0001 /* TLB miss flag */ -#define MMUFCR_xFC_INITWR 0x0002 /* initial write excep flag */ -#define MMUFCR_xFC_PGINVAL 0x0004 /* page invalid excep flag */ -#define MMUFCR_xFC_PROTVIOL 0x0008 /* protection violation excep flag */ -#define MMUFCR_xFC_ACCESS 0x0010 /* access level flag */ -#define MMUFCR_xFC_ACCESS_USR 0x0000 /* - user mode */ -#define MMUFCR_xFC_ACCESS_SR 0x0010 /* - supervisor mode */ -#define MMUFCR_xFC_TYPE 0x0020 /* access type flag */ -#define MMUFCR_xFC_TYPE_READ 0x0000 /* - read */ -#define MMUFCR_xFC_TYPE_WRITE 0x0020 /* - write */ -#define MMUFCR_xFC_PR 0x01c0 /* page protection flag */ -#define MMUFCR_xFC_PR_ROK 0x0000 /* - R/O kernel */ -#define MMUFCR_xFC_PR_RWK 0x0100 /* - R/W kernel */ -#define MMUFCR_xFC_PR_ROK_ROU 0x0080 /* - R/O kernel and R/O user */ -#define MMUFCR_xFC_PR_RWK_ROU 0x0180 /* - R/W kernel and R/O user */ -#define MMUFCR_xFC_PR_RWK_RWU 0x01c0 /* - R/W kernel and R/W user */ -#define MMUFCR_xFC_ILLADDR 0x0200 /* illegal address excep flag */ - -#ifdef CONFIG_MN10300_HAS_ATOMIC_OPS_UNIT -/* atomic operation registers */ -#define AAR __SYSREG(0xc0000a00, u32) /* cacheable address */ -#define AAR2 __SYSREG(0xc0000a04, u32) /* uncacheable address */ -#define ADR __SYSREG(0xc0000a08, u32) /* data */ -#define ASR __SYSREG(0xc0000a0c, u32) /* status */ -#define AARU __SYSREG(0xd400aa00, u32) /* user address */ -#define ADRU __SYSREG(0xd400aa08, u32) /* user data */ -#define ASRU __SYSREG(0xd400aa0c, u32) /* user status */ - -#define ASR_RW 0x00000008 /* read */ -#define ASR_BW 0x00000004 /* bus error */ -#define ASR_IW 0x00000002 /* interrupt */ -#define ASR_LW 0x00000001 /* bus lock */ - -#define ASRU_RW ASR_RW /* read */ -#define ASRU_BW ASR_BW /* bus error */ -#define ASRU_IW ASR_IW /* interrupt */ -#define ASRU_LW ASR_LW /* bus lock */ - -/* in inline ASM, we stick the base pointer in to a reg and use offsets from - * it */ -#define ATOMIC_OPS_BASE_ADDR 0xc0000a00 -#ifndef __ASSEMBLY__ -asm( - "_AAR = 0\n" - "_AAR2 = 4\n" - "_ADR = 8\n" - "_ASR = 12\n"); -#else -#define _AAR 0 -#define _AAR2 4 -#define _ADR 8 -#define _ASR 12 -#endif - -/* physical page address for userspace atomic operations registers */ -#define USER_ATOMIC_OPS_PAGE_ADDR 0xd400a000 - -#endif /* CONFIG_MN10300_HAS_ATOMIC_OPS_UNIT */ - -#endif /* __KERNEL__ */ - -#endif /* _ASM_CPU_REGS_H */ diff --git a/arch/mn10300/include/asm/current.h b/arch/mn10300/include/asm/current.h deleted file mode 100644 index ca6027d83743a..0000000000000 --- a/arch/mn10300/include/asm/current.h +++ /dev/null @@ -1,37 +0,0 @@ -/* MN10300 Current task structure accessor - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_CURRENT_H -#define _ASM_CURRENT_H - -#include - -/* - * dedicate E2 to keeping the current task pointer - */ -#ifdef CONFIG_MN10300_CURRENT_IN_E2 - -register struct task_struct *const current asm("e2") __attribute__((used)); - -#define get_current() current - -extern struct task_struct *__current; - -#else -static inline __attribute__((const)) -struct task_struct *get_current(void) -{ - return current_thread_info()->task; -} - -#define current get_current() -#endif - -#endif /* _ASM_CURRENT_H */ diff --git a/arch/mn10300/include/asm/debugger.h b/arch/mn10300/include/asm/debugger.h deleted file mode 100644 index e1d3b083696cd..0000000000000 --- a/arch/mn10300/include/asm/debugger.h +++ /dev/null @@ -1,43 +0,0 @@ -/* Kernel debugger for MN10300 - * - * Copyright (C) 2011 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - -#ifndef _ASM_DEBUGGER_H -#define _ASM_DEBUGGER_H - -#if defined(CONFIG_KERNEL_DEBUGGER) - -extern int debugger_intercept(enum exception_code, int, int, struct pt_regs *); -extern int at_debugger_breakpoint(struct pt_regs *); - -#ifndef CONFIG_MN10300_DEBUGGER_CACHE_NO_FLUSH -extern void debugger_local_cache_flushinv(void); -extern void debugger_local_cache_flushinv_one(u8 *); -#else -static inline void debugger_local_cache_flushinv(void) {} -static inline void debugger_local_cache_flushinv_one(u8 *addr) {} -#endif - -#else /* CONFIG_KERNEL_DEBUGGER */ - -static inline int debugger_intercept(enum exception_code excep, - int signo, int si_code, - struct pt_regs *regs) -{ - return 0; -} - -static inline int at_debugger_breakpoint(struct pt_regs *regs) -{ - return 0; -} - -#endif /* CONFIG_KERNEL_DEBUGGER */ -#endif /* _ASM_DEBUGGER_H */ diff --git a/arch/mn10300/include/asm/delay.h b/arch/mn10300/include/asm/delay.h deleted file mode 100644 index 34517b359399e..0000000000000 --- a/arch/mn10300/include/asm/delay.h +++ /dev/null @@ -1,19 +0,0 @@ -/* MN10300 Uninterruptible delay routines - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_DELAY_H -#define _ASM_DELAY_H - -extern void __udelay(unsigned long usecs); -extern void __delay(unsigned long loops); - -#define udelay(n) __udelay(n) - -#endif /* _ASM_DELAY_H */ diff --git a/arch/mn10300/include/asm/div64.h b/arch/mn10300/include/asm/div64.h deleted file mode 100644 index 503efab2a5169..0000000000000 --- a/arch/mn10300/include/asm/div64.h +++ /dev/null @@ -1,115 +0,0 @@ -/* MN10300 64-bit division - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_DIV64 -#define _ASM_DIV64 - -#include - -extern void ____unhandled_size_in_do_div___(void); - -/* - * Beginning with gcc 4.6, the MDR register is represented explicitly. We - * must, therefore, at least explicitly clobber the register when we make - * changes to it. The following assembly fragments *could* be rearranged in - * order to leave the moves to/from the MDR register to the compiler, but the - * gains would be minimal at best. - */ -#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) -# define CLOBBER_MDR_CC "mdr", "cc" -#else -# define CLOBBER_MDR_CC "cc" -#endif - -/* - * divide n by base, leaving the result in n and returning the remainder - * - we can do this quite efficiently on the MN10300 by cascading the divides - * through the MDR register - */ -#define do_div(n, base) \ -({ \ - unsigned __rem = 0; \ - if (sizeof(n) <= 4) { \ - asm("mov %1,mdr \n" \ - "divu %2,%0 \n" \ - "mov mdr,%1 \n" \ - : "+r"(n), "=d"(__rem) \ - : "r"(base), "1"(__rem) \ - : CLOBBER_MDR_CC \ - ); \ - } else if (sizeof(n) <= 8) { \ - union { \ - unsigned long long l; \ - u32 w[2]; \ - } __quot; \ - __quot.l = n; \ - asm("mov %0,mdr \n" /* MDR = 0 */ \ - "divu %3,%1 \n" \ - /* __quot.MSL = __div.MSL / base, */ \ - /* MDR = MDR:__div.MSL % base */ \ - "divu %3,%2 \n" \ - /* __quot.LSL = MDR:__div.LSL / base, */ \ - /* MDR = MDR:__div.LSL % base */ \ - "mov mdr,%0 \n" \ - : "=d"(__rem), "=r"(__quot.w[1]), "=r"(__quot.w[0]) \ - : "r"(base), "0"(__rem), "1"(__quot.w[1]), \ - "2"(__quot.w[0]) \ - : CLOBBER_MDR_CC \ - ); \ - n = __quot.l; \ - } else { \ - ____unhandled_size_in_do_div___(); \ - } \ - __rem; \ -}) - -/* - * do an unsigned 32-bit multiply and divide with intermediate 64-bit product - * so as not to lose accuracy - * - we use the MDR register to hold the MSW of the product - */ -static inline __attribute__((const)) -unsigned __muldiv64u(unsigned val, unsigned mult, unsigned div) -{ - unsigned result; - - asm("mulu %2,%0 \n" /* MDR:val = val*mult */ - "divu %3,%0 \n" /* val = MDR:val/div; - * MDR = MDR:val%div */ - : "=r"(result) - : "0"(val), "ir"(mult), "r"(div) - : CLOBBER_MDR_CC - ); - - return result; -} - -/* - * do a signed 32-bit multiply and divide with intermediate 64-bit product so - * as not to lose accuracy - * - we use the MDR register to hold the MSW of the product - */ -static inline __attribute__((const)) -signed __muldiv64s(signed val, signed mult, signed div) -{ - signed result; - - asm("mul %2,%0 \n" /* MDR:val = val*mult */ - "div %3,%0 \n" /* val = MDR:val/div; - * MDR = MDR:val%div */ - : "=r"(result) - : "0"(val), "ir"(mult), "r"(div) - : CLOBBER_MDR_CC - ); - - return result; -} - -#endif /* _ASM_DIV64 */ diff --git a/arch/mn10300/include/asm/dma-mapping.h b/arch/mn10300/include/asm/dma-mapping.h deleted file mode 100644 index 439e474ed6d75..0000000000000 --- a/arch/mn10300/include/asm/dma-mapping.h +++ /dev/null @@ -1,21 +0,0 @@ -/* DMA mapping routines for the MN10300 arch - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_DMA_MAPPING_H -#define _ASM_DMA_MAPPING_H - -extern const struct dma_map_ops mn10300_dma_ops; - -static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) -{ - return &mn10300_dma_ops; -} - -#endif diff --git a/arch/mn10300/include/asm/dma.h b/arch/mn10300/include/asm/dma.h deleted file mode 100644 index 10b77d4628c2c..0000000000000 --- a/arch/mn10300/include/asm/dma.h +++ /dev/null @@ -1,117 +0,0 @@ -/* MN10300 ISA DMA handlers and definitions - * - * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd. - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_DMA_H -#define _ASM_DMA_H - -#include -#include -#include - -#undef MAX_DMA_CHANNELS /* switch off linux/kernel/dma.c */ -#define MAX_DMA_ADDRESS 0xbfffffff - -extern spinlock_t dma_spin_lock; - -static inline unsigned long claim_dma_lock(void) -{ - unsigned long flags; - spin_lock_irqsave(&dma_spin_lock, flags); - return flags; -} - -static inline void release_dma_lock(unsigned long flags) -{ - spin_unlock_irqrestore(&dma_spin_lock, flags); -} - -/* enable/disable a specific DMA channel */ -static inline void enable_dma(unsigned int dmanr) -{ -} - -static inline void disable_dma(unsigned int dmanr) -{ -} - -/* Clear the 'DMA Pointer Flip Flop'. - * Write 0 for LSB/MSB, 1 for MSB/LSB access. - * Use this once to initialize the FF to a known state. - * After that, keep track of it. :-) - * --- In order to do that, the DMA routines below should --- - * --- only be used while holding the DMA lock ! --- - */ -static inline void clear_dma_ff(unsigned int dmanr) -{ -} - -/* set mode (above) for a specific DMA channel */ -static inline void set_dma_mode(unsigned int dmanr, char mode) -{ -} - -/* Set only the page register bits of the transfer address. - * This is used for successive transfers when we know the contents of - * the lower 16 bits of the DMA current address register, but a 64k boundary - * may have been crossed. - */ -static inline void set_dma_page(unsigned int dmanr, char pagenr) -{ -} - - -/* Set transfer address & page bits for specific DMA channel. - * Assumes dma flipflop is clear. - */ -static inline void set_dma_addr(unsigned int dmanr, unsigned int a) -{ -} - - -/* Set transfer size (max 64k for DMA1..3, 128k for DMA5..7) for - * a specific DMA channel. - * You must ensure the parameters are valid. - * NOTE: from a manual: "the number of transfers is one more - * than the initial word count"! This is taken into account. - * Assumes dma flip-flop is clear. - * NOTE 2: "count" represents _bytes_ and must be even for channels 5-7. - */ -static inline void set_dma_count(unsigned int dmanr, unsigned int count) -{ -} - - -/* Get DMA residue count. After a DMA transfer, this - * should return zero. Reading this while a DMA transfer is - * still in progress will return unpredictable results. - * If called before the channel has been used, it may return 1. - * Otherwise, it returns the number of _bytes_ left to transfer. - * - * Assumes DMA flip-flop is clear. - */ -static inline int get_dma_residue(unsigned int dmanr) -{ - return 0; -} - - -/* These are in kernel/dma.c: */ -extern int request_dma(unsigned int dmanr, const char *device_id); -extern void free_dma(unsigned int dmanr); - -/* From PCI */ - -#ifdef CONFIG_PCI -extern int isa_dma_bridge_buggy; -#else -#define isa_dma_bridge_buggy (0) -#endif - -#endif /* _ASM_DMA_H */ diff --git a/arch/mn10300/include/asm/dmactl-regs.h b/arch/mn10300/include/asm/dmactl-regs.h deleted file mode 100644 index 80337b339c903..0000000000000 --- a/arch/mn10300/include/asm/dmactl-regs.h +++ /dev/null @@ -1,16 +0,0 @@ -/* MN10300 on-board DMA controller registers - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_DMACTL_REGS_H -#define _ASM_DMACTL_REGS_H - -#include - -#endif /* _ASM_DMACTL_REGS_H */ diff --git a/arch/mn10300/include/asm/elf.h b/arch/mn10300/include/asm/elf.h deleted file mode 100644 index f592d7a9f0321..0000000000000 --- a/arch/mn10300/include/asm/elf.h +++ /dev/null @@ -1,153 +0,0 @@ -/* MN10300 ELF constant and register definitions - * - * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd. - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_ELF_H -#define _ASM_ELF_H - -#include -#include -#include - -/* - * AM33 relocations - */ -#define R_MN10300_NONE 0 /* No reloc. */ -#define R_MN10300_32 1 /* Direct 32 bit. */ -#define R_MN10300_16 2 /* Direct 16 bit. */ -#define R_MN10300_8 3 /* Direct 8 bit. */ -#define R_MN10300_PCREL32 4 /* PC-relative 32-bit. */ -#define R_MN10300_PCREL16 5 /* PC-relative 16-bit signed. */ -#define R_MN10300_PCREL8 6 /* PC-relative 8-bit signed. */ -#define R_MN10300_24 9 /* Direct 24 bit. */ -#define R_MN10300_RELATIVE 23 /* Adjust by program base. */ -#define R_MN10300_SYM_DIFF 33 /* Adjustment when relaxing. */ -#define R_MN10300_ALIGN 34 /* Alignment requirement. */ - -/* - * AM33/AM34 HW Capabilities - */ -#define HWCAP_MN10300_ATOMIC_OP_UNIT 1 /* Has AM34 Atomic Operations */ - - -/* - * ELF register definitions.. - */ -typedef unsigned long elf_greg_t; - -#define ELF_NGREG ((sizeof(struct pt_regs) / sizeof(elf_greg_t)) - 1) -typedef elf_greg_t elf_gregset_t[ELF_NGREG]; - -#define ELF_NFPREG 32 -typedef float elf_fpreg_t; - -typedef struct { - elf_fpreg_t fpregs[ELF_NFPREG]; - u_int32_t fpcr; -} elf_fpregset_t; - -/* - * This is used to ensure we don't load something for the wrong architecture - */ -#define elf_check_arch(x) \ - (((x)->e_machine == EM_CYGNUS_MN10300) || \ - ((x)->e_machine == EM_MN10300)) - -/* - * These are used to set parameters in the core dumps. - */ -#define ELF_CLASS ELFCLASS32 -#define ELF_DATA ELFDATA2LSB -#define ELF_ARCH EM_MN10300 - -/* - * ELF process initialiser - */ -#define ELF_PLAT_INIT(_r, load_addr) \ -do { \ - struct pt_regs *_ur = current->thread.uregs; \ - _ur->a3 = 0; _ur->a2 = 0; _ur->d3 = 0; _ur->d2 = 0; \ - _ur->mcvf = 0; _ur->mcrl = 0; _ur->mcrh = 0; _ur->mdrq = 0; \ - _ur->e1 = 0; _ur->e0 = 0; _ur->e7 = 0; _ur->e6 = 0; \ - _ur->e5 = 0; _ur->e4 = 0; _ur->e3 = 0; _ur->e2 = 0; \ - _ur->lar = 0; _ur->lir = 0; _ur->mdr = 0; \ - _ur->a1 = 0; _ur->a0 = 0; _ur->d1 = 0; _ur->d0 = 0; \ -} while (0) - -#define CORE_DUMP_USE_REGSET -#define ELF_EXEC_PAGESIZE 4096 - -/* - * This is the location that an ET_DYN program is loaded if exec'ed. Typical - * use of this is to invoke "./ld.so someprog" to test out a new version of - * the loader. We need to make sure that it is out of the way of the program - * that it will "exec", and that there is sufficient room for the brk. - * - must clear the VMALLOC area - */ -#define ELF_ET_DYN_BASE 0x04000000 - -/* - * regs is struct pt_regs, pr_reg is elf_gregset_t (which is - * now struct user_regs, they are different) - * - ELF_CORE_COPY_REGS has been guessed, and may be wrong - */ -#define ELF_CORE_COPY_REGS(pr_reg, regs) \ -do { \ - pr_reg[0] = regs->a3; \ - pr_reg[1] = regs->a2; \ - pr_reg[2] = regs->d3; \ - pr_reg[3] = regs->d2; \ - pr_reg[4] = regs->mcvf; \ - pr_reg[5] = regs->mcrl; \ - pr_reg[6] = regs->mcrh; \ - pr_reg[7] = regs->mdrq; \ - pr_reg[8] = regs->e1; \ - pr_reg[9] = regs->e0; \ - pr_reg[10] = regs->e7; \ - pr_reg[11] = regs->e6; \ - pr_reg[12] = regs->e5; \ - pr_reg[13] = regs->e4; \ - pr_reg[14] = regs->e3; \ - pr_reg[15] = regs->e2; \ - pr_reg[16] = regs->sp; \ - pr_reg[17] = regs->lar; \ - pr_reg[18] = regs->lir; \ - pr_reg[19] = regs->mdr; \ - pr_reg[20] = regs->a1; \ - pr_reg[21] = regs->a0; \ - pr_reg[22] = regs->d1; \ - pr_reg[23] = regs->d0; \ - pr_reg[24] = regs->orig_d0; \ - pr_reg[25] = regs->epsw; \ - pr_reg[26] = regs->pc; \ -} while (0); - -/* - * This yields a mask that user programs can use to figure out what - * instruction set this CPU supports. This could be done in user space, - * but it's not easy, and we've already done it here. - */ -#ifdef CONFIG_MN10300_HAS_ATOMIC_OPS_UNIT -#define ELF_HWCAP (HWCAP_MN10300_ATOMIC_OP_UNIT) -#else -#define ELF_HWCAP (0) -#endif - -/* - * This yields a string that ld.so will use to load implementation - * specific libraries for optimization. This is more specific in - * intent than poking at uname or /proc/cpuinfo. - * - * For the moment, we have only optimizations for the Intel generations, - * but that could change... - */ -#define ELF_PLATFORM (NULL) - -#endif /* _ASM_ELF_H */ diff --git a/arch/mn10300/include/asm/emergency-restart.h b/arch/mn10300/include/asm/emergency-restart.h deleted file mode 100644 index 3711bd9d50bda..0000000000000 --- a/arch/mn10300/include/asm/emergency-restart.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/arch/mn10300/include/asm/exceptions.h b/arch/mn10300/include/asm/exceptions.h deleted file mode 100644 index 95a4d42c3a06e..0000000000000 --- a/arch/mn10300/include/asm/exceptions.h +++ /dev/null @@ -1,121 +0,0 @@ -/* MN10300 Microcontroller core exceptions - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_EXCEPTIONS_H -#define _ASM_EXCEPTIONS_H - -#include - -/* - * define the breakpoint instruction opcode to use - * - note that the JTAG unit steals 0xFF, so you can't use JTAG and GDBSTUB at - * the same time. - */ -#define GDBSTUB_BKPT 0xFF - -#ifndef __ASSEMBLY__ - -/* - * enumeration of exception codes (as extracted from TBR MSW) - */ -enum exception_code { - EXCEP_RESET = 0x000000, /* reset */ - - /* MMU exceptions */ - EXCEP_ITLBMISS = 0x000100, /* instruction TLB miss */ - EXCEP_DTLBMISS = 0x000108, /* data TLB miss */ - EXCEP_IAERROR = 0x000110, /* instruction address */ - EXCEP_DAERROR = 0x000118, /* data address */ - - /* system exceptions */ - EXCEP_TRAP = 0x000128, /* program interrupt (PI instruction) */ - EXCEP_ISTEP = 0x000130, /* single step */ - EXCEP_IBREAK = 0x000150, /* instruction breakpoint */ - EXCEP_OBREAK = 0x000158, /* operand breakpoint */ - EXCEP_PRIVINS = 0x000160, /* privileged instruction execution */ - EXCEP_UNIMPINS = 0x000168, /* unimplemented instruction execution */ - EXCEP_UNIMPEXINS = 0x000170, /* unimplemented extended instruction execution */ - EXCEP_MEMERR = 0x000178, /* illegal memory access */ - EXCEP_MISALIGN = 0x000180, /* misalignment */ - EXCEP_BUSERROR = 0x000188, /* bus error */ - EXCEP_ILLINSACC = 0x000190, /* illegal instruction access */ - EXCEP_ILLDATACC = 0x000198, /* illegal data access */ - EXCEP_IOINSACC = 0x0001a0, /* I/O space instruction access */ - EXCEP_PRIVINSACC = 0x0001a8, /* privileged space instruction access */ - EXCEP_PRIVDATACC = 0x0001b0, /* privileged space data access */ - EXCEP_DATINSACC = 0x0001b8, /* data space instruction access */ - EXCEP_DOUBLE_FAULT = 0x000200, /* double fault */ - - /* FPU exceptions */ - EXCEP_FPU_DISABLED = 0x0001c0, /* FPU disabled */ - EXCEP_FPU_UNIMPINS = 0x0001c8, /* FPU unimplemented operation */ - EXCEP_FPU_OPERATION = 0x0001d0, /* FPU operation */ - - /* interrupts */ - EXCEP_WDT = 0x000240, /* watchdog timer overflow */ - EXCEP_NMI = 0x000248, /* non-maskable interrupt */ - EXCEP_IRQ_LEVEL0 = 0x000280, /* level 0 maskable interrupt */ - EXCEP_IRQ_LEVEL1 = 0x000288, /* level 1 maskable interrupt */ - EXCEP_IRQ_LEVEL2 = 0x000290, /* level 2 maskable interrupt */ - EXCEP_IRQ_LEVEL3 = 0x000298, /* level 3 maskable interrupt */ - EXCEP_IRQ_LEVEL4 = 0x0002a0, /* level 4 maskable interrupt */ - EXCEP_IRQ_LEVEL5 = 0x0002a8, /* level 5 maskable interrupt */ - EXCEP_IRQ_LEVEL6 = 0x0002b0, /* level 6 maskable interrupt */ - - /* system calls */ - EXCEP_SYSCALL0 = 0x000300, /* system call 0 */ - EXCEP_SYSCALL1 = 0x000308, /* system call 1 */ - EXCEP_SYSCALL2 = 0x000310, /* system call 2 */ - EXCEP_SYSCALL3 = 0x000318, /* system call 3 */ - EXCEP_SYSCALL4 = 0x000320, /* system call 4 */ - EXCEP_SYSCALL5 = 0x000328, /* system call 5 */ - EXCEP_SYSCALL6 = 0x000330, /* system call 6 */ - EXCEP_SYSCALL7 = 0x000338, /* system call 7 */ - EXCEP_SYSCALL8 = 0x000340, /* system call 8 */ - EXCEP_SYSCALL9 = 0x000348, /* system call 9 */ - EXCEP_SYSCALL10 = 0x000350, /* system call 10 */ - EXCEP_SYSCALL11 = 0x000358, /* system call 11 */ - EXCEP_SYSCALL12 = 0x000360, /* system call 12 */ - EXCEP_SYSCALL13 = 0x000368, /* system call 13 */ - EXCEP_SYSCALL14 = 0x000370, /* system call 14 */ - EXCEP_SYSCALL15 = 0x000378, /* system call 15 */ -}; - -extern void __set_intr_stub(enum exception_code code, void *handler); -extern void set_intr_stub(enum exception_code code, void *handler); - -struct pt_regs; - -extern asmlinkage void __common_exception(void); -extern asmlinkage void itlb_miss(void); -extern asmlinkage void dtlb_miss(void); -extern asmlinkage void itlb_aerror(void); -extern asmlinkage void dtlb_aerror(void); -extern asmlinkage void raw_bus_error(void); -extern asmlinkage void double_fault(void); -extern asmlinkage int system_call(struct pt_regs *); -extern asmlinkage void nmi(struct pt_regs *, enum exception_code); -extern asmlinkage void uninitialised_exception(struct pt_regs *, - enum exception_code); -extern asmlinkage void irq_handler(void); -extern asmlinkage void profile_handler(void); -extern asmlinkage void nmi_handler(void); -extern asmlinkage void misalignment(struct pt_regs *, enum exception_code); - -extern void die(const char *, struct pt_regs *, enum exception_code) - __noreturn; - -extern int die_if_no_fixup(const char *, struct pt_regs *, enum exception_code); - -#define NUM2EXCEP_IRQ_LEVEL(num) (EXCEP_IRQ_LEVEL0 + (num) * 8) - -#endif /* __ASSEMBLY__ */ - -#endif /* _ASM_EXCEPTIONS_H */ diff --git a/arch/mn10300/include/asm/fpu.h b/arch/mn10300/include/asm/fpu.h deleted file mode 100644 index a47e995d45f34..0000000000000 --- a/arch/mn10300/include/asm/fpu.h +++ /dev/null @@ -1,132 +0,0 @@ -/* MN10300 FPU definitions - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * Derived from include/asm-i386/i387.h: Copyright (C) 1994 Linus Torvalds - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_FPU_H -#define _ASM_FPU_H - -#ifndef __ASSEMBLY__ - -#include -#include -#include - -#ifdef __KERNEL__ - -extern asmlinkage void fpu_disabled(void); - -#ifdef CONFIG_FPU - -#ifdef CONFIG_LAZY_SAVE_FPU -/* the task that currently owns the FPU state */ -extern struct task_struct *fpu_state_owner; -#endif - -#if (THREAD_USING_FPU & ~0xff) -#error THREAD_USING_FPU must be smaller than 0x100. -#endif - -static inline void set_using_fpu(struct task_struct *tsk) -{ - asm volatile( - "bset %0,(0,%1)" - : - : "i"(THREAD_USING_FPU), "a"(&tsk->thread.fpu_flags) - : "memory", "cc"); -} - -static inline void clear_using_fpu(struct task_struct *tsk) -{ - asm volatile( - "bclr %0,(0,%1)" - : - : "i"(THREAD_USING_FPU), "a"(&tsk->thread.fpu_flags) - : "memory", "cc"); -} - -#define is_using_fpu(tsk) ((tsk)->thread.fpu_flags & THREAD_USING_FPU) - -extern asmlinkage void fpu_kill_state(struct task_struct *); -extern asmlinkage void fpu_exception(struct pt_regs *, enum exception_code); -extern asmlinkage void fpu_init_state(void); -extern asmlinkage void fpu_save(struct fpu_state_struct *); -extern int fpu_setup_sigcontext(struct fpucontext *buf); -extern int fpu_restore_sigcontext(struct fpucontext *buf); - -static inline void unlazy_fpu(struct task_struct *tsk) -{ - preempt_disable(); -#ifndef CONFIG_LAZY_SAVE_FPU - if (tsk->thread.fpu_flags & THREAD_HAS_FPU) { - fpu_save(&tsk->thread.fpu_state); - tsk->thread.fpu_flags &= ~THREAD_HAS_FPU; - tsk->thread.uregs->epsw &= ~EPSW_FE; - } -#else - if (fpu_state_owner == tsk) - fpu_save(&tsk->thread.fpu_state); -#endif - preempt_enable(); -} - -static inline void exit_fpu(struct task_struct *tsk) -{ -#ifdef CONFIG_LAZY_SAVE_FPU - preempt_disable(); - if (fpu_state_owner == tsk) - fpu_state_owner = NULL; - preempt_enable(); -#endif -} - -static inline void flush_fpu(void) -{ - struct task_struct *tsk = current; - - preempt_disable(); -#ifndef CONFIG_LAZY_SAVE_FPU - if (tsk->thread.fpu_flags & THREAD_HAS_FPU) { - tsk->thread.fpu_flags &= ~THREAD_HAS_FPU; - tsk->thread.uregs->epsw &= ~EPSW_FE; - } -#else - if (fpu_state_owner == tsk) { - fpu_state_owner = NULL; - tsk->thread.uregs->epsw &= ~EPSW_FE; - } -#endif - preempt_enable(); - clear_using_fpu(tsk); -} - -#else /* CONFIG_FPU */ - -extern asmlinkage -void unexpected_fpu_exception(struct pt_regs *, enum exception_code); -#define fpu_exception unexpected_fpu_exception - -struct task_struct; -struct fpu_state_struct; -static inline bool is_using_fpu(struct task_struct *tsk) { return false; } -static inline void set_using_fpu(struct task_struct *tsk) {} -static inline void clear_using_fpu(struct task_struct *tsk) {} -static inline void fpu_init_state(void) {} -static inline void fpu_save(struct fpu_state_struct *s) {} -static inline void fpu_kill_state(struct task_struct *tsk) {} -static inline void unlazy_fpu(struct task_struct *tsk) {} -static inline void exit_fpu(struct task_struct *tsk) {} -static inline void flush_fpu(void) {} -static inline int fpu_setup_sigcontext(struct fpucontext *buf) { return 0; } -static inline int fpu_restore_sigcontext(struct fpucontext *buf) { return 0; } -#endif /* CONFIG_FPU */ - -#endif /* __KERNEL__ */ -#endif /* !__ASSEMBLY__ */ -#endif /* _ASM_FPU_H */ diff --git a/arch/mn10300/include/asm/frame.inc b/arch/mn10300/include/asm/frame.inc deleted file mode 100644 index 1c3eb4fda9588..0000000000000 --- a/arch/mn10300/include/asm/frame.inc +++ /dev/null @@ -1,97 +0,0 @@ -/* MN10300 Microcontroller core system register definitions -*- asm -*- - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_FRAME_INC -#define _ASM_FRAME_INC - -#ifndef __ASSEMBLY__ -#error not for use in C files -#endif - -#ifndef __ASM_OFFSETS_H__ -#include -#endif -#include - -#define pi break - -#define fp a3 - -############################################################################### -# -# build a stack frame from the registers -# - the caller has subtracted 4 from SP before coming here -# -############################################################################### -.macro SAVE_ALL - add -4,sp # next exception frame ptr save area - movm [other],(sp) - mov usp,a1 - mov a1,(sp) # USP in MOVM[other] dummy slot - movm [d2,d3,a2,a3,exreg0,exreg1,exother],(sp) - mov sp,fp # FRAME pointer in A3 - add -12,sp # allow for calls to be made - - # push the exception frame onto the front of the list - GET_THREAD_INFO a1 - mov (TI_frame,a1),a0 - mov a0,(REG_NEXT,fp) - mov fp,(TI_frame,a1) - - # disable the FPU inside the kernel - and ~EPSW_FE,epsw - - # we may be holding current in E2 -#ifdef CONFIG_MN10300_CURRENT_IN_E2 - mov (__current),e2 -#endif -.endm - -############################################################################### -# -# restore the registers from a stack frame -# -############################################################################### -.macro RESTORE_ALL - # peel back the stack to the calling frame - # - we need that when returning from interrupts to kernel mode - GET_THREAD_INFO a0 - mov (TI_frame,a0),fp - mov fp,sp - mov (REG_NEXT,fp),d0 - mov d0,(TI_frame,a0) # userspace has regs->next == 0 - -#ifndef CONFIG_MN10300_USING_JTAG - mov (REG_EPSW,fp),d0 - btst EPSW_T,d0 - beq 99f - - or EPSW_NMID,epsw - movhu (DCR),d1 - or 0x0001, d1 - movhu d1,(DCR) - -99: -#endif - movm (sp),[d2,d3,a2,a3,exreg0,exreg1,exother] - - # must restore usp even if returning to kernel space, - # when CONFIG_PREEMPT is enabled. - mov (sp),a1 # USP in MOVM[other] dummy slot - mov a1,usp - - movm (sp),[other] - add 8,sp - rti - -.endm - - -#endif /* _ASM_FRAME_INC */ diff --git a/arch/mn10300/include/asm/ftrace.h b/arch/mn10300/include/asm/ftrace.h deleted file mode 100644 index 40a8c178f10d9..0000000000000 --- a/arch/mn10300/include/asm/ftrace.h +++ /dev/null @@ -1 +0,0 @@ -/* empty */ diff --git a/arch/mn10300/include/asm/futex.h b/arch/mn10300/include/asm/futex.h deleted file mode 100644 index 0b745828f42bc..0000000000000 --- a/arch/mn10300/include/asm/futex.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/arch/mn10300/include/asm/gdb-stub.h b/arch/mn10300/include/asm/gdb-stub.h deleted file mode 100644 index f5495ad82b77b..0000000000000 --- a/arch/mn10300/include/asm/gdb-stub.h +++ /dev/null @@ -1,182 +0,0 @@ -/* MN10300 Kernel GDB stub definitions - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - Derived from asm-mips/gdb-stub.h (c) 1995 Andreas Busse - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_GDB_STUB_H -#define _ASM_GDB_STUB_H - -#include - -/* - * register ID numbers in GDB remote protocol - */ - -#define GDB_REGID_PC 9 -#define GDB_REGID_FP 7 -#define GDB_REGID_SP 8 - -/* - * virtual stack layout for the GDB exception handler - */ -#define NUMREGS 64 - -#define GDB_FR_D0 (0 * 4) -#define GDB_FR_D1 (1 * 4) -#define GDB_FR_D2 (2 * 4) -#define GDB_FR_D3 (3 * 4) -#define GDB_FR_A0 (4 * 4) -#define GDB_FR_A1 (5 * 4) -#define GDB_FR_A2 (6 * 4) -#define GDB_FR_A3 (7 * 4) - -#define GDB_FR_SP (8 * 4) -#define GDB_FR_PC (9 * 4) -#define GDB_FR_MDR (10 * 4) -#define GDB_FR_EPSW (11 * 4) -#define GDB_FR_LIR (12 * 4) -#define GDB_FR_LAR (13 * 4) -#define GDB_FR_MDRQ (14 * 4) - -#define GDB_FR_E0 (15 * 4) -#define GDB_FR_E1 (16 * 4) -#define GDB_FR_E2 (17 * 4) -#define GDB_FR_E3 (18 * 4) -#define GDB_FR_E4 (19 * 4) -#define GDB_FR_E5 (20 * 4) -#define GDB_FR_E6 (21 * 4) -#define GDB_FR_E7 (22 * 4) - -#define GDB_FR_SSP (23 * 4) -#define GDB_FR_MSP (24 * 4) -#define GDB_FR_USP (25 * 4) -#define GDB_FR_MCRH (26 * 4) -#define GDB_FR_MCRL (27 * 4) -#define GDB_FR_MCVF (28 * 4) - -#define GDB_FR_FPCR (29 * 4) -#define GDB_FR_DUMMY0 (30 * 4) -#define GDB_FR_DUMMY1 (31 * 4) - -#define GDB_FR_FS0 (32 * 4) - -#define GDB_FR_SIZE (NUMREGS * 4) - -#ifndef __ASSEMBLY__ - -/* - * This is the same as above, but for the high-level - * part of the GDB stub. - */ - -struct gdb_regs { - /* saved main processor registers */ - u32 d0, d1, d2, d3, a0, a1, a2, a3; - u32 sp, pc, mdr, epsw, lir, lar, mdrq; - u32 e0, e1, e2, e3, e4, e5, e6, e7; - u32 ssp, msp, usp, mcrh, mcrl, mcvf; - - /* saved floating point registers */ - u32 fpcr, _dummy0, _dummy1; - u32 fs0, fs1, fs2, fs3, fs4, fs5, fs6, fs7; - u32 fs8, fs9, fs10, fs11, fs12, fs13, fs14, fs15; - u32 fs16, fs17, fs18, fs19, fs20, fs21, fs22, fs23; - u32 fs24, fs25, fs26, fs27, fs28, fs29, fs30, fs31; -}; - -/* - * Prototypes - */ -extern void show_registers_only(struct pt_regs *regs); - -extern asmlinkage void gdbstub_init(void); -extern asmlinkage void gdbstub_exit(int status); -extern asmlinkage void gdbstub_io_init(void); -extern asmlinkage void gdbstub_io_set_baud(unsigned baud); -extern asmlinkage int gdbstub_io_rx_char(unsigned char *_ch, int nonblock); -extern asmlinkage void gdbstub_io_tx_char(unsigned char ch); -extern asmlinkage void gdbstub_io_tx_flush(void); - -extern asmlinkage void gdbstub_io_rx_handler(void); -extern asmlinkage void gdbstub_rx_irq(struct pt_regs *, enum exception_code); -extern asmlinkage int gdbstub_intercept(struct pt_regs *, enum exception_code); -extern asmlinkage void gdbstub_exception(struct pt_regs *, enum exception_code); -extern asmlinkage void __gdbstub_bug_trap(void); -extern asmlinkage void __gdbstub_pause(void); - -#ifdef CONFIG_MN10300_CACHE_ENABLED -extern asmlinkage void gdbstub_purge_cache(void); -#else -#define gdbstub_purge_cache() do {} while (0) -#endif - -/* Used to prevent crashes in memory access */ -extern asmlinkage int gdbstub_read_byte(const u8 *, u8 *); -extern asmlinkage int gdbstub_read_word(const u8 *, u8 *); -extern asmlinkage int gdbstub_read_dword(const u8 *, u8 *); -extern asmlinkage int gdbstub_write_byte(u32, u8 *); -extern asmlinkage int gdbstub_write_word(u32, u8 *); -extern asmlinkage int gdbstub_write_dword(u32, u8 *); - -extern asmlinkage void gdbstub_read_byte_guard(void); -extern asmlinkage void gdbstub_read_byte_cont(void); -extern asmlinkage void gdbstub_read_word_guard(void); -extern asmlinkage void gdbstub_read_word_cont(void); -extern asmlinkage void gdbstub_read_dword_guard(void); -extern asmlinkage void gdbstub_read_dword_cont(void); -extern asmlinkage void gdbstub_write_byte_guard(void); -extern asmlinkage void gdbstub_write_byte_cont(void); -extern asmlinkage void gdbstub_write_word_guard(void); -extern asmlinkage void gdbstub_write_word_cont(void); -extern asmlinkage void gdbstub_write_dword_guard(void); -extern asmlinkage void gdbstub_write_dword_cont(void); - -extern u8 gdbstub_rx_buffer[PAGE_SIZE]; -extern u32 gdbstub_rx_inp; -extern u32 gdbstub_rx_outp; -extern u8 gdbstub_rx_overflow; -extern u8 gdbstub_busy; -extern u8 gdbstub_rx_unget; - -#ifdef CONFIG_GDBSTUB_DEBUGGING -extern void gdbstub_printk(const char *fmt, ...) - __attribute__((format(printf, 1, 2))); -#else -static inline __attribute__((format(printf, 1, 2))) -void gdbstub_printk(const char *fmt, ...) -{ -} -#endif - -#ifdef CONFIG_GDBSTUB_DEBUG_ENTRY -#define gdbstub_entry(FMT, ...) gdbstub_printk(FMT, ##__VA_ARGS__) -#else -#define gdbstub_entry(FMT, ...) no_printk(FMT, ##__VA_ARGS__) -#endif - -#ifdef CONFIG_GDBSTUB_DEBUG_PROTOCOL -#define gdbstub_proto(FMT, ...) gdbstub_printk(FMT, ##__VA_ARGS__) -#else -#define gdbstub_proto(FMT, ...) no_printk(FMT, ##__VA_ARGS__) -#endif - -#ifdef CONFIG_GDBSTUB_DEBUG_IO -#define gdbstub_io(FMT, ...) gdbstub_printk(FMT, ##__VA_ARGS__) -#else -#define gdbstub_io(FMT, ...) no_printk(FMT, ##__VA_ARGS__) -#endif - -#ifdef CONFIG_GDBSTUB_DEBUG_BREAKPOINT -#define gdbstub_bkpt(FMT, ...) gdbstub_printk(FMT, ##__VA_ARGS__) -#else -#define gdbstub_bkpt(FMT, ...) no_printk(FMT, ##__VA_ARGS__) -#endif - -#endif /* !__ASSEMBLY__ */ -#endif /* _ASM_GDB_STUB_H */ diff --git a/arch/mn10300/include/asm/hardirq.h b/arch/mn10300/include/asm/hardirq.h deleted file mode 100644 index 0000d650b55f1..0000000000000 --- a/arch/mn10300/include/asm/hardirq.h +++ /dev/null @@ -1,49 +0,0 @@ -/* MN10300 Hardware IRQ statistics and management - * - * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd. - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Modified by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_HARDIRQ_H -#define _ASM_HARDIRQ_H - -#include -#include -#include - -/* assembly code in softirq.h is sensitive to the offsets of these fields */ -typedef struct { - unsigned int __softirq_pending; -#ifdef CONFIG_MN10300_WD_TIMER - unsigned int __nmi_count; /* arch dependent */ - unsigned int __irq_count; /* arch dependent */ -#endif -} ____cacheline_aligned irq_cpustat_t; - -#include /* Standard mappings for irq_cpustat_t above */ - -extern void ack_bad_irq(int irq); - -/* - * manipulate stubs in the MN10300 CPU Trap/Interrupt Vector table - * - these should jump to __common_exception in entry.S unless there's a good - * reason to do otherwise (see trap_preinit() in traps.c) - */ -typedef void (*intr_stub_fnx)(struct pt_regs *regs, - enum exception_code intcode); - -/* - * manipulate pointers in the Exception table (see entry.S) - * - these are indexed by decoding the lower 24 bits of the TBR register - * - note that the MN103E010 doesn't always trap through the correct vector, - * but does always set the TBR correctly - */ -extern asmlinkage void set_excp_vector(enum exception_code code, - intr_stub_fnx handler); - -#endif /* _ASM_HARDIRQ_H */ diff --git a/arch/mn10300/include/asm/highmem.h b/arch/mn10300/include/asm/highmem.h deleted file mode 100644 index 1ddea5afba093..0000000000000 --- a/arch/mn10300/include/asm/highmem.h +++ /dev/null @@ -1,131 +0,0 @@ -/* MN10300 Virtual kernel memory mappings for high memory - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - Derived from include/asm-i386/highmem.h - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_HIGHMEM_H -#define _ASM_HIGHMEM_H - -#ifdef __KERNEL__ - -#include -#include -#include -#include -#include - -/* undef for production */ -#undef HIGHMEM_DEBUG - -/* declarations for highmem.c */ -extern unsigned long highstart_pfn, highend_pfn; - -extern pte_t *kmap_pte; -extern pgprot_t kmap_prot; -extern pte_t *pkmap_page_table; - -extern void __init kmap_init(void); - -/* - * Right now we initialize only a single pte table. It can be extended - * easily, subsequent pte tables have to be allocated in one physical - * chunk of RAM. - */ -#define PKMAP_BASE 0xfe000000UL -#define LAST_PKMAP 1024 -#define LAST_PKMAP_MASK (LAST_PKMAP - 1) -#define PKMAP_NR(virt) ((virt - PKMAP_BASE) >> PAGE_SHIFT) -#define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT)) - -extern unsigned long kmap_high(struct page *page); -extern void kunmap_high(struct page *page); - -static inline unsigned long kmap(struct page *page) -{ - if (in_interrupt()) - BUG(); - if (page < highmem_start_page) - return page_address(page); - return kmap_high(page); -} - -static inline void kunmap(struct page *page) -{ - if (in_interrupt()) - BUG(); - if (page < highmem_start_page) - return; - kunmap_high(page); -} - -/* - * The use of kmap_atomic/kunmap_atomic is discouraged - kmap/kunmap - * gives a more generic (and caching) interface. But kmap_atomic can - * be used in IRQ contexts, so in some (very limited) cases we need - * it. - */ -static inline void *kmap_atomic(struct page *page) -{ - unsigned long vaddr; - int idx, type; - - preempt_disable(); - pagefault_disable(); - if (page < highmem_start_page) - return page_address(page); - - type = kmap_atomic_idx_push(); - idx = type + KM_TYPE_NR * smp_processor_id(); - vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); -#if HIGHMEM_DEBUG - if (!pte_none(*(kmap_pte - idx))) - BUG(); -#endif - set_pte(kmap_pte - idx, mk_pte(page, kmap_prot)); - local_flush_tlb_one(vaddr); - - return (void *)vaddr; -} - -static inline void __kunmap_atomic(unsigned long vaddr) -{ - int type; - - if (vaddr < FIXADDR_START) { /* FIXME */ - pagefault_enable(); - preempt_enable(); - return; - } - - type = kmap_atomic_idx(); - -#if HIGHMEM_DEBUG - { - unsigned int idx; - idx = type + KM_TYPE_NR * smp_processor_id(); - - if (vaddr != __fix_to_virt(FIX_KMAP_BEGIN + idx)) - BUG(); - - /* - * force other mappings to Oops if they'll try to access - * this pte without first remap it - */ - pte_clear(kmap_pte - idx); - local_flush_tlb_one(vaddr); - } -#endif - - kmap_atomic_idx_pop(); - pagefault_enable(); - preempt_enable(); -} -#endif /* __KERNEL__ */ - -#endif /* _ASM_HIGHMEM_H */ diff --git a/arch/mn10300/include/asm/hw_irq.h b/arch/mn10300/include/asm/hw_irq.h deleted file mode 100644 index 70619901098ec..0000000000000 --- a/arch/mn10300/include/asm/hw_irq.h +++ /dev/null @@ -1,14 +0,0 @@ -/* MN10300 Hardware interrupt definitions - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_HW_IRQ_H -#define _ASM_HW_IRQ_H - -#endif /* _ASM_HW_IRQ_H */ diff --git a/arch/mn10300/include/asm/intctl-regs.h b/arch/mn10300/include/asm/intctl-regs.h deleted file mode 100644 index d65bbeebe50a6..0000000000000 --- a/arch/mn10300/include/asm/intctl-regs.h +++ /dev/null @@ -1,71 +0,0 @@ -/* MN10300 On-board interrupt controller registers - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_INTCTL_REGS_H -#define _ASM_INTCTL_REGS_H - -#include - -#ifdef __KERNEL__ - -/* - * Interrupt controller registers - * - Registers 64-191 are at addresses offset from the main array - */ -#define GxICR(X) \ - __SYSREG(0xd4000000 + (X) * 4 + \ - (((X) >= 64) && ((X) < 192)) * 0xf00, u16) - -#define GxICR_u8(X) \ - __SYSREG(0xd4000000 + (X) * 4 + \ - (((X) >= 64) && ((X) < 192)) * 0xf00, u8) - -#include - -#define XIRQ_TRIGGER_LOWLEVEL 0 -#define XIRQ_TRIGGER_HILEVEL 1 -#define XIRQ_TRIGGER_NEGEDGE 2 -#define XIRQ_TRIGGER_POSEDGE 3 - -/* non-maskable interrupt control */ -#define NMIIRQ 0 -#define NMICR GxICR(NMIIRQ) /* NMI control register */ -#define NMICR_NMIF 0x0001 /* NMI pin interrupt flag */ -#define NMICR_WDIF 0x0002 /* watchdog timer overflow flag */ -#define NMICR_ABUSERR 0x0008 /* async bus error flag */ - -/* maskable interrupt control */ -#define GxICR_DETECT 0x0001 /* interrupt detect flag */ -#define GxICR_REQUEST 0x0010 /* interrupt request flag */ -#define GxICR_ENABLE 0x0100 /* interrupt enable flag */ -#define GxICR_LEVEL 0x7000 /* interrupt priority level */ -#define GxICR_LEVEL_0 0x0000 /* - level 0 */ -#define GxICR_LEVEL_1 0x1000 /* - level 1 */ -#define GxICR_LEVEL_2 0x2000 /* - level 2 */ -#define GxICR_LEVEL_3 0x3000 /* - level 3 */ -#define GxICR_LEVEL_4 0x4000 /* - level 4 */ -#define GxICR_LEVEL_5 0x5000 /* - level 5 */ -#define GxICR_LEVEL_6 0x6000 /* - level 6 */ -#define GxICR_LEVEL_SHIFT 12 -#define GxICR_NMI 0x8000 /* nmi request flag */ - -#define NUM2GxICR_LEVEL(num) ((num) << GxICR_LEVEL_SHIFT) - -#ifndef __ASSEMBLY__ -extern void set_intr_level(int irq, u16 level); -extern void mn10300_set_lateack_irq_type(int irq); -#endif - -/* external interrupts */ -#define XIRQxICR(X) GxICR((X)) /* external interrupt control regs */ - -#endif /* __KERNEL__ */ - -#endif /* _ASM_INTCTL_REGS_H */ diff --git a/arch/mn10300/include/asm/io.h b/arch/mn10300/include/asm/io.h deleted file mode 100644 index 62189353d2f62..0000000000000 --- a/arch/mn10300/include/asm/io.h +++ /dev/null @@ -1,325 +0,0 @@ -/* MN10300 I/O port emulation and memory-mapped I/O - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_IO_H -#define _ASM_IO_H - -#include /* I/O is all done through memory accesses */ -#include -#include -#include - -#define mmiowb() do {} while (0) - -/*****************************************************************************/ -/* - * readX/writeX() are used to access memory mapped devices. On some - * architectures the memory mapped IO stuff needs to be accessed - * differently. On the x86 architecture, we just read/write the - * memory location directly. - */ -static inline u8 readb(const volatile void __iomem *addr) -{ - return *(const volatile u8 *) addr; -} - -static inline u16 readw(const volatile void __iomem *addr) -{ - return *(const volatile u16 *) addr; -} - -static inline u32 readl(const volatile void __iomem *addr) -{ - return *(const volatile u32 *) addr; -} - -#define __raw_readb readb -#define __raw_readw readw -#define __raw_readl readl - -#define readb_relaxed readb -#define readw_relaxed readw -#define readl_relaxed readl - -static inline void writeb(u8 b, volatile void __iomem *addr) -{ - *(volatile u8 *) addr = b; -} - -static inline void writew(u16 b, volatile void __iomem *addr) -{ - *(volatile u16 *) addr = b; -} - -static inline void writel(u32 b, volatile void __iomem *addr) -{ - *(volatile u32 *) addr = b; -} - -#define __raw_writeb writeb -#define __raw_writew writew -#define __raw_writel writel - -#define writeb_relaxed writeb -#define writew_relaxed writew -#define writel_relaxed writel - -/*****************************************************************************/ -/* - * traditional input/output functions - */ -static inline u8 inb_local(unsigned long addr) -{ - return readb((volatile void __iomem *) addr); -} - -static inline void outb_local(u8 b, unsigned long addr) -{ - return writeb(b, (volatile void __iomem *) addr); -} - -static inline u8 inb(unsigned long addr) -{ - return readb((volatile void __iomem *) addr); -} - -static inline u16 inw(unsigned long addr) -{ - return readw((volatile void __iomem *) addr); -} - -static inline u32 inl(unsigned long addr) -{ - return readl((volatile void __iomem *) addr); -} - -static inline void outb(u8 b, unsigned long addr) -{ - return writeb(b, (volatile void __iomem *) addr); -} - -static inline void outw(u16 b, unsigned long addr) -{ - return writew(b, (volatile void __iomem *) addr); -} - -static inline void outl(u32 b, unsigned long addr) -{ - return writel(b, (volatile void __iomem *) addr); -} - -#define inb_p(addr) inb(addr) -#define inw_p(addr) inw(addr) -#define inl_p(addr) inl(addr) -#define outb_p(x, addr) outb((x), (addr)) -#define outw_p(x, addr) outw((x), (addr)) -#define outl_p(x, addr) outl((x), (addr)) - -static inline void insb(unsigned long addr, void *buffer, int count) -{ - if (count) { - u8 *buf = buffer; - do { - u8 x = inb(addr); - *buf++ = x; - } while (--count); - } -} - -static inline void insw(unsigned long addr, void *buffer, int count) -{ - if (count) { - u16 *buf = buffer; - do { - u16 x = inw(addr); - *buf++ = x; - } while (--count); - } -} - -static inline void insl(unsigned long addr, void *buffer, int count) -{ - if (count) { - u32 *buf = buffer; - do { - u32 x = inl(addr); - *buf++ = x; - } while (--count); - } -} - -static inline void outsb(unsigned long addr, const void *buffer, int count) -{ - if (count) { - const u8 *buf = buffer; - do { - outb(*buf++, addr); - } while (--count); - } -} - -static inline void outsw(unsigned long addr, const void *buffer, int count) -{ - if (count) { - const u16 *buf = buffer; - do { - outw(*buf++, addr); - } while (--count); - } -} - -extern void __outsl(unsigned long addr, const void *buffer, int count); -static inline void outsl(unsigned long addr, const void *buffer, int count) -{ - if ((unsigned long) buffer & 0x3) - return __outsl(addr, buffer, count); - - if (count) { - const u32 *buf = buffer; - do { - outl(*buf++, addr); - } while (--count); - } -} - -#define ioread8(addr) readb(addr) -#define ioread16(addr) readw(addr) -#define ioread32(addr) readl(addr) - -#define iowrite8(v, addr) writeb((v), (addr)) -#define iowrite16(v, addr) writew((v), (addr)) -#define iowrite32(v, addr) writel((v), (addr)) - -#define ioread16be(addr) be16_to_cpu(readw(addr)) -#define ioread32be(addr) be32_to_cpu(readl(addr)) -#define iowrite16be(v, addr) writew(cpu_to_be16(v), (addr)) -#define iowrite32be(v, addr) writel(cpu_to_be32(v), (addr)) - -#define ioread8_rep(p, dst, count) \ - insb((unsigned long) (p), (dst), (count)) -#define ioread16_rep(p, dst, count) \ - insw((unsigned long) (p), (dst), (count)) -#define ioread32_rep(p, dst, count) \ - insl((unsigned long) (p), (dst), (count)) - -#define iowrite8_rep(p, src, count) \ - outsb((unsigned long) (p), (src), (count)) -#define iowrite16_rep(p, src, count) \ - outsw((unsigned long) (p), (src), (count)) -#define iowrite32_rep(p, src, count) \ - outsl((unsigned long) (p), (src), (count)) - -#define readsb(p, dst, count) \ - insb((unsigned long) (p), (dst), (count)) -#define readsw(p, dst, count) \ - insw((unsigned long) (p), (dst), (count)) -#define readsl(p, dst, count) \ - insl((unsigned long) (p), (dst), (count)) - -#define writesb(p, src, count) \ - outsb((unsigned long) (p), (src), (count)) -#define writesw(p, src, count) \ - outsw((unsigned long) (p), (src), (count)) -#define writesl(p, src, count) \ - outsl((unsigned long) (p), (src), (count)) - -#define IO_SPACE_LIMIT 0xffffffff - -#ifdef __KERNEL__ - -#include -#define __io_virt(x) ((void *) (x)) - -/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ -struct pci_dev; -static inline void pci_iounmap(struct pci_dev *dev, void __iomem *p) -{ -} - -/* - * Change virtual addresses to physical addresses and vv. - * These are pretty trivial - */ -static inline unsigned long virt_to_phys(volatile void *address) -{ - return __pa(address); -} - -static inline void *phys_to_virt(unsigned long address) -{ - return __va(address); -} - -/* - * Change "struct page" to physical address. - */ -static inline void __iomem *__ioremap(unsigned long offset, unsigned long size, - unsigned long flags) -{ - return (void __iomem *) offset; -} - -static inline void __iomem *ioremap(unsigned long offset, unsigned long size) -{ - return (void __iomem *)(offset & ~0x20000000); -} - -/* - * This one maps high address device memory and turns off caching for that - * area. it's useful if some control registers are in such an area and write - * combining or read caching is not desirable: - */ -static inline void __iomem *ioremap_nocache(unsigned long offset, unsigned long size) -{ - return (void __iomem *) (offset | 0x20000000); -} - -#define ioremap_wc ioremap_nocache -#define ioremap_wt ioremap_nocache -#define ioremap_uc ioremap_nocache - -static inline void iounmap(void __iomem *addr) -{ -} - -static inline void __iomem *ioport_map(unsigned long port, unsigned int nr) -{ - return (void __iomem *) port; -} - -static inline void ioport_unmap(void __iomem *p) -{ -} - -#define xlate_dev_kmem_ptr(p) ((void *) (p)) -#define xlate_dev_mem_ptr(p) ((void *) (p)) - -/* - * PCI bus iomem addresses must be in the region 0x80000000-0x9fffffff - */ -static inline unsigned long virt_to_bus(volatile void *address) -{ - return ((unsigned long) address) & ~0x20000000; -} - -static inline void *bus_to_virt(unsigned long address) -{ - return (void *) address; -} - -#define page_to_bus page_to_phys - -#define memset_io(a, b, c) memset(__io_virt(a), (b), (c)) -#define memcpy_fromio(a, b, c) memcpy((a), __io_virt(b), (c)) -#define memcpy_toio(a, b, c) memcpy(__io_virt(a), (b), (c)) - -#endif /* __KERNEL__ */ - -#endif /* _ASM_IO_H */ diff --git a/arch/mn10300/include/asm/irq.h b/arch/mn10300/include/asm/irq.h deleted file mode 100644 index 1a73fb3f60c66..0000000000000 --- a/arch/mn10300/include/asm/irq.h +++ /dev/null @@ -1,40 +0,0 @@ -/* MN10300 Hardware interrupt definitions - * - * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd. - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Modified by David Howells (dhowells@redhat.com) - * - Derived from include/asm-i386/irq.h: - * - (C) 1992, 1993 Linus Torvalds, (C) 1997 Ingo Molnar - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_IRQ_H -#define _ASM_IRQ_H - -#include -#include -#include - -/* this number is used when no interrupt has been assigned */ -#define NO_IRQ INT_MAX - -/* - * hardware irq numbers - * - the ASB2364 has an FPGA with an IRQ multiplexer on it - */ -#ifdef CONFIG_MN10300_UNIT_ASB2364 -#include -#else -#define NR_CPU_IRQS GxICR_NUM_IRQS -#define NR_IRQS NR_CPU_IRQS -#endif - -/* external hardware irq numbers */ -#define NR_XIRQS GxICR_NUM_XIRQS - -#define irq_canonicalize(IRQ) (IRQ) - -#endif /* _ASM_IRQ_H */ diff --git a/arch/mn10300/include/asm/irq_regs.h b/arch/mn10300/include/asm/irq_regs.h deleted file mode 100644 index 97d0cb5af8078..0000000000000 --- a/arch/mn10300/include/asm/irq_regs.h +++ /dev/null @@ -1,28 +0,0 @@ -/* MN10300 IRQ registers pointer definition - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_IRQ_REGS_H -#define _ASM_IRQ_REGS_H - -/* - * Per-cpu current frame pointer - the location of the last exception frame on - * the stack - */ -#define ARCH_HAS_OWN_IRQ_REGS - -#ifndef __ASSEMBLY__ -static inline __attribute__((const)) -struct pt_regs *get_irq_regs(void) -{ - return current_frame(); -} -#endif - -#endif /* _ASM_IRQ_REGS_H */ diff --git a/arch/mn10300/include/asm/irqflags.h b/arch/mn10300/include/asm/irqflags.h deleted file mode 100644 index 8730c0a3c37d2..0000000000000 --- a/arch/mn10300/include/asm/irqflags.h +++ /dev/null @@ -1,215 +0,0 @@ -/* MN10300 IRQ flag handling - * - * Copyright (C) 2010 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - -#ifndef _ASM_IRQFLAGS_H -#define _ASM_IRQFLAGS_H - -#include -/* linux/smp.h <- linux/irqflags.h needs asm/smp.h first */ -#include - -/* - * interrupt control - * - "disabled": run in IM1/2 - * - level 0 - kernel debugger - * - level 1 - virtual serial DMA (if present) - * - level 5 - normal interrupt priority - * - level 6 - timer interrupt - * - "enabled": run in IM7 - */ -#define MN10300_CLI_LEVEL (CONFIG_LINUX_CLI_LEVEL << EPSW_IM_SHIFT) - -#ifndef __ASSEMBLY__ - -static inline unsigned long arch_local_save_flags(void) -{ - unsigned long flags; - - asm volatile("mov epsw,%0" : "=d"(flags)); - return flags; -} - -static inline void arch_local_irq_disable(void) -{ - asm volatile( - " and %0,epsw \n" - " or %1,epsw \n" - " nop \n" - " nop \n" - " nop \n" - : - : "i"(~EPSW_IM), "i"(EPSW_IE | MN10300_CLI_LEVEL) - : "memory"); -} - -static inline unsigned long arch_local_irq_save(void) -{ - unsigned long flags; - - flags = arch_local_save_flags(); - arch_local_irq_disable(); - return flags; -} - -/* - * we make sure arch_irq_enable() doesn't cause priority inversion - */ -extern unsigned long __mn10300_irq_enabled_epsw[]; - -static inline void arch_local_irq_enable(void) -{ - unsigned long tmp; - int cpu = raw_smp_processor_id(); - - asm volatile( - " mov epsw,%0 \n" - " and %1,%0 \n" - " or %2,%0 \n" - " mov %0,epsw \n" - : "=&d"(tmp) - : "i"(~EPSW_IM), "r"(__mn10300_irq_enabled_epsw[cpu]) - : "memory", "cc"); -} - -static inline void arch_local_irq_restore(unsigned long flags) -{ - asm volatile( - " mov %0,epsw \n" - " nop \n" - " nop \n" - " nop \n" - : - : "d"(flags) - : "memory", "cc"); -} - -static inline bool arch_irqs_disabled_flags(unsigned long flags) -{ - return (flags & (EPSW_IE | EPSW_IM)) != (EPSW_IE | EPSW_IM_7); -} - -static inline bool arch_irqs_disabled(void) -{ - return arch_irqs_disabled_flags(arch_local_save_flags()); -} - -/* - * Hook to save power by halting the CPU - * - called from the idle loop - * - must reenable interrupts (which takes three instruction cycles to complete) - */ -static inline void arch_safe_halt(void) -{ -#ifdef CONFIG_SMP - arch_local_irq_enable(); -#else - asm volatile( - " or %0,epsw \n" - " nop \n" - " nop \n" - " bset %2,(%1) \n" - : - : "i"(EPSW_IE|EPSW_IM), "n"(&CPUM), "i"(CPUM_SLEEP) - : "cc"); -#endif -} - -#define __sleep_cpu() \ -do { \ - asm volatile( \ - " bset %1,(%0)\n" \ - "1: btst %1,(%0)\n" \ - " bne 1b\n" \ - : \ - : "i"(&CPUM), "i"(CPUM_SLEEP) \ - : "cc" \ - ); \ -} while (0) - -static inline void arch_local_cli(void) -{ - asm volatile( - " and %0,epsw \n" - " nop \n" - " nop \n" - " nop \n" - : - : "i"(~EPSW_IE) - : "memory" - ); -} - -static inline unsigned long arch_local_cli_save(void) -{ - unsigned long flags = arch_local_save_flags(); - arch_local_cli(); - return flags; -} - -static inline void arch_local_sti(void) -{ - asm volatile( - " or %0,epsw \n" - : - : "i"(EPSW_IE) - : "memory"); -} - -static inline void arch_local_change_intr_mask_level(unsigned long level) -{ - asm volatile( - " and %0,epsw \n" - " or %1,epsw \n" - : - : "i"(~EPSW_IM), "i"(EPSW_IE | level) - : "cc", "memory"); -} - -#else /* !__ASSEMBLY__ */ - -#define LOCAL_SAVE_FLAGS(reg) \ - mov epsw,reg - -#define LOCAL_IRQ_DISABLE \ - and ~EPSW_IM,epsw; \ - or EPSW_IE|MN10300_CLI_LEVEL,epsw; \ - nop; \ - nop; \ - nop - -#define LOCAL_IRQ_ENABLE \ - or EPSW_IE|EPSW_IM_7,epsw - -#define LOCAL_IRQ_RESTORE(reg) \ - mov reg,epsw - -#define LOCAL_CLI_SAVE(reg) \ - mov epsw,reg; \ - and ~EPSW_IE,epsw; \ - nop; \ - nop; \ - nop - -#define LOCAL_CLI \ - and ~EPSW_IE,epsw; \ - nop; \ - nop; \ - nop - -#define LOCAL_STI \ - or EPSW_IE,epsw - -#define LOCAL_CHANGE_INTR_MASK_LEVEL(level) \ - and ~EPSW_IM,epsw; \ - or EPSW_IE|(level),epsw - -#endif /* __ASSEMBLY__ */ -#endif /* _ASM_IRQFLAGS_H */ diff --git a/arch/mn10300/include/asm/kdebug.h b/arch/mn10300/include/asm/kdebug.h deleted file mode 100644 index 0f47e112190c9..0000000000000 --- a/arch/mn10300/include/asm/kdebug.h +++ /dev/null @@ -1,22 +0,0 @@ -/* MN10300 In-kernel death knells - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - -#ifndef _ASM_KDEBUG_H -#define _ASM_KDEBUG_H - -/* Grossly misnamed. */ -enum die_val { - DIE_OOPS = 1, - DIE_BREAKPOINT, - DIE_GPF, -}; - -#endif /* _ASM_KDEBUG_H */ diff --git a/arch/mn10300/include/asm/kgdb.h b/arch/mn10300/include/asm/kgdb.h deleted file mode 100644 index eb245f18a7083..0000000000000 --- a/arch/mn10300/include/asm/kgdb.h +++ /dev/null @@ -1,81 +0,0 @@ -/* Kernel debugger for MN10300 - * - * Copyright (C) 2010 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - -#ifndef _ASM_KGDB_H -#define _ASM_KGDB_H - -/* - * BUFMAX defines the maximum number of characters in inbound/outbound - * buffers at least NUMREGBYTES*2 are needed for register packets - * Longer buffer is needed to list all threads - */ -#define BUFMAX 1024 - -/* - * Note that this register image is in a different order than the register - * image that Linux produces at interrupt time. - */ -enum regnames { - GDB_FR_D0 = 0, - GDB_FR_D1 = 1, - GDB_FR_D2 = 2, - GDB_FR_D3 = 3, - GDB_FR_A0 = 4, - GDB_FR_A1 = 5, - GDB_FR_A2 = 6, - GDB_FR_A3 = 7, - - GDB_FR_SP = 8, - GDB_FR_PC = 9, - GDB_FR_MDR = 10, - GDB_FR_EPSW = 11, - GDB_FR_LIR = 12, - GDB_FR_LAR = 13, - GDB_FR_MDRQ = 14, - - GDB_FR_E0 = 15, - GDB_FR_E1 = 16, - GDB_FR_E2 = 17, - GDB_FR_E3 = 18, - GDB_FR_E4 = 19, - GDB_FR_E5 = 20, - GDB_FR_E6 = 21, - GDB_FR_E7 = 22, - - GDB_FR_SSP = 23, - GDB_FR_MSP = 24, - GDB_FR_USP = 25, - GDB_FR_MCRH = 26, - GDB_FR_MCRL = 27, - GDB_FR_MCVF = 28, - - GDB_FR_FPCR = 29, - GDB_FR_DUMMY0 = 30, - GDB_FR_DUMMY1 = 31, - - GDB_FR_FS0 = 32, - - GDB_FR_SIZE = 64, -}; - -#define GDB_ORIG_D0 41 -#define NUMREGBYTES (GDB_FR_SIZE*4) - -static inline void arch_kgdb_breakpoint(void) -{ - asm(".globl __arch_kgdb_breakpoint; __arch_kgdb_breakpoint: break"); -} -extern u8 __arch_kgdb_breakpoint; - -#define BREAK_INSTR_SIZE 1 -#define CACHE_FLUSH_IS_SAFE 1 - -#endif /* _ASM_KGDB_H */ diff --git a/arch/mn10300/include/asm/kmap_types.h b/arch/mn10300/include/asm/kmap_types.h deleted file mode 100644 index f444d7ffa7665..0000000000000 --- a/arch/mn10300/include/asm/kmap_types.h +++ /dev/null @@ -1,7 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_KMAP_TYPES_H -#define _ASM_KMAP_TYPES_H - -#include - -#endif /* _ASM_KMAP_TYPES_H */ diff --git a/arch/mn10300/include/asm/kprobes.h b/arch/mn10300/include/asm/kprobes.h deleted file mode 100644 index 7abea0bdb549a..0000000000000 --- a/arch/mn10300/include/asm/kprobes.h +++ /dev/null @@ -1,55 +0,0 @@ -/* MN10300 Kernel Probes support - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by Mark Salter (msalter@redhat.com) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public Licence as published by - * the Free Software Foundation; either version 2 of the Licence, 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 Licence for more details. - * - * You should have received a copy of the GNU General Public Licence - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - */ -#ifndef _ASM_KPROBES_H -#define _ASM_KPROBES_H - -#include - -#define BREAKPOINT_INSTRUCTION 0xff - -#ifdef CONFIG_KPROBES -#include -#include - -struct kprobe; - -typedef unsigned char kprobe_opcode_t; -#define MAX_INSN_SIZE 8 -#define MAX_STACK_SIZE 128 - -/* Architecture specific copy of original instruction */ -struct arch_specific_insn { - /* copy of original instruction - */ - kprobe_opcode_t insn[MAX_INSN_SIZE]; -}; - -extern const int kretprobe_blacklist_size; - -extern int kprobe_exceptions_notify(struct notifier_block *self, - unsigned long val, void *data); - -#define flush_insn_slot(p) do {} while (0) - -extern void arch_remove_kprobe(struct kprobe *p); - -#endif /* CONFIG_KPROBES */ -#endif /* _ASM_KPROBES_H */ diff --git a/arch/mn10300/include/asm/linkage.h b/arch/mn10300/include/asm/linkage.h deleted file mode 100644 index dda3002a5dfaa..0000000000000 --- a/arch/mn10300/include/asm/linkage.h +++ /dev/null @@ -1,20 +0,0 @@ -/* MN10300 Linkage and calling-convention overrides - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_LINKAGE_H -#define _ASM_LINKAGE_H - -/* don't override anything */ -#define asmlinkage - -#define __ALIGN .align 4,0xcb -#define __ALIGN_STR ".align 4,0xcb" - -#endif diff --git a/arch/mn10300/include/asm/local.h b/arch/mn10300/include/asm/local.h deleted file mode 100644 index c11c530f74d02..0000000000000 --- a/arch/mn10300/include/asm/local.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/arch/mn10300/include/asm/local64.h b/arch/mn10300/include/asm/local64.h deleted file mode 100644 index 36c93b5cc239b..0000000000000 --- a/arch/mn10300/include/asm/local64.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/arch/mn10300/include/asm/mc146818rtc.h b/arch/mn10300/include/asm/mc146818rtc.h deleted file mode 100644 index df6bc6e0e8c6e..0000000000000 --- a/arch/mn10300/include/asm/mc146818rtc.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/arch/mn10300/include/asm/mmu.h b/arch/mn10300/include/asm/mmu.h deleted file mode 100644 index b9d6d41adace1..0000000000000 --- a/arch/mn10300/include/asm/mmu.h +++ /dev/null @@ -1,20 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* MN10300 Memory management context - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - Derived from include/asm-frv/mmu.h - */ - -#ifndef _ASM_MMU_H -#define _ASM_MMU_H - -/* - * MMU context - */ -typedef struct { - unsigned long tlbpid[NR_CPUS]; /* TLB PID for this process on - * each CPU */ -} mm_context_t; - -#endif /* _ASM_MMU_H */ diff --git a/arch/mn10300/include/asm/mmu_context.h b/arch/mn10300/include/asm/mmu_context.h deleted file mode 100644 index d2034f5e6eda7..0000000000000 --- a/arch/mn10300/include/asm/mmu_context.h +++ /dev/null @@ -1,163 +0,0 @@ -/* MN10300 MMU context management - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Modified by David Howells (dhowells@redhat.com) - * - Derived from include/asm-m32r/mmu_context.h - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - * - * - * This implements an algorithm to provide TLB PID mappings to provide - * selective access to the TLB for processes, thus reducing the number of TLB - * flushes required. - * - * Note, however, that the M32R algorithm is technically broken as it does not - * handle version wrap-around, and could, theoretically, have a problem with a - * very long lived program that sleeps long enough for the version number to - * wrap all the way around so that its TLB mappings appear valid once again. - */ -#ifndef _ASM_MMU_CONTEXT_H -#define _ASM_MMU_CONTEXT_H - -#include -#include - -#include -#include -#include - -#define MMU_CONTEXT_TLBPID_NR 256 -#define MMU_CONTEXT_TLBPID_MASK 0x000000ffUL -#define MMU_CONTEXT_VERSION_MASK 0xffffff00UL -#define MMU_CONTEXT_FIRST_VERSION 0x00000100UL -#define MMU_NO_CONTEXT 0x00000000UL -#define MMU_CONTEXT_TLBPID_LOCK_NR 0 - -#define enter_lazy_tlb(mm, tsk) do {} while (0) - -static inline void cpu_ran_vm(int cpu, struct mm_struct *mm) -{ -#ifdef CONFIG_SMP - cpumask_set_cpu(cpu, mm_cpumask(mm)); -#endif -} - -static inline bool cpu_maybe_ran_vm(int cpu, struct mm_struct *mm) -{ -#ifdef CONFIG_SMP - return cpumask_test_and_set_cpu(cpu, mm_cpumask(mm)); -#else - return true; -#endif -} - -#ifdef CONFIG_MN10300_TLB_USE_PIDR -extern unsigned long mmu_context_cache[NR_CPUS]; -#define mm_context(mm) (mm->context.tlbpid[smp_processor_id()]) - -/** - * allocate_mmu_context - Allocate storage for the arch-specific MMU data - * @mm: The userspace VM context being set up - */ -static inline unsigned long allocate_mmu_context(struct mm_struct *mm) -{ - unsigned long *pmc = &mmu_context_cache[smp_processor_id()]; - unsigned long mc = ++(*pmc); - - if (!(mc & MMU_CONTEXT_TLBPID_MASK)) { - /* we exhausted the TLB PIDs of this version on this CPU, so we - * flush this CPU's TLB in its entirety and start new cycle */ - local_flush_tlb_all(); - - /* fix the TLB version if needed (we avoid version #0 so as to - * distinguish MMU_NO_CONTEXT) */ - if (!mc) - *pmc = mc = MMU_CONTEXT_FIRST_VERSION; - } - mm_context(mm) = mc; - return mc; -} - -/* - * get an MMU context if one is needed - */ -static inline unsigned long get_mmu_context(struct mm_struct *mm) -{ - unsigned long mc = MMU_NO_CONTEXT, cache; - - if (mm) { - cache = mmu_context_cache[smp_processor_id()]; - mc = mm_context(mm); - - /* if we have an old version of the context, replace it */ - if ((mc ^ cache) & MMU_CONTEXT_VERSION_MASK) - mc = allocate_mmu_context(mm); - } - return mc; -} - -/* - * initialise the context related info for a new mm_struct instance - */ -static inline int init_new_context(struct task_struct *tsk, - struct mm_struct *mm) -{ - int num_cpus = NR_CPUS, i; - - for (i = 0; i < num_cpus; i++) - mm->context.tlbpid[i] = MMU_NO_CONTEXT; - return 0; -} - -/* - * after we have set current->mm to a new value, this activates the context for - * the new mm so we see the new mappings. - */ -static inline void activate_context(struct mm_struct *mm) -{ - PIDR = get_mmu_context(mm) & MMU_CONTEXT_TLBPID_MASK; -} -#else /* CONFIG_MN10300_TLB_USE_PIDR */ - -#define init_new_context(tsk, mm) (0) -#define activate_context(mm) local_flush_tlb() - -#endif /* CONFIG_MN10300_TLB_USE_PIDR */ - -/** - * destroy_context - Destroy mm context information - * @mm: The MM being destroyed. - * - * Destroy context related info for an mm_struct that is about to be put to - * rest - */ -#define destroy_context(mm) do {} while (0) - -/** - * switch_mm - Change between userspace virtual memory contexts - * @prev: The outgoing MM context. - * @next: The incoming MM context. - * @tsk: The incoming task. - */ -static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, - struct task_struct *tsk) -{ - int cpu = smp_processor_id(); - - if (prev != next) { -#ifdef CONFIG_SMP - per_cpu(cpu_tlbstate, cpu).active_mm = next; -#endif - cpu_ran_vm(cpu, next); - PTBR = (unsigned long) next->pgd; - activate_context(next); - } -} - -#define deactivate_mm(tsk, mm) do {} while (0) -#define activate_mm(prev, next) switch_mm((prev), (next), NULL) - -#endif /* _ASM_MMU_CONTEXT_H */ diff --git a/arch/mn10300/include/asm/module.h b/arch/mn10300/include/asm/module.h deleted file mode 100644 index 6571103b05181..0000000000000 --- a/arch/mn10300/include/asm/module.h +++ /dev/null @@ -1,22 +0,0 @@ -/* MN10300 Arch-specific module definitions - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by Mark Salter (msalter@redhat.com) - * Derived from include/asm-i386/module.h - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_MODULE_H -#define _ASM_MODULE_H - -#include - -/* - * Include the MN10300 architecture version. - */ -#define MODULE_ARCH_VERMAGIC __stringify(PROCESSOR_MODEL_NAME) " " - -#endif /* _ASM_MODULE_H */ diff --git a/arch/mn10300/include/asm/nmi.h b/arch/mn10300/include/asm/nmi.h deleted file mode 100644 index b05627597b1ba..0000000000000 --- a/arch/mn10300/include/asm/nmi.h +++ /dev/null @@ -1,16 +0,0 @@ -/* MN10300 NMI handling - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_NMI_H -#define _ASM_NMI_H - -extern void arch_touch_nmi_watchdog(void); - -#endif /* _ASM_NMI_H */ diff --git a/arch/mn10300/include/asm/page.h b/arch/mn10300/include/asm/page.h deleted file mode 100644 index dfe730a5ede04..0000000000000 --- a/arch/mn10300/include/asm/page.h +++ /dev/null @@ -1,130 +0,0 @@ -/* MN10300 Page table definitions - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_PAGE_H -#define _ASM_PAGE_H - -/* PAGE_SHIFT determines the page size */ -#define PAGE_SHIFT 12 - -#ifndef __ASSEMBLY__ -#define PAGE_SIZE (1UL << PAGE_SHIFT) -#define PAGE_MASK (~(PAGE_SIZE - 1)) -#else -#define PAGE_SIZE +(1 << PAGE_SHIFT) /* unary plus marks an - * immediate val not an addr */ -#define PAGE_MASK +(~(PAGE_SIZE - 1)) -#endif - -#ifdef __KERNEL__ -#ifndef __ASSEMBLY__ - -#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE) -#define copy_page(to, from) memcpy((void *)(to), (void *)(from), PAGE_SIZE) - -#define clear_user_page(addr, vaddr, page) clear_page(addr) -#define copy_user_page(vto, vfrom, vaddr, to) copy_page(vto, vfrom) - -/* - * These are used to make use of C type-checking.. - */ -typedef struct { unsigned long pte; } pte_t; -typedef struct { unsigned long pgd; } pgd_t; -typedef struct { unsigned long pgprot; } pgprot_t; -typedef struct page *pgtable_t; - -#define PTE_MASK PAGE_MASK -#define HPAGE_SHIFT 22 - -#ifdef CONFIG_HUGETLB_PAGE -#define HPAGE_SIZE ((1UL) << HPAGE_SHIFT) -#define HPAGE_MASK (~(HPAGE_SIZE - 1)) -#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) -#endif - -#define pte_val(x) ((x).pte) -#define pgd_val(x) ((x).pgd) -#define pgprot_val(x) ((x).pgprot) - -#define __pte(x) ((pte_t) { (x) }) -#define __pgd(x) ((pgd_t) { (x) }) -#define __pgprot(x) ((pgprot_t) { (x) }) - -#define __ARCH_USE_5LEVEL_HACK -#include - -#endif /* !__ASSEMBLY__ */ - -/* - * This handles the memory map.. We could make this a config - * option, but too many people screw it up, and too few need - * it. - * - * A __PAGE_OFFSET of 0xC0000000 means that the kernel has - * a virtual address space of one gigabyte, which limits the - * amount of physical memory you can use to about 950MB. - */ - -#ifndef __ASSEMBLY__ - -/* Pure 2^n version of get_order */ -static inline int get_order(unsigned long size) __attribute__((const)); -static inline int get_order(unsigned long size) -{ - int order; - - size = (size - 1) >> (PAGE_SHIFT - 1); - order = -1; - do { - size >>= 1; - order++; - } while (size); - return order; -} - -#endif /* __ASSEMBLY__ */ - -#include - -#define __PAGE_OFFSET (PAGE_OFFSET_RAW) -#define PAGE_OFFSET ((unsigned long) __PAGE_OFFSET) - -/* - * main RAM and kernel working space are coincident at 0x90000000, but to make - * life more interesting, there's also an uncached virtual shadow at 0xb0000000 - * - these mappings are fixed in the MMU - */ -#define __pfn_disp (CONFIG_KERNEL_RAM_BASE_ADDRESS >> PAGE_SHIFT) - -#define __pa(x) ((unsigned long)(x)) -#define __va(x) ((void *)(unsigned long)(x)) -#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) -#define pfn_to_page(pfn) (mem_map + ((pfn) - __pfn_disp)) -#define page_to_pfn(page) ((unsigned long)((page) - mem_map) + __pfn_disp) -#define __pfn_to_phys(pfn) PFN_PHYS(pfn) - -#define pfn_valid(pfn) \ -({ \ - unsigned long __pfn = (pfn) - __pfn_disp; \ - __pfn < max_mapnr; \ -}) - -#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) -#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) -#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) - -#define VM_DATA_DEFAULT_FLAGS \ - (VM_READ | VM_WRITE | \ - ((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0) | \ - VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) - -#endif /* __KERNEL__ */ - -#endif /* _ASM_PAGE_H */ diff --git a/arch/mn10300/include/asm/page_offset.h b/arch/mn10300/include/asm/page_offset.h deleted file mode 100644 index 1e869aa09418e..0000000000000 --- a/arch/mn10300/include/asm/page_offset.h +++ /dev/null @@ -1,12 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* MN10300 Kernel base address - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - */ -#ifndef _ASM_PAGE_OFFSET_H -#define _ASM_PAGE_OFFSET_H - -#define PAGE_OFFSET_RAW CONFIG_KERNEL_RAM_BASE_ADDRESS - -#endif diff --git a/arch/mn10300/include/asm/pci.h b/arch/mn10300/include/asm/pci.h deleted file mode 100644 index 5b75a1b2c4f62..0000000000000 --- a/arch/mn10300/include/asm/pci.h +++ /dev/null @@ -1,84 +0,0 @@ -/* MN10300 PCI definitions - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_PCI_H -#define _ASM_PCI_H - -#ifdef __KERNEL__ -#include /* for struct page */ - -#if 0 -#define __pcbdebug(FMT, ADDR, ...) \ - printk(KERN_DEBUG "PCIBRIDGE[%08x]: "FMT"\n", \ - (u32)(ADDR), ##__VA_ARGS__) - -#define __pcidebug(FMT, BUS, DEVFN, WHERE,...) \ -do { \ - printk(KERN_DEBUG "PCI[%02x:%02x.%x + %02x]: "FMT"\n", \ - (BUS)->number, \ - PCI_SLOT(DEVFN), \ - PCI_FUNC(DEVFN), \ - (u32)(WHERE), ##__VA_ARGS__); \ -} while (0) - -#else -#define __pcbdebug(FMT, ADDR, ...) do {} while (0) -#define __pcidebug(FMT, BUS, DEVFN, WHERE, ...) do {} while (0) -#endif - -/* Can be used to override the logic in pci_scan_bus for skipping - * already-configured bus numbers - to be used for buggy BIOSes or - * architectures with incomplete PCI setup by the loader */ - -#ifdef CONFIG_PCI -#define pcibios_assign_all_busses() 1 -extern void unit_pci_init(void); -#else -#define pcibios_assign_all_busses() 0 -#endif - -#define PCIBIOS_MIN_IO 0xBE000004 -#define PCIBIOS_MIN_MEM 0xB8000000 - -/* Dynamic DMA mapping stuff. - * i386 has everything mapped statically. - */ - -#include -#include -#include -#include -#include - -/* The PCI address space does equal the physical memory - * address space. The networking and block device layers use - * this boolean for bounce buffer decisions. - */ -#define PCI_DMA_BUS_IS_PHYS (1) - -/* Return the index of the PCI controller for device. */ -static inline int pci_controller_num(struct pci_dev *dev) -{ - return 0; -} - -#define HAVE_PCI_MMAP -#define ARCH_GENERIC_PCI_MMAP_RESOURCE - -#endif /* __KERNEL__ */ - -static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) -{ - return channel ? 15 : 14; -} - -#include - -#endif /* _ASM_PCI_H */ diff --git a/arch/mn10300/include/asm/percpu.h b/arch/mn10300/include/asm/percpu.h deleted file mode 100644 index 06a959d672347..0000000000000 --- a/arch/mn10300/include/asm/percpu.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/arch/mn10300/include/asm/pgalloc.h b/arch/mn10300/include/asm/pgalloc.h deleted file mode 100644 index 0f25d5fa86f3e..0000000000000 --- a/arch/mn10300/include/asm/pgalloc.h +++ /dev/null @@ -1,56 +0,0 @@ -/* MN10300 Page and page table/directory allocation - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_PGALLOC_H -#define _ASM_PGALLOC_H - -#include -#include -#include /* for struct page */ - -struct mm_struct; -struct page; - -/* attach a page table to a PMD entry */ -#define pmd_populate_kernel(mm, pmd, pte) \ - set_pmd(pmd, __pmd(__pa(pte) | _PAGE_TABLE)) - -static inline -void pmd_populate(struct mm_struct *mm, pmd_t *pmd, struct page *pte) -{ - set_pmd(pmd, __pmd((page_to_pfn(pte) << PAGE_SHIFT) | _PAGE_TABLE)); -} -#define pmd_pgtable(pmd) pmd_page(pmd) - -/* - * Allocate and free page tables. - */ - -extern pgd_t *pgd_alloc(struct mm_struct *); -extern void pgd_free(struct mm_struct *, pgd_t *); - -extern pte_t *pte_alloc_one_kernel(struct mm_struct *, unsigned long); -extern struct page *pte_alloc_one(struct mm_struct *, unsigned long); - -static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) -{ - free_page((unsigned long) pte); -} - -static inline void pte_free(struct mm_struct *mm, struct page *pte) -{ - pgtable_page_dtor(pte); - __free_page(pte); -} - - -#define __pte_free_tlb(tlb, pte, addr) tlb_remove_page((tlb), (pte)) - -#endif /* _ASM_PGALLOC_H */ diff --git a/arch/mn10300/include/asm/pgtable.h b/arch/mn10300/include/asm/pgtable.h deleted file mode 100644 index 96d3f9deb59c3..0000000000000 --- a/arch/mn10300/include/asm/pgtable.h +++ /dev/null @@ -1,494 +0,0 @@ -/* MN10300 Page table manipulators and constants - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - * - * - * The Linux memory management assumes a three-level page table setup. On - * the i386, we use that, but "fold" the mid level into the top-level page - * table, so that we physically have the same two-level page table as the - * i386 mmu expects. - * - * This file contains the functions and defines necessary to modify and use - * the i386 page table tree for the purposes of the MN10300 TLB handler - * functions. - */ -#ifndef _ASM_PGTABLE_H -#define _ASM_PGTABLE_H - -#include - -#ifndef __ASSEMBLY__ -#include -#include -#include - -#include - -#include -#include -#include - -/* - * ZERO_PAGE is a global shared page that is always zero: used - * for zero-mapped memory areas etc.. - */ -#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page)) -extern unsigned long empty_zero_page[1024]; -extern spinlock_t pgd_lock; -extern struct page *pgd_list; - -extern void pmd_ctor(void *, struct kmem_cache *, unsigned long); -extern void pgtable_cache_init(void); -extern void paging_init(void); - -#endif /* !__ASSEMBLY__ */ - -/* - * The Linux mn10300 paging architecture only implements both the traditional - * 2-level page tables - */ -#define PGDIR_SHIFT 22 -#define PTRS_PER_PGD 1024 -#define PTRS_PER_PUD 1 /* we don't really have any PUD physically */ -#define __PAGETABLE_PUD_FOLDED -#define PTRS_PER_PMD 1 /* we don't really have any PMD physically */ -#define __PAGETABLE_PMD_FOLDED -#define PTRS_PER_PTE 1024 - -#define PGD_SIZE PAGE_SIZE -#define PMD_SIZE (1UL << PMD_SHIFT) -#define PGDIR_SIZE (1UL << PGDIR_SHIFT) -#define PGDIR_MASK (~(PGDIR_SIZE - 1)) - -#define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SIZE) -#define FIRST_USER_ADDRESS 0UL - -#define USER_PGD_PTRS (PAGE_OFFSET >> PGDIR_SHIFT) -#define KERNEL_PGD_PTRS (PTRS_PER_PGD - USER_PGD_PTRS) - -#define TWOLEVEL_PGDIR_SHIFT 22 -#define BOOT_USER_PGD_PTRS (__PAGE_OFFSET >> TWOLEVEL_PGDIR_SHIFT) -#define BOOT_KERNEL_PGD_PTRS (1024 - BOOT_USER_PGD_PTRS) - -#ifndef __ASSEMBLY__ -extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; -#endif - -/* - * Unfortunately, due to the way the MMU works on the MN10300, the vmalloc VM - * area has to be in the lower half of the virtual address range (the upper - * half is not translated through the TLB). - * - * So in this case, the vmalloc area goes at the bottom of the address map - * (leaving a hole at the very bottom to catch addressing errors), and - * userspace starts immediately above. - * - * The vmalloc() routines also leaves a hole of 4kB between each vmalloced - * area to catch addressing errors. - */ -#ifndef __ASSEMBLY__ -#define VMALLOC_OFFSET (8UL * 1024 * 1024) -#define VMALLOC_START (0x70000000UL) -#define VMALLOC_END (0x7C000000UL) -#else -#define VMALLOC_OFFSET (8 * 1024 * 1024) -#define VMALLOC_START (0x70000000) -#define VMALLOC_END (0x7C000000) -#endif - -#ifndef __ASSEMBLY__ -extern pte_t kernel_vmalloc_ptes[(VMALLOC_END - VMALLOC_START) / PAGE_SIZE]; -#endif - -/* IPTEL2/DPTEL2 bit assignments */ -#define _PAGE_BIT_VALID xPTEL2_V_BIT -#define _PAGE_BIT_CACHE xPTEL2_C_BIT -#define _PAGE_BIT_PRESENT xPTEL2_PV_BIT -#define _PAGE_BIT_DIRTY xPTEL2_D_BIT -#define _PAGE_BIT_GLOBAL xPTEL2_G_BIT -#define _PAGE_BIT_ACCESSED xPTEL2_UNUSED1_BIT /* mustn't be loaded into IPTEL2/DPTEL2 */ - -#define _PAGE_VALID xPTEL2_V -#define _PAGE_CACHE xPTEL2_C -#define _PAGE_PRESENT xPTEL2_PV -#define _PAGE_DIRTY xPTEL2_D -#define _PAGE_PROT xPTEL2_PR -#define _PAGE_PROT_RKNU xPTEL2_PR_ROK -#define _PAGE_PROT_WKNU xPTEL2_PR_RWK -#define _PAGE_PROT_RKRU xPTEL2_PR_ROK_ROU -#define _PAGE_PROT_WKRU xPTEL2_PR_RWK_ROU -#define _PAGE_PROT_WKWU xPTEL2_PR_RWK_RWU -#define _PAGE_GLOBAL xPTEL2_G -#define _PAGE_PS_MASK xPTEL2_PS -#define _PAGE_PS_4Kb xPTEL2_PS_4Kb -#define _PAGE_PS_128Kb xPTEL2_PS_128Kb -#define _PAGE_PS_1Kb xPTEL2_PS_1Kb -#define _PAGE_PS_4Mb xPTEL2_PS_4Mb -#define _PAGE_PSE xPTEL2_PS_4Mb /* 4MB page */ -#define _PAGE_CACHE_WT xPTEL2_CWT -#define _PAGE_ACCESSED xPTEL2_UNUSED1 -#define _PAGE_NX 0 /* no-execute bit */ - -/* If _PAGE_VALID is clear, we use these: */ -#define _PAGE_PROTNONE 0x000 /* If not present */ - -#define __PAGE_PROT_UWAUX 0x010 -#define __PAGE_PROT_USER 0x020 -#define __PAGE_PROT_WRITE 0x040 - -#define _PAGE_PRESENTV (_PAGE_PRESENT|_PAGE_VALID) - -#ifndef __ASSEMBLY__ - -#define VMALLOC_VMADDR(x) ((unsigned long)(x)) - -#define _PAGE_TABLE (_PAGE_PRESENTV | _PAGE_PROT_WKNU | _PAGE_ACCESSED | _PAGE_DIRTY) -#define _PAGE_CHG_MASK (PTE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY) - -#define __PAGE_NONE (_PAGE_PRESENTV | _PAGE_PROT_RKNU | _PAGE_ACCESSED | _PAGE_CACHE) -#define __PAGE_SHARED (_PAGE_PRESENTV | _PAGE_PROT_WKWU | _PAGE_ACCESSED | _PAGE_CACHE) -#define __PAGE_COPY (_PAGE_PRESENTV | _PAGE_PROT_RKRU | _PAGE_ACCESSED | _PAGE_CACHE) -#define __PAGE_READONLY (_PAGE_PRESENTV | _PAGE_PROT_RKRU | _PAGE_ACCESSED | _PAGE_CACHE) - -#define PAGE_NONE __pgprot(__PAGE_NONE | _PAGE_NX) -#define PAGE_SHARED_NOEXEC __pgprot(__PAGE_SHARED | _PAGE_NX) -#define PAGE_COPY_NOEXEC __pgprot(__PAGE_COPY | _PAGE_NX) -#define PAGE_READONLY_NOEXEC __pgprot(__PAGE_READONLY | _PAGE_NX) -#define PAGE_SHARED_EXEC __pgprot(__PAGE_SHARED) -#define PAGE_COPY_EXEC __pgprot(__PAGE_COPY) -#define PAGE_READONLY_EXEC __pgprot(__PAGE_READONLY) -#define PAGE_COPY PAGE_COPY_NOEXEC -#define PAGE_READONLY PAGE_READONLY_NOEXEC -#define PAGE_SHARED PAGE_SHARED_EXEC - -#define __PAGE_KERNEL_BASE (_PAGE_PRESENTV | _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_GLOBAL) - -#define __PAGE_KERNEL (__PAGE_KERNEL_BASE | _PAGE_PROT_WKNU | _PAGE_CACHE | _PAGE_NX) -#define __PAGE_KERNEL_NOCACHE (__PAGE_KERNEL_BASE | _PAGE_PROT_WKNU | _PAGE_NX) -#define __PAGE_KERNEL_EXEC (__PAGE_KERNEL & ~_PAGE_NX) -#define __PAGE_KERNEL_RO (__PAGE_KERNEL_BASE | _PAGE_PROT_RKNU | _PAGE_CACHE | _PAGE_NX) -#define __PAGE_KERNEL_LARGE (__PAGE_KERNEL | _PAGE_PSE) -#define __PAGE_KERNEL_LARGE_EXEC (__PAGE_KERNEL_EXEC | _PAGE_PSE) - -#define PAGE_KERNEL __pgprot(__PAGE_KERNEL) -#define PAGE_KERNEL_RO __pgprot(__PAGE_KERNEL_RO) -#define PAGE_KERNEL_EXEC __pgprot(__PAGE_KERNEL_EXEC) -#define PAGE_KERNEL_NOCACHE __pgprot(__PAGE_KERNEL_NOCACHE) -#define PAGE_KERNEL_LARGE __pgprot(__PAGE_KERNEL_LARGE) -#define PAGE_KERNEL_LARGE_EXEC __pgprot(__PAGE_KERNEL_LARGE_EXEC) - -#define __PAGE_USERIO (__PAGE_KERNEL_BASE | _PAGE_PROT_WKWU | _PAGE_NX) -#define PAGE_USERIO __pgprot(__PAGE_USERIO) - -/* - * Whilst the MN10300 can do page protection for execute (given separate data - * and insn TLBs), we are not supporting it at the moment. Write permission, - * however, always implies read permission (but not execute permission). - */ -#define __P000 PAGE_NONE -#define __P001 PAGE_READONLY_NOEXEC -#define __P010 PAGE_COPY_NOEXEC -#define __P011 PAGE_COPY_NOEXEC -#define __P100 PAGE_READONLY_EXEC -#define __P101 PAGE_READONLY_EXEC -#define __P110 PAGE_COPY_EXEC -#define __P111 PAGE_COPY_EXEC - -#define __S000 PAGE_NONE -#define __S001 PAGE_READONLY_NOEXEC -#define __S010 PAGE_SHARED_NOEXEC -#define __S011 PAGE_SHARED_NOEXEC -#define __S100 PAGE_READONLY_EXEC -#define __S101 PAGE_READONLY_EXEC -#define __S110 PAGE_SHARED_EXEC -#define __S111 PAGE_SHARED_EXEC - -/* - * Define this to warn about kernel memory accesses that are - * done without a 'verify_area(VERIFY_WRITE,..)' - */ -#undef TEST_VERIFY_AREA - -#define pte_present(x) (pte_val(x) & _PAGE_VALID) -#define pte_clear(mm, addr, xp) \ -do { \ - set_pte_at((mm), (addr), (xp), __pte(0)); \ -} while (0) - -#define pmd_none(x) (!pmd_val(x)) -#define pmd_present(x) (!pmd_none(x)) -#define pmd_clear(xp) do { set_pmd(xp, __pmd(0)); } while (0) -#define pmd_bad(x) 0 - - -#define pages_to_mb(x) ((x) >> (20 - PAGE_SHIFT)) - -#ifndef __ASSEMBLY__ - -/* - * The following only work if pte_present() is true. - * Undefined behaviour if not.. - */ -static inline int pte_user(pte_t pte) { return pte_val(pte) & __PAGE_PROT_USER; } -static inline int pte_read(pte_t pte) { return pte_val(pte) & __PAGE_PROT_USER; } -static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } -static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } -static inline int pte_write(pte_t pte) { return pte_val(pte) & __PAGE_PROT_WRITE; } -static inline int pte_special(pte_t pte){ return 0; } - -static inline pte_t pte_rdprotect(pte_t pte) -{ - pte_val(pte) &= ~(__PAGE_PROT_USER|__PAGE_PROT_UWAUX); return pte; -} -static inline pte_t pte_exprotect(pte_t pte) -{ - pte_val(pte) |= _PAGE_NX; return pte; -} - -static inline pte_t pte_wrprotect(pte_t pte) -{ - pte_val(pte) &= ~(__PAGE_PROT_WRITE|__PAGE_PROT_UWAUX); return pte; -} - -static inline pte_t pte_mkclean(pte_t pte) { pte_val(pte) &= ~_PAGE_DIRTY; return pte; } -static inline pte_t pte_mkold(pte_t pte) { pte_val(pte) &= ~_PAGE_ACCESSED; return pte; } -static inline pte_t pte_mkdirty(pte_t pte) { pte_val(pte) |= _PAGE_DIRTY; return pte; } -static inline pte_t pte_mkyoung(pte_t pte) { pte_val(pte) |= _PAGE_ACCESSED; return pte; } -static inline pte_t pte_mkexec(pte_t pte) { pte_val(pte) &= ~_PAGE_NX; return pte; } - -static inline pte_t pte_mkread(pte_t pte) -{ - pte_val(pte) |= __PAGE_PROT_USER; - if (pte_write(pte)) - pte_val(pte) |= __PAGE_PROT_UWAUX; - return pte; -} -static inline pte_t pte_mkwrite(pte_t pte) -{ - pte_val(pte) |= __PAGE_PROT_WRITE; - if (pte_val(pte) & __PAGE_PROT_USER) - pte_val(pte) |= __PAGE_PROT_UWAUX; - return pte; -} - -static inline pte_t pte_mkspecial(pte_t pte) { return pte; } - -#define pte_ERROR(e) \ - printk(KERN_ERR "%s:%d: bad pte %08lx.\n", \ - __FILE__, __LINE__, pte_val(e)) -#define pgd_ERROR(e) \ - printk(KERN_ERR "%s:%d: bad pgd %08lx.\n", \ - __FILE__, __LINE__, pgd_val(e)) - -/* - * The "pgd_xxx()" functions here are trivial for a folded two-level - * setup: the pgd is never bad, and a pmd always exists (as it's folded - * into the pgd entry) - */ -#define pgd_clear(xp) do { } while (0) - -/* - * Certain architectures need to do special things when PTEs - * within a page table are directly modified. Thus, the following - * hook is made available. - */ -#define set_pte(pteptr, pteval) (*(pteptr) = pteval) -#define set_pte_at(mm, addr, ptep, pteval) set_pte((ptep), (pteval)) -#define set_pte_atomic(pteptr, pteval) set_pte((pteptr), (pteval)) - -/* - * (pmds are folded into pgds so this doesn't get actually called, - * but the define is needed for a generic inline function.) - */ -#define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval) - -#define ptep_get_and_clear(mm, addr, ptep) \ - __pte(xchg(&(ptep)->pte, 0)) -#define pte_same(a, b) (pte_val(a) == pte_val(b)) -#define pte_page(x) pfn_to_page(pte_pfn(x)) -#define pte_none(x) (!pte_val(x)) -#define pte_pfn(x) ((unsigned long) (pte_val(x) >> PAGE_SHIFT)) -#define __pfn_addr(pfn) ((pfn) << PAGE_SHIFT) -#define pfn_pte(pfn, prot) __pte(__pfn_addr(pfn) | pgprot_val(prot)) -#define pfn_pmd(pfn, prot) __pmd(__pfn_addr(pfn) | pgprot_val(prot)) - -/* - * All present user pages are user-executable: - */ -static inline int pte_exec(pte_t pte) -{ - return pte_user(pte); -} - -/* - * All present pages are kernel-executable: - */ -static inline int pte_exec_kernel(pte_t pte) -{ - return 1; -} - -/* Encode and de-code a swap entry */ -#define __swp_type(x) (((x).val >> 1) & 0x3f) -#define __swp_offset(x) ((x).val >> 7) -#define __swp_entry(type, offset) \ - ((swp_entry_t) { ((type) << 1) | ((offset) << 7) }) -#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) -#define __swp_entry_to_pte(x) __pte((x).val) - -static inline -int ptep_test_and_clear_dirty(struct vm_area_struct *vma, unsigned long addr, - pte_t *ptep) -{ - if (!pte_dirty(*ptep)) - return 0; - return test_and_clear_bit(_PAGE_BIT_DIRTY, &ptep->pte); -} - -static inline -int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, - pte_t *ptep) -{ - if (!pte_young(*ptep)) - return 0; - return test_and_clear_bit(_PAGE_BIT_ACCESSED, &ptep->pte); -} - -static inline -void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep) -{ - pte_val(*ptep) &= ~(__PAGE_PROT_WRITE|__PAGE_PROT_UWAUX); -} - -static inline void ptep_mkdirty(pte_t *ptep) -{ - set_bit(_PAGE_BIT_DIRTY, &ptep->pte); -} - -/* - * Macro to mark a page protection value as "uncacheable". On processors which - * do not support it, this is a no-op. - */ -#define pgprot_noncached(prot) __pgprot(pgprot_val(prot) & ~_PAGE_CACHE) - -/* - * Macro to mark a page protection value as "Write-Through". - * On processors which do not support it, this is a no-op. - */ -#define pgprot_through(prot) __pgprot(pgprot_val(prot) | _PAGE_CACHE_WT) - -/* - * Conversion functions: convert a page and protection to a page entry, - * and a page entry and page directory to the page they refer to. - */ - -#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot)) -#define mk_pte_huge(entry) \ - ((entry).pte |= _PAGE_PRESENT | _PAGE_PSE | _PAGE_VALID) - -static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) -{ - pte_val(pte) &= _PAGE_CHG_MASK; - pte_val(pte) |= pgprot_val(newprot); - return pte; -} - -#define page_pte(page) page_pte_prot((page), __pgprot(0)) - -#define pmd_page_kernel(pmd) \ - ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) - -#define pmd_page(pmd) pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT) - -#define pmd_large(pmd) \ - ((pmd_val(pmd) & (_PAGE_PSE | _PAGE_PRESENT)) == \ - (_PAGE_PSE | _PAGE_PRESENT)) - -/* - * the pgd page can be thought of an array like this: pgd_t[PTRS_PER_PGD] - * - * this macro returns the index of the entry in the pgd page which would - * control the given virtual address - */ -#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1)) - -/* - * pgd_offset() returns a (pgd_t *) - * pgd_index() is used get the offset into the pgd page's array of pgd_t's; - */ -#define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address)) - -/* - * a shortcut which implies the use of the kernel's pgd, instead - * of a process's - */ -#define pgd_offset_k(address) pgd_offset(&init_mm, address) - -/* - * the pmd page can be thought of an array like this: pmd_t[PTRS_PER_PMD] - * - * this macro returns the index of the entry in the pmd page which would - * control the given virtual address - */ -#define pmd_index(address) \ - (((address) >> PMD_SHIFT) & (PTRS_PER_PMD - 1)) - -/* - * the pte page can be thought of an array like this: pte_t[PTRS_PER_PTE] - * - * this macro returns the index of the entry in the pte page which would - * control the given virtual address - */ -#define pte_index(address) \ - (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) - -#define pte_offset_kernel(dir, address) \ - ((pte_t *) pmd_page_kernel(*(dir)) + pte_index(address)) - -/* - * Make a given kernel text page executable/non-executable. - * Returns the previous executability setting of that page (which - * is used to restore the previous state). Used by the SMP bootup code. - * NOTE: this is an __init function for security reasons. - */ -static inline int set_kernel_exec(unsigned long vaddr, int enable) -{ - return 0; -} - -#define pte_offset_map(dir, address) \ - ((pte_t *) page_address(pmd_page(*(dir))) + pte_index(address)) -#define pte_unmap(pte) do {} while (0) - -/* - * The MN10300 has external MMU info in the form of a TLB: this is adapted from - * the kernel page tables containing the necessary information by tlb-mn10300.S - */ -extern void update_mmu_cache(struct vm_area_struct *vma, - unsigned long address, pte_t *ptep); - -#endif /* !__ASSEMBLY__ */ - -#define kern_addr_valid(addr) (1) - -#define MK_IOSPACE_PFN(space, pfn) (pfn) -#define GET_IOSPACE(pfn) 0 -#define GET_PFN(pfn) (pfn) - -#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG -#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_DIRTY -#define __HAVE_ARCH_PTEP_GET_AND_CLEAR -#define __HAVE_ARCH_PTEP_SET_WRPROTECT -#define __HAVE_ARCH_PTEP_MKDIRTY -#define __HAVE_ARCH_PTE_SAME -#include - -#endif /* !__ASSEMBLY__ */ - -#endif /* _ASM_PGTABLE_H */ diff --git a/arch/mn10300/include/asm/pio-regs.h b/arch/mn10300/include/asm/pio-regs.h deleted file mode 100644 index 96bc8182d0bad..0000000000000 --- a/arch/mn10300/include/asm/pio-regs.h +++ /dev/null @@ -1,233 +0,0 @@ -/* MN10300 On-board I/O port module registers - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_PIO_REGS_H -#define _ASM_PIO_REGS_H - -#include -#include - -#ifdef __KERNEL__ - -/* I/O port 0 */ -#define P0MD __SYSREG(0xdb000000, u16) /* mode reg */ -#define P0MD_0 0x0003 /* mask */ -#define P0MD_0_IN 0x0000 /* input mode */ -#define P0MD_0_OUT 0x0001 /* output mode */ -#define P0MD_0_TM0IO 0x0002 /* timer 0 I/O mode */ -#define P0MD_0_EYECLK 0x0003 /* test signal output (clock) */ -#define P0MD_1 0x000c -#define P0MD_1_IN 0x0000 -#define P0MD_1_OUT 0x0004 -#define P0MD_1_TM1IO 0x0008 /* timer 1 I/O mode */ -#define P0MD_1_EYED 0x000c /* test signal output (data) */ -#define P0MD_2 0x0030 -#define P0MD_2_IN 0x0000 -#define P0MD_2_OUT 0x0010 -#define P0MD_2_TM2IO 0x0020 /* timer 2 I/O mode */ -#define P0MD_3 0x00c0 -#define P0MD_3_IN 0x0000 -#define P0MD_3_OUT 0x0040 -#define P0MD_3_TM3IO 0x0080 /* timer 3 I/O mode */ -#define P0MD_4 0x0300 -#define P0MD_4_IN 0x0000 -#define P0MD_4_OUT 0x0100 -#define P0MD_4_TM4IO 0x0200 /* timer 4 I/O mode */ -#define P0MD_4_XCTS 0x0300 /* XCTS input for serial port 2 */ -#define P0MD_5 0x0c00 -#define P0MD_5_IN 0x0000 -#define P0MD_5_OUT 0x0400 -#define P0MD_5_TM5IO 0x0800 /* timer 5 I/O mode */ -#define P0MD_6 0x3000 -#define P0MD_6_IN 0x0000 -#define P0MD_6_OUT 0x1000 -#define P0MD_6_TM6IOA 0x2000 /* timer 6 I/O mode A */ -#define P0MD_7 0xc000 -#define P0MD_7_IN 0x0000 -#define P0MD_7_OUT 0x4000 -#define P0MD_7_TM6IOB 0x8000 /* timer 6 I/O mode B */ - -#define P0IN __SYSREG(0xdb000004, u8) /* in reg */ -#define P0OUT __SYSREG(0xdb000008, u8) /* out reg */ - -#define P0TMIO __SYSREG(0xdb00000c, u8) /* TM pin I/O control reg */ -#define P0TMIO_TM0_IN 0x00 -#define P0TMIO_TM0_OUT 0x01 -#define P0TMIO_TM1_IN 0x00 -#define P0TMIO_TM1_OUT 0x02 -#define P0TMIO_TM2_IN 0x00 -#define P0TMIO_TM2_OUT 0x04 -#define P0TMIO_TM3_IN 0x00 -#define P0TMIO_TM3_OUT 0x08 -#define P0TMIO_TM4_IN 0x00 -#define P0TMIO_TM4_OUT 0x10 -#define P0TMIO_TM5_IN 0x00 -#define P0TMIO_TM5_OUT 0x20 -#define P0TMIO_TM6A_IN 0x00 -#define P0TMIO_TM6A_OUT 0x40 -#define P0TMIO_TM6B_IN 0x00 -#define P0TMIO_TM6B_OUT 0x80 - -/* I/O port 1 */ -#define P1MD __SYSREG(0xdb000100, u16) /* mode reg */ -#define P1MD_0 0x0003 /* mask */ -#define P1MD_0_IN 0x0000 /* input mode */ -#define P1MD_0_OUT 0x0001 /* output mode */ -#define P1MD_0_TM7IO 0x0002 /* timer 7 I/O mode */ -#define P1MD_0_ADTRG 0x0003 /* A/D converter trigger mode */ -#define P1MD_1 0x000c -#define P1MD_1_IN 0x0000 -#define P1MD_1_OUT 0x0004 -#define P1MD_1_TM8IO 0x0008 /* timer 8 I/O mode */ -#define P1MD_1_XDMR0 0x000c /* DMA request input 0 mode */ -#define P1MD_2 0x0030 -#define P1MD_2_IN 0x0000 -#define P1MD_2_OUT 0x0010 -#define P1MD_2_TM9IO 0x0020 /* timer 9 I/O mode */ -#define P1MD_2_XDMR1 0x0030 /* DMA request input 1 mode */ -#define P1MD_3 0x00c0 -#define P1MD_3_IN 0x0000 -#define P1MD_3_OUT 0x0040 -#define P1MD_3_TM10IO 0x0080 /* timer 10 I/O mode */ -#define P1MD_3_FRQS0 0x00c0 /* CPU clock multiplier setting input 0 mode */ -#define P1MD_4 0x0300 -#define P1MD_4_IN 0x0000 -#define P1MD_4_OUT 0x0100 -#define P1MD_4_TM11IO 0x0200 /* timer 11 I/O mode */ -#define P1MD_4_FRQS1 0x0300 /* CPU clock multiplier setting input 1 mode */ - -#define P1IN __SYSREG(0xdb000104, u8) /* in reg */ -#define P1OUT __SYSREG(0xdb000108, u8) /* out reg */ -#define P1TMIO __SYSREG(0xdb00010c, u8) /* TM pin I/O control reg */ -#define P1TMIO_TM11_IN 0x00 -#define P1TMIO_TM11_OUT 0x01 -#define P1TMIO_TM10_IN 0x00 -#define P1TMIO_TM10_OUT 0x02 -#define P1TMIO_TM9_IN 0x00 -#define P1TMIO_TM9_OUT 0x04 -#define P1TMIO_TM8_IN 0x00 -#define P1TMIO_TM8_OUT 0x08 -#define P1TMIO_TM7_IN 0x00 -#define P1TMIO_TM7_OUT 0x10 - -/* I/O port 2 */ -#define P2MD __SYSREG(0xdb000200, u16) /* mode reg */ -#define P2MD_0 0x0003 /* mask */ -#define P2MD_0_IN 0x0000 /* input mode */ -#define P2MD_0_OUT 0x0001 /* output mode */ -#define P2MD_0_BOOTBW 0x0003 /* boot bus width selector mode */ -#define P2MD_1 0x000c -#define P2MD_1_IN 0x0000 -#define P2MD_1_OUT 0x0004 -#define P2MD_1_BOOTSEL 0x000c /* boot device selector mode */ -#define P2MD_2 0x0030 -#define P2MD_2_IN 0x0000 -#define P2MD_2_OUT 0x0010 -#define P2MD_3 0x00c0 -#define P2MD_3_IN 0x0000 -#define P2MD_3_OUT 0x0040 -#define P2MD_3_CKIO 0x00c0 /* mode */ -#define P2MD_4 0x0300 -#define P2MD_4_IN 0x0000 -#define P2MD_4_OUT 0x0100 -#define P2MD_4_CMOD 0x0300 /* mode */ - -#define P2IN __SYSREG(0xdb000204, u8) /* in reg */ -#define P2OUT __SYSREG(0xdb000208, u8) /* out reg */ -#define P2TMIO __SYSREG(0xdb00020c, u8) /* TM pin I/O control reg */ - -/* I/O port 3 */ -#define P3MD __SYSREG(0xdb000300, u16) /* mode reg */ -#define P3MD_0 0x0003 /* mask */ -#define P3MD_0_IN 0x0000 /* input mode */ -#define P3MD_0_OUT 0x0001 /* output mode */ -#define P3MD_0_AFRXD 0x0002 /* AFR interface mode */ -#define P3MD_1 0x000c -#define P3MD_1_IN 0x0000 -#define P3MD_1_OUT 0x0004 -#define P3MD_1_AFTXD 0x0008 /* AFR interface mode */ -#define P3MD_2 0x0030 -#define P3MD_2_IN 0x0000 -#define P3MD_2_OUT 0x0010 -#define P3MD_2_AFSCLK 0x0020 /* AFR interface mode */ -#define P3MD_3 0x00c0 -#define P3MD_3_IN 0x0000 -#define P3MD_3_OUT 0x0040 -#define P3MD_3_AFFS 0x0080 /* AFR interface mode */ -#define P3MD_4 0x0300 -#define P3MD_4_IN 0x0000 -#define P3MD_4_OUT 0x0100 -#define P3MD_4_AFEHC 0x0200 /* AFR interface mode */ - -#define P3IN __SYSREG(0xdb000304, u8) /* in reg */ -#define P3OUT __SYSREG(0xdb000308, u8) /* out reg */ - -/* I/O port 4 */ -#define P4MD __SYSREG(0xdb000400, u16) /* mode reg */ -#define P4MD_0 0x0003 /* mask */ -#define P4MD_0_IN 0x0000 /* input mode */ -#define P4MD_0_OUT 0x0001 /* output mode */ -#define P4MD_0_SCL0 0x0002 /* I2C/serial mode */ -#define P4MD_1 0x000c -#define P4MD_1_IN 0x0000 -#define P4MD_1_OUT 0x0004 -#define P4MD_1_SDA0 0x0008 -#define P4MD_2 0x0030 -#define P4MD_2_IN 0x0000 -#define P4MD_2_OUT 0x0010 -#define P4MD_2_SCL1 0x0020 -#define P4MD_3 0x00c0 -#define P4MD_3_IN 0x0000 -#define P4MD_3_OUT 0x0040 -#define P4MD_3_SDA1 0x0080 -#define P4MD_4 0x0300 -#define P4MD_4_IN 0x0000 -#define P4MD_4_OUT 0x0100 -#define P4MD_4_SBO0 0x0200 -#define P4MD_5 0x0c00 -#define P4MD_5_IN 0x0000 -#define P4MD_5_OUT 0x0400 -#define P4MD_5_SBO1 0x0800 -#define P4MD_6 0x3000 -#define P4MD_6_IN 0x0000 -#define P4MD_6_OUT 0x1000 -#define P4MD_6_SBT0 0x2000 -#define P4MD_7 0xc000 -#define P4MD_7_IN 0x0000 -#define P4MD_7_OUT 0x4000 -#define P4MD_7_SBT1 0x8000 - -#define P4IN __SYSREG(0xdb000404, u8) /* in reg */ -#define P4OUT __SYSREG(0xdb000408, u8) /* out reg */ - -/* I/O port 5 */ -#define P5MD __SYSREG(0xdb000500, u16) /* mode reg */ -#define P5MD_0 0x0003 /* mask */ -#define P5MD_0_IN 0x0000 /* input mode */ -#define P5MD_0_OUT 0x0001 /* output mode */ -#define P5MD_0_IRTXD 0x0002 /* IrDA mode */ -#define P5MD_0_SOUT 0x0004 /* serial mode */ -#define P5MD_1 0x000c -#define P5MD_1_IN 0x0000 -#define P5MD_1_OUT 0x0004 -#define P5MD_1_IRRXDS 0x0008 /* IrDA mode */ -#define P5MD_1_SIN 0x000c /* serial mode */ -#define P5MD_2 0x0030 -#define P5MD_2_IN 0x0000 -#define P5MD_2_OUT 0x0010 -#define P5MD_2_IRRXDF 0x0020 /* IrDA mode */ - -#define P5IN __SYSREG(0xdb000504, u8) /* in reg */ -#define P5OUT __SYSREG(0xdb000508, u8) /* out reg */ - - -#endif /* __KERNEL__ */ - -#endif /* _ASM_PIO_REGS_H */ diff --git a/arch/mn10300/include/asm/processor.h b/arch/mn10300/include/asm/processor.h deleted file mode 100644 index 3ae479117b42e..0000000000000 --- a/arch/mn10300/include/asm/processor.h +++ /dev/null @@ -1,171 +0,0 @@ -/* MN10300 Processor specifics - * - * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd. - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - -#ifndef _ASM_PROCESSOR_H -#define _ASM_PROCESSOR_H - -#include -#include -#include -#include -#include -#include - -/* Forward declaration, a strange C thing */ -struct task_struct; -struct mm_struct; - -/* - * Default implementation of macro that returns current - * instruction pointer ("program counter"). - */ -#define current_text_addr() \ -({ \ - void *__pc; \ - asm("mov pc,%0" : "=a"(__pc)); \ - __pc; \ -}) - -extern void get_mem_info(unsigned long *mem_base, unsigned long *mem_size); - -extern void show_registers(struct pt_regs *regs); - -/* - * CPU type and hardware bug flags. Kept separately for each CPU. - * Members of this structure are referenced in head.S, so think twice - * before touching them. [mj] - */ - -struct mn10300_cpuinfo { - int type; - unsigned long loops_per_jiffy; - char hard_math; -}; - -extern struct mn10300_cpuinfo boot_cpu_data; - -#ifdef CONFIG_SMP -#if CONFIG_NR_CPUS < 2 || CONFIG_NR_CPUS > 8 -# error Sorry, NR_CPUS should be 2 to 8 -#endif -extern struct mn10300_cpuinfo cpu_data[]; -#define current_cpu_data cpu_data[smp_processor_id()] -#else /* CONFIG_SMP */ -#define cpu_data &boot_cpu_data -#define current_cpu_data boot_cpu_data -#endif /* CONFIG_SMP */ - -extern void identify_cpu(struct mn10300_cpuinfo *); -extern void print_cpu_info(struct mn10300_cpuinfo *); -extern void dodgy_tsc(void); - -#define cpu_relax() barrier() - -/* - * User space process size: 1.75GB (default). - */ -#define TASK_SIZE 0x70000000 - -/* - * Where to put the userspace stack by default - */ -#define STACK_TOP 0x70000000 -#define STACK_TOP_MAX STACK_TOP - -/* This decides where the kernel will search for a free chunk of vm - * space during mmap's. - */ -#define TASK_UNMAPPED_BASE 0x30000000 - -struct fpu_state_struct { - unsigned long fs[32]; /* fpu registers */ - unsigned long fpcr; /* fpu control register */ -}; - -struct thread_struct { - struct pt_regs *uregs; /* userspace register frame */ - unsigned long pc; /* kernel PC */ - unsigned long sp; /* kernel SP */ - unsigned long a3; /* kernel FP */ - unsigned long wchan; - unsigned long usp; - unsigned long fpu_flags; -#define THREAD_USING_FPU 0x00000001 /* T if this task is using the FPU */ -#define THREAD_HAS_FPU 0x00000002 /* T if this task owns the FPU right now */ - struct fpu_state_struct fpu_state; -}; - -#define INIT_THREAD \ -{ \ - .uregs = init_uregs, \ - .pc = 0, \ - .sp = 0, \ - .a3 = 0, \ - .wchan = 0, \ -} - -#define INIT_MMAP \ -{ &init_mm, 0, 0, NULL, PAGE_SHARED, VM_READ | VM_WRITE | VM_EXEC, 1, \ - NULL, NULL } - -/* - * do necessary setup to start up a newly executed thread - */ -static inline void start_thread(struct pt_regs *regs, - unsigned long new_pc, unsigned long new_sp) -{ - regs->epsw = EPSW_nSL | EPSW_IE | EPSW_IM; - regs->pc = new_pc; - regs->sp = new_sp; -} - - -/* Free all resources held by a thread. */ -extern void release_thread(struct task_struct *); - -unsigned long get_wchan(struct task_struct *p); - -#define task_pt_regs(task) ((task)->thread.uregs) -#define KSTK_EIP(task) (task_pt_regs(task)->pc) -#define KSTK_ESP(task) (task_pt_regs(task)->sp) - -#define KSTK_TOP(info) \ -({ \ - (unsigned long)(info) + THREAD_SIZE; \ -}) - -#define ARCH_HAS_PREFETCH -#define ARCH_HAS_PREFETCHW - -static inline void prefetch(const void *x) -{ -#ifdef CONFIG_MN10300_CACHE_ENABLED -#ifdef CONFIG_MN10300_PROC_MN103E010 - asm volatile ("nop; nop; dcpf (%0)" : : "r"(x)); -#else - asm volatile ("dcpf (%0)" : : "r"(x)); -#endif -#endif -} - -static inline void prefetchw(const void *x) -{ -#ifdef CONFIG_MN10300_CACHE_ENABLED -#ifdef CONFIG_MN10300_PROC_MN103E010 - asm volatile ("nop; nop; dcpf (%0)" : : "r"(x)); -#else - asm volatile ("dcpf (%0)" : : "r"(x)); -#endif -#endif -} - -#endif /* _ASM_PROCESSOR_H */ diff --git a/arch/mn10300/include/asm/ptrace.h b/arch/mn10300/include/asm/ptrace.h deleted file mode 100644 index 838a3830010ef..0000000000000 --- a/arch/mn10300/include/asm/ptrace.h +++ /dev/null @@ -1,26 +0,0 @@ -/* MN10300 Exception frame layout and ptrace constants - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_PTRACE_H -#define _ASM_PTRACE_H - -#include - - -#define user_mode(regs) (((regs)->epsw & EPSW_nSL) == EPSW_nSL) -#define instruction_pointer(regs) ((regs)->pc) -#define user_stack_pointer(regs) ((regs)->sp) -#define current_pt_regs() current_frame() - -#define arch_has_single_step() (1) - -#define profile_pc(regs) ((regs)->pc) - -#endif /* _ASM_PTRACE_H */ diff --git a/arch/mn10300/include/asm/reset-regs.h b/arch/mn10300/include/asm/reset-regs.h deleted file mode 100644 index 8ca2a42d365b4..0000000000000 --- a/arch/mn10300/include/asm/reset-regs.h +++ /dev/null @@ -1,60 +0,0 @@ -/* MN10300 Reset controller and watchdog timer definitions - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - -#ifndef _ASM_RESET_REGS_H -#define _ASM_RESET_REGS_H - -#include -#include - -#ifdef __KERNEL__ - -/* - * watchdog timer registers - */ -#define WDBC __SYSREGC(0xc0001000, u8) /* watchdog binary counter reg */ - -#define WDCTR __SYSREG(0xc0001002, u8) /* watchdog timer control reg */ -#define WDCTR_WDCK 0x07 /* clock source selection */ -#define WDCTR_WDCK_256th 0x00 /* - OSCI/256 */ -#define WDCTR_WDCK_1024th 0x01 /* - OSCI/1024 */ -#define WDCTR_WDCK_2048th 0x02 /* - OSCI/2048 */ -#define WDCTR_WDCK_16384th 0x03 /* - OSCI/16384 */ -#define WDCTR_WDCK_65536th 0x04 /* - OSCI/65536 */ -#define WDCTR_WDRST 0x40 /* binary counter reset */ -#define WDCTR_WDCNE 0x80 /* watchdog timer enable */ - -#define RSTCTR __SYSREG(0xc0001004, u8) /* reset control reg */ -#define RSTCTR_CHIPRST 0x01 /* chip reset */ -#define RSTCTR_DBFRST 0x02 /* double fault reset flag */ -#define RSTCTR_WDTRST 0x04 /* watchdog timer reset flag */ -#define RSTCTR_WDREN 0x08 /* watchdog timer reset enable */ - -#ifndef __ASSEMBLY__ - -static inline void mn10300_proc_hard_reset(void) -{ - RSTCTR &= ~RSTCTR_CHIPRST; - RSTCTR |= RSTCTR_CHIPRST; -} - -extern unsigned int watchdog_alert_counter[]; - -extern void watchdog_go(void); -extern asmlinkage void watchdog_handler(void); -extern asmlinkage -void watchdog_interrupt(struct pt_regs *, enum exception_code); - -#endif - -#endif /* __KERNEL__ */ - -#endif /* _ASM_RESET_REGS_H */ diff --git a/arch/mn10300/include/asm/rtc-regs.h b/arch/mn10300/include/asm/rtc-regs.h deleted file mode 100644 index c81cacecb6e38..0000000000000 --- a/arch/mn10300/include/asm/rtc-regs.h +++ /dev/null @@ -1,86 +0,0 @@ -/* MN10300 on-chip Real-Time Clock registers - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_RTC_REGS_H -#define _ASM_RTC_REGS_H - -#include - -#ifdef __KERNEL__ - -#define RTSCR __SYSREG(0xd8600000, u8) /* RTC seconds count reg */ -#define RTSAR __SYSREG(0xd8600001, u8) /* RTC seconds alarm reg */ -#define RTMCR __SYSREG(0xd8600002, u8) /* RTC minutes count reg */ -#define RTMAR __SYSREG(0xd8600003, u8) /* RTC minutes alarm reg */ -#define RTHCR __SYSREG(0xd8600004, u8) /* RTC hours count reg */ -#define RTHAR __SYSREG(0xd8600005, u8) /* RTC hours alarm reg */ -#define RTDWCR __SYSREG(0xd8600006, u8) /* RTC day of the week count reg */ -#define RTDMCR __SYSREG(0xd8600007, u8) /* RTC days count reg */ -#define RTMTCR __SYSREG(0xd8600008, u8) /* RTC months count reg */ -#define RTYCR __SYSREG(0xd8600009, u8) /* RTC years count reg */ - -#define RTCRA __SYSREG(0xd860000a, u8)/* RTC control reg A */ -#define RTCRA_RS 0x0f /* periodic timer interrupt cycle setting */ -#define RTCRA_RS_NONE 0x00 /* - off */ -#define RTCRA_RS_3_90625ms 0x01 /* - 3.90625ms (1/256s) */ -#define RTCRA_RS_7_8125ms 0x02 /* - 7.8125ms (1/128s) */ -#define RTCRA_RS_122_070us 0x03 /* - 122.070us (1/8192s) */ -#define RTCRA_RS_244_141us 0x04 /* - 244.141us (1/4096s) */ -#define RTCRA_RS_488_281us 0x05 /* - 488.281us (1/2048s) */ -#define RTCRA_RS_976_5625us 0x06 /* - 976.5625us (1/1024s) */ -#define RTCRA_RS_1_953125ms 0x07 /* - 1.953125ms (1/512s) */ -#define RTCRA_RS_3_90624ms 0x08 /* - 3.90624ms (1/256s) */ -#define RTCRA_RS_7_8125ms_b 0x09 /* - 7.8125ms (1/128s) */ -#define RTCRA_RS_15_625ms 0x0a /* - 15.625ms (1/64s) */ -#define RTCRA_RS_31_25ms 0x0b /* - 31.25ms (1/32s) */ -#define RTCRA_RS_62_5ms 0x0c /* - 62.5ms (1/16s) */ -#define RTCRA_RS_125ms 0x0d /* - 125ms (1/8s) */ -#define RTCRA_RS_250ms 0x0e /* - 250ms (1/4s) */ -#define RTCRA_RS_500ms 0x0f /* - 500ms (1/2s) */ -#define RTCRA_DVR 0x40 /* divider reset */ -#define RTCRA_UIP 0x80 /* clock update flag */ - -#define RTCRB __SYSREG(0xd860000b, u8) /* RTC control reg B */ -#define RTCRB_DSE 0x01 /* daylight savings time enable */ -#define RTCRB_TM 0x02 /* time format */ -#define RTCRB_TM_12HR 0x00 /* - 12 hour format */ -#define RTCRB_TM_24HR 0x02 /* - 24 hour format */ -#define RTCRB_DM 0x04 /* numeric value format */ -#define RTCRB_DM_BCD 0x00 /* - BCD */ -#define RTCRB_DM_BINARY 0x04 /* - binary */ -#define RTCRB_UIE 0x10 /* update interrupt disable */ -#define RTCRB_AIE 0x20 /* alarm interrupt disable */ -#define RTCRB_PIE 0x40 /* periodic interrupt disable */ -#define RTCRB_SET 0x80 /* clock update enable */ - -#define RTSRC __SYSREG(0xd860000c, u8) /* RTC status reg C */ -#define RTSRC_UF 0x10 /* update end interrupt flag */ -#define RTSRC_AF 0x20 /* alarm interrupt flag */ -#define RTSRC_PF 0x40 /* periodic interrupt flag */ -#define RTSRC_IRQF 0x80 /* interrupt flag */ - -#define RTIRQ 32 -#define RTICR GxICR(RTIRQ) - -/* - * MC146818 RTC compatibility defs for the MN10300 on-chip RTC - */ -#define RTC_PORT(x) 0xd8600000 -#define RTC_ALWAYS_BCD 1 /* RTC operates in binary mode */ - -#define CMOS_READ(addr) __SYSREG(0xd8600000 + (u32)(addr), u8) -#define CMOS_WRITE(val, addr) \ - do { __SYSREG(0xd8600000 + (u32)(addr), u8) = val; } while (0) - -#define RTC_IRQ RTIRQ - -#endif /* __KERNEL__ */ - -#endif /* _ASM_RTC_REGS_H */ diff --git a/arch/mn10300/include/asm/rtc.h b/arch/mn10300/include/asm/rtc.h deleted file mode 100644 index 07dc876561979..0000000000000 --- a/arch/mn10300/include/asm/rtc.h +++ /dev/null @@ -1,28 +0,0 @@ -/* MN10300 Real time clock definitions - * - * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd. - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_RTC_H -#define _ASM_RTC_H - -#ifdef CONFIG_MN10300_RTC - -#include - -extern void __init calibrate_clock(void); - -#else /* !CONFIG_MN10300_RTC */ - -static inline void calibrate_clock(void) -{ -} - -#endif /* !CONFIG_MN10300_RTC */ - -#endif /* _ASM_RTC_H */ diff --git a/arch/mn10300/include/asm/rwlock.h b/arch/mn10300/include/asm/rwlock.h deleted file mode 100644 index 6d594d4a0e10c..0000000000000 --- a/arch/mn10300/include/asm/rwlock.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Helpers used by both rw spinlocks and rw semaphores. - * - * Based in part on code from semaphore.h and - * spinlock.h Copyright 1996 Linus Torvalds. - * - * Copyright 1999 Red Hat, Inc. - * - * Written by Benjamin LaHaise. - * - * Modified by Matsushita Electric Industrial Co., Ltd. - * Modifications: - * 13-Nov-2006 MEI Temporarily delete lock functions for SMP support. - * - * 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_RWLOCK_H -#define _ASM_RWLOCK_H - -#define RW_LOCK_BIAS 0x01000000 - -#ifndef CONFIG_SMP - -typedef struct { unsigned long a[100]; } __dummy_lock_t; -#define __dummy_lock(lock) (*(__dummy_lock_t *)(lock)) - -#define RW_LOCK_BIAS_STR "0x01000000" - -#define __build_read_lock_ptr(rw, helper) \ - do { \ - asm volatile( \ - " mov (%0),d3 \n" \ - " sub 1,d3 \n" \ - " mov d3,(%0) \n" \ - " blt 1f \n" \ - " bra 2f \n" \ - "1: jmp 3f \n" \ - "2: \n" \ - " .section .text.lock,\"ax\" \n" \ - "3: call "helper"[],0 \n" \ - " jmp 2b \n" \ - " .previous" \ - : \ - : "d" (rw) \ - : "memory", "d3", "cc"); \ - } while (0) - -#define __build_read_lock_const(rw, helper) \ - do { \ - asm volatile( \ - " mov (%0),d3 \n" \ - " sub 1,d3 \n" \ - " mov d3,(%0) \n" \ - " blt 1f \n" \ - " bra 2f \n" \ - "1: jmp 3f \n" \ - "2: \n" \ - " .section .text.lock,\"ax\" \n" \ - "3: call "helper"[],0 \n" \ - " jmp 2b \n" \ - " .previous" \ - : \ - : "d" (rw) \ - : "memory", "d3", "cc"); \ - } while (0) - -#define __build_read_lock(rw, helper) \ - do { \ - if (__builtin_constant_p(rw)) \ - __build_read_lock_const(rw, helper); \ - else \ - __build_read_lock_ptr(rw, helper); \ - } while (0) - -#define __build_write_lock_ptr(rw, helper) \ - do { \ - asm volatile( \ - " mov (%0),d3 \n" \ - " sub 1,d3 \n" \ - " mov d3,(%0) \n" \ - " blt 1f \n" \ - " bra 2f \n" \ - "1: jmp 3f \n" \ - "2: \n" \ - " .section .text.lock,\"ax\" \n" \ - "3: call "helper"[],0 \n" \ - " jmp 2b \n" \ - " .previous" \ - : \ - : "d" (rw) \ - : "memory", "d3", "cc"); \ - } while (0) - -#define __build_write_lock_const(rw, helper) \ - do { \ - asm volatile( \ - " mov (%0),d3 \n" \ - " sub 1,d3 \n" \ - " mov d3,(%0) \n" \ - " blt 1f \n" \ - " bra 2f \n" \ - "1: jmp 3f \n" \ - "2: \n" \ - " .section .text.lock,\"ax\" \n" \ - "3: call "helper"[],0 \n" \ - " jmp 2b \n" \ - " .previous" \ - : \ - : "d" (rw) \ - : "memory", "d3", "cc"); \ - } while (0) - -#define __build_write_lock(rw, helper) \ - do { \ - if (__builtin_constant_p(rw)) \ - __build_write_lock_const(rw, helper); \ - else \ - __build_write_lock_ptr(rw, helper); \ - } while (0) - -#endif /* CONFIG_SMP */ -#endif /* _ASM_RWLOCK_H */ diff --git a/arch/mn10300/include/asm/serial-regs.h b/arch/mn10300/include/asm/serial-regs.h deleted file mode 100644 index 8320cda32f5aa..0000000000000 --- a/arch/mn10300/include/asm/serial-regs.h +++ /dev/null @@ -1,191 +0,0 @@ -/* MN10300 on-board serial port module registers - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - -#ifndef _ASM_SERIAL_REGS_H -#define _ASM_SERIAL_REGS_H - -#include -#include - -#ifdef __KERNEL__ - -/* serial port 0 */ -#define SC0CTR __SYSREG(0xd4002000, u16) /* control reg */ -#define SC01CTR_CK 0x0007 /* clock source select */ -#define SC01CTR_CK_IOCLK_8 0x0001 /* - 1/8 IOCLK */ -#define SC01CTR_CK_IOCLK_32 0x0002 /* - 1/32 IOCLK */ -#define SC01CTR_CK_EXTERN_8 0x0006 /* - 1/8 external closk */ -#define SC01CTR_CK_EXTERN 0x0007 /* - external closk */ -#if defined(CONFIG_AM33_2) || defined(CONFIG_AM33_3) -#define SC0CTR_CK_TM8UFLOW_8 0x0000 /* - 1/8 timer 8 underflow (serial port 0 only) */ -#define SC0CTR_CK_TM2UFLOW_2 0x0003 /* - 1/2 timer 2 underflow (serial port 0 only) */ -#define SC0CTR_CK_TM0UFLOW_8 0x0004 /* - 1/8 timer 0 underflow (serial port 0 only) */ -#define SC0CTR_CK_TM2UFLOW_8 0x0005 /* - 1/8 timer 2 underflow (serial port 0 only) */ -#define SC1CTR_CK_TM9UFLOW_8 0x0000 /* - 1/8 timer 9 underflow (serial port 1 only) */ -#define SC1CTR_CK_TM3UFLOW_2 0x0003 /* - 1/2 timer 3 underflow (serial port 1 only) */ -#define SC1CTR_CK_TM1UFLOW_8 0x0004 /* - 1/8 timer 1 underflow (serial port 1 only) */ -#define SC1CTR_CK_TM3UFLOW_8 0x0005 /* - 1/8 timer 3 underflow (serial port 1 only) */ -#else /* CONFIG_AM33_2 || CONFIG_AM33_3 */ -#define SC0CTR_CK_TM8UFLOW_8 0x0000 /* - 1/8 timer 8 underflow (serial port 0 only) */ -#define SC0CTR_CK_TM0UFLOW_8 0x0004 /* - 1/8 timer 0 underflow (serial port 0 only) */ -#define SC0CTR_CK_TM2UFLOW_8 0x0005 /* - 1/8 timer 2 underflow (serial port 0 only) */ -#define SC1CTR_CK_TM12UFLOW_8 0x0000 /* - 1/8 timer 12 underflow (serial port 1 only) */ -#endif /* CONFIG_AM33_2 || CONFIG_AM33_3 */ -#define SC01CTR_STB 0x0008 /* stop bit select */ -#define SC01CTR_STB_1BIT 0x0000 /* - 1 stop bit */ -#define SC01CTR_STB_2BIT 0x0008 /* - 2 stop bits */ -#define SC01CTR_PB 0x0070 /* parity bit select */ -#define SC01CTR_PB_NONE 0x0000 /* - no parity */ -#define SC01CTR_PB_FIXED0 0x0040 /* - fixed at 0 */ -#define SC01CTR_PB_FIXED1 0x0050 /* - fixed at 1 */ -#define SC01CTR_PB_EVEN 0x0060 /* - even parity */ -#define SC01CTR_PB_ODD 0x0070 /* - odd parity */ -#define SC01CTR_CLN 0x0080 /* character length */ -#define SC01CTR_CLN_7BIT 0x0000 /* - 7 bit chars */ -#define SC01CTR_CLN_8BIT 0x0080 /* - 8 bit chars */ -#define SC01CTR_TOE 0x0100 /* T input output enable */ -#define SC01CTR_OD 0x0200 /* bit order select */ -#define SC01CTR_OD_LSBFIRST 0x0000 /* - LSB first */ -#define SC01CTR_OD_MSBFIRST 0x0200 /* - MSB first */ -#define SC01CTR_MD 0x0c00 /* mode select */ -#define SC01CTR_MD_STST_SYNC 0x0000 /* - start-stop synchronous */ -#define SC01CTR_MD_CLOCK_SYNC1 0x0400 /* - clock synchronous 1 */ -#define SC01CTR_MD_I2C 0x0800 /* - I2C mode */ -#define SC01CTR_MD_CLOCK_SYNC2 0x0c00 /* - clock synchronous 2 */ -#define SC01CTR_IIC 0x1000 /* I2C mode select */ -#define SC01CTR_BKE 0x2000 /* break transmit enable */ -#define SC01CTR_RXE 0x4000 /* receive enable */ -#define SC01CTR_TXE 0x8000 /* transmit enable */ - -#define SC0ICR __SYSREG(0xd4002004, u8) /* interrupt control reg */ -#define SC01ICR_DMD 0x80 /* output data mode */ -#define SC01ICR_TD 0x20 /* transmit DMA trigger cause */ -#define SC01ICR_TI 0x10 /* transmit interrupt cause */ -#define SC01ICR_RES 0x04 /* receive error select */ -#define SC01ICR_RI 0x01 /* receive interrupt cause */ - -#define SC0TXB __SYSREG(0xd4002008, u8) /* transmit buffer reg */ -#define SC0RXB __SYSREG(0xd4002009, u8) /* receive buffer reg */ - -#define SC0STR __SYSREG(0xd400200c, u16) /* status reg */ -#define SC01STR_OEF 0x0001 /* overrun error found */ -#define SC01STR_PEF 0x0002 /* parity error found */ -#define SC01STR_FEF 0x0004 /* framing error found */ -#define SC01STR_RBF 0x0010 /* receive buffer status */ -#define SC01STR_TBF 0x0020 /* transmit buffer status */ -#define SC01STR_RXF 0x0040 /* receive status */ -#define SC01STR_TXF 0x0080 /* transmit status */ -#define SC01STR_STF 0x0100 /* I2C start sequence found */ -#define SC01STR_SPF 0x0200 /* I2C stop sequence found */ - -#define SC0RXIRQ 20 /* timer 0 Receive IRQ */ -#define SC0TXIRQ 21 /* timer 0 Transmit IRQ */ - -#define SC0RXICR GxICR(SC0RXIRQ) /* serial 0 receive intr ctrl reg */ -#define SC0TXICR GxICR(SC0TXIRQ) /* serial 0 transmit intr ctrl reg */ - -/* serial port 1 */ -#define SC1CTR __SYSREG(0xd4002010, u16) /* serial port 1 control */ -#define SC1ICR __SYSREG(0xd4002014, u8) /* interrupt control reg */ -#define SC1TXB __SYSREG(0xd4002018, u8) /* transmit buffer reg */ -#define SC1RXB __SYSREG(0xd4002019, u8) /* receive buffer reg */ -#define SC1STR __SYSREG(0xd400201c, u16) /* status reg */ - -#define SC1RXIRQ 22 /* timer 1 Receive IRQ */ -#define SC1TXIRQ 23 /* timer 1 Transmit IRQ */ - -#define SC1RXICR GxICR(SC1RXIRQ) /* serial 1 receive intr ctrl reg */ -#define SC1TXICR GxICR(SC1TXIRQ) /* serial 1 transmit intr ctrl reg */ - -/* serial port 2 */ -#define SC2CTR __SYSREG(0xd4002020, u16) /* control reg */ -#ifdef CONFIG_AM33_2 -#define SC2CTR_CK 0x0003 /* clock source select */ -#define SC2CTR_CK_TM10UFLOW 0x0000 /* - timer 10 underflow */ -#define SC2CTR_CK_TM2UFLOW 0x0001 /* - timer 2 underflow */ -#define SC2CTR_CK_EXTERN 0x0002 /* - external closk */ -#define SC2CTR_CK_TM3UFLOW 0x0003 /* - timer 3 underflow */ -#else /* CONFIG_AM33_2 */ -#define SC2CTR_CK 0x0007 /* clock source select */ -#define SC2CTR_CK_TM9UFLOW_8 0x0000 /* - 1/8 timer 9 underflow */ -#define SC2CTR_CK_IOCLK_8 0x0001 /* - 1/8 IOCLK */ -#define SC2CTR_CK_IOCLK_32 0x0002 /* - 1/32 IOCLK */ -#define SC2CTR_CK_TM3UFLOW_2 0x0003 /* - 1/2 timer 3 underflow */ -#define SC2CTR_CK_TM1UFLOW_8 0x0004 /* - 1/8 timer 1 underflow */ -#define SC2CTR_CK_TM3UFLOW_8 0x0005 /* - 1/8 timer 3 underflow */ -#define SC2CTR_CK_EXTERN_8 0x0006 /* - 1/8 external closk */ -#define SC2CTR_CK_EXTERN 0x0007 /* - external closk */ -#endif /* CONFIG_AM33_2 */ -#define SC2CTR_STB 0x0008 /* stop bit select */ -#define SC2CTR_STB_1BIT 0x0000 /* - 1 stop bit */ -#define SC2CTR_STB_2BIT 0x0008 /* - 2 stop bits */ -#define SC2CTR_PB 0x0070 /* parity bit select */ -#define SC2CTR_PB_NONE 0x0000 /* - no parity */ -#define SC2CTR_PB_FIXED0 0x0040 /* - fixed at 0 */ -#define SC2CTR_PB_FIXED1 0x0050 /* - fixed at 1 */ -#define SC2CTR_PB_EVEN 0x0060 /* - even parity */ -#define SC2CTR_PB_ODD 0x0070 /* - odd parity */ -#define SC2CTR_CLN 0x0080 /* character length */ -#define SC2CTR_CLN_7BIT 0x0000 /* - 7 bit chars */ -#define SC2CTR_CLN_8BIT 0x0080 /* - 8 bit chars */ -#define SC2CTR_TWE 0x0100 /* transmit wait enable (enable XCTS control) */ -#define SC2CTR_OD 0x0200 /* bit order select */ -#define SC2CTR_OD_LSBFIRST 0x0000 /* - LSB first */ -#define SC2CTR_OD_MSBFIRST 0x0200 /* - MSB first */ -#define SC2CTR_TWS 0x1000 /* transmit wait select */ -#define SC2CTR_TWS_XCTS_HIGH 0x0000 /* - interrupt TX when XCTS high */ -#define SC2CTR_TWS_XCTS_LOW 0x1000 /* - interrupt TX when XCTS low */ -#define SC2CTR_BKE 0x2000 /* break transmit enable */ -#define SC2CTR_RXE 0x4000 /* receive enable */ -#define SC2CTR_TXE 0x8000 /* transmit enable */ - -#define SC2ICR __SYSREG(0xd4002024, u8) /* interrupt control reg */ -#define SC2ICR_TD 0x20 /* transmit DMA trigger cause */ -#define SC2ICR_TI 0x10 /* transmit interrupt cause */ -#define SC2ICR_RES 0x04 /* receive error select */ -#define SC2ICR_RI 0x01 /* receive interrupt cause */ - -#define SC2TXB __SYSREG(0xd4002028, u8) /* transmit buffer reg */ -#define SC2RXB __SYSREG(0xd4002029, u8) /* receive buffer reg */ - -#ifdef CONFIG_AM33_2 -#define SC2STR __SYSREG(0xd400202c, u8) /* status reg */ -#else /* CONFIG_AM33_2 */ -#define SC2STR __SYSREG(0xd400202c, u16) /* status reg */ -#endif /* CONFIG_AM33_2 */ -#define SC2STR_OEF 0x0001 /* overrun error found */ -#define SC2STR_PEF 0x0002 /* parity error found */ -#define SC2STR_FEF 0x0004 /* framing error found */ -#define SC2STR_CTS 0x0008 /* XCTS input pin status (0 means high) */ -#define SC2STR_RBF 0x0010 /* receive buffer status */ -#define SC2STR_TBF 0x0020 /* transmit buffer status */ -#define SC2STR_RXF 0x0040 /* receive status */ -#define SC2STR_TXF 0x0080 /* transmit status */ - -#ifdef CONFIG_AM33_2 -#define SC2TIM __SYSREG(0xd400202d, u8) /* status reg */ -#endif - -#ifdef CONFIG_AM33_2 -#define SC2RXIRQ 24 /* serial 2 Receive IRQ */ -#define SC2TXIRQ 25 /* serial 2 Transmit IRQ */ -#else /* CONFIG_AM33_2 */ -#define SC2RXIRQ 68 /* serial 2 Receive IRQ */ -#define SC2TXIRQ 69 /* serial 2 Transmit IRQ */ -#endif /* CONFIG_AM33_2 */ - -#define SC2RXICR GxICR(SC2RXIRQ) /* serial 2 receive intr ctrl reg */ -#define SC2TXICR GxICR(SC2TXIRQ) /* serial 2 transmit intr ctrl reg */ - - -#endif /* __KERNEL__ */ - -#endif /* _ASM_SERIAL_REGS_H */ diff --git a/arch/mn10300/include/asm/serial.h b/arch/mn10300/include/asm/serial.h deleted file mode 100644 index 594ebff15d3f0..0000000000000 --- a/arch/mn10300/include/asm/serial.h +++ /dev/null @@ -1,36 +0,0 @@ -/* Standard UART definitions - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - -#ifndef _ASM_SERIAL_H -#define _ASM_SERIAL_H - -/* Standard COM flags (except for COM4, because of the 8514 problem) */ -#ifdef CONFIG_SERIAL_8250_DETECT_IRQ -#define STD_COM_FLAGS (UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_AUTO_IRQ) -#define STD_COM4_FLAGS (UPF_BOOT_AUTOCONF | UPF_AUTO_IRQ) -#else -#define STD_COM_FLAGS (UPF_BOOT_AUTOCONF | UPF_SKIP_TEST) -#define STD_COM4_FLAGS UPF_BOOT_AUTOCONF -#endif - -#ifdef CONFIG_SERIAL_8250_MANY_PORTS -#define FOURPORT_FLAGS UPF_FOURPORT -#define ACCENT_FLAGS 0 -#define BOCA_FLAGS 0 -#define HUB6_FLAGS 0 -#define RS_TABLE_SIZE 64 -#else -#define RS_TABLE_SIZE -#endif - -#include - -#endif /* _ASM_SERIAL_H */ diff --git a/arch/mn10300/include/asm/setup.h b/arch/mn10300/include/asm/setup.h deleted file mode 100644 index fb024555d2a98..0000000000000 --- a/arch/mn10300/include/asm/setup.h +++ /dev/null @@ -1,18 +0,0 @@ -/* MN10300 Setup declarations - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_SETUP_H -#define _ASM_SETUP_H - -#include - -extern void __init unit_setup(void); -extern void __init unit_init_IRQ(void); -#endif /* _ASM_SETUP_H */ diff --git a/arch/mn10300/include/asm/shmparam.h b/arch/mn10300/include/asm/shmparam.h deleted file mode 100644 index 3a31faaa43539..0000000000000 --- a/arch/mn10300/include/asm/shmparam.h +++ /dev/null @@ -1,7 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_SHMPARAM_H -#define _ASM_SHMPARAM_H - -#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */ - -#endif /* _ASM_SHMPARAM_H */ diff --git a/arch/mn10300/include/asm/signal.h b/arch/mn10300/include/asm/signal.h deleted file mode 100644 index 214ff5e9fe601..0000000000000 --- a/arch/mn10300/include/asm/signal.h +++ /dev/null @@ -1,33 +0,0 @@ -/* MN10300 Signal definitions - * - * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd. - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_SIGNAL_H -#define _ASM_SIGNAL_H - -#include - -/* 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; - -#define __ARCH_HAS_SA_RESTORER - -#include - -#endif /* _ASM_SIGNAL_H */ diff --git a/arch/mn10300/include/asm/smp.h b/arch/mn10300/include/asm/smp.h deleted file mode 100644 index 56c42417d4287..0000000000000 --- a/arch/mn10300/include/asm/smp.h +++ /dev/null @@ -1,109 +0,0 @@ -/* MN10300 SMP support - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * Modified by Matsushita Electric Industrial Co., Ltd. - * Modifications: - * 13-Nov-2006 MEI Define IPI-IRQ number and add inline/macro function - * for SMP support. - * 22-Jan-2007 MEI Add the define related to SMP_BOOT_IRQ. - * 23-Feb-2007 MEI Add the define related to SMP icahce invalidate. - * 23-Jun-2008 MEI Delete INTC_IPI. - * 22-Jul-2008 MEI Add smp_nmi_call_function and related defines. - * 04-Aug-2008 MEI Delete USE_DOIRQ_CACHE_IPI. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_SMP_H -#define _ASM_SMP_H - -#ifndef __ASSEMBLY__ -#include -#include -#include -#endif - -#ifdef CONFIG_SMP -#include - -#define RESCHEDULE_IPI 63 -#define CALL_FUNC_SINGLE_IPI 192 -#define LOCAL_TIMER_IPI 193 -#define FLUSH_CACHE_IPI 194 -#define CALL_FUNCTION_NMI_IPI 195 -#define DEBUGGER_NMI_IPI 196 - -#define SMP_BOOT_IRQ 195 - -#define RESCHEDULE_GxICR_LV GxICR_LEVEL_6 -#define CALL_FUNCTION_GxICR_LV GxICR_LEVEL_4 -#define LOCAL_TIMER_GxICR_LV GxICR_LEVEL_4 -#define FLUSH_CACHE_GxICR_LV GxICR_LEVEL_0 -#define SMP_BOOT_GxICR_LV GxICR_LEVEL_0 -#define DEBUGGER_GxICR_LV CONFIG_DEBUGGER_IRQ_LEVEL - -#define TIME_OUT_COUNT_BOOT_IPI 100 -#define DELAY_TIME_BOOT_IPI 75000 - - -#ifndef __ASSEMBLY__ - -/** - * raw_smp_processor_id - Determine the raw CPU ID of the CPU running it - * - * What we really want to do is to use the CPUID hardware CPU register to get - * this information, but accesses to that aren't cached, and run at system bus - * speed, not CPU speed. A copy of this value is, however, stored in the - * thread_info struct, and that can be cached. - * - * An alternate way of dealing with this could be to use the EPSW.S bits to - * cache this information for systems with up to four CPUs. - */ -#define arch_smp_processor_id() (CPUID) -#if 0 -#define raw_smp_processor_id() (arch_smp_processor_id()) -#else -#define raw_smp_processor_id() (current_thread_info()->cpu) -#endif - -static inline int cpu_logical_map(int cpu) -{ - return cpu; -} - -static inline int cpu_number_map(int cpu) -{ - return cpu; -} - - -extern cpumask_t cpu_boot_map; - -extern void smp_init_cpus(void); -extern void smp_cache_interrupt(void); -extern void send_IPI_allbutself(int irq); -extern int smp_nmi_call_function(void (*func)(void *), void *info, int wait); - -extern void arch_send_call_function_single_ipi(int cpu); -extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); - -#ifdef CONFIG_HOTPLUG_CPU -extern int __cpu_disable(void); -extern void __cpu_die(unsigned int cpu); -#endif /* CONFIG_HOTPLUG_CPU */ - -#endif /* __ASSEMBLY__ */ -#else /* CONFIG_SMP */ -#ifndef __ASSEMBLY__ - -static inline void smp_init_cpus(void) {} -#define raw_smp_processor_id() 0 - -#endif /* __ASSEMBLY__ */ -#endif /* CONFIG_SMP */ - -#endif /* _ASM_SMP_H */ diff --git a/arch/mn10300/include/asm/smsc911x.h b/arch/mn10300/include/asm/smsc911x.h deleted file mode 100644 index 2fcd1080322b6..0000000000000 --- a/arch/mn10300/include/asm/smsc911x.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/arch/mn10300/include/asm/spinlock.h b/arch/mn10300/include/asm/spinlock.h deleted file mode 100644 index 879cd0df53ba2..0000000000000 --- a/arch/mn10300/include/asm/spinlock.h +++ /dev/null @@ -1,180 +0,0 @@ -/* MN10300 spinlock support - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_SPINLOCK_H -#define _ASM_SPINLOCK_H - -#include -#include -#include -#include -#include - -/* - * Simple spin lock operations. There are two variants, one clears IRQ's - * on the local processor, one does not. - * - * We make no fairness assumptions. They have a cost. - */ - -#define arch_spin_is_locked(x) (*(volatile signed char *)(&(x)->slock) != 0) - -static inline void arch_spin_unlock(arch_spinlock_t *lock) -{ - asm volatile( - " bclr 1,(0,%0) \n" - : - : "a"(&lock->slock) - : "memory", "cc"); -} - -static inline int arch_spin_trylock(arch_spinlock_t *lock) -{ - int ret; - - asm volatile( - " mov 1,%0 \n" - " bset %0,(%1) \n" - " bne 1f \n" - " clr %0 \n" - "1: xor 1,%0 \n" - : "=d"(ret) - : "a"(&lock->slock) - : "memory", "cc"); - - return ret; -} - -static inline void arch_spin_lock(arch_spinlock_t *lock) -{ - asm volatile( - "1: bset 1,(0,%0) \n" - " bne 1b \n" - : - : "a"(&lock->slock) - : "memory", "cc"); -} - -static inline void arch_spin_lock_flags(arch_spinlock_t *lock, - unsigned long flags) -{ - int temp; - - asm volatile( - "1: bset 1,(0,%2) \n" - " beq 3f \n" - " mov %1,epsw \n" - "2: mov (0,%2),%0 \n" - " or %0,%0 \n" - " bne 2b \n" - " mov %3,%0 \n" - " mov %0,epsw \n" - " nop \n" - " nop \n" - " bra 1b\n" - "3: \n" - : "=&d" (temp) - : "d" (flags), "a"(&lock->slock), "i"(EPSW_IE | MN10300_CLI_LEVEL) - : "memory", "cc"); -} -#define arch_spin_lock_flags arch_spin_lock_flags - -#ifdef __KERNEL__ - -/* - * Read-write spinlocks, allowing multiple readers - * but only one writer. - * - * NOTE! it is quite common to have readers in interrupts - * but no interrupt writers. For those circumstances we - * can "mix" irq-safe locks - any writer needs to get a - * irq-safe write-lock, but readers can get non-irqsafe - * read-locks. - */ - -/* - * On mn10300, we implement read-write locks as a 32-bit counter - * with the high bit (sign) being the "contended" bit. - */ -static inline void arch_read_lock(arch_rwlock_t *rw) -{ -#if 0 //def CONFIG_MN10300_HAS_ATOMIC_OPS_UNIT - __build_read_lock(rw, "__read_lock_failed"); -#else - { - atomic_t *count = (atomic_t *)rw; - while (atomic_dec_return(count) < 0) - atomic_inc(count); - } -#endif -} - -static inline void arch_write_lock(arch_rwlock_t *rw) -{ -#if 0 //def CONFIG_MN10300_HAS_ATOMIC_OPS_UNIT - __build_write_lock(rw, "__write_lock_failed"); -#else - { - atomic_t *count = (atomic_t *)rw; - while (!atomic_sub_and_test(RW_LOCK_BIAS, count)) - atomic_add(RW_LOCK_BIAS, count); - } -#endif -} - -static inline void arch_read_unlock(arch_rwlock_t *rw) -{ -#if 0 //def CONFIG_MN10300_HAS_ATOMIC_OPS_UNIT - __build_read_unlock(rw); -#else - { - atomic_t *count = (atomic_t *)rw; - atomic_inc(count); - } -#endif -} - -static inline void arch_write_unlock(arch_rwlock_t *rw) -{ -#if 0 //def CONFIG_MN10300_HAS_ATOMIC_OPS_UNIT - __build_write_unlock(rw); -#else - { - atomic_t *count = (atomic_t *)rw; - atomic_add(RW_LOCK_BIAS, count); - } -#endif -} - -static inline int arch_read_trylock(arch_rwlock_t *lock) -{ - atomic_t *count = (atomic_t *)lock; - atomic_dec(count); - if (atomic_read(count) >= 0) - return 1; - atomic_inc(count); - return 0; -} - -static inline int arch_write_trylock(arch_rwlock_t *lock) -{ - atomic_t *count = (atomic_t *)lock; - if (atomic_sub_and_test(RW_LOCK_BIAS, count)) - return 1; - atomic_add(RW_LOCK_BIAS, count); - return 0; -} - -#define _raw_spin_relax(lock) cpu_relax() -#define _raw_read_relax(lock) cpu_relax() -#define _raw_write_relax(lock) cpu_relax() - -#endif /* __KERNEL__ */ -#endif /* _ASM_SPINLOCK_H */ diff --git a/arch/mn10300/include/asm/spinlock_types.h b/arch/mn10300/include/asm/spinlock_types.h deleted file mode 100644 index 32abdc89bbc75..0000000000000 --- a/arch/mn10300/include/asm/spinlock_types.h +++ /dev/null @@ -1,21 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_SPINLOCK_TYPES_H -#define _ASM_SPINLOCK_TYPES_H - -#ifndef __LINUX_SPINLOCK_TYPES_H -# error "please don't include this file directly" -#endif - -typedef struct arch_spinlock { - unsigned int slock; -} arch_spinlock_t; - -#define __ARCH_SPIN_LOCK_UNLOCKED { 0 } - -typedef struct { - unsigned int lock; -} arch_rwlock_t; - -#define __ARCH_RW_LOCK_UNLOCKED { RW_LOCK_BIAS } - -#endif /* _ASM_SPINLOCK_TYPES_H */ diff --git a/arch/mn10300/include/asm/string.h b/arch/mn10300/include/asm/string.h deleted file mode 100644 index 47dbd4346c326..0000000000000 --- a/arch/mn10300/include/asm/string.h +++ /dev/null @@ -1,32 +0,0 @@ -/* MN10300 Optimised string functions - * - * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd. - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Modified by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_STRING_H -#define _ASM_STRING_H - -#define __HAVE_ARCH_MEMSET -#define __HAVE_ARCH_MEMCPY -#define __HAVE_ARCH_MEMMOVE - -extern void *memset(void *dest, int ch, size_t count); -extern void *memcpy(void *dest, const void *src, size_t count); -extern void *memmove(void *dest, const void *src, size_t count); - - -extern void __struct_cpy_bug(void); -#define struct_cpy(x, y) \ -({ \ - if (sizeof(*(x)) != sizeof(*(y))) \ - __struct_cpy_bug; \ - memcpy(x, y, sizeof(*(x))); \ -}) - -#endif /* _ASM_STRING_H */ diff --git a/arch/mn10300/include/asm/switch_to.h b/arch/mn10300/include/asm/switch_to.h deleted file mode 100644 index 67e333aa7629c..0000000000000 --- a/arch/mn10300/include/asm/switch_to.h +++ /dev/null @@ -1,49 +0,0 @@ -/* MN10300 task switching definitions - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_SWITCH_TO_H -#define _ASM_SWITCH_TO_H - -#include - -struct task_struct; -struct thread_struct; - -#if defined(CONFIG_FPU) && !defined(CONFIG_LAZY_SAVE_FPU) -struct fpu_state_struct; -extern asmlinkage void fpu_save(struct fpu_state_struct *); -#define switch_fpu(prev, next) \ - do { \ - if ((prev)->thread.fpu_flags & THREAD_HAS_FPU) { \ - (prev)->thread.fpu_flags &= ~THREAD_HAS_FPU; \ - (prev)->thread.uregs->epsw &= ~EPSW_FE; \ - fpu_save(&(prev)->thread.fpu_state); \ - } \ - } while (0) -#else -#define switch_fpu(prev, next) do {} while (0) -#endif - -/* context switching is now performed out-of-line in switch_to.S */ -extern asmlinkage -struct task_struct *__switch_to(struct thread_struct *prev, - struct thread_struct *next, - struct task_struct *prev_task); - -#define switch_to(prev, next, last) \ -do { \ - switch_fpu(prev, next); \ - current->thread.wchan = (u_long) __builtin_return_address(0); \ - (last) = __switch_to(&(prev)->thread, &(next)->thread, (prev)); \ - mb(); \ - current->thread.wchan = 0; \ -} while (0) - -#endif /* _ASM_SWITCH_TO_H */ diff --git a/arch/mn10300/include/asm/syscall.h b/arch/mn10300/include/asm/syscall.h deleted file mode 100644 index b44b0bb75a011..0000000000000 --- a/arch/mn10300/include/asm/syscall.h +++ /dev/null @@ -1,117 +0,0 @@ -/* Access to user system call parameters and results - * - * See asm-generic/syscall.h for function descriptions. - * - * Copyright (C) 2010 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - -#ifndef _ASM_SYSCALL_H -#define _ASM_SYSCALL_H - -#include -#include - -extern const unsigned long sys_call_table[]; - -static inline int syscall_get_nr(struct task_struct *task, struct pt_regs *regs) -{ - return regs->orig_d0; -} - -static inline void syscall_rollback(struct task_struct *task, - struct pt_regs *regs) -{ - regs->d0 = regs->orig_d0; -} - -static inline long syscall_get_error(struct task_struct *task, - struct pt_regs *regs) -{ - unsigned long error = regs->d0; - return IS_ERR_VALUE(error) ? error : 0; -} - -static inline long syscall_get_return_value(struct task_struct *task, - struct pt_regs *regs) -{ - return regs->d0; -} - -static inline void syscall_set_return_value(struct task_struct *task, - struct pt_regs *regs, - int error, long val) -{ - regs->d0 = (long) error ?: val; -} - -static inline void syscall_get_arguments(struct task_struct *task, - struct pt_regs *regs, - unsigned int i, unsigned int n, - unsigned long *args) -{ - switch (i) { - case 0: - if (!n--) break; - *args++ = regs->a0; - case 1: - if (!n--) break; - *args++ = regs->d1; - case 2: - if (!n--) break; - *args++ = regs->a3; - case 3: - if (!n--) break; - *args++ = regs->a2; - case 4: - if (!n--) break; - *args++ = regs->d3; - case 5: - if (!n--) break; - *args++ = regs->d2; - case 6: - if (!n--) break; - default: - BUG(); - break; - } -} - -static inline void syscall_set_arguments(struct task_struct *task, - struct pt_regs *regs, - unsigned int i, unsigned int n, - const unsigned long *args) -{ - switch (i) { - case 0: - if (!n--) break; - regs->a0 = *args++; - case 1: - if (!n--) break; - regs->d1 = *args++; - case 2: - if (!n--) break; - regs->a3 = *args++; - case 3: - if (!n--) break; - regs->a2 = *args++; - case 4: - if (!n--) break; - regs->d3 = *args++; - case 5: - if (!n--) break; - regs->d2 = *args++; - case 6: - if (!n--) break; - default: - BUG(); - break; - } -} - -#endif /* _ASM_SYSCALL_H */ diff --git a/arch/mn10300/include/asm/termios.h b/arch/mn10300/include/asm/termios.h deleted file mode 100644 index 4010edcaa08e7..0000000000000 --- a/arch/mn10300/include/asm/termios.h +++ /dev/null @@ -1,14 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_TERMIOS_H -#define _ASM_TERMIOS_H - -#include - -/* 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 /* _ASM_TERMIOS_H */ diff --git a/arch/mn10300/include/asm/thread_info.h b/arch/mn10300/include/asm/thread_info.h deleted file mode 100644 index 1748a7b25bf8c..0000000000000 --- a/arch/mn10300/include/asm/thread_info.h +++ /dev/null @@ -1,160 +0,0 @@ -/* MN10300 Low-level thread information - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - -#ifndef _ASM_THREAD_INFO_H -#define _ASM_THREAD_INFO_H - -#ifdef __KERNEL__ - -#include - -#ifdef CONFIG_4KSTACKS -#define THREAD_SIZE (4096) -#define THREAD_SIZE_ORDER (0) -#else -#define THREAD_SIZE (8192) -#define THREAD_SIZE_ORDER (1) -#endif - -#define STACK_WARN (THREAD_SIZE / 8) - -/* - * 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 - */ -#ifndef __ASSEMBLY__ -typedef struct { - unsigned long seg; -} mm_segment_t; - -struct thread_info { - struct task_struct *task; /* main task structure */ - struct pt_regs *frame; /* current exception frame */ - unsigned long flags; /* low level flags */ - __u32 cpu; /* current CPU */ - __s32 preempt_count; /* 0 => preemptable, <0 => BUG */ - - mm_segment_t addr_limit; /* thread address space: - 0-0xBFFFFFFF for user-thead - 0-0xFFFFFFFF for kernel-thread - */ - - __u8 supervisor_stack[0]; -}; - -#define thread_info_to_uregs(ti) \ - ((struct pt_regs *) \ - ((unsigned long)ti + THREAD_SIZE - sizeof(struct pt_regs))) - -#else /* !__ASSEMBLY__ */ - -#ifndef __ASM_OFFSETS_H__ -#include -#endif - -#endif - -/* - * macros/functions for gaining access to the thread information structure - */ -#ifndef __ASSEMBLY__ - -#define INIT_THREAD_INFO(tsk) \ -{ \ - .task = &tsk, \ - .flags = 0, \ - .cpu = 0, \ - .preempt_count = INIT_PREEMPT_COUNT, \ - .addr_limit = KERNEL_DS, \ -} - -#define init_uregs \ - ((struct pt_regs *) \ - ((unsigned long) init_stack + THREAD_SIZE - sizeof(struct pt_regs))) - -extern struct thread_info *__current_ti; - -/* how to get the thread information struct from C */ -static inline __attribute__((const)) -struct thread_info *current_thread_info(void) -{ - struct thread_info *ti; - asm("mov sp,%0\n" - "and %1,%0\n" - : "=d" (ti) - : "i" (~(THREAD_SIZE - 1)) - : "cc"); - return ti; -} - -static inline __attribute__((const)) -struct pt_regs *current_frame(void) -{ - return current_thread_info()->frame; -} - -/* how to get the current stack pointer from C */ -static inline unsigned long current_stack_pointer(void) -{ - unsigned long sp; - asm("mov sp,%0; ":"=r" (sp)); - return sp; -} - -#ifndef CONFIG_KGDB -void arch_release_thread_stack(unsigned long *stack); -#endif -#define get_thread_info(ti) get_task_struct((ti)->task) -#define put_thread_info(ti) put_task_struct((ti)->task) - -#else /* !__ASSEMBLY__ */ - -#ifndef __VMLINUX_LDS__ -/* how to get the thread information struct from ASM */ -.macro GET_THREAD_INFO reg - mov sp,\reg - and -THREAD_SIZE,\reg -.endm -#endif -#endif - -/* - * 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 */ -#define TIF_SINGLESTEP 4 /* restore singlestep on return to user mode */ -#define TIF_RESTORE_SIGMASK 5 /* restore signal mask in do_signal() */ -#define TIF_POLLING_NRFLAG 16 /* true if poll_idle() is polling TIF_NEED_RESCHED */ -#define TIF_MEMDIE 17 /* is terminating due to OOM killer */ - -#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_POLLING_NRFLAG +(1 << TIF_POLLING_NRFLAG) - -#define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */ -#define _TIF_ALLWORK_MASK 0x0000FFFF /* work to do on any return to u-space */ - -#endif /* __KERNEL__ */ - -#endif /* _ASM_THREAD_INFO_H */ diff --git a/arch/mn10300/include/asm/timer-regs.h b/arch/mn10300/include/asm/timer-regs.h deleted file mode 100644 index c634977caf66d..0000000000000 --- a/arch/mn10300/include/asm/timer-regs.h +++ /dev/null @@ -1,452 +0,0 @@ -/* AM33v2 on-board timer module registers - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - -#ifndef _ASM_TIMER_REGS_H -#define _ASM_TIMER_REGS_H - -#include -#include - -#ifdef __KERNEL__ - -/* - * Timer prescalar control - */ -#define TMPSCNT __SYSREG(0xd4003071, u8) /* timer prescaler control */ -#define TMPSCNT_ENABLE 0x80 /* timer prescaler enable */ -#define TMPSCNT_DISABLE 0x00 /* timer prescaler disable */ - -/* - * 8-bit timers - */ -#define TM0MD __SYSREG(0xd4003000, u8) /* timer 0 mode register */ -#define TM0MD_SRC 0x07 /* timer source */ -#define TM0MD_SRC_IOCLK 0x00 /* - IOCLK */ -#define TM0MD_SRC_IOCLK_8 0x01 /* - 1/8 IOCLK */ -#define TM0MD_SRC_IOCLK_32 0x02 /* - 1/32 IOCLK */ -#define TM0MD_SRC_TM1UFLOW 0x05 /* - timer 1 underflow */ -#define TM0MD_SRC_TM2UFLOW 0x06 /* - timer 2 underflow */ -#if defined(CONFIG_AM33_2) -#define TM0MD_SRC_TM2IO 0x03 /* - TM2IO pin input */ -#define TM0MD_SRC_TM0IO 0x07 /* - TM0IO pin input */ -#endif /* CONFIG_AM33_2 */ -#define TM0MD_INIT_COUNTER 0x40 /* initialize TMnBC = TMnBR */ -#define TM0MD_COUNT_ENABLE 0x80 /* timer count enable */ - -#define TM1MD __SYSREG(0xd4003001, u8) /* timer 1 mode register */ -#define TM1MD_SRC 0x07 /* timer source */ -#define TM1MD_SRC_IOCLK 0x00 /* - IOCLK */ -#define TM1MD_SRC_IOCLK_8 0x01 /* - 1/8 IOCLK */ -#define TM1MD_SRC_IOCLK_32 0x02 /* - 1/32 IOCLK */ -#define TM1MD_SRC_TM0CASCADE 0x03 /* - cascade with timer 0 */ -#define TM1MD_SRC_TM0UFLOW 0x04 /* - timer 0 underflow */ -#define TM1MD_SRC_TM2UFLOW 0x06 /* - timer 2 underflow */ -#if defined(CONFIG_AM33_2) -#define TM1MD_SRC_TM1IO 0x07 /* - TM1IO pin input */ -#endif /* CONFIG_AM33_2 */ -#define TM1MD_INIT_COUNTER 0x40 /* initialize TMnBC = TMnBR */ -#define TM1MD_COUNT_ENABLE 0x80 /* timer count enable */ - -#define TM2MD __SYSREG(0xd4003002, u8) /* timer 2 mode register */ -#define TM2MD_SRC 0x07 /* timer source */ -#define TM2MD_SRC_IOCLK 0x00 /* - IOCLK */ -#define TM2MD_SRC_IOCLK_8 0x01 /* - 1/8 IOCLK */ -#define TM2MD_SRC_IOCLK_32 0x02 /* - 1/32 IOCLK */ -#define TM2MD_SRC_TM1CASCADE 0x03 /* - cascade with timer 1 */ -#define TM2MD_SRC_TM0UFLOW 0x04 /* - timer 0 underflow */ -#define TM2MD_SRC_TM1UFLOW 0x05 /* - timer 1 underflow */ -#if defined(CONFIG_AM33_2) -#define TM2MD_SRC_TM2IO 0x07 /* - TM2IO pin input */ -#endif /* CONFIG_AM33_2 */ -#define TM2MD_INIT_COUNTER 0x40 /* initialize TMnBC = TMnBR */ -#define TM2MD_COUNT_ENABLE 0x80 /* timer count enable */ - -#define TM3MD __SYSREG(0xd4003003, u8) /* timer 3 mode register */ -#define TM3MD_SRC 0x07 /* timer source */ -#define TM3MD_SRC_IOCLK 0x00 /* - IOCLK */ -#define TM3MD_SRC_IOCLK_8 0x01 /* - 1/8 IOCLK */ -#define TM3MD_SRC_IOCLK_32 0x02 /* - 1/32 IOCLK */ -#define TM3MD_SRC_TM2CASCADE 0x03 /* - cascade with timer 2 */ -#define TM3MD_SRC_TM0UFLOW 0x04 /* - timer 0 underflow */ -#define TM3MD_SRC_TM1UFLOW 0x05 /* - timer 1 underflow */ -#define TM3MD_SRC_TM2UFLOW 0x06 /* - timer 2 underflow */ -#if defined(CONFIG_AM33_2) -#define TM3MD_SRC_TM3IO 0x07 /* - TM3IO pin input */ -#endif /* CONFIG_AM33_2 */ -#define TM3MD_INIT_COUNTER 0x40 /* initialize TMnBC = TMnBR */ -#define TM3MD_COUNT_ENABLE 0x80 /* timer count enable */ - -#define TM01MD __SYSREG(0xd4003000, u16) /* timer 0:1 mode register */ - -#define TM0BR __SYSREG(0xd4003010, u8) /* timer 0 base register */ -#define TM1BR __SYSREG(0xd4003011, u8) /* timer 1 base register */ -#define TM2BR __SYSREG(0xd4003012, u8) /* timer 2 base register */ -#define TM3BR __SYSREG(0xd4003013, u8) /* timer 3 base register */ -#define TM01BR __SYSREG(0xd4003010, u16) /* timer 0:1 base register */ - -#define TM0BC __SYSREGC(0xd4003020, u8) /* timer 0 binary counter */ -#define TM1BC __SYSREGC(0xd4003021, u8) /* timer 1 binary counter */ -#define TM2BC __SYSREGC(0xd4003022, u8) /* timer 2 binary counter */ -#define TM3BC __SYSREGC(0xd4003023, u8) /* timer 3 binary counter */ -#define TM01BC __SYSREGC(0xd4003020, u16) /* timer 0:1 binary counter */ - -#define TM0IRQ 2 /* timer 0 IRQ */ -#define TM1IRQ 3 /* timer 1 IRQ */ -#define TM2IRQ 4 /* timer 2 IRQ */ -#define TM3IRQ 5 /* timer 3 IRQ */ - -#define TM0ICR GxICR(TM0IRQ) /* timer 0 uflow intr ctrl reg */ -#define TM1ICR GxICR(TM1IRQ) /* timer 1 uflow intr ctrl reg */ -#define TM2ICR GxICR(TM2IRQ) /* timer 2 uflow intr ctrl reg */ -#define TM3ICR GxICR(TM3IRQ) /* timer 3 uflow intr ctrl reg */ - -/* - * 16-bit timers 4,5 & 7-15 - */ -#define TM4MD __SYSREG(0xd4003080, u8) /* timer 4 mode register */ -#define TM4MD_SRC 0x07 /* timer source */ -#define TM4MD_SRC_IOCLK 0x00 /* - IOCLK */ -#define TM4MD_SRC_IOCLK_8 0x01 /* - 1/8 IOCLK */ -#define TM4MD_SRC_IOCLK_32 0x02 /* - 1/32 IOCLK */ -#define TM4MD_SRC_TM0UFLOW 0x04 /* - timer 0 underflow */ -#define TM4MD_SRC_TM1UFLOW 0x05 /* - timer 1 underflow */ -#define TM4MD_SRC_TM2UFLOW 0x06 /* - timer 2 underflow */ -#if defined(CONFIG_AM33_2) -#define TM4MD_SRC_TM4IO 0x07 /* - TM4IO pin input */ -#endif /* CONFIG_AM33_2 */ -#define TM4MD_INIT_COUNTER 0x40 /* initialize TMnBC = TMnBR */ -#define TM4MD_COUNT_ENABLE 0x80 /* timer count enable */ - -#define TM5MD __SYSREG(0xd4003082, u8) /* timer 5 mode register */ -#define TM5MD_SRC 0x07 /* timer source */ -#define TM5MD_SRC_IOCLK 0x00 /* - IOCLK */ -#define TM5MD_SRC_IOCLK_8 0x01 /* - 1/8 IOCLK */ -#define TM5MD_SRC_IOCLK_32 0x02 /* - 1/32 IOCLK */ -#define TM5MD_SRC_TM4CASCADE 0x03 /* - cascade with timer 4 */ -#define TM5MD_SRC_TM0UFLOW 0x04 /* - timer 0 underflow */ -#define TM5MD_SRC_TM1UFLOW 0x05 /* - timer 1 underflow */ -#define TM5MD_SRC_TM2UFLOW 0x06 /* - timer 2 underflow */ -#if defined(CONFIG_AM33_2) -#define TM5MD_SRC_TM5IO 0x07 /* - TM5IO pin input */ -#else /* !CONFIG_AM33_2 */ -#define TM5MD_SRC_TM7UFLOW 0x07 /* - timer 7 underflow */ -#endif /* CONFIG_AM33_2 */ -#define TM5MD_INIT_COUNTER 0x40 /* initialize TMnBC = TMnBR */ -#define TM5MD_COUNT_ENABLE 0x80 /* timer count enable */ - -#define TM7MD __SYSREG(0xd4003086, u8) /* timer 7 mode register */ -#define TM7MD_SRC 0x07 /* timer source */ -#define TM7MD_SRC_IOCLK 0x00 /* - IOCLK */ -#define TM7MD_SRC_IOCLK_8 0x01 /* - 1/8 IOCLK */ -#define TM7MD_SRC_IOCLK_32 0x02 /* - 1/32 IOCLK */ -#define TM7MD_SRC_TM0UFLOW 0x04 /* - timer 0 underflow */ -#define TM7MD_SRC_TM1UFLOW 0x05 /* - timer 1 underflow */ -#define TM7MD_SRC_TM2UFLOW 0x06 /* - timer 2 underflow */ -#if defined(CONFIG_AM33_2) -#define TM7MD_SRC_TM7IO 0x07 /* - TM7IO pin input */ -#endif /* CONFIG_AM33_2 */ -#define TM7MD_INIT_COUNTER 0x40 /* initialize TMnBC = TMnBR */ -#define TM7MD_COUNT_ENABLE 0x80 /* timer count enable */ - -#define TM8MD __SYSREG(0xd4003088, u8) /* timer 8 mode register */ -#define TM8MD_SRC 0x07 /* timer source */ -#define TM8MD_SRC_IOCLK 0x00 /* - IOCLK */ -#define TM8MD_SRC_IOCLK_8 0x01 /* - 1/8 IOCLK */ -#define TM8MD_SRC_IOCLK_32 0x02 /* - 1/32 IOCLK */ -#define TM8MD_SRC_TM7CASCADE 0x03 /* - cascade with timer 7 */ -#define TM8MD_SRC_TM0UFLOW 0x04 /* - timer 0 underflow */ -#define TM8MD_SRC_TM1UFLOW 0x05 /* - timer 1 underflow */ -#define TM8MD_SRC_TM2UFLOW 0x06 /* - timer 2 underflow */ -#if defined(CONFIG_AM33_2) -#define TM8MD_SRC_TM8IO 0x07 /* - TM8IO pin input */ -#else /* !CONFIG_AM33_2 */ -#define TM8MD_SRC_TM7UFLOW 0x07 /* - timer 7 underflow */ -#endif /* CONFIG_AM33_2 */ -#define TM8MD_INIT_COUNTER 0x40 /* initialize TMnBC = TMnBR */ -#define TM8MD_COUNT_ENABLE 0x80 /* timer count enable */ - -#define TM9MD __SYSREG(0xd400308a, u8) /* timer 9 mode register */ -#define TM9MD_SRC 0x07 /* timer source */ -#define TM9MD_SRC_IOCLK 0x00 /* - IOCLK */ -#define TM9MD_SRC_IOCLK_8 0x01 /* - 1/8 IOCLK */ -#define TM9MD_SRC_IOCLK_32 0x02 /* - 1/32 IOCLK */ -#define TM9MD_SRC_TM8CASCADE 0x03 /* - cascade with timer 8 */ -#define TM9MD_SRC_TM0UFLOW 0x04 /* - timer 0 underflow */ -#define TM9MD_SRC_TM1UFLOW 0x05 /* - timer 1 underflow */ -#define TM9MD_SRC_TM2UFLOW 0x06 /* - timer 2 underflow */ -#if defined(CONFIG_AM33_2) -#define TM9MD_SRC_TM9IO 0x07 /* - TM9IO pin input */ -#else /* !CONFIG_AM33_2 */ -#define TM9MD_SRC_TM7UFLOW 0x07 /* - timer 7 underflow */ -#endif /* CONFIG_AM33_2 */ -#define TM9MD_INIT_COUNTER 0x40 /* initialize TMnBC = TMnBR */ -#define TM9MD_COUNT_ENABLE 0x80 /* timer count enable */ - -#define TM10MD __SYSREG(0xd400308c, u8) /* timer 10 mode register */ -#define TM10MD_SRC 0x07 /* timer source */ -#define TM10MD_SRC_IOCLK 0x00 /* - IOCLK */ -#define TM10MD_SRC_IOCLK_8 0x01 /* - 1/8 IOCLK */ -#define TM10MD_SRC_IOCLK_32 0x02 /* - 1/32 IOCLK */ -#define TM10MD_SRC_TM9CASCADE 0x03 /* - cascade with timer 9 */ -#define TM10MD_SRC_TM0UFLOW 0x04 /* - timer 0 underflow */ -#define TM10MD_SRC_TM1UFLOW 0x05 /* - timer 1 underflow */ -#define TM10MD_SRC_TM2UFLOW 0x06 /* - timer 2 underflow */ -#if defined(CONFIG_AM33_2) -#define TM10MD_SRC_TM10IO 0x07 /* - TM10IO pin input */ -#else /* !CONFIG_AM33_2 */ -#define TM10MD_SRC_TM7UFLOW 0x07 /* - timer 7 underflow */ -#endif /* CONFIG_AM33_2 */ -#define TM10MD_INIT_COUNTER 0x40 /* initialize TMnBC = TMnBR */ -#define TM10MD_COUNT_ENABLE 0x80 /* timer count enable */ - -#define TM11MD __SYSREG(0xd400308e, u8) /* timer 11 mode register */ -#define TM11MD_SRC 0x07 /* timer source */ -#define TM11MD_SRC_IOCLK 0x00 /* - IOCLK */ -#define TM11MD_SRC_IOCLK_8 0x01 /* - 1/8 IOCLK */ -#define TM11MD_SRC_IOCLK_32 0x02 /* - 1/32 IOCLK */ -#define TM11MD_SRC_TM0UFLOW 0x04 /* - timer 0 underflow */ -#define TM11MD_SRC_TM1UFLOW 0x05 /* - timer 1 underflow */ -#define TM11MD_SRC_TM2UFLOW 0x06 /* - timer 2 underflow */ -#if defined(CONFIG_AM33_2) -#define TM11MD_SRC_TM11IO 0x07 /* - TM11IO pin input */ -#else /* !CONFIG_AM33_2 */ -#define TM11MD_SRC_TM7UFLOW 0x07 /* - timer 7 underflow */ -#endif /* CONFIG_AM33_2 */ -#define TM11MD_INIT_COUNTER 0x40 /* initialize TMnBC = TMnBR */ -#define TM11MD_COUNT_ENABLE 0x80 /* timer count enable */ - -#if defined(CONFIG_AM34_2) -#define TM12MD __SYSREG(0xd4003180, u8) /* timer 11 mode register */ -#define TM12MD_SRC 0x07 /* timer source */ -#define TM12MD_SRC_IOCLK 0x00 /* - IOCLK */ -#define TM12MD_SRC_IOCLK_8 0x01 /* - 1/8 IOCLK */ -#define TM12MD_SRC_IOCLK_32 0x02 /* - 1/32 IOCLK */ -#define TM12MD_SRC_TM0UFLOW 0x04 /* - timer 0 underflow */ -#define TM12MD_SRC_TM1UFLOW 0x05 /* - timer 1 underflow */ -#define TM12MD_SRC_TM2UFLOW 0x06 /* - timer 2 underflow */ -#define TM12MD_SRC_TM7UFLOW 0x07 /* - timer 7 underflow */ -#define TM12MD_INIT_COUNTER 0x40 /* initialize TMnBC = TMnBR */ -#define TM12MD_COUNT_ENABLE 0x80 /* timer count enable */ - -#define TM13MD __SYSREG(0xd4003182, u8) /* timer 11 mode register */ -#define TM13MD_SRC 0x07 /* timer source */ -#define TM13MD_SRC_IOCLK 0x00 /* - IOCLK */ -#define TM13MD_SRC_IOCLK_8 0x01 /* - 1/8 IOCLK */ -#define TM13MD_SRC_IOCLK_32 0x02 /* - 1/32 IOCLK */ -#define TM13MD_SRC_TM12CASCADE 0x03 /* - cascade with timer 12 */ -#define TM13MD_SRC_TM0UFLOW 0x04 /* - timer 0 underflow */ -#define TM13MD_SRC_TM1UFLOW 0x05 /* - timer 1 underflow */ -#define TM13MD_SRC_TM2UFLOW 0x06 /* - timer 2 underflow */ -#define TM13MD_SRC_TM7UFLOW 0x07 /* - timer 7 underflow */ -#define TM13MD_INIT_COUNTER 0x40 /* initialize TMnBC = TMnBR */ -#define TM13MD_COUNT_ENABLE 0x80 /* timer count enable */ - -#define TM14MD __SYSREG(0xd4003184, u8) /* timer 11 mode register */ -#define TM14MD_SRC 0x07 /* timer source */ -#define TM14MD_SRC_IOCLK 0x00 /* - IOCLK */ -#define TM14MD_SRC_IOCLK_8 0x01 /* - 1/8 IOCLK */ -#define TM14MD_SRC_IOCLK_32 0x02 /* - 1/32 IOCLK */ -#define TM14MD_SRC_TM13CASCADE 0x03 /* - cascade with timer 13 */ -#define TM14MD_SRC_TM0UFLOW 0x04 /* - timer 0 underflow */ -#define TM14MD_SRC_TM1UFLOW 0x05 /* - timer 1 underflow */ -#define TM14MD_SRC_TM2UFLOW 0x06 /* - timer 2 underflow */ -#define TM14MD_SRC_TM7UFLOW 0x07 /* - timer 7 underflow */ -#define TM14MD_INIT_COUNTER 0x40 /* initialize TMnBC = TMnBR */ -#define TM14MD_COUNT_ENABLE 0x80 /* timer count enable */ - -#define TM15MD __SYSREG(0xd4003186, u8) /* timer 11 mode register */ -#define TM15MD_SRC 0x07 /* timer source */ -#define TM15MD_SRC_IOCLK 0x00 /* - IOCLK */ -#define TM15MD_SRC_IOCLK_8 0x01 /* - 1/8 IOCLK */ -#define TM15MD_SRC_IOCLK_32 0x02 /* - 1/32 IOCLK */ -#define TM15MD_SRC_TM0UFLOW 0x04 /* - timer 0 underflow */ -#define TM15MD_SRC_TM1UFLOW 0x05 /* - timer 1 underflow */ -#define TM15MD_SRC_TM2UFLOW 0x06 /* - timer 2 underflow */ -#define TM15MD_SRC_TM7UFLOW 0x07 /* - timer 7 underflow */ -#define TM15MD_INIT_COUNTER 0x40 /* initialize TMnBC = TMnBR */ -#define TM15MD_COUNT_ENABLE 0x80 /* timer count enable */ -#endif /* CONFIG_AM34_2 */ - - -#define TM4BR __SYSREG(0xd4003090, u16) /* timer 4 base register */ -#define TM5BR __SYSREG(0xd4003092, u16) /* timer 5 base register */ -#define TM45BR __SYSREG(0xd4003090, u32) /* timer 4:5 base register */ -#define TM7BR __SYSREG(0xd4003096, u16) /* timer 7 base register */ -#define TM8BR __SYSREG(0xd4003098, u16) /* timer 8 base register */ -#define TM9BR __SYSREG(0xd400309a, u16) /* timer 9 base register */ -#define TM89BR __SYSREG(0xd4003098, u32) /* timer 8:9 base register */ -#define TM10BR __SYSREG(0xd400309c, u16) /* timer 10 base register */ -#define TM11BR __SYSREG(0xd400309e, u16) /* timer 11 base register */ -#if defined(CONFIG_AM34_2) -#define TM12BR __SYSREG(0xd4003190, u16) /* timer 12 base register */ -#define TM13BR __SYSREG(0xd4003192, u16) /* timer 13 base register */ -#define TM14BR __SYSREG(0xd4003194, u16) /* timer 14 base register */ -#define TM15BR __SYSREG(0xd4003196, u16) /* timer 15 base register */ -#endif /* CONFIG_AM34_2 */ - -#define TM4BC __SYSREG(0xd40030a0, u16) /* timer 4 binary counter */ -#define TM5BC __SYSREG(0xd40030a2, u16) /* timer 5 binary counter */ -#define TM45BC __SYSREG(0xd40030a0, u32) /* timer 4:5 binary counter */ -#define TM7BC __SYSREG(0xd40030a6, u16) /* timer 7 binary counter */ -#define TM8BC __SYSREG(0xd40030a8, u16) /* timer 8 binary counter */ -#define TM9BC __SYSREG(0xd40030aa, u16) /* timer 9 binary counter */ -#define TM89BC __SYSREG(0xd40030a8, u32) /* timer 8:9 binary counter */ -#define TM10BC __SYSREG(0xd40030ac, u16) /* timer 10 binary counter */ -#define TM11BC __SYSREG(0xd40030ae, u16) /* timer 11 binary counter */ -#if defined(CONFIG_AM34_2) -#define TM12BC __SYSREG(0xd40031a0, u16) /* timer 12 binary counter */ -#define TM13BC __SYSREG(0xd40031a2, u16) /* timer 13 binary counter */ -#define TM14BC __SYSREG(0xd40031a4, u16) /* timer 14 binary counter */ -#define TM15BC __SYSREG(0xd40031a6, u16) /* timer 15 binary counter */ -#endif /* CONFIG_AM34_2 */ - -#define TM4IRQ 6 /* timer 4 IRQ */ -#define TM5IRQ 7 /* timer 5 IRQ */ -#define TM7IRQ 11 /* timer 7 IRQ */ -#define TM8IRQ 12 /* timer 8 IRQ */ -#define TM9IRQ 13 /* timer 9 IRQ */ -#define TM10IRQ 14 /* timer 10 IRQ */ -#define TM11IRQ 15 /* timer 11 IRQ */ -#if defined(CONFIG_AM34_2) -#define TM12IRQ 64 /* timer 12 IRQ */ -#define TM13IRQ 65 /* timer 13 IRQ */ -#define TM14IRQ 66 /* timer 14 IRQ */ -#define TM15IRQ 67 /* timer 15 IRQ */ -#endif /* CONFIG_AM34_2 */ - -#define TM4ICR GxICR(TM4IRQ) /* timer 4 uflow intr ctrl reg */ -#define TM5ICR GxICR(TM5IRQ) /* timer 5 uflow intr ctrl reg */ -#define TM7ICR GxICR(TM7IRQ) /* timer 7 uflow intr ctrl reg */ -#define TM8ICR GxICR(TM8IRQ) /* timer 8 uflow intr ctrl reg */ -#define TM9ICR GxICR(TM9IRQ) /* timer 9 uflow intr ctrl reg */ -#define TM10ICR GxICR(TM10IRQ) /* timer 10 uflow intr ctrl reg */ -#define TM11ICR GxICR(TM11IRQ) /* timer 11 uflow intr ctrl reg */ -#if defined(CONFIG_AM34_2) -#define TM12ICR GxICR(TM12IRQ) /* timer 12 uflow intr ctrl reg */ -#define TM13ICR GxICR(TM13IRQ) /* timer 13 uflow intr ctrl reg */ -#define TM14ICR GxICR(TM14IRQ) /* timer 14 uflow intr ctrl reg */ -#define TM15ICR GxICR(TM15IRQ) /* timer 15 uflow intr ctrl reg */ -#endif /* CONFIG_AM34_2 */ - -/* - * 16-bit timer 6 - */ -#define TM6MD __SYSREG(0xd4003084, u16) /* timer6 mode register */ -#define TM6MD_SRC 0x0007 /* timer source */ -#define TM6MD_SRC_IOCLK 0x0000 /* - IOCLK */ -#define TM6MD_SRC_IOCLK_8 0x0001 /* - 1/8 IOCLK */ -#define TM6MD_SRC_IOCLK_32 0x0002 /* - 1/32 IOCLK */ -#define TM6MD_SRC_TM0UFLOW 0x0004 /* - timer 0 underflow */ -#define TM6MD_SRC_TM1UFLOW 0x0005 /* - timer 1 underflow */ -#define TM6MD_SRC_TM2UFLOW 0x0006 /* - timer 2 underflow */ -#if defined(CONFIG_AM33_2) -/* #define TM6MD_SRC_TM6IOB_BOTH 0x0006 */ /* - TM6IOB pin input (both edges) */ -#define TM6MD_SRC_TM6IOB_SINGLE 0x0007 /* - TM6IOB pin input (single edge) */ -#endif /* CONFIG_AM33_2 */ -#define TM6MD_ONESHOT_ENABLE 0x0040 /* oneshot count */ -#define TM6MD_CLR_ENABLE 0x0010 /* clear count enable */ -#if defined(CONFIG_AM33_2) -#define TM6MD_TRIG_ENABLE 0x0080 /* TM6IOB pin trigger enable */ -#define TM6MD_PWM 0x3800 /* PWM output mode */ -#define TM6MD_PWM_DIS 0x0000 /* - disabled */ -#define TM6MD_PWM_10BIT 0x1000 /* - 10 bits mode */ -#define TM6MD_PWM_11BIT 0x1800 /* - 11 bits mode */ -#define TM6MD_PWM_12BIT 0x3000 /* - 12 bits mode */ -#define TM6MD_PWM_14BIT 0x3800 /* - 14 bits mode */ -#endif /* CONFIG_AM33_2 */ - -#define TM6MD_INIT_COUNTER 0x4000 /* initialize TMnBC to zero */ -#define TM6MD_COUNT_ENABLE 0x8000 /* timer count enable */ - -#define TM6MDA __SYSREG(0xd40030b4, u8) /* timer6 cmp/cap A mode reg */ -#define TM6MDA_MODE_CMP_SINGLE 0x00 /* - compare, single buffer mode */ -#define TM6MDA_MODE_CMP_DOUBLE 0x40 /* - compare, double buffer mode */ -#if defined(CONFIG_AM33_2) -#define TM6MDA_OUT 0x07 /* output select */ -#define TM6MDA_OUT_SETA_RESETB 0x00 /* - set at match A, reset at match B */ -#define TM6MDA_OUT_SETA_RESETOV 0x01 /* - set at match A, reset at overflow */ -#define TM6MDA_OUT_SETA 0x02 /* - set at match A */ -#define TM6MDA_OUT_RESETA 0x03 /* - reset at match A */ -#define TM6MDA_OUT_TOGGLE 0x04 /* - toggle on match A */ -#define TM6MDA_MODE 0xc0 /* compare A register mode */ -#define TM6MDA_MODE_CAP_S_EDGE 0x80 /* - capture, single edge mode */ -#define TM6MDA_MODE_CAP_D_EDGE 0xc0 /* - capture, double edge mode */ -#define TM6MDA_EDGE 0x20 /* compare A edge select */ -#define TM6MDA_EDGE_FALLING 0x00 /* capture on falling edge */ -#define TM6MDA_EDGE_RISING 0x20 /* capture on rising edge */ -#define TM6MDA_CAPTURE_ENABLE 0x10 /* capture enable */ -#else /* !CONFIG_AM33_2 */ -#define TM6MDA_MODE 0x40 /* compare A register mode */ -#endif /* CONFIG_AM33_2 */ - -#define TM6MDB __SYSREG(0xd40030b5, u8) /* timer6 cmp/cap B mode reg */ -#define TM6MDB_MODE_CMP_SINGLE 0x00 /* - compare, single buffer mode */ -#define TM6MDB_MODE_CMP_DOUBLE 0x40 /* - compare, double buffer mode */ -#if defined(CONFIG_AM33_2) -#define TM6MDB_OUT 0x07 /* output select */ -#define TM6MDB_OUT_SETB_RESETA 0x00 /* - set at match B, reset at match A */ -#define TM6MDB_OUT_SETB_RESETOV 0x01 /* - set at match B */ -#define TM6MDB_OUT_RESETB 0x03 /* - reset at match B */ -#define TM6MDB_OUT_TOGGLE 0x04 /* - toggle on match B */ -#define TM6MDB_MODE 0xc0 /* compare B register mode */ -#define TM6MDB_MODE_CAP_S_EDGE 0x80 /* - capture, single edge mode */ -#define TM6MDB_MODE_CAP_D_EDGE 0xc0 /* - capture, double edge mode */ -#define TM6MDB_EDGE 0x20 /* compare B edge select */ -#define TM6MDB_EDGE_FALLING 0x00 /* capture on falling edge */ -#define TM6MDB_EDGE_RISING 0x20 /* capture on rising edge */ -#define TM6MDB_CAPTURE_ENABLE 0x10 /* capture enable */ -#else /* !CONFIG_AM33_2 */ -#define TM6MDB_MODE 0x40 /* compare B register mode */ -#endif /* CONFIG_AM33_2 */ - -#define TM6CA __SYSREG(0xd40030c4, u16) /* timer6 cmp/capture reg A */ -#define TM6CB __SYSREG(0xd40030d4, u16) /* timer6 cmp/capture reg B */ -#define TM6BC __SYSREG(0xd40030a4, u16) /* timer6 binary counter */ - -#define TM6IRQ 6 /* timer 6 IRQ */ -#define TM6AIRQ 9 /* timer 6A IRQ */ -#define TM6BIRQ 10 /* timer 6B IRQ */ - -#define TM6ICR GxICR(TM6IRQ) /* timer 6 uflow intr ctrl reg */ -#define TM6AICR GxICR(TM6AIRQ) /* timer 6A intr control reg */ -#define TM6BICR GxICR(TM6BIRQ) /* timer 6B intr control reg */ - -#if defined(CONFIG_AM34_2) -/* - * MTM: OS Tick-Timer - */ -#define TMTMD __SYSREG(0xd4004100, u8) /* Tick Timer mode register */ -#define TMTMD_TMTLDE 0x40 /* initialize TMTBC = TMTBR */ -#define TMTMD_TMTCNE 0x80 /* timer count enable */ - -#define TMTBR __SYSREG(0xd4004110, u32) /* Tick Timer mode reg */ -#define TMTBC __SYSREG(0xd4004120, u32) /* Tick Timer mode reg */ - -/* - * MTM: OS Timestamp-Timer - */ -#define TMSMD __SYSREG(0xd4004140, u8) /* Tick Timer mode register */ -#define TMSMD_TMSLDE 0x40 /* initialize TMSBC = TMSBR */ -#define TMSMD_TMSCNE 0x80 /* timer count enable */ - -#define TMSBR __SYSREG(0xd4004150, u32) /* Tick Timer mode register */ -#define TMSBC __SYSREG(0xd4004160, u32) /* Tick Timer mode register */ - -#define TMTIRQ 119 /* OS Tick timer IRQ */ -#define TMSIRQ 120 /* Timestamp timer IRQ */ - -#define TMTICR GxICR(TMTIRQ) /* OS Tick timer uflow intr ctrl reg */ -#define TMSICR GxICR(TMSIRQ) /* Timestamp timer uflow intr ctrl reg */ -#endif /* CONFIG_AM34_2 */ - -#endif /* __KERNEL__ */ - -#endif /* _ASM_TIMER_REGS_H */ diff --git a/arch/mn10300/include/asm/timex.h b/arch/mn10300/include/asm/timex.h deleted file mode 100644 index f8e66425cbf82..0000000000000 --- a/arch/mn10300/include/asm/timex.h +++ /dev/null @@ -1,34 +0,0 @@ -/* MN10300 Architecture time management specifications - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_TIMEX_H -#define _ASM_TIMEX_H - -#include - -#define TICK_SIZE (tick_nsec / 1000) - -#define CLOCK_TICK_RATE MN10300_JCCLK /* Underlying HZ */ - -#ifdef __KERNEL__ - -extern cycles_t cacheflush_time; - -static inline cycles_t get_cycles(void) -{ - return read_timestamp_counter(); -} - -extern int init_clockevents(void); -extern int init_clocksource(void); - -#endif /* __KERNEL__ */ - -#endif /* _ASM_TIMEX_H */ diff --git a/arch/mn10300/include/asm/tlb.h b/arch/mn10300/include/asm/tlb.h deleted file mode 100644 index 65d232b966139..0000000000000 --- a/arch/mn10300/include/asm/tlb.h +++ /dev/null @@ -1,34 +0,0 @@ -/* MN10300 TLB definitions - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - -#ifndef _ASM_TLB_H -#define _ASM_TLB_H - -#include - -extern void check_pgt_cache(void); - -/* - * we don't need any special per-pte or per-vma handling... - */ -#define tlb_start_vma(tlb, vma) do { } while (0) -#define tlb_end_vma(tlb, vma) do { } while (0) -#define __tlb_remove_tlb_entry(tlb, ptep, address) do { } while (0) - -/* - * .. because we flush the whole mm when it fills up - */ -#define tlb_flush(tlb) flush_tlb_mm((tlb)->mm) - -/* for now, just use the generic stuff */ -#include - -#endif /* _ASM_TLB_H */ diff --git a/arch/mn10300/include/asm/tlbflush.h b/arch/mn10300/include/asm/tlbflush.h deleted file mode 100644 index efddd6e1adead..0000000000000 --- a/arch/mn10300/include/asm/tlbflush.h +++ /dev/null @@ -1,154 +0,0 @@ -/* MN10300 TLB flushing functions - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_TLBFLUSH_H -#define _ASM_TLBFLUSH_H - -#include -#include - -struct tlb_state { - struct mm_struct *active_mm; - int state; -}; -DECLARE_PER_CPU_SHARED_ALIGNED(struct tlb_state, cpu_tlbstate); - -/** - * local_flush_tlb - Flush the current MM's entries from the local CPU's TLBs - */ -static inline void local_flush_tlb(void) -{ - int w; - asm volatile( - " mov %1,%0 \n" - " or %2,%0 \n" - " mov %0,%1 \n" - : "=d"(w) - : "m"(MMUCTR), "i"(MMUCTR_IIV|MMUCTR_DIV) - : "cc", "memory"); -} - -/** - * local_flush_tlb_all - Flush all entries from the local CPU's TLBs - */ -static inline void local_flush_tlb_all(void) -{ - local_flush_tlb(); -} - -/** - * local_flush_tlb_one - Flush one entry from the local CPU's TLBs - */ -static inline void local_flush_tlb_one(unsigned long addr) -{ - local_flush_tlb(); -} - -/** - * local_flush_tlb_page - Flush a page's entry from the local CPU's TLBs - * @mm: The MM to flush for - * @addr: The address of the target page in RAM (not its page struct) - */ -static inline -void local_flush_tlb_page(struct mm_struct *mm, unsigned long addr) -{ - unsigned long pteu, flags, cnx; - - addr &= PAGE_MASK; - - local_irq_save(flags); - - cnx = 1; -#ifdef CONFIG_MN10300_TLB_USE_PIDR - cnx = mm->context.tlbpid[smp_processor_id()]; -#endif - if (cnx) { - pteu = addr; -#ifdef CONFIG_MN10300_TLB_USE_PIDR - pteu |= cnx & xPTEU_PID; -#endif - IPTEU = pteu; - DPTEU = pteu; - if (IPTEL & xPTEL_V) - IPTEL = 0; - if (DPTEL & xPTEL_V) - DPTEL = 0; - } - local_irq_restore(flags); -} - -/* - * TLB flushing: - * - * - flush_tlb() flushes the current mm struct TLBs - * - flush_tlb_all() flushes all processes TLBs - * - flush_tlb_mm(mm) flushes the specified mm context TLB's - * - flush_tlb_page(vma, vmaddr) flushes one page - * - flush_tlb_range(mm, start, end) flushes a range of pages - * - flush_tlb_pgtables(mm, start, end) flushes a range of page tables - */ -#ifdef CONFIG_SMP - -#include - -extern void flush_tlb_all(void); -extern void flush_tlb_current_task(void); -extern void flush_tlb_mm(struct mm_struct *); -extern void flush_tlb_page(struct vm_area_struct *, unsigned long); - -#define flush_tlb() flush_tlb_current_task() - -static inline void flush_tlb_range(struct vm_area_struct *vma, - unsigned long start, unsigned long end) -{ - flush_tlb_mm(vma->vm_mm); -} - -#else /* CONFIG_SMP */ - -static inline void flush_tlb_all(void) -{ - preempt_disable(); - local_flush_tlb_all(); - preempt_enable(); -} - -static inline void flush_tlb_mm(struct mm_struct *mm) -{ - preempt_disable(); - local_flush_tlb_all(); - preempt_enable(); -} - -static inline void flush_tlb_range(struct vm_area_struct *vma, - unsigned long start, unsigned long end) -{ - preempt_disable(); - local_flush_tlb_all(); - preempt_enable(); -} - -#define flush_tlb_page(vma, addr) local_flush_tlb_page((vma)->vm_mm, addr) -#define flush_tlb() flush_tlb_all() - -#endif /* CONFIG_SMP */ - -static inline void flush_tlb_kernel_range(unsigned long start, - unsigned long end) -{ - flush_tlb_all(); -} - -static inline void flush_tlb_pgtables(struct mm_struct *mm, - unsigned long start, unsigned long end) -{ -} - -#endif /* _ASM_TLBFLUSH_H */ diff --git a/arch/mn10300/include/asm/topology.h b/arch/mn10300/include/asm/topology.h deleted file mode 100644 index 5428f333a02c7..0000000000000 --- a/arch/mn10300/include/asm/topology.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/arch/mn10300/include/asm/types.h b/arch/mn10300/include/asm/types.h deleted file mode 100644 index 3d6e48311beff..0000000000000 --- a/arch/mn10300/include/asm/types.h +++ /dev/null @@ -1,22 +0,0 @@ -/* MN10300 Basic type definitions - * - * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd. - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_TYPES_H -#define _ASM_TYPES_H - -#include - -/* - * These aren't exported outside the kernel to avoid name space clashes - */ - -#define BITS_PER_LONG 32 - -#endif /* _ASM_TYPES_H */ diff --git a/arch/mn10300/include/asm/uaccess.h b/arch/mn10300/include/asm/uaccess.h deleted file mode 100644 index 5af468fd13596..0000000000000 --- a/arch/mn10300/include/asm/uaccess.h +++ /dev/null @@ -1,297 +0,0 @@ -/* MN10300 userspace access functions - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_UACCESS_H -#define _ASM_UACCESS_H - -/* - * User space memory access functions - */ -#include -#include - -/* - * 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. - */ -#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) }) - -#define KERNEL_XDS MAKE_MM_SEG(0xBFFFFFFF) -#define KERNEL_DS MAKE_MM_SEG(0x9FFFFFFF) -#define USER_DS MAKE_MM_SEG(TASK_SIZE) - -#define get_ds() (KERNEL_DS) -#define get_fs() (current_thread_info()->addr_limit) -#define set_fs(x) (current_thread_info()->addr_limit = (x)) - -#define segment_eq(a, b) ((a).seg == (b).seg) - -#define __addr_ok(addr) \ - ((unsigned long)(addr) < (current_thread_info()->addr_limit.seg)) - -/* - * check that a range of addresses falls within the current address limit - */ -static inline int ___range_ok(unsigned long addr, unsigned int size) -{ - int flag = 1, tmp; - - asm(" add %3,%1 \n" /* set C-flag if addr + size > 4Gb */ - " bcs 0f \n" - " cmp %4,%1 \n" /* jump if addr+size>limit (error) */ - " bhi 0f \n" - " clr %0 \n" /* mark okay */ - "0: \n" - : "=r"(flag), "=&r"(tmp) - : "1"(addr), "ir"(size), - "r"(current_thread_info()->addr_limit.seg), "0"(flag) - : "cc" - ); - - return flag; -} - -#define __range_ok(addr, size) ___range_ok((unsigned long)(addr), (u32)(size)) - -#define access_ok(type, addr, size) (__range_ok((addr), (size)) == 0) -#define __access_ok(addr, size) (__range_ok((addr), (size)) == 0) - -#include - -#define put_user(x, ptr) __put_user_check((x), (ptr), sizeof(*(ptr))) -#define get_user(x, ptr) __get_user_check((x), (ptr), sizeof(*(ptr))) - -/* - * The "__xxx" versions do not do address space checking, useful when - * doing multiple accesses to the same area (the user has to do the - * checks by hand with "access_ok()") - */ -#define __put_user(x, ptr) __put_user_nocheck((x), (ptr), sizeof(*(ptr))) -#define __get_user(x, ptr) __get_user_nocheck((x), (ptr), sizeof(*(ptr))) - -struct __large_struct { unsigned long buf[100]; }; -#define __m(x) (*(struct __large_struct *)(x)) - -#define __get_user_nocheck(x, ptr, size) \ -({ \ - unsigned long __gu_addr; \ - int __gu_err; \ - __gu_addr = (unsigned long) (ptr); \ - switch (size) { \ - case 1: { \ - unsigned char __gu_val; \ - __get_user_asm("bu"); \ - (x) = *(__force __typeof__(*(ptr))*) &__gu_val; \ - break; \ - } \ - case 2: { \ - unsigned short __gu_val; \ - __get_user_asm("hu"); \ - (x) = *(__force __typeof__(*(ptr))*) &__gu_val; \ - break; \ - } \ - case 4: { \ - unsigned int __gu_val; \ - __get_user_asm(""); \ - (x) = *(__force __typeof__(*(ptr))*) &__gu_val; \ - break; \ - } \ - default: \ - __get_user_unknown(); \ - break; \ - } \ - __gu_err; \ -}) - -#define __get_user_check(x, ptr, size) \ -({ \ - const __typeof__(*(ptr))* __guc_ptr = (ptr); \ - int _e; \ - if (likely(__access_ok((unsigned long) __guc_ptr, (size)))) \ - _e = __get_user_nocheck((x), __guc_ptr, (size)); \ - else { \ - _e = -EFAULT; \ - (x) = (__typeof__(x))0; \ - } \ - _e; \ -}) - -#define __get_user_asm(INSN) \ -({ \ - asm volatile( \ - "1:\n" \ - " mov"INSN" %2,%1\n" \ - " mov 0,%0\n" \ - "2:\n" \ - " .section .fixup,\"ax\"\n" \ - "3:\n\t" \ - " mov 0,%1\n" \ - " mov %3,%0\n" \ - " jmp 2b\n" \ - " .previous\n" \ - " .section __ex_table,\"a\"\n" \ - " .balign 4\n" \ - " .long 1b, 3b\n" \ - " .previous" \ - : "=&r" (__gu_err), "=&r" (__gu_val) \ - : "m" (__m(__gu_addr)), "i" (-EFAULT)); \ -}) - -extern int __get_user_unknown(void); - -#define __put_user_nocheck(x, ptr, size) \ -({ \ - union { \ - __typeof__(*(ptr)) val; \ - u32 bits[2]; \ - } __pu_val; \ - unsigned long __pu_addr; \ - int __pu_err; \ - __pu_val.val = (x); \ - __pu_addr = (unsigned long) (ptr); \ - switch (size) { \ - case 1: __put_user_asm("bu"); break; \ - case 2: __put_user_asm("hu"); break; \ - case 4: __put_user_asm("" ); break; \ - case 8: __put_user_asm8(); break; \ - default: __pu_err = __put_user_unknown(); break; \ - } \ - __pu_err; \ -}) - -#define __put_user_check(x, ptr, size) \ -({ \ - union { \ - __typeof__(*(ptr)) val; \ - u32 bits[2]; \ - } __pu_val; \ - unsigned long __pu_addr; \ - int __pu_err; \ - __pu_val.val = (x); \ - __pu_addr = (unsigned long) (ptr); \ - if (likely(__access_ok(__pu_addr, size))) { \ - switch (size) { \ - case 1: __put_user_asm("bu"); break; \ - case 2: __put_user_asm("hu"); break; \ - case 4: __put_user_asm("" ); break; \ - case 8: __put_user_asm8(); break; \ - default: __pu_err = __put_user_unknown(); break; \ - } \ - } \ - else { \ - __pu_err = -EFAULT; \ - } \ - __pu_err; \ -}) - -#define __put_user_asm(INSN) \ -({ \ - asm volatile( \ - "1:\n" \ - " mov"INSN" %1,%2\n" \ - " mov 0,%0\n" \ - "2:\n" \ - " .section .fixup,\"ax\"\n" \ - "3:\n" \ - " mov %3,%0\n" \ - " jmp 2b\n" \ - " .previous\n" \ - " .section __ex_table,\"a\"\n" \ - " .balign 4\n" \ - " .long 1b, 3b\n" \ - " .previous" \ - : "=&r" (__pu_err) \ - : "r" (__pu_val.val), "m" (__m(__pu_addr)), \ - "i" (-EFAULT) \ - ); \ -}) - -#define __put_user_asm8() \ -({ \ - asm volatile( \ - "1: mov %1,%3 \n" \ - "2: mov %2,%4 \n" \ - " mov 0,%0 \n" \ - "3: \n" \ - " .section .fixup,\"ax\" \n" \ - "4: \n" \ - " mov %5,%0 \n" \ - " jmp 3b \n" \ - " .previous \n" \ - " .section __ex_table,\"a\"\n" \ - " .balign 4 \n" \ - " .long 1b, 4b \n" \ - " .long 2b, 4b \n" \ - " .previous \n" \ - : "=&r" (__pu_err) \ - : "r" (__pu_val.bits[0]), "r" (__pu_val.bits[1]), \ - "m" (__m(__pu_addr)), "m" (__m(__pu_addr+4)), \ - "i" (-EFAULT) \ - ); \ -}) - -extern int __put_user_unknown(void); - - -/* - * Copy To/From Userspace - */ -/* Generic arbitrary sized copy. */ -#define __copy_user(to, from, size) \ -do { \ - if (size) { \ - void *__to = to; \ - const void *__from = from; \ - int w; \ - asm volatile( \ - "0: movbu (%0),%3;\n" \ - "1: movbu %3,(%1);\n" \ - " inc %0;\n" \ - " inc %1;\n" \ - " add -1,%2;\n" \ - " bne 0b;\n" \ - "2:\n" \ - " .section .fixup,\"ax\"\n" \ - "3: jmp 2b\n" \ - " .previous\n" \ - " .section __ex_table,\"a\"\n" \ - " .balign 4\n" \ - " .long 0b,3b\n" \ - " .long 1b,3b\n" \ - " .previous\n" \ - : "=a"(__from), "=a"(__to), "=r"(size), "=&r"(w)\ - : "0"(__from), "1"(__to), "2"(size) \ - : "cc", "memory"); \ - } \ -} while (0) - -static inline unsigned long -raw_copy_from_user(void *to, const void __user *from, unsigned long n) -{ - __copy_user(to, from, n); - return n; -} - -static inline unsigned long -raw_copy_to_user(void __user *to, const void *from, unsigned long n) -{ - __copy_user(to, from, n); - return n; -} - -extern long strncpy_from_user(char *dst, const char __user *src, long count); -extern long strnlen_user(const char __user *str, long n); -extern unsigned long clear_user(void __user *mem, unsigned long len); -extern unsigned long __clear_user(void __user *mem, unsigned long len); - -#endif /* _ASM_UACCESS_H */ diff --git a/arch/mn10300/include/asm/ucontext.h b/arch/mn10300/include/asm/ucontext.h deleted file mode 100644 index fcab5c1d8e183..0000000000000 --- a/arch/mn10300/include/asm/ucontext.h +++ /dev/null @@ -1,22 +0,0 @@ -/* MN10300 User context - * - * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd. - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_UCONTEXT_H -#define _ASM_UCONTEXT_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_UCONTEXT_H */ diff --git a/arch/mn10300/include/asm/unaligned.h b/arch/mn10300/include/asm/unaligned.h deleted file mode 100644 index 0df671318ae49..0000000000000 --- a/arch/mn10300/include/asm/unaligned.h +++ /dev/null @@ -1,20 +0,0 @@ -/* MN10300 Unaligned memory access handling - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_MN10300_UNALIGNED_H -#define _ASM_MN10300_UNALIGNED_H - -#include -#include - -#define get_unaligned __get_unaligned_le -#define put_unaligned __put_unaligned_le - -#endif /* _ASM_MN10300_UNALIGNED_H */ diff --git a/arch/mn10300/include/asm/unistd.h b/arch/mn10300/include/asm/unistd.h deleted file mode 100644 index 0522468f488b7..0000000000000 --- a/arch/mn10300/include/asm/unistd.h +++ /dev/null @@ -1,47 +0,0 @@ -/* MN10300 System call number list - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_UNISTD_H -#define _ASM_UNISTD_H - -#include - - -#define NR_syscalls 340 - -/* - * specify the deprecated syscalls we want to support on this arch - */ -#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_IPC -#define __ARCH_WANT_SYS_PAUSE -#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_OLD_SELECT -#define __ARCH_WANT_SYS_OLDUMOUNT -#define __ARCH_WANT_SYS_SIGPENDING -#define __ARCH_WANT_SYS_SIGPROCMASK -#define __ARCH_WANT_SYS_FORK -#define __ARCH_WANT_SYS_VFORK -#define __ARCH_WANT_SYS_CLONE - -#endif /* _ASM_UNISTD_H */ diff --git a/arch/mn10300/include/asm/user.h b/arch/mn10300/include/asm/user.h deleted file mode 100644 index e1193908b78c6..0000000000000 --- a/arch/mn10300/include/asm/user.h +++ /dev/null @@ -1,53 +0,0 @@ -/* MN10300 User process data - * - * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd. - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_USER_H -#define _ASM_USER_H - -#include -#include - -#ifndef __ASSEMBLY__ -/* - * When the kernel dumps core, it starts by dumping the user struct - this will - * be used by gdb to figure out where the data and stack segments are within - * the file, and what virtual addresses to use. - */ -struct user { - /* We start with the registers, to mimic the way that "memory" is - * returned from the ptrace(3,...) function. - */ - struct pt_regs regs; /* Where the registers are actually stored */ - - /* The rest of this junk is to help gdb figure out what goes where */ - unsigned long int u_tsize; /* Text segment size (pages). */ - unsigned long int u_dsize; /* Data segment size (pages). */ - unsigned long int u_ssize; /* Stack segment size (pages). */ - unsigned long start_code; /* Starting virtual address of text. */ - unsigned long start_stack; /* Starting virtual address of stack area. - This is actually the bottom of the stack, - the top of the stack is always found in the - esp register. */ - long int signal; /* Signal that caused the core dump. */ - int reserved; /* No longer used */ - struct user_pt_regs *u_ar0; /* Used by gdb to help find the values for */ - - /* the registers */ - unsigned long magic; /* To uniquely identify a core file */ - char u_comm[32]; /* User command that was responsible */ -}; -#endif - -#define NBPG PAGE_SIZE -#define UPAGES 1 -#define HOST_TEXT_START_ADDR +(u.start_code) -#define HOST_STACK_END_ADDR +(u.start_stack + u.u_ssize * NBPG) - -#endif /* _ASM_USER_H */ diff --git a/arch/mn10300/include/asm/vga.h b/arch/mn10300/include/asm/vga.h deleted file mode 100644 index 0163e50a34590..0000000000000 --- a/arch/mn10300/include/asm/vga.h +++ /dev/null @@ -1,17 +0,0 @@ -/* MN10300 VGA register definitions - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - -#ifndef _ASM_VGA_H -#define _ASM_VGA_H - - - -#endif /* _ASM_VGA_H */ diff --git a/arch/mn10300/include/asm/xor.h b/arch/mn10300/include/asm/xor.h deleted file mode 100644 index c82eb12a5b181..0000000000000 --- a/arch/mn10300/include/asm/xor.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/arch/mn10300/include/uapi/asm/Kbuild b/arch/mn10300/include/uapi/asm/Kbuild deleted file mode 100644 index b04fd1632051d..0000000000000 --- a/arch/mn10300/include/uapi/asm/Kbuild +++ /dev/null @@ -1,6 +0,0 @@ -# UAPI Header export list -include include/uapi/asm-generic/Kbuild.asm - -generic-y += bpf_perf_event.h -generic-y += poll.h -generic-y += siginfo.h diff --git a/arch/mn10300/include/uapi/asm/auxvec.h b/arch/mn10300/include/uapi/asm/auxvec.h deleted file mode 100644 index 4fdb60b2ae39c..0000000000000 --- a/arch/mn10300/include/uapi/asm/auxvec.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef _ASM_AUXVEC_H -#define _ASM_AUXVEC_H - -#endif diff --git a/arch/mn10300/include/uapi/asm/bitsperlong.h b/arch/mn10300/include/uapi/asm/bitsperlong.h deleted file mode 100644 index 76da34b10f598..0000000000000 --- a/arch/mn10300/include/uapi/asm/bitsperlong.h +++ /dev/null @@ -1,2 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#include diff --git a/arch/mn10300/include/uapi/asm/byteorder.h b/arch/mn10300/include/uapi/asm/byteorder.h deleted file mode 100644 index 3467df91216c9..0000000000000 --- a/arch/mn10300/include/uapi/asm/byteorder.h +++ /dev/null @@ -1,7 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _ASM_BYTEORDER_H -#define _ASM_BYTEORDER_H - -#include - -#endif /* _ASM_BYTEORDER_H */ diff --git a/arch/mn10300/include/uapi/asm/errno.h b/arch/mn10300/include/uapi/asm/errno.h deleted file mode 100644 index 9addba5926463..0000000000000 --- a/arch/mn10300/include/uapi/asm/errno.h +++ /dev/null @@ -1,2 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#include diff --git a/arch/mn10300/include/uapi/asm/fcntl.h b/arch/mn10300/include/uapi/asm/fcntl.h deleted file mode 100644 index a77648c505d17..0000000000000 --- a/arch/mn10300/include/uapi/asm/fcntl.h +++ /dev/null @@ -1,2 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#include diff --git a/arch/mn10300/include/uapi/asm/ioctl.h b/arch/mn10300/include/uapi/asm/ioctl.h deleted file mode 100644 index b809c4566e5f8..0000000000000 --- a/arch/mn10300/include/uapi/asm/ioctl.h +++ /dev/null @@ -1,2 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#include diff --git a/arch/mn10300/include/uapi/asm/ioctls.h b/arch/mn10300/include/uapi/asm/ioctls.h deleted file mode 100644 index 0955d4f854e99..0000000000000 --- a/arch/mn10300/include/uapi/asm/ioctls.h +++ /dev/null @@ -1,7 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _ASM_IOCTLS_H -#define _ASM_IOCTLS_H - -#include - -#endif /* _ASM_IOCTLS_H */ diff --git a/arch/mn10300/include/uapi/asm/ipcbuf.h b/arch/mn10300/include/uapi/asm/ipcbuf.h deleted file mode 100644 index 90d6445a14df8..0000000000000 --- a/arch/mn10300/include/uapi/asm/ipcbuf.h +++ /dev/null @@ -1,2 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#include diff --git a/arch/mn10300/include/uapi/asm/kvm_para.h b/arch/mn10300/include/uapi/asm/kvm_para.h deleted file mode 100644 index baacc4996d18e..0000000000000 --- a/arch/mn10300/include/uapi/asm/kvm_para.h +++ /dev/null @@ -1,2 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#include diff --git a/arch/mn10300/include/uapi/asm/mman.h b/arch/mn10300/include/uapi/asm/mman.h deleted file mode 100644 index eb7f4798c0366..0000000000000 --- a/arch/mn10300/include/uapi/asm/mman.h +++ /dev/null @@ -1,7 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#include - -#define MIN_MAP_ADDR PAGE_SIZE /* minimum fixed mmap address */ - -#define arch_mmap_check(addr, len, flags) \ - (((flags) & MAP_FIXED && (addr) < MIN_MAP_ADDR) ? -EINVAL : 0) diff --git a/arch/mn10300/include/uapi/asm/msgbuf.h b/arch/mn10300/include/uapi/asm/msgbuf.h deleted file mode 100644 index 5982def83355d..0000000000000 --- a/arch/mn10300/include/uapi/asm/msgbuf.h +++ /dev/null @@ -1,32 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _ASM_MSGBUF_H -#define _ASM_MSGBUF_H - -/* - * The msqid64_ds structure for MN10300 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_MSGBUF_H */ diff --git a/arch/mn10300/include/uapi/asm/param.h b/arch/mn10300/include/uapi/asm/param.h deleted file mode 100644 index e0020d7742bde..0000000000000 --- a/arch/mn10300/include/uapi/asm/param.h +++ /dev/null @@ -1,19 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ -/* MN10300 Kernel parameters - * - * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd. - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_PARAM_H -#define _ASM_PARAM_H - -#include - -#define COMMAND_LINE_SIZE 256 - -#endif /* _ASM_PARAM_H */ diff --git a/arch/mn10300/include/uapi/asm/posix_types.h b/arch/mn10300/include/uapi/asm/posix_types.h deleted file mode 100644 index 6b4cfc7136e9f..0000000000000 --- a/arch/mn10300/include/uapi/asm/posix_types.h +++ /dev/null @@ -1,46 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ -/* MN10300 POSIX types - * - * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd. - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_POSIX_TYPES_H -#define _ASM_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 short __kernel_mode_t; -#define __kernel_mode_t __kernel_mode_t - -typedef unsigned short __kernel_ipc_pid_t; -#define __kernel_ipc_pid_t __kernel_ipc_pid_t - -typedef unsigned short __kernel_uid_t; -typedef unsigned short __kernel_gid_t; -#define __kernel_uid_t __kernel_uid_t - -#if __GNUC__ == 4 -typedef unsigned int __kernel_size_t; -typedef signed int __kernel_ssize_t; -#else -typedef unsigned long __kernel_size_t; -typedef signed long __kernel_ssize_t; -#endif -typedef int __kernel_ptrdiff_t; -#define __kernel_size_t __kernel_size_t - -typedef unsigned short __kernel_old_dev_t; -#define __kernel_old_dev_t __kernel_old_dev_t - -#include - -#endif /* _ASM_POSIX_TYPES_H */ diff --git a/arch/mn10300/include/uapi/asm/ptrace.h b/arch/mn10300/include/uapi/asm/ptrace.h deleted file mode 100644 index f485c481a2661..0000000000000 --- a/arch/mn10300/include/uapi/asm/ptrace.h +++ /dev/null @@ -1,85 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ -/* MN10300 Exception frame layout and ptrace constants - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _UAPI_ASM_PTRACE_H -#define _UAPI_ASM_PTRACE_H - -#define PT_A3 0 -#define PT_A2 1 -#define PT_D3 2 -#define PT_D2 3 -#define PT_MCVF 4 -#define PT_MCRL 5 -#define PT_MCRH 6 -#define PT_MDRQ 7 -#define PT_E1 8 -#define PT_E0 9 -#define PT_E7 10 -#define PT_E6 11 -#define PT_E5 12 -#define PT_E4 13 -#define PT_E3 14 -#define PT_E2 15 -#define PT_SP 16 -#define PT_LAR 17 -#define PT_LIR 18 -#define PT_MDR 19 -#define PT_A1 20 -#define PT_A0 21 -#define PT_D1 22 -#define PT_D0 23 -#define PT_ORIG_D0 24 -#define PT_EPSW 25 -#define PT_PC 26 -#define NR_PTREGS 27 - -/* - * This defines the way registers are stored in the event of an exception - * - the strange order is due to the MOVM instruction - */ -struct pt_regs { - unsigned long a3; /* syscall arg 3 */ - unsigned long a2; /* syscall arg 4 */ - unsigned long d3; /* syscall arg 5 */ - unsigned long d2; /* syscall arg 6 */ - unsigned long mcvf; - unsigned long mcrl; - unsigned long mcrh; - unsigned long mdrq; - unsigned long e1; - unsigned long e0; - unsigned long e7; - unsigned long e6; - unsigned long e5; - unsigned long e4; - unsigned long e3; - unsigned long e2; - unsigned long sp; - unsigned long lar; - unsigned long lir; - unsigned long mdr; - unsigned long a1; - unsigned long a0; /* syscall arg 1 */ - unsigned long d1; /* syscall arg 2 */ - unsigned long d0; /* syscall ret */ - struct pt_regs *next; /* next frame pointer */ - unsigned long orig_d0; /* syscall number */ - unsigned long epsw; - unsigned long pc; -}; - -/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */ -#define PTRACE_GETREGS 12 -#define PTRACE_SETREGS 13 -#define PTRACE_GETFPREGS 14 -#define PTRACE_SETFPREGS 15 - -#endif /* _UAPI_ASM_PTRACE_H */ diff --git a/arch/mn10300/include/uapi/asm/resource.h b/arch/mn10300/include/uapi/asm/resource.h deleted file mode 100644 index 49a81fbab43d9..0000000000000 --- a/arch/mn10300/include/uapi/asm/resource.h +++ /dev/null @@ -1,2 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#include diff --git a/arch/mn10300/include/uapi/asm/sembuf.h b/arch/mn10300/include/uapi/asm/sembuf.h deleted file mode 100644 index ef44c42c7e0f3..0000000000000 --- a/arch/mn10300/include/uapi/asm/sembuf.h +++ /dev/null @@ -1,26 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _ASM_SEMBUF_H -#define _ASM_SEMBUF_H - -/* - * The semid64_ds structure for MN10300 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_SEMBUF_H */ diff --git a/arch/mn10300/include/uapi/asm/setup.h b/arch/mn10300/include/uapi/asm/setup.h deleted file mode 100644 index 043dd4b920263..0000000000000 --- a/arch/mn10300/include/uapi/asm/setup.h +++ /dev/null @@ -1,5 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -/* - * There isn't anything here anymore, but the file must not be empty or patch - * will delete it. - */ diff --git a/arch/mn10300/include/uapi/asm/shmbuf.h b/arch/mn10300/include/uapi/asm/shmbuf.h deleted file mode 100644 index 6e81f74f51c64..0000000000000 --- a/arch/mn10300/include/uapi/asm/shmbuf.h +++ /dev/null @@ -1,43 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _ASM_SHMBUF_H -#define _ASM_SHMBUF_H - -/* - * The shmid64_ds structure for MN10300 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_SHMBUF_H */ diff --git a/arch/mn10300/include/uapi/asm/sigcontext.h b/arch/mn10300/include/uapi/asm/sigcontext.h deleted file mode 100644 index 1c361fabb9778..0000000000000 --- a/arch/mn10300/include/uapi/asm/sigcontext.h +++ /dev/null @@ -1,53 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ -/* MN10300 Userspace signal context - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_SIGCONTEXT_H -#define _ASM_SIGCONTEXT_H - -struct fpucontext { - /* Regular FPU environment */ - unsigned long fs[32]; /* fpu registers */ - unsigned long fpcr; /* fpu control register */ -}; - -struct sigcontext { - unsigned long d0; - unsigned long d1; - unsigned long d2; - unsigned long d3; - unsigned long a0; - unsigned long a1; - unsigned long a2; - unsigned long a3; - unsigned long e0; - unsigned long e1; - unsigned long e2; - unsigned long e3; - unsigned long e4; - unsigned long e5; - unsigned long e6; - unsigned long e7; - unsigned long lar; - unsigned long lir; - unsigned long mdr; - unsigned long mcvf; - unsigned long mcrl; - unsigned long mcrh; - unsigned long mdrq; - unsigned long sp; - unsigned long epsw; - unsigned long pc; - struct fpucontext *fpucontext; - unsigned long oldmask; -}; - - -#endif /* _ASM_SIGCONTEXT_H */ diff --git a/arch/mn10300/include/uapi/asm/signal.h b/arch/mn10300/include/uapi/asm/signal.h deleted file mode 100644 index 566cb199d5aca..0000000000000 --- a/arch/mn10300/include/uapi/asm/signal.h +++ /dev/null @@ -1,126 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ -/* MN10300 Signal definitions - * - * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd. - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _UAPI_ASM_SIGNAL_H -#define _UAPI_ASM_SIGNAL_H - -#include - -/* Avoid too many header ordering problems. */ -struct siginfo; - -#ifndef __KERNEL__ -/* Here we must cater to libcs that poke about in kernel headers. */ - -#define NSIG 32 -typedef unsigned long sigset_t; - -#endif /* __KERNEL__ */ - -#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 0x00000001U -#define SA_NOCLDWAIT 0x00000002U -#define SA_SIGINFO 0x00000004U -#define SA_ONSTACK 0x08000000U -#define SA_RESTART 0x10000000U -#define SA_NODEFER 0x40000000U -#define SA_RESETHAND 0x80000000U - -#define SA_NOMASK SA_NODEFER -#define SA_ONESHOT SA_RESETHAND - -#define SA_RESTORER 0x04000000 - -#define MINSIGSTKSZ 2048 -#define SIGSTKSZ 8192 - -#include - -#ifndef __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 __user *ss_sp; - int ss_flags; - size_t ss_size; -} stack_t; - - -#endif /* _UAPI_ASM_SIGNAL_H */ diff --git a/arch/mn10300/include/uapi/asm/socket.h b/arch/mn10300/include/uapi/asm/socket.h deleted file mode 100644 index b35eee132142f..0000000000000 --- a/arch/mn10300/include/uapi/asm/socket.h +++ /dev/null @@ -1,108 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _ASM_SOCKET_H -#define _ASM_SOCKET_H - -#include - -/* For setsockopt(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 -#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_GET_FILTER SO_ATTACH_FILTER - -#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 - -#define SO_TIMESTAMPING 37 -#define SCM_TIMESTAMPING SO_TIMESTAMPING - -#define SO_PROTOCOL 38 -#define SO_DOMAIN 39 - -#define SO_RXQ_OVFL 40 - -#define SO_WIFI_STATUS 41 -#define SCM_WIFI_STATUS SO_WIFI_STATUS -#define SO_PEEK_OFF 42 - -/* Instruct lower device to use last 4-bytes of skb data as FCS */ -#define SO_NOFCS 43 - -#define SO_LOCK_FILTER 44 - -#define SO_SELECT_ERR_QUEUE 45 - -#define SO_BUSY_POLL 46 - -#define SO_MAX_PACING_RATE 47 - -#define SO_BPF_EXTENSIONS 48 - -#define SO_INCOMING_CPU 49 - -#define SO_ATTACH_BPF 50 -#define SO_DETACH_BPF SO_DETACH_FILTER - -#define SO_ATTACH_REUSEPORT_CBPF 51 -#define SO_ATTACH_REUSEPORT_EBPF 52 - -#define SO_CNX_ADVICE 53 - -#define SCM_TIMESTAMPING_OPT_STATS 54 - -#define SO_MEMINFO 55 - -#define SO_INCOMING_NAPI_ID 56 - -#define SO_COOKIE 57 - -#define SCM_TIMESTAMPING_PKTINFO 58 - -#define SO_PEERGROUPS 59 - -#define SO_ZEROCOPY 60 - -#endif /* _ASM_SOCKET_H */ diff --git a/arch/mn10300/include/uapi/asm/sockios.h b/arch/mn10300/include/uapi/asm/sockios.h deleted file mode 100644 index 5706baa3cd0d3..0000000000000 --- a/arch/mn10300/include/uapi/asm/sockios.h +++ /dev/null @@ -1,14 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _ASM_SOCKIOS_H -#define _ASM_SOCKIOS_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 */ -#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */ - -#endif /* _ASM_SOCKIOS_H */ diff --git a/arch/mn10300/include/uapi/asm/stat.h b/arch/mn10300/include/uapi/asm/stat.h deleted file mode 100644 index 769f5f8829d4e..0000000000000 --- a/arch/mn10300/include/uapi/asm/stat.h +++ /dev/null @@ -1,79 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _ASM_STAT_H -#define _ASM_STAT_H - -struct __old_kernel_stat { - unsigned short st_dev; - unsigned short st_ino; - unsigned short st_mode; - unsigned short st_nlink; - unsigned short st_uid; - unsigned short st_gid; - unsigned short st_rdev; - unsigned long st_size; - unsigned long st_atime; - unsigned long st_mtime; - unsigned long st_ctime; -}; - -struct stat { - unsigned long st_dev; - unsigned long st_ino; - unsigned short st_mode; - unsigned short st_nlink; - unsigned short st_uid; - unsigned short st_gid; - unsigned long st_rdev; - unsigned long st_size; - unsigned long st_blksize; - unsigned long st_blocks; - 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 __unused4; - unsigned long __unused5; -}; - -/* This matches struct stat64 in glibc2.1, hence the absolutely - * insane amounts of padding around dev_t's. - */ -struct stat64 { - unsigned long long st_dev; - unsigned char __pad0[4]; - -#define STAT64_HAS_BROKEN_ST_INO 1 - unsigned long __st_ino; - - unsigned int st_mode; - unsigned int st_nlink; - - unsigned long st_uid; - unsigned long st_gid; - - unsigned long long st_rdev; - unsigned char __pad3[4]; - - long long st_size; - unsigned long st_blksize; - - unsigned long st_blocks; /* Number 512-byte blocks allocated. */ - unsigned long __pad4; /* future possible st_blocks high bits */ - - unsigned long st_atime; - unsigned long st_atime_nsec; - - unsigned long st_mtime; - unsigned int st_mtime_nsec; - - unsigned long st_ctime; - unsigned long st_ctime_nsec; - - unsigned long long st_ino; -}; - -#define STAT_HAVE_NSEC 1 - -#endif /* _ASM_STAT_H */ diff --git a/arch/mn10300/include/uapi/asm/statfs.h b/arch/mn10300/include/uapi/asm/statfs.h deleted file mode 100644 index 0b91fe198c201..0000000000000 --- a/arch/mn10300/include/uapi/asm/statfs.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/arch/mn10300/include/uapi/asm/swab.h b/arch/mn10300/include/uapi/asm/swab.h deleted file mode 100644 index d2284dd27ad46..0000000000000 --- a/arch/mn10300/include/uapi/asm/swab.h +++ /dev/null @@ -1,43 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ -/* MN10300 Byte-order primitive construction - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_SWAB_H -#define _ASM_SWAB_H - -#include - -#ifdef __GNUC__ - -static inline __attribute__((const)) -__u32 __arch_swab32(__u32 x) -{ - __u32 ret; - asm("swap %1,%0" : "=r" (ret) : "r" (x)); - return ret; -} -#define __arch_swab32 __arch_swab32 - -static inline __attribute__((const)) -__u16 __arch_swab16(__u16 x) -{ - __u16 ret; - asm("swaph %1,%0" : "=r" (ret) : "r" (x)); - return ret; -} -#define __arch_swab32 __arch_swab32 - -#if !defined(__STRICT_ANSI__) || defined(__KERNEL__) -# define __SWAB_64_THRU_32__ -#endif - -#endif /* __GNUC__ */ - -#endif /* _ASM_SWAB_H */ diff --git a/arch/mn10300/include/uapi/asm/termbits.h b/arch/mn10300/include/uapi/asm/termbits.h deleted file mode 100644 index fca82ea2ca2c5..0000000000000 --- a/arch/mn10300/include/uapi/asm/termbits.h +++ /dev/null @@ -1,202 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _ASM_TERMBITS_H -#define _ASM_TERMBITS_H - -#include - -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 termios2 { - 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 */ -}; - -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 BOTHER 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 CTVB 004000000000 /* VisioBraille Terminal flow control */ -#define CMSPAR 010000000000 /* mark or space (stick) parity */ -#define CRTSCTS 020000000000 /* flow control */ - -#define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */ - -/* c_lflag bits */ -#define ISIG 0000001 -#define ICANON 0000002 -#define XCASE 0000004 -#define ECHO 0000010 -#define ECHOE 0000020 -#define ECHOK 0000040 -#define ECHONL 0000100 -#define NOFLSH 0000200 -#define TOSTOP 0000400 -#define ECHOCTL 0001000 -#define ECHOPRT 0002000 -#define ECHOKE 0004000 -#define FLUSHO 0010000 -#define PENDIN 0040000 -#define IEXTEN 0100000 -#define EXTPROC 0200000 - -/* 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_TERMBITS_H */ diff --git a/arch/mn10300/include/uapi/asm/termios.h b/arch/mn10300/include/uapi/asm/termios.h deleted file mode 100644 index 25981aadb8cd1..0000000000000 --- a/arch/mn10300/include/uapi/asm/termios.h +++ /dev/null @@ -1,84 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _UAPI_ASM_TERMIOS_H -#define _UAPI_ASM_TERMIOS_H - -#include -#include - -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 */ -}; - - -/* 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 - -#define TIOCM_MODEM_BITS TIOCM_OUT2 /* IRDA support */ - -/* - * Translate a "termio" structure into a "termios". Ugh. - */ -#define SET_LOW_TERMIOS_BITS(termios, termio, x) { \ - unsigned short __tmp; \ - get_user(__tmp, &(termio)->x); \ - *(unsigned short *) &(termios)->x = __tmp; \ -} - -#define user_termio_to_kernel_termios(termios, termio) \ -({ \ - SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \ - SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \ - SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \ - SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \ - copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \ -}) - -/* - * Translate a "termios" structure into a "termio". Ugh. - */ -#define kernel_termios_to_user_termio(termio, termios) \ -({ \ - put_user((termios)->c_iflag, &(termio)->c_iflag); \ - put_user((termios)->c_oflag, &(termio)->c_oflag); \ - put_user((termios)->c_cflag, &(termio)->c_cflag); \ - put_user((termios)->c_lflag, &(termio)->c_lflag); \ - put_user((termios)->c_line, &(termio)->c_line); \ - copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \ -}) - -#define user_termios_to_kernel_termios(k, u) \ - copy_from_user(k, u, sizeof(struct termios2)) -#define kernel_termios_to_user_termios(u, k) \ - copy_to_user(u, k, sizeof(struct termios2)) -#define user_termios_to_kernel_termios_1(k, u) \ - copy_from_user(k, u, sizeof(struct termios)) -#define kernel_termios_to_user_termios_1(u, k) \ - copy_to_user(u, k, sizeof(struct termios)) - -#endif /* _UAPI_ASM_TERMIOS_H */ diff --git a/arch/mn10300/include/uapi/asm/types.h b/arch/mn10300/include/uapi/asm/types.h deleted file mode 100644 index 7d2a697e29376..0000000000000 --- a/arch/mn10300/include/uapi/asm/types.h +++ /dev/null @@ -1,12 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ -/* MN10300 Basic type definitions - * - * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd. - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include diff --git a/arch/mn10300/include/uapi/asm/unistd.h b/arch/mn10300/include/uapi/asm/unistd.h deleted file mode 100644 index c0c96b650692c..0000000000000 --- a/arch/mn10300/include/uapi/asm/unistd.h +++ /dev/null @@ -1,355 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ -/* MN10300 System call number list - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _UAPI_ASM_UNISTD_H -#define _UAPI_ASM_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 - -#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_add_key 286 -#define __NR_request_key 287 -#define __NR_keyctl 288 -#define __NR_cacheflush 289 -#define __NR_ioprio_set 290 -#define __NR_ioprio_get 291 -#define __NR_inotify_init 292 -#define __NR_inotify_add_watch 293 -#define __NR_inotify_rm_watch 294 -#define __NR_migrate_pages 295 -#define __NR_openat 296 -#define __NR_mkdirat 297 -#define __NR_mknodat 298 -#define __NR_fchownat 299 -#define __NR_futimesat 300 -#define __NR_fstatat64 301 -#define __NR_unlinkat 302 -#define __NR_renameat 303 -#define __NR_linkat 304 -#define __NR_symlinkat 305 -#define __NR_readlinkat 306 -#define __NR_fchmodat 307 -#define __NR_faccessat 308 -#define __NR_pselect6 309 -#define __NR_ppoll 310 -#define __NR_unshare 311 -#define __NR_set_robust_list 312 -#define __NR_get_robust_list 313 -#define __NR_splice 314 -#define __NR_sync_file_range 315 -#define __NR_tee 316 -#define __NR_vmsplice 317 -#define __NR_move_pages 318 -#define __NR_getcpu 319 -#define __NR_epoll_pwait 320 -#define __NR_utimensat 321 -#define __NR_signalfd 322 -#define __NR_timerfd_create 323 -#define __NR_eventfd 324 -#define __NR_fallocate 325 -#define __NR_timerfd_settime 326 -#define __NR_timerfd_gettime 327 -#define __NR_signalfd4 328 -#define __NR_eventfd2 329 -#define __NR_epoll_create1 330 -#define __NR_dup3 331 -#define __NR_pipe2 332 -#define __NR_inotify_init1 333 -#define __NR_preadv 334 -#define __NR_pwritev 335 -#define __NR_rt_tgsigqueueinfo 336 -#define __NR_perf_event_open 337 -#define __NR_recvmmsg 338 -#define __NR_setns 339 - -#endif /* _UAPI_ASM_UNISTD_H */ diff --git a/arch/mn10300/kernel/Makefile b/arch/mn10300/kernel/Makefile deleted file mode 100644 index de32af0e4b6ed..0000000000000 --- a/arch/mn10300/kernel/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# -# Makefile for the MN10300-specific core kernel code -# -extra-y := head.o vmlinux.lds - -fpu-obj-y := fpu-nofpu.o fpu-nofpu-low.o -fpu-obj-$(CONFIG_FPU) := fpu.o fpu-low.o - -obj-y := process.o signal.o entry.o traps.o irq.o \ - ptrace.o setup.o time.o sys_mn10300.o io.o \ - switch_to.o mn10300_ksyms.o $(fpu-obj-y) \ - csrc-mn10300.o cevt-mn10300.o - -obj-$(CONFIG_SMP) += smp.o smp-low.o - -obj-$(CONFIG_MN10300_WD_TIMER) += mn10300-watchdog.o mn10300-watchdog-low.o - -obj-$(CONFIG_MN10300_TTYSM) += mn10300-serial.o mn10300-serial-low.o \ - mn10300-debug.o -obj-$(CONFIG_GDBSTUB) += gdb-stub.o gdb-low.o -obj-$(CONFIG_GDBSTUB_ON_TTYSx) += gdb-io-serial.o gdb-io-serial-low.o -obj-$(CONFIG_GDBSTUB_ON_TTYSMx) += gdb-io-ttysm.o gdb-io-ttysm-low.o - -obj-$(CONFIG_MN10300_RTC) += rtc.o -obj-$(CONFIG_PROFILE) += profile.o profile-low.o -obj-$(CONFIG_MODULES) += module.o -obj-$(CONFIG_KPROBES) += kprobes.o -obj-$(CONFIG_KGDB) += kgdb.o diff --git a/arch/mn10300/kernel/asm-offsets.c b/arch/mn10300/kernel/asm-offsets.c deleted file mode 100644 index 57e6cc96267be..0000000000000 --- a/arch/mn10300/kernel/asm-offsets.c +++ /dev/null @@ -1,108 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Generate definitions needed by assembly language modules. - * This code generates raw asm output which is post-processed - * to extract and format the required data. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "sigframe.h" -#include "mn10300-serial.h" - -void foo(void) -{ - OFFSET(SIGCONTEXT_d0, sigcontext, d0); - OFFSET(SIGCONTEXT_d1, sigcontext, d1); - BLANK(); - - OFFSET(TI_task, thread_info, task); - OFFSET(TI_frame, thread_info, frame); - OFFSET(TI_flags, thread_info, flags); - OFFSET(TI_cpu, thread_info, cpu); - OFFSET(TI_preempt_count, thread_info, preempt_count); - OFFSET(TI_addr_limit, thread_info, addr_limit); - BLANK(); - - OFFSET(REG_D0, pt_regs, d0); - OFFSET(REG_D1, pt_regs, d1); - OFFSET(REG_D2, pt_regs, d2); - OFFSET(REG_D3, pt_regs, d3); - OFFSET(REG_A0, pt_regs, a0); - OFFSET(REG_A1, pt_regs, a1); - OFFSET(REG_A2, pt_regs, a2); - OFFSET(REG_A3, pt_regs, a3); - OFFSET(REG_E0, pt_regs, e0); - OFFSET(REG_E1, pt_regs, e1); - OFFSET(REG_E2, pt_regs, e2); - OFFSET(REG_E3, pt_regs, e3); - OFFSET(REG_E4, pt_regs, e4); - OFFSET(REG_E5, pt_regs, e5); - OFFSET(REG_E6, pt_regs, e6); - OFFSET(REG_E7, pt_regs, e7); - OFFSET(REG_SP, pt_regs, sp); - OFFSET(REG_EPSW, pt_regs, epsw); - OFFSET(REG_PC, pt_regs, pc); - OFFSET(REG_LAR, pt_regs, lar); - OFFSET(REG_LIR, pt_regs, lir); - OFFSET(REG_MDR, pt_regs, mdr); - OFFSET(REG_MCVF, pt_regs, mcvf); - OFFSET(REG_MCRL, pt_regs, mcrl); - OFFSET(REG_MCRH, pt_regs, mcrh); - OFFSET(REG_MDRQ, pt_regs, mdrq); - OFFSET(REG_ORIG_D0, pt_regs, orig_d0); - OFFSET(REG_NEXT, pt_regs, next); - DEFINE(REG__END, sizeof(struct pt_regs)); - BLANK(); - - OFFSET(THREAD_UREGS, thread_struct, uregs); - OFFSET(THREAD_PC, thread_struct, pc); - OFFSET(THREAD_SP, thread_struct, sp); - OFFSET(THREAD_A3, thread_struct, a3); - OFFSET(THREAD_USP, thread_struct, usp); -#ifdef CONFIG_FPU - OFFSET(THREAD_FPU_FLAGS, thread_struct, fpu_flags); - OFFSET(THREAD_FPU_STATE, thread_struct, fpu_state); - DEFINE(__THREAD_USING_FPU, THREAD_USING_FPU); - DEFINE(__THREAD_HAS_FPU, THREAD_HAS_FPU); -#endif /* CONFIG_FPU */ - BLANK(); - - OFFSET(TASK_THREAD, task_struct, thread); - BLANK(); - - DEFINE(CLONE_VM_asm, CLONE_VM); - DEFINE(CLONE_FS_asm, CLONE_FS); - DEFINE(CLONE_FILES_asm, CLONE_FILES); - DEFINE(CLONE_SIGHAND_asm, CLONE_SIGHAND); - DEFINE(CLONE_UNTRACED_asm, CLONE_UNTRACED); - DEFINE(SIGCHLD_asm, SIGCHLD); - BLANK(); - - OFFSET(RT_SIGFRAME_sigcontext, rt_sigframe, uc.uc_mcontext); - - DEFINE(PAGE_SIZE_asm, PAGE_SIZE); - - OFFSET(__rx_buffer, mn10300_serial_port, rx_buffer); - OFFSET(__rx_inp, mn10300_serial_port, rx_inp); - OFFSET(__rx_outp, mn10300_serial_port, rx_outp); - OFFSET(__uart_state, mn10300_serial_port, uart.state); - OFFSET(__tx_xchar, mn10300_serial_port, tx_xchar); - OFFSET(__tx_flags, mn10300_serial_port, tx_flags); - OFFSET(__intr_flags, mn10300_serial_port, intr_flags); - OFFSET(__rx_icr, mn10300_serial_port, rx_icr); - OFFSET(__tx_icr, mn10300_serial_port, tx_icr); - OFFSET(__tm_icr, mn10300_serial_port, _tmicr); - OFFSET(__iobase, mn10300_serial_port, _iobase); - - DEFINE(__UART_XMIT_SIZE, UART_XMIT_SIZE); - OFFSET(__xmit_buffer, uart_state, xmit.buf); - OFFSET(__xmit_head, uart_state, xmit.head); - OFFSET(__xmit_tail, uart_state, xmit.tail); -} diff --git a/arch/mn10300/kernel/cevt-mn10300.c b/arch/mn10300/kernel/cevt-mn10300.c deleted file mode 100644 index 2b21bbc9efa4b..0000000000000 --- a/arch/mn10300/kernel/cevt-mn10300.c +++ /dev/null @@ -1,137 +0,0 @@ -/* MN10300 clockevents - * - * Copyright (C) 2010 Red Hat, Inc. All Rights Reserved. - * Written by Mark Salter (msalter@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include -#include -#include -#include -#include "internal.h" - -#ifdef CONFIG_SMP -#if (CONFIG_NR_CPUS > 2) && !defined(CONFIG_GEENERIC_CLOCKEVENTS_BROADCAST) -#error "This doesn't scale well! Need per-core local timers." -#endif -#else /* CONFIG_SMP */ -#define stop_jiffies_counter1() -#define reload_jiffies_counter1(x) -#define TMJC1IRQ TMJCIRQ -#endif - - -static int next_event(unsigned long delta, - struct clock_event_device *evt) -{ - unsigned int cpu = smp_processor_id(); - - if (cpu == 0) { - stop_jiffies_counter(); - reload_jiffies_counter(delta - 1); - } else { - stop_jiffies_counter1(); - reload_jiffies_counter1(delta - 1); - } - return 0; -} - -static DEFINE_PER_CPU(struct clock_event_device, mn10300_clockevent_device); -static DEFINE_PER_CPU(struct irqaction, timer_irq); - -static irqreturn_t timer_interrupt(int irq, void *dev_id) -{ - struct clock_event_device *cd; - unsigned int cpu = smp_processor_id(); - - if (cpu == 0) - stop_jiffies_counter(); - else - stop_jiffies_counter1(); - - cd = &per_cpu(mn10300_clockevent_device, cpu); - cd->event_handler(cd); - - return IRQ_HANDLED; -} - -static void event_handler(struct clock_event_device *dev) -{ -} - -static inline void setup_jiffies_interrupt(int irq, - struct irqaction *action) -{ - u16 tmp; - setup_irq(irq, action); - set_intr_level(irq, NUM2GxICR_LEVEL(CONFIG_TIMER_IRQ_LEVEL)); - GxICR(irq) |= GxICR_ENABLE | GxICR_DETECT | GxICR_REQUEST; - tmp = GxICR(irq); -} - -int __init init_clockevents(void) -{ - struct clock_event_device *cd; - struct irqaction *iact; - unsigned int cpu = smp_processor_id(); - - cd = &per_cpu(mn10300_clockevent_device, cpu); - - if (cpu == 0) { - stop_jiffies_counter(); - cd->irq = TMJCIRQ; - } else { - stop_jiffies_counter1(); - cd->irq = TMJC1IRQ; - } - - cd->name = "Timestamp"; - cd->features = CLOCK_EVT_FEAT_ONESHOT; - - /* Calculate shift/mult. We want to spawn at least 1 second */ - clockevents_calc_mult_shift(cd, MN10300_JCCLK, 1); - - /* Calculate the min / max delta */ - cd->max_delta_ns = clockevent_delta2ns(TMJCBR_MAX, cd); - cd->max_delta_ticks = TMJCBR_MAX; - cd->min_delta_ns = clockevent_delta2ns(100, cd); - cd->min_delta_ticks = 100; - - cd->rating = 200; - cd->cpumask = cpumask_of(smp_processor_id()); - cd->event_handler = event_handler; - cd->set_next_event = next_event; - - iact = &per_cpu(timer_irq, cpu); - iact->flags = IRQF_SHARED | IRQF_TIMER; - iact->handler = timer_interrupt; - - clockevents_register_device(cd); - -#if defined(CONFIG_SMP) && !defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) - /* setup timer irq affinity so it only runs on this cpu */ - { - struct irq_data *data; - data = irq_get_irq_data(cd->irq); - cpumask_copy(irq_data_get_affinity_mask(data), cpumask_of(cpu)); - iact->flags |= IRQF_NOBALANCING; - } -#endif - - if (cpu == 0) { - reload_jiffies_counter(MN10300_JC_PER_HZ - 1); - iact->name = "CPU0 Timer"; - } else { - reload_jiffies_counter1(MN10300_JC_PER_HZ - 1); - iact->name = "CPU1 Timer"; - } - - setup_jiffies_interrupt(cd->irq, iact); - - return 0; -} diff --git a/arch/mn10300/kernel/csrc-mn10300.c b/arch/mn10300/kernel/csrc-mn10300.c deleted file mode 100644 index 6b74df3661f22..0000000000000 --- a/arch/mn10300/kernel/csrc-mn10300.c +++ /dev/null @@ -1,34 +0,0 @@ -/* MN10300 clocksource - * - * Copyright (C) 2010 Red Hat, Inc. All Rights Reserved. - * Written by Mark Salter (msalter@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include -#include -#include "internal.h" - -static u64 mn10300_read(struct clocksource *cs) -{ - return read_timestamp_counter(); -} - -static struct clocksource clocksource_mn10300 = { - .name = "TSC", - .rating = 200, - .read = mn10300_read, - .mask = CLOCKSOURCE_MASK(32), - .flags = CLOCK_SOURCE_IS_CONTINUOUS, -}; - -int __init init_clocksource(void) -{ - startup_timestamp_counter(); - clocksource_register_hz(&clocksource_mn10300, MN10300_TSCCLK); - return 0; -} diff --git a/arch/mn10300/kernel/entry.S b/arch/mn10300/kernel/entry.S deleted file mode 100644 index 177d61de51c93..0000000000000 --- a/arch/mn10300/kernel/entry.S +++ /dev/null @@ -1,772 +0,0 @@ -############################################################################### -# -# MN10300 Exception and interrupt entry points -# -# Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd. -# Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. -# Modified by David Howells (dhowells@redhat.com) -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public Licence -# as published by the Free Software Foundation; either version -# 2 of the Licence, or (at your option) any later version. -# -############################################################################### -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if defined(CONFIG_SMP) && defined(CONFIG_GDBSTUB) -#include -#endif /* CONFIG_SMP && CONFIG_GDBSTUB */ - -#ifdef CONFIG_PREEMPT -#define preempt_stop LOCAL_IRQ_DISABLE -#else -#define preempt_stop -#define resume_kernel restore_all -#endif - - .am33_2 - -############################################################################### -# -# the return path for a forked child -# - on entry, D0 holds the address of the previous task to run -# -############################################################################### -ENTRY(ret_from_fork) - call schedule_tail[],0 - GET_THREAD_INFO a2 - - # return 0 to indicate child process - clr d0 - mov d0,(REG_D0,fp) - jmp syscall_exit - -ENTRY(ret_from_kernel_thread) - call schedule_tail[],0 - mov (REG_D0,fp),d0 - mov (REG_A0,fp),a0 - calls (a0) - GET_THREAD_INFO a2 # A2 must be set on return from sys_exit() - clr d0 - mov d0,(REG_D0,fp) - jmp syscall_exit - -############################################################################### -# -# system call handler -# -############################################################################### -ENTRY(system_call) - add -4,sp - SAVE_ALL - mov d0,(REG_ORIG_D0,fp) - GET_THREAD_INFO a2 - cmp nr_syscalls,d0 - bcc syscall_badsys - btst _TIF_SYSCALL_TRACE,(TI_flags,a2) - bne syscall_entry_trace -syscall_call: - add d0,d0,a1 - add a1,a1 - mov (REG_A0,fp),d0 - mov (sys_call_table,a1),a0 - calls (a0) - mov d0,(REG_D0,fp) -syscall_exit: - # make sure we don't miss an interrupt setting need_resched or - # sigpending between sampling and the rti - LOCAL_IRQ_DISABLE - mov (TI_flags,a2),d2 - btst _TIF_ALLWORK_MASK,d2 - bne syscall_exit_work -restore_all: - RESTORE_ALL - -############################################################################### -# -# perform work that needs to be done immediately before resumption and syscall -# tracing -# -############################################################################### - ALIGN -syscall_exit_work: - mov (REG_EPSW,fp),d0 - and EPSW_nSL,d0 - beq resume_kernel # returning to supervisor mode - - LOCAL_IRQ_ENABLE # could let syscall_trace_exit() call - # schedule() instead - btst _TIF_SYSCALL_TRACE,d2 - beq work_pending - mov fp,d0 - call syscall_trace_exit[],0 # do_syscall_trace(regs) - jmp resume_userspace - - ALIGN -work_pending: - btst _TIF_NEED_RESCHED,d2 - beq work_notifysig - -work_resched: - call schedule[],0 - -resume_userspace: - # make sure we don't miss an interrupt setting need_resched or - # sigpending between sampling and the rti - LOCAL_IRQ_DISABLE - - # is there any work to be done other than syscall tracing? - mov (TI_flags,a2),d2 - btst _TIF_WORK_MASK,d2 - beq restore_all - - LOCAL_IRQ_ENABLE - btst _TIF_NEED_RESCHED,d2 - bne work_resched - - # deal with pending signals and notify-resume requests -work_notifysig: - mov fp,d0 - mov d2,d1 - call do_notify_resume[],0 - jmp resume_userspace - - # perform syscall entry tracing -syscall_entry_trace: - mov -ENOSYS,d0 - mov d0,(REG_D0,fp) - mov fp,d0 - call syscall_trace_entry[],0 # returns the syscall number to actually use - mov (REG_D1,fp),d1 - cmp nr_syscalls,d0 - bcs syscall_call - jmp syscall_exit - -syscall_badsys: - mov -ENOSYS,d0 - mov d0,(REG_D0,fp) - jmp resume_userspace - - # userspace resumption stub bypassing syscall exit tracing - .globl ret_from_exception, ret_from_intr - ALIGN -ret_from_exception: - preempt_stop -ret_from_intr: - GET_THREAD_INFO a2 - mov (REG_EPSW,fp),d0 # need to deliver signals before - # returning to userspace - and EPSW_nSL,d0 - bne resume_userspace # returning to userspace - -#ifdef CONFIG_PREEMPT -resume_kernel: - LOCAL_IRQ_DISABLE - mov (TI_preempt_count,a2),d0 # non-zero preempt_count ? - cmp 0,d0 - bne restore_all - -need_resched: - btst _TIF_NEED_RESCHED,(TI_flags,a2) - beq restore_all - mov (REG_EPSW,fp),d0 - and EPSW_IM,d0 - cmp EPSW_IM_7,d0 # interrupts off (exception path) ? - bne restore_all - call preempt_schedule_irq[],0 - jmp need_resched -#else - jmp resume_kernel -#endif - - -############################################################################### -# -# IRQ handler entry point -# - intended to be entered at multiple priorities -# -############################################################################### -ENTRY(irq_handler) - add -4,sp - SAVE_ALL - - # it's not a syscall - mov 0xffffffff,d0 - mov d0,(REG_ORIG_D0,fp) - - mov fp,d0 - call do_IRQ[],0 # do_IRQ(regs) - - jmp ret_from_intr - -############################################################################### -# -# Double Fault handler entry point -# - note that there will not be a stack, D0/A0 will hold EPSW/PC as were -# -############################################################################### - .section .bss - .balign THREAD_SIZE - .space THREAD_SIZE -__df_stack: - .previous - -ENTRY(double_fault) - mov a0,(__df_stack-4) # PC as was - mov d0,(__df_stack-8) # EPSW as was - mn10300_set_dbfleds # display 'db-f' on the LEDs - mov 0xaa55aa55,d0 - mov d0,(__df_stack-12) # no ORIG_D0 - mov sp,a0 # save corrupted SP - mov __df_stack-12,sp # emergency supervisor stack - SAVE_ALL - mov a0,(REG_A0,fp) # save corrupted SP as A0 (which got - # clobbered by the CPU) - mov fp,d0 - calls do_double_fault -double_fault_loop: - bra double_fault_loop - -############################################################################### -# -# Bus Error handler entry point -# - handle external (async) bus errors separately -# -############################################################################### -ENTRY(raw_bus_error) - add -4,sp - mov d0,(sp) -#if defined(CONFIG_ERRATUM_NEED_TO_RELOAD_MMUCTR) - mov (MMUCTR),d0 - mov d0,(MMUCTR) -#endif - mov (BCBERR),d0 # what - btst BCBERR_BEMR_DMA,d0 # see if it was an external bus error - beq __common_exception_aux # it wasn't - - SAVE_ALL - mov (BCBEAR),d1 # destination of erroneous access - - mov (REG_ORIG_D0,fp),d2 - mov d2,(REG_D0,fp) - mov -1,d2 - mov d2,(REG_ORIG_D0,fp) - - add -4,sp - mov fp,(12,sp) # frame pointer - call io_bus_error[],0 - jmp restore_all - -############################################################################### -# -# NMI exception entry points -# -# This is used by ordinary interrupt channels that have the GxICR_NMI bit set -# in addition to the main NMI and Watchdog channels. SMP NMI IPIs use this -# facility. -# -############################################################################### -ENTRY(nmi_handler) - add -4,sp - mov d0,(sp) - mov (TBR),d0 - -#ifdef CONFIG_SMP - add -4,sp - mov d0,(sp) # save d0(TBR) - movhu (NMIAGR),d0 - and NMIAGR_GN,d0 - lsr 0x2,d0 - cmp CALL_FUNCTION_NMI_IPI,d0 - bne nmi_not_smp_callfunc # if not call function, jump - - # function call nmi ipi - add 4,sp # no need to store TBR - mov GxICR_DETECT,d0 # clear NMI request - movbu d0,(GxICR(CALL_FUNCTION_NMI_IPI)) - movhu (GxICR(CALL_FUNCTION_NMI_IPI)),d0 - and ~EPSW_NMID,epsw # enable NMI - - mov (sp),d0 # restore d0 - SAVE_ALL - call smp_nmi_call_function_interrupt[],0 - RESTORE_ALL - -nmi_not_smp_callfunc: -#ifdef CONFIG_KERNEL_DEBUGGER - cmp DEBUGGER_NMI_IPI,d0 - bne nmi_not_debugger # if not kernel debugger NMI IPI, jump - - # kernel debugger NMI IPI - add 4,sp # no need to store TBR - mov GxICR_DETECT,d0 # clear NMI - movbu d0,(GxICR(DEBUGGER_NMI_IPI)) - movhu (GxICR(DEBUGGER_NMI_IPI)),d0 - and ~EPSW_NMID,epsw # enable NMI - - mov (sp),d0 - SAVE_ALL - mov fp,d0 # arg 0: stacked register file - mov a2,d1 # arg 1: exception number - call debugger_nmi_interrupt[],0 - RESTORE_ALL - -nmi_not_debugger: -#endif /* CONFIG_KERNEL_DEBUGGER */ - mov (sp),d0 # restore TBR to d0 - add 4,sp -#endif /* CONFIG_SMP */ - - bra __common_exception_nonmi - -############################################################################### -# -# General exception entry point -# -############################################################################### -ENTRY(__common_exception) - add -4,sp - mov d0,(sp) -#if defined(CONFIG_ERRATUM_NEED_TO_RELOAD_MMUCTR) - mov (MMUCTR),d0 - mov d0,(MMUCTR) -#endif - -__common_exception_aux: - mov (TBR),d0 - and ~EPSW_NMID,epsw # turn NMIs back on if not NMI - or EPSW_IE,epsw - -__common_exception_nonmi: - and 0x0000FFFF,d0 # turn the exception code into a vector - # table index - - btst 0x00000007,d0 - bne 1f - cmp 0x00000400,d0 - bge 1f - - SAVE_ALL # build the stack frame - - mov (REG_D0,fp),a2 # get the exception number - mov (REG_ORIG_D0,fp),d0 - mov d0,(REG_D0,fp) - mov -1,d0 - mov d0,(REG_ORIG_D0,fp) - -#ifdef CONFIG_GDBSTUB -#ifdef CONFIG_SMP - call gdbstub_busy_check[],0 - and d0,d0 # check return value - beq 2f -#else /* CONFIG_SMP */ - btst 0x01,(gdbstub_busy) - beq 2f -#endif /* CONFIG_SMP */ - and ~EPSW_IE,epsw - mov fp,d0 - mov a2,d1 - call gdbstub_exception[],0 # gdbstub itself caused an exception - bra restore_all -2: -#endif /* CONFIG_GDBSTUB */ - - mov fp,d0 # arg 0: stacked register file - mov a2,d1 # arg 1: exception number - lsr 1,a2 - - mov (exception_table,a2),a2 - calls (a2) - jmp ret_from_exception - -1: pi # BUG() equivalent - -############################################################################### -# -# Exception handler functions table -# -############################################################################### - .data -ENTRY(exception_table) - .rept 0x400>>1 - .long uninitialised_exception - .endr - .previous - -############################################################################### -# -# Change an entry in the exception table -# - D0 exception code, D1 handler -# -############################################################################### -ENTRY(set_excp_vector) - lsr 1,d0 - add exception_table,d0 - mov d1,(d0) - mov 4,d1 - ret [],0 - -############################################################################### -# -# System call table -# -############################################################################### - .data -ENTRY(sys_call_table) - .long sys_restart_syscall /* 0 */ - .long sys_exit - .long sys_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 - .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_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_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 /* old sys_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 - .long sys_sigpending - .long sys_sethostname - .long sys_setrlimit /* 75 */ - .long sys_old_getrlimit - .long sys_getrusage - .long sys_gettimeofday - .long sys_settimeofday - .long sys_getgroups16 /* 80 */ - .long sys_setgroups16 - .long sys_old_select - .long sys_symlink - .long sys_lstat - .long sys_readlink /* 85 */ - .long sys_uselib - .long sys_swapon - .long sys_reboot - .long sys_old_readdir - .long old_mmap /* 90 */ - .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 /* old sys_uname */ - .long sys_ni_syscall /* 110 - iopl */ - .long sys_vhangup - .long sys_ni_syscall /* old "idle" system call */ - .long sys_ni_syscall /* vm86old */ - .long sys_wait4 - .long sys_swapoff /* 115 */ - .long sys_sysinfo - .long sys_ipc - .long sys_fsync - .long sys_sigreturn - .long sys_clone /* 120 */ - .long sys_setdomainname - .long sys_newuname - .long sys_ni_syscall /* modify_ldt */ - .long sys_adjtimex - .long sys_mprotect /* 125 */ - .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_msync - .long sys_readv /* 145 */ - .long sys_writev - .long sys_getsid - .long sys_fdatasync - .long sys_sysctl - .long sys_mlock /* 150 */ - .long sys_munlock - .long sys_mlockall - .long 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_mremap - .long sys_setresuid16 - .long sys_getresuid16 /* 165 */ - .long sys_ni_syscall /* vm86 */ - .long sys_ni_syscall /* Old sys_query_module */ - .long sys_poll - .long sys_ni_syscall /* was nfsservctl */ - .long sys_setresgid16 /* 170 */ - .long sys_getresgid16 - .long sys_prctl - .long sys_rt_sigreturn - .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 - .long sys_pread64 /* 180 */ - .long sys_pwrite64 - .long sys_chown16 - .long sys_getcwd - .long sys_capget - .long sys_capset /* 185 */ - .long sys_sigaltstack - .long sys_sendfile - .long sys_ni_syscall /* reserved for streams1 */ - .long sys_ni_syscall /* reserved for streams2 */ - .long sys_vfork /* 190 */ - .long sys_getrlimit - .long sys_mmap_pgoff - .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_mincore - .long 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 /* sys_set_thread_area */ - .long sys_ni_syscall /* sys_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_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 /* 275 */ - .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_cacheflush - .long sys_ioprio_set /* 290 */ - .long sys_ioprio_get - .long sys_inotify_init - .long sys_inotify_add_watch - .long sys_inotify_rm_watch - .long sys_migrate_pages /* 295 */ - .long sys_openat - .long sys_mkdirat - .long sys_mknodat - .long sys_fchownat - .long sys_futimesat /* 300 */ - .long sys_fstatat64 - .long sys_unlinkat - .long sys_renameat - .long sys_linkat - .long sys_symlinkat /* 305 */ - .long sys_readlinkat - .long sys_fchmodat - .long sys_faccessat - .long sys_pselect6 - .long sys_ppoll /* 310 */ - .long sys_unshare - .long sys_set_robust_list - .long sys_get_robust_list - .long sys_splice - .long sys_sync_file_range /* 315 */ - .long sys_tee - .long sys_vmsplice - .long sys_move_pages - .long sys_getcpu - .long sys_epoll_pwait /* 320 */ - .long sys_utimensat - .long sys_signalfd - .long sys_timerfd_create - .long sys_eventfd - .long sys_fallocate /* 325 */ - .long sys_timerfd_settime - .long sys_timerfd_gettime - .long sys_signalfd4 - .long sys_eventfd2 - .long sys_epoll_create1 /* 330 */ - .long sys_dup3 - .long sys_pipe2 - .long sys_inotify_init1 - .long sys_preadv - .long sys_pwritev /* 335 */ - .long sys_rt_tgsigqueueinfo - .long sys_perf_event_open - .long sys_recvmmsg - .long sys_setns - - -nr_syscalls=(.-sys_call_table)/4 diff --git a/arch/mn10300/kernel/fpu-low.S b/arch/mn10300/kernel/fpu-low.S deleted file mode 100644 index 78df25cfae293..0000000000000 --- a/arch/mn10300/kernel/fpu-low.S +++ /dev/null @@ -1,258 +0,0 @@ -/* MN10300 Low level FPU management operations - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include -#include -#include -#include -#include - -.macro FPU_INIT_STATE_ALL - fmov 0,fs0 - fmov fs0,fs1 - fmov fs0,fs2 - fmov fs0,fs3 - fmov fs0,fs4 - fmov fs0,fs5 - fmov fs0,fs6 - fmov fs0,fs7 - fmov fs0,fs8 - fmov fs0,fs9 - fmov fs0,fs10 - fmov fs0,fs11 - fmov fs0,fs12 - fmov fs0,fs13 - fmov fs0,fs14 - fmov fs0,fs15 - fmov fs0,fs16 - fmov fs0,fs17 - fmov fs0,fs18 - fmov fs0,fs19 - fmov fs0,fs20 - fmov fs0,fs21 - fmov fs0,fs22 - fmov fs0,fs23 - fmov fs0,fs24 - fmov fs0,fs25 - fmov fs0,fs26 - fmov fs0,fs27 - fmov fs0,fs28 - fmov fs0,fs29 - fmov fs0,fs30 - fmov fs0,fs31 - fmov FPCR_INIT,fpcr -.endm - -.macro FPU_SAVE_ALL areg,dreg - fmov fs0,(\areg+) - fmov fs1,(\areg+) - fmov fs2,(\areg+) - fmov fs3,(\areg+) - fmov fs4,(\areg+) - fmov fs5,(\areg+) - fmov fs6,(\areg+) - fmov fs7,(\areg+) - fmov fs8,(\areg+) - fmov fs9,(\areg+) - fmov fs10,(\areg+) - fmov fs11,(\areg+) - fmov fs12,(\areg+) - fmov fs13,(\areg+) - fmov fs14,(\areg+) - fmov fs15,(\areg+) - fmov fs16,(\areg+) - fmov fs17,(\areg+) - fmov fs18,(\areg+) - fmov fs19,(\areg+) - fmov fs20,(\areg+) - fmov fs21,(\areg+) - fmov fs22,(\areg+) - fmov fs23,(\areg+) - fmov fs24,(\areg+) - fmov fs25,(\areg+) - fmov fs26,(\areg+) - fmov fs27,(\areg+) - fmov fs28,(\areg+) - fmov fs29,(\areg+) - fmov fs30,(\areg+) - fmov fs31,(\areg+) - fmov fpcr,\dreg - mov \dreg,(\areg) -.endm - -.macro FPU_RESTORE_ALL areg,dreg - fmov (\areg+),fs0 - fmov (\areg+),fs1 - fmov (\areg+),fs2 - fmov (\areg+),fs3 - fmov (\areg+),fs4 - fmov (\areg+),fs5 - fmov (\areg+),fs6 - fmov (\areg+),fs7 - fmov (\areg+),fs8 - fmov (\areg+),fs9 - fmov (\areg+),fs10 - fmov (\areg+),fs11 - fmov (\areg+),fs12 - fmov (\areg+),fs13 - fmov (\areg+),fs14 - fmov (\areg+),fs15 - fmov (\areg+),fs16 - fmov (\areg+),fs17 - fmov (\areg+),fs18 - fmov (\areg+),fs19 - fmov (\areg+),fs20 - fmov (\areg+),fs21 - fmov (\areg+),fs22 - fmov (\areg+),fs23 - fmov (\areg+),fs24 - fmov (\areg+),fs25 - fmov (\areg+),fs26 - fmov (\areg+),fs27 - fmov (\areg+),fs28 - fmov (\areg+),fs29 - fmov (\areg+),fs30 - fmov (\areg+),fs31 - mov (\areg),\dreg - fmov \dreg,fpcr -.endm - -############################################################################### -# -# void fpu_init_state(void) -# - initialise the FPU -# -############################################################################### - .globl fpu_init_state - .type fpu_init_state,@function -fpu_init_state: - mov epsw,d0 - or EPSW_FE,epsw - -#ifdef CONFIG_MN10300_PROC_MN103E010 - nop - nop - nop -#endif - FPU_INIT_STATE_ALL -#ifdef CONFIG_MN10300_PROC_MN103E010 - nop - nop - nop -#endif - mov d0,epsw - ret [],0 - - .size fpu_init_state,.-fpu_init_state - -############################################################################### -# -# void fpu_save(struct fpu_state_struct *) -# - save the fpu state -# - note that an FPU Operational exception might occur during this process -# -############################################################################### - .globl fpu_save - .type fpu_save,@function -fpu_save: - mov epsw,d1 - or EPSW_FE,epsw /* enable the FPU so we can access it */ - -#ifdef CONFIG_MN10300_PROC_MN103E010 - nop - nop -#endif - mov d0,a0 - FPU_SAVE_ALL a0,d0 -#ifdef CONFIG_MN10300_PROC_MN103E010 - nop - nop -#endif - - mov d1,epsw - ret [],0 - - .size fpu_save,.-fpu_save - -############################################################################### -# -# void fpu_disabled(void) -# - handle an exception due to the FPU being disabled -# when CONFIG_FPU is enabled -# -############################################################################### - .type fpu_disabled,@function - .globl fpu_disabled -fpu_disabled: - or EPSW_nAR|EPSW_FE,epsw - nop - nop - nop - - mov sp,a1 - mov (a1),d1 /* get epsw of user context */ - and ~(THREAD_SIZE-1),a1 /* a1: (thread_info *ti) */ - mov (TI_task,a1),a2 /* a2: (task_struct *tsk) */ - btst EPSW_nSL,d1 - beq fpu_used_in_kernel - - or EPSW_FE,d1 - mov d1,(sp) - mov (TASK_THREAD+THREAD_FPU_FLAGS,a2),d1 -#ifndef CONFIG_LAZY_SAVE_FPU - or __THREAD_HAS_FPU,d1 - mov d1,(TASK_THREAD+THREAD_FPU_FLAGS,a2) -#else /* !CONFIG_LAZY_SAVE_FPU */ - mov (fpu_state_owner),a0 - cmp 0,a0 - beq fpu_regs_save_end - - mov (TASK_THREAD+THREAD_UREGS,a0),a1 - add TASK_THREAD+THREAD_FPU_STATE,a0 - FPU_SAVE_ALL a0,d0 - - mov (REG_EPSW,a1),d0 - and ~EPSW_FE,d0 - mov d0,(REG_EPSW,a1) - -fpu_regs_save_end: - mov a2,(fpu_state_owner) -#endif /* !CONFIG_LAZY_SAVE_FPU */ - - btst __THREAD_USING_FPU,d1 - beq fpu_regs_init - add TASK_THREAD+THREAD_FPU_STATE,a2 - FPU_RESTORE_ALL a2,d0 - rti - -fpu_regs_init: - FPU_INIT_STATE_ALL - add TASK_THREAD+THREAD_FPU_FLAGS,a2 - bset __THREAD_USING_FPU,(0,a2) - rti - -fpu_used_in_kernel: - and ~(EPSW_nAR|EPSW_FE),epsw - nop - nop - - add -4,sp - SAVE_ALL - mov -1,d0 - mov d0,(REG_ORIG_D0,fp) - - and ~EPSW_NMID,epsw - - mov fp,d0 - call fpu_disabled_in_kernel[],0 - jmp ret_from_exception - - .size fpu_disabled,.-fpu_disabled diff --git a/arch/mn10300/kernel/fpu-nofpu-low.S b/arch/mn10300/kernel/fpu-nofpu-low.S deleted file mode 100644 index 7ea087a549f45..0000000000000 --- a/arch/mn10300/kernel/fpu-nofpu-low.S +++ /dev/null @@ -1,39 +0,0 @@ -/* MN10300 Low level FPU management operations - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include -#include -#include -#include -#include - -############################################################################### -# -# void fpu_disabled(void) -# - handle an exception due to the FPU being disabled -# when CONFIG_FPU is disabled -# -############################################################################### - .type fpu_disabled,@function - .globl fpu_disabled -fpu_disabled: - add -4,sp - SAVE_ALL - mov -1,d0 - mov d0,(REG_ORIG_D0,fp) - - and ~EPSW_NMID,epsw - - mov fp,d0 - call unexpected_fpu_exception[],0 - jmp ret_from_exception - - .size fpu_disabled,.-fpu_disabled diff --git a/arch/mn10300/kernel/fpu-nofpu.c b/arch/mn10300/kernel/fpu-nofpu.c deleted file mode 100644 index 8d0e041aa798e..0000000000000 --- a/arch/mn10300/kernel/fpu-nofpu.c +++ /dev/null @@ -1,31 +0,0 @@ -/* MN10300 FPU management - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include - -/* - * handle an FPU operational exception - * - there's a possibility that if the FPU is asynchronous, the signal might - * be meant for a process other than the current one - */ -asmlinkage -void unexpected_fpu_exception(struct pt_regs *regs, enum exception_code code) -{ - panic("An FPU exception was received, but there's no FPU enabled."); -} - -/* - * fill in the FPU structure for a core dump - */ -int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpreg) -{ - return 0; /* not valid */ -} diff --git a/arch/mn10300/kernel/fpu.c b/arch/mn10300/kernel/fpu.c deleted file mode 100644 index 50ce7b447fed4..0000000000000 --- a/arch/mn10300/kernel/fpu.c +++ /dev/null @@ -1,177 +0,0 @@ -/* MN10300 FPU management - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include - -#include -#include -#include - -#ifdef CONFIG_LAZY_SAVE_FPU -struct task_struct *fpu_state_owner; -#endif - -/* - * error functions in FPU disabled exception - */ -asmlinkage void fpu_disabled_in_kernel(struct pt_regs *regs) -{ - die_if_no_fixup("An FPU Disabled exception happened in kernel space\n", - regs, EXCEP_FPU_DISABLED); -} - -/* - * handle an FPU operational exception - * - there's a possibility that if the FPU is asynchronous, the signal might - * be meant for a process other than the current one - */ -asmlinkage void fpu_exception(struct pt_regs *regs, enum exception_code code) -{ - struct task_struct *tsk = current; - siginfo_t info; - u32 fpcr; - - if (!user_mode(regs)) - die_if_no_fixup("An FPU Operation exception happened in" - " kernel space\n", - regs, code); - - if (!is_using_fpu(tsk)) - die_if_no_fixup("An FPU Operation exception happened," - " but the FPU is not in use", - regs, code); - - info.si_signo = SIGFPE; - info.si_errno = 0; - info.si_addr = (void *) tsk->thread.uregs->pc; - info.si_code = FPE_FLTINV; - - unlazy_fpu(tsk); - - fpcr = tsk->thread.fpu_state.fpcr; - - if (fpcr & FPCR_EC_Z) - info.si_code = FPE_FLTDIV; - else if (fpcr & FPCR_EC_O) - info.si_code = FPE_FLTOVF; - else if (fpcr & FPCR_EC_U) - info.si_code = FPE_FLTUND; - else if (fpcr & FPCR_EC_I) - info.si_code = FPE_FLTRES; - - force_sig_info(SIGFPE, &info, tsk); -} - -/* - * save the FPU state to a signal context - */ -int fpu_setup_sigcontext(struct fpucontext *fpucontext) -{ - struct task_struct *tsk = current; - - if (!is_using_fpu(tsk)) - return 0; - - /* transfer the current FPU state to memory and cause fpu_init() to be - * triggered by the next attempted FPU operation by the current - * process. - */ - preempt_disable(); - -#ifndef CONFIG_LAZY_SAVE_FPU - if (tsk->thread.fpu_flags & THREAD_HAS_FPU) { - fpu_save(&tsk->thread.fpu_state); - tsk->thread.uregs->epsw &= ~EPSW_FE; - tsk->thread.fpu_flags &= ~THREAD_HAS_FPU; - } -#else /* !CONFIG_LAZY_SAVE_FPU */ - if (fpu_state_owner == tsk) { - fpu_save(&tsk->thread.fpu_state); - fpu_state_owner->thread.uregs->epsw &= ~EPSW_FE; - fpu_state_owner = NULL; - } -#endif /* !CONFIG_LAZY_SAVE_FPU */ - - preempt_enable(); - - /* we no longer have a valid current FPU state */ - clear_using_fpu(tsk); - - /* transfer the saved FPU state onto the userspace stack */ - if (copy_to_user(fpucontext, - &tsk->thread.fpu_state, - min(sizeof(struct fpu_state_struct), - sizeof(struct fpucontext)))) - return -1; - - return 1; -} - -/* - * kill a process's FPU state during restoration after signal handling - */ -void fpu_kill_state(struct task_struct *tsk) -{ - /* disown anything left in the FPU */ - preempt_disable(); - -#ifndef CONFIG_LAZY_SAVE_FPU - if (tsk->thread.fpu_flags & THREAD_HAS_FPU) { - tsk->thread.uregs->epsw &= ~EPSW_FE; - tsk->thread.fpu_flags &= ~THREAD_HAS_FPU; - } -#else /* !CONFIG_LAZY_SAVE_FPU */ - if (fpu_state_owner == tsk) { - fpu_state_owner->thread.uregs->epsw &= ~EPSW_FE; - fpu_state_owner = NULL; - } -#endif /* !CONFIG_LAZY_SAVE_FPU */ - - preempt_enable(); - - /* we no longer have a valid current FPU state */ - clear_using_fpu(tsk); -} - -/* - * restore the FPU state from a signal context - */ -int fpu_restore_sigcontext(struct fpucontext *fpucontext) -{ - struct task_struct *tsk = current; - int ret; - - /* load up the old FPU state */ - ret = copy_from_user(&tsk->thread.fpu_state, fpucontext, - min(sizeof(struct fpu_state_struct), - sizeof(struct fpucontext))); - if (!ret) - set_using_fpu(tsk); - - return ret; -} - -/* - * fill in the FPU structure for a core dump - */ -int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpreg) -{ - struct task_struct *tsk = current; - int fpvalid; - - fpvalid = is_using_fpu(tsk); - if (fpvalid) { - unlazy_fpu(tsk); - memcpy(fpreg, &tsk->thread.fpu_state, sizeof(*fpreg)); - } - - return fpvalid; -} diff --git a/arch/mn10300/kernel/gdb-io-serial-low.S b/arch/mn10300/kernel/gdb-io-serial-low.S deleted file mode 100644 index b1d0152e96cb9..0000000000000 --- a/arch/mn10300/kernel/gdb-io-serial-low.S +++ /dev/null @@ -1,91 +0,0 @@ -############################################################################### -# -# 16550 serial Rx interrupt handler for gdbstub I/O -# -# Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. -# Written by David Howells (dhowells@redhat.com) -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public Licence -# as published by the Free Software Foundation; either version -# 2 of the Licence, or (at your option) any later version. -# -############################################################################### -#include -#include -#include -#include -#include -#include -#include -#include -#include - - .text - -############################################################################### -# -# GDB stub serial receive interrupt entry point -# - intended to run at interrupt priority 0 -# -############################################################################### - .globl gdbstub_io_rx_handler - .type gdbstub_io_rx_handler,@function -gdbstub_io_rx_handler: - movm [d2,d3,a2,a3],(sp) - -#if 1 - movbu (GDBPORT_SERIAL_IIR),d2 -#endif - - mov (gdbstub_rx_inp),a3 -gdbstub_io_rx_more: - mov a3,a2 - add 2,a3 - and 0x00000fff,a3 - mov (gdbstub_rx_outp),d3 - cmp a3,d3 - beq gdbstub_io_rx_overflow - - movbu (GDBPORT_SERIAL_LSR),d3 - btst UART_LSR_DR,d3 - beq gdbstub_io_rx_done - movbu (GDBPORT_SERIAL_RX),d2 - movbu d3,(gdbstub_rx_buffer+1,a2) - movbu d2,(gdbstub_rx_buffer,a2) - mov a3,(gdbstub_rx_inp) - bra gdbstub_io_rx_more - -gdbstub_io_rx_done: - mov GxICR_DETECT,d2 - movbu d2,(XIRQxICR(GDBPORT_SERIAL_IRQ)) # ACK the interrupt - movhu (XIRQxICR(GDBPORT_SERIAL_IRQ)),d2 # flush - movm (sp),[d2,d3,a2,a3] - bset 0x01,(gdbstub_busy) - beq gdbstub_io_rx_enter - rti - -gdbstub_io_rx_overflow: - bset 0x01,(gdbstub_rx_overflow) - bra gdbstub_io_rx_done - -gdbstub_io_rx_enter: - LOCAL_CHANGE_INTR_MASK_LEVEL(NUM2EPSW_IM(CONFIG_GDBSTUB_IRQ_LEVEL+1)) - add -4,sp - SAVE_ALL - - mov 0xffffffff,d0 - mov d0,(REG_ORIG_D0,fp) - mov 0x280,d1 - - mov fp,d0 - call gdbstub_rx_irq[],0 # gdbstub_rx_irq(regs,excep) - - LOCAL_CLI - bclr 0x01,(gdbstub_busy) - - .globl gdbstub_return -gdbstub_return: - RESTORE_ALL - - .size gdbstub_io_rx_handler,.-gdbstub_io_rx_handler diff --git a/arch/mn10300/kernel/gdb-io-serial.c b/arch/mn10300/kernel/gdb-io-serial.c deleted file mode 100644 index df51242744cc4..0000000000000 --- a/arch/mn10300/kernel/gdb-io-serial.c +++ /dev/null @@ -1,174 +0,0 @@ -/* 16550 serial driver for gdbstub I/O - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -/* - * initialise the GDB stub - */ -void gdbstub_io_init(void) -{ - u16 tmp; - - /* set up the serial port */ - GDBPORT_SERIAL_LCR = UART_LCR_WLEN8; /* 1N8 */ - GDBPORT_SERIAL_FCR = (UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR | - UART_FCR_CLEAR_XMIT); - - FLOWCTL_CLEAR(DTR); - FLOWCTL_SET(RTS); - - gdbstub_io_set_baud(115200); - - /* we want to get serial receive interrupts */ - XIRQxICR(GDBPORT_SERIAL_IRQ) = 0; - tmp = XIRQxICR(GDBPORT_SERIAL_IRQ); - -#if CONFIG_GDBSTUB_IRQ_LEVEL == 0 - IVAR0 = EXCEP_IRQ_LEVEL0; -#elif CONFIG_GDBSTUB_IRQ_LEVEL == 1 - IVAR1 = EXCEP_IRQ_LEVEL1; -#elif CONFIG_GDBSTUB_IRQ_LEVEL == 2 - IVAR2 = EXCEP_IRQ_LEVEL2; -#elif CONFIG_GDBSTUB_IRQ_LEVEL == 3 - IVAR3 = EXCEP_IRQ_LEVEL3; -#elif CONFIG_GDBSTUB_IRQ_LEVEL == 4 - IVAR4 = EXCEP_IRQ_LEVEL4; -#elif CONFIG_GDBSTUB_IRQ_LEVEL == 5 - IVAR5 = EXCEP_IRQ_LEVEL5; -#else -#error "Unknown irq level for gdbstub." -#endif - - set_intr_stub(NUM2EXCEP_IRQ_LEVEL(CONFIG_GDBSTUB_IRQ_LEVEL), - gdbstub_io_rx_handler); - - XIRQxICR(GDBPORT_SERIAL_IRQ) &= ~GxICR_REQUEST; - XIRQxICR(GDBPORT_SERIAL_IRQ) = - GxICR_ENABLE | NUM2GxICR_LEVEL(CONFIG_GDBSTUB_IRQ_LEVEL); - tmp = XIRQxICR(GDBPORT_SERIAL_IRQ); - - GDBPORT_SERIAL_IER = UART_IER_RDI | UART_IER_RLSI; - - /* permit level 0 IRQs to take place */ - arch_local_change_intr_mask_level( - NUM2EPSW_IM(CONFIG_GDBSTUB_IRQ_LEVEL + 1)); -} - -/* - * set up the GDB stub serial port baud rate timers - */ -void gdbstub_io_set_baud(unsigned baud) -{ - unsigned value; - u8 lcr; - - value = 18432000 / 16 / baud; - - lcr = GDBPORT_SERIAL_LCR; - GDBPORT_SERIAL_LCR |= UART_LCR_DLAB; - GDBPORT_SERIAL_DLL = value & 0xff; - GDBPORT_SERIAL_DLM = (value >> 8) & 0xff; - GDBPORT_SERIAL_LCR = lcr; -} - -/* - * wait for a character to come from the debugger - */ -int gdbstub_io_rx_char(unsigned char *_ch, int nonblock) -{ - unsigned ix; - u8 ch, st; -#if defined(CONFIG_MN10300_WD_TIMER) - int cpu; -#endif - - *_ch = 0xff; - - if (gdbstub_rx_unget) { - *_ch = gdbstub_rx_unget; - gdbstub_rx_unget = 0; - return 0; - } - - try_again: - /* pull chars out of the buffer */ - ix = gdbstub_rx_outp; - barrier(); - if (ix == gdbstub_rx_inp) { - if (nonblock) - return -EAGAIN; -#ifdef CONFIG_MN10300_WD_TIMER - for (cpu = 0; cpu < NR_CPUS; cpu++) - watchdog_alert_counter[cpu] = 0; -#endif - goto try_again; - } - - ch = gdbstub_rx_buffer[ix++]; - st = gdbstub_rx_buffer[ix++]; - barrier(); - gdbstub_rx_outp = ix & 0x00000fff; - - if (st & UART_LSR_BI) { - gdbstub_proto("### GDB Rx Break Detected ###\n"); - return -EINTR; - } else if (st & (UART_LSR_FE | UART_LSR_OE | UART_LSR_PE)) { - gdbstub_proto("### GDB Rx Error (st=%02x) ###\n", st); - return -EIO; - } else { - gdbstub_proto("### GDB Rx %02x (st=%02x) ###\n", ch, st); - *_ch = ch & 0x7f; - return 0; - } -} - -/* - * send a character to the debugger - */ -void gdbstub_io_tx_char(unsigned char ch) -{ - FLOWCTL_SET(DTR); - LSR_WAIT_FOR(THRE); - /* FLOWCTL_WAIT_FOR(CTS); */ - - if (ch == 0x0a) { - GDBPORT_SERIAL_TX = 0x0d; - LSR_WAIT_FOR(THRE); - /* FLOWCTL_WAIT_FOR(CTS); */ - } - GDBPORT_SERIAL_TX = ch; - - FLOWCTL_CLEAR(DTR); -} - -/* - * send a character to the debugger - */ -void gdbstub_io_tx_flush(void) -{ - LSR_WAIT_FOR(TEMT); - LSR_WAIT_FOR(THRE); - FLOWCTL_CLEAR(DTR); -} diff --git a/arch/mn10300/kernel/gdb-io-ttysm-low.S b/arch/mn10300/kernel/gdb-io-ttysm-low.S deleted file mode 100644 index 060b7cca735dd..0000000000000 --- a/arch/mn10300/kernel/gdb-io-ttysm-low.S +++ /dev/null @@ -1,93 +0,0 @@ -############################################################################### -# -# MN10300 On-chip serial Rx interrupt handler for GDB stub I/O -# -# Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. -# Written by David Howells (dhowells@redhat.com) -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public Licence -# as published by the Free Software Foundation; either version -# 2 of the Licence, or (at your option) any later version. -# -############################################################################### -#include -#include -#include -#include -#include -#include -#include -#include -#include "mn10300-serial.h" - - .text - -############################################################################### -# -# GDB stub serial receive interrupt entry point -# - intended to run at interrupt priority 0 -# -############################################################################### - .globl gdbstub_io_rx_handler - .type gdbstub_io_rx_handler,@function -gdbstub_io_rx_handler: - movm [d2,d3,a2,a3],(sp) - - mov (gdbstub_rx_inp),a3 -gdbstub_io_rx_more: - mov a3,a2 - add 2,a3 - and PAGE_SIZE_asm-1,a3 - mov (gdbstub_rx_outp),d3 - cmp a3,d3 - beq gdbstub_io_rx_overflow - - movbu (SCgSTR),d3 - btst SC01STR_RBF,d3 - beq gdbstub_io_rx_done - movbu (SCgRXB),d2 - movbu d3,(gdbstub_rx_buffer+1,a2) - movbu d2,(gdbstub_rx_buffer,a2) - mov a3,(gdbstub_rx_inp) - bra gdbstub_io_rx_more - -gdbstub_io_rx_done: - mov GxICR_DETECT,d2 - movbu d2,(GxICR(SCgRXIRQ)) # ACK the interrupt - movhu (GxICR(SCgRXIRQ)),d2 # flush - - movm (sp),[d2,d3,a2,a3] - bset 0x01,(gdbstub_busy) - beq gdbstub_io_rx_enter - rti - -gdbstub_io_rx_overflow: - bset 0x01,(gdbstub_rx_overflow) - bra gdbstub_io_rx_done - -############################################################################### -# -# debugging interrupt - enter the GDB stub proper -# -############################################################################### -gdbstub_io_rx_enter: - or EPSW_IE|EPSW_IM_1,epsw - add -4,sp - SAVE_ALL - - mov 0xffffffff,d0 - mov d0,(REG_ORIG_D0,fp) - mov 0x280,d1 - - mov fp,d0 - call gdbstub_rx_irq[],0 # gdbstub_io_rx_irq(regs,excep) - - and ~EPSW_IE,epsw - bclr 0x01,(gdbstub_busy) - - .globl gdbstub_return -gdbstub_return: - RESTORE_ALL - - .size gdbstub_io_rx_handler,.-gdbstub_io_rx_handler diff --git a/arch/mn10300/kernel/gdb-io-ttysm.c b/arch/mn10300/kernel/gdb-io-ttysm.c deleted file mode 100644 index caae8cac9db10..0000000000000 --- a/arch/mn10300/kernel/gdb-io-ttysm.c +++ /dev/null @@ -1,303 +0,0 @@ -/* MN10300 On-chip serial driver for gdbstub I/O - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "mn10300-serial.h" - -#if defined(CONFIG_GDBSTUB_ON_TTYSM0) -struct mn10300_serial_port *const gdbstub_port = &mn10300_serial_port_sif0; -#elif defined(CONFIG_GDBSTUB_ON_TTYSM1) -struct mn10300_serial_port *const gdbstub_port = &mn10300_serial_port_sif1; -#else -struct mn10300_serial_port *const gdbstub_port = &mn10300_serial_port_sif2; -#endif - - -/* - * initialise the GDB stub I/O routines - */ -void __init gdbstub_io_init(void) -{ - uint16_t scxctr; - int tmp; - - switch (gdbstub_port->clock_src) { - case MNSCx_CLOCK_SRC_IOCLK: - gdbstub_port->ioclk = MN10300_IOCLK; - break; - -#ifdef MN10300_IOBCLK - case MNSCx_CLOCK_SRC_IOBCLK: - gdbstub_port->ioclk = MN10300_IOBCLK; - break; -#endif - default: - BUG(); - } - - /* set up the serial port */ - gdbstub_io_set_baud(115200); - - /* we want to get serial receive interrupts */ - set_intr_level(gdbstub_port->rx_irq, - NUM2GxICR_LEVEL(CONFIG_DEBUGGER_IRQ_LEVEL)); - set_intr_level(gdbstub_port->tx_irq, - NUM2GxICR_LEVEL(CONFIG_DEBUGGER_IRQ_LEVEL)); - set_intr_stub(NUM2EXCEP_IRQ_LEVEL(CONFIG_DEBUGGER_IRQ_LEVEL), - gdbstub_io_rx_handler); - - *gdbstub_port->rx_icr |= GxICR_ENABLE; - tmp = *gdbstub_port->rx_icr; - - /* enable the device */ - scxctr = SC01CTR_CLN_8BIT; /* 1N8 */ - switch (gdbstub_port->div_timer) { - case MNSCx_DIV_TIMER_16BIT: - scxctr |= SC0CTR_CK_TM8UFLOW_8; /* == SC1CTR_CK_TM9UFLOW_8 - == SC2CTR_CK_TM10UFLOW_8 */ - break; - - case MNSCx_DIV_TIMER_8BIT: - scxctr |= SC0CTR_CK_TM2UFLOW_8; - break; - } - - scxctr |= SC01CTR_TXE | SC01CTR_RXE; - - *gdbstub_port->_control = scxctr; - tmp = *gdbstub_port->_control; - - /* permit level 0 IRQs only */ - arch_local_change_intr_mask_level( - NUM2EPSW_IM(CONFIG_DEBUGGER_IRQ_LEVEL + 1)); -} - -/* - * set up the GDB stub serial port baud rate timers - */ -void gdbstub_io_set_baud(unsigned baud) -{ - const unsigned bits = 10; /* 1 [start] + 8 [data] + 0 [parity] + - * 1 [stop] */ - unsigned long ioclk = gdbstub_port->ioclk; - unsigned xdiv, tmp; - uint16_t tmxbr; - uint8_t tmxmd; - - if (!baud) { - baud = 9600; - } else if (baud == 134) { - baud = 269; /* 134 is really 134.5 */ - xdiv = 2; - } - -try_alternative: - xdiv = 1; - - switch (gdbstub_port->div_timer) { - case MNSCx_DIV_TIMER_16BIT: - tmxmd = TM8MD_SRC_IOCLK; - tmxbr = tmp = (ioclk / (baud * xdiv) + 4) / 8 - 1; - if (tmp > 0 && tmp <= 65535) - goto timer_okay; - - tmxmd = TM8MD_SRC_IOCLK_8; - tmxbr = tmp = (ioclk / (baud * 8 * xdiv) + 4) / 8 - 1; - if (tmp > 0 && tmp <= 65535) - goto timer_okay; - - tmxmd = TM8MD_SRC_IOCLK_32; - tmxbr = tmp = (ioclk / (baud * 32 * xdiv) + 4) / 8 - 1; - if (tmp > 0 && tmp <= 65535) - goto timer_okay; - - break; - - case MNSCx_DIV_TIMER_8BIT: - tmxmd = TM2MD_SRC_IOCLK; - tmxbr = tmp = (ioclk / (baud * xdiv) + 4) / 8 - 1; - if (tmp > 0 && tmp <= 255) - goto timer_okay; - - tmxmd = TM2MD_SRC_IOCLK_8; - tmxbr = tmp = (ioclk / (baud * 8 * xdiv) + 4) / 8 - 1; - if (tmp > 0 && tmp <= 255) - goto timer_okay; - - tmxmd = TM2MD_SRC_IOCLK_32; - tmxbr = tmp = (ioclk / (baud * 32 * xdiv) + 4) / 8 - 1; - if (tmp > 0 && tmp <= 255) - goto timer_okay; - break; - } - - /* as a last resort, if the quotient is zero, default to 9600 bps */ - baud = 9600; - goto try_alternative; - -timer_okay: - gdbstub_port->uart.timeout = (2 * bits * HZ) / baud; - gdbstub_port->uart.timeout += HZ / 50; - - /* set the timer to produce the required baud rate */ - switch (gdbstub_port->div_timer) { - case MNSCx_DIV_TIMER_16BIT: - *gdbstub_port->_tmxmd = 0; - *gdbstub_port->_tmxbr = tmxbr; - *gdbstub_port->_tmxmd = TM8MD_INIT_COUNTER; - *gdbstub_port->_tmxmd = tmxmd | TM8MD_COUNT_ENABLE; - break; - - case MNSCx_DIV_TIMER_8BIT: - *gdbstub_port->_tmxmd = 0; - *(volatile u8 *) gdbstub_port->_tmxbr = (u8)tmxbr; - *gdbstub_port->_tmxmd = TM2MD_INIT_COUNTER; - *gdbstub_port->_tmxmd = tmxmd | TM2MD_COUNT_ENABLE; - break; - } -} - -/* - * wait for a character to come from the debugger - */ -int gdbstub_io_rx_char(unsigned char *_ch, int nonblock) -{ - unsigned ix; - u8 ch, st; -#if defined(CONFIG_MN10300_WD_TIMER) - int cpu; -#endif - - *_ch = 0xff; - - if (gdbstub_rx_unget) { - *_ch = gdbstub_rx_unget; - gdbstub_rx_unget = 0; - return 0; - } - -try_again: - /* pull chars out of the buffer */ - ix = gdbstub_rx_outp; - barrier(); - if (ix == gdbstub_rx_inp) { - if (nonblock) - return -EAGAIN; -#ifdef CONFIG_MN10300_WD_TIMER - for (cpu = 0; cpu < NR_CPUS; cpu++) - watchdog_alert_counter[cpu] = 0; -#endif - goto try_again; - } - - ch = gdbstub_rx_buffer[ix++]; - st = gdbstub_rx_buffer[ix++]; - barrier(); - gdbstub_rx_outp = ix & (PAGE_SIZE - 1); - - st &= SC01STR_RXF | SC01STR_RBF | SC01STR_FEF | SC01STR_PEF | - SC01STR_OEF; - - /* deal with what we've got - * - note that the UART doesn't do BREAK-detection for us - */ - if (st & SC01STR_FEF && ch == 0) { - switch (gdbstub_port->rx_brk) { - case 0: gdbstub_port->rx_brk = 1; goto try_again; - case 1: gdbstub_port->rx_brk = 2; goto try_again; - case 2: - gdbstub_port->rx_brk = 3; - gdbstub_proto("### GDB MNSERIAL Rx Break Detected" - " ###\n"); - return -EINTR; - default: - goto try_again; - } - } else if (st & SC01STR_FEF) { - if (gdbstub_port->rx_brk) - goto try_again; - - gdbstub_proto("### GDB MNSERIAL Framing Error ###\n"); - return -EIO; - } else if (st & SC01STR_OEF) { - if (gdbstub_port->rx_brk) - goto try_again; - - gdbstub_proto("### GDB MNSERIAL Overrun Error ###\n"); - return -EIO; - } else if (st & SC01STR_PEF) { - if (gdbstub_port->rx_brk) - goto try_again; - - gdbstub_proto("### GDB MNSERIAL Parity Error ###\n"); - return -EIO; - } else { - /* look for the tail-end char on a break run */ - if (gdbstub_port->rx_brk == 3) { - switch (ch) { - case 0xFF: - case 0xFE: - case 0xFC: - case 0xF8: - case 0xF0: - case 0xE0: - case 0xC0: - case 0x80: - case 0x00: - gdbstub_port->rx_brk = 0; - goto try_again; - default: - break; - } - } - - gdbstub_port->rx_brk = 0; - gdbstub_io("### GDB Rx %02x (st=%02x) ###\n", ch, st); - *_ch = ch & 0x7f; - return 0; - } -} - -/* - * send a character to the debugger - */ -void gdbstub_io_tx_char(unsigned char ch) -{ - while (*gdbstub_port->_status & SC01STR_TBF) - continue; - - if (ch == 0x0a) { - *(u8 *) gdbstub_port->_txb = 0x0d; - while (*gdbstub_port->_status & SC01STR_TBF) - continue; - } - - *(u8 *) gdbstub_port->_txb = ch; -} - -/* - * flush the transmission buffers - */ -void gdbstub_io_tx_flush(void) -{ - while (*gdbstub_port->_status & (SC01STR_TBF | SC01STR_TXF)) - continue; -} diff --git a/arch/mn10300/kernel/gdb-low.S b/arch/mn10300/kernel/gdb-low.S deleted file mode 100644 index e2725552cd82a..0000000000000 --- a/arch/mn10300/kernel/gdb-low.S +++ /dev/null @@ -1,115 +0,0 @@ -############################################################################### -# -# MN10300 Low-level gdbstub routines -# -# Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. -# Written by David Howells (dhowells@redhat.com) -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public Licence -# as published by the Free Software Foundation; either version -# 2 of the Licence, or (at your option) any later version. -# -############################################################################### -#include -#include -#include -#include -#include -#include -#include -#include - - .text - -############################################################################### -# -# GDB stub read memory with guard -# - D0 holds the memory address to read -# - D1 holds the address to store the byte into -# -############################################################################### - .globl gdbstub_read_byte_guard - .globl gdbstub_read_byte_cont -ENTRY(gdbstub_read_byte) - mov d0,a0 - mov d1,a1 - clr d0 -gdbstub_read_byte_guard: - movbu (a0),d1 -gdbstub_read_byte_cont: - movbu d1,(a1) - ret [],0 - - .globl gdbstub_read_word_guard - .globl gdbstub_read_word_cont -ENTRY(gdbstub_read_word) - mov d0,a0 - mov d1,a1 - clr d0 -gdbstub_read_word_guard: - movhu (a0),d1 -gdbstub_read_word_cont: - movhu d1,(a1) - ret [],0 - - .globl gdbstub_read_dword_guard - .globl gdbstub_read_dword_cont -ENTRY(gdbstub_read_dword) - mov d0,a0 - mov d1,a1 - clr d0 -gdbstub_read_dword_guard: - mov (a0),d1 -gdbstub_read_dword_cont: - mov d1,(a1) - ret [],0 - -############################################################################### -# -# GDB stub write memory with guard -# - D0 holds the byte to store -# - D1 holds the memory address to write -# -############################################################################### - .globl gdbstub_write_byte_guard - .globl gdbstub_write_byte_cont -ENTRY(gdbstub_write_byte) - mov d0,a0 - mov d1,a1 - clr d0 -gdbstub_write_byte_guard: - movbu a0,(a1) -gdbstub_write_byte_cont: - ret [],0 - - .globl gdbstub_write_word_guard - .globl gdbstub_write_word_cont -ENTRY(gdbstub_write_word) - mov d0,a0 - mov d1,a1 - clr d0 -gdbstub_write_word_guard: - movhu a0,(a1) -gdbstub_write_word_cont: - ret [],0 - - .globl gdbstub_write_dword_guard - .globl gdbstub_write_dword_cont -ENTRY(gdbstub_write_dword) - mov d0,a0 - mov d1,a1 - clr d0 -gdbstub_write_dword_guard: - mov a0,(a1) -gdbstub_write_dword_cont: - ret [],0 - -############################################################################### -# -# GDB stub BUG() trap -# -############################################################################### -ENTRY(__gdbstub_bug_trap) - .byte 0xF7,0xF7 # don't use 0xFF as the JTAG unit preempts that - ret [],0 diff --git a/arch/mn10300/kernel/gdb-stub.c b/arch/mn10300/kernel/gdb-stub.c deleted file mode 100644 index 3399d5699804f..0000000000000 --- a/arch/mn10300/kernel/gdb-stub.c +++ /dev/null @@ -1,1924 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* MN10300 GDB stub - * - * Originally written by Glenn Engel, Lake Stevens Instrument Division - * - * Contributed by HP Systems - * - * Modified for SPARC by Stu Grossman, Cygnus Support. - * - * Modified for Linux/MIPS (and MIPS in general) by Andreas Busse - * Send complaints, suggestions etc. to - * - * Copyright (C) 1995 Andreas Busse - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Modified for Linux/mn10300 by David Howells - */ - -/* - * To enable debugger support, two things need to happen. One, a - * call to set_debug_traps() is necessary in order to allow any breakpoints - * or error conditions to be properly intercepted and reported to gdb. - * Two, a breakpoint needs to be generated to begin communication. This - * is most easily accomplished by a call to breakpoint(). Breakpoint() - * simulates a breakpoint by executing a BREAK instruction. - * - * - * The following gdb commands are supported: - * - * command function Return value - * - * g return the value of the CPU registers hex data or ENN - * G set the value of the CPU registers OK or ENN - * - * mAA..AA,LLLL Read LLLL bytes at address AA..AA hex data or ENN - * MAA..AA,LLLL: Write LLLL bytes at address AA.AA OK or ENN - * - * c Resume at current address SNN ( signal NN) - * cAA..AA Continue at address AA..AA SNN - * - * s Step one instruction SNN - * sAA..AA Step one instruction from AA..AA SNN - * - * k kill - * - * ? What was the last sigval ? SNN (signal NN) - * - * bBB..BB Set baud rate to BB..BB OK or BNN, then sets - * baud rate - * - * All commands and responses are sent with a packet which includes a - * checksum. A packet consists of - * - * $#. - * - * where - * :: - * :: < two hex digits computed as modulo 256 sum of > - * - * When a packet is received, it is first acknowledged with either '+' or '-'. - * '+' indicates a successful transfer. '-' indicates a failed transfer. - * - * Example: - * - * Host: Reply: - * $m0,10#2a +$00010203040506070809101112131415#42 - * - * - * ============== - * MORE EXAMPLES: - * ============== - * - * For reference -- the following are the steps that one - * company took (RidgeRun Inc) to get remote gdb debugging - * going. In this scenario the host machine was a PC and the - * target platform was a Galileo EVB64120A MIPS evaluation - * board. - * - * Step 1: - * First download gdb-5.0.tar.gz from the internet. - * and then build/install the package. - * - * Example: - * $ tar zxf gdb-5.0.tar.gz - * $ cd gdb-5.0 - * $ ./configure --target=am33_2.0-linux-gnu - * $ make - * $ install - * am33_2.0-linux-gnu-gdb - * - * Step 2: - * Configure linux for remote debugging and build it. - * - * Example: - * $ cd ~/linux - * $ make menuconfig - * $ make dep; make vmlinux - * - * Step 3: - * Download the kernel to the remote target and start - * the kernel running. It will promptly halt and wait - * for the host gdb session to connect. It does this - * since the "Kernel Hacking" option has defined - * CONFIG_REMOTE_DEBUG which in turn enables your calls - * to: - * set_debug_traps(); - * breakpoint(); - * - * Step 4: - * Start the gdb session on the host. - * - * Example: - * $ am33_2.0-linux-gnu-gdb vmlinux - * (gdb) set remotebaud 115200 - * (gdb) target remote /dev/ttyS1 - * ...at this point you are connected to - * the remote target and can use gdb - * in the normal fasion. Setting - * breakpoints, single stepping, - * printing variables, etc. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -/* define to use F7F7 rather than FF which is subverted by JTAG debugger */ -#undef GDBSTUB_USE_F7F7_AS_BREAKPOINT - -/* - * BUFMAX defines the maximum number of characters in inbound/outbound buffers - * at least NUMREGBYTES*2 are needed for register packets - */ -#define BUFMAX 2048 - -static const char gdbstub_banner[] = - "Linux/MN10300 GDB Stub (c) RedHat 2007\n"; - -u8 gdbstub_rx_buffer[PAGE_SIZE] __attribute__((aligned(PAGE_SIZE))); -u32 gdbstub_rx_inp; -u32 gdbstub_rx_outp; -u8 gdbstub_busy; -u8 gdbstub_rx_overflow; -u8 gdbstub_rx_unget; - -static u8 gdbstub_flush_caches; -static char input_buffer[BUFMAX]; -static char output_buffer[BUFMAX]; -static char trans_buffer[BUFMAX]; - -struct gdbstub_bkpt { - u8 *addr; /* address of breakpoint */ - u8 len; /* size of breakpoint */ - u8 origbytes[7]; /* original bytes */ -}; - -static struct gdbstub_bkpt gdbstub_bkpts[256]; - -/* - * local prototypes - */ -static void getpacket(char *buffer); -static int putpacket(char *buffer); -static int computeSignal(enum exception_code excep); -static int hex(unsigned char ch); -static int hexToInt(char **ptr, int *intValue); -static unsigned char *mem2hex(const void *mem, char *buf, int count, - int may_fault); -static const char *hex2mem(const char *buf, void *_mem, int count, - int may_fault); - -/* - * Convert ch from a hex digit to an int - */ -static int hex(unsigned char ch) -{ - if (ch >= 'a' && ch <= 'f') - return ch - 'a' + 10; - if (ch >= '0' && ch <= '9') - return ch - '0'; - if (ch >= 'A' && ch <= 'F') - return ch - 'A' + 10; - return -1; -} - -#ifdef CONFIG_GDBSTUB_DEBUGGING - -void debug_to_serial(const char *p, int n) -{ - __debug_to_serial(p, n); - /* gdbstub_console_write(NULL, p, n); */ -} - -void gdbstub_printk(const char *fmt, ...) -{ - va_list args; - int len; - - /* Emit the output into the temporary buffer */ - va_start(args, fmt); - len = vsnprintf(trans_buffer, sizeof(trans_buffer), fmt, args); - va_end(args); - debug_to_serial(trans_buffer, len); -} - -#endif - -static inline char *gdbstub_strcpy(char *dst, const char *src) -{ - int loop = 0; - while ((dst[loop] = src[loop])) - loop++; - return dst; -} - -/* - * scan for the sequence $# - */ -static void getpacket(char *buffer) -{ - unsigned char checksum; - unsigned char xmitcsum; - unsigned char ch; - int count, i, ret, error; - - for (;;) { - /* - * wait around for the start character, - * ignore all other characters - */ - do { - gdbstub_io_rx_char(&ch, 0); - } while (ch != '$'); - - checksum = 0; - xmitcsum = -1; - count = 0; - error = 0; - - /* - * now, read until a # or end of buffer is found - */ - while (count < BUFMAX) { - ret = gdbstub_io_rx_char(&ch, 0); - if (ret < 0) - error = ret; - - if (ch == '#') - break; - checksum += ch; - buffer[count] = ch; - count++; - } - - if (error == -EIO) { - gdbstub_proto("### GDB Rx Error - Skipping packet" - " ###\n"); - gdbstub_proto("### GDB Tx NAK\n"); - gdbstub_io_tx_char('-'); - continue; - } - - if (count >= BUFMAX || error) - continue; - - buffer[count] = 0; - - /* read the checksum */ - ret = gdbstub_io_rx_char(&ch, 0); - if (ret < 0) - error = ret; - xmitcsum = hex(ch) << 4; - - ret = gdbstub_io_rx_char(&ch, 0); - if (ret < 0) - error = ret; - xmitcsum |= hex(ch); - - if (error) { - if (error == -EIO) - gdbstub_io("### GDB Rx Error -" - " Skipping packet\n"); - gdbstub_io("### GDB Tx NAK\n"); - gdbstub_io_tx_char('-'); - continue; - } - - /* check the checksum */ - if (checksum != xmitcsum) { - gdbstub_io("### GDB Tx NAK\n"); - gdbstub_io_tx_char('-'); /* failed checksum */ - continue; - } - - gdbstub_proto("### GDB Rx '$%s#%02x' ###\n", buffer, checksum); - gdbstub_io("### GDB Tx ACK\n"); - gdbstub_io_tx_char('+'); /* successful transfer */ - - /* - * if a sequence char is present, - * reply the sequence ID - */ - if (buffer[2] == ':') { - gdbstub_io_tx_char(buffer[0]); - gdbstub_io_tx_char(buffer[1]); - - /* - * remove sequence chars from buffer - */ - count = 0; - while (buffer[count]) - count++; - for (i = 3; i <= count; i++) - buffer[i - 3] = buffer[i]; - } - - break; - } -} - -/* - * send the packet in buffer. - * - return 0 if successfully ACK'd - * - return 1 if abandoned due to new incoming packet - */ -static int putpacket(char *buffer) -{ - unsigned char checksum; - unsigned char ch; - int count; - - /* - * $#. - */ - gdbstub_proto("### GDB Tx $'%s'#?? ###\n", buffer); - - do { - gdbstub_io_tx_char('$'); - checksum = 0; - count = 0; - - while ((ch = buffer[count]) != 0) { - gdbstub_io_tx_char(ch); - checksum += ch; - count += 1; - } - - gdbstub_io_tx_char('#'); - gdbstub_io_tx_char(hex_asc_hi(checksum)); - gdbstub_io_tx_char(hex_asc_lo(checksum)); - - } while (gdbstub_io_rx_char(&ch, 0), - ch == '-' && (gdbstub_io("### GDB Rx NAK\n"), 0), - ch != '-' && ch != '+' && - (gdbstub_io("### GDB Rx ??? %02x\n", ch), 0), - ch != '+' && ch != '$'); - - if (ch == '+') { - gdbstub_io("### GDB Rx ACK\n"); - return 0; - } - - gdbstub_io("### GDB Tx Abandoned\n"); - gdbstub_rx_unget = ch; - return 1; -} - -/* - * While we find nice hex chars, build an int. - * Return number of chars processed. - */ -static int hexToInt(char **ptr, int *intValue) -{ - int numChars = 0; - int hexValue; - - *intValue = 0; - - while (**ptr) { - hexValue = hex(**ptr); - if (hexValue < 0) - break; - - *intValue = (*intValue << 4) | hexValue; - numChars++; - - (*ptr)++; - } - - return (numChars); -} - -#ifdef CONFIG_GDBSTUB_ALLOW_SINGLE_STEP -/* - * We single-step by setting breakpoints. When an exception - * is handled, we need to restore the instructions hoisted - * when the breakpoints were set. - * - * This is where we save the original instructions. - */ -static struct gdb_bp_save { - u8 *addr; - u8 opcode[2]; -} step_bp[2]; - -static const unsigned char gdbstub_insn_sizes[256] = -{ - /* 1 2 3 4 5 6 7 8 9 a b c d e f */ - 1, 3, 3, 3, 1, 3, 3, 3, 1, 3, 3, 3, 1, 3, 3, 3, /* 0 */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 1 */ - 2, 2, 2, 2, 3, 3, 3, 3, 2, 2, 2, 2, 3, 3, 3, 3, /* 2 */ - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, /* 3 */ - 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, /* 4 */ - 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, /* 5 */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 6 */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 7 */ - 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, /* 8 */ - 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, /* 9 */ - 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, /* a */ - 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, /* b */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 2, /* c */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* d */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* e */ - 0, 2, 2, 2, 2, 2, 2, 4, 0, 3, 0, 4, 0, 6, 7, 1 /* f */ -}; - -static int __gdbstub_mark_bp(u8 *addr, int ix) -{ - /* vmalloc area */ - if (((u8 *) VMALLOC_START <= addr) && (addr < (u8 *) VMALLOC_END)) - goto okay; - /* SRAM, SDRAM */ - if (((u8 *) 0x80000000UL <= addr) && (addr < (u8 *) 0xa0000000UL)) - goto okay; - return 0; - -okay: - if (gdbstub_read_byte(addr + 0, &step_bp[ix].opcode[0]) < 0 || - gdbstub_read_byte(addr + 1, &step_bp[ix].opcode[1]) < 0) - return 0; - - step_bp[ix].addr = addr; - return 1; -} - -static inline void __gdbstub_restore_bp(void) -{ -#ifdef GDBSTUB_USE_F7F7_AS_BREAKPOINT - if (step_bp[0].addr) { - gdbstub_write_byte(step_bp[0].opcode[0], step_bp[0].addr + 0); - gdbstub_write_byte(step_bp[0].opcode[1], step_bp[0].addr + 1); - } - if (step_bp[1].addr) { - gdbstub_write_byte(step_bp[1].opcode[0], step_bp[1].addr + 0); - gdbstub_write_byte(step_bp[1].opcode[1], step_bp[1].addr + 1); - } -#else - if (step_bp[0].addr) - gdbstub_write_byte(step_bp[0].opcode[0], step_bp[0].addr + 0); - if (step_bp[1].addr) - gdbstub_write_byte(step_bp[1].opcode[0], step_bp[1].addr + 0); -#endif - - gdbstub_flush_caches = 1; - - step_bp[0].addr = NULL; - step_bp[0].opcode[0] = 0; - step_bp[0].opcode[1] = 0; - step_bp[1].addr = NULL; - step_bp[1].opcode[0] = 0; - step_bp[1].opcode[1] = 0; -} - -/* - * emulate single stepping by means of breakpoint instructions - */ -static int gdbstub_single_step(struct pt_regs *regs) -{ - unsigned size; - uint32_t x; - uint8_t cur, *pc, *sp; - - step_bp[0].addr = NULL; - step_bp[0].opcode[0] = 0; - step_bp[0].opcode[1] = 0; - step_bp[1].addr = NULL; - step_bp[1].opcode[0] = 0; - step_bp[1].opcode[1] = 0; - x = 0; - - pc = (u8 *) regs->pc; - sp = (u8 *) (regs + 1); - if (gdbstub_read_byte(pc, &cur) < 0) - return -EFAULT; - - gdbstub_bkpt("Single Step from %p { %02x }\n", pc, cur); - - gdbstub_flush_caches = 1; - - size = gdbstub_insn_sizes[cur]; - if (size > 0) { - if (!__gdbstub_mark_bp(pc + size, 0)) - goto fault; - } else { - switch (cur) { - /* Bxx (d8,PC) */ - case 0xc0 ... 0xca: - if (gdbstub_read_byte(pc + 1, (u8 *) &x) < 0) - goto fault; - if (!__gdbstub_mark_bp(pc + 2, 0)) - goto fault; - if ((x < 0 || x > 2) && - !__gdbstub_mark_bp(pc + (s8) x, 1)) - goto fault; - break; - - /* LXX (d8,PC) */ - case 0xd0 ... 0xda: - if (!__gdbstub_mark_bp(pc + 1, 0)) - goto fault; - if (regs->pc != regs->lar && - !__gdbstub_mark_bp((u8 *) regs->lar, 1)) - goto fault; - break; - - /* SETLB - loads the next for bytes into the LIR - * register */ - case 0xdb: - if (!__gdbstub_mark_bp(pc + 1, 0)) - goto fault; - break; - - /* JMP (d16,PC) or CALL (d16,PC) */ - case 0xcc: - case 0xcd: - if (gdbstub_read_byte(pc + 1, ((u8 *) &x) + 0) < 0 || - gdbstub_read_byte(pc + 2, ((u8 *) &x) + 1) < 0) - goto fault; - if (!__gdbstub_mark_bp(pc + (s16) x, 0)) - goto fault; - break; - - /* JMP (d32,PC) or CALL (d32,PC) */ - case 0xdc: - case 0xdd: - if (gdbstub_read_byte(pc + 1, ((u8 *) &x) + 0) < 0 || - gdbstub_read_byte(pc + 2, ((u8 *) &x) + 1) < 0 || - gdbstub_read_byte(pc + 3, ((u8 *) &x) + 2) < 0 || - gdbstub_read_byte(pc + 4, ((u8 *) &x) + 3) < 0) - goto fault; - if (!__gdbstub_mark_bp(pc + (s32) x, 0)) - goto fault; - break; - - /* RETF */ - case 0xde: - if (!__gdbstub_mark_bp((u8 *) regs->mdr, 0)) - goto fault; - break; - - /* RET */ - case 0xdf: - if (gdbstub_read_byte(pc + 2, (u8 *) &x) < 0) - goto fault; - sp += (s8)x; - if (gdbstub_read_byte(sp + 0, ((u8 *) &x) + 0) < 0 || - gdbstub_read_byte(sp + 1, ((u8 *) &x) + 1) < 0 || - gdbstub_read_byte(sp + 2, ((u8 *) &x) + 2) < 0 || - gdbstub_read_byte(sp + 3, ((u8 *) &x) + 3) < 0) - goto fault; - if (!__gdbstub_mark_bp((u8 *) x, 0)) - goto fault; - break; - - case 0xf0: - if (gdbstub_read_byte(pc + 1, &cur) < 0) - goto fault; - - if (cur >= 0xf0 && cur <= 0xf7) { - /* JMP (An) / CALLS (An) */ - switch (cur & 3) { - case 0: x = regs->a0; break; - case 1: x = regs->a1; break; - case 2: x = regs->a2; break; - case 3: x = regs->a3; break; - } - if (!__gdbstub_mark_bp((u8 *) x, 0)) - goto fault; - } else if (cur == 0xfc) { - /* RETS */ - if (gdbstub_read_byte( - sp + 0, ((u8 *) &x) + 0) < 0 || - gdbstub_read_byte( - sp + 1, ((u8 *) &x) + 1) < 0 || - gdbstub_read_byte( - sp + 2, ((u8 *) &x) + 2) < 0 || - gdbstub_read_byte( - sp + 3, ((u8 *) &x) + 3) < 0) - goto fault; - if (!__gdbstub_mark_bp((u8 *) x, 0)) - goto fault; - } else if (cur == 0xfd) { - /* RTI */ - if (gdbstub_read_byte( - sp + 4, ((u8 *) &x) + 0) < 0 || - gdbstub_read_byte( - sp + 5, ((u8 *) &x) + 1) < 0 || - gdbstub_read_byte( - sp + 6, ((u8 *) &x) + 2) < 0 || - gdbstub_read_byte( - sp + 7, ((u8 *) &x) + 3) < 0) - goto fault; - if (!__gdbstub_mark_bp((u8 *) x, 0)) - goto fault; - } else { - if (!__gdbstub_mark_bp(pc + 2, 0)) - goto fault; - } - - break; - - /* potential 3-byte conditional branches */ - case 0xf8: - if (gdbstub_read_byte(pc + 1, &cur) < 0) - goto fault; - if (!__gdbstub_mark_bp(pc + 3, 0)) - goto fault; - - if (cur >= 0xe8 && cur <= 0xeb) { - if (gdbstub_read_byte( - pc + 2, ((u8 *) &x) + 0) < 0) - goto fault; - if ((x < 0 || x > 3) && - !__gdbstub_mark_bp(pc + (s8) x, 1)) - goto fault; - } - break; - - case 0xfa: - if (gdbstub_read_byte(pc + 1, &cur) < 0) - goto fault; - - if (cur == 0xff) { - /* CALLS (d16,PC) */ - if (gdbstub_read_byte( - pc + 2, ((u8 *) &x) + 0) < 0 || - gdbstub_read_byte( - pc + 3, ((u8 *) &x) + 1) < 0) - goto fault; - if (!__gdbstub_mark_bp(pc + (s16) x, 0)) - goto fault; - } else { - if (!__gdbstub_mark_bp(pc + 4, 0)) - goto fault; - } - break; - - case 0xfc: - if (gdbstub_read_byte(pc + 1, &cur) < 0) - goto fault; - if (cur == 0xff) { - /* CALLS (d32,PC) */ - if (gdbstub_read_byte( - pc + 2, ((u8 *) &x) + 0) < 0 || - gdbstub_read_byte( - pc + 3, ((u8 *) &x) + 1) < 0 || - gdbstub_read_byte( - pc + 4, ((u8 *) &x) + 2) < 0 || - gdbstub_read_byte( - pc + 5, ((u8 *) &x) + 3) < 0) - goto fault; - if (!__gdbstub_mark_bp( - pc + (s32) x, 0)) - goto fault; - } else { - if (!__gdbstub_mark_bp( - pc + 6, 0)) - goto fault; - } - break; - - } - } - - gdbstub_bkpt("Step: %02x at %p; %02x at %p\n", - step_bp[0].opcode[0], step_bp[0].addr, - step_bp[1].opcode[0], step_bp[1].addr); - - if (step_bp[0].addr) { -#ifdef GDBSTUB_USE_F7F7_AS_BREAKPOINT - if (gdbstub_write_byte(0xF7, step_bp[0].addr + 0) < 0 || - gdbstub_write_byte(0xF7, step_bp[0].addr + 1) < 0) - goto fault; -#else - if (gdbstub_write_byte(0xFF, step_bp[0].addr + 0) < 0) - goto fault; -#endif - } - - if (step_bp[1].addr) { -#ifdef GDBSTUB_USE_F7F7_AS_BREAKPOINT - if (gdbstub_write_byte(0xF7, step_bp[1].addr + 0) < 0 || - gdbstub_write_byte(0xF7, step_bp[1].addr + 1) < 0) - goto fault; -#else - if (gdbstub_write_byte(0xFF, step_bp[1].addr + 0) < 0) - goto fault; -#endif - } - - return 0; - - fault: - /* uh-oh - silly address alert, try and restore things */ - __gdbstub_restore_bp(); - return -EFAULT; -} -#endif /* CONFIG_GDBSTUB_ALLOW_SINGLE_STEP */ - -#ifdef CONFIG_GDBSTUB_CONSOLE - -void gdbstub_console_write(struct console *con, const char *p, unsigned n) -{ - static const char gdbstub_cr[] = { 0x0d }; - char outbuf[26]; - int qty; - u8 busy; - - busy = gdbstub_busy; - gdbstub_busy = 1; - - outbuf[0] = 'O'; - - while (n > 0) { - qty = 1; - - while (n > 0 && qty < 20) { - mem2hex(p, outbuf + qty, 2, 0); - qty += 2; - if (*p == 0x0a) { - mem2hex(gdbstub_cr, outbuf + qty, 2, 0); - qty += 2; - } - p++; - n--; - } - - outbuf[qty] = 0; - putpacket(outbuf); - } - - gdbstub_busy = busy; -} - -static kdev_t gdbstub_console_dev(struct console *con) -{ - return MKDEV(1, 3); /* /dev/null */ -} - -static struct console gdbstub_console = { - .name = "gdb", - .write = gdbstub_console_write, - .device = gdbstub_console_dev, - .flags = CON_PRINTBUFFER, - .index = -1, -}; - -#endif - -/* - * Convert the memory pointed to by mem into hex, placing result in buf. - * - if successful, return a pointer to the last char put in buf (NUL) - * - in case of mem fault, return NULL - * may_fault is non-zero if we are reading from arbitrary memory, but is - * currently not used. - */ -static -unsigned char *mem2hex(const void *_mem, char *buf, int count, int may_fault) -{ - const u8 *mem = _mem; - u8 ch[4]; - - if ((u32) mem & 1 && count >= 1) { - if (gdbstub_read_byte(mem, ch) != 0) - return 0; - buf = hex_byte_pack(buf, ch[0]); - mem++; - count--; - } - - if ((u32) mem & 3 && count >= 2) { - if (gdbstub_read_word(mem, ch) != 0) - return 0; - buf = hex_byte_pack(buf, ch[0]); - buf = hex_byte_pack(buf, ch[1]); - mem += 2; - count -= 2; - } - - while (count >= 4) { - if (gdbstub_read_dword(mem, ch) != 0) - return 0; - buf = hex_byte_pack(buf, ch[0]); - buf = hex_byte_pack(buf, ch[1]); - buf = hex_byte_pack(buf, ch[2]); - buf = hex_byte_pack(buf, ch[3]); - mem += 4; - count -= 4; - } - - if (count >= 2) { - if (gdbstub_read_word(mem, ch) != 0) - return 0; - buf = hex_byte_pack(buf, ch[0]); - buf = hex_byte_pack(buf, ch[1]); - mem += 2; - count -= 2; - } - - if (count >= 1) { - if (gdbstub_read_byte(mem, ch) != 0) - return 0; - buf = hex_byte_pack(buf, ch[0]); - } - - *buf = 0; - return buf; -} - -/* - * convert the hex array pointed to by buf into binary to be placed in mem - * return a pointer to the character AFTER the last byte written - * may_fault is non-zero if we are reading from arbitrary memory, but is - * currently not used. - */ -static -const char *hex2mem(const char *buf, void *_mem, int count, int may_fault) -{ - u8 *mem = _mem; - union { - u32 val; - u8 b[4]; - } ch; - - if ((u32) mem & 1 && count >= 1) { - ch.b[0] = hex(*buf++) << 4; - ch.b[0] |= hex(*buf++); - if (gdbstub_write_byte(ch.val, mem) != 0) - return 0; - mem++; - count--; - } - - if ((u32) mem & 3 && count >= 2) { - ch.b[0] = hex(*buf++) << 4; - ch.b[0] |= hex(*buf++); - ch.b[1] = hex(*buf++) << 4; - ch.b[1] |= hex(*buf++); - if (gdbstub_write_word(ch.val, mem) != 0) - return 0; - mem += 2; - count -= 2; - } - - while (count >= 4) { - ch.b[0] = hex(*buf++) << 4; - ch.b[0] |= hex(*buf++); - ch.b[1] = hex(*buf++) << 4; - ch.b[1] |= hex(*buf++); - ch.b[2] = hex(*buf++) << 4; - ch.b[2] |= hex(*buf++); - ch.b[3] = hex(*buf++) << 4; - ch.b[3] |= hex(*buf++); - if (gdbstub_write_dword(ch.val, mem) != 0) - return 0; - mem += 4; - count -= 4; - } - - if (count >= 2) { - ch.b[0] = hex(*buf++) << 4; - ch.b[0] |= hex(*buf++); - ch.b[1] = hex(*buf++) << 4; - ch.b[1] |= hex(*buf++); - if (gdbstub_write_word(ch.val, mem) != 0) - return 0; - mem += 2; - count -= 2; - } - - if (count >= 1) { - ch.b[0] = hex(*buf++) << 4; - ch.b[0] |= hex(*buf++); - if (gdbstub_write_byte(ch.val, mem) != 0) - return 0; - } - - return buf; -} - -/* - * This table contains the mapping between MN10300 exception codes, and - * signals, which are primarily what GDB understands. It also indicates - * which hardware traps we need to commandeer when initializing the stub. - */ -static const struct excep_to_sig_map { - enum exception_code excep; /* MN10300 exception code */ - unsigned char signo; /* Signal that we map this into */ -} excep_to_sig_map[] = { - { EXCEP_ITLBMISS, SIGSEGV }, - { EXCEP_DTLBMISS, SIGSEGV }, - { EXCEP_TRAP, SIGTRAP }, - { EXCEP_ISTEP, SIGTRAP }, - { EXCEP_IBREAK, SIGTRAP }, - { EXCEP_OBREAK, SIGTRAP }, - { EXCEP_UNIMPINS, SIGILL }, - { EXCEP_UNIMPEXINS, SIGILL }, - { EXCEP_MEMERR, SIGSEGV }, - { EXCEP_MISALIGN, SIGSEGV }, - { EXCEP_BUSERROR, SIGBUS }, - { EXCEP_ILLINSACC, SIGSEGV }, - { EXCEP_ILLDATACC, SIGSEGV }, - { EXCEP_IOINSACC, SIGSEGV }, - { EXCEP_PRIVINSACC, SIGSEGV }, - { EXCEP_PRIVDATACC, SIGSEGV }, - { EXCEP_FPU_DISABLED, SIGFPE }, - { EXCEP_FPU_UNIMPINS, SIGFPE }, - { EXCEP_FPU_OPERATION, SIGFPE }, - { EXCEP_WDT, SIGALRM }, - { EXCEP_NMI, SIGQUIT }, - { EXCEP_IRQ_LEVEL0, SIGINT }, - { EXCEP_IRQ_LEVEL1, SIGINT }, - { EXCEP_IRQ_LEVEL2, SIGINT }, - { EXCEP_IRQ_LEVEL3, SIGINT }, - { EXCEP_IRQ_LEVEL4, SIGINT }, - { EXCEP_IRQ_LEVEL5, SIGINT }, - { EXCEP_IRQ_LEVEL6, SIGINT }, - { 0, 0} -}; - -/* - * convert the MN10300 exception code into a UNIX signal number - */ -static int computeSignal(enum exception_code excep) -{ - const struct excep_to_sig_map *map; - - for (map = excep_to_sig_map; map->signo; map++) - if (map->excep == excep) - return map->signo; - - return SIGHUP; /* default for things we don't know about */ -} - -static u32 gdbstub_fpcr, gdbstub_fpufs_array[32]; - -/* - * - */ -static void gdbstub_store_fpu(void) -{ -#ifdef CONFIG_FPU - - asm volatile( - "or %2,epsw\n" -#ifdef CONFIG_MN10300_PROC_MN103E010 - "nop\n" - "nop\n" -#endif - "mov %1, a1\n" - "fmov fs0, (a1+)\n" - "fmov fs1, (a1+)\n" - "fmov fs2, (a1+)\n" - "fmov fs3, (a1+)\n" - "fmov fs4, (a1+)\n" - "fmov fs5, (a1+)\n" - "fmov fs6, (a1+)\n" - "fmov fs7, (a1+)\n" - "fmov fs8, (a1+)\n" - "fmov fs9, (a1+)\n" - "fmov fs10, (a1+)\n" - "fmov fs11, (a1+)\n" - "fmov fs12, (a1+)\n" - "fmov fs13, (a1+)\n" - "fmov fs14, (a1+)\n" - "fmov fs15, (a1+)\n" - "fmov fs16, (a1+)\n" - "fmov fs17, (a1+)\n" - "fmov fs18, (a1+)\n" - "fmov fs19, (a1+)\n" - "fmov fs20, (a1+)\n" - "fmov fs21, (a1+)\n" - "fmov fs22, (a1+)\n" - "fmov fs23, (a1+)\n" - "fmov fs24, (a1+)\n" - "fmov fs25, (a1+)\n" - "fmov fs26, (a1+)\n" - "fmov fs27, (a1+)\n" - "fmov fs28, (a1+)\n" - "fmov fs29, (a1+)\n" - "fmov fs30, (a1+)\n" - "fmov fs31, (a1+)\n" - "fmov fpcr, %0\n" - : "=d"(gdbstub_fpcr) - : "g" (&gdbstub_fpufs_array), "i"(EPSW_FE) - : "a1" - ); -#endif -} - -/* - * - */ -static void gdbstub_load_fpu(void) -{ -#ifdef CONFIG_FPU - - asm volatile( - "or %1,epsw\n" -#ifdef CONFIG_MN10300_PROC_MN103E010 - "nop\n" - "nop\n" -#endif - "mov %0, a1\n" - "fmov (a1+), fs0\n" - "fmov (a1+), fs1\n" - "fmov (a1+), fs2\n" - "fmov (a1+), fs3\n" - "fmov (a1+), fs4\n" - "fmov (a1+), fs5\n" - "fmov (a1+), fs6\n" - "fmov (a1+), fs7\n" - "fmov (a1+), fs8\n" - "fmov (a1+), fs9\n" - "fmov (a1+), fs10\n" - "fmov (a1+), fs11\n" - "fmov (a1+), fs12\n" - "fmov (a1+), fs13\n" - "fmov (a1+), fs14\n" - "fmov (a1+), fs15\n" - "fmov (a1+), fs16\n" - "fmov (a1+), fs17\n" - "fmov (a1+), fs18\n" - "fmov (a1+), fs19\n" - "fmov (a1+), fs20\n" - "fmov (a1+), fs21\n" - "fmov (a1+), fs22\n" - "fmov (a1+), fs23\n" - "fmov (a1+), fs24\n" - "fmov (a1+), fs25\n" - "fmov (a1+), fs26\n" - "fmov (a1+), fs27\n" - "fmov (a1+), fs28\n" - "fmov (a1+), fs29\n" - "fmov (a1+), fs30\n" - "fmov (a1+), fs31\n" - "fmov %2, fpcr\n" - : - : "g" (&gdbstub_fpufs_array), "i"(EPSW_FE), "d"(gdbstub_fpcr) - : "a1" - ); -#endif -} - -/* - * set a software breakpoint - */ -int gdbstub_set_breakpoint(u8 *addr, int len) -{ - int bkpt, loop, xloop; - -#ifdef GDBSTUB_USE_F7F7_AS_BREAKPOINT - len = (len + 1) & ~1; -#endif - - gdbstub_bkpt("setbkpt(%p,%d)\n", addr, len); - - for (bkpt = 255; bkpt >= 0; bkpt--) - if (!gdbstub_bkpts[bkpt].addr) - break; - if (bkpt < 0) - return -ENOSPC; - - for (loop = 0; loop < len; loop++) - if (gdbstub_read_byte(&addr[loop], - &gdbstub_bkpts[bkpt].origbytes[loop] - ) < 0) - return -EFAULT; - - gdbstub_flush_caches = 1; - -#ifdef GDBSTUB_USE_F7F7_AS_BREAKPOINT - for (loop = 0; loop < len; loop++) - if (gdbstub_write_byte(0xF7, &addr[loop]) < 0) - goto restore; -#else - for (loop = 0; loop < len; loop++) - if (gdbstub_write_byte(0xFF, &addr[loop]) < 0) - goto restore; -#endif - - gdbstub_bkpts[bkpt].addr = addr; - gdbstub_bkpts[bkpt].len = len; - - gdbstub_bkpt("Set BKPT[%02x]: %p-%p {%02x%02x%02x%02x%02x%02x%02x}\n", - bkpt, - gdbstub_bkpts[bkpt].addr, - gdbstub_bkpts[bkpt].addr + gdbstub_bkpts[bkpt].len - 1, - gdbstub_bkpts[bkpt].origbytes[0], - gdbstub_bkpts[bkpt].origbytes[1], - gdbstub_bkpts[bkpt].origbytes[2], - gdbstub_bkpts[bkpt].origbytes[3], - gdbstub_bkpts[bkpt].origbytes[4], - gdbstub_bkpts[bkpt].origbytes[5], - gdbstub_bkpts[bkpt].origbytes[6] - ); - - return 0; - -restore: - for (xloop = 0; xloop < loop; xloop++) - gdbstub_write_byte(gdbstub_bkpts[bkpt].origbytes[xloop], - addr + xloop); - return -EFAULT; -} - -/* - * clear a software breakpoint - */ -int gdbstub_clear_breakpoint(u8 *addr, int len) -{ - int bkpt, loop; - -#ifdef GDBSTUB_USE_F7F7_AS_BREAKPOINT - len = (len + 1) & ~1; -#endif - - gdbstub_bkpt("clearbkpt(%p,%d)\n", addr, len); - - for (bkpt = 255; bkpt >= 0; bkpt--) - if (gdbstub_bkpts[bkpt].addr == addr && - gdbstub_bkpts[bkpt].len == len) - break; - if (bkpt < 0) - return -ENOENT; - - gdbstub_bkpts[bkpt].addr = NULL; - - gdbstub_flush_caches = 1; - - for (loop = 0; loop < len; loop++) - if (gdbstub_write_byte(gdbstub_bkpts[bkpt].origbytes[loop], - addr + loop) < 0) - return -EFAULT; - - return 0; -} - -/* - * This function does all command processing for interfacing to gdb - * - returns 0 if the exception should be skipped, -ERROR otherwise. - */ -static int gdbstub(struct pt_regs *regs, enum exception_code excep) -{ - unsigned long *stack; - unsigned long epsw, mdr; - uint32_t zero, ssp; - uint8_t broke; - char *ptr; - int sigval; - int addr; - int length; - int loop; - - if (excep == EXCEP_FPU_DISABLED) - return -ENOTSUPP; - - gdbstub_flush_caches = 0; - - mn10300_set_gdbleds(1); - - asm volatile("mov mdr,%0" : "=d"(mdr)); - local_save_flags(epsw); - arch_local_change_intr_mask_level( - NUM2EPSW_IM(CONFIG_DEBUGGER_IRQ_LEVEL + 1)); - - gdbstub_store_fpu(); - -#ifdef CONFIG_GDBSTUB_IMMEDIATE - /* skip the initial pause loop */ - if (regs->pc == (unsigned long) __gdbstub_pause) - regs->pc = (unsigned long) start_kernel; -#endif - - /* if we were single stepping, restore the opcodes hoisted for the - * breakpoint[s] */ - broke = 0; -#ifdef CONFIG_GDBSTUB_ALLOW_SINGLE_STEP - if ((step_bp[0].addr && step_bp[0].addr == (u8 *) regs->pc) || - (step_bp[1].addr && step_bp[1].addr == (u8 *) regs->pc)) - broke = 1; - - __gdbstub_restore_bp(); -#endif - - if (gdbstub_rx_unget) { - sigval = SIGINT; - if (gdbstub_rx_unget != 3) - goto packet_waiting; - gdbstub_rx_unget = 0; - } - - stack = (unsigned long *) regs->sp; - sigval = broke ? SIGTRAP : computeSignal(excep); - - /* send information about a BUG() */ - if (!user_mode(regs) && excep == EXCEP_SYSCALL15) { - const struct bug_entry *bug; - - bug = find_bug(regs->pc); - if (bug) - goto found_bug; - length = snprintf(trans_buffer, sizeof(trans_buffer), - "BUG() at address %lx\n", regs->pc); - goto send_bug_pkt; - - found_bug: - length = snprintf(trans_buffer, sizeof(trans_buffer), - "BUG() at address %lx (%s:%d)\n", - regs->pc, bug->file, bug->line); - - send_bug_pkt: - ptr = output_buffer; - *ptr++ = 'O'; - ptr = mem2hex(trans_buffer, ptr, length, 0); - *ptr = 0; - putpacket(output_buffer); - - regs->pc -= 2; - sigval = SIGABRT; - } else if (regs->pc == (unsigned long) __gdbstub_bug_trap) { - regs->pc = regs->mdr; - sigval = SIGABRT; - } - - /* - * send a message to the debugger's user saying what happened if it may - * not be clear cut (we can't map exceptions onto signals properly) - */ - if (sigval != SIGINT && sigval != SIGTRAP && sigval != SIGILL) { - static const char title[] = "Excep ", tbcberr[] = "BCBERR "; - static const char crlf[] = "\r\n"; - char hx; - u32 bcberr = BCBERR; - - ptr = output_buffer; - *ptr++ = 'O'; - ptr = mem2hex(title, ptr, sizeof(title) - 1, 0); - - hx = hex_asc_hi(excep >> 8); - ptr = hex_byte_pack(ptr, hx); - hx = hex_asc_lo(excep >> 8); - ptr = hex_byte_pack(ptr, hx); - hx = hex_asc_hi(excep); - ptr = hex_byte_pack(ptr, hx); - hx = hex_asc_lo(excep); - ptr = hex_byte_pack(ptr, hx); - - ptr = mem2hex(crlf, ptr, sizeof(crlf) - 1, 0); - *ptr = 0; - putpacket(output_buffer); /* send it off... */ - - /* BCBERR */ - ptr = output_buffer; - *ptr++ = 'O'; - ptr = mem2hex(tbcberr, ptr, sizeof(tbcberr) - 1, 0); - - hx = hex_asc_hi(bcberr >> 24); - ptr = hex_byte_pack(ptr, hx); - hx = hex_asc_lo(bcberr >> 24); - ptr = hex_byte_pack(ptr, hx); - hx = hex_asc_hi(bcberr >> 16); - ptr = hex_byte_pack(ptr, hx); - hx = hex_asc_lo(bcberr >> 16); - ptr = hex_byte_pack(ptr, hx); - hx = hex_asc_hi(bcberr >> 8); - ptr = hex_byte_pack(ptr, hx); - hx = hex_asc_lo(bcberr >> 8); - ptr = hex_byte_pack(ptr, hx); - hx = hex_asc_hi(bcberr); - ptr = hex_byte_pack(ptr, hx); - hx = hex_asc_lo(bcberr); - ptr = hex_byte_pack(ptr, hx); - - ptr = mem2hex(crlf, ptr, sizeof(crlf) - 1, 0); - *ptr = 0; - putpacket(output_buffer); /* send it off... */ - } - - /* - * tell the debugger that an exception has occurred - */ - ptr = output_buffer; - - /* - * Send trap type (converted to signal) - */ - *ptr++ = 'T'; - ptr = hex_byte_pack(ptr, sigval); - - /* - * Send Error PC - */ - ptr = hex_byte_pack(ptr, GDB_REGID_PC); - *ptr++ = ':'; - ptr = mem2hex(®s->pc, ptr, 4, 0); - *ptr++ = ';'; - - /* - * Send frame pointer - */ - ptr = hex_byte_pack(ptr, GDB_REGID_FP); - *ptr++ = ':'; - ptr = mem2hex(®s->a3, ptr, 4, 0); - *ptr++ = ';'; - - /* - * Send stack pointer - */ - ssp = (unsigned long) (regs + 1); - ptr = hex_byte_pack(ptr, GDB_REGID_SP); - *ptr++ = ':'; - ptr = mem2hex(&ssp, ptr, 4, 0); - *ptr++ = ';'; - - *ptr++ = 0; - putpacket(output_buffer); /* send it off... */ - -packet_waiting: - /* - * Wait for input from remote GDB - */ - while (1) { - output_buffer[0] = 0; - getpacket(input_buffer); - - switch (input_buffer[0]) { - /* request repeat of last signal number */ - case '?': - output_buffer[0] = 'S'; - output_buffer[1] = hex_asc_hi(sigval); - output_buffer[2] = hex_asc_lo(sigval); - output_buffer[3] = 0; - break; - - case 'd': - /* toggle debug flag */ - break; - - /* - * Return the value of the CPU registers - */ - case 'g': - zero = 0; - ssp = (u32) (regs + 1); - ptr = output_buffer; - ptr = mem2hex(®s->d0, ptr, 4, 0); - ptr = mem2hex(®s->d1, ptr, 4, 0); - ptr = mem2hex(®s->d2, ptr, 4, 0); - ptr = mem2hex(®s->d3, ptr, 4, 0); - ptr = mem2hex(®s->a0, ptr, 4, 0); - ptr = mem2hex(®s->a1, ptr, 4, 0); - ptr = mem2hex(®s->a2, ptr, 4, 0); - ptr = mem2hex(®s->a3, ptr, 4, 0); - - ptr = mem2hex(&ssp, ptr, 4, 0); /* 8 */ - ptr = mem2hex(®s->pc, ptr, 4, 0); - ptr = mem2hex(®s->mdr, ptr, 4, 0); - ptr = mem2hex(®s->epsw, ptr, 4, 0); - ptr = mem2hex(®s->lir, ptr, 4, 0); - ptr = mem2hex(®s->lar, ptr, 4, 0); - ptr = mem2hex(®s->mdrq, ptr, 4, 0); - - ptr = mem2hex(®s->e0, ptr, 4, 0); /* 15 */ - ptr = mem2hex(®s->e1, ptr, 4, 0); - ptr = mem2hex(®s->e2, ptr, 4, 0); - ptr = mem2hex(®s->e3, ptr, 4, 0); - ptr = mem2hex(®s->e4, ptr, 4, 0); - ptr = mem2hex(®s->e5, ptr, 4, 0); - ptr = mem2hex(®s->e6, ptr, 4, 0); - ptr = mem2hex(®s->e7, ptr, 4, 0); - - ptr = mem2hex(&ssp, ptr, 4, 0); - ptr = mem2hex(®s, ptr, 4, 0); - ptr = mem2hex(®s->sp, ptr, 4, 0); - ptr = mem2hex(®s->mcrh, ptr, 4, 0); /* 26 */ - ptr = mem2hex(®s->mcrl, ptr, 4, 0); - ptr = mem2hex(®s->mcvf, ptr, 4, 0); - - ptr = mem2hex(&gdbstub_fpcr, ptr, 4, 0); /* 29 - FPCR */ - ptr = mem2hex(&zero, ptr, 4, 0); - ptr = mem2hex(&zero, ptr, 4, 0); - for (loop = 0; loop < 32; loop++) - ptr = mem2hex(&gdbstub_fpufs_array[loop], - ptr, 4, 0); /* 32 - FS0-31 */ - - break; - - /* - * set the value of the CPU registers - return OK - */ - case 'G': - { - const char *ptr; - - ptr = &input_buffer[1]; - ptr = hex2mem(ptr, ®s->d0, 4, 0); - ptr = hex2mem(ptr, ®s->d1, 4, 0); - ptr = hex2mem(ptr, ®s->d2, 4, 0); - ptr = hex2mem(ptr, ®s->d3, 4, 0); - ptr = hex2mem(ptr, ®s->a0, 4, 0); - ptr = hex2mem(ptr, ®s->a1, 4, 0); - ptr = hex2mem(ptr, ®s->a2, 4, 0); - ptr = hex2mem(ptr, ®s->a3, 4, 0); - - ptr = hex2mem(ptr, &ssp, 4, 0); /* 8 */ - ptr = hex2mem(ptr, ®s->pc, 4, 0); - ptr = hex2mem(ptr, ®s->mdr, 4, 0); - ptr = hex2mem(ptr, ®s->epsw, 4, 0); - ptr = hex2mem(ptr, ®s->lir, 4, 0); - ptr = hex2mem(ptr, ®s->lar, 4, 0); - ptr = hex2mem(ptr, ®s->mdrq, 4, 0); - - ptr = hex2mem(ptr, ®s->e0, 4, 0); /* 15 */ - ptr = hex2mem(ptr, ®s->e1, 4, 0); - ptr = hex2mem(ptr, ®s->e2, 4, 0); - ptr = hex2mem(ptr, ®s->e3, 4, 0); - ptr = hex2mem(ptr, ®s->e4, 4, 0); - ptr = hex2mem(ptr, ®s->e5, 4, 0); - ptr = hex2mem(ptr, ®s->e6, 4, 0); - ptr = hex2mem(ptr, ®s->e7, 4, 0); - - ptr = hex2mem(ptr, &ssp, 4, 0); - ptr = hex2mem(ptr, &zero, 4, 0); - ptr = hex2mem(ptr, ®s->sp, 4, 0); - ptr = hex2mem(ptr, ®s->mcrh, 4, 0); /* 26 */ - ptr = hex2mem(ptr, ®s->mcrl, 4, 0); - ptr = hex2mem(ptr, ®s->mcvf, 4, 0); - - ptr = hex2mem(ptr, &zero, 4, 0); /* 29 - FPCR */ - ptr = hex2mem(ptr, &zero, 4, 0); - ptr = hex2mem(ptr, &zero, 4, 0); - for (loop = 0; loop < 32; loop++) /* 32 - FS0-31 */ - ptr = hex2mem(ptr, &zero, 4, 0); - -#if 0 - /* - * See if the stack pointer has moved. If so, then copy - * the saved locals and ins to the new location. - */ - unsigned long *newsp = (unsigned long *) registers[SP]; - if (sp != newsp) - sp = memcpy(newsp, sp, 16 * 4); -#endif - - gdbstub_strcpy(output_buffer, "OK"); - } - break; - - /* - * mAA..AA,LLLL Read LLLL bytes at address AA..AA - */ - case 'm': - ptr = &input_buffer[1]; - - if (hexToInt(&ptr, &addr) && - *ptr++ == ',' && - hexToInt(&ptr, &length) - ) { - if (mem2hex((char *) addr, output_buffer, - length, 1)) - break; - gdbstub_strcpy(output_buffer, "E03"); - } else { - gdbstub_strcpy(output_buffer, "E01"); - } - break; - - /* - * MAA..AA,LLLL: Write LLLL bytes at address AA.AA - * return OK - */ - case 'M': - ptr = &input_buffer[1]; - - if (hexToInt(&ptr, &addr) && - *ptr++ == ',' && - hexToInt(&ptr, &length) && - *ptr++ == ':' - ) { - if (hex2mem(ptr, (char *) addr, length, 1)) - gdbstub_strcpy(output_buffer, "OK"); - else - gdbstub_strcpy(output_buffer, "E03"); - - gdbstub_flush_caches = 1; - } else { - gdbstub_strcpy(output_buffer, "E02"); - } - break; - - /* - * cAA..AA Continue at address AA..AA(optional) - */ - case 'c': - /* try to read optional parameter, pc unchanged if no - * parm */ - - ptr = &input_buffer[1]; - if (hexToInt(&ptr, &addr)) - regs->pc = addr; - goto done; - - /* - * kill the program - */ - case 'k' : - goto done; /* just continue */ - - /* - * Reset the whole machine (FIXME: system dependent) - */ - case 'r': - break; - - /* - * Step to next instruction - */ - case 's': - /* Using the T flag doesn't seem to perform single - * stepping (it seems to wind up being caught by the - * JTAG unit), so we have to use breakpoints and - * continue instead. - */ -#ifdef CONFIG_GDBSTUB_ALLOW_SINGLE_STEP - if (gdbstub_single_step(regs) < 0) - /* ignore any fault error for now */ - gdbstub_printk("unable to set single-step" - " bp\n"); - goto done; -#else - gdbstub_strcpy(output_buffer, "E01"); - break; -#endif - - /* - * Set baud rate (bBB) - */ - case 'b': - do { - int baudrate; - - ptr = &input_buffer[1]; - if (!hexToInt(&ptr, &baudrate)) { - gdbstub_strcpy(output_buffer, "B01"); - break; - } - - if (baudrate) { - /* ACK before changing speed */ - putpacket("OK"); - gdbstub_io_set_baud(baudrate); - } - } while (0); - break; - - /* - * Set breakpoint - */ - case 'Z': - ptr = &input_buffer[1]; - - if (!hexToInt(&ptr, &loop) || *ptr++ != ',' || - !hexToInt(&ptr, &addr) || *ptr++ != ',' || - !hexToInt(&ptr, &length) - ) { - gdbstub_strcpy(output_buffer, "E01"); - break; - } - - /* only support software breakpoints */ - gdbstub_strcpy(output_buffer, "E03"); - if (loop != 0 || - length < 1 || - length > 7 || - (unsigned long) addr < 4096) - break; - - if (gdbstub_set_breakpoint((u8 *) addr, length) < 0) - break; - - gdbstub_strcpy(output_buffer, "OK"); - break; - - /* - * Clear breakpoint - */ - case 'z': - ptr = &input_buffer[1]; - - if (!hexToInt(&ptr, &loop) || *ptr++ != ',' || - !hexToInt(&ptr, &addr) || *ptr++ != ',' || - !hexToInt(&ptr, &length) - ) { - gdbstub_strcpy(output_buffer, "E01"); - break; - } - - /* only support software breakpoints */ - gdbstub_strcpy(output_buffer, "E03"); - if (loop != 0 || - length < 1 || - length > 7 || - (unsigned long) addr < 4096) - break; - - if (gdbstub_clear_breakpoint((u8 *) addr, length) < 0) - break; - - gdbstub_strcpy(output_buffer, "OK"); - break; - - default: - gdbstub_proto("### GDB Unsupported Cmd '%s'\n", - input_buffer); - break; - } - - /* reply to the request */ - putpacket(output_buffer); - } - -done: - /* - * Need to flush the instruction cache here, as we may - * have deposited a breakpoint, and the icache probably - * has no way of knowing that a data ref to some location - * may have changed something that is in the instruction - * cache. - * NB: We flush both caches, just to be sure... - */ - if (gdbstub_flush_caches) - debugger_local_cache_flushinv(); - - gdbstub_load_fpu(); - mn10300_set_gdbleds(0); - if (excep == EXCEP_NMI) - NMICR = NMICR_NMIF; - - touch_softlockup_watchdog(); - - local_irq_restore(epsw); - return 0; -} - -/* - * Determine if we hit a debugger special breakpoint that needs skipping over - * automatically. - */ -int at_debugger_breakpoint(struct pt_regs *regs) -{ - return 0; -} - -/* - * handle event interception - */ -asmlinkage int debugger_intercept(enum exception_code excep, - int signo, int si_code, struct pt_regs *regs) -{ - static u8 notfirst = 1; - int ret; - - if (gdbstub_busy) - gdbstub_printk("--> gdbstub reentered itself\n"); - gdbstub_busy = 1; - - if (notfirst) { - unsigned long mdr; - asm("mov mdr,%0" : "=d"(mdr)); - - gdbstub_entry( - "--> debugger_intercept(%p,%04x) [MDR=%lx PC=%lx]\n", - regs, excep, mdr, regs->pc); - - gdbstub_entry( - "PC: %08lx EPSW: %08lx SSP: %08lx mode: %s\n", - regs->pc, regs->epsw, (unsigned long) &ret, - user_mode(regs) ? "User" : "Super"); - gdbstub_entry( - "d0: %08lx d1: %08lx d2: %08lx d3: %08lx\n", - regs->d0, regs->d1, regs->d2, regs->d3); - gdbstub_entry( - "a0: %08lx a1: %08lx a2: %08lx a3: %08lx\n", - regs->a0, regs->a1, regs->a2, regs->a3); - gdbstub_entry( - "e0: %08lx e1: %08lx e2: %08lx e3: %08lx\n", - regs->e0, regs->e1, regs->e2, regs->e3); - gdbstub_entry( - "e4: %08lx e5: %08lx e6: %08lx e7: %08lx\n", - regs->e4, regs->e5, regs->e6, regs->e7); - gdbstub_entry( - "lar: %08lx lir: %08lx mdr: %08lx usp: %08lx\n", - regs->lar, regs->lir, regs->mdr, regs->sp); - gdbstub_entry( - "cvf: %08lx crl: %08lx crh: %08lx drq: %08lx\n", - regs->mcvf, regs->mcrl, regs->mcrh, regs->mdrq); - gdbstub_entry( - "threadinfo=%p task=%p)\n", - current_thread_info(), current); - } else { - notfirst = 1; - } - - ret = gdbstub(regs, excep); - - gdbstub_entry("<-- debugger_intercept()\n"); - gdbstub_busy = 0; - return ret; -} - -/* - * handle the GDB stub itself causing an exception - */ -asmlinkage void gdbstub_exception(struct pt_regs *regs, - enum exception_code excep) -{ - unsigned long mdr; - - asm("mov mdr,%0" : "=d"(mdr)); - gdbstub_entry("--> gdbstub exception({%p},%04x) [MDR=%lx]\n", - regs, excep, mdr); - - while ((unsigned long) regs == 0xffffffff) {} - - /* handle guarded memory accesses where we know it might fault */ - if (regs->pc == (unsigned) gdbstub_read_byte_guard) { - regs->pc = (unsigned) gdbstub_read_byte_cont; - goto fault; - } - - if (regs->pc == (unsigned) gdbstub_read_word_guard) { - regs->pc = (unsigned) gdbstub_read_word_cont; - goto fault; - } - - if (regs->pc == (unsigned) gdbstub_read_dword_guard) { - regs->pc = (unsigned) gdbstub_read_dword_cont; - goto fault; - } - - if (regs->pc == (unsigned) gdbstub_write_byte_guard) { - regs->pc = (unsigned) gdbstub_write_byte_cont; - goto fault; - } - - if (regs->pc == (unsigned) gdbstub_write_word_guard) { - regs->pc = (unsigned) gdbstub_write_word_cont; - goto fault; - } - - if (regs->pc == (unsigned) gdbstub_write_dword_guard) { - regs->pc = (unsigned) gdbstub_write_dword_cont; - goto fault; - } - - gdbstub_printk("\n### GDB stub caused an exception ###\n"); - - /* something went horribly wrong */ - console_verbose(); - show_registers(regs); - - panic("GDB Stub caused an unexpected exception - can't continue\n"); - - /* we caught an attempt by the stub to access silly memory */ -fault: - gdbstub_entry("<-- gdbstub exception() = EFAULT\n"); - regs->d0 = -EFAULT; - return; -} - -/* - * send an exit message to GDB - */ -void gdbstub_exit(int status) -{ - unsigned char checksum; - unsigned char ch; - int count; - - gdbstub_busy = 1; - output_buffer[0] = 'W'; - output_buffer[1] = hex_asc_hi(status); - output_buffer[2] = hex_asc_lo(status); - output_buffer[3] = 0; - - gdbstub_io_tx_char('$'); - checksum = 0; - count = 0; - - while ((ch = output_buffer[count]) != 0) { - gdbstub_io_tx_char(ch); - checksum += ch; - count += 1; - } - - gdbstub_io_tx_char('#'); - gdbstub_io_tx_char(hex_asc_hi(checksum)); - gdbstub_io_tx_char(hex_asc_lo(checksum)); - - /* make sure the output is flushed, or else RedBoot might clobber it */ - gdbstub_io_tx_flush(); - - gdbstub_busy = 0; -} - -/* - * initialise the GDB stub - */ -asmlinkage void __init gdbstub_init(void) -{ -#ifdef CONFIG_GDBSTUB_IMMEDIATE - unsigned char ch; - int ret; -#endif - - gdbstub_busy = 1; - - printk(KERN_INFO "%s", gdbstub_banner); - - gdbstub_io_init(); - - gdbstub_entry("--> gdbstub_init\n"); - - /* try to talk to GDB (or anyone insane enough to want to type GDB - * protocol by hand) */ - gdbstub_io("### GDB Tx ACK\n"); - gdbstub_io_tx_char('+'); /* 'hello world' */ - -#ifdef CONFIG_GDBSTUB_IMMEDIATE - gdbstub_printk("GDB Stub waiting for packet\n"); - - /* in case GDB is started before us, ACK any packets that are already - * sitting there (presumably "$?#xx") - */ - do { gdbstub_io_rx_char(&ch, 0); } while (ch != '$'); - do { gdbstub_io_rx_char(&ch, 0); } while (ch != '#'); - /* eat first csum byte */ - do { ret = gdbstub_io_rx_char(&ch, 0); } while (ret != 0); - /* eat second csum byte */ - do { ret = gdbstub_io_rx_char(&ch, 0); } while (ret != 0); - - gdbstub_io("### GDB Tx NAK\n"); - gdbstub_io_tx_char('-'); /* NAK it */ - -#else - printk("GDB Stub ready\n"); -#endif - - gdbstub_busy = 0; - gdbstub_entry("<-- gdbstub_init\n"); -} - -/* - * register the console at a more appropriate time - */ -#ifdef CONFIG_GDBSTUB_CONSOLE -static int __init gdbstub_postinit(void) -{ - printk(KERN_NOTICE "registering console\n"); - register_console(&gdbstub_console); - return 0; -} - -__initcall(gdbstub_postinit); -#endif - -/* - * handle character reception on GDB serial port - * - jump into the GDB stub if BREAK is detected on the serial line - */ -asmlinkage void gdbstub_rx_irq(struct pt_regs *regs, enum exception_code excep) -{ - char ch; - int ret; - - gdbstub_entry("--> gdbstub_rx_irq\n"); - - do { - ret = gdbstub_io_rx_char(&ch, 1); - if (ret != -EIO && ret != -EAGAIN) { - if (ret != -EINTR) - gdbstub_rx_unget = ch; - gdbstub(regs, excep); - } - } while (ret != -EAGAIN); - - gdbstub_entry("<-- gdbstub_rx_irq\n"); -} diff --git a/arch/mn10300/kernel/head.S b/arch/mn10300/kernel/head.S deleted file mode 100644 index 0b15f759e0d26..0000000000000 --- a/arch/mn10300/kernel/head.S +++ /dev/null @@ -1,442 +0,0 @@ -/* Boot entry point for MN10300 kernel - * - * Copyright (C) 2005 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef CONFIG_SMP -#include -#include -#include -#include -#endif /* CONFIG_SMP */ - - __HEAD - -############################################################################### -# -# bootloader entry point -# -############################################################################### - .globl _start - .type _start,@function -_start: -#ifdef CONFIG_SMP - # - # If this is a secondary CPU (AP), then deal with that elsewhere - # - mov (CPUID),d3 - and CPUID_MASK,d3 - bne startup_secondary - - # - # We're dealing with the primary CPU (BP) here, then. - # Keep BP's D0,D1,D2 register for boot check. - # - - # Set up the Boot IPI for each secondary CPU - mov 0x1,a0 -loop_set_secondary_icr: - mov a0,a1 - asl CROSS_ICR_CPU_SHIFT,a1 - add CROSS_GxICR(SMP_BOOT_IRQ,0),a1 - movhu (a1),d3 - or GxICR_ENABLE|GxICR_LEVEL_0,d3 - movhu d3,(a1) - movhu (a1),d3 # flush - inc a0 - cmp NR_CPUS,a0 - bne loop_set_secondary_icr -#endif /* CONFIG_SMP */ - - # save commandline pointer - mov d0,a3 - - # preload the PGD pointer register - mov swapper_pg_dir,d0 - mov d0,(PTBR) - clr d0 - movbu d0,(PIDR) - - # turn on the TLBs - mov MMUCTR_IIV|MMUCTR_DIV,d0 - mov d0,(MMUCTR) -#ifdef CONFIG_AM34_2 - mov MMUCTR_ITE|MMUCTR_DTE|MMUCTR_CE|MMUCTR_WTE,d0 -#else - mov MMUCTR_ITE|MMUCTR_DTE|MMUCTR_CE,d0 -#endif - mov d0,(MMUCTR) - - # turn on AM33v2 exception handling mode and set the trap table base - movhu (CPUP),d0 - or CPUP_EXM_AM33V2,d0 - movhu d0,(CPUP) - mov CONFIG_INTERRUPT_VECTOR_BASE,d0 - mov d0,(TBR) - - # invalidate and enable both of the caches -#ifdef CONFIG_SMP - mov ECHCTR,a0 - clr d0 - mov d0,(a0) -#endif - mov CHCTR,a0 - clr d0 - movhu d0,(a0) # turn off first - mov CHCTR_ICINV|CHCTR_DCINV,d0 - movhu d0,(a0) - setlb - mov (a0),d0 - btst CHCTR_ICBUSY|CHCTR_DCBUSY,d0 # wait till not busy - lne - -#ifdef CONFIG_MN10300_CACHE_ENABLED -#ifdef CONFIG_MN10300_CACHE_WBACK -#ifndef CONFIG_MN10300_CACHE_WBACK_NOWRALLOC - mov CHCTR_ICEN|CHCTR_DCEN|CHCTR_DCWTMD_WRBACK,d0 -#else - mov CHCTR_ICEN|CHCTR_DCEN|CHCTR_DCWTMD_WRBACK|CHCTR_DCALMD,d0 -#endif /* NOWRALLOC */ -#else - mov CHCTR_ICEN|CHCTR_DCEN|CHCTR_DCWTMD_WRTHROUGH,d0 -#endif /* WBACK */ - movhu d0,(a0) # enable -#endif /* ENABLED */ - - # turn on RTS on the debug serial port if applicable -#ifdef CONFIG_MN10300_UNIT_ASB2305 - bset UART_MCR_RTS,(ASB2305_DEBUG_MCR) -#endif - - # clear the BSS area - mov __bss_start,a0 - mov __bss_stop,a1 - clr d0 -bssclear: - cmp a1,a0 - bge bssclear_end - mov d0,(a0) - inc4 a0 - bra bssclear -bssclear_end: - - # retrieve the parameters (including command line) before we overwrite - # them - cmp 0xabadcafe,d1 - bne __no_parameters - -__copy_parameters: - mov redboot_command_line,a0 - mov a0,a1 - add COMMAND_LINE_SIZE,a1 -1: - movbu (a3),d0 - inc a3 - movbu d0,(a0) - inc a0 - cmp a1,a0 - blt 1b - - mov redboot_platform_name,a0 - mov a0,a1 - add COMMAND_LINE_SIZE,a1 - mov d2,a3 -1: - movbu (a3),d0 - inc a3 - movbu d0,(a0) - inc a0 - cmp a1,a0 - blt 1b - -__no_parameters: - - # set up the registers with recognisable rubbish in them - mov init_thread_union+THREAD_SIZE-12,sp - - mov 0xea01eaea,d0 - mov d0,(4,sp) # EPSW save area - mov 0xea02eaea,d0 - mov d0,(8,sp) # PC save area - - mov 0xeb0060ed,d0 - mov d0,mdr - mov 0xeb0061ed,d0 - mov d0,mdrq - mov 0xeb0062ed,d0 - mov d0,mcrh - mov 0xeb0063ed,d0 - mov d0,mcrl - mov 0xeb0064ed,d0 - mov d0,mcvf - mov 0xed0065ed,a3 - mov a3,usp - - mov 0xed00e0ed,e0 - mov 0xed00e1ed,e1 - mov 0xed00e2ed,e2 - mov 0xed00e3ed,e3 - mov 0xed00e4ed,e4 - mov 0xed00e5ed,e5 - mov 0xed00e6ed,e6 - mov 0xed00e7ed,e7 - - mov 0xed00d0ed,d0 - mov 0xed00d1ed,d1 - mov 0xed00d2ed,d2 - mov 0xed00d3ed,d3 - mov 0xed00a0ed,a0 - mov 0xed00a1ed,a1 - mov 0xed00a2ed,a2 - mov 0,a3 - - # set up the initial kernel stack - SAVE_ALL - mov 0xffffffff,d0 - mov d0,(REG_ORIG_D0,fp) - - # put different recognisable rubbish in the regs - mov 0xfb0060ed,d0 - mov d0,mdr - mov 0xfb0061ed,d0 - mov d0,mdrq - mov 0xfb0062ed,d0 - mov d0,mcrh - mov 0xfb0063ed,d0 - mov d0,mcrl - mov 0xfb0064ed,d0 - mov d0,mcvf - mov 0xfd0065ed,a0 - mov a0,usp - - mov 0xfd00e0ed,e0 - mov 0xfd00e1ed,e1 - mov 0xfd00e2ed,e2 - mov 0xfd00e3ed,e3 - mov 0xfd00e4ed,e4 - mov 0xfd00e5ed,e5 - mov 0xfd00e6ed,e6 - mov 0xfd00e7ed,e7 - - mov 0xfd00d0ed,d0 - mov 0xfd00d1ed,d1 - mov 0xfd00d2ed,d2 - mov 0xfd00d3ed,d3 - mov 0xfd00a0ed,a0 - mov 0xfd00a1ed,a1 - mov 0xfd00a2ed,a2 - - # we may be holding current in E2 -#ifdef CONFIG_MN10300_CURRENT_IN_E2 - mov init_task,e2 -#endif - - # initialise the processor and the unit - call processor_init[],0 - call unit_init[],0 - -#ifdef CONFIG_SMP - # mark the primary CPU in cpu_boot_map - mov cpu_boot_map,a0 - mov 0x1,d0 - mov d0,(a0) - - # signal each secondary CPU to begin booting - mov 0x1,d2 # CPU ID - -loop_request_boot_secondary: - mov d2,a0 - # send SMP_BOOT_IPI to secondary CPU - asl CROSS_ICR_CPU_SHIFT,a0 - add CROSS_GxICR(SMP_BOOT_IRQ,0),a0 - movhu (a0),d0 - or GxICR_REQUEST|GxICR_DETECT,d0 - movhu d0,(a0) - movhu (a0),d0 # flush - - # wait up to 100ms for AP's IPI to be received - clr d3 -wait_on_secondary_boot: - mov DELAY_TIME_BOOT_IPI,d0 - call __delay[],0 - inc d3 - mov cpu_boot_map,a0 - mov (a0),d0 - lsr d2,d0 - btst 0x1,d0 - bne 1f - cmp TIME_OUT_COUNT_BOOT_IPI,d3 - bne wait_on_secondary_boot -1: - inc d2 - cmp NR_CPUS,d2 - bne loop_request_boot_secondary -#endif /* CONFIG_SMP */ - -#ifdef CONFIG_GDBSTUB - call gdbstub_init[],0 - -#ifdef CONFIG_GDBSTUB_IMMEDIATE - .globl __gdbstub_pause -__gdbstub_pause: - bra __gdbstub_pause -#endif -#endif - - jmp start_kernel - .size _start,.-_start - -############################################################################### -# -# Secondary CPU boot point -# -############################################################################### -#ifdef CONFIG_SMP -startup_secondary: - # preload the PGD pointer register - mov swapper_pg_dir,d0 - mov d0,(PTBR) - clr d0 - movbu d0,(PIDR) - - # turn on the TLBs - mov MMUCTR_IIV|MMUCTR_DIV,d0 - mov d0,(MMUCTR) -#ifdef CONFIG_AM34_2 - mov MMUCTR_ITE|MMUCTR_DTE|MMUCTR_CE|MMUCTR_WTE,d0 -#else - mov MMUCTR_ITE|MMUCTR_DTE|MMUCTR_CE,d0 -#endif - mov d0,(MMUCTR) - - # turn on AM33v2 exception handling mode and set the trap table base - movhu (CPUP),d0 - or CPUP_EXM_AM33V2,d0 - movhu d0,(CPUP) - - # set the interrupt vector table - mov CONFIG_INTERRUPT_VECTOR_BASE,d0 - mov d0,(TBR) - - # invalidate and enable both of the caches - mov ECHCTR,a0 - clr d0 - mov d0,(a0) - mov CHCTR,a0 - clr d0 - movhu d0,(a0) # turn off first - mov CHCTR_ICINV|CHCTR_DCINV,d0 - movhu d0,(a0) - setlb - mov (a0),d0 - btst CHCTR_ICBUSY|CHCTR_DCBUSY,d0 # wait till not busy (use CPU loop buffer) - lne - -#ifdef CONFIG_MN10300_CACHE_ENABLED -#ifdef CONFIG_MN10300_CACHE_WBACK -#ifndef CONFIG_MN10300_CACHE_WBACK_NOWRALLOC - mov CHCTR_ICEN|CHCTR_DCEN|CHCTR_DCWTMD_WRBACK,d0 -#else - mov CHCTR_ICEN|CHCTR_DCEN|CHCTR_DCWTMD_WRBACK|CHCTR_DCALMD,d0 -#endif /* !NOWRALLOC */ -#else - mov CHCTR_ICEN|CHCTR_DCEN|CHCTR_DCWTMD_WRTHROUGH,d0 -#endif /* WBACK */ - movhu d0,(a0) # enable -#endif /* ENABLED */ - - # Clear the boot IPI interrupt for this CPU - movhu (GxICR(SMP_BOOT_IRQ)),d0 - and ~GxICR_REQUEST,d0 - movhu d0,(GxICR(SMP_BOOT_IRQ)) - movhu (GxICR(SMP_BOOT_IRQ)),d0 # flush - - /* get stack */ - mov CONFIG_INTERRUPT_VECTOR_BASE + CONFIG_BOOT_STACK_OFFSET,a0 - mov (CPUID),d0 - and CPUID_MASK,d0 - mulu CONFIG_BOOT_STACK_SIZE,d0 - sub d0,a0 - mov a0,sp - - # init interrupt for AP - call smp_prepare_cpu_init[],0 - - # mark this secondary CPU in cpu_boot_map - mov (CPUID),d0 - mov 0x1,d1 - asl d0,d1 - mov cpu_boot_map,a0 - bset d1,(a0) - - or EPSW_IE|EPSW_IM_1,epsw # permit level 0 interrupts - nop - nop -#ifdef CONFIG_MN10300_CACHE_WBACK - # flush the local cache if it's in writeback mode - call mn10300_local_dcache_flush_inv[],0 - setlb - mov (CHCTR),d0 - btst CHCTR_DCBUSY,d0 # wait till not busy (use CPU loop buffer) - lne -#endif - - # now sleep waiting for further instructions -secondary_sleep: - mov CPUM_SLEEP,d0 - movhu d0,(CPUM) - nop - nop - bra secondary_sleep - .size startup_secondary,.-startup_secondary -#endif /* CONFIG_SMP */ - -############################################################################### -# -# -# -############################################################################### -ENTRY(__head_end) - -/* - * This is initialized to disallow all access to the low 2G region - * - the high 2G region is managed directly by the MMU - * - range 0x70000000-0x7C000000 are initialised for use by VMALLOC - */ - .section .bss - .balign PAGE_SIZE -ENTRY(swapper_pg_dir) - .space PTRS_PER_PGD*4 - -/* - * The page tables are initialized to only 8MB here - the final page - * tables are set up later depending on memory size. - */ - - .balign PAGE_SIZE -ENTRY(empty_zero_page) - .space PAGE_SIZE - - .balign PAGE_SIZE -ENTRY(large_page_table) - .space PAGE_SIZE - - .balign PAGE_SIZE -ENTRY(kernel_vmalloc_ptes) - .space ((VMALLOC_END-VMALLOC_START)/PAGE_SIZE)*4 diff --git a/arch/mn10300/kernel/internal.h b/arch/mn10300/kernel/internal.h deleted file mode 100644 index 561785581f6c2..0000000000000 --- a/arch/mn10300/kernel/internal.h +++ /dev/null @@ -1,40 +0,0 @@ -/* Internal definitions for the arch part of the core kernel - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - -#include - -struct clocksource; -struct clock_event_device; - -/* - * entry.S - */ -extern void ret_from_fork(struct task_struct *) __attribute__((noreturn)); -extern void ret_from_kernel_thread(struct task_struct *) __attribute__((noreturn)); - -/* - * smp-low.S - */ -#ifdef CONFIG_SMP -extern void mn10300_low_ipi_handler(void); -#endif - -/* - * smp.c - */ -#ifdef CONFIG_SMP -extern void smp_jump_to_debugger(void); -#endif - -/* - * time.c - */ -extern irqreturn_t local_timer_interrupt(void); diff --git a/arch/mn10300/kernel/io.c b/arch/mn10300/kernel/io.c deleted file mode 100644 index e96fdf6bb5423..0000000000000 --- a/arch/mn10300/kernel/io.c +++ /dev/null @@ -1,30 +0,0 @@ -/* MN10300 Misaligned multibyte-word I/O - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include -#include -#include - -/* - * output data from a potentially misaligned buffer - */ -void __outsl(unsigned long addr, const void *buffer, int count) -{ - const unsigned char *buf = buffer; - unsigned long val; - - while (count--) { - memcpy(&val, buf, 4); - outl(val, addr); - buf += 4; - } -} -EXPORT_SYMBOL(__outsl); diff --git a/arch/mn10300/kernel/irq.c b/arch/mn10300/kernel/irq.c deleted file mode 100644 index c716437baa2cd..0000000000000 --- a/arch/mn10300/kernel/irq.c +++ /dev/null @@ -1,356 +0,0 @@ -/* MN10300 Arch-specific interrupt handling - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include -#include -#include -#include -#include -#include - -unsigned long __mn10300_irq_enabled_epsw[NR_CPUS] __cacheline_aligned_in_smp = { - [0 ... NR_CPUS - 1] = EPSW_IE | EPSW_IM_7 -}; -EXPORT_SYMBOL(__mn10300_irq_enabled_epsw); - -#ifdef CONFIG_SMP -static char irq_affinity_online[NR_IRQS] = { - [0 ... NR_IRQS - 1] = 0 -}; - -#define NR_IRQ_WORDS ((NR_IRQS + 31) / 32) -static unsigned long irq_affinity_request[NR_IRQ_WORDS] = { - [0 ... NR_IRQ_WORDS - 1] = 0 -}; -#endif /* CONFIG_SMP */ - -atomic_t irq_err_count; - -/* - * MN10300 interrupt controller operations - */ -static void mn10300_cpupic_ack(struct irq_data *d) -{ - unsigned int irq = d->irq; - unsigned long flags; - u16 tmp; - - flags = arch_local_cli_save(); - GxICR_u8(irq) = GxICR_DETECT; - tmp = GxICR(irq); - arch_local_irq_restore(flags); -} - -static void __mask_and_set_icr(unsigned int irq, - unsigned int mask, unsigned int set) -{ - unsigned long flags; - u16 tmp; - - flags = arch_local_cli_save(); - tmp = GxICR(irq); - GxICR(irq) = (tmp & mask) | set; - tmp = GxICR(irq); - arch_local_irq_restore(flags); -} - -static void mn10300_cpupic_mask(struct irq_data *d) -{ - __mask_and_set_icr(d->irq, GxICR_LEVEL, 0); -} - -static void mn10300_cpupic_mask_ack(struct irq_data *d) -{ - unsigned int irq = d->irq; -#ifdef CONFIG_SMP - unsigned long flags; - u16 tmp; - - flags = arch_local_cli_save(); - - if (!test_and_clear_bit(irq, irq_affinity_request)) { - tmp = GxICR(irq); - GxICR(irq) = (tmp & GxICR_LEVEL) | GxICR_DETECT; - tmp = GxICR(irq); - } else { - u16 tmp2; - tmp = GxICR(irq); - GxICR(irq) = (tmp & GxICR_LEVEL); - tmp2 = GxICR(irq); - - irq_affinity_online[irq] = - cpumask_any_and(irq_data_get_affinity_mask(d), - cpu_online_mask); - CROSS_GxICR(irq, irq_affinity_online[irq]) = - (tmp & (GxICR_LEVEL | GxICR_ENABLE)) | GxICR_DETECT; - tmp = CROSS_GxICR(irq, irq_affinity_online[irq]); - } - - arch_local_irq_restore(flags); -#else /* CONFIG_SMP */ - __mask_and_set_icr(irq, GxICR_LEVEL, GxICR_DETECT); -#endif /* CONFIG_SMP */ -} - -static void mn10300_cpupic_unmask(struct irq_data *d) -{ - __mask_and_set_icr(d->irq, GxICR_LEVEL, GxICR_ENABLE); -} - -static void mn10300_cpupic_unmask_clear(struct irq_data *d) -{ - unsigned int irq = d->irq; - /* the MN10300 PIC latches its interrupt request bit, even after the - * device has ceased to assert its interrupt line and the interrupt - * channel has been disabled in the PIC, so for level-triggered - * interrupts we need to clear the request bit when we re-enable */ -#ifdef CONFIG_SMP - unsigned long flags; - u16 tmp; - - flags = arch_local_cli_save(); - - if (!test_and_clear_bit(irq, irq_affinity_request)) { - tmp = GxICR(irq); - GxICR(irq) = (tmp & GxICR_LEVEL) | GxICR_ENABLE | GxICR_DETECT; - tmp = GxICR(irq); - } else { - tmp = GxICR(irq); - - irq_affinity_online[irq] = cpumask_any_and(irq_data_get_affinity_mask(d), - cpu_online_mask); - CROSS_GxICR(irq, irq_affinity_online[irq]) = (tmp & GxICR_LEVEL) | GxICR_ENABLE | GxICR_DETECT; - tmp = CROSS_GxICR(irq, irq_affinity_online[irq]); - } - - arch_local_irq_restore(flags); -#else /* CONFIG_SMP */ - __mask_and_set_icr(irq, GxICR_LEVEL, GxICR_ENABLE | GxICR_DETECT); -#endif /* CONFIG_SMP */ -} - -#ifdef CONFIG_SMP -static int -mn10300_cpupic_setaffinity(struct irq_data *d, const struct cpumask *mask, - bool force) -{ - unsigned long flags; - - flags = arch_local_cli_save(); - set_bit(d->irq, irq_affinity_request); - arch_local_irq_restore(flags); - return 0; -} -#endif /* CONFIG_SMP */ - -/* - * MN10300 PIC level-triggered IRQ handling. - * - * The PIC has no 'ACK' function per se. It is possible to clear individual - * channel latches, but each latch relatches whether or not the channel is - * masked, so we need to clear the latch when we unmask the channel. - * - * Also for this reason, we don't supply an ack() op (it's unused anyway if - * mask_ack() is provided), and mask_ack() just masks. - */ -static struct irq_chip mn10300_cpu_pic_level = { - .name = "cpu_l", - .irq_disable = mn10300_cpupic_mask, - .irq_enable = mn10300_cpupic_unmask_clear, - .irq_ack = NULL, - .irq_mask = mn10300_cpupic_mask, - .irq_mask_ack = mn10300_cpupic_mask, - .irq_unmask = mn10300_cpupic_unmask_clear, -#ifdef CONFIG_SMP - .irq_set_affinity = mn10300_cpupic_setaffinity, -#endif -}; - -/* - * MN10300 PIC edge-triggered IRQ handling. - * - * We use the latch clearing function of the PIC as the 'ACK' function. - */ -static struct irq_chip mn10300_cpu_pic_edge = { - .name = "cpu_e", - .irq_disable = mn10300_cpupic_mask, - .irq_enable = mn10300_cpupic_unmask, - .irq_ack = mn10300_cpupic_ack, - .irq_mask = mn10300_cpupic_mask, - .irq_mask_ack = mn10300_cpupic_mask_ack, - .irq_unmask = mn10300_cpupic_unmask, -#ifdef CONFIG_SMP - .irq_set_affinity = mn10300_cpupic_setaffinity, -#endif -}; - -/* - * '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(int irq) -{ - printk(KERN_WARNING "unexpected IRQ trap at vector %02x\n", irq); -} - -/* - * change the level at which an IRQ executes - * - must not be called whilst interrupts are being processed! - */ -void set_intr_level(int irq, u16 level) -{ - BUG_ON(in_interrupt()); - - __mask_and_set_icr(irq, GxICR_ENABLE, level); -} - -/* - * mark an interrupt to be ACK'd after interrupt handlers have been run rather - * than before - */ -void mn10300_set_lateack_irq_type(int irq) -{ - irq_set_chip_and_handler(irq, &mn10300_cpu_pic_level, - handle_level_irq); -} - -/* - * initialise the interrupt system - */ -void __init init_IRQ(void) -{ - int irq; - - for (irq = 0; irq < NR_IRQS; irq++) - if (irq_get_chip(irq) == &no_irq_chip) - /* due to the PIC latching interrupt requests, even - * when the IRQ is disabled, IRQ_PENDING is superfluous - * and we can use handle_level_irq() for edge-triggered - * interrupts */ - irq_set_chip_and_handler(irq, &mn10300_cpu_pic_edge, - handle_level_irq); - - unit_init_IRQ(); -} - -/* - * handle normal device IRQs - */ -asmlinkage void do_IRQ(void) -{ - unsigned long sp, epsw, irq_disabled_epsw, old_irq_enabled_epsw; - unsigned int cpu_id = smp_processor_id(); - int irq; - - sp = current_stack_pointer(); - BUG_ON(sp - (sp & ~(THREAD_SIZE - 1)) < STACK_WARN); - - /* make sure local_irq_enable() doesn't muck up the interrupt priority - * setting in EPSW */ - old_irq_enabled_epsw = __mn10300_irq_enabled_epsw[cpu_id]; - local_save_flags(epsw); - __mn10300_irq_enabled_epsw[cpu_id] = EPSW_IE | (EPSW_IM & epsw); - irq_disabled_epsw = EPSW_IE | MN10300_CLI_LEVEL; - -#ifdef CONFIG_MN10300_WD_TIMER - __IRQ_STAT(cpu_id, __irq_count)++; -#endif - - irq_enter(); - - for (;;) { - /* ask the interrupt controller for the next IRQ to process - * - the result we get depends on EPSW.IM - */ - irq = IAGR & IAGR_GN; - if (!irq) - break; - - local_irq_restore(irq_disabled_epsw); - - generic_handle_irq(irq >> 2); - - /* restore IRQ controls for IAGR access */ - local_irq_restore(epsw); - } - - __mn10300_irq_enabled_epsw[cpu_id] = old_irq_enabled_epsw; - - irq_exit(); -} - -/* - * Display interrupt management information through /proc/interrupts - */ -int arch_show_interrupts(struct seq_file *p, int prec) -{ -#ifdef CONFIG_MN10300_WD_TIMER - int j; - - seq_printf(p, "%*s: ", prec, "NMI"); - for (j = 0; j < NR_CPUS; j++) - if (cpu_online(j)) - seq_printf(p, "%10u ", nmi_count(j)); - seq_putc(p, '\n'); -#endif - - seq_printf(p, "%*s: ", prec, "ERR"); - seq_printf(p, "%10u\n", atomic_read(&irq_err_count)); - return 0; -} - -#ifdef CONFIG_HOTPLUG_CPU -void migrate_irqs(void) -{ - int irq; - unsigned int self, new; - unsigned long flags; - - self = smp_processor_id(); - for (irq = 0; irq < NR_IRQS; irq++) { - struct irq_data *data = irq_get_irq_data(irq); - struct cpumask *mask = irq_data_get_affinity_mask(data); - - if (irqd_is_per_cpu(data)) - continue; - - if (cpumask_test_cpu(self, mask) && - !cpumask_intersects(&irq_affinity[irq], cpu_online_mask)) { - int cpu_id; - cpu_id = cpumask_first(cpu_online_mask); - cpumask_set_cpu(cpu_id, mask); - } - /* We need to operate irq_affinity_online atomically. */ - arch_local_cli_save(flags); - if (irq_affinity_online[irq] == self) { - u16 x, tmp; - - x = GxICR(irq); - GxICR(irq) = x & GxICR_LEVEL; - tmp = GxICR(irq); - - new = cpumask_any_and(mask, cpu_online_mask); - irq_affinity_online[irq] = new; - - CROSS_GxICR(irq, new) = - (x & GxICR_LEVEL) | GxICR_DETECT; - tmp = CROSS_GxICR(irq, new); - - x &= GxICR_LEVEL | GxICR_ENABLE; - if (GxICR(irq) & GxICR_REQUEST) - x |= GxICR_REQUEST | GxICR_DETECT; - CROSS_GxICR(irq, new) = x; - tmp = CROSS_GxICR(irq, new); - } - arch_local_irq_restore(flags); - } -} -#endif /* CONFIG_HOTPLUG_CPU */ diff --git a/arch/mn10300/kernel/kgdb.c b/arch/mn10300/kernel/kgdb.c deleted file mode 100644 index 2d7986c386fe5..0000000000000 --- a/arch/mn10300/kernel/kgdb.c +++ /dev/null @@ -1,502 +0,0 @@ -/* kgdb support for MN10300 - * - * Copyright (C) 2010 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "internal.h" - -/* - * Software single-stepping breakpoint save (used by __switch_to()) - */ -static struct thread_info *kgdb_sstep_thread; -u8 *kgdb_sstep_bp_addr[2]; -u8 kgdb_sstep_bp[2]; - -/* - * Copy kernel exception frame registers to the GDB register file - */ -void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs) -{ - unsigned long ssp = (unsigned long) (regs + 1); - - gdb_regs[GDB_FR_D0] = regs->d0; - gdb_regs[GDB_FR_D1] = regs->d1; - gdb_regs[GDB_FR_D2] = regs->d2; - gdb_regs[GDB_FR_D3] = regs->d3; - gdb_regs[GDB_FR_A0] = regs->a0; - gdb_regs[GDB_FR_A1] = regs->a1; - gdb_regs[GDB_FR_A2] = regs->a2; - gdb_regs[GDB_FR_A3] = regs->a3; - gdb_regs[GDB_FR_SP] = (regs->epsw & EPSW_nSL) ? regs->sp : ssp; - gdb_regs[GDB_FR_PC] = regs->pc; - gdb_regs[GDB_FR_MDR] = regs->mdr; - gdb_regs[GDB_FR_EPSW] = regs->epsw; - gdb_regs[GDB_FR_LIR] = regs->lir; - gdb_regs[GDB_FR_LAR] = regs->lar; - gdb_regs[GDB_FR_MDRQ] = regs->mdrq; - gdb_regs[GDB_FR_E0] = regs->e0; - gdb_regs[GDB_FR_E1] = regs->e1; - gdb_regs[GDB_FR_E2] = regs->e2; - gdb_regs[GDB_FR_E3] = regs->e3; - gdb_regs[GDB_FR_E4] = regs->e4; - gdb_regs[GDB_FR_E5] = regs->e5; - gdb_regs[GDB_FR_E6] = regs->e6; - gdb_regs[GDB_FR_E7] = regs->e7; - gdb_regs[GDB_FR_SSP] = ssp; - gdb_regs[GDB_FR_MSP] = 0; - gdb_regs[GDB_FR_USP] = regs->sp; - gdb_regs[GDB_FR_MCRH] = regs->mcrh; - gdb_regs[GDB_FR_MCRL] = regs->mcrl; - gdb_regs[GDB_FR_MCVF] = regs->mcvf; - gdb_regs[GDB_FR_DUMMY0] = 0; - gdb_regs[GDB_FR_DUMMY1] = 0; - gdb_regs[GDB_FR_FS0] = 0; -} - -/* - * Extracts kernel SP/PC values understandable by gdb from the values - * saved by switch_to(). - */ -void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p) -{ - gdb_regs[GDB_FR_SSP] = p->thread.sp; - gdb_regs[GDB_FR_PC] = p->thread.pc; - gdb_regs[GDB_FR_A3] = p->thread.a3; - gdb_regs[GDB_FR_USP] = p->thread.usp; - gdb_regs[GDB_FR_FPCR] = p->thread.fpu_state.fpcr; -} - -/* - * Fill kernel exception frame registers from the GDB register file - */ -void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs) -{ - regs->d0 = gdb_regs[GDB_FR_D0]; - regs->d1 = gdb_regs[GDB_FR_D1]; - regs->d2 = gdb_regs[GDB_FR_D2]; - regs->d3 = gdb_regs[GDB_FR_D3]; - regs->a0 = gdb_regs[GDB_FR_A0]; - regs->a1 = gdb_regs[GDB_FR_A1]; - regs->a2 = gdb_regs[GDB_FR_A2]; - regs->a3 = gdb_regs[GDB_FR_A3]; - regs->sp = gdb_regs[GDB_FR_SP]; - regs->pc = gdb_regs[GDB_FR_PC]; - regs->mdr = gdb_regs[GDB_FR_MDR]; - regs->epsw = gdb_regs[GDB_FR_EPSW]; - regs->lir = gdb_regs[GDB_FR_LIR]; - regs->lar = gdb_regs[GDB_FR_LAR]; - regs->mdrq = gdb_regs[GDB_FR_MDRQ]; - regs->e0 = gdb_regs[GDB_FR_E0]; - regs->e1 = gdb_regs[GDB_FR_E1]; - regs->e2 = gdb_regs[GDB_FR_E2]; - regs->e3 = gdb_regs[GDB_FR_E3]; - regs->e4 = gdb_regs[GDB_FR_E4]; - regs->e5 = gdb_regs[GDB_FR_E5]; - regs->e6 = gdb_regs[GDB_FR_E6]; - regs->e7 = gdb_regs[GDB_FR_E7]; - regs->sp = gdb_regs[GDB_FR_SSP]; - /* gdb_regs[GDB_FR_MSP]; */ - // regs->usp = gdb_regs[GDB_FR_USP]; - regs->mcrh = gdb_regs[GDB_FR_MCRH]; - regs->mcrl = gdb_regs[GDB_FR_MCRL]; - regs->mcvf = gdb_regs[GDB_FR_MCVF]; - /* gdb_regs[GDB_FR_DUMMY0]; */ - /* gdb_regs[GDB_FR_DUMMY1]; */ - - // regs->fpcr = gdb_regs[GDB_FR_FPCR]; - // regs->fs0 = gdb_regs[GDB_FR_FS0]; -} - -struct kgdb_arch arch_kgdb_ops = { - .gdb_bpt_instr = { 0xff }, - .flags = KGDB_HW_BREAKPOINT, -}; - -static const unsigned char mn10300_kgdb_insn_sizes[256] = -{ - /* 1 2 3 4 5 6 7 8 9 a b c d e f */ - 1, 3, 3, 3, 1, 3, 3, 3, 1, 3, 3, 3, 1, 3, 3, 3, /* 0 */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 1 */ - 2, 2, 2, 2, 3, 3, 3, 3, 2, 2, 2, 2, 3, 3, 3, 3, /* 2 */ - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, /* 3 */ - 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, /* 4 */ - 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, /* 5 */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 6 */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 7 */ - 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, /* 8 */ - 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, /* 9 */ - 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, /* a */ - 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, /* b */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 2, /* c */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* d */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* e */ - 0, 2, 2, 2, 2, 2, 2, 4, 0, 3, 0, 4, 0, 6, 7, 1 /* f */ -}; - -/* - * Attempt to emulate single stepping by means of breakpoint instructions. - * Although there is a single-step trace flag in EPSW, its use is not - * sufficiently documented and is only intended for use with the JTAG debugger. - */ -static int kgdb_arch_do_singlestep(struct pt_regs *regs) -{ - unsigned long arg; - unsigned size; - u8 *pc = (u8 *)regs->pc, *sp = (u8 *)(regs + 1), cur; - u8 *x = NULL, *y = NULL; - int ret; - - ret = probe_kernel_read(&cur, pc, 1); - if (ret < 0) - return ret; - - size = mn10300_kgdb_insn_sizes[cur]; - if (size > 0) { - x = pc + size; - goto set_x; - } - - switch (cur) { - /* Bxx (d8,PC) */ - case 0xc0 ... 0xca: - ret = probe_kernel_read(&arg, pc + 1, 1); - if (ret < 0) - return ret; - x = pc + 2; - if (arg >= 0 && arg <= 2) - goto set_x; - y = pc + (s8)arg; - goto set_x_and_y; - - /* LXX (d8,PC) */ - case 0xd0 ... 0xda: - x = pc + 1; - if (regs->pc == regs->lar) - goto set_x; - y = (u8 *)regs->lar; - goto set_x_and_y; - - /* SETLB - loads the next four bytes into the LIR register - * (which mustn't include a breakpoint instruction) */ - case 0xdb: - x = pc + 5; - goto set_x; - - /* JMP (d16,PC) or CALL (d16,PC) */ - case 0xcc: - case 0xcd: - ret = probe_kernel_read(&arg, pc + 1, 2); - if (ret < 0) - return ret; - x = pc + (s16)arg; - goto set_x; - - /* JMP (d32,PC) or CALL (d32,PC) */ - case 0xdc: - case 0xdd: - ret = probe_kernel_read(&arg, pc + 1, 4); - if (ret < 0) - return ret; - x = pc + (s32)arg; - goto set_x; - - /* RETF */ - case 0xde: - x = (u8 *)regs->mdr; - goto set_x; - - /* RET */ - case 0xdf: - ret = probe_kernel_read(&arg, pc + 2, 1); - if (ret < 0) - return ret; - ret = probe_kernel_read(&x, sp + (s8)arg, 4); - if (ret < 0) - return ret; - goto set_x; - - case 0xf0: - ret = probe_kernel_read(&cur, pc + 1, 1); - if (ret < 0) - return ret; - - if (cur >= 0xf0 && cur <= 0xf7) { - /* JMP (An) / CALLS (An) */ - switch (cur & 3) { - case 0: x = (u8 *)regs->a0; break; - case 1: x = (u8 *)regs->a1; break; - case 2: x = (u8 *)regs->a2; break; - case 3: x = (u8 *)regs->a3; break; - } - goto set_x; - } else if (cur == 0xfc) { - /* RETS */ - ret = probe_kernel_read(&x, sp, 4); - if (ret < 0) - return ret; - goto set_x; - } else if (cur == 0xfd) { - /* RTI */ - ret = probe_kernel_read(&x, sp + 4, 4); - if (ret < 0) - return ret; - goto set_x; - } else { - x = pc + 2; - goto set_x; - } - break; - - /* potential 3-byte conditional branches */ - case 0xf8: - ret = probe_kernel_read(&cur, pc + 1, 1); - if (ret < 0) - return ret; - x = pc + 3; - - if (cur >= 0xe8 && cur <= 0xeb) { - ret = probe_kernel_read(&arg, pc + 2, 1); - if (ret < 0) - return ret; - if (arg >= 0 && arg <= 3) - goto set_x; - y = pc + (s8)arg; - goto set_x_and_y; - } - goto set_x; - - case 0xfa: - ret = probe_kernel_read(&cur, pc + 1, 1); - if (ret < 0) - return ret; - - if (cur == 0xff) { - /* CALLS (d16,PC) */ - ret = probe_kernel_read(&arg, pc + 2, 2); - if (ret < 0) - return ret; - x = pc + (s16)arg; - goto set_x; - } - - x = pc + 4; - goto set_x; - - case 0xfc: - ret = probe_kernel_read(&cur, pc + 1, 1); - if (ret < 0) - return ret; - - if (cur == 0xff) { - /* CALLS (d32,PC) */ - ret = probe_kernel_read(&arg, pc + 2, 4); - if (ret < 0) - return ret; - x = pc + (s32)arg; - goto set_x; - } - - x = pc + 6; - goto set_x; - } - - return 0; - -set_x: - kgdb_sstep_bp_addr[0] = x; - kgdb_sstep_bp_addr[1] = NULL; - ret = probe_kernel_read(&kgdb_sstep_bp[0], x, 1); - if (ret < 0) - return ret; - ret = probe_kernel_write(x, &arch_kgdb_ops.gdb_bpt_instr, 1); - if (ret < 0) - return ret; - kgdb_sstep_thread = current_thread_info(); - debugger_local_cache_flushinv_one(x); - return ret; - -set_x_and_y: - kgdb_sstep_bp_addr[0] = x; - kgdb_sstep_bp_addr[1] = y; - ret = probe_kernel_read(&kgdb_sstep_bp[0], x, 1); - if (ret < 0) - return ret; - ret = probe_kernel_read(&kgdb_sstep_bp[1], y, 1); - if (ret < 0) - return ret; - ret = probe_kernel_write(x, &arch_kgdb_ops.gdb_bpt_instr, 1); - if (ret < 0) - return ret; - ret = probe_kernel_write(y, &arch_kgdb_ops.gdb_bpt_instr, 1); - if (ret < 0) { - probe_kernel_write(kgdb_sstep_bp_addr[0], - &kgdb_sstep_bp[0], 1); - } else { - kgdb_sstep_thread = current_thread_info(); - } - debugger_local_cache_flushinv_one(x); - debugger_local_cache_flushinv_one(y); - return ret; -} - -/* - * Remove emplaced single-step breakpoints, returning true if we hit one of - * them. - */ -static bool kgdb_arch_undo_singlestep(struct pt_regs *regs) -{ - bool hit = false; - u8 *x = kgdb_sstep_bp_addr[0], *y = kgdb_sstep_bp_addr[1]; - u8 opcode; - - if (kgdb_sstep_thread == current_thread_info()) { - if (x) { - if (x == (u8 *)regs->pc) - hit = true; - if (probe_kernel_read(&opcode, x, - 1) < 0 || - opcode != 0xff) - BUG(); - probe_kernel_write(x, &kgdb_sstep_bp[0], 1); - debugger_local_cache_flushinv_one(x); - } - if (y) { - if (y == (u8 *)regs->pc) - hit = true; - if (probe_kernel_read(&opcode, y, - 1) < 0 || - opcode != 0xff) - BUG(); - probe_kernel_write(y, &kgdb_sstep_bp[1], 1); - debugger_local_cache_flushinv_one(y); - } - } - - kgdb_sstep_bp_addr[0] = NULL; - kgdb_sstep_bp_addr[1] = NULL; - kgdb_sstep_thread = NULL; - return hit; -} - -/* - * Catch a single-step-pending thread being deleted and make sure the global - * single-step state is cleared. At this point the breakpoints should have - * been removed by __switch_to(). - */ -void arch_release_thread_stack(unsigned long *stack) -{ - struct thread_info *ti = (void *)stack; - if (kgdb_sstep_thread == ti) { - kgdb_sstep_thread = NULL; - - /* However, we may now be running in degraded mode, with most - * of the CPUs disabled until such a time as KGDB is reentered, - * so force immediate reentry */ - kgdb_breakpoint(); - } -} - -/* - * Handle unknown packets and [CcsDk] packets - * - at this point breakpoints have been installed - */ -int kgdb_arch_handle_exception(int vector, int signo, int err_code, - char *remcom_in_buffer, char *remcom_out_buffer, - struct pt_regs *regs) -{ - long addr; - char *ptr; - - switch (remcom_in_buffer[0]) { - case 'c': - case 's': - /* try to read optional parameter, pc unchanged if no parm */ - ptr = &remcom_in_buffer[1]; - if (kgdb_hex2long(&ptr, &addr)) - regs->pc = addr; - case 'D': - case 'k': - atomic_set(&kgdb_cpu_doing_single_step, -1); - - if (remcom_in_buffer[0] == 's') { - kgdb_arch_do_singlestep(regs); - kgdb_single_step = 1; - atomic_set(&kgdb_cpu_doing_single_step, - raw_smp_processor_id()); - } - return 0; - } - return -1; /* this means that we do not want to exit from the handler */ -} - -/* - * Handle event interception - * - returns 0 if the exception should be skipped, -ERROR otherwise. - */ -int debugger_intercept(enum exception_code excep, int signo, int si_code, - struct pt_regs *regs) -{ - int ret; - - if (kgdb_arch_undo_singlestep(regs)) { - excep = EXCEP_TRAP; - signo = SIGTRAP; - si_code = TRAP_TRACE; - } - - ret = kgdb_handle_exception(excep, signo, si_code, regs); - - debugger_local_cache_flushinv(); - - return ret; -} - -/* - * Determine if we've hit a debugger special breakpoint - */ -int at_debugger_breakpoint(struct pt_regs *regs) -{ - return regs->pc == (unsigned long)&__arch_kgdb_breakpoint; -} - -/* - * Initialise kgdb - */ -int kgdb_arch_init(void) -{ - return 0; -} - -/* - * Do something, perhaps, but don't know what. - */ -void kgdb_arch_exit(void) -{ -} - -#ifdef CONFIG_SMP -void debugger_nmi_interrupt(struct pt_regs *regs, enum exception_code code) -{ - kgdb_nmicallback(arch_smp_processor_id(), regs); - debugger_local_cache_flushinv(); -} - -void kgdb_roundup_cpus(unsigned long flags) -{ - smp_jump_to_debugger(); -} -#endif diff --git a/arch/mn10300/kernel/kprobes.c b/arch/mn10300/kernel/kprobes.c deleted file mode 100644 index 0311a7fcea169..0000000000000 --- a/arch/mn10300/kernel/kprobes.c +++ /dev/null @@ -1,656 +0,0 @@ -/* MN10300 Kernel probes implementation - * - * Copyright (C) 2005 Red Hat, Inc. All Rights Reserved. - * Written by Mark Salter (msalter@redhat.com) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public Licence as published by - * the Free Software Foundation; either version 2 of the Licence, 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 Licence for more details. - * - * You should have received a copy of the GNU General Public Licence - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ -#include -#include -#include -#include -#include -#include - -struct kretprobe_blackpoint kretprobe_blacklist[] = { { NULL, NULL } }; -const int kretprobe_blacklist_size = ARRAY_SIZE(kretprobe_blacklist); - -/* kprobe_status settings */ -#define KPROBE_HIT_ACTIVE 0x00000001 -#define KPROBE_HIT_SS 0x00000002 - -static struct kprobe *cur_kprobe; -static unsigned long cur_kprobe_orig_pc; -static unsigned long cur_kprobe_next_pc; -static int cur_kprobe_ss_flags; -static unsigned long kprobe_status; -static kprobe_opcode_t cur_kprobe_ss_buf[MAX_INSN_SIZE + 2]; -static unsigned long cur_kprobe_bp_addr; - -DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL; - - -/* singlestep flag bits */ -#define SINGLESTEP_BRANCH 1 -#define SINGLESTEP_PCREL 2 - -#define READ_BYTE(p, valp) \ - do { *(u8 *)(valp) = *(u8 *)(p); } while (0) - -#define READ_WORD16(p, valp) \ - do { \ - READ_BYTE((p), (valp)); \ - READ_BYTE((u8 *)(p) + 1, (u8 *)(valp) + 1); \ - } while (0) - -#define READ_WORD32(p, valp) \ - do { \ - READ_BYTE((p), (valp)); \ - READ_BYTE((u8 *)(p) + 1, (u8 *)(valp) + 1); \ - READ_BYTE((u8 *)(p) + 2, (u8 *)(valp) + 2); \ - READ_BYTE((u8 *)(p) + 3, (u8 *)(valp) + 3); \ - } while (0) - - -static const u8 mn10300_insn_sizes[256] = -{ - /* 1 2 3 4 5 6 7 8 9 a b c d e f */ - 1, 3, 3, 3, 1, 3, 3, 3, 1, 3, 3, 3, 1, 3, 3, 3, /* 0 */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 1 */ - 2, 2, 2, 2, 3, 3, 3, 3, 2, 2, 2, 2, 3, 3, 3, 3, /* 2 */ - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, /* 3 */ - 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, 1, 1, 2, 2, /* 4 */ - 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, /* 5 */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 6 */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 7 */ - 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, /* 8 */ - 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, /* 9 */ - 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, /* a */ - 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, /* b */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 2, /* c */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* d */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* e */ - 0, 2, 2, 2, 2, 2, 2, 4, 0, 3, 0, 4, 0, 6, 7, 1 /* f */ -}; - -#define LT (1 << 0) -#define GT (1 << 1) -#define GE (1 << 2) -#define LE (1 << 3) -#define CS (1 << 4) -#define HI (1 << 5) -#define CC (1 << 6) -#define LS (1 << 7) -#define EQ (1 << 8) -#define NE (1 << 9) -#define RA (1 << 10) -#define VC (1 << 11) -#define VS (1 << 12) -#define NC (1 << 13) -#define NS (1 << 14) - -static const u16 cond_table[] = { - /* V C N Z */ - /* 0 0 0 0 */ (NE | NC | CC | VC | GE | GT | HI), - /* 0 0 0 1 */ (EQ | NC | CC | VC | GE | LE | LS), - /* 0 0 1 0 */ (NE | NS | CC | VC | LT | LE | HI), - /* 0 0 1 1 */ (EQ | NS | CC | VC | LT | LE | LS), - /* 0 1 0 0 */ (NE | NC | CS | VC | GE | GT | LS), - /* 0 1 0 1 */ (EQ | NC | CS | VC | GE | LE | LS), - /* 0 1 1 0 */ (NE | NS | CS | VC | LT | LE | LS), - /* 0 1 1 1 */ (EQ | NS | CS | VC | LT | LE | LS), - /* 1 0 0 0 */ (NE | NC | CC | VS | LT | LE | HI), - /* 1 0 0 1 */ (EQ | NC | CC | VS | LT | LE | LS), - /* 1 0 1 0 */ (NE | NS | CC | VS | GE | GT | HI), - /* 1 0 1 1 */ (EQ | NS | CC | VS | GE | LE | LS), - /* 1 1 0 0 */ (NE | NC | CS | VS | LT | LE | LS), - /* 1 1 0 1 */ (EQ | NC | CS | VS | LT | LE | LS), - /* 1 1 1 0 */ (NE | NS | CS | VS | GE | GT | LS), - /* 1 1 1 1 */ (EQ | NS | CS | VS | GE | LE | LS), -}; - -/* - * Calculate what the PC will be after executing next instruction - */ -static unsigned find_nextpc(struct pt_regs *regs, int *flags) -{ - unsigned size; - s8 x8; - s16 x16; - s32 x32; - u8 opc, *pc, *sp, *next; - - next = 0; - *flags = SINGLESTEP_PCREL; - - pc = (u8 *) regs->pc; - sp = (u8 *) (regs + 1); - opc = *pc; - - size = mn10300_insn_sizes[opc]; - if (size > 0) { - next = pc + size; - } else { - switch (opc) { - /* Bxx (d8,PC) */ - case 0xc0 ... 0xca: - x8 = 2; - if (cond_table[regs->epsw & 0xf] & (1 << (opc & 0xf))) - x8 = (s8)pc[1]; - next = pc + x8; - *flags |= SINGLESTEP_BRANCH; - break; - - /* JMP (d16,PC) or CALL (d16,PC) */ - case 0xcc: - case 0xcd: - READ_WORD16(pc + 1, &x16); - next = pc + x16; - *flags |= SINGLESTEP_BRANCH; - break; - - /* JMP (d32,PC) or CALL (d32,PC) */ - case 0xdc: - case 0xdd: - READ_WORD32(pc + 1, &x32); - next = pc + x32; - *flags |= SINGLESTEP_BRANCH; - break; - - /* RETF */ - case 0xde: - next = (u8 *)regs->mdr; - *flags &= ~SINGLESTEP_PCREL; - *flags |= SINGLESTEP_BRANCH; - break; - - /* RET */ - case 0xdf: - sp += pc[2]; - READ_WORD32(sp, &x32); - next = (u8 *)x32; - *flags &= ~SINGLESTEP_PCREL; - *flags |= SINGLESTEP_BRANCH; - break; - - case 0xf0: - next = pc + 2; - opc = pc[1]; - if (opc >= 0xf0 && opc <= 0xf7) { - /* JMP (An) / CALLS (An) */ - switch (opc & 3) { - case 0: - next = (u8 *)regs->a0; - break; - case 1: - next = (u8 *)regs->a1; - break; - case 2: - next = (u8 *)regs->a2; - break; - case 3: - next = (u8 *)regs->a3; - break; - } - *flags &= ~SINGLESTEP_PCREL; - *flags |= SINGLESTEP_BRANCH; - } else if (opc == 0xfc) { - /* RETS */ - READ_WORD32(sp, &x32); - next = (u8 *)x32; - *flags &= ~SINGLESTEP_PCREL; - *flags |= SINGLESTEP_BRANCH; - } else if (opc == 0xfd) { - /* RTI */ - READ_WORD32(sp + 4, &x32); - next = (u8 *)x32; - *flags &= ~SINGLESTEP_PCREL; - *flags |= SINGLESTEP_BRANCH; - } - break; - - /* potential 3-byte conditional branches */ - case 0xf8: - next = pc + 3; - opc = pc[1]; - if (opc >= 0xe8 && opc <= 0xeb && - (cond_table[regs->epsw & 0xf] & - (1 << ((opc & 0xf) + 3))) - ) { - READ_BYTE(pc+2, &x8); - next = pc + x8; - *flags |= SINGLESTEP_BRANCH; - } - break; - - case 0xfa: - if (pc[1] == 0xff) { - /* CALLS (d16,PC) */ - READ_WORD16(pc + 2, &x16); - next = pc + x16; - } else - next = pc + 4; - *flags |= SINGLESTEP_BRANCH; - break; - - case 0xfc: - x32 = 6; - if (pc[1] == 0xff) { - /* CALLS (d32,PC) */ - READ_WORD32(pc + 2, &x32); - } - next = pc + x32; - *flags |= SINGLESTEP_BRANCH; - break; - /* LXX (d8,PC) */ - /* SETLB - loads the next four bytes into the LIR reg */ - case 0xd0 ... 0xda: - case 0xdb: - panic("Can't singlestep Lxx/SETLB\n"); - break; - } - } - return (unsigned)next; - -} - -/* - * set up out of place singlestep of some branching instructions - */ -static unsigned __kprobes singlestep_branch_setup(struct pt_regs *regs) -{ - u8 opc, *pc, *sp, *next; - - next = NULL; - pc = (u8 *) regs->pc; - sp = (u8 *) (regs + 1); - - switch (pc[0]) { - case 0xc0 ... 0xca: /* Bxx (d8,PC) */ - case 0xcc: /* JMP (d16,PC) */ - case 0xdc: /* JMP (d32,PC) */ - case 0xf8: /* Bxx (d8,PC) 3-byte version */ - /* don't really need to do anything except cause trap */ - next = pc; - break; - - case 0xcd: /* CALL (d16,PC) */ - pc[1] = 5; - pc[2] = 0; - next = pc + 5; - break; - - case 0xdd: /* CALL (d32,PC) */ - pc[1] = 7; - pc[2] = 0; - pc[3] = 0; - pc[4] = 0; - next = pc + 7; - break; - - case 0xde: /* RETF */ - next = pc + 3; - regs->mdr = (unsigned) next; - break; - - case 0xdf: /* RET */ - sp += pc[2]; - next = pc + 3; - *(unsigned *)sp = (unsigned) next; - break; - - case 0xf0: - next = pc + 2; - opc = pc[1]; - if (opc >= 0xf0 && opc <= 0xf3) { - /* CALLS (An) */ - /* use CALLS (d16,PC) to avoid mucking with An */ - pc[0] = 0xfa; - pc[1] = 0xff; - pc[2] = 4; - pc[3] = 0; - next = pc + 4; - } else if (opc >= 0xf4 && opc <= 0xf7) { - /* JMP (An) */ - next = pc; - } else if (opc == 0xfc) { - /* RETS */ - next = pc + 2; - *(unsigned *) sp = (unsigned) next; - } else if (opc == 0xfd) { - /* RTI */ - next = pc + 2; - *(unsigned *)(sp + 4) = (unsigned) next; - } - break; - - case 0xfa: /* CALLS (d16,PC) */ - pc[2] = 4; - pc[3] = 0; - next = pc + 4; - break; - - case 0xfc: /* CALLS (d32,PC) */ - pc[2] = 6; - pc[3] = 0; - pc[4] = 0; - pc[5] = 0; - next = pc + 6; - break; - - case 0xd0 ... 0xda: /* LXX (d8,PC) */ - case 0xdb: /* SETLB */ - panic("Can't singlestep Lxx/SETLB\n"); - } - - return (unsigned) next; -} - -int __kprobes arch_prepare_kprobe(struct kprobe *p) -{ - return 0; -} - -void __kprobes arch_copy_kprobe(struct kprobe *p) -{ - memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE); -} - -void __kprobes arch_arm_kprobe(struct kprobe *p) -{ - *p->addr = BREAKPOINT_INSTRUCTION; - flush_icache_range((unsigned long) p->addr, - (unsigned long) p->addr + sizeof(kprobe_opcode_t)); -} - -void __kprobes arch_disarm_kprobe(struct kprobe *p) -{ -#ifndef CONFIG_MN10300_CACHE_SNOOP - mn10300_dcache_flush(); - mn10300_icache_inv(); -#endif -} - -void arch_remove_kprobe(struct kprobe *p) -{ -} - -static inline -void __kprobes disarm_kprobe(struct kprobe *p, struct pt_regs *regs) -{ - *p->addr = p->opcode; - regs->pc = (unsigned long) p->addr; -#ifndef CONFIG_MN10300_CACHE_SNOOP - mn10300_dcache_flush(); - mn10300_icache_inv(); -#endif -} - -static inline -void __kprobes prepare_singlestep(struct kprobe *p, struct pt_regs *regs) -{ - unsigned long nextpc; - - cur_kprobe_orig_pc = regs->pc; - memcpy(cur_kprobe_ss_buf, &p->ainsn.insn[0], MAX_INSN_SIZE); - regs->pc = (unsigned long) cur_kprobe_ss_buf; - - nextpc = find_nextpc(regs, &cur_kprobe_ss_flags); - if (cur_kprobe_ss_flags & SINGLESTEP_PCREL) - cur_kprobe_next_pc = cur_kprobe_orig_pc + (nextpc - regs->pc); - else - cur_kprobe_next_pc = nextpc; - - /* branching instructions need special handling */ - if (cur_kprobe_ss_flags & SINGLESTEP_BRANCH) - nextpc = singlestep_branch_setup(regs); - - cur_kprobe_bp_addr = nextpc; - - *(u8 *) nextpc = BREAKPOINT_INSTRUCTION; - mn10300_dcache_flush_range2((unsigned) cur_kprobe_ss_buf, - sizeof(cur_kprobe_ss_buf)); - mn10300_icache_inv(); -} - -static inline int __kprobes kprobe_handler(struct pt_regs *regs) -{ - struct kprobe *p; - int ret = 0; - unsigned int *addr = (unsigned int *) regs->pc; - - /* We're in an interrupt, but this is clear and BUG()-safe. */ - preempt_disable(); - - /* Check we're not actually recursing */ - if (kprobe_running()) { - /* We *are* holding lock here, so this is safe. - Disarm the probe we just hit, and ignore it. */ - p = get_kprobe(addr); - if (p) { - disarm_kprobe(p, regs); - ret = 1; - } else { - p = cur_kprobe; - if (p->break_handler && p->break_handler(p, regs)) - goto ss_probe; - } - /* If it's not ours, can't be delete race, (we hold lock). */ - goto no_kprobe; - } - - p = get_kprobe(addr); - if (!p) { - if (*addr != BREAKPOINT_INSTRUCTION) { - /* The breakpoint instruction was removed right after - * we hit it. Another cpu has removed either a - * probepoint or a debugger breakpoint at this address. - * In either case, no further handling of this - * interrupt is appropriate. - */ - ret = 1; - } - /* Not one of ours: let kernel handle it */ - goto no_kprobe; - } - - kprobe_status = KPROBE_HIT_ACTIVE; - cur_kprobe = p; - if (p->pre_handler(p, regs)) { - /* handler has already set things up, so skip ss setup */ - return 1; - } - -ss_probe: - prepare_singlestep(p, regs); - kprobe_status = KPROBE_HIT_SS; - return 1; - -no_kprobe: - preempt_enable_no_resched(); - return ret; -} - -/* - * Called after single-stepping. p->addr is the address of the - * instruction whose first byte has been replaced by the "breakpoint" - * instruction. To avoid the SMP problems that can occur when we - * temporarily put back the original opcode to single-step, we - * single-stepped a copy of the instruction. The address of this - * copy is p->ainsn.insn. - */ -static void __kprobes resume_execution(struct kprobe *p, struct pt_regs *regs) -{ - /* we may need to fixup regs/stack after singlestepping a call insn */ - if (cur_kprobe_ss_flags & SINGLESTEP_BRANCH) { - regs->pc = cur_kprobe_orig_pc; - switch (p->ainsn.insn[0]) { - case 0xcd: /* CALL (d16,PC) */ - *(unsigned *) regs->sp = regs->mdr = regs->pc + 5; - break; - case 0xdd: /* CALL (d32,PC) */ - /* fixup mdr and return address on stack */ - *(unsigned *) regs->sp = regs->mdr = regs->pc + 7; - break; - case 0xf0: - if (p->ainsn.insn[1] >= 0xf0 && - p->ainsn.insn[1] <= 0xf3) { - /* CALLS (An) */ - /* fixup MDR and return address on stack */ - regs->mdr = regs->pc + 2; - *(unsigned *) regs->sp = regs->mdr; - } - break; - - case 0xfa: /* CALLS (d16,PC) */ - /* fixup MDR and return address on stack */ - *(unsigned *) regs->sp = regs->mdr = regs->pc + 4; - break; - - case 0xfc: /* CALLS (d32,PC) */ - /* fixup MDR and return address on stack */ - *(unsigned *) regs->sp = regs->mdr = regs->pc + 6; - break; - } - } - - regs->pc = cur_kprobe_next_pc; - cur_kprobe_bp_addr = 0; -} - -static inline int __kprobes post_kprobe_handler(struct pt_regs *regs) -{ - if (!kprobe_running()) - return 0; - - if (cur_kprobe->post_handler) - cur_kprobe->post_handler(cur_kprobe, regs, 0); - - resume_execution(cur_kprobe, regs); - reset_current_kprobe(); - preempt_enable_no_resched(); - return 1; -} - -/* Interrupts disabled, kprobe_lock held. */ -static inline -int __kprobes kprobe_fault_handler(struct pt_regs *regs, int trapnr) -{ - if (cur_kprobe->fault_handler && - cur_kprobe->fault_handler(cur_kprobe, regs, trapnr)) - return 1; - - if (kprobe_status & KPROBE_HIT_SS) { - resume_execution(cur_kprobe, regs); - reset_current_kprobe(); - preempt_enable_no_resched(); - } - return 0; -} - -/* - * Wrapper routine to for handling exceptions. - */ -int __kprobes kprobe_exceptions_notify(struct notifier_block *self, - unsigned long val, void *data) -{ - struct die_args *args = data; - - switch (val) { - case DIE_BREAKPOINT: - if (cur_kprobe_bp_addr != args->regs->pc) { - if (kprobe_handler(args->regs)) - return NOTIFY_STOP; - } else { - if (post_kprobe_handler(args->regs)) - return NOTIFY_STOP; - } - break; - case DIE_GPF: - if (kprobe_running() && - kprobe_fault_handler(args->regs, args->trapnr)) - return NOTIFY_STOP; - break; - default: - break; - } - return NOTIFY_DONE; -} - -/* Jprobes support. */ -static struct pt_regs jprobe_saved_regs; -static struct pt_regs *jprobe_saved_regs_location; -static kprobe_opcode_t jprobe_saved_stack[MAX_STACK_SIZE]; - -int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs) -{ - struct jprobe *jp = container_of(p, struct jprobe, kp); - - jprobe_saved_regs_location = regs; - memcpy(&jprobe_saved_regs, regs, sizeof(struct pt_regs)); - - /* Save a whole stack frame, this gets arguments - * pushed onto the stack after using up all the - * arg registers. - */ - memcpy(&jprobe_saved_stack, regs + 1, sizeof(jprobe_saved_stack)); - - /* setup return addr to the jprobe handler routine */ - regs->pc = (unsigned long) jp->entry; - return 1; -} - -void __kprobes jprobe_return(void) -{ - void *orig_sp = jprobe_saved_regs_location + 1; - - preempt_enable_no_resched(); - asm volatile(" mov %0,sp\n" - ".globl jprobe_return_bp_addr\n" - "jprobe_return_bp_addr:\n\t" - " .byte 0xff\n" - : : "d" (orig_sp)); -} - -extern void jprobe_return_bp_addr(void); - -int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs) -{ - u8 *addr = (u8 *) regs->pc; - - if (addr == (u8 *) jprobe_return_bp_addr) { - if (jprobe_saved_regs_location != regs) { - printk(KERN_ERR"JPROBE:" - " Current regs (%p) does not match saved regs" - " (%p).\n", - regs, jprobe_saved_regs_location); - BUG(); - } - - /* Restore old register state. - */ - memcpy(regs, &jprobe_saved_regs, sizeof(struct pt_regs)); - - memcpy(regs + 1, &jprobe_saved_stack, - sizeof(jprobe_saved_stack)); - return 1; - } - return 0; -} - -int __init arch_init_kprobes(void) -{ - return 0; -} diff --git a/arch/mn10300/kernel/mn10300-debug.c b/arch/mn10300/kernel/mn10300-debug.c deleted file mode 100644 index bd8196478cbcf..0000000000000 --- a/arch/mn10300/kernel/mn10300-debug.c +++ /dev/null @@ -1,58 +0,0 @@ -/* Debugging stuff for the MN10300-based processors - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include - -#undef MN10300_CONSOLE_ON_SERIO - -/* - * write a string directly through one of the serial ports on-board the MN10300 - */ -#ifdef MN10300_CONSOLE_ON_SERIO -void debug_to_serial_mnser(const char *p, int n) -{ - char ch; - - for (; n > 0; n--) { - ch = *p++; - -#if MN10300_CONSOLE_ON_SERIO == 0 - while (SC0STR & (SC01STR_TBF)) continue; - SC0TXB = ch; - while (SC0STR & (SC01STR_TBF)) continue; - if (ch == 0x0a) { - SC0TXB = 0x0d; - while (SC0STR & (SC01STR_TBF)) continue; - } - -#elif MN10300_CONSOLE_ON_SERIO == 1 - while (SC1STR & (SC01STR_TBF)) continue; - SC1TXB = ch; - while (SC1STR & (SC01STR_TBF)) continue; - if (ch == 0x0a) { - SC1TXB = 0x0d; - while (SC1STR & (SC01STR_TBF)) continue; - } - -#elif MN10300_CONSOLE_ON_SERIO == 2 - while (SC2STR & (SC2STR_TBF)) continue; - SC2TXB = ch; - while (SC2STR & (SC2STR_TBF)) continue; - if (ch == 0x0a) { - SC2TXB = 0x0d; - while (SC2STR & (SC2STR_TBF)) continue; - } - -#endif - } -} -#endif - diff --git a/arch/mn10300/kernel/mn10300-serial-low.S b/arch/mn10300/kernel/mn10300-serial-low.S deleted file mode 100644 index b95e76caf4fae..0000000000000 --- a/arch/mn10300/kernel/mn10300-serial-low.S +++ /dev/null @@ -1,194 +0,0 @@ -############################################################################### -# -# Virtual DMA driver for MN10300 serial ports -# -# Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. -# Written by David Howells (dhowells@redhat.com) -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public Licence -# as published by the Free Software Foundation; either version -# 2 of the Licence, or (at your option) any later version. -# -############################################################################### -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "mn10300-serial.h" - -#define SCxCTR 0x00 -#define SCxICR 0x04 -#define SCxTXB 0x08 -#define SCxRXB 0x09 -#define SCxSTR 0x0c -#define SCxTIM 0x0d - - .text - -############################################################################### -# -# serial port interrupt virtual DMA entry point -# - intended to run at interrupt priority 1 (not affected by local_irq_disable) -# -############################################################################### - .balign L1_CACHE_BYTES -ENTRY(mn10300_serial_vdma_interrupt) -# or EPSW_IE,psw # permit overriding by - # debugging interrupts - movm [d2,d3,a2,a3,exreg0],(sp) - - movhu (IAGR),a2 # see if which interrupt is - # pending - and IAGR_GN,a2 - add a2,a2 - add mn10300_serial_int_tbl,a2 - - mov (a2+),a3 - mov (__iobase,a3),e2 - mov (a2),a2 - jmp (a2) - -############################################################################### -# -# serial port receive interrupt virtual DMA entry point -# - intended to run at interrupt priority 1 (not affected by local_irq_disable) -# - stores data/status byte pairs in the ring buffer -# - induces a scheduler tick timer interrupt when done, which we then subvert -# on entry: -# A3 struct mn10300_serial_port * -# E2 I/O port base -# -############################################################################### -ENTRY(mn10300_serial_vdma_rx_handler) - mov (__rx_icr,a3),e3 - mov GxICR_DETECT,d2 - movbu d2,(e3) # ACK the interrupt - movhu (e3),d2 # flush - - mov (__rx_inp,a3),d3 - mov d3,a2 - add 2,d3 - and MNSC_BUFFER_SIZE-1,d3 - mov (__rx_outp,a3),d2 - cmp d3,d2 - beq mnsc_vdma_rx_overflow - - mov (__rx_buffer,a3),d2 - add d2,a2 - movhu (SCxSTR,e2),d2 - movbu d2,(1,a2) - movbu (SCxRXB,e2),d2 - movbu d2,(a2) - mov d3,(__rx_inp,a3) - bset MNSCx_RX_AVAIL,(__intr_flags,a3) - -mnsc_vdma_rx_done: - mov (__tm_icr,a3),a2 - mov GxICR_LEVEL_6|GxICR_ENABLE|GxICR_REQUEST|GxICR_DETECT,d2 - movhu d2,(a2) # request a slow interrupt - movhu (a2),d2 # flush - - movm (sp),[d2,d3,a2,a3,exreg0] - rti - -mnsc_vdma_rx_overflow: - bset MNSCx_RX_OVERF,(__intr_flags,a3) - bra mnsc_vdma_rx_done - -############################################################################### -# -# serial port transmit interrupt virtual DMA entry point -# - intended to run at interrupt priority 1 (not affected by local_irq_disable) -# - retrieves data bytes from the ring buffer and passes them to the serial port -# - induces a scheduler tick timer interrupt when done, which we then subvert -# A3 struct mn10300_serial_port * -# E2 I/O port base -# -############################################################################### - .balign L1_CACHE_BYTES -ENTRY(mn10300_serial_vdma_tx_handler) - mov (__tx_icr,a3),e3 - mov GxICR_DETECT,d2 - movbu d2,(e3) # ACK the interrupt - movhu (e3),d2 # flush - - btst 0xFF,(__tx_flags,a3) # handle transmit flags - bne mnsc_vdma_tx_flags - - movbu (SCxSTR,e2),d2 # don't try and transmit a char if the - # buffer is not empty - btst SC01STR_TBF,d2 # (may have tried to jumpstart) - bne mnsc_vdma_tx_noint - - movbu (__tx_xchar,a3),d2 # handle hi-pri XON/XOFF - or d2,d2 - bne mnsc_vdma_tx_xchar - - mov (__uart_state,a3),a2 # see if the TTY Tx queue has anything in it - mov (__xmit_tail,a2),d3 - mov (__xmit_head,a2),d2 - cmp d3,d2 - beq mnsc_vdma_tx_empty - - mov (__xmit_buffer,a2),d2 # get a char from the buffer and - # transmit it - movbu (d3,d2),d2 - movbu d2,(SCxTXB,e2) # Tx - - inc d3 # advance the buffer pointer - and __UART_XMIT_SIZE-1,d3 - mov (__xmit_head,a2),d2 - mov d3,(__xmit_tail,a2) - - sub d3,d2 # see if we've written everything - beq mnsc_vdma_tx_empty - - and __UART_XMIT_SIZE-1,d2 # see if we just made a hole - cmp __UART_XMIT_SIZE-2,d2 - beq mnsc_vdma_tx_made_hole - -mnsc_vdma_tx_done: - mov (__tm_icr,a3),a2 - mov GxICR_LEVEL_6|GxICR_ENABLE|GxICR_REQUEST|GxICR_DETECT,d2 - movhu d2,(a2) # request a slow interrupt - movhu (a2),d2 # flush - -mnsc_vdma_tx_noint: - movm (sp),[d2,d3,a2,a3,exreg0] - rti - -mnsc_vdma_tx_empty: - mov +(NUM2GxICR_LEVEL(CONFIG_MN10300_SERIAL_IRQ_LEVEL)|GxICR_DETECT),d2 - movhu d2,(e3) # disable the interrupt - movhu (e3),d2 # flush - - bset MNSCx_TX_EMPTY,(__intr_flags,a3) - bra mnsc_vdma_tx_done - -mnsc_vdma_tx_flags: - btst MNSCx_TX_STOP,(__tx_flags,a3) - bne mnsc_vdma_tx_stop - movhu (SCxCTR,e2),d2 # turn on break mode - or SC01CTR_BKE,d2 - movhu d2,(SCxCTR,e2) -mnsc_vdma_tx_stop: - mov +(NUM2GxICR_LEVEL(CONFIG_MN10300_SERIAL_IRQ_LEVEL)|GxICR_DETECT),d2 - movhu d2,(e3) # disable transmit interrupts on this - # channel - movhu (e3),d2 # flush - bra mnsc_vdma_tx_noint - -mnsc_vdma_tx_xchar: - bclr 0xff,(__tx_xchar,a3) - movbu d2,(SCxTXB,e2) - bra mnsc_vdma_tx_done - -mnsc_vdma_tx_made_hole: - bset MNSCx_TX_SPACE,(__intr_flags,a3) - bra mnsc_vdma_tx_done diff --git a/arch/mn10300/kernel/mn10300-serial.c b/arch/mn10300/kernel/mn10300-serial.c deleted file mode 100644 index 4994b570dfd96..0000000000000 --- a/arch/mn10300/kernel/mn10300-serial.c +++ /dev/null @@ -1,1790 +0,0 @@ -/* MN10300 On-chip serial port UART driver - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - -static const char serial_name[] = "MN10300 Serial driver"; -static const char serial_version[] = "mn10300_serial-1.0"; -static const char serial_revdate[] = "2007-11-06"; - -#if defined(CONFIG_MN10300_TTYSM_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) -#define SUPPORT_SYSRQ -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include "mn10300-serial.h" - -#ifdef CONFIG_SMP -#undef GxICR -#define GxICR(X) CROSS_GxICR(X, 0) -#endif /* CONFIG_SMP */ - -#define kenter(FMT, ...) \ - printk(KERN_DEBUG "-->%s(" FMT ")\n", __func__, ##__VA_ARGS__) -#define _enter(FMT, ...) \ - no_printk(KERN_DEBUG "-->%s(" FMT ")\n", __func__, ##__VA_ARGS__) -#define kdebug(FMT, ...) \ - printk(KERN_DEBUG "--- " FMT "\n", ##__VA_ARGS__) -#define _debug(FMT, ...) \ - no_printk(KERN_DEBUG "--- " FMT "\n", ##__VA_ARGS__) -#define kproto(FMT, ...) \ - printk(KERN_DEBUG "### MNSERIAL " FMT " ###\n", ##__VA_ARGS__) -#define _proto(FMT, ...) \ - no_printk(KERN_DEBUG "### MNSERIAL " FMT " ###\n", ##__VA_ARGS__) - -#ifndef CODMSB -/* c_cflag bit meaning */ -#define CODMSB 004000000000 /* change Transfer bit-order */ -#endif - -#define NR_UARTS 3 - -#ifdef CONFIG_MN10300_TTYSM_CONSOLE -static void mn10300_serial_console_write(struct console *co, - const char *s, unsigned count); -static int __init mn10300_serial_console_setup(struct console *co, - char *options); - -static struct uart_driver mn10300_serial_driver; -static struct console mn10300_serial_console = { - .name = "ttySM", - .write = mn10300_serial_console_write, - .device = uart_console_device, - .setup = mn10300_serial_console_setup, - .flags = CON_PRINTBUFFER, - .index = -1, - .data = &mn10300_serial_driver, -}; -#endif - -static struct uart_driver mn10300_serial_driver = { - .owner = NULL, - .driver_name = "mn10300-serial", - .dev_name = "ttySM", - .major = TTY_MAJOR, - .minor = 128, - .nr = NR_UARTS, -#ifdef CONFIG_MN10300_TTYSM_CONSOLE - .cons = &mn10300_serial_console, -#endif -}; - -static unsigned int mn10300_serial_tx_empty(struct uart_port *); -static void mn10300_serial_set_mctrl(struct uart_port *, unsigned int mctrl); -static unsigned int mn10300_serial_get_mctrl(struct uart_port *); -static void mn10300_serial_stop_tx(struct uart_port *); -static void mn10300_serial_start_tx(struct uart_port *); -static void mn10300_serial_send_xchar(struct uart_port *, char ch); -static void mn10300_serial_stop_rx(struct uart_port *); -static void mn10300_serial_enable_ms(struct uart_port *); -static void mn10300_serial_break_ctl(struct uart_port *, int ctl); -static int mn10300_serial_startup(struct uart_port *); -static void mn10300_serial_shutdown(struct uart_port *); -static void mn10300_serial_set_termios(struct uart_port *, - struct ktermios *new, - struct ktermios *old); -static const char *mn10300_serial_type(struct uart_port *); -static void mn10300_serial_release_port(struct uart_port *); -static int mn10300_serial_request_port(struct uart_port *); -static void mn10300_serial_config_port(struct uart_port *, int); -static int mn10300_serial_verify_port(struct uart_port *, - struct serial_struct *); -#ifdef CONFIG_CONSOLE_POLL -static void mn10300_serial_poll_put_char(struct uart_port *, unsigned char); -static int mn10300_serial_poll_get_char(struct uart_port *); -#endif - -static const struct uart_ops mn10300_serial_ops = { - .tx_empty = mn10300_serial_tx_empty, - .set_mctrl = mn10300_serial_set_mctrl, - .get_mctrl = mn10300_serial_get_mctrl, - .stop_tx = mn10300_serial_stop_tx, - .start_tx = mn10300_serial_start_tx, - .send_xchar = mn10300_serial_send_xchar, - .stop_rx = mn10300_serial_stop_rx, - .enable_ms = mn10300_serial_enable_ms, - .break_ctl = mn10300_serial_break_ctl, - .startup = mn10300_serial_startup, - .shutdown = mn10300_serial_shutdown, - .set_termios = mn10300_serial_set_termios, - .type = mn10300_serial_type, - .release_port = mn10300_serial_release_port, - .request_port = mn10300_serial_request_port, - .config_port = mn10300_serial_config_port, - .verify_port = mn10300_serial_verify_port, -#ifdef CONFIG_CONSOLE_POLL - .poll_put_char = mn10300_serial_poll_put_char, - .poll_get_char = mn10300_serial_poll_get_char, -#endif -}; - -static irqreturn_t mn10300_serial_interrupt(int irq, void *dev_id); - -/* - * the first on-chip serial port: ttySM0 (aka SIF0) - */ -#ifdef CONFIG_MN10300_TTYSM0 -struct mn10300_serial_port mn10300_serial_port_sif0 = { - .uart.ops = &mn10300_serial_ops, - .uart.membase = (void __iomem *) &SC0CTR, - .uart.mapbase = (unsigned long) &SC0CTR, - .uart.iotype = UPIO_MEM, - .uart.irq = 0, - .uart.uartclk = 0, /* MN10300_IOCLK, */ - .uart.fifosize = 1, - .uart.flags = UPF_BOOT_AUTOCONF, - .uart.line = 0, - .uart.type = PORT_MN10300, - .uart.lock = - __SPIN_LOCK_UNLOCKED(mn10300_serial_port_sif0.uart.lock), - .name = "ttySM0", - ._iobase = &SC0CTR, - ._control = &SC0CTR, - ._status = (volatile u8 *)&SC0STR, - ._intr = &SC0ICR, - ._rxb = &SC0RXB, - ._txb = &SC0TXB, - .rx_name = "ttySM0:Rx", - .tx_name = "ttySM0:Tx", -#if defined(CONFIG_MN10300_TTYSM0_TIMER8) - .tm_name = "ttySM0:Timer8", - ._tmxmd = &TM8MD, - ._tmxbr = &TM8BR, - ._tmicr = &TM8ICR, - .tm_irq = TM8IRQ, - .div_timer = MNSCx_DIV_TIMER_16BIT, -#elif defined(CONFIG_MN10300_TTYSM0_TIMER0) - .tm_name = "ttySM0:Timer0", - ._tmxmd = &TM0MD, - ._tmxbr = (volatile u16 *)&TM0BR, - ._tmicr = &TM0ICR, - .tm_irq = TM0IRQ, - .div_timer = MNSCx_DIV_TIMER_8BIT, -#elif defined(CONFIG_MN10300_TTYSM0_TIMER2) - .tm_name = "ttySM0:Timer2", - ._tmxmd = &TM2MD, - ._tmxbr = (volatile u16 *)&TM2BR, - ._tmicr = &TM2ICR, - .tm_irq = TM2IRQ, - .div_timer = MNSCx_DIV_TIMER_8BIT, -#else -#error "Unknown config for ttySM0" -#endif - .rx_irq = SC0RXIRQ, - .tx_irq = SC0TXIRQ, - .rx_icr = &GxICR(SC0RXIRQ), - .tx_icr = &GxICR(SC0TXIRQ), - .clock_src = MNSCx_CLOCK_SRC_IOCLK, - .options = 0, -#ifdef CONFIG_GDBSTUB_ON_TTYSM0 - .gdbstub = 1, -#endif -}; -#endif /* CONFIG_MN10300_TTYSM0 */ - -/* - * the second on-chip serial port: ttySM1 (aka SIF1) - */ -#ifdef CONFIG_MN10300_TTYSM1 -struct mn10300_serial_port mn10300_serial_port_sif1 = { - .uart.ops = &mn10300_serial_ops, - .uart.membase = (void __iomem *) &SC1CTR, - .uart.mapbase = (unsigned long) &SC1CTR, - .uart.iotype = UPIO_MEM, - .uart.irq = 0, - .uart.uartclk = 0, /* MN10300_IOCLK, */ - .uart.fifosize = 1, - .uart.flags = UPF_BOOT_AUTOCONF, - .uart.line = 1, - .uart.type = PORT_MN10300, - .uart.lock = - __SPIN_LOCK_UNLOCKED(mn10300_serial_port_sif1.uart.lock), - .name = "ttySM1", - ._iobase = &SC1CTR, - ._control = &SC1CTR, - ._status = (volatile u8 *)&SC1STR, - ._intr = &SC1ICR, - ._rxb = &SC1RXB, - ._txb = &SC1TXB, - .rx_name = "ttySM1:Rx", - .tx_name = "ttySM1:Tx", -#if defined(CONFIG_MN10300_TTYSM1_TIMER9) - .tm_name = "ttySM1:Timer9", - ._tmxmd = &TM9MD, - ._tmxbr = &TM9BR, - ._tmicr = &TM9ICR, - .tm_irq = TM9IRQ, - .div_timer = MNSCx_DIV_TIMER_16BIT, -#elif defined(CONFIG_MN10300_TTYSM1_TIMER3) - .tm_name = "ttySM1:Timer3", - ._tmxmd = &TM3MD, - ._tmxbr = (volatile u16 *)&TM3BR, - ._tmicr = &TM3ICR, - .tm_irq = TM3IRQ, - .div_timer = MNSCx_DIV_TIMER_8BIT, -#elif defined(CONFIG_MN10300_TTYSM1_TIMER12) - .tm_name = "ttySM1/Timer12", - ._tmxmd = &TM12MD, - ._tmxbr = &TM12BR, - ._tmicr = &TM12ICR, - .tm_irq = TM12IRQ, - .div_timer = MNSCx_DIV_TIMER_16BIT, -#else -#error "Unknown config for ttySM1" -#endif - .rx_irq = SC1RXIRQ, - .tx_irq = SC1TXIRQ, - .rx_icr = &GxICR(SC1RXIRQ), - .tx_icr = &GxICR(SC1TXIRQ), - .clock_src = MNSCx_CLOCK_SRC_IOCLK, - .options = 0, -#ifdef CONFIG_GDBSTUB_ON_TTYSM1 - .gdbstub = 1, -#endif -}; -#endif /* CONFIG_MN10300_TTYSM1 */ - -/* - * the third on-chip serial port: ttySM2 (aka SIF2) - */ -#ifdef CONFIG_MN10300_TTYSM2 -struct mn10300_serial_port mn10300_serial_port_sif2 = { - .uart.ops = &mn10300_serial_ops, - .uart.membase = (void __iomem *) &SC2CTR, - .uart.mapbase = (unsigned long) &SC2CTR, - .uart.iotype = UPIO_MEM, - .uart.irq = 0, - .uart.uartclk = 0, /* MN10300_IOCLK, */ - .uart.fifosize = 1, - .uart.flags = UPF_BOOT_AUTOCONF, - .uart.line = 2, -#ifdef CONFIG_MN10300_TTYSM2_CTS - .uart.type = PORT_MN10300_CTS, -#else - .uart.type = PORT_MN10300, -#endif - .uart.lock = - __SPIN_LOCK_UNLOCKED(mn10300_serial_port_sif2.uart.lock), - .name = "ttySM2", - ._iobase = &SC2CTR, - ._control = &SC2CTR, - ._status = (volatile u8 *)&SC2STR, - ._intr = &SC2ICR, - ._rxb = &SC2RXB, - ._txb = &SC2TXB, - .rx_name = "ttySM2:Rx", - .tx_name = "ttySM2:Tx", -#if defined(CONFIG_MN10300_TTYSM2_TIMER10) - .tm_name = "ttySM2/Timer10", - ._tmxmd = &TM10MD, - ._tmxbr = &TM10BR, - ._tmicr = &TM10ICR, - .tm_irq = TM10IRQ, - .div_timer = MNSCx_DIV_TIMER_16BIT, -#elif defined(CONFIG_MN10300_TTYSM2_TIMER9) - .tm_name = "ttySM2/Timer9", - ._tmxmd = &TM9MD, - ._tmxbr = &TM9BR, - ._tmicr = &TM9ICR, - .tm_irq = TM9IRQ, - .div_timer = MNSCx_DIV_TIMER_16BIT, -#elif defined(CONFIG_MN10300_TTYSM2_TIMER1) - .tm_name = "ttySM2/Timer1", - ._tmxmd = &TM1MD, - ._tmxbr = (volatile u16 *)&TM1BR, - ._tmicr = &TM1ICR, - .tm_irq = TM1IRQ, - .div_timer = MNSCx_DIV_TIMER_8BIT, -#elif defined(CONFIG_MN10300_TTYSM2_TIMER3) - .tm_name = "ttySM2/Timer3", - ._tmxmd = &TM3MD, - ._tmxbr = (volatile u16 *)&TM3BR, - ._tmicr = &TM3ICR, - .tm_irq = TM3IRQ, - .div_timer = MNSCx_DIV_TIMER_8BIT, -#else -#error "Unknown config for ttySM2" -#endif - .rx_irq = SC2RXIRQ, - .tx_irq = SC2TXIRQ, - .rx_icr = &GxICR(SC2RXIRQ), - .tx_icr = &GxICR(SC2TXIRQ), - .clock_src = MNSCx_CLOCK_SRC_IOCLK, -#ifdef CONFIG_MN10300_TTYSM2_CTS - .options = MNSCx_OPT_CTS, -#else - .options = 0, -#endif -#ifdef CONFIG_GDBSTUB_ON_TTYSM2 - .gdbstub = 1, -#endif -}; -#endif /* CONFIG_MN10300_TTYSM2 */ - - -/* - * list of available serial ports - */ -struct mn10300_serial_port *mn10300_serial_ports[NR_UARTS + 1] = { -#ifdef CONFIG_MN10300_TTYSM0 - [0] = &mn10300_serial_port_sif0, -#endif -#ifdef CONFIG_MN10300_TTYSM1 - [1] = &mn10300_serial_port_sif1, -#endif -#ifdef CONFIG_MN10300_TTYSM2 - [2] = &mn10300_serial_port_sif2, -#endif - [NR_UARTS] = NULL, -}; - - -/* - * we abuse the serial ports' baud timers' interrupt lines to get the ability - * to deliver interrupts to userspace as we use the ports' interrupt lines to - * do virtual DMA on account of the ports having no hardware FIFOs - * - * we can generate an interrupt manually in the assembly stubs by writing to - * the enable and detect bits in the interrupt control register, so all we need - * to do here is disable the interrupt line - * - * note that we can't just leave the line enabled as the baud rate timer *also* - * generates interrupts - */ -static void mn10300_serial_mask_ack(unsigned int irq) -{ - unsigned long flags; - u16 tmp; - - flags = arch_local_cli_save(); - GxICR(irq) = GxICR_LEVEL_6; - tmp = GxICR(irq); /* flush write buffer */ - arch_local_irq_restore(flags); -} - -static void mn10300_serial_chip_mask_ack(struct irq_data *d) -{ - mn10300_serial_mask_ack(d->irq); -} - -static void mn10300_serial_nop(struct irq_data *d) -{ -} - -static struct irq_chip mn10300_serial_pic = { - .name = "mnserial", - .irq_ack = mn10300_serial_chip_mask_ack, - .irq_mask = mn10300_serial_chip_mask_ack, - .irq_mask_ack = mn10300_serial_chip_mask_ack, - .irq_unmask = mn10300_serial_nop, -}; - -static void mn10300_serial_low_mask(struct irq_data *d) -{ - unsigned long flags; - u16 tmp; - - flags = arch_local_cli_save(); - GxICR(d->irq) = NUM2GxICR_LEVEL(CONFIG_MN10300_SERIAL_IRQ_LEVEL); - tmp = GxICR(d->irq); /* flush write buffer */ - arch_local_irq_restore(flags); -} - -static void mn10300_serial_low_unmask(struct irq_data *d) -{ - unsigned long flags; - u16 tmp; - - flags = arch_local_cli_save(); - GxICR(d->irq) = - NUM2GxICR_LEVEL(CONFIG_MN10300_SERIAL_IRQ_LEVEL) | GxICR_ENABLE; - tmp = GxICR(d->irq); /* flush write buffer */ - arch_local_irq_restore(flags); -} - -static struct irq_chip mn10300_serial_low_pic = { - .name = "mnserial-low", - .irq_mask = mn10300_serial_low_mask, - .irq_unmask = mn10300_serial_low_unmask, -}; - -/* - * serial virtual DMA interrupt jump table - */ -struct mn10300_serial_int mn10300_serial_int_tbl[NR_IRQS]; - -static void mn10300_serial_dis_tx_intr(struct mn10300_serial_port *port) -{ - int retries = 100; - u16 x; - - /* nothing to do if irq isn't set up */ - if (!mn10300_serial_int_tbl[port->tx_irq].port) - return; - - port->tx_flags |= MNSCx_TX_STOP; - mb(); - - /* - * Here we wait for the irq to be disabled. Either it already is - * disabled or we wait some number of retries for the VDMA handler - * to disable it. The retries give the VDMA handler enough time to - * run to completion if it was already in progress. If the VDMA IRQ - * is enabled but the handler is not yet running when arrive here, - * the STOP flag will prevent the handler from conflicting with the - * driver code following this loop. - */ - while ((*port->tx_icr & GxICR_ENABLE) && retries-- > 0) - ; - if (retries <= 0) { - *port->tx_icr = - NUM2GxICR_LEVEL(CONFIG_MN10300_SERIAL_IRQ_LEVEL); - x = *port->tx_icr; - } -} - -static void mn10300_serial_en_tx_intr(struct mn10300_serial_port *port) -{ - u16 x; - - /* nothing to do if irq isn't set up */ - if (!mn10300_serial_int_tbl[port->tx_irq].port) - return; - - /* stop vdma irq if not already stopped */ - if (!(port->tx_flags & MNSCx_TX_STOP)) - mn10300_serial_dis_tx_intr(port); - - port->tx_flags &= ~MNSCx_TX_STOP; - mb(); - - *port->tx_icr = - NUM2GxICR_LEVEL(CONFIG_MN10300_SERIAL_IRQ_LEVEL) | - GxICR_ENABLE | GxICR_REQUEST | GxICR_DETECT; - x = *port->tx_icr; -} - -static void mn10300_serial_dis_rx_intr(struct mn10300_serial_port *port) -{ - unsigned long flags; - u16 x; - - flags = arch_local_cli_save(); - *port->rx_icr = NUM2GxICR_LEVEL(CONFIG_MN10300_SERIAL_IRQ_LEVEL); - x = *port->rx_icr; - arch_local_irq_restore(flags); -} - -/* - * multi-bit equivalent of test_and_clear_bit() - */ -static int mask_test_and_clear(volatile u8 *ptr, u8 mask) -{ - u32 epsw; - asm volatile(" bclr %1,(%2) \n" - " mov epsw,%0 \n" - : "=d"(epsw) : "d"(mask), "a"(ptr) - : "cc", "memory"); - return !(epsw & EPSW_FLAG_Z); -} - -/* - * receive chars from the ring buffer for this serial port - * - must do break detection here (not done in the UART) - */ -static void mn10300_serial_receive_interrupt(struct mn10300_serial_port *port) -{ - struct uart_icount *icount = &port->uart.icount; - struct tty_port *tport = &port->uart.state->port; - unsigned ix; - int count; - u8 st, ch, push, status, overrun; - - _enter("%s", port->name); - - push = 0; - - count = CIRC_CNT(port->rx_inp, port->rx_outp, MNSC_BUFFER_SIZE); - count = tty_buffer_request_room(tport, count); - if (count == 0) { - if (!tport->low_latency) - tty_flip_buffer_push(tport); - return; - } - -try_again: - /* pull chars out of the hat */ - ix = READ_ONCE(port->rx_outp); - if (CIRC_CNT(port->rx_inp, ix, MNSC_BUFFER_SIZE) == 0) { - if (push && !tport->low_latency) - tty_flip_buffer_push(tport); - return; - } - - /* READ_ONCE() enforces dependency, but dangerous through integer!!! */ - ch = port->rx_buffer[ix++]; - st = port->rx_buffer[ix++]; - smp_mb(); - port->rx_outp = ix & (MNSC_BUFFER_SIZE - 1); - port->uart.icount.rx++; - - st &= SC01STR_FEF | SC01STR_PEF | SC01STR_OEF; - status = 0; - overrun = 0; - - /* the UART doesn't detect BREAK, so we have to do that ourselves - * - it starts as a framing error on a NUL character - * - then we count another two NUL characters before issuing TTY_BREAK - * - then we end on a normal char or one that has all the bottom bits - * zero and the top bits set - */ - switch (port->rx_brk) { - case 0: - /* not breaking at the moment */ - break; - - case 1: - if (st & SC01STR_FEF && ch == 0) { - port->rx_brk = 2; - goto try_again; - } - goto not_break; - - case 2: - if (st & SC01STR_FEF && ch == 0) { - port->rx_brk = 3; - _proto("Rx Break Detected"); - icount->brk++; - if (uart_handle_break(&port->uart)) - goto ignore_char; - status |= 1 << TTY_BREAK; - goto insert; - } - goto not_break; - - default: - if (st & (SC01STR_FEF | SC01STR_PEF | SC01STR_OEF)) - goto try_again; /* still breaking */ - - port->rx_brk = 0; /* end of the break */ - - switch (ch) { - case 0xFF: - case 0xFE: - case 0xFC: - case 0xF8: - case 0xF0: - case 0xE0: - case 0xC0: - case 0x80: - case 0x00: - /* discard char at probable break end */ - goto try_again; - } - break; - } - -process_errors: - /* handle framing error */ - if (st & SC01STR_FEF) { - if (ch == 0) { - /* framing error with NUL char is probably a BREAK */ - port->rx_brk = 1; - goto try_again; - } - - _proto("Rx Framing Error"); - icount->frame++; - status |= 1 << TTY_FRAME; - } - - /* handle parity error */ - if (st & SC01STR_PEF) { - _proto("Rx Parity Error"); - icount->parity++; - status = TTY_PARITY; - } - - /* handle normal char */ - if (status == 0) { - if (uart_handle_sysrq_char(&port->uart, ch)) - goto ignore_char; - status = (1 << TTY_NORMAL); - } - - /* handle overrun error */ - if (st & SC01STR_OEF) { - if (port->rx_brk) - goto try_again; - - _proto("Rx Overrun Error"); - icount->overrun++; - overrun = 1; - } - -insert: - status &= port->uart.read_status_mask; - - if (!overrun && !(status & port->uart.ignore_status_mask)) { - int flag; - - if (status & (1 << TTY_BREAK)) - flag = TTY_BREAK; - else if (status & (1 << TTY_PARITY)) - flag = TTY_PARITY; - else if (status & (1 << TTY_FRAME)) - flag = TTY_FRAME; - else - flag = TTY_NORMAL; - - tty_insert_flip_char(tport, ch, flag); - } - - /* overrun is special, since it's reported immediately, and doesn't - * affect the current character - */ - if (overrun) - tty_insert_flip_char(tport, 0, TTY_OVERRUN); - - count--; - if (count <= 0) { - if (!tport->low_latency) - tty_flip_buffer_push(tport); - return; - } - -ignore_char: - push = 1; - goto try_again; - -not_break: - port->rx_brk = 0; - goto process_errors; -} - -/* - * handle an interrupt from the serial transmission "virtual DMA" driver - * - note: the interrupt routine will disable its own interrupts when the Tx - * buffer is empty - */ -static void mn10300_serial_transmit_interrupt(struct mn10300_serial_port *port) -{ - _enter("%s", port->name); - - if (!port->uart.state || !port->uart.state->port.tty) { - mn10300_serial_dis_tx_intr(port); - return; - } - - if (uart_tx_stopped(&port->uart) || - uart_circ_empty(&port->uart.state->xmit)) - mn10300_serial_dis_tx_intr(port); - - if (uart_circ_chars_pending(&port->uart.state->xmit) < WAKEUP_CHARS) - uart_write_wakeup(&port->uart); -} - -/* - * deal with a change in the status of the CTS line - */ -static void mn10300_serial_cts_changed(struct mn10300_serial_port *port, u8 st) -{ - u16 ctr; - - port->tx_cts = st; - port->uart.icount.cts++; - - /* flip the CTS state selector flag to interrupt when it changes - * back */ - ctr = *port->_control; - ctr ^= SC2CTR_TWS; - *port->_control = ctr; - - uart_handle_cts_change(&port->uart, st & SC2STR_CTS); - wake_up_interruptible(&port->uart.state->port.delta_msr_wait); -} - -/* - * handle a virtual interrupt generated by the lower level "virtual DMA" - * routines (irq is the baud timer interrupt) - */ -static irqreturn_t mn10300_serial_interrupt(int irq, void *dev_id) -{ - struct mn10300_serial_port *port = dev_id; - u8 st; - - spin_lock(&port->uart.lock); - - if (port->intr_flags) { - _debug("INT %s: %x", port->name, port->intr_flags); - - if (mask_test_and_clear(&port->intr_flags, MNSCx_RX_AVAIL)) - mn10300_serial_receive_interrupt(port); - - if (mask_test_and_clear(&port->intr_flags, - MNSCx_TX_SPACE | MNSCx_TX_EMPTY)) - mn10300_serial_transmit_interrupt(port); - } - - /* the only modem control line amongst the whole lot is CTS on - * serial port 2 */ - if (port->type == PORT_MN10300_CTS) { - st = *port->_status; - if ((port->tx_cts ^ st) & SC2STR_CTS) - mn10300_serial_cts_changed(port, st); - } - - spin_unlock(&port->uart.lock); - - return IRQ_HANDLED; -} - -/* - * return indication of whether the hardware transmit buffer is empty - */ -static unsigned int mn10300_serial_tx_empty(struct uart_port *_port) -{ - struct mn10300_serial_port *port = - container_of(_port, struct mn10300_serial_port, uart); - - _enter("%s", port->name); - - return (*port->_status & (SC01STR_TXF | SC01STR_TBF)) ? - 0 : TIOCSER_TEMT; -} - -/* - * set the modem control lines (we don't have any) - */ -static void mn10300_serial_set_mctrl(struct uart_port *_port, - unsigned int mctrl) -{ - struct mn10300_serial_port *port __attribute__ ((unused)) = - container_of(_port, struct mn10300_serial_port, uart); - - _enter("%s,%x", port->name, mctrl); -} - -/* - * get the modem control line statuses - */ -static unsigned int mn10300_serial_get_mctrl(struct uart_port *_port) -{ - struct mn10300_serial_port *port = - container_of(_port, struct mn10300_serial_port, uart); - - _enter("%s", port->name); - - if (port->type == PORT_MN10300_CTS && !(*port->_status & SC2STR_CTS)) - return TIOCM_CAR | TIOCM_DSR; - - return TIOCM_CAR | TIOCM_CTS | TIOCM_DSR; -} - -/* - * stop transmitting characters - */ -static void mn10300_serial_stop_tx(struct uart_port *_port) -{ - struct mn10300_serial_port *port = - container_of(_port, struct mn10300_serial_port, uart); - - _enter("%s", port->name); - - /* disable the virtual DMA */ - mn10300_serial_dis_tx_intr(port); -} - -/* - * start transmitting characters - * - jump-start transmission if it has stalled - * - enable the serial Tx interrupt (used by the virtual DMA controller) - * - force an interrupt to happen if necessary - */ -static void mn10300_serial_start_tx(struct uart_port *_port) -{ - struct mn10300_serial_port *port = - container_of(_port, struct mn10300_serial_port, uart); - - _enter("%s{%lu}", - port->name, - CIRC_CNT(&port->uart.state->xmit.head, - &port->uart.state->xmit.tail, - UART_XMIT_SIZE)); - - /* kick the virtual DMA controller */ - mn10300_serial_en_tx_intr(port); - - _debug("CTR=%04hx ICR=%02hx STR=%04x TMD=%02hx TBR=%04hx ICR=%04hx", - *port->_control, *port->_intr, *port->_status, - *port->_tmxmd, - (port->div_timer == MNSCx_DIV_TIMER_8BIT) ? - *(volatile u8 *)port->_tmxbr : *port->_tmxbr, - *port->tx_icr); -} - -/* - * transmit a high-priority XON/XOFF character - */ -static void mn10300_serial_send_xchar(struct uart_port *_port, char ch) -{ - struct mn10300_serial_port *port = - container_of(_port, struct mn10300_serial_port, uart); - unsigned long flags; - - _enter("%s,%02x", port->name, ch); - - if (likely(port->gdbstub)) { - port->tx_xchar = ch; - if (ch) { - spin_lock_irqsave(&port->uart.lock, flags); - mn10300_serial_en_tx_intr(port); - spin_unlock_irqrestore(&port->uart.lock, flags); - } - } -} - -/* - * stop receiving characters - * - called whilst the port is being closed - */ -static void mn10300_serial_stop_rx(struct uart_port *_port) -{ - struct mn10300_serial_port *port = - container_of(_port, struct mn10300_serial_port, uart); - - u16 ctr; - - _enter("%s", port->name); - - ctr = *port->_control; - ctr &= ~SC01CTR_RXE; - *port->_control = ctr; - - mn10300_serial_dis_rx_intr(port); -} - -/* - * enable modem status interrupts - */ -static void mn10300_serial_enable_ms(struct uart_port *_port) -{ - struct mn10300_serial_port *port = - container_of(_port, struct mn10300_serial_port, uart); - - u16 ctr, cts; - - _enter("%s", port->name); - - if (port->type == PORT_MN10300_CTS) { - /* want to interrupt when CTS goes low if CTS is now high and - * vice versa - */ - port->tx_cts = *port->_status; - - cts = (port->tx_cts & SC2STR_CTS) ? - SC2CTR_TWE : SC2CTR_TWE | SC2CTR_TWS; - - ctr = *port->_control; - ctr &= ~SC2CTR_TWS; - ctr |= cts; - *port->_control = ctr; - - mn10300_serial_en_tx_intr(port); - } -} - -/* - * transmit or cease transmitting a break signal - */ -static void mn10300_serial_break_ctl(struct uart_port *_port, int ctl) -{ - struct mn10300_serial_port *port = - container_of(_port, struct mn10300_serial_port, uart); - unsigned long flags; - - _enter("%s,%d", port->name, ctl); - - spin_lock_irqsave(&port->uart.lock, flags); - if (ctl) { - /* tell the virtual DMA handler to assert BREAK */ - port->tx_flags |= MNSCx_TX_BREAK; - mn10300_serial_en_tx_intr(port); - } else { - port->tx_flags &= ~MNSCx_TX_BREAK; - *port->_control &= ~SC01CTR_BKE; - mn10300_serial_en_tx_intr(port); - } - spin_unlock_irqrestore(&port->uart.lock, flags); -} - -/* - * grab the interrupts and enable the port for reception - */ -static int mn10300_serial_startup(struct uart_port *_port) -{ - struct mn10300_serial_port *port = - container_of(_port, struct mn10300_serial_port, uart); - struct mn10300_serial_int *pint; - - _enter("%s{%d}", port->name, port->gdbstub); - - if (unlikely(port->gdbstub)) - return -EBUSY; - - /* allocate an Rx buffer for the virtual DMA handler */ - port->rx_buffer = kmalloc(MNSC_BUFFER_SIZE, GFP_KERNEL); - if (!port->rx_buffer) - return -ENOMEM; - - port->rx_inp = port->rx_outp = 0; - port->tx_flags = 0; - - /* finally, enable the device */ - *port->_intr = SC01ICR_TI; - *port->_control |= SC01CTR_TXE | SC01CTR_RXE; - - pint = &mn10300_serial_int_tbl[port->rx_irq]; - pint->port = port; - pint->vdma = mn10300_serial_vdma_rx_handler; - pint = &mn10300_serial_int_tbl[port->tx_irq]; - pint->port = port; - pint->vdma = mn10300_serial_vdma_tx_handler; - - irq_set_chip(port->rx_irq, &mn10300_serial_low_pic); - irq_set_chip(port->tx_irq, &mn10300_serial_low_pic); - irq_set_chip(port->tm_irq, &mn10300_serial_pic); - - if (request_irq(port->rx_irq, mn10300_serial_interrupt, - IRQF_NOBALANCING, - port->rx_name, port) < 0) - goto error; - - if (request_irq(port->tx_irq, mn10300_serial_interrupt, - IRQF_NOBALANCING, - port->tx_name, port) < 0) - goto error2; - - if (request_irq(port->tm_irq, mn10300_serial_interrupt, - IRQF_NOBALANCING, - port->tm_name, port) < 0) - goto error3; - mn10300_serial_mask_ack(port->tm_irq); - - return 0; - -error3: - free_irq(port->tx_irq, port); -error2: - free_irq(port->rx_irq, port); -error: - kfree(port->rx_buffer); - port->rx_buffer = NULL; - return -EBUSY; -} - -/* - * shutdown the port and release interrupts - */ -static void mn10300_serial_shutdown(struct uart_port *_port) -{ - unsigned long flags; - u16 x; - struct mn10300_serial_port *port = - container_of(_port, struct mn10300_serial_port, uart); - - _enter("%s", port->name); - - spin_lock_irqsave(&_port->lock, flags); - mn10300_serial_dis_tx_intr(port); - - *port->rx_icr = NUM2GxICR_LEVEL(CONFIG_MN10300_SERIAL_IRQ_LEVEL); - x = *port->rx_icr; - port->tx_flags = 0; - spin_unlock_irqrestore(&_port->lock, flags); - - /* disable the serial port and its baud rate timer */ - *port->_control &= ~(SC01CTR_TXE | SC01CTR_RXE | SC01CTR_BKE); - *port->_tmxmd = 0; - - if (port->rx_buffer) { - void *buf = port->rx_buffer; - port->rx_buffer = NULL; - kfree(buf); - } - - /* disable all intrs */ - free_irq(port->tm_irq, port); - free_irq(port->rx_irq, port); - free_irq(port->tx_irq, port); - - mn10300_serial_int_tbl[port->tx_irq].port = NULL; - mn10300_serial_int_tbl[port->rx_irq].port = NULL; -} - -/* - * this routine is called to set the UART divisor registers to match the - * specified baud rate for a serial port. - */ -static void mn10300_serial_change_speed(struct mn10300_serial_port *port, - struct ktermios *new, - struct ktermios *old) -{ - unsigned long flags; - unsigned long ioclk = port->ioclk; - unsigned cflag; - int baud, bits, xdiv, tmp; - u16 tmxbr, scxctr; - u8 tmxmd, battempt; - u8 div_timer = port->div_timer; - - _enter("%s{%lu}", port->name, ioclk); - - /* byte size and parity */ - cflag = new->c_cflag; - switch (cflag & CSIZE) { - case CS7: scxctr = SC01CTR_CLN_7BIT; bits = 9; break; - case CS8: scxctr = SC01CTR_CLN_8BIT; bits = 10; break; - default: scxctr = SC01CTR_CLN_8BIT; bits = 10; break; - } - - if (cflag & CSTOPB) { - scxctr |= SC01CTR_STB_2BIT; - bits++; - } - - if (cflag & PARENB) { - bits++; - if (cflag & PARODD) - scxctr |= SC01CTR_PB_ODD; -#ifdef CMSPAR - else if (cflag & CMSPAR) - scxctr |= SC01CTR_PB_FIXED0; -#endif - else - scxctr |= SC01CTR_PB_EVEN; - } - - /* Determine divisor based on baud rate */ - battempt = 0; - - switch (port->uart.line) { -#ifdef CONFIG_MN10300_TTYSM0 - case 0: /* ttySM0 */ -#if defined(CONFIG_MN10300_TTYSM0_TIMER8) - scxctr |= SC0CTR_CK_TM8UFLOW_8; -#elif defined(CONFIG_MN10300_TTYSM0_TIMER0) - scxctr |= SC0CTR_CK_TM0UFLOW_8; -#elif defined(CONFIG_MN10300_TTYSM0_TIMER2) - scxctr |= SC0CTR_CK_TM2UFLOW_8; -#else -#error "Unknown config for ttySM0" -#endif - break; -#endif /* CONFIG_MN10300_TTYSM0 */ - -#ifdef CONFIG_MN10300_TTYSM1 - case 1: /* ttySM1 */ -#if defined(CONFIG_AM33_2) || defined(CONFIG_AM33_3) -#if defined(CONFIG_MN10300_TTYSM1_TIMER9) - scxctr |= SC1CTR_CK_TM9UFLOW_8; -#elif defined(CONFIG_MN10300_TTYSM1_TIMER3) - scxctr |= SC1CTR_CK_TM3UFLOW_8; -#else -#error "Unknown config for ttySM1" -#endif -#else /* CONFIG_AM33_2 || CONFIG_AM33_3 */ -#if defined(CONFIG_MN10300_TTYSM1_TIMER12) - scxctr |= SC1CTR_CK_TM12UFLOW_8; -#else -#error "Unknown config for ttySM1" -#endif -#endif /* CONFIG_AM33_2 || CONFIG_AM33_3 */ - break; -#endif /* CONFIG_MN10300_TTYSM1 */ - -#ifdef CONFIG_MN10300_TTYSM2 - case 2: /* ttySM2 */ -#if defined(CONFIG_AM33_2) -#if defined(CONFIG_MN10300_TTYSM2_TIMER10) - scxctr |= SC2CTR_CK_TM10UFLOW; -#else -#error "Unknown config for ttySM2" -#endif -#else /* CONFIG_AM33_2 */ -#if defined(CONFIG_MN10300_TTYSM2_TIMER9) - scxctr |= SC2CTR_CK_TM9UFLOW_8; -#elif defined(CONFIG_MN10300_TTYSM2_TIMER1) - scxctr |= SC2CTR_CK_TM1UFLOW_8; -#elif defined(CONFIG_MN10300_TTYSM2_TIMER3) - scxctr |= SC2CTR_CK_TM3UFLOW_8; -#else -#error "Unknown config for ttySM2" -#endif -#endif /* CONFIG_AM33_2 */ - break; -#endif /* CONFIG_MN10300_TTYSM2 */ - - default: - break; - } - -try_alternative: - baud = uart_get_baud_rate(&port->uart, new, old, 0, - port->ioclk / 8); - - _debug("ALT %d [baud %d]", battempt, baud); - - if (!baud) - baud = 9600; /* B0 transition handled in rs_set_termios */ - xdiv = 1; - if (baud == 134) { - baud = 269; /* 134 is really 134.5 */ - xdiv = 2; - } - - if (baud == 38400 && - (port->uart.flags & UPF_SPD_MASK) == UPF_SPD_CUST - ) { - _debug("CUSTOM %u", port->uart.custom_divisor); - - if (div_timer == MNSCx_DIV_TIMER_16BIT) { - if (port->uart.custom_divisor <= 65535) { - tmxmd = TM8MD_SRC_IOCLK; - tmxbr = port->uart.custom_divisor; - port->uart.uartclk = ioclk; - goto timer_okay; - } - if (port->uart.custom_divisor / 8 <= 65535) { - tmxmd = TM8MD_SRC_IOCLK_8; - tmxbr = port->uart.custom_divisor / 8; - port->uart.custom_divisor = tmxbr * 8; - port->uart.uartclk = ioclk / 8; - goto timer_okay; - } - if (port->uart.custom_divisor / 32 <= 65535) { - tmxmd = TM8MD_SRC_IOCLK_32; - tmxbr = port->uart.custom_divisor / 32; - port->uart.custom_divisor = tmxbr * 32; - port->uart.uartclk = ioclk / 32; - goto timer_okay; - } - - } else if (div_timer == MNSCx_DIV_TIMER_8BIT) { - if (port->uart.custom_divisor <= 255) { - tmxmd = TM2MD_SRC_IOCLK; - tmxbr = port->uart.custom_divisor; - port->uart.uartclk = ioclk; - goto timer_okay; - } - if (port->uart.custom_divisor / 8 <= 255) { - tmxmd = TM2MD_SRC_IOCLK_8; - tmxbr = port->uart.custom_divisor / 8; - port->uart.custom_divisor = tmxbr * 8; - port->uart.uartclk = ioclk / 8; - goto timer_okay; - } - if (port->uart.custom_divisor / 32 <= 255) { - tmxmd = TM2MD_SRC_IOCLK_32; - tmxbr = port->uart.custom_divisor / 32; - port->uart.custom_divisor = tmxbr * 32; - port->uart.uartclk = ioclk / 32; - goto timer_okay; - } - } - } - - switch (div_timer) { - case MNSCx_DIV_TIMER_16BIT: - port->uart.uartclk = ioclk; - tmxmd = TM8MD_SRC_IOCLK; - tmxbr = tmp = (ioclk / (baud * xdiv) + 4) / 8 - 1; - if (tmp > 0 && tmp <= 65535) - goto timer_okay; - - port->uart.uartclk = ioclk / 8; - tmxmd = TM8MD_SRC_IOCLK_8; - tmxbr = tmp = (ioclk / (baud * 8 * xdiv) + 4) / 8 - 1; - if (tmp > 0 && tmp <= 65535) - goto timer_okay; - - port->uart.uartclk = ioclk / 32; - tmxmd = TM8MD_SRC_IOCLK_32; - tmxbr = tmp = (ioclk / (baud * 32 * xdiv) + 4) / 8 - 1; - if (tmp > 0 && tmp <= 65535) - goto timer_okay; - break; - - case MNSCx_DIV_TIMER_8BIT: - port->uart.uartclk = ioclk; - tmxmd = TM2MD_SRC_IOCLK; - tmxbr = tmp = (ioclk / (baud * xdiv) + 4) / 8 - 1; - if (tmp > 0 && tmp <= 255) - goto timer_okay; - - port->uart.uartclk = ioclk / 8; - tmxmd = TM2MD_SRC_IOCLK_8; - tmxbr = tmp = (ioclk / (baud * 8 * xdiv) + 4) / 8 - 1; - if (tmp > 0 && tmp <= 255) - goto timer_okay; - - port->uart.uartclk = ioclk / 32; - tmxmd = TM2MD_SRC_IOCLK_32; - tmxbr = tmp = (ioclk / (baud * 32 * xdiv) + 4) / 8 - 1; - if (tmp > 0 && tmp <= 255) - goto timer_okay; - break; - - default: - BUG(); - return; - } - - /* refuse to change to a baud rate we can't support */ - _debug("CAN'T SUPPORT"); - - switch (battempt) { - case 0: - if (old) { - new->c_cflag &= ~CBAUD; - new->c_cflag |= (old->c_cflag & CBAUD); - battempt = 1; - goto try_alternative; - } - - case 1: - /* as a last resort, if the quotient is zero, default to 9600 - * bps */ - new->c_cflag &= ~CBAUD; - new->c_cflag |= B9600; - battempt = 2; - goto try_alternative; - - default: - /* hmmm... can't seem to support 9600 either - * - we could try iterating through the speeds we know about to - * find the lowest - */ - new->c_cflag &= ~CBAUD; - new->c_cflag |= B0; - - if (div_timer == MNSCx_DIV_TIMER_16BIT) - tmxmd = TM8MD_SRC_IOCLK_32; - else if (div_timer == MNSCx_DIV_TIMER_8BIT) - tmxmd = TM2MD_SRC_IOCLK_32; - tmxbr = 1; - - port->uart.uartclk = ioclk / 32; - break; - } -timer_okay: - - _debug("UARTCLK: %u / %hu", port->uart.uartclk, tmxbr); - - /* make the changes */ - spin_lock_irqsave(&port->uart.lock, flags); - - uart_update_timeout(&port->uart, new->c_cflag, baud); - - /* set the timer to produce the required baud rate */ - switch (div_timer) { - case MNSCx_DIV_TIMER_16BIT: - *port->_tmxmd = 0; - *port->_tmxbr = tmxbr; - *port->_tmxmd = TM8MD_INIT_COUNTER; - *port->_tmxmd = tmxmd | TM8MD_COUNT_ENABLE; - break; - - case MNSCx_DIV_TIMER_8BIT: - *port->_tmxmd = 0; - *(volatile u8 *) port->_tmxbr = (u8) tmxbr; - *port->_tmxmd = TM2MD_INIT_COUNTER; - *port->_tmxmd = tmxmd | TM2MD_COUNT_ENABLE; - break; - } - - /* CTS flow control flag and modem status interrupts */ - scxctr &= ~(SC2CTR_TWE | SC2CTR_TWS); - - if (port->type == PORT_MN10300_CTS && cflag & CRTSCTS) { - /* want to interrupt when CTS goes low if CTS is now - * high and vice versa - */ - port->tx_cts = *port->_status; - - if (port->tx_cts & SC2STR_CTS) - scxctr |= SC2CTR_TWE; - else - scxctr |= SC2CTR_TWE | SC2CTR_TWS; - } - - /* set up parity check flag */ - port->uart.read_status_mask = (1 << TTY_NORMAL) | (1 << TTY_OVERRUN); - if (new->c_iflag & INPCK) - port->uart.read_status_mask |= - (1 << TTY_PARITY) | (1 << TTY_FRAME); - if (new->c_iflag & (BRKINT | PARMRK)) - port->uart.read_status_mask |= (1 << TTY_BREAK); - - /* characters to ignore */ - port->uart.ignore_status_mask = 0; - if (new->c_iflag & IGNPAR) - port->uart.ignore_status_mask |= - (1 << TTY_PARITY) | (1 << TTY_FRAME); - if (new->c_iflag & IGNBRK) { - port->uart.ignore_status_mask |= (1 << TTY_BREAK); - /* - * If we're ignoring parity and break indicators, - * ignore overruns to (for real raw support). - */ - if (new->c_iflag & IGNPAR) - port->uart.ignore_status_mask |= (1 << TTY_OVERRUN); - } - - /* Ignore all characters if CREAD is not set */ - if ((new->c_cflag & CREAD) == 0) - port->uart.ignore_status_mask |= (1 << TTY_NORMAL); - - scxctr |= SC01CTR_TXE | SC01CTR_RXE; - scxctr |= *port->_control & SC01CTR_BKE; - *port->_control = scxctr; - - spin_unlock_irqrestore(&port->uart.lock, flags); -} - -/* - * set the terminal I/O parameters - */ -static void mn10300_serial_set_termios(struct uart_port *_port, - struct ktermios *new, - struct ktermios *old) -{ - struct mn10300_serial_port *port = - container_of(_port, struct mn10300_serial_port, uart); - - _enter("%s,%p,%p", port->name, new, old); - - mn10300_serial_change_speed(port, new, old); - - /* handle turning off CRTSCTS */ - if (!(new->c_cflag & CRTSCTS)) { - u16 ctr = *port->_control; - ctr &= ~SC2CTR_TWE; - *port->_control = ctr; - } - - /* change Transfer bit-order (LSB/MSB) */ - if (new->c_cflag & CODMSB) - *port->_control |= SC01CTR_OD_MSBFIRST; /* MSB MODE */ - else - *port->_control &= ~SC01CTR_OD_MSBFIRST; /* LSB MODE */ -} - -/* - * return description of port type - */ -static const char *mn10300_serial_type(struct uart_port *_port) -{ - struct mn10300_serial_port *port = - container_of(_port, struct mn10300_serial_port, uart); - - if (port->uart.type == PORT_MN10300_CTS) - return "MN10300 SIF_CTS"; - - return "MN10300 SIF"; -} - -/* - * release I/O and memory regions in use by port - */ -static void mn10300_serial_release_port(struct uart_port *_port) -{ - struct mn10300_serial_port *port = - container_of(_port, struct mn10300_serial_port, uart); - - _enter("%s", port->name); - - release_mem_region((unsigned long) port->_iobase, 16); -} - -/* - * request I/O and memory regions for port - */ -static int mn10300_serial_request_port(struct uart_port *_port) -{ - struct mn10300_serial_port *port = - container_of(_port, struct mn10300_serial_port, uart); - - _enter("%s", port->name); - - request_mem_region((unsigned long) port->_iobase, 16, port->name); - return 0; -} - -/* - * configure the type and reserve the ports - */ -static void mn10300_serial_config_port(struct uart_port *_port, int type) -{ - struct mn10300_serial_port *port = - container_of(_port, struct mn10300_serial_port, uart); - - _enter("%s", port->name); - - port->uart.type = PORT_MN10300; - - if (port->options & MNSCx_OPT_CTS) - port->uart.type = PORT_MN10300_CTS; - - mn10300_serial_request_port(_port); -} - -/* - * verify serial parameters are suitable for this port type - */ -static int mn10300_serial_verify_port(struct uart_port *_port, - struct serial_struct *ss) -{ - struct mn10300_serial_port *port = - container_of(_port, struct mn10300_serial_port, uart); - void *mapbase = (void *) (unsigned long) port->uart.mapbase; - - _enter("%s", port->name); - - /* these things may not be changed */ - if (ss->irq != port->uart.irq || - ss->port != port->uart.iobase || - ss->io_type != port->uart.iotype || - ss->iomem_base != mapbase || - ss->iomem_reg_shift != port->uart.regshift || - ss->hub6 != port->uart.hub6 || - ss->xmit_fifo_size != port->uart.fifosize) - return -EINVAL; - - /* type may be changed on a port that supports CTS */ - if (ss->type != port->uart.type) { - if (!(port->options & MNSCx_OPT_CTS)) - return -EINVAL; - - if (ss->type != PORT_MN10300 && - ss->type != PORT_MN10300_CTS) - return -EINVAL; - } - - return 0; -} - -/* - * initialise the MN10300 on-chip UARTs - */ -static int __init mn10300_serial_init(void) -{ - struct mn10300_serial_port *port; - int ret, i; - - printk(KERN_INFO "%s version %s (%s)\n", - serial_name, serial_version, serial_revdate); - -#if defined(CONFIG_MN10300_TTYSM2) && defined(CONFIG_AM33_2) - { - int tmp; - SC2TIM = 8; /* make the baud base of timer 2 IOCLK/8 */ - tmp = SC2TIM; - } -#endif - - set_intr_stub(NUM2EXCEP_IRQ_LEVEL(CONFIG_MN10300_SERIAL_IRQ_LEVEL), - mn10300_serial_vdma_interrupt); - - ret = uart_register_driver(&mn10300_serial_driver); - if (!ret) { - for (i = 0 ; i < NR_PORTS ; i++) { - port = mn10300_serial_ports[i]; - if (!port || port->gdbstub) - continue; - - switch (port->clock_src) { - case MNSCx_CLOCK_SRC_IOCLK: - port->ioclk = MN10300_IOCLK; - break; - -#ifdef MN10300_IOBCLK - case MNSCx_CLOCK_SRC_IOBCLK: - port->ioclk = MN10300_IOBCLK; - break; -#endif - default: - BUG(); - } - - ret = uart_add_one_port(&mn10300_serial_driver, - &port->uart); - - if (ret < 0) { - _debug("ERROR %d", -ret); - break; - } - } - - if (ret) - uart_unregister_driver(&mn10300_serial_driver); - } - - return ret; -} - -__initcall(mn10300_serial_init); - - -#ifdef CONFIG_MN10300_TTYSM_CONSOLE - -/* - * print a string to the serial port without disturbing the real user of the - * port too much - * - the console must be locked by the caller - */ -static void mn10300_serial_console_write(struct console *co, - const char *s, unsigned count) -{ - struct mn10300_serial_port *port; - unsigned i; - u16 scxctr; - u8 tmxmd; - unsigned long flags; - int locked = 1; - - port = mn10300_serial_ports[co->index]; - - local_irq_save(flags); - if (port->uart.sysrq) { - /* mn10300_serial_interrupt() already took the lock */ - locked = 0; - } else if (oops_in_progress) { - locked = spin_trylock(&port->uart.lock); - } else - spin_lock(&port->uart.lock); - - /* firstly hijack the serial port from the "virtual DMA" controller */ - mn10300_serial_dis_tx_intr(port); - - /* the transmitter may be disabled */ - scxctr = *port->_control; - if (!(scxctr & SC01CTR_TXE)) { - /* restart the UART clock */ - tmxmd = *port->_tmxmd; - - switch (port->div_timer) { - case MNSCx_DIV_TIMER_16BIT: - *port->_tmxmd = 0; - *port->_tmxmd = TM8MD_INIT_COUNTER; - *port->_tmxmd = tmxmd | TM8MD_COUNT_ENABLE; - break; - - case MNSCx_DIV_TIMER_8BIT: - *port->_tmxmd = 0; - *port->_tmxmd = TM2MD_INIT_COUNTER; - *port->_tmxmd = tmxmd | TM2MD_COUNT_ENABLE; - break; - } - - /* enable the transmitter */ - *port->_control = (scxctr & ~SC01CTR_BKE) | SC01CTR_TXE; - - } else if (scxctr & SC01CTR_BKE) { - /* stop transmitting BREAK */ - *port->_control = (scxctr & ~SC01CTR_BKE); - } - - /* send the chars into the serial port (with LF -> LFCR conversion) */ - for (i = 0; i < count; i++) { - char ch = *s++; - - while (*port->_status & SC01STR_TBF) - continue; - *port->_txb = ch; - - if (ch == 0x0a) { - while (*port->_status & SC01STR_TBF) - continue; - *port->_txb = 0xd; - } - } - - /* can't let the transmitter be turned off if it's actually - * transmitting */ - while (*port->_status & (SC01STR_TXF | SC01STR_TBF)) - continue; - - /* disable the transmitter if we re-enabled it */ - if (!(scxctr & SC01CTR_TXE)) - *port->_control = scxctr; - - mn10300_serial_en_tx_intr(port); - - if (locked) - spin_unlock(&port->uart.lock); - local_irq_restore(flags); -} - -/* - * set up a serial port as a console - * - construct a cflag setting for the first rs_open() - * - initialize the serial port - * - return non-zero if we didn't find a serial port. - */ -static int __init mn10300_serial_console_setup(struct console *co, - char *options) -{ - struct mn10300_serial_port *port; - int i, parity = 'n', baud = 9600, bits = 8, flow = 0; - - for (i = 0 ; i < NR_PORTS ; i++) { - port = mn10300_serial_ports[i]; - if (port && !port->gdbstub && port->uart.line == co->index) - goto found_device; - } - - return -ENODEV; - -found_device: - switch (port->clock_src) { - case MNSCx_CLOCK_SRC_IOCLK: - port->ioclk = MN10300_IOCLK; - break; - -#ifdef MN10300_IOBCLK - case MNSCx_CLOCK_SRC_IOBCLK: - port->ioclk = MN10300_IOBCLK; - break; -#endif - default: - BUG(); - } - - if (options) - uart_parse_options(options, &baud, &parity, &bits, &flow); - - return uart_set_options(&port->uart, co, baud, parity, bits, flow); -} - -/* - * register console - */ -static int __init mn10300_serial_console_init(void) -{ - register_console(&mn10300_serial_console); - return 0; -} - -console_initcall(mn10300_serial_console_init); -#endif - -#ifdef CONFIG_CONSOLE_POLL -/* - * Polled character reception for the kernel debugger - */ -static int mn10300_serial_poll_get_char(struct uart_port *_port) -{ - struct mn10300_serial_port *port = - container_of(_port, struct mn10300_serial_port, uart); - unsigned ix; - u8 st, ch; - - _enter("%s", port->name); - - if (mn10300_serial_int_tbl[port->rx_irq].port != NULL) { - do { - /* pull chars out of the hat */ - ix = READ_ONCE(port->rx_outp); - if (CIRC_CNT(port->rx_inp, ix, MNSC_BUFFER_SIZE) == 0) - return NO_POLL_CHAR; - - /* - * READ_ONCE() enforces dependency, but dangerous - * through integer!!! - */ - ch = port->rx_buffer[ix++]; - st = port->rx_buffer[ix++]; - smp_mb(); - port->rx_outp = ix & (MNSC_BUFFER_SIZE - 1); - - } while (st & (SC01STR_FEF | SC01STR_PEF | SC01STR_OEF)); - } else { - do { - st = *port->_status; - if (st & (SC01STR_FEF | SC01STR_PEF | SC01STR_OEF)) - continue; - } while (!(st & SC01STR_RBF)); - - ch = *port->_rxb; - } - - return ch; -} - - -/* - * Polled character transmission for the kernel debugger - */ -static void mn10300_serial_poll_put_char(struct uart_port *_port, - unsigned char ch) -{ - struct mn10300_serial_port *port = - container_of(_port, struct mn10300_serial_port, uart); - u8 intr, tmp; - - /* wait for the transmitter to finish anything it might be doing (and - * this includes the virtual DMA handler, so it might take a while) */ - while (*port->_status & (SC01STR_TBF | SC01STR_TXF)) - continue; - - /* disable the Tx ready interrupt */ - intr = *port->_intr; - *port->_intr = intr & ~SC01ICR_TI; - tmp = *port->_intr; - - if (ch == 0x0a) { - *port->_txb = 0x0d; - while (*port->_status & SC01STR_TBF) - continue; - } - - *port->_txb = ch; - while (*port->_status & SC01STR_TBF) - continue; - - /* restore the Tx interrupt flag */ - *port->_intr = intr; - tmp = *port->_intr; -} - -#endif /* CONFIG_CONSOLE_POLL */ diff --git a/arch/mn10300/kernel/mn10300-serial.h b/arch/mn10300/kernel/mn10300-serial.h deleted file mode 100644 index 01791c68ea1f1..0000000000000 --- a/arch/mn10300/kernel/mn10300-serial.h +++ /dev/null @@ -1,130 +0,0 @@ -/* MN10300 On-chip serial port driver definitions - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _MN10300_SERIAL_H -#define _MN10300_SERIAL_H - -#ifndef __ASSEMBLY__ -#include -#include -#endif - -#include -#include - -#define NR_PORTS 3 /* should be set 3 or 9 or 16 */ - -#define MNSC_BUFFER_SIZE +(PAGE_SIZE / 2) - -/* intr_flags bits */ -#define MNSCx_RX_AVAIL 0x01 -#define MNSCx_RX_OVERF 0x02 -#define MNSCx_TX_SPACE 0x04 -#define MNSCx_TX_EMPTY 0x08 - -/* tx_flags bits */ -#define MNSCx_TX_BREAK 0x01 -#define MNSCx_TX_STOP 0x02 - -#ifndef __ASSEMBLY__ - -struct mn10300_serial_port { - char *rx_buffer; /* reception buffer base */ - unsigned rx_inp; /* pointer to rx input offset */ - unsigned rx_outp; /* pointer to rx output offset */ - u8 tx_xchar; /* high-priority XON/XOFF buffer */ - u8 tx_flags; /* transmit break/stop request */ - u8 intr_flags; /* interrupt flags */ - volatile u16 *rx_icr; /* Rx interrupt control register */ - volatile u16 *tx_icr; /* Tx interrupt control register */ - int rx_irq; /* reception IRQ */ - int tx_irq; /* transmission IRQ */ - int tm_irq; /* timer IRQ */ - - const char *name; /* name of serial port */ - const char *rx_name; /* Rx interrupt handler name of serial port */ - const char *tx_name; /* Tx interrupt handler name of serial port */ - const char *tm_name; /* Timer interrupt handler name */ - unsigned short type; /* type of serial port */ - unsigned char isconsole; /* T if it's a console */ - volatile void *_iobase; /* pointer to base of I/O control regs */ - volatile u16 *_control; /* control register pointer */ - volatile u8 *_status; /* status register pointer */ - volatile u8 *_intr; /* interrupt register pointer */ - volatile u8 *_rxb; /* receive buffer register pointer */ - volatile u8 *_txb; /* transmit buffer register pointer */ - volatile u16 *_tmicr; /* timer interrupt control register */ - volatile u8 *_tmxmd; /* baud rate timer mode register */ - volatile u16 *_tmxbr; /* baud rate timer base register */ - - /* this must come down here so that assembly can use BSET to access the - * above fields */ - struct uart_port uart; - - unsigned short rx_brk; /* current break reception status */ - u16 tx_cts; /* current CTS status */ - int gdbstub; /* preemptively stolen by GDB stub */ - - u8 clock_src; /* clock source */ -#define MNSCx_CLOCK_SRC_IOCLK 0 -#define MNSCx_CLOCK_SRC_IOBCLK 1 - - u8 div_timer; /* timer used as divisor */ -#define MNSCx_DIV_TIMER_16BIT 0 -#define MNSCx_DIV_TIMER_8BIT 1 - - u16 options; /* options */ -#define MNSCx_OPT_CTS 0x0001 - - unsigned long ioclk; /* base clock rate */ -}; - -#ifdef CONFIG_MN10300_TTYSM0 -extern struct mn10300_serial_port mn10300_serial_port_sif0; -#endif - -#ifdef CONFIG_MN10300_TTYSM1 -extern struct mn10300_serial_port mn10300_serial_port_sif1; -#endif - -#ifdef CONFIG_MN10300_TTYSM2 -extern struct mn10300_serial_port mn10300_serial_port_sif2; -#endif - -extern struct mn10300_serial_port *mn10300_serial_ports[]; - -struct mn10300_serial_int { - struct mn10300_serial_port *port; - asmlinkage void (*vdma)(void); -}; - -extern struct mn10300_serial_int mn10300_serial_int_tbl[]; - -extern asmlinkage void mn10300_serial_vdma_interrupt(void); -extern asmlinkage void mn10300_serial_vdma_rx_handler(void); -extern asmlinkage void mn10300_serial_vdma_tx_handler(void); - -#endif /* __ASSEMBLY__ */ - -#if defined(CONFIG_GDBSTUB_ON_TTYSM0) -#define SCgSTR SC0STR -#define SCgRXB SC0RXB -#define SCgRXIRQ SC0RXIRQ -#elif defined(CONFIG_GDBSTUB_ON_TTYSM1) -#define SCgSTR SC1STR -#define SCgRXB SC1RXB -#define SCgRXIRQ SC1RXIRQ -#elif defined(CONFIG_GDBSTUB_ON_TTYSM2) -#define SCgSTR SC2STR -#define SCgRXB SC2RXB -#define SCgRXIRQ SC2RXIRQ -#endif - -#endif /* _MN10300_SERIAL_H */ diff --git a/arch/mn10300/kernel/mn10300-watchdog-low.S b/arch/mn10300/kernel/mn10300-watchdog-low.S deleted file mode 100644 index 34f8773de7d03..0000000000000 --- a/arch/mn10300/kernel/mn10300-watchdog-low.S +++ /dev/null @@ -1,66 +0,0 @@ -############################################################################### -# -# MN10300 Watchdog interrupt handler -# -# Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. -# Written by David Howells (dhowells@redhat.com) -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public Licence -# as published by the Free Software Foundation; either version -# 2 of the Licence, or (at your option) any later version. -# -############################################################################### -#include -#include -#include -#include -#include -#include - - .text - -############################################################################### -# -# Watchdog handler entry point -# - special non-maskable interrupt -# -############################################################################### - .globl watchdog_handler - .type watchdog_handler,@function -watchdog_handler: - add -4,sp - SAVE_ALL - - mov 0xffffffff,d0 - mov d0,(REG_ORIG_D0,fp) - - mov fp,d0 - lsr 2,d1 - call watchdog_interrupt[],0 # watchdog_interrupt(regs,irq) - - jmp ret_from_intr - - .size watchdog_handler,.-watchdog_handler - -############################################################################### -# -# Watchdog touch entry point -# - kept to absolute minimum (unfortunately, it's prototyped in linux/nmi.h so -# we can't inline it) -# -############################################################################### - .globl arch_touch_nmi_watchdog - .type arch_touch_nmi_watchdog,@function -arch_touch_nmi_watchdog: - clr d0 - clr d1 - mov watchdog_alert_counter, a0 - setlb - mov d0, (a0+) - inc d1 - cmp NR_CPUS, d1 - lne - ret [],0 - - .size arch_touch_nmi_watchdog,.-arch_touch_nmi_watchdog diff --git a/arch/mn10300/kernel/mn10300-watchdog.c b/arch/mn10300/kernel/mn10300-watchdog.c deleted file mode 100644 index 0d5641beadf5c..0000000000000 --- a/arch/mn10300/kernel/mn10300-watchdog.c +++ /dev/null @@ -1,205 +0,0 @@ -/* MN10300 Watchdog timer - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - Derived from arch/i386/kernel/nmi.c - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static DEFINE_SPINLOCK(watchdog_print_lock); -static unsigned int watchdog; -static unsigned int watchdog_hz = 1; -unsigned int watchdog_alert_counter[NR_CPUS]; - -EXPORT_SYMBOL(arch_touch_nmi_watchdog); - -/* - * the best way to detect whether a CPU has a 'hard lockup' problem - * is to check its timer makes IRQ counts. If they are not - * changing then that CPU has some problem. - * - * since NMIs dont listen to _any_ locks, we have to be extremely - * careful not to rely on unsafe variables. The printk might lock - * up though, so we have to break up any console locks first ... - * [when there will be more tty-related locks, break them up - * here too!] - */ -static unsigned int last_irq_sums[NR_CPUS]; - -int __init check_watchdog(void) -{ - irq_cpustat_t tmp[1]; - - printk(KERN_INFO "Testing Watchdog... "); - - memcpy(tmp, irq_stat, sizeof(tmp)); - local_irq_enable(); - mdelay((10 * 1000) / watchdog_hz); /* wait 10 ticks */ - local_irq_disable(); - - if (nmi_count(0) - tmp[0].__nmi_count <= 5) { - printk(KERN_WARNING "CPU#%d: Watchdog appears to be stuck!\n", - 0); - return -1; - } - - printk(KERN_INFO "OK.\n"); - - /* now that we know it works we can reduce NMI frequency to something - * more reasonable; makes a difference in some configs - */ - watchdog_hz = 1; - - return 0; -} - -static int __init setup_watchdog(char *str) -{ - unsigned tmp; - int opt; - u8 ctr; - - get_option(&str, &opt); - if (opt != 1) - return 0; - - watchdog = opt; - if (watchdog) { - set_intr_stub(EXCEP_WDT, watchdog_handler); - ctr = WDCTR_WDCK_65536th; - WDCTR = WDCTR_WDRST | ctr; - WDCTR = ctr; - tmp = WDCTR; - - tmp = __muldiv64u(1 << (16 + ctr * 2), 1000000, MN10300_WDCLK); - tmp = 1000000000 / tmp; - watchdog_hz = (tmp + 500) / 1000; - } - - return 1; -} - -__setup("watchdog=", setup_watchdog); - -void __init watchdog_go(void) -{ - u8 wdt; - - if (watchdog) { - printk(KERN_INFO "Watchdog: running at %uHz\n", watchdog_hz); - wdt = WDCTR & ~WDCTR_WDCNE; - WDCTR = wdt | WDCTR_WDRST; - wdt = WDCTR; - WDCTR = wdt | WDCTR_WDCNE; - wdt = WDCTR; - - check_watchdog(); - } -} - -#ifdef CONFIG_SMP -static void watchdog_dump_register(void *dummy) -{ - printk(KERN_ERR "--- Register Dump (CPU%d) ---\n", CPUID); - show_registers(current_frame()); -} -#endif - -asmlinkage -void watchdog_interrupt(struct pt_regs *regs, enum exception_code excep) -{ - /* - * Since current-> is always on the stack, and we always switch - * the stack NMI-atomically, it's safe to use smp_processor_id(). - */ - int sum, cpu; - int irq = NMIIRQ; - u8 wdt, tmp; - - wdt = WDCTR & ~WDCTR_WDCNE; - WDCTR = wdt; - tmp = WDCTR; - NMICR = NMICR_WDIF; - - nmi_count(smp_processor_id())++; - kstat_incr_irq_this_cpu(irq); - - for_each_online_cpu(cpu) { - - sum = irq_stat[cpu].__irq_count; - - if ((last_irq_sums[cpu] == sum) -#if defined(CONFIG_GDBSTUB) && defined(CONFIG_SMP) - && !(CHK_GDBSTUB_BUSY() - || atomic_read(&cpu_doing_single_step)) -#endif - ) { - /* - * Ayiee, looks like this CPU is stuck ... - * wait a few IRQs (5 seconds) before doing the oops ... - */ - watchdog_alert_counter[cpu]++; - if (watchdog_alert_counter[cpu] == 5 * watchdog_hz) { - spin_lock(&watchdog_print_lock); - /* - * We are in trouble anyway, lets at least try - * to get a message out. - */ - bust_spinlocks(1); - printk(KERN_ERR - "NMI Watchdog detected LOCKUP on CPU%d," - " pc %08lx, registers:\n", - cpu, regs->pc); -#ifdef CONFIG_SMP - printk(KERN_ERR - "--- Register Dump (CPU%d) ---\n", - CPUID); -#endif - show_registers(regs); -#ifdef CONFIG_SMP - smp_nmi_call_function(watchdog_dump_register, - NULL, 1); -#endif - printk(KERN_NOTICE "console shuts up ...\n"); - console_silent(); - spin_unlock(&watchdog_print_lock); - bust_spinlocks(0); -#ifdef CONFIG_GDBSTUB - if (CHK_GDBSTUB_BUSY_AND_ACTIVE()) - gdbstub_exception(regs, excep); - else - gdbstub_intercept(regs, excep); -#endif - do_exit(SIGSEGV); - } - } else { - last_irq_sums[cpu] = sum; - watchdog_alert_counter[cpu] = 0; - } - } - - WDCTR = wdt | WDCTR_WDRST; - tmp = WDCTR; - WDCTR = wdt | WDCTR_WDCNE; - tmp = WDCTR; -} diff --git a/arch/mn10300/kernel/mn10300_ksyms.c b/arch/mn10300/kernel/mn10300_ksyms.c deleted file mode 100644 index 66fb68d0ca8a8..0000000000000 --- a/arch/mn10300/kernel/mn10300_ksyms.c +++ /dev/null @@ -1,39 +0,0 @@ -/* MN10300 Miscellaneous and library kernel exports - * - * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd. - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include -#include - - -EXPORT_SYMBOL(empty_zero_page); - -EXPORT_SYMBOL(change_bit); -EXPORT_SYMBOL(test_and_change_bit); - -EXPORT_SYMBOL(memcpy); -EXPORT_SYMBOL(memmove); -EXPORT_SYMBOL(memset); - -EXPORT_SYMBOL(strncpy_from_user); -EXPORT_SYMBOL(clear_user); -EXPORT_SYMBOL(__clear_user); -EXPORT_SYMBOL(strnlen_user); - -extern u64 __ashrdi3(u64, unsigned); -extern u64 __ashldi3(u64, unsigned); -extern u64 __lshrdi3(u64, unsigned); -extern s64 __negdi2(s64); -extern int __ucmpdi2(u64, u64); -EXPORT_SYMBOL(__ashrdi3); -EXPORT_SYMBOL(__ashldi3); -EXPORT_SYMBOL(__lshrdi3); -EXPORT_SYMBOL(__negdi2); -EXPORT_SYMBOL(__ucmpdi2); diff --git a/arch/mn10300/kernel/module.c b/arch/mn10300/kernel/module.c deleted file mode 100644 index 216ad23c9570f..0000000000000 --- a/arch/mn10300/kernel/module.c +++ /dev/null @@ -1,156 +0,0 @@ -/* MN10300 Kernel module helper routines - * - * Copyright (C) 2007, 2008, 2009 Red Hat, Inc. All Rights Reserved. - * Written by Mark Salter (msalter@redhat.com) - * - Derived from arch/i386/kernel/module.c - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public Licence as published by - * the Free Software Foundation; either version 2 of the Licence, 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 Licence for more details. - * - * You should have received a copy of the GNU General Public Licence - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#include -#include -#include -#include -#include -#include -#include - -#if 0 -#define DEBUGP printk -#else -#define DEBUGP(fmt, ...) -#endif - -static void reloc_put16(uint8_t *p, uint32_t val) -{ - p[0] = val & 0xff; - p[1] = (val >> 8) & 0xff; -} - -static void reloc_put24(uint8_t *p, uint32_t val) -{ - reloc_put16(p, val); - p[2] = (val >> 16) & 0xff; -} - -static void reloc_put32(uint8_t *p, uint32_t val) -{ - reloc_put16(p, val); - reloc_put16(p+2, val >> 16); -} - -/* - * apply a RELA relocation - */ -int apply_relocate_add(Elf32_Shdr *sechdrs, - const char *strtab, - unsigned int symindex, - unsigned int relsec, - struct module *me) -{ - unsigned int i, sym_diff_seen = 0; - Elf32_Rela *rel = (void *)sechdrs[relsec].sh_addr; - Elf32_Sym *sym; - Elf32_Addr relocation, sym_diff_val = 0; - uint8_t *location; - uint32_t value; - - DEBUGP("Applying relocate section %u to %u\n", - relsec, sechdrs[relsec].sh_info); - - for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) { - /* this is where to make the change */ - location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr - + rel[i].r_offset; - - /* this is the symbol the relocation is referring to (note that - * all undefined symbols have been resolved by the caller) */ - sym = (Elf32_Sym *)sechdrs[symindex].sh_addr - + ELF32_R_SYM(rel[i].r_info); - - /* this is the adjustment to be made */ - relocation = sym->st_value + rel[i].r_addend; - - if (sym_diff_seen) { - switch (ELF32_R_TYPE(rel[i].r_info)) { - case R_MN10300_32: - case R_MN10300_24: - case R_MN10300_16: - case R_MN10300_8: - relocation -= sym_diff_val; - sym_diff_seen = 0; - break; - default: - printk(KERN_ERR "module %s: Unexpected SYM_DIFF relocation: %u\n", - me->name, ELF32_R_TYPE(rel[i].r_info)); - return -ENOEXEC; - } - } - - switch (ELF32_R_TYPE(rel[i].r_info)) { - /* for the first four relocation types, we simply - * store the adjustment at the location given */ - case R_MN10300_32: - reloc_put32(location, relocation); - break; - case R_MN10300_24: - reloc_put24(location, relocation); - break; - case R_MN10300_16: - reloc_put16(location, relocation); - break; - case R_MN10300_8: - *location = relocation; - break; - - /* for the next three relocation types, we write the - * adjustment with the address subtracted over the - * value at the location given */ - case R_MN10300_PCREL32: - value = relocation - (uint32_t) location; - reloc_put32(location, value); - break; - case R_MN10300_PCREL16: - value = relocation - (uint32_t) location; - reloc_put16(location, value); - break; - case R_MN10300_PCREL8: - *location = relocation - (uint32_t) location; - break; - - case R_MN10300_SYM_DIFF: - /* This is used to adjust the next reloc as required - * by relaxation. */ - sym_diff_seen = 1; - sym_diff_val = sym->st_value; - break; - - case R_MN10300_ALIGN: - /* Just ignore the ALIGN relocs. - * Only interesting if kernel performed relaxation. */ - continue; - - default: - printk(KERN_ERR "module %s: Unknown relocation: %u\n", - me->name, ELF32_R_TYPE(rel[i].r_info)); - return -ENOEXEC; - } - } - if (sym_diff_seen) { - printk(KERN_ERR "module %s: Nothing follows SYM_DIFF relocation: %u\n", - me->name, ELF32_R_TYPE(rel[i].r_info)); - return -ENOEXEC; - } - return 0; -} diff --git a/arch/mn10300/kernel/process.c b/arch/mn10300/kernel/process.c deleted file mode 100644 index 7c475fd99c468..0000000000000 --- a/arch/mn10300/kernel/process.c +++ /dev/null @@ -1,175 +0,0 @@ -/* MN10300 Process handling code - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "internal.h" - -/* - * power off function, if any - */ -void (*pm_power_off)(void); -EXPORT_SYMBOL(pm_power_off); - -/* - * On SMP it's slightly faster (but much more power-consuming!) - * to poll the ->work.need_resched flag instead of waiting for the - * cross-CPU IPI to arrive. Use this option with caution. - * - * tglx: No idea why this depends on HOTPLUG_CPU !?! - */ -#if !defined(CONFIG_SMP) || defined(CONFIG_HOTPLUG_CPU) -void arch_cpu_idle(void) -{ - safe_halt(); -} -#endif - -void machine_restart(char *cmd) -{ -#ifdef CONFIG_KERNEL_DEBUGGER - gdbstub_exit(0); -#endif - -#ifdef mn10300_unit_hard_reset - mn10300_unit_hard_reset(); -#else - mn10300_proc_hard_reset(); -#endif -} - -void machine_halt(void) -{ -#ifdef CONFIG_KERNEL_DEBUGGER - gdbstub_exit(0); -#endif -} - -void machine_power_off(void) -{ -#ifdef CONFIG_KERNEL_DEBUGGER - gdbstub_exit(0); -#endif -} - -void show_regs(struct pt_regs *regs) -{ - show_regs_print_info(KERN_DEFAULT); -} - -/* - * free current thread data structures etc.. - */ -void exit_thread(struct task_struct *tsk) -{ - exit_fpu(tsk); -} - -void flush_thread(void) -{ - flush_fpu(); -} - -void release_thread(struct task_struct *dead_task) -{ -} - -/* - * this gets called so that we can store lazy state into memory and copy the - * current task into the new thread. - */ -int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) -{ - unlazy_fpu(src); - *dst = *src; - return 0; -} - -/* - * set up the kernel stack for a new thread and copy arch-specific thread - * control information - */ -int copy_thread(unsigned long clone_flags, - unsigned long c_usp, unsigned long ustk_size, - struct task_struct *p) -{ - struct thread_info *ti = task_thread_info(p); - struct pt_regs *c_regs; - unsigned long c_ksp; - - c_ksp = (unsigned long) task_stack_page(p) + THREAD_SIZE; - - /* allocate the userspace exception frame and set it up */ - c_ksp -= sizeof(struct pt_regs); - c_regs = (struct pt_regs *) c_ksp; - c_ksp -= 12; /* allocate function call ABI slack */ - - /* set up things up so the scheduler can start the new task */ - p->thread.uregs = c_regs; - ti->frame = c_regs; - p->thread.a3 = (unsigned long) c_regs; - p->thread.sp = c_ksp; - p->thread.wchan = p->thread.pc; - p->thread.usp = c_usp; - - if (unlikely(p->flags & PF_KTHREAD)) { - memset(c_regs, 0, sizeof(struct pt_regs)); - c_regs->a0 = c_usp; /* function */ - c_regs->d0 = ustk_size; /* argument */ - local_save_flags(c_regs->epsw); - c_regs->epsw |= EPSW_IE | EPSW_IM_7; - p->thread.pc = (unsigned long) ret_from_kernel_thread; - return 0; - } - *c_regs = *current_pt_regs(); - if (c_usp) - c_regs->sp = c_usp; - c_regs->epsw &= ~EPSW_FE; /* my FPU */ - - /* the new TLS pointer is passed in as arg #5 to sys_clone() */ - if (clone_flags & CLONE_SETTLS) - c_regs->e2 = current_frame()->d3; - - p->thread.pc = (unsigned long) ret_from_fork; - - return 0; -} - -unsigned long get_wchan(struct task_struct *p) -{ - return p->thread.wchan; -} diff --git a/arch/mn10300/kernel/profile-low.S b/arch/mn10300/kernel/profile-low.S deleted file mode 100644 index 94ffac12d02df..0000000000000 --- a/arch/mn10300/kernel/profile-low.S +++ /dev/null @@ -1,72 +0,0 @@ -############################################################################### -# -# Fast profiling interrupt handler -# -# Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. -# Written by David Howells (dhowells@redhat.com) -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public Licence -# as published by the Free Software Foundation; either version -# 2 of the Licence, or (at your option) any later version. -# -############################################################################### -#include -#include -#include -#include -#include -#include - -#define pi break - - .balign 4 -counter: - .long -1 - -############################################################################### -# -# Profiling interrupt entry point -# - intended to run at interrupt priority 1 -# -############################################################################### -ENTRY(profile_handler) - movm [d2,d3,a2],(sp) - - # ignore userspace - mov (12,sp),d2 - and EPSW_nSL,d2 - bne out - - # do nothing if there's no buffer - mov (prof_buffer),a2 - and a2,a2 - beq out - or 0x20000000,a2 - - # calculate relative position in text segment - mov (16,sp),d2 - sub _stext,d2 - mov (prof_shift),d3 - lsr d3,d2 - mov (prof_len),d3 - cmp d3,d2 - bcc outside_text - - # increment the appropriate profile bucket -do_inc: - asl2 d2 - mov (a2,d2),d3 - inc d3 - mov d3,(a2,d2) -out: - mov GxICR_DETECT,d2 - movbu d2,(TM11ICR) # ACK the interrupt - movbu (TM11ICR),d2 - movm (sp),[d2,d3,a2] - rti - -outside_text: - sub 1,d3 - mov d3,d2 - bra do_inc diff --git a/arch/mn10300/kernel/profile.c b/arch/mn10300/kernel/profile.c deleted file mode 100644 index 4f342f75d00cd..0000000000000 --- a/arch/mn10300/kernel/profile.c +++ /dev/null @@ -1,51 +0,0 @@ -/* MN10300 Profiling setup - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - -/* - * initialise the profiling if enabled - * - using with gdbstub will give anomalous results - * - can't be used with gdbstub if running at IRQ priority 0 - */ -static __init int profile_init(void) -{ - u16 tmp; - - if (!prof_buffer) - return 0; - - /* use timer 11 to drive the profiling interrupts */ - set_intr_stub(EXCEP_IRQ_LEVEL0, profile_handler); - - /* set IRQ priority at which to run */ - set_intr_level(TM11IRQ, GxICR_LEVEL_0); - - /* set up timer 11 - * - source: (IOCLK 33MHz)*2 = 66MHz - * - frequency: (33330000*2) / 8 / 20625 = 202Hz - */ - TM11BR = 20625 - 1; - TM11MD = TM8MD_SRC_IOCLK_8; - TM11MD |= TM8MD_INIT_COUNTER; - TM11MD &= ~TM8MD_INIT_COUNTER; - TM11MD |= TM8MD_COUNT_ENABLE; - - TM11ICR |= GxICR_ENABLE; - tmp = TM11ICR; - - printk(KERN_INFO "Profiling initiated on timer 11, priority 0, %uHz\n", - MN10300_IOCLK / 8 / (TM11BR + 1)); - printk(KERN_INFO "Profile histogram stored %p-%p\n", - prof_buffer, (u8 *)(prof_buffer + prof_len) - 1); - - return 0; -} - -__initcall(profile_init); diff --git a/arch/mn10300/kernel/ptrace.c b/arch/mn10300/kernel/ptrace.c deleted file mode 100644 index 8009876a7ac4e..0000000000000 --- a/arch/mn10300/kernel/ptrace.c +++ /dev/null @@ -1,386 +0,0 @@ -/* MN10300 Process tracing - * - * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd. - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Modified by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * translate ptrace register IDs into struct pt_regs offsets - */ -static const u8 ptrace_regid_to_frame[] = { - [PT_A3 << 2] = REG_A3, - [PT_A2 << 2] = REG_A2, - [PT_D3 << 2] = REG_D3, - [PT_D2 << 2] = REG_D2, - [PT_MCVF << 2] = REG_MCVF, - [PT_MCRL << 2] = REG_MCRL, - [PT_MCRH << 2] = REG_MCRH, - [PT_MDRQ << 2] = REG_MDRQ, - [PT_E1 << 2] = REG_E1, - [PT_E0 << 2] = REG_E0, - [PT_E7 << 2] = REG_E7, - [PT_E6 << 2] = REG_E6, - [PT_E5 << 2] = REG_E5, - [PT_E4 << 2] = REG_E4, - [PT_E3 << 2] = REG_E3, - [PT_E2 << 2] = REG_E2, - [PT_SP << 2] = REG_SP, - [PT_LAR << 2] = REG_LAR, - [PT_LIR << 2] = REG_LIR, - [PT_MDR << 2] = REG_MDR, - [PT_A1 << 2] = REG_A1, - [PT_A0 << 2] = REG_A0, - [PT_D1 << 2] = REG_D1, - [PT_D0 << 2] = REG_D0, - [PT_ORIG_D0 << 2] = REG_ORIG_D0, - [PT_EPSW << 2] = REG_EPSW, - [PT_PC << 2] = REG_PC, -}; - -static inline int get_stack_long(struct task_struct *task, int offset) -{ - return *(unsigned long *) - ((unsigned long) task->thread.uregs + offset); -} - -static inline -int put_stack_long(struct task_struct *task, int offset, unsigned long data) -{ - unsigned long stack; - - stack = (unsigned long) task->thread.uregs + offset; - *(unsigned long *) stack = data; - return 0; -} - -/* - * retrieve the contents of MN10300 userspace general registers - */ -static int genregs_get(struct task_struct *target, - const struct user_regset *regset, - unsigned int pos, unsigned int count, - void *kbuf, void __user *ubuf) -{ - const struct pt_regs *regs = task_pt_regs(target); - int ret; - - /* we need to skip regs->next */ - ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, - regs, 0, PT_ORIG_D0 * sizeof(long)); - if (ret < 0) - return ret; - - ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, - ®s->orig_d0, PT_ORIG_D0 * sizeof(long), - NR_PTREGS * sizeof(long)); - if (ret < 0) - return ret; - - return user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf, - NR_PTREGS * sizeof(long), -1); -} - -/* - * update the contents of the MN10300 userspace general registers - */ -static int genregs_set(struct task_struct *target, - const struct user_regset *regset, - unsigned int pos, unsigned int count, - const void *kbuf, const void __user *ubuf) -{ - struct pt_regs *regs = task_pt_regs(target); - unsigned long tmp; - int ret; - - /* we need to skip regs->next */ - ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, - regs, 0, PT_ORIG_D0 * sizeof(long)); - if (ret < 0) - return ret; - - ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, - ®s->orig_d0, PT_ORIG_D0 * sizeof(long), - PT_EPSW * sizeof(long)); - if (ret < 0) - return ret; - - /* we need to mask off changes to EPSW */ - tmp = regs->epsw; - ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, - &tmp, PT_EPSW * sizeof(long), - PT_PC * sizeof(long)); - tmp &= EPSW_FLAG_V | EPSW_FLAG_C | EPSW_FLAG_N | EPSW_FLAG_Z; - tmp |= regs->epsw & ~(EPSW_FLAG_V | EPSW_FLAG_C | EPSW_FLAG_N | - EPSW_FLAG_Z); - regs->epsw = tmp; - - if (ret < 0) - return ret; - - /* and finally load the PC */ - ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, - ®s->pc, PT_PC * sizeof(long), - NR_PTREGS * sizeof(long)); - - if (ret < 0) - return ret; - - return user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf, - NR_PTREGS * sizeof(long), -1); -} - -/* - * retrieve the contents of MN10300 userspace FPU registers - */ -static int fpuregs_get(struct task_struct *target, - const struct user_regset *regset, - unsigned int pos, unsigned int count, - void *kbuf, void __user *ubuf) -{ - const struct fpu_state_struct *fpregs = &target->thread.fpu_state; - int ret; - - unlazy_fpu(target); - - ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, - fpregs, 0, sizeof(*fpregs)); - if (ret < 0) - return ret; - - return user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf, - sizeof(*fpregs), -1); -} - -/* - * update the contents of the MN10300 userspace FPU registers - */ -static int fpuregs_set(struct task_struct *target, - const struct user_regset *regset, - unsigned int pos, unsigned int count, - const void *kbuf, const void __user *ubuf) -{ - struct fpu_state_struct fpu_state = target->thread.fpu_state; - int ret; - - ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, - &fpu_state, 0, sizeof(fpu_state)); - if (ret < 0) - return ret; - - fpu_kill_state(target); - target->thread.fpu_state = fpu_state; - set_using_fpu(target); - - return user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf, - sizeof(fpu_state), -1); -} - -/* - * determine if the FPU registers have actually been used - */ -static int fpuregs_active(struct task_struct *target, - const struct user_regset *regset) -{ - return is_using_fpu(target) ? regset->n : 0; -} - -/* - * Define the register sets available on the MN10300 under Linux - */ -enum mn10300_regset { - REGSET_GENERAL, - REGSET_FPU, -}; - -static const struct user_regset mn10300_regsets[] = { - /* - * General register format is: - * A3, A2, D3, D2, MCVF, MCRL, MCRH, MDRQ - * E1, E0, E7...E2, SP, LAR, LIR, MDR - * A1, A0, D1, D0, ORIG_D0, EPSW, PC - */ - [REGSET_GENERAL] = { - .core_note_type = NT_PRSTATUS, - .n = ELF_NGREG, - .size = sizeof(long), - .align = sizeof(long), - .get = genregs_get, - .set = genregs_set, - }, - /* - * FPU register format is: - * FS0-31, FPCR - */ - [REGSET_FPU] = { - .core_note_type = NT_PRFPREG, - .n = sizeof(struct fpu_state_struct) / sizeof(long), - .size = sizeof(long), - .align = sizeof(long), - .get = fpuregs_get, - .set = fpuregs_set, - .active = fpuregs_active, - }, -}; - -static const struct user_regset_view user_mn10300_native_view = { - .name = "mn10300", - .e_machine = EM_MN10300, - .regsets = mn10300_regsets, - .n = ARRAY_SIZE(mn10300_regsets), -}; - -const struct user_regset_view *task_user_regset_view(struct task_struct *task) -{ - return &user_mn10300_native_view; -} - -/* - * set the single-step bit - */ -void user_enable_single_step(struct task_struct *child) -{ -#ifndef CONFIG_MN10300_USING_JTAG - struct user *dummy = NULL; - long tmp; - - tmp = get_stack_long(child, (unsigned long) &dummy->regs.epsw); - tmp |= EPSW_T; - put_stack_long(child, (unsigned long) &dummy->regs.epsw, tmp); -#endif -} - -/* - * make sure the single-step bit is not set - */ -void user_disable_single_step(struct task_struct *child) -{ -#ifndef CONFIG_MN10300_USING_JTAG - struct user *dummy = NULL; - long tmp; - - tmp = get_stack_long(child, (unsigned long) &dummy->regs.epsw); - tmp &= ~EPSW_T; - put_stack_long(child, (unsigned long) &dummy->regs.epsw, tmp); -#endif -} - -void ptrace_disable(struct task_struct *child) -{ - user_disable_single_step(child); -} - -/* - * handle the arch-specific side of process tracing - */ -long arch_ptrace(struct task_struct *child, long request, - unsigned long addr, unsigned long data) -{ - unsigned long tmp; - int ret; - unsigned long __user *datap = (unsigned long __user *) data; - - switch (request) { - /* read the word at location addr in the USER area. */ - case PTRACE_PEEKUSR: - ret = -EIO; - if ((addr & 3) || addr > sizeof(struct user) - 3) - break; - - tmp = 0; /* Default return condition */ - if (addr < NR_PTREGS << 2) - tmp = get_stack_long(child, - ptrace_regid_to_frame[addr]); - ret = put_user(tmp, datap); - break; - - /* write the word at location addr in the USER area */ - case PTRACE_POKEUSR: - ret = -EIO; - if ((addr & 3) || addr > sizeof(struct user) - 3) - break; - - ret = 0; - if (addr < NR_PTREGS << 2) - ret = put_stack_long(child, ptrace_regid_to_frame[addr], - data); - break; - - case PTRACE_GETREGS: /* Get all integer regs from the child. */ - return copy_regset_to_user(child, &user_mn10300_native_view, - REGSET_GENERAL, - 0, NR_PTREGS * sizeof(long), - datap); - - case PTRACE_SETREGS: /* Set all integer regs in the child. */ - return copy_regset_from_user(child, &user_mn10300_native_view, - REGSET_GENERAL, - 0, NR_PTREGS * sizeof(long), - datap); - - case PTRACE_GETFPREGS: /* Get the child FPU state. */ - return copy_regset_to_user(child, &user_mn10300_native_view, - REGSET_FPU, - 0, sizeof(struct fpu_state_struct), - datap); - - case PTRACE_SETFPREGS: /* Set the child FPU state. */ - return copy_regset_from_user(child, &user_mn10300_native_view, - REGSET_FPU, - 0, sizeof(struct fpu_state_struct), - datap); - - default: - ret = ptrace_request(child, request, addr, data); - break; - } - - return ret; -} - -/* - * handle tracing of system call entry - * - return the revised system call number or ULONG_MAX to cause ENOSYS - */ -asmlinkage unsigned long syscall_trace_entry(struct pt_regs *regs) -{ - if (tracehook_report_syscall_entry(regs)) - /* tracing decided this syscall should not happen, so - * We'll return a bogus call number to get an ENOSYS - * error, but leave the original number in - * regs->orig_d0 - */ - return ULONG_MAX; - - return regs->orig_d0; -} - -/* - * handle tracing of system call exit - */ -asmlinkage void syscall_trace_exit(struct pt_regs *regs) -{ - tracehook_report_syscall_exit(regs, 0); -} diff --git a/arch/mn10300/kernel/rtc.c b/arch/mn10300/kernel/rtc.c deleted file mode 100644 index f81f370250720..0000000000000 --- a/arch/mn10300/kernel/rtc.c +++ /dev/null @@ -1,46 +0,0 @@ -/* MN10300 RTC management - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include -#include -#include -#include -#include - -#include -#include - -DEFINE_SPINLOCK(rtc_lock); -EXPORT_SYMBOL(rtc_lock); - -static const __initdata struct resource res[] = { - DEFINE_RES_IO(RTC_PORT(0), RTC_IO_EXTENT), - DEFINE_RES_IRQ(RTC_IRQ), -}; - -/* - * calibrate the TSC clock against the RTC - */ -void __init calibrate_clock(void) -{ - unsigned char status; - - /* make sure the RTC is running and is set to operate in 24hr mode */ - status = RTSRC; - RTCRB |= RTCRB_SET; - RTCRB |= RTCRB_TM_24HR; - RTCRB &= ~RTCRB_DM_BINARY; - RTCRA |= RTCRA_DVR; - RTCRA &= ~RTCRA_DVR; - RTCRB &= ~RTCRB_SET; - - platform_device_register_simple("rtc_cmos", -1, res, ARRAY_SIZE(res)); -} diff --git a/arch/mn10300/kernel/setup.c b/arch/mn10300/kernel/setup.c deleted file mode 100644 index 1b3d80d8a171a..0000000000000 --- a/arch/mn10300/kernel/setup.c +++ /dev/null @@ -1,283 +0,0 @@ -/* MN10300 Arch-specific initialisation - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -struct mn10300_cpuinfo boot_cpu_data; - -static char __initdata cmd_line[COMMAND_LINE_SIZE]; -char redboot_command_line[COMMAND_LINE_SIZE] = - "console=ttyS0,115200 root=/dev/mtdblock3 rw"; - -char __initdata redboot_platform_name[COMMAND_LINE_SIZE]; - -static struct resource code_resource = { - .start = 0x100000, - .end = 0, - .name = "Kernel code", -}; - -static struct resource data_resource = { - .start = 0, - .end = 0, - .name = "Kernel data", -}; - -static unsigned long __initdata phys_memory_base; -static unsigned long __initdata phys_memory_end; -static unsigned long __initdata memory_end; -unsigned long memory_size; - -struct thread_info *__current_ti = &init_thread_union.thread_info; -struct task_struct *__current = &init_task; - -#define mn10300_known_cpus 5 -static const char *const mn10300_cputypes[] = { - "am33-1", - "am33-2", - "am34-1", - "am33-3", - "am34-2", - "unknown" -}; - -/* - * Pick out the memory size. We look for mem=size, - * where size is "size[KkMm]" - */ -static int __init early_mem(char *p) -{ - memory_size = memparse(p, &p); - - if (memory_size == 0) - panic("Memory size not known\n"); - - return 0; -} -early_param("mem", early_mem); - -/* - * architecture specific setup - */ -void __init setup_arch(char **cmdline_p) -{ - unsigned long bootmap_size; - unsigned long kstart_pfn, start_pfn, free_pfn, end_pfn; - - cpu_init(); - unit_setup(); - smp_init_cpus(); - - /* save unparsed command line copy for /proc/cmdline */ - strlcpy(boot_command_line, redboot_command_line, COMMAND_LINE_SIZE); - - /* populate cmd_line too for later use, preserving boot_command_line */ - strlcpy(cmd_line, boot_command_line, COMMAND_LINE_SIZE); - *cmdline_p = cmd_line; - - parse_early_param(); - - memory_end = (unsigned long) CONFIG_KERNEL_RAM_BASE_ADDRESS + - memory_size; - if (memory_end > phys_memory_end) - memory_end = phys_memory_end; - - init_mm.start_code = (unsigned long)&_text; - init_mm.end_code = (unsigned long) &_etext; - init_mm.end_data = (unsigned long) &_edata; - init_mm.brk = (unsigned long) &_end; - - code_resource.start = virt_to_bus(&_text); - code_resource.end = virt_to_bus(&_etext)-1; - data_resource.start = virt_to_bus(&_etext); - data_resource.end = virt_to_bus(&_edata)-1; - - start_pfn = (CONFIG_KERNEL_RAM_BASE_ADDRESS >> PAGE_SHIFT); - kstart_pfn = PFN_UP(__pa(&_text)); - free_pfn = PFN_UP(__pa(&_end)); - end_pfn = PFN_DOWN(__pa(memory_end)); - - bootmap_size = init_bootmem_node(&contig_page_data, - free_pfn, - start_pfn, - end_pfn); - - if (kstart_pfn > start_pfn) - free_bootmem(PFN_PHYS(start_pfn), - PFN_PHYS(kstart_pfn - start_pfn)); - - free_bootmem(PFN_PHYS(free_pfn), - PFN_PHYS(end_pfn - free_pfn)); - - /* If interrupt vector table is in main ram, then we need to - reserve the page it is occupying. */ - if (CONFIG_INTERRUPT_VECTOR_BASE >= CONFIG_KERNEL_RAM_BASE_ADDRESS && - CONFIG_INTERRUPT_VECTOR_BASE < memory_end) - reserve_bootmem(CONFIG_INTERRUPT_VECTOR_BASE, PAGE_SIZE, - BOOTMEM_DEFAULT); - - reserve_bootmem(PAGE_ALIGN(PFN_PHYS(free_pfn)), bootmap_size, - BOOTMEM_DEFAULT); - -#ifdef CONFIG_VT -#if defined(CONFIG_VGA_CONSOLE) - conswitchp = &vga_con; -#elif defined(CONFIG_DUMMY_CONSOLE) - conswitchp = &dummy_con; -#endif -#endif - - paging_init(); -} - -/* - * perform CPU initialisation - */ -void __init cpu_init(void) -{ - unsigned long cpurev = CPUREV, type; - - type = (CPUREV & CPUREV_TYPE) >> CPUREV_TYPE_S; - if (type > mn10300_known_cpus) - type = mn10300_known_cpus; - - printk(KERN_INFO "Panasonic %s, rev %ld\n", - mn10300_cputypes[type], - (cpurev & CPUREV_REVISION) >> CPUREV_REVISION_S); - - get_mem_info(&phys_memory_base, &memory_size); - phys_memory_end = phys_memory_base + memory_size; - - fpu_init_state(); -} - -static struct cpu cpu_devices[NR_CPUS]; - -static int __init topology_init(void) -{ - int i; - - for_each_present_cpu(i) - register_cpu(&cpu_devices[i], i); - - return 0; -} - -subsys_initcall(topology_init); - -/* - * Get CPU information for use by the procfs. - */ -static int show_cpuinfo(struct seq_file *m, void *v) -{ -#ifdef CONFIG_SMP - struct mn10300_cpuinfo *c = v; - unsigned long cpu_id = c - cpu_data; - unsigned long cpurev = c->type, type, icachesz, dcachesz; -#else /* CONFIG_SMP */ - unsigned long cpu_id = 0; - unsigned long cpurev = CPUREV, type, icachesz, dcachesz; -#endif /* CONFIG_SMP */ - -#ifdef CONFIG_SMP - if (!cpu_online(cpu_id)) - return 0; -#endif - - type = (cpurev & CPUREV_TYPE) >> CPUREV_TYPE_S; - if (type > mn10300_known_cpus) - type = mn10300_known_cpus; - - icachesz = - ((cpurev & CPUREV_ICWAY ) >> CPUREV_ICWAY_S) * - ((cpurev & CPUREV_ICSIZE) >> CPUREV_ICSIZE_S) * - 1024; - - dcachesz = - ((cpurev & CPUREV_DCWAY ) >> CPUREV_DCWAY_S) * - ((cpurev & CPUREV_DCSIZE) >> CPUREV_DCSIZE_S) * - 1024; - - seq_printf(m, - "processor : %ld\n" - "vendor_id : " PROCESSOR_VENDOR_NAME "\n" - "cpu core : %s\n" - "cpu rev : %lu\n" - "model name : " PROCESSOR_MODEL_NAME "\n" - "icache size: %lu\n" - "dcache size: %lu\n", - cpu_id, - mn10300_cputypes[type], - (cpurev & CPUREV_REVISION) >> CPUREV_REVISION_S, - icachesz, - dcachesz - ); - - seq_printf(m, - "ioclk speed: %lu.%02luMHz\n" - "bogomips : %lu.%02lu\n\n", - MN10300_IOCLK / 1000000, - (MN10300_IOCLK / 10000) % 100, -#ifdef CONFIG_SMP - c->loops_per_jiffy / (500000 / HZ), - (c->loops_per_jiffy / (5000 / HZ)) % 100 -#else /* CONFIG_SMP */ - loops_per_jiffy / (500000 / HZ), - (loops_per_jiffy / (5000 / HZ)) % 100 -#endif /* CONFIG_SMP */ - ); - - return 0; -} - -static void *c_start(struct seq_file *m, loff_t *pos) -{ - return *pos < NR_CPUS ? cpu_data + *pos : 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) -{ -} - -const struct seq_operations cpuinfo_op = { - .start = c_start, - .next = c_next, - .stop = c_stop, - .show = show_cpuinfo, -}; diff --git a/arch/mn10300/kernel/sigframe.h b/arch/mn10300/kernel/sigframe.h deleted file mode 100644 index 0decba28ae842..0000000000000 --- a/arch/mn10300/kernel/sigframe.h +++ /dev/null @@ -1,33 +0,0 @@ -/* MN10300 Signal frame definitions - * - * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd. - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - -struct sigframe -{ - void (*pretcode)(void); - int sig; - struct sigcontext *psc; - struct sigcontext sc; - struct fpucontext fpuctx; - unsigned long extramask[_NSIG_WORDS-1]; - char retcode[8]; -}; - -struct rt_sigframe -{ - void (*pretcode)(void); - int sig; - struct siginfo *pinfo; - void *puc; - struct siginfo info; - struct ucontext uc; - struct fpucontext fpuctx; - char retcode[8]; -}; diff --git a/arch/mn10300/kernel/signal.c b/arch/mn10300/kernel/signal.c deleted file mode 100644 index 2f3cb57342356..0000000000000 --- a/arch/mn10300/kernel/signal.c +++ /dev/null @@ -1,431 +0,0 @@ -/* MN10300 Signal handling - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "sigframe.h" - -#define DEBUG_SIG 0 - -/* - * do a signal return; undo the signal stack. - */ -static int restore_sigcontext(struct pt_regs *regs, - struct sigcontext __user *sc, long *_d0) -{ - unsigned int err = 0; - - /* Always make any pending restarted system calls return -EINTR */ - current->restart_block.fn = do_no_restart_syscall; - - if (is_using_fpu(current)) - fpu_kill_state(current); - -#define COPY(x) err |= __get_user(regs->x, &sc->x) - COPY(d1); COPY(d2); COPY(d3); - COPY(a0); COPY(a1); COPY(a2); COPY(a3); - COPY(e0); COPY(e1); COPY(e2); COPY(e3); - COPY(e4); COPY(e5); COPY(e6); COPY(e7); - COPY(lar); COPY(lir); - COPY(mdr); COPY(mdrq); - COPY(mcvf); COPY(mcrl); COPY(mcrh); - COPY(sp); COPY(pc); -#undef COPY - - { - unsigned int tmpflags; -#ifndef CONFIG_MN10300_USING_JTAG -#define USER_EPSW (EPSW_FLAG_Z | EPSW_FLAG_N | EPSW_FLAG_C | EPSW_FLAG_V | \ - EPSW_T | EPSW_nAR) -#else -#define USER_EPSW (EPSW_FLAG_Z | EPSW_FLAG_N | EPSW_FLAG_C | EPSW_FLAG_V | \ - EPSW_nAR) -#endif - err |= __get_user(tmpflags, &sc->epsw); - regs->epsw = (regs->epsw & ~USER_EPSW) | - (tmpflags & USER_EPSW); - regs->orig_d0 = -1; /* disable syscall checks */ - } - - { - struct fpucontext *buf; - err |= __get_user(buf, &sc->fpucontext); - if (buf) { - if (!access_ok(VERIFY_READ, buf, sizeof(*buf))) - goto badframe; - err |= fpu_restore_sigcontext(buf); - } - } - - err |= __get_user(*_d0, &sc->d0); - return err; - -badframe: - return 1; -} - -/* - * standard signal return syscall - */ -asmlinkage long sys_sigreturn(void) -{ - struct sigframe __user *frame; - sigset_t set; - long d0; - - frame = (struct sigframe __user *) current_frame()->sp; - if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) - goto badframe; - if (__get_user(set.sig[0], &frame->sc.oldmask)) - goto badframe; - - if (_NSIG_WORDS > 1 && - __copy_from_user(&set.sig[1], &frame->extramask, - sizeof(frame->extramask))) - goto badframe; - - set_current_blocked(&set); - - if (restore_sigcontext(current_frame(), &frame->sc, &d0)) - goto badframe; - - return d0; - -badframe: - force_sig(SIGSEGV, current); - return 0; -} - -/* - * realtime signal return syscall - */ -asmlinkage long sys_rt_sigreturn(void) -{ - struct rt_sigframe __user *frame; - sigset_t set; - long d0; - - frame = (struct rt_sigframe __user *) current_frame()->sp; - if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) - goto badframe; - if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) - goto badframe; - - set_current_blocked(&set); - - if (restore_sigcontext(current_frame(), &frame->uc.uc_mcontext, &d0)) - goto badframe; - - if (restore_altstack(&frame->uc.uc_stack)) - goto badframe; - - return d0; - -badframe: - force_sig(SIGSEGV, current); - return 0; -} - -/* - * store the userspace context into a signal frame - */ -static int setup_sigcontext(struct sigcontext __user *sc, - struct fpucontext *fpuctx, - struct pt_regs *regs, - unsigned long mask) -{ - int tmp, err = 0; - -#define COPY(x) err |= __put_user(regs->x, &sc->x) - COPY(d0); COPY(d1); COPY(d2); COPY(d3); - COPY(a0); COPY(a1); COPY(a2); COPY(a3); - COPY(e0); COPY(e1); COPY(e2); COPY(e3); - COPY(e4); COPY(e5); COPY(e6); COPY(e7); - COPY(lar); COPY(lir); - COPY(mdr); COPY(mdrq); - COPY(mcvf); COPY(mcrl); COPY(mcrh); - COPY(sp); COPY(epsw); COPY(pc); -#undef COPY - - tmp = fpu_setup_sigcontext(fpuctx); - if (tmp < 0) - err = 1; - else - err |= __put_user(tmp ? fpuctx : NULL, &sc->fpucontext); - - /* non-iBCS2 extensions.. */ - err |= __put_user(mask, &sc->oldmask); - - return err; -} - -/* - * determine which stack to use.. - */ -static inline void __user *get_sigframe(struct ksignal *ksig, - struct pt_regs *regs, - size_t frame_size) -{ - unsigned long sp = sigsp(regs->sp, ksig); - - return (void __user *) ((sp - frame_size) & ~7UL); -} - -/* - * set up a normal signal frame - */ -static int setup_frame(struct ksignal *ksig, sigset_t *set, - struct pt_regs *regs) -{ - struct sigframe __user *frame; - int sig = ksig->sig; - - frame = get_sigframe(ksig, regs, sizeof(*frame)); - - if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) - return -EFAULT; - - if (__put_user(sig, &frame->sig) < 0 || - __put_user(&frame->sc, &frame->psc) < 0) - return -EFAULT; - - if (setup_sigcontext(&frame->sc, &frame->fpuctx, regs, set->sig[0])) - return -EFAULT; - - if (_NSIG_WORDS > 1) { - if (__copy_to_user(frame->extramask, &set->sig[1], - sizeof(frame->extramask))) - return -EFAULT; - } - - /* set up to return from userspace. If provided, use a stub already in - * userspace */ - if (ksig->ka.sa.sa_flags & SA_RESTORER) { - if (__put_user(ksig->ka.sa.sa_restorer, &frame->pretcode)) - return -EFAULT; - } else { - if (__put_user((void (*)(void))frame->retcode, - &frame->pretcode)) - return -EFAULT; - /* this is mov $,d0; syscall 0 */ - if (__put_user(0x2c, (char *)(frame->retcode + 0)) || - __put_user(__NR_sigreturn, (char *)(frame->retcode + 1)) || - __put_user(0x00, (char *)(frame->retcode + 2)) || - __put_user(0xf0, (char *)(frame->retcode + 3)) || - __put_user(0xe0, (char *)(frame->retcode + 4))) - return -EFAULT; - flush_icache_range((unsigned long) frame->retcode, - (unsigned long) frame->retcode + 5); - } - - /* set up registers for signal handler */ - regs->sp = (unsigned long) frame; - regs->pc = (unsigned long) ksig->ka.sa.sa_handler; - regs->d0 = sig; - regs->d1 = (unsigned long) &frame->sc; - -#if DEBUG_SIG - printk(KERN_DEBUG "SIG deliver %d (%s:%d): sp=%p pc=%lx ra=%p\n", - sig, current->comm, current->pid, frame, regs->pc, - frame->pretcode); -#endif - - return 0; -} - -/* - * set up a realtime signal frame - */ -static int setup_rt_frame(struct ksignal *ksig, sigset_t *set, - struct pt_regs *regs) -{ - struct rt_sigframe __user *frame; - int sig = ksig->sig; - - frame = get_sigframe(ksig, regs, sizeof(*frame)); - - if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) - return -EFAULT; - - if (__put_user(sig, &frame->sig) || - __put_user(&frame->info, &frame->pinfo) || - __put_user(&frame->uc, &frame->puc) || - copy_siginfo_to_user(&frame->info, &ksig->info)) - return -EFAULT; - - /* create the ucontext. */ - if (__put_user(0, &frame->uc.uc_flags) || - __put_user(0, &frame->uc.uc_link) || - __save_altstack(&frame->uc.uc_stack, regs->sp) || - setup_sigcontext(&frame->uc.uc_mcontext, - &frame->fpuctx, regs, set->sig[0]) || - __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set))) - return -EFAULT; - - /* set up to return from userspace. If provided, use a stub already in - * userspace */ - if (ksig->ka.sa.sa_flags & SA_RESTORER) { - if (__put_user(ksig->ka.sa.sa_restorer, &frame->pretcode)) - return -EFAULT; - - } else { - if (__put_user((void(*)(void))frame->retcode, - &frame->pretcode) || - /* This is mov $,d0; syscall 0 */ - __put_user(0x2c, (char *)(frame->retcode + 0)) || - __put_user(__NR_rt_sigreturn, - (char *)(frame->retcode + 1)) || - __put_user(0x00, (char *)(frame->retcode + 2)) || - __put_user(0xf0, (char *)(frame->retcode + 3)) || - __put_user(0xe0, (char *)(frame->retcode + 4))) - return -EFAULT; - - flush_icache_range((u_long) frame->retcode, - (u_long) frame->retcode + 5); - } - - /* Set up registers for signal handler */ - regs->sp = (unsigned long) frame; - regs->pc = (unsigned long) ksig->ka.sa.sa_handler; - regs->d0 = sig; - regs->d1 = (long) &frame->info; - -#if DEBUG_SIG - printk(KERN_DEBUG "SIG deliver %d (%s:%d): sp=%p pc=%lx ra=%p\n", - sig, current->comm, current->pid, frame, regs->pc, - frame->pretcode); -#endif - - return 0; -} - -static inline void stepback(struct pt_regs *regs) -{ - regs->pc -= 2; - regs->orig_d0 = -1; -} - -/* - * handle the actual delivery of a signal to userspace - */ -static int handle_signal(struct ksignal *ksig, struct pt_regs *regs) -{ - sigset_t *oldset = sigmask_to_save(); - int ret; - - /* Are we from a system call? */ - if (regs->orig_d0 >= 0) { - /* If so, check system call restarting.. */ - switch (regs->d0) { - case -ERESTART_RESTARTBLOCK: - case -ERESTARTNOHAND: - regs->d0 = -EINTR; - break; - - case -ERESTARTSYS: - if (!(ksig->ka.sa.sa_flags & SA_RESTART)) { - regs->d0 = -EINTR; - break; - } - - /* fallthrough */ - case -ERESTARTNOINTR: - regs->d0 = regs->orig_d0; - stepback(regs); - } - } - - /* Set up the stack frame */ - if (ksig->ka.sa.sa_flags & SA_SIGINFO) - ret = setup_rt_frame(ksig, oldset, regs); - else - ret = setup_frame(ksig, oldset, regs); - - signal_setup_done(ret, ksig, test_thread_flag(TIF_SINGLESTEP)); - return 0; -} - -/* - * handle a potential signal - */ -static void do_signal(struct pt_regs *regs) -{ - struct ksignal ksig; - - if (get_signal(&ksig)) { - handle_signal(&ksig, regs); - return; - } - - /* did we come from a system call? */ - if (regs->orig_d0 >= 0) { - /* restart the system call - no handlers present */ - switch (regs->d0) { - case -ERESTARTNOHAND: - case -ERESTARTSYS: - case -ERESTARTNOINTR: - regs->d0 = regs->orig_d0; - stepback(regs); - break; - - case -ERESTART_RESTARTBLOCK: - regs->d0 = __NR_restart_syscall; - stepback(regs); - break; - } - } - - /* if there's no signal to deliver, we just put the saved sigmask - * back */ - restore_saved_sigmask(); -} - -/* - * notification of userspace execution resumption - * - triggered by current->work.notify_resume - */ -asmlinkage void do_notify_resume(struct pt_regs *regs, u32 thread_info_flags) -{ - /* Pending single-step? */ - if (thread_info_flags & _TIF_SINGLESTEP) { -#ifndef CONFIG_MN10300_USING_JTAG - regs->epsw |= EPSW_T; - clear_thread_flag(TIF_SINGLESTEP); -#else - BUG(); /* no h/w single-step if using JTAG unit */ -#endif - } - - /* deal with pending signal delivery */ - if (thread_info_flags & _TIF_SIGPENDING) - do_signal(regs); - - if (thread_info_flags & _TIF_NOTIFY_RESUME) { - clear_thread_flag(TIF_NOTIFY_RESUME); - tracehook_notify_resume(current_frame()); - } -} diff --git a/arch/mn10300/kernel/smp-low.S b/arch/mn10300/kernel/smp-low.S deleted file mode 100644 index 71f1b2faaa0b1..0000000000000 --- a/arch/mn10300/kernel/smp-low.S +++ /dev/null @@ -1,97 +0,0 @@ -/* SMP IPI low-level handler - * - * Copyright (C) 2006-2007 Matsushita Electric Industrial Co., Ltd. - * All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - - .am33_2 - -############################################################################### -# -# IPI interrupt handler -# -############################################################################### - .globl mn10300_low_ipi_handler -mn10300_low_ipi_handler: - add -4,sp - mov d0,(sp) - movhu (IAGR),d0 - and IAGR_GN,d0 - lsr 0x2,d0 -#ifdef CONFIG_MN10300_CACHE_ENABLED - cmp FLUSH_CACHE_IPI,d0 - beq mn10300_flush_cache_ipi -#endif - cmp SMP_BOOT_IRQ,d0 - beq mn10300_smp_boot_ipi - /* OTHERS */ - mov (sp),d0 - add 4,sp -#ifdef CONFIG_GDBSTUB - jmp gdbstub_io_rx_handler -#else - jmp end -#endif - -############################################################################### -# -# Cache flush IPI interrupt handler -# -############################################################################### -#ifdef CONFIG_MN10300_CACHE_ENABLED -mn10300_flush_cache_ipi: - mov (sp),d0 - add 4,sp - - /* FLUSH_CACHE_IPI */ - add -4,sp - SAVE_ALL - mov GxICR_DETECT,d2 - movbu d2,(GxICR(FLUSH_CACHE_IPI)) # ACK the interrupt - movhu (GxICR(FLUSH_CACHE_IPI)),d2 - call smp_cache_interrupt[],0 - RESTORE_ALL - jmp end -#endif - -############################################################################### -# -# SMP boot CPU IPI interrupt handler -# -############################################################################### -mn10300_smp_boot_ipi: - /* clear interrupt */ - movhu (GxICR(SMP_BOOT_IRQ)),d0 - and ~GxICR_REQUEST,d0 - movhu d0,(GxICR(SMP_BOOT_IRQ)) - mov (sp),d0 - add 4,sp - - # get stack - mov (CPUID),a0 - add -1,a0 - add a0,a0 - add a0,a0 - mov (start_stack,a0),a0 - mov a0,sp - jmp initialize_secondary - - -# Jump here after RTI to suppress the icache lookahead -end: diff --git a/arch/mn10300/kernel/smp.c b/arch/mn10300/kernel/smp.c deleted file mode 100644 index 35d2c3fe6f769..0000000000000 --- a/arch/mn10300/kernel/smp.c +++ /dev/null @@ -1,1186 +0,0 @@ -/* SMP support routines. - * - * Copyright (C) 2006-2008 Panasonic Corporation - * All Rights Reserved. - * - * 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. - * - * 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. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "internal.h" - -#ifdef CONFIG_HOTPLUG_CPU -#include - -static unsigned long sleep_mode[NR_CPUS]; - -static void run_sleep_cpu(unsigned int cpu); -static void run_wakeup_cpu(unsigned int cpu); -#endif /* CONFIG_HOTPLUG_CPU */ - -/* - * Debug Message function - */ - -#undef DEBUG_SMP -#ifdef DEBUG_SMP -#define Dprintk(fmt, ...) printk(KERN_DEBUG fmt, ##__VA_ARGS__) -#else -#define Dprintk(fmt, ...) no_printk(KERN_DEBUG fmt, ##__VA_ARGS__) -#endif - -/* timeout value in msec for smp_nmi_call_function. zero is no timeout. */ -#define CALL_FUNCTION_NMI_IPI_TIMEOUT 0 - -/* - * Structure and data for smp_nmi_call_function(). - */ -struct nmi_call_data_struct { - smp_call_func_t func; - void *info; - cpumask_t started; - cpumask_t finished; - int wait; - char size_alignment[0] - __attribute__ ((__aligned__(SMP_CACHE_BYTES))); -} __attribute__ ((__aligned__(SMP_CACHE_BYTES))); - -static DEFINE_SPINLOCK(smp_nmi_call_lock); -static struct nmi_call_data_struct *nmi_call_data; - -/* - * Data structures and variables - */ -static cpumask_t cpu_callin_map; /* Bitmask of callin CPUs */ -static cpumask_t cpu_callout_map; /* Bitmask of callout CPUs */ -cpumask_t cpu_boot_map; /* Bitmask of boot APs */ -unsigned long start_stack[NR_CPUS - 1]; - -/* - * Per CPU parameters - */ -struct mn10300_cpuinfo cpu_data[NR_CPUS] __cacheline_aligned; - -static int cpucount; /* The count of boot CPUs */ -static cpumask_t smp_commenced_mask; -cpumask_t cpu_initialized __initdata = CPU_MASK_NONE; - -/* - * Function Prototypes - */ -static int do_boot_cpu(int); -static void smp_show_cpu_info(int cpu_id); -static void smp_callin(void); -static void smp_online(void); -static void smp_store_cpu_info(int); -static void smp_cpu_init(void); -static void smp_tune_scheduling(void); -static void send_IPI_mask(const cpumask_t *cpumask, int irq); -static void init_ipi(void); - -/* - * IPI Initialization interrupt definitions - */ -static void mn10300_ipi_disable(unsigned int irq); -static void mn10300_ipi_enable(unsigned int irq); -static void mn10300_ipi_chip_disable(struct irq_data *d); -static void mn10300_ipi_chip_enable(struct irq_data *d); -static void mn10300_ipi_ack(struct irq_data *d); -static void mn10300_ipi_nop(struct irq_data *d); - -static struct irq_chip mn10300_ipi_type = { - .name = "cpu_ipi", - .irq_disable = mn10300_ipi_chip_disable, - .irq_enable = mn10300_ipi_chip_enable, - .irq_ack = mn10300_ipi_ack, - .irq_eoi = mn10300_ipi_nop -}; - -static irqreturn_t smp_reschedule_interrupt(int irq, void *dev_id); -static irqreturn_t smp_call_function_interrupt(int irq, void *dev_id); - -static struct irqaction reschedule_ipi = { - .handler = smp_reschedule_interrupt, - .flags = IRQF_NOBALANCING, - .name = "smp reschedule IPI" -}; -static struct irqaction call_function_ipi = { - .handler = smp_call_function_interrupt, - .flags = IRQF_NOBALANCING, - .name = "smp call function IPI" -}; - -#if !defined(CONFIG_GENERIC_CLOCKEVENTS) || defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) -static irqreturn_t smp_ipi_timer_interrupt(int irq, void *dev_id); -static struct irqaction local_timer_ipi = { - .handler = smp_ipi_timer_interrupt, - .flags = IRQF_NOBALANCING, - .name = "smp local timer IPI" -}; -#endif - -/** - * init_ipi - Initialise the IPI mechanism - */ -static void init_ipi(void) -{ - unsigned long flags; - u16 tmp16; - - /* set up the reschedule IPI */ - irq_set_chip_and_handler(RESCHEDULE_IPI, &mn10300_ipi_type, - handle_percpu_irq); - setup_irq(RESCHEDULE_IPI, &reschedule_ipi); - set_intr_level(RESCHEDULE_IPI, RESCHEDULE_GxICR_LV); - mn10300_ipi_enable(RESCHEDULE_IPI); - - /* set up the call function IPI */ - irq_set_chip_and_handler(CALL_FUNC_SINGLE_IPI, &mn10300_ipi_type, - handle_percpu_irq); - setup_irq(CALL_FUNC_SINGLE_IPI, &call_function_ipi); - set_intr_level(CALL_FUNC_SINGLE_IPI, CALL_FUNCTION_GxICR_LV); - mn10300_ipi_enable(CALL_FUNC_SINGLE_IPI); - - /* set up the local timer IPI */ -#if !defined(CONFIG_GENERIC_CLOCKEVENTS) || \ - defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) - irq_set_chip_and_handler(LOCAL_TIMER_IPI, &mn10300_ipi_type, - handle_percpu_irq); - setup_irq(LOCAL_TIMER_IPI, &local_timer_ipi); - set_intr_level(LOCAL_TIMER_IPI, LOCAL_TIMER_GxICR_LV); - mn10300_ipi_enable(LOCAL_TIMER_IPI); -#endif - -#ifdef CONFIG_MN10300_CACHE_ENABLED - /* set up the cache flush IPI */ - irq_set_chip(FLUSH_CACHE_IPI, &mn10300_ipi_type); - flags = arch_local_cli_save(); - __set_intr_stub(NUM2EXCEP_IRQ_LEVEL(FLUSH_CACHE_GxICR_LV), - mn10300_low_ipi_handler); - GxICR(FLUSH_CACHE_IPI) = FLUSH_CACHE_GxICR_LV | GxICR_DETECT; - mn10300_ipi_enable(FLUSH_CACHE_IPI); - arch_local_irq_restore(flags); -#endif - - /* set up the NMI call function IPI */ - irq_set_chip(CALL_FUNCTION_NMI_IPI, &mn10300_ipi_type); - flags = arch_local_cli_save(); - GxICR(CALL_FUNCTION_NMI_IPI) = GxICR_NMI | GxICR_ENABLE | GxICR_DETECT; - tmp16 = GxICR(CALL_FUNCTION_NMI_IPI); - arch_local_irq_restore(flags); - - /* set up the SMP boot IPI */ - flags = arch_local_cli_save(); - __set_intr_stub(NUM2EXCEP_IRQ_LEVEL(SMP_BOOT_GxICR_LV), - mn10300_low_ipi_handler); - arch_local_irq_restore(flags); - -#ifdef CONFIG_KERNEL_DEBUGGER - irq_set_chip(DEBUGGER_NMI_IPI, &mn10300_ipi_type); -#endif -} - -/** - * mn10300_ipi_shutdown - Shut down handling of an IPI - * @irq: The IPI to be shut down. - */ -static void mn10300_ipi_shutdown(unsigned int irq) -{ - unsigned long flags; - u16 tmp; - - flags = arch_local_cli_save(); - - tmp = GxICR(irq); - GxICR(irq) = (tmp & GxICR_LEVEL) | GxICR_DETECT; - tmp = GxICR(irq); - - arch_local_irq_restore(flags); -} - -/** - * mn10300_ipi_enable - Enable an IPI - * @irq: The IPI to be enabled. - */ -static void mn10300_ipi_enable(unsigned int irq) -{ - unsigned long flags; - u16 tmp; - - flags = arch_local_cli_save(); - - tmp = GxICR(irq); - GxICR(irq) = (tmp & GxICR_LEVEL) | GxICR_ENABLE; - tmp = GxICR(irq); - - arch_local_irq_restore(flags); -} - -static void mn10300_ipi_chip_enable(struct irq_data *d) -{ - mn10300_ipi_enable(d->irq); -} - -/** - * mn10300_ipi_disable - Disable an IPI - * @irq: The IPI to be disabled. - */ -static void mn10300_ipi_disable(unsigned int irq) -{ - unsigned long flags; - u16 tmp; - - flags = arch_local_cli_save(); - - tmp = GxICR(irq); - GxICR(irq) = tmp & GxICR_LEVEL; - tmp = GxICR(irq); - - arch_local_irq_restore(flags); -} - -static void mn10300_ipi_chip_disable(struct irq_data *d) -{ - mn10300_ipi_disable(d->irq); -} - - -/** - * mn10300_ipi_ack - Acknowledge an IPI interrupt in the PIC - * @irq: The IPI to be acknowledged. - * - * Clear the interrupt detection flag for the IPI on the appropriate interrupt - * channel in the PIC. - */ -static void mn10300_ipi_ack(struct irq_data *d) -{ - unsigned int irq = d->irq; - unsigned long flags; - u16 tmp; - - flags = arch_local_cli_save(); - GxICR_u8(irq) = GxICR_DETECT; - tmp = GxICR(irq); - arch_local_irq_restore(flags); -} - -/** - * mn10300_ipi_nop - Dummy IPI action - * @irq: The IPI to be acted upon. - */ -static void mn10300_ipi_nop(struct irq_data *d) -{ -} - -/** - * send_IPI_mask - Send IPIs to all CPUs in list - * @cpumask: The list of CPUs to target. - * @irq: The IPI request to be sent. - * - * Send the specified IPI to all the CPUs in the list, not waiting for them to - * finish before returning. The caller is responsible for synchronisation if - * that is needed. - */ -static void send_IPI_mask(const cpumask_t *cpumask, int irq) -{ - int i; - u16 tmp; - - for (i = 0; i < NR_CPUS; i++) { - if (cpumask_test_cpu(i, cpumask)) { - /* send IPI */ - tmp = CROSS_GxICR(irq, i); - CROSS_GxICR(irq, i) = - tmp | GxICR_REQUEST | GxICR_DETECT; - tmp = CROSS_GxICR(irq, i); /* flush write buffer */ - } - } -} - -/** - * send_IPI_self - Send an IPI to this CPU. - * @irq: The IPI request to be sent. - * - * Send the specified IPI to the current CPU. - */ -void send_IPI_self(int irq) -{ - send_IPI_mask(cpumask_of(smp_processor_id()), irq); -} - -/** - * send_IPI_allbutself - Send IPIs to all the other CPUs. - * @irq: The IPI request to be sent. - * - * Send the specified IPI to all CPUs in the system barring the current one, - * not waiting for them to finish before returning. The caller is responsible - * for synchronisation if that is needed. - */ -void send_IPI_allbutself(int irq) -{ - cpumask_t cpumask; - - cpumask_copy(&cpumask, cpu_online_mask); - cpumask_clear_cpu(smp_processor_id(), &cpumask); - send_IPI_mask(&cpumask, irq); -} - -void arch_send_call_function_ipi_mask(const struct cpumask *mask) -{ - BUG(); - /*send_IPI_mask(mask, CALL_FUNCTION_IPI);*/ -} - -void arch_send_call_function_single_ipi(int cpu) -{ - send_IPI_mask(cpumask_of(cpu), CALL_FUNC_SINGLE_IPI); -} - -/** - * smp_send_reschedule - Send reschedule IPI to a CPU - * @cpu: The CPU to target. - */ -void smp_send_reschedule(int cpu) -{ - send_IPI_mask(cpumask_of(cpu), RESCHEDULE_IPI); -} - -/** - * smp_nmi_call_function - Send a call function NMI IPI to all CPUs - * @func: The function to ask to be run. - * @info: The context data to pass to that function. - * @wait: If true, wait (atomically) until function is run on all CPUs. - * - * Send a non-maskable request to all CPUs in the system, requesting them to - * run the specified function with the given context data, and, potentially, to - * wait for completion of that function on all CPUs. - * - * Returns 0 if successful, -ETIMEDOUT if we were asked to wait, but hit the - * timeout. - */ -int smp_nmi_call_function(smp_call_func_t func, void *info, int wait) -{ - struct nmi_call_data_struct data; - unsigned long flags; - unsigned int cnt; - int cpus, ret = 0; - - cpus = num_online_cpus() - 1; - if (cpus < 1) - return 0; - - data.func = func; - data.info = info; - cpumask_copy(&data.started, cpu_online_mask); - cpumask_clear_cpu(smp_processor_id(), &data.started); - data.wait = wait; - if (wait) - data.finished = data.started; - - spin_lock_irqsave(&smp_nmi_call_lock, flags); - nmi_call_data = &data; - smp_mb(); - - /* Send a message to all other CPUs and wait for them to respond */ - send_IPI_allbutself(CALL_FUNCTION_NMI_IPI); - - /* Wait for response */ - if (CALL_FUNCTION_NMI_IPI_TIMEOUT > 0) { - for (cnt = 0; - cnt < CALL_FUNCTION_NMI_IPI_TIMEOUT && - !cpumask_empty(&data.started); - cnt++) - mdelay(1); - - if (wait && cnt < CALL_FUNCTION_NMI_IPI_TIMEOUT) { - for (cnt = 0; - cnt < CALL_FUNCTION_NMI_IPI_TIMEOUT && - !cpumask_empty(&data.finished); - cnt++) - mdelay(1); - } - - if (cnt >= CALL_FUNCTION_NMI_IPI_TIMEOUT) - ret = -ETIMEDOUT; - - } else { - /* If timeout value is zero, wait until cpumask has been - * cleared */ - while (!cpumask_empty(&data.started)) - barrier(); - if (wait) - while (!cpumask_empty(&data.finished)) - barrier(); - } - - spin_unlock_irqrestore(&smp_nmi_call_lock, flags); - return ret; -} - -/** - * smp_jump_to_debugger - Make other CPUs enter the debugger by sending an IPI - * - * Send a non-maskable request to all other CPUs in the system, instructing - * them to jump into the debugger. The caller is responsible for checking that - * the other CPUs responded to the instruction. - * - * The caller should make sure that this CPU's debugger IPI is disabled. - */ -void smp_jump_to_debugger(void) -{ - if (num_online_cpus() > 1) - /* Send a message to all other CPUs */ - send_IPI_allbutself(DEBUGGER_NMI_IPI); -} - -/** - * stop_this_cpu - Callback to stop a CPU. - * @unused: Callback context (ignored). - */ -void stop_this_cpu(void *unused) -{ - static volatile int stopflag; - unsigned long flags; - -#ifdef CONFIG_GDBSTUB - /* In case of single stepping smp_send_stop by other CPU, - * clear procindebug to avoid deadlock. - */ - atomic_set(&procindebug[smp_processor_id()], 0); -#endif /* CONFIG_GDBSTUB */ - - flags = arch_local_cli_save(); - set_cpu_online(smp_processor_id(), false); - - while (!stopflag) - cpu_relax(); - - set_cpu_online(smp_processor_id(), true); - arch_local_irq_restore(flags); -} - -/** - * smp_send_stop - Send a stop request to all CPUs. - */ -void smp_send_stop(void) -{ - smp_nmi_call_function(stop_this_cpu, NULL, 0); -} - -/** - * smp_reschedule_interrupt - Reschedule IPI handler - * @irq: The interrupt number. - * @dev_id: The device ID. - * - * Returns IRQ_HANDLED to indicate we handled the interrupt successfully. - */ -static irqreturn_t smp_reschedule_interrupt(int irq, void *dev_id) -{ - scheduler_ipi(); - return IRQ_HANDLED; -} - -/** - * smp_call_function_interrupt - Call function IPI handler - * @irq: The interrupt number. - * @dev_id: The device ID. - * - * Returns IRQ_HANDLED to indicate we handled the interrupt successfully. - */ -static irqreturn_t smp_call_function_interrupt(int irq, void *dev_id) -{ - /* generic_smp_call_function_interrupt(); */ - generic_smp_call_function_single_interrupt(); - return IRQ_HANDLED; -} - -/** - * smp_nmi_call_function_interrupt - Non-maskable call function IPI handler - */ -void smp_nmi_call_function_interrupt(void) -{ - smp_call_func_t func = nmi_call_data->func; - void *info = nmi_call_data->info; - int wait = nmi_call_data->wait; - - /* Notify the initiating CPU that I've grabbed the data and am about to - * execute the function - */ - smp_mb(); - cpumask_clear_cpu(smp_processor_id(), &nmi_call_data->started); - (*func)(info); - - if (wait) { - smp_mb(); - cpumask_clear_cpu(smp_processor_id(), - &nmi_call_data->finished); - } -} - -#if !defined(CONFIG_GENERIC_CLOCKEVENTS) || \ - defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) -/** - * smp_ipi_timer_interrupt - Local timer IPI handler - * @irq: The interrupt number. - * @dev_id: The device ID. - * - * Returns IRQ_HANDLED to indicate we handled the interrupt successfully. - */ -static irqreturn_t smp_ipi_timer_interrupt(int irq, void *dev_id) -{ - return local_timer_interrupt(); -} -#endif - -void __init smp_init_cpus(void) -{ - int i; - for (i = 0; i < NR_CPUS; i++) { - set_cpu_possible(i, true); - set_cpu_present(i, true); - } -} - -/** - * smp_cpu_init - Initialise AP in start_secondary. - * - * For this Application Processor, set up init_mm, initialise FPU and set - * interrupt level 0-6 setting. - */ -static void __init smp_cpu_init(void) -{ - unsigned long flags; - int cpu_id = smp_processor_id(); - u16 tmp16; - - if (test_and_set_bit(cpu_id, &cpu_initialized)) { - printk(KERN_WARNING "CPU#%d already initialized!\n", cpu_id); - for (;;) - local_irq_enable(); - } - printk(KERN_INFO "Initializing CPU#%d\n", cpu_id); - - mmgrab(&init_mm); - current->active_mm = &init_mm; - BUG_ON(current->mm); - - enter_lazy_tlb(&init_mm, current); - - /* Force FPU initialization */ - clear_using_fpu(current); - - GxICR(CALL_FUNC_SINGLE_IPI) = CALL_FUNCTION_GxICR_LV | GxICR_DETECT; - mn10300_ipi_enable(CALL_FUNC_SINGLE_IPI); - - GxICR(LOCAL_TIMER_IPI) = LOCAL_TIMER_GxICR_LV | GxICR_DETECT; - mn10300_ipi_enable(LOCAL_TIMER_IPI); - - GxICR(RESCHEDULE_IPI) = RESCHEDULE_GxICR_LV | GxICR_DETECT; - mn10300_ipi_enable(RESCHEDULE_IPI); - -#ifdef CONFIG_MN10300_CACHE_ENABLED - GxICR(FLUSH_CACHE_IPI) = FLUSH_CACHE_GxICR_LV | GxICR_DETECT; - mn10300_ipi_enable(FLUSH_CACHE_IPI); -#endif - - mn10300_ipi_shutdown(SMP_BOOT_IRQ); - - /* Set up the non-maskable call function IPI */ - flags = arch_local_cli_save(); - GxICR(CALL_FUNCTION_NMI_IPI) = GxICR_NMI | GxICR_ENABLE | GxICR_DETECT; - tmp16 = GxICR(CALL_FUNCTION_NMI_IPI); - arch_local_irq_restore(flags); -} - -/** - * smp_prepare_cpu_init - Initialise CPU in startup_secondary - * - * Set interrupt level 0-6 setting and init ICR of the kernel debugger. - */ -void smp_prepare_cpu_init(void) -{ - int loop; - - /* Set the interrupt vector registers */ - IVAR0 = EXCEP_IRQ_LEVEL0; - IVAR1 = EXCEP_IRQ_LEVEL1; - IVAR2 = EXCEP_IRQ_LEVEL2; - IVAR3 = EXCEP_IRQ_LEVEL3; - IVAR4 = EXCEP_IRQ_LEVEL4; - IVAR5 = EXCEP_IRQ_LEVEL5; - IVAR6 = EXCEP_IRQ_LEVEL6; - - /* Disable all interrupts and set to priority 6 (lowest) */ - for (loop = 0; loop < GxICR_NUM_IRQS; loop++) - GxICR(loop) = GxICR_LEVEL_6 | GxICR_DETECT; - -#ifdef CONFIG_KERNEL_DEBUGGER - /* initialise the kernel debugger interrupt */ - do { - unsigned long flags; - u16 tmp16; - - flags = arch_local_cli_save(); - GxICR(DEBUGGER_NMI_IPI) = GxICR_NMI | GxICR_ENABLE | GxICR_DETECT; - tmp16 = GxICR(DEBUGGER_NMI_IPI); - arch_local_irq_restore(flags); - } while (0); -#endif -} - -/** - * start_secondary - Activate a secondary CPU (AP) - * @unused: Thread parameter (ignored). - */ -int __init start_secondary(void *unused) -{ - smp_cpu_init(); - smp_callin(); - while (!cpumask_test_cpu(smp_processor_id(), &smp_commenced_mask)) - cpu_relax(); - - local_flush_tlb(); - preempt_disable(); - smp_online(); - -#ifdef CONFIG_GENERIC_CLOCKEVENTS - init_clockevents(); -#endif - cpu_startup_entry(CPUHP_AP_ONLINE_IDLE); - return 0; -} - -/** - * smp_prepare_cpus - Boot up secondary CPUs (APs) - * @max_cpus: Maximum number of CPUs to boot. - * - * Call do_boot_cpu, and boot up APs. - */ -void __init smp_prepare_cpus(unsigned int max_cpus) -{ - int phy_id; - - /* Setup boot CPU information */ - smp_store_cpu_info(0); - smp_tune_scheduling(); - - init_ipi(); - - /* If SMP should be disabled, then finish */ - if (max_cpus == 0) { - printk(KERN_INFO "SMP mode deactivated.\n"); - goto smp_done; - } - - /* Boot secondary CPUs (for which phy_id > 0) */ - for (phy_id = 0; phy_id < NR_CPUS; phy_id++) { - /* Don't boot primary CPU */ - if (max_cpus <= cpucount + 1) - continue; - if (phy_id != 0) - do_boot_cpu(phy_id); - set_cpu_possible(phy_id, true); - smp_show_cpu_info(phy_id); - } - -smp_done: - Dprintk("Boot done.\n"); -} - -/** - * smp_store_cpu_info - Save a CPU's information - * @cpu: The CPU to save for. - * - * Save boot_cpu_data and jiffy for the specified CPU. - */ -static void __init smp_store_cpu_info(int cpu) -{ - struct mn10300_cpuinfo *ci = &cpu_data[cpu]; - - *ci = boot_cpu_data; - ci->loops_per_jiffy = loops_per_jiffy; - ci->type = CPUREV; -} - -/** - * smp_tune_scheduling - Set time slice value - * - * Nothing to do here. - */ -static void __init smp_tune_scheduling(void) -{ -} - -/** - * do_boot_cpu: Boot up one CPU - * @phy_id: Physical ID of CPU to boot. - * - * Send an IPI to a secondary CPU to boot it. Returns 0 on success, 1 - * otherwise. - */ -static int __init do_boot_cpu(int phy_id) -{ - struct task_struct *idle; - unsigned long send_status, callin_status; - int timeout, cpu_id; - - send_status = GxICR_REQUEST; - callin_status = 0; - timeout = 0; - cpu_id = phy_id; - - cpucount++; - - /* Create idle thread for this CPU */ - idle = fork_idle(cpu_id); - if (IS_ERR(idle)) - panic("Failed fork for CPU#%d.", cpu_id); - - idle->thread.pc = (unsigned long)start_secondary; - - printk(KERN_NOTICE "Booting CPU#%d\n", cpu_id); - start_stack[cpu_id - 1] = idle->thread.sp; - - task_thread_info(idle)->cpu = cpu_id; - - /* Send boot IPI to AP */ - send_IPI_mask(cpumask_of(phy_id), SMP_BOOT_IRQ); - - Dprintk("Waiting for send to finish...\n"); - - /* Wait for AP's IPI receive in 100[ms] */ - do { - udelay(1000); - send_status = - CROSS_GxICR(SMP_BOOT_IRQ, phy_id) & GxICR_REQUEST; - } while (send_status == GxICR_REQUEST && timeout++ < 100); - - Dprintk("Waiting for cpu_callin_map.\n"); - - if (send_status == 0) { - /* Allow AP to start initializing */ - cpumask_set_cpu(cpu_id, &cpu_callout_map); - - /* Wait for setting cpu_callin_map */ - timeout = 0; - do { - udelay(1000); - callin_status = cpumask_test_cpu(cpu_id, - &cpu_callin_map); - } while (callin_status == 0 && timeout++ < 5000); - - if (callin_status == 0) - Dprintk("Not responding.\n"); - } else { - printk(KERN_WARNING "IPI not delivered.\n"); - } - - if (send_status == GxICR_REQUEST || callin_status == 0) { - cpumask_clear_cpu(cpu_id, &cpu_callout_map); - cpumask_clear_cpu(cpu_id, &cpu_callin_map); - cpumask_clear_cpu(cpu_id, &cpu_initialized); - cpucount--; - return 1; - } - return 0; -} - -/** - * smp_show_cpu_info - Show SMP CPU information - * @cpu: The CPU of interest. - */ -static void __init smp_show_cpu_info(int cpu) -{ - struct mn10300_cpuinfo *ci = &cpu_data[cpu]; - - printk(KERN_INFO - "CPU#%d : ioclk speed: %lu.%02luMHz : bogomips : %lu.%02lu\n", - cpu, - MN10300_IOCLK / 1000000, - (MN10300_IOCLK / 10000) % 100, - ci->loops_per_jiffy / (500000 / HZ), - (ci->loops_per_jiffy / (5000 / HZ)) % 100); -} - -/** - * smp_callin - Set cpu_callin_map of the current CPU ID - */ -static void __init smp_callin(void) -{ - unsigned long timeout; - int cpu; - - cpu = smp_processor_id(); - timeout = jiffies + (2 * HZ); - - if (cpumask_test_cpu(cpu, &cpu_callin_map)) { - printk(KERN_ERR "CPU#%d already present.\n", cpu); - BUG(); - } - Dprintk("CPU#%d waiting for CALLOUT\n", cpu); - - /* Wait for AP startup 2s total */ - while (time_before(jiffies, timeout)) { - if (cpumask_test_cpu(cpu, &cpu_callout_map)) - break; - cpu_relax(); - } - - if (!time_before(jiffies, timeout)) { - printk(KERN_ERR - "BUG: CPU#%d started up but did not get a callout!\n", - cpu); - BUG(); - } - -#ifdef CONFIG_CALIBRATE_DELAY - calibrate_delay(); /* Get our bogomips */ -#endif - - /* Save our processor parameters */ - smp_store_cpu_info(cpu); - - /* Allow the boot processor to continue */ - cpumask_set_cpu(cpu, &cpu_callin_map); -} - -/** - * smp_online - Set cpu_online_mask - */ -static void __init smp_online(void) -{ - int cpu; - - cpu = smp_processor_id(); - - notify_cpu_starting(cpu); - - set_cpu_online(cpu, true); - - local_irq_enable(); -} - -/** - * smp_cpus_done - - * @max_cpus: Maximum CPU count. - * - * Do nothing. - */ -void __init smp_cpus_done(unsigned int max_cpus) -{ -} - -/* - * smp_prepare_boot_cpu - Set up stuff for the boot processor. - * - * Set up the cpu_online_mask, cpu_callout_map and cpu_callin_map of the boot - * processor (CPU 0). - */ -void smp_prepare_boot_cpu(void) -{ - cpumask_set_cpu(0, &cpu_callout_map); - cpumask_set_cpu(0, &cpu_callin_map); - current_thread_info()->cpu = 0; -} - -/* - * initialize_secondary - Initialise a secondary CPU (Application Processor). - * - * Set SP register and jump to thread's PC address. - */ -void initialize_secondary(void) -{ - asm volatile ( - "mov %0,sp \n" - "jmp (%1) \n" - : - : "a"(current->thread.sp), "a"(current->thread.pc)); -} - -/** - * __cpu_up - Set smp_commenced_mask for the nominated CPU - * @cpu: The target CPU. - */ -int __cpu_up(unsigned int cpu, struct task_struct *tidle) -{ - int timeout; - -#ifdef CONFIG_HOTPLUG_CPU - if (sleep_mode[cpu]) - run_wakeup_cpu(cpu); -#endif /* CONFIG_HOTPLUG_CPU */ - - cpumask_set_cpu(cpu, &smp_commenced_mask); - - /* Wait 5s total for a response */ - for (timeout = 0 ; timeout < 5000 ; timeout++) { - if (cpu_online(cpu)) - break; - udelay(1000); - } - - BUG_ON(!cpu_online(cpu)); - return 0; -} - -/** - * setup_profiling_timer - Set up the profiling timer - * @multiplier - The frequency multiplier to use - * - * The frequency of the profiling timer can be changed by writing a multiplier - * value into /proc/profile. - */ -int setup_profiling_timer(unsigned int multiplier) -{ - return -EINVAL; -} - -/* - * CPU hotplug routines - */ -#ifdef CONFIG_HOTPLUG_CPU - -static DEFINE_PER_CPU(struct cpu, cpu_devices); - -static int __init topology_init(void) -{ - int cpu, ret; - - for_each_cpu(cpu) { - ret = register_cpu(&per_cpu(cpu_devices, cpu), cpu, NULL); - if (ret) - printk(KERN_WARNING - "topology_init: register_cpu %d failed (%d)\n", - cpu, ret); - } - return 0; -} - -subsys_initcall(topology_init); - -int __cpu_disable(void) -{ - int cpu = smp_processor_id(); - if (cpu == 0) - return -EBUSY; - - migrate_irqs(); - cpumask_clear_cpu(cpu, &mm_cpumask(current->active_mm)); - return 0; -} - -void __cpu_die(unsigned int cpu) -{ - run_sleep_cpu(cpu); -} - -#ifdef CONFIG_MN10300_CACHE_ENABLED -static inline void hotplug_cpu_disable_cache(void) -{ - int tmp; - asm volatile( - " movhu (%1),%0 \n" - " and %2,%0 \n" - " movhu %0,(%1) \n" - "1: movhu (%1),%0 \n" - " btst %3,%0 \n" - " bne 1b \n" - : "=&r"(tmp) - : "a"(&CHCTR), - "i"(~(CHCTR_ICEN | CHCTR_DCEN)), - "i"(CHCTR_ICBUSY | CHCTR_DCBUSY) - : "memory", "cc"); -} - -static inline void hotplug_cpu_enable_cache(void) -{ - int tmp; - asm volatile( - "movhu (%1),%0 \n" - "or %2,%0 \n" - "movhu %0,(%1) \n" - : "=&r"(tmp) - : "a"(&CHCTR), - "i"(CHCTR_ICEN | CHCTR_DCEN) - : "memory", "cc"); -} - -static inline void hotplug_cpu_invalidate_cache(void) -{ - int tmp; - asm volatile ( - "movhu (%1),%0 \n" - "or %2,%0 \n" - "movhu %0,(%1) \n" - : "=&r"(tmp) - : "a"(&CHCTR), - "i"(CHCTR_ICINV | CHCTR_DCINV) - : "cc"); -} - -#else /* CONFIG_MN10300_CACHE_ENABLED */ -#define hotplug_cpu_disable_cache() do {} while (0) -#define hotplug_cpu_enable_cache() do {} while (0) -#define hotplug_cpu_invalidate_cache() do {} while (0) -#endif /* CONFIG_MN10300_CACHE_ENABLED */ - -/** - * hotplug_cpu_nmi_call_function - Call a function on other CPUs for hotplug - * @cpumask: List of target CPUs. - * @func: The function to call on those CPUs. - * @info: The context data for the function to be called. - * @wait: Whether to wait for the calls to complete. - * - * Non-maskably call a function on another CPU for hotplug purposes. - * - * This function must be called with maskable interrupts disabled. - */ -static int hotplug_cpu_nmi_call_function(cpumask_t cpumask, - smp_call_func_t func, void *info, - int wait) -{ - /* - * The address and the size of nmi_call_func_mask_data - * need to be aligned on L1_CACHE_BYTES. - */ - static struct nmi_call_data_struct nmi_call_func_mask_data - __cacheline_aligned; - unsigned long start, end; - - start = (unsigned long)&nmi_call_func_mask_data; - end = start + sizeof(struct nmi_call_data_struct); - - nmi_call_func_mask_data.func = func; - nmi_call_func_mask_data.info = info; - nmi_call_func_mask_data.started = cpumask; - nmi_call_func_mask_data.wait = wait; - if (wait) - nmi_call_func_mask_data.finished = cpumask; - - spin_lock(&smp_nmi_call_lock); - nmi_call_data = &nmi_call_func_mask_data; - mn10300_local_dcache_flush_range(start, end); - smp_wmb(); - - send_IPI_mask(cpumask, CALL_FUNCTION_NMI_IPI); - - do { - mn10300_local_dcache_inv_range(start, end); - barrier(); - } while (!cpumask_empty(&nmi_call_func_mask_data.started)); - - if (wait) { - do { - mn10300_local_dcache_inv_range(start, end); - barrier(); - } while (!cpumask_empty(&nmi_call_func_mask_data.finished)); - } - - spin_unlock(&smp_nmi_call_lock); - return 0; -} - -static void restart_wakeup_cpu(void) -{ - unsigned int cpu = smp_processor_id(); - - cpumask_set_cpu(cpu, &cpu_callin_map); - local_flush_tlb(); - set_cpu_online(cpu, true); - smp_wmb(); -} - -static void prepare_sleep_cpu(void *unused) -{ - sleep_mode[smp_processor_id()] = 1; - smp_mb(); - mn10300_local_dcache_flush_inv(); - hotplug_cpu_disable_cache(); - hotplug_cpu_invalidate_cache(); -} - -/* when this function called, IE=0, NMID=0. */ -static void sleep_cpu(void *unused) -{ - unsigned int cpu_id = smp_processor_id(); - /* - * CALL_FUNCTION_NMI_IPI for wakeup_cpu() shall not be requested, - * before this cpu goes in SLEEP mode. - */ - do { - smp_mb(); - __sleep_cpu(); - } while (sleep_mode[cpu_id]); - restart_wakeup_cpu(); -} - -static void run_sleep_cpu(unsigned int cpu) -{ - unsigned long flags; - cpumask_t cpumask; - - cpumask_copy(&cpumask, &cpumask_of(cpu)); - flags = arch_local_cli_save(); - hotplug_cpu_nmi_call_function(cpumask, prepare_sleep_cpu, NULL, 1); - hotplug_cpu_nmi_call_function(cpumask, sleep_cpu, NULL, 0); - udelay(1); /* delay for the cpu to sleep. */ - arch_local_irq_restore(flags); -} - -static void wakeup_cpu(void) -{ - hotplug_cpu_invalidate_cache(); - hotplug_cpu_enable_cache(); - smp_mb(); - sleep_mode[smp_processor_id()] = 0; -} - -static void run_wakeup_cpu(unsigned int cpu) -{ - unsigned long flags; - - flags = arch_local_cli_save(); -#if NR_CPUS == 2 - mn10300_local_dcache_flush_inv(); -#else - /* - * Before waking up the cpu, - * all online cpus should stop and flush D-Cache for global data. - */ -#error not support NR_CPUS > 2, when CONFIG_HOTPLUG_CPU=y. -#endif - hotplug_cpu_nmi_call_function(cpumask_of(cpu), wakeup_cpu, NULL, 1); - arch_local_irq_restore(flags); -} - -#endif /* CONFIG_HOTPLUG_CPU */ diff --git a/arch/mn10300/kernel/switch_to.S b/arch/mn10300/kernel/switch_to.S deleted file mode 100644 index de3e74fc9ea04..0000000000000 --- a/arch/mn10300/kernel/switch_to.S +++ /dev/null @@ -1,179 +0,0 @@ -############################################################################### -# -# MN10300 Context switch operation -# -# Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. -# Written by David Howells (dhowells@redhat.com) -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public Licence -# as published by the Free Software Foundation; either version -# 2 of the Licence, or (at your option) any later version. -# -############################################################################### -#include -#include -#include -#include -#ifdef CONFIG_SMP -#include -#endif /* CONFIG_SMP */ - - .text - -############################################################################### -# -# struct task_struct *__switch_to(struct thread_struct *prev, -# struct thread_struct *next, -# struct task_struct *prev_task) -# -############################################################################### -ENTRY(__switch_to) - movm [d2,d3,a2,a3,exreg1],(sp) - or EPSW_NMID,epsw - - mov (44,sp),d2 - - mov d0,a0 - mov d1,a1 - - # save prev context - mov __switch_back,d0 - mov sp,a2 - mov a2,(THREAD_SP,a0) - mov a3,(THREAD_A3,a0) - -#ifdef CONFIG_KGDB - btst 0xff,(kgdb_single_step) - bne __switch_to__lift_sstep_bp -__switch_to__continue: -#endif - mov d0,(THREAD_PC,a0) - - mov (THREAD_A3,a1),a3 - mov (THREAD_SP,a1),a2 - - # switch - mov a2,sp - - # load next context - GET_THREAD_INFO a2 - mov a2,(__current_ti) - mov (TI_task,a2),a2 - mov a2,(__current) -#ifdef CONFIG_MN10300_CURRENT_IN_E2 - mov a2,e2 -#endif - - mov (THREAD_PC,a1),a2 - mov d2,d0 # for ret_from_fork - mov d0,a0 # for __switch_to - - jmp (a2) - -__switch_back: - and ~EPSW_NMID,epsw - ret [d2,d3,a2,a3,exreg1],32 - -#ifdef CONFIG_KGDB -############################################################################### -# -# Lift the single-step breakpoints when the task being traced is switched out -# A0 = prev -# A1 = next -# -############################################################################### -__switch_to__lift_sstep_bp: - add -12,sp - mov a0,e4 - mov a1,e5 - - # Clear the single-step flag to prevent us coming this way until we get - # switched back in - bclr 0xff,(kgdb_single_step) - - # Remove first breakpoint - mov (kgdb_sstep_bp_addr),a2 - cmp 0,a2 - beq 1f - movbu (kgdb_sstep_bp),d0 - movbu d0,(a2) -#if defined(CONFIG_MN10300_CACHE_FLUSH_ICACHE) || defined(CONFIG_MN10300_CACHE_INV_ICACHE) - mov a2,d0 - mov a2,d1 - add 1,d1 - calls flush_icache_range -#endif -1: - - # Remove second breakpoint - mov (kgdb_sstep_bp_addr+4),a2 - cmp 0,a2 - beq 2f - movbu (kgdb_sstep_bp+1),d0 - movbu d0,(a2) -#if defined(CONFIG_MN10300_CACHE_FLUSH_ICACHE) || defined(CONFIG_MN10300_CACHE_INV_ICACHE) - mov a2,d0 - mov a2,d1 - add 1,d1 - calls flush_icache_range -#endif -2: - - # Change the resumption address and return - mov __switch_back__reinstall_sstep_bp,d0 - mov e4,a0 - mov e5,a1 - add 12,sp - bra __switch_to__continue - -############################################################################### -# -# Reinstall the single-step breakpoints when the task being traced is switched -# back in (A1 points to the new thread_struct). -# -############################################################################### -__switch_back__reinstall_sstep_bp: - add -12,sp - mov a0,e4 # save the return value - mov 0xff,d3 - - # Reinstall first breakpoint - mov (kgdb_sstep_bp_addr),a2 - cmp 0,a2 - beq 1f - movbu (a2),d0 - movbu d0,(kgdb_sstep_bp) - movbu d3,(a2) -#if defined(CONFIG_MN10300_CACHE_FLUSH_ICACHE) || defined(CONFIG_MN10300_CACHE_INV_ICACHE) - mov a2,d0 - mov a2,d1 - add 1,d1 - calls flush_icache_range -#endif -1: - - # Reinstall second breakpoint - mov (kgdb_sstep_bp_addr+4),a2 - cmp 0,a2 - beq 2f - movbu (a2),d0 - movbu d0,(kgdb_sstep_bp+1) - movbu d3,(a2) -#if defined(CONFIG_MN10300_CACHE_FLUSH_ICACHE) || defined(CONFIG_MN10300_CACHE_INV_ICACHE) - mov a2,d0 - mov a2,d1 - add 1,d1 - calls flush_icache_range -#endif -2: - - mov d3,(kgdb_single_step) - - # Restore the return value (the previous thread_struct pointer) - mov e4,a0 - mov a0,d0 - add 12,sp - bra __switch_back - -#endif /* CONFIG_KGDB */ diff --git a/arch/mn10300/kernel/sys_mn10300.c b/arch/mn10300/kernel/sys_mn10300.c deleted file mode 100644 index f999981e55c06..0000000000000 --- a/arch/mn10300/kernel/sys_mn10300.c +++ /dev/null @@ -1,33 +0,0 @@ -/* MN10300 Weird system calls - * - * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd. - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -asmlinkage long old_mmap(unsigned long addr, unsigned long len, - unsigned long prot, unsigned long flags, - unsigned long fd, unsigned long offset) -{ - if (offset & ~PAGE_MASK) - return -EINVAL; - return sys_mmap_pgoff(addr, len, prot, flags, fd, offset >> PAGE_SHIFT); -} diff --git a/arch/mn10300/kernel/time.c b/arch/mn10300/kernel/time.c deleted file mode 100644 index 06b83b17c5f19..0000000000000 --- a/arch/mn10300/kernel/time.c +++ /dev/null @@ -1,125 +0,0 @@ -/* MN10300 Low level time management - * - * Copyright (C) 2007-2008 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - Derived from arch/i386/kernel/time.c - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "internal.h" - -static unsigned long mn10300_last_tsc; /* time-stamp counter at last time - * interrupt occurred */ - -static unsigned long sched_clock_multiplier; - -/* - * scheduler clock - returns current time in nanosec units. - */ -unsigned long long sched_clock(void) -{ - union { - unsigned long long ll; - unsigned l[2]; - } tsc64, result; - unsigned long tmp; - unsigned product[3]; /* 96-bit intermediate value */ - - /* cnt32_to_63() is not safe with preemption */ - preempt_disable(); - - /* expand the tsc to 64-bits. - * - sched_clock() must be called once a minute or better or the - * following will go horribly wrong - see cnt32_to_63() - */ - tsc64.ll = cnt32_to_63(get_cycles()) & 0x7fffffffffffffffULL; - - preempt_enable(); - - /* scale the 64-bit TSC value to a nanosecond value via a 96-bit - * intermediate - */ - asm("mulu %2,%0,%3,%0 \n" /* LSW * mult -> 0:%3:%0 */ - "mulu %2,%1,%2,%1 \n" /* MSW * mult -> %2:%1:0 */ - "add %3,%1 \n" - "addc 0,%2 \n" /* result in %2:%1:%0 */ - : "=r"(product[0]), "=r"(product[1]), "=r"(product[2]), "=r"(tmp) - : "0"(tsc64.l[0]), "1"(tsc64.l[1]), "2"(sched_clock_multiplier) - : "cc"); - - result.l[0] = product[1] << 16 | product[0] >> 16; - result.l[1] = product[2] << 16 | product[1] >> 16; - - return result.ll; -} - -/* - * initialise the scheduler clock - */ -static void __init mn10300_sched_clock_init(void) -{ - sched_clock_multiplier = - __muldiv64u(NSEC_PER_SEC, 1 << 16, MN10300_TSCCLK); -} - -/** - * local_timer_interrupt - Local timer interrupt handler - * - * Handle local timer interrupts for this CPU. They may have been propagated - * to this CPU from the CPU that actually gets them by way of an IPI. - */ -irqreturn_t local_timer_interrupt(void) -{ - profile_tick(CPU_PROFILING); - update_process_times(user_mode(get_irq_regs())); - return IRQ_HANDLED; -} - -/* - * initialise the various timers used by the main part of the kernel - */ -void __init time_init(void) -{ - /* we need the prescalar running to be able to use IOCLK/8 - * - IOCLK runs at 1/4 (ST5 open) or 1/8 (ST5 closed) internal CPU clock - * - IOCLK runs at Fosc rate (crystal speed) - */ - TMPSCNT |= TMPSCNT_ENABLE; - - init_clocksource(); - - printk(KERN_INFO - "timestamp counter I/O clock running at %lu.%02lu" - " (calibrated against RTC)\n", - MN10300_TSCCLK / 1000000, (MN10300_TSCCLK / 10000) % 100); - - mn10300_last_tsc = read_timestamp_counter(); - - init_clockevents(); - -#ifdef CONFIG_MN10300_WD_TIMER - /* start the watchdog timer */ - watchdog_go(); -#endif - - mn10300_sched_clock_init(); -} diff --git a/arch/mn10300/kernel/traps.c b/arch/mn10300/kernel/traps.c deleted file mode 100644 index 72d1015b2ae7d..0000000000000 --- a/arch/mn10300/kernel/traps.c +++ /dev/null @@ -1,615 +0,0 @@ -/* MN10300 Exception handling - * - * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd. - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Modified by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "internal.h" - -#if (CONFIG_INTERRUPT_VECTOR_BASE & 0xffffff) -#error "INTERRUPT_VECTOR_BASE not aligned to 16MiB boundary!" -#endif - -int kstack_depth_to_print = 24; - -spinlock_t die_lock = __SPIN_LOCK_UNLOCKED(die_lock); - -struct exception_to_signal_map { - u8 signo; - u32 si_code; -}; - -static const struct exception_to_signal_map exception_to_signal_map[256] = { - /* MMU exceptions */ - [EXCEP_ITLBMISS >> 3] = { 0, 0 }, - [EXCEP_DTLBMISS >> 3] = { 0, 0 }, - [EXCEP_IAERROR >> 3] = { 0, 0 }, - [EXCEP_DAERROR >> 3] = { 0, 0 }, - - /* system exceptions */ - [EXCEP_TRAP >> 3] = { SIGTRAP, TRAP_BRKPT }, - [EXCEP_ISTEP >> 3] = { SIGTRAP, TRAP_TRACE }, /* Monitor */ - [EXCEP_IBREAK >> 3] = { SIGTRAP, TRAP_HWBKPT }, /* Monitor */ - [EXCEP_OBREAK >> 3] = { SIGTRAP, TRAP_HWBKPT }, /* Monitor */ - [EXCEP_PRIVINS >> 3] = { SIGILL, ILL_PRVOPC }, - [EXCEP_UNIMPINS >> 3] = { SIGILL, ILL_ILLOPC }, - [EXCEP_UNIMPEXINS >> 3] = { SIGILL, ILL_ILLOPC }, - [EXCEP_MEMERR >> 3] = { SIGSEGV, SEGV_ACCERR }, - [EXCEP_MISALIGN >> 3] = { SIGBUS, BUS_ADRALN }, - [EXCEP_BUSERROR >> 3] = { SIGBUS, BUS_ADRERR }, - [EXCEP_ILLINSACC >> 3] = { SIGSEGV, SEGV_ACCERR }, - [EXCEP_ILLDATACC >> 3] = { SIGSEGV, SEGV_ACCERR }, - [EXCEP_IOINSACC >> 3] = { SIGSEGV, SEGV_ACCERR }, - [EXCEP_PRIVINSACC >> 3] = { SIGSEGV, SEGV_ACCERR }, /* userspace */ - [EXCEP_PRIVDATACC >> 3] = { SIGSEGV, SEGV_ACCERR }, /* userspace */ - [EXCEP_DATINSACC >> 3] = { SIGSEGV, SEGV_ACCERR }, - [EXCEP_DOUBLE_FAULT >> 3] = { SIGILL, ILL_BADSTK }, - - /* FPU exceptions */ - [EXCEP_FPU_DISABLED >> 3] = { SIGILL, ILL_COPROC }, - [EXCEP_FPU_UNIMPINS >> 3] = { SIGILL, ILL_COPROC }, - [EXCEP_FPU_OPERATION >> 3] = { SIGFPE, FPE_INTDIV }, - - /* interrupts */ - [EXCEP_WDT >> 3] = { SIGALRM, 0 }, - [EXCEP_NMI >> 3] = { SIGQUIT, 0 }, - [EXCEP_IRQ_LEVEL0 >> 3] = { SIGINT, 0 }, - [EXCEP_IRQ_LEVEL1 >> 3] = { 0, 0 }, - [EXCEP_IRQ_LEVEL2 >> 3] = { 0, 0 }, - [EXCEP_IRQ_LEVEL3 >> 3] = { 0, 0 }, - [EXCEP_IRQ_LEVEL4 >> 3] = { 0, 0 }, - [EXCEP_IRQ_LEVEL5 >> 3] = { 0, 0 }, - [EXCEP_IRQ_LEVEL6 >> 3] = { 0, 0 }, - - /* system calls */ - [EXCEP_SYSCALL0 >> 3] = { 0, 0 }, - [EXCEP_SYSCALL1 >> 3] = { SIGILL, ILL_ILLTRP }, - [EXCEP_SYSCALL2 >> 3] = { SIGILL, ILL_ILLTRP }, - [EXCEP_SYSCALL3 >> 3] = { SIGILL, ILL_ILLTRP }, - [EXCEP_SYSCALL4 >> 3] = { SIGILL, ILL_ILLTRP }, - [EXCEP_SYSCALL5 >> 3] = { SIGILL, ILL_ILLTRP }, - [EXCEP_SYSCALL6 >> 3] = { SIGILL, ILL_ILLTRP }, - [EXCEP_SYSCALL7 >> 3] = { SIGILL, ILL_ILLTRP }, - [EXCEP_SYSCALL8 >> 3] = { SIGILL, ILL_ILLTRP }, - [EXCEP_SYSCALL9 >> 3] = { SIGILL, ILL_ILLTRP }, - [EXCEP_SYSCALL10 >> 3] = { SIGILL, ILL_ILLTRP }, - [EXCEP_SYSCALL11 >> 3] = { SIGILL, ILL_ILLTRP }, - [EXCEP_SYSCALL12 >> 3] = { SIGILL, ILL_ILLTRP }, - [EXCEP_SYSCALL13 >> 3] = { SIGILL, ILL_ILLTRP }, - [EXCEP_SYSCALL14 >> 3] = { SIGILL, ILL_ILLTRP }, - [EXCEP_SYSCALL15 >> 3] = { SIGABRT, 0 }, -}; - -/* - * Handle kernel exceptions. - * - * See if there's a fixup handler we can force a jump to when an exception - * happens due to something kernel code did - */ -int die_if_no_fixup(const char *str, struct pt_regs *regs, - enum exception_code code) -{ - u8 opcode; - int signo, si_code; - - if (user_mode(regs)) - return 0; - - peripheral_leds_display_exception(code); - - signo = exception_to_signal_map[code >> 3].signo; - si_code = exception_to_signal_map[code >> 3].si_code; - - switch (code) { - /* see if we can fixup the kernel accessing memory */ - case EXCEP_ITLBMISS: - case EXCEP_DTLBMISS: - case EXCEP_IAERROR: - case EXCEP_DAERROR: - case EXCEP_MEMERR: - case EXCEP_MISALIGN: - case EXCEP_BUSERROR: - case EXCEP_ILLDATACC: - case EXCEP_IOINSACC: - case EXCEP_PRIVINSACC: - case EXCEP_PRIVDATACC: - case EXCEP_DATINSACC: - if (fixup_exception(regs)) - return 1; - break; - - case EXCEP_TRAP: - case EXCEP_UNIMPINS: - if (probe_kernel_read(&opcode, (u8 *)regs->pc, 1) < 0) - break; - if (opcode == 0xff) { - if (notify_die(DIE_BREAKPOINT, str, regs, code, 0, 0)) - return 1; - if (at_debugger_breakpoint(regs)) - regs->pc++; - signo = SIGTRAP; - si_code = TRAP_BRKPT; - } - break; - - case EXCEP_SYSCALL1 ... EXCEP_SYSCALL14: - /* syscall return addr is _after_ the instruction */ - regs->pc -= 2; - break; - - case EXCEP_SYSCALL15: - if (report_bug(regs->pc, regs) == BUG_TRAP_TYPE_WARN) - return 1; - - /* syscall return addr is _after_ the instruction */ - regs->pc -= 2; - break; - - default: - break; - } - - if (debugger_intercept(code, signo, si_code, regs) == 0) - return 1; - - if (notify_die(DIE_GPF, str, regs, code, 0, 0)) - return 1; - - /* make the process die as the last resort */ - die(str, regs, code); -} - -/* - * General exception handler - */ -asmlinkage void handle_exception(struct pt_regs *regs, u32 intcode) -{ - siginfo_t info; - - /* deal with kernel exceptions here */ - if (die_if_no_fixup(NULL, regs, intcode)) - return; - - /* otherwise it's a userspace exception */ - info.si_signo = exception_to_signal_map[intcode >> 3].signo; - info.si_code = exception_to_signal_map[intcode >> 3].si_code; - info.si_errno = 0; - info.si_addr = (void *) regs->pc; - force_sig_info(info.si_signo, &info, current); -} - -/* - * handle NMI - */ -asmlinkage void nmi(struct pt_regs *regs, enum exception_code code) -{ - /* see if gdbstub wants to deal with it */ - if (debugger_intercept(code, SIGQUIT, 0, regs)) - return; - - printk(KERN_WARNING "--- Register Dump ---\n"); - show_registers(regs); - printk(KERN_WARNING "---------------------\n"); -} - -/* - * show a stack trace from the specified stack pointer - */ -void show_trace(unsigned long *sp) -{ - unsigned long bottom, stack, addr, fp, raslot; - - printk(KERN_EMERG "\nCall Trace:\n"); - - //stack = (unsigned long)sp; - asm("mov sp,%0" : "=a"(stack)); - asm("mov a3,%0" : "=r"(fp)); - - raslot = ULONG_MAX; - bottom = (stack + THREAD_SIZE) & ~(THREAD_SIZE - 1); - for (; stack < bottom; stack += sizeof(addr)) { - addr = *(unsigned long *)stack; - if (stack == fp) { - if (addr > stack && addr < bottom) { - fp = addr; - raslot = stack + sizeof(addr); - continue; - } - fp = 0; - raslot = ULONG_MAX; - } - - if (__kernel_text_address(addr)) { - printk(" [<%08lx>]", addr); - if (stack >= raslot) - raslot = ULONG_MAX; - else - printk(" ?"); - printk(" %pS\n", (void *)addr); - } - } - - printk("\n"); -} - -/* - * show the raw stack from the specified stack pointer - */ -void show_stack(struct task_struct *task, unsigned long *sp) -{ - unsigned long *stack; - int i; - - if (!sp) - sp = (unsigned long *) &sp; - - stack = sp; - printk(KERN_EMERG "Stack:"); - for (i = 0; i < kstack_depth_to_print; i++) { - if (((long) stack & (THREAD_SIZE - 1)) == 0) - break; - if ((i % 8) == 0) - printk(KERN_EMERG " "); - printk("%08lx ", *stack++); - } - - show_trace(sp); -} - -/* - * dump the register file in the specified exception frame - */ -void show_registers_only(struct pt_regs *regs) -{ - unsigned long ssp; - - ssp = (unsigned long) regs + sizeof(*regs); - - printk(KERN_EMERG "PC: %08lx EPSW: %08lx SSP: %08lx mode: %s\n", - regs->pc, regs->epsw, ssp, user_mode(regs) ? "User" : "Super"); - printk(KERN_EMERG "d0: %08lx d1: %08lx d2: %08lx d3: %08lx\n", - regs->d0, regs->d1, regs->d2, regs->d3); - printk(KERN_EMERG "a0: %08lx a1: %08lx a2: %08lx a3: %08lx\n", - regs->a0, regs->a1, regs->a2, regs->a3); - printk(KERN_EMERG "e0: %08lx e1: %08lx e2: %08lx e3: %08lx\n", - regs->e0, regs->e1, regs->e2, regs->e3); - printk(KERN_EMERG "e4: %08lx e5: %08lx e6: %08lx e7: %08lx\n", - regs->e4, regs->e5, regs->e6, regs->e7); - printk(KERN_EMERG "lar: %08lx lir: %08lx mdr: %08lx usp: %08lx\n", - regs->lar, regs->lir, regs->mdr, regs->sp); - printk(KERN_EMERG "cvf: %08lx crl: %08lx crh: %08lx drq: %08lx\n", - regs->mcvf, regs->mcrl, regs->mcrh, regs->mdrq); - printk(KERN_EMERG "threadinfo=%p task=%p)\n", - current_thread_info(), current); - - if ((unsigned long) current >= PAGE_OFFSET && - (unsigned long) current < (unsigned long)high_memory) - printk(KERN_EMERG "Process %s (pid: %d)\n", - current->comm, current->pid); - -#ifdef CONFIG_SMP - printk(KERN_EMERG "CPUID: %08x\n", CPUID); -#endif - printk(KERN_EMERG "CPUP: %04hx\n", CPUP); - printk(KERN_EMERG "TBR: %08x\n", TBR); - printk(KERN_EMERG "DEAR: %08x\n", DEAR); - printk(KERN_EMERG "sISR: %08x\n", sISR); - printk(KERN_EMERG "NMICR: %04hx\n", NMICR); - printk(KERN_EMERG "BCBERR: %08x\n", BCBERR); - printk(KERN_EMERG "BCBEAR: %08x\n", BCBEAR); - printk(KERN_EMERG "MMUFCR: %08x\n", MMUFCR); - printk(KERN_EMERG "IPTEU : %08x IPTEL2: %08x\n", IPTEU, IPTEL2); - printk(KERN_EMERG "DPTEU: %08x DPTEL2: %08x\n", DPTEU, DPTEL2); -} - -/* - * dump the registers and the stack - */ -void show_registers(struct pt_regs *regs) -{ - unsigned long sp; - int i; - - show_registers_only(regs); - - if (!user_mode(regs)) - sp = (unsigned long) regs + sizeof(*regs); - else - sp = regs->sp; - - /* when in-kernel, we also print out the stack and code at the - * time of the fault.. - */ - if (!user_mode(regs)) { - printk(KERN_EMERG "\n"); - show_stack(current, (unsigned long *) sp); - -#if 0 - printk(KERN_EMERG "\nCode: "); - if (regs->pc < PAGE_OFFSET) - goto bad; - - for (i = 0; i < 20; i++) { - unsigned char c; - if (__get_user(c, &((unsigned char *) regs->pc)[i])) - goto bad; - printk("%02x ", c); - } -#else - i = 0; -#endif - } - - printk("\n"); - return; - -#if 0 -bad: - printk(KERN_EMERG " Bad PC value."); - break; -#endif -} - -/* - * - */ -void show_trace_task(struct task_struct *tsk) -{ - unsigned long sp = tsk->thread.sp; - - /* User space on another CPU? */ - if ((sp ^ (unsigned long) tsk) & (PAGE_MASK << 1)) - return; - - show_trace((unsigned long *) sp); -} - -/* - * note the untimely death of part of the kernel - */ -void die(const char *str, struct pt_regs *regs, enum exception_code code) -{ - console_verbose(); - spin_lock_irq(&die_lock); - printk(KERN_EMERG "\n%s: %04x\n", - str, code & 0xffff); - show_registers(regs); - - if (regs->pc >= 0x02000000 && regs->pc < 0x04000000 && - (regs->epsw & (EPSW_IM | EPSW_IE)) != (EPSW_IM | EPSW_IE)) { - printk(KERN_EMERG "Exception in usermode interrupt handler\n"); - printk(KERN_EMERG "\nPlease connect to kernel debugger !!\n"); - asm volatile ("0: bra 0b"); - } - - spin_unlock_irq(&die_lock); - do_exit(SIGSEGV); -} - -/* - * display the register file when the stack pointer gets clobbered - */ -asmlinkage void do_double_fault(struct pt_regs *regs) -{ - struct task_struct *tsk = current; - - strcpy(tsk->comm, "emergency tsk"); - tsk->pid = 0; - console_verbose(); - printk(KERN_EMERG "--- double fault ---\n"); - show_registers(regs); -} - -/* - * asynchronous bus error (external, usually I/O DMA) - */ -asmlinkage void io_bus_error(u32 bcberr, u32 bcbear, struct pt_regs *regs) -{ - console_verbose(); - - printk(KERN_EMERG "Asynchronous I/O Bus Error\n"); - printk(KERN_EMERG "==========================\n"); - - if (bcberr & BCBERR_BEME) - printk(KERN_EMERG "- Multiple recorded errors\n"); - - printk(KERN_EMERG "- Faulting Buses:%s%s%s\n", - bcberr & BCBERR_BEMR_CI ? " CPU-Ins-Fetch" : "", - bcberr & BCBERR_BEMR_CD ? " CPU-Data" : "", - bcberr & BCBERR_BEMR_DMA ? " DMA" : ""); - - printk(KERN_EMERG "- %s %s access made to %s at address %08x\n", - bcberr & BCBERR_BEBST ? "Burst" : "Single", - bcberr & BCBERR_BERW ? "Read" : "Write", - bcberr & BCBERR_BESB_MON ? "Monitor Space" : - bcberr & BCBERR_BESB_IO ? "Internal CPU I/O Space" : - bcberr & BCBERR_BESB_EX ? "External I/O Bus" : - bcberr & BCBERR_BESB_OPEX ? "External Memory Bus" : - "On Chip Memory", - bcbear - ); - - printk(KERN_EMERG "- Detected by the %s\n", - bcberr&BCBERR_BESD ? "Bus Control Unit" : "Slave Bus"); - -#ifdef CONFIG_PCI -#define BRIDGEREGB(X) (*(volatile __u8 *)(0xBE040000 + (X))) -#define BRIDGEREGW(X) (*(volatile __u16 *)(0xBE040000 + (X))) -#define BRIDGEREGL(X) (*(volatile __u32 *)(0xBE040000 + (X))) - - printk(KERN_EMERG "- PCI Memory Paging Reg: %08x\n", - *(volatile __u32 *) (0xBFFFFFF4)); - printk(KERN_EMERG "- PCI Bridge Base Address 0: %08x\n", - BRIDGEREGL(PCI_BASE_ADDRESS_0)); - printk(KERN_EMERG "- PCI Bridge AMPCI Base Address: %08x\n", - BRIDGEREGL(0x48)); - printk(KERN_EMERG "- PCI Bridge Command: %04hx\n", - BRIDGEREGW(PCI_COMMAND)); - printk(KERN_EMERG "- PCI Bridge Status: %04hx\n", - BRIDGEREGW(PCI_STATUS)); - printk(KERN_EMERG "- PCI Bridge Int Status: %08hx\n", - BRIDGEREGL(0x4c)); -#endif - - printk(KERN_EMERG "\n"); - show_registers(regs); - - panic("Halted due to asynchronous I/O Bus Error\n"); -} - -/* - * handle an exception for which a handler has not yet been installed - */ -asmlinkage void uninitialised_exception(struct pt_regs *regs, - enum exception_code code) -{ - - /* see if gdbstub wants to deal with it */ - if (debugger_intercept(code, SIGSYS, 0, regs) == 0) - return; - - peripheral_leds_display_exception(code); - printk(KERN_EMERG "Uninitialised Exception 0x%04x\n", code & 0xFFFF); - show_registers(regs); - - for (;;) - continue; -} - -/* - * set an interrupt stub to jump to a handler - * ! NOTE: this does *not* flush the caches - */ -void __init __set_intr_stub(enum exception_code code, void *handler) -{ - unsigned long addr; - u8 *vector = (u8 *)(CONFIG_INTERRUPT_VECTOR_BASE + code); - - addr = (unsigned long) handler - (unsigned long) vector; - vector[0] = 0xdc; /* JMP handler */ - vector[1] = addr; - vector[2] = addr >> 8; - vector[3] = addr >> 16; - vector[4] = addr >> 24; - vector[5] = 0xcb; - vector[6] = 0xcb; - vector[7] = 0xcb; -} - -/* - * set an interrupt stub to jump to a handler - */ -void __init set_intr_stub(enum exception_code code, void *handler) -{ - unsigned long addr; - u8 *vector = (u8 *)(CONFIG_INTERRUPT_VECTOR_BASE + code); - unsigned long flags; - - addr = (unsigned long) handler - (unsigned long) vector; - - flags = arch_local_cli_save(); - - vector[0] = 0xdc; /* JMP handler */ - vector[1] = addr; - vector[2] = addr >> 8; - vector[3] = addr >> 16; - vector[4] = addr >> 24; - vector[5] = 0xcb; - vector[6] = 0xcb; - vector[7] = 0xcb; - - arch_local_irq_restore(flags); - -#ifndef CONFIG_MN10300_CACHE_SNOOP - mn10300_dcache_flush_inv(); - mn10300_icache_inv(); -#endif -} - -/* - * initialise the exception table - */ -void __init trap_init(void) -{ - set_excp_vector(EXCEP_TRAP, handle_exception); - set_excp_vector(EXCEP_ISTEP, handle_exception); - set_excp_vector(EXCEP_IBREAK, handle_exception); - set_excp_vector(EXCEP_OBREAK, handle_exception); - - set_excp_vector(EXCEP_PRIVINS, handle_exception); - set_excp_vector(EXCEP_UNIMPINS, handle_exception); - set_excp_vector(EXCEP_UNIMPEXINS, handle_exception); - set_excp_vector(EXCEP_MEMERR, handle_exception); - set_excp_vector(EXCEP_MISALIGN, misalignment); - set_excp_vector(EXCEP_BUSERROR, handle_exception); - set_excp_vector(EXCEP_ILLINSACC, handle_exception); - set_excp_vector(EXCEP_ILLDATACC, handle_exception); - set_excp_vector(EXCEP_IOINSACC, handle_exception); - set_excp_vector(EXCEP_PRIVINSACC, handle_exception); - set_excp_vector(EXCEP_PRIVDATACC, handle_exception); - set_excp_vector(EXCEP_DATINSACC, handle_exception); - set_excp_vector(EXCEP_FPU_UNIMPINS, handle_exception); - set_excp_vector(EXCEP_FPU_OPERATION, fpu_exception); - - set_excp_vector(EXCEP_NMI, nmi); - - set_excp_vector(EXCEP_SYSCALL1, handle_exception); - set_excp_vector(EXCEP_SYSCALL2, handle_exception); - set_excp_vector(EXCEP_SYSCALL3, handle_exception); - set_excp_vector(EXCEP_SYSCALL4, handle_exception); - set_excp_vector(EXCEP_SYSCALL5, handle_exception); - set_excp_vector(EXCEP_SYSCALL6, handle_exception); - set_excp_vector(EXCEP_SYSCALL7, handle_exception); - set_excp_vector(EXCEP_SYSCALL8, handle_exception); - set_excp_vector(EXCEP_SYSCALL9, handle_exception); - set_excp_vector(EXCEP_SYSCALL10, handle_exception); - set_excp_vector(EXCEP_SYSCALL11, handle_exception); - set_excp_vector(EXCEP_SYSCALL12, handle_exception); - set_excp_vector(EXCEP_SYSCALL13, handle_exception); - set_excp_vector(EXCEP_SYSCALL14, handle_exception); - set_excp_vector(EXCEP_SYSCALL15, handle_exception); -} - -/* - * determine if a program counter value is a valid bug address - */ -int is_valid_bugaddr(unsigned long pc) -{ - return pc >= PAGE_OFFSET; -} diff --git a/arch/mn10300/kernel/vmlinux.lds.S b/arch/mn10300/kernel/vmlinux.lds.S deleted file mode 100644 index 2d5f1c3f1afbc..0000000000000 --- a/arch/mn10300/kernel/vmlinux.lds.S +++ /dev/null @@ -1,94 +0,0 @@ -/* MN10300 Main kernel linker script - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#define __VMLINUX_LDS__ -#include -#include -#include - -OUTPUT_FORMAT("elf32-am33lin", "elf32-am33lin", "elf32-am33lin") -OUTPUT_ARCH(mn10300) -ENTRY(_start) -jiffies = jiffies_64; -#ifndef CONFIG_MN10300_CURRENT_IN_E2 -current = __current; -#endif -SECTIONS -{ - . = CONFIG_KERNEL_TEXT_ADDRESS; - /* read-only */ - _stext = .; - _text = .; /* Text and read-only data */ - .text : { - HEAD_TEXT - TEXT_TEXT - SCHED_TEXT - CPUIDLE_TEXT - LOCK_TEXT - KPROBES_TEXT - *(.fixup) - *(.gnu.warning) - } = 0xcb - - _etext = .; /* End of text section */ - - EXCEPTION_TABLE(16) - BUG_TABLE - - RO_DATA(PAGE_SIZE) - - /* writeable */ - _sdata = .; /* Start of rw data section */ - RW_DATA_SECTION(32, PAGE_SIZE, THREAD_SIZE) - _edata = .; - - /* might get freed after init */ - . = ALIGN(PAGE_SIZE); - .smp_locks : AT(ADDR(.smp_locks) - LOAD_OFFSET) { - __smp_locks = .; - *(.smp_locks) - __smp_locks_end = .; - } - - /* will be freed after init */ - . = ALIGN(PAGE_SIZE); /* Init code and data */ - __init_begin = .; - INIT_TEXT_SECTION(PAGE_SIZE) - INIT_DATA_SECTION(16) - . = ALIGN(4); - __alt_instructions = .; - .altinstructions : { *(.altinstructions) } - __alt_instructions_end = .; - .altinstr_replacement : { *(.altinstr_replacement) } - /* .exit.text is discard at runtime, not link time, to deal with references - from .altinstructions and .eh_frame */ - .exit.text : { EXIT_TEXT; } - .exit.data : { EXIT_DATA; } - - PERCPU_SECTION(32) - . = ALIGN(PAGE_SIZE); - __init_end = .; - /* freed after init ends here */ - - BSS_SECTION(0, PAGE_SIZE, 4) - - _end = . ; - - /* This is where the kernel creates the early boot page tables */ - . = ALIGN(PAGE_SIZE); - pg0 = .; - - STABS_DEBUG - - DWARF_DEBUG - - /* Sections to be discarded */ - DISCARDS -} diff --git a/arch/mn10300/lib/Makefile b/arch/mn10300/lib/Makefile deleted file mode 100644 index 0cd2346f4c136..0000000000000 --- a/arch/mn10300/lib/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# -# Makefile for the MN10300-specific library files.. -# - -lib-y = delay.o usercopy.o checksum.o bitops.o memcpy.o memmove.o memset.o -lib-y += do_csum.o -lib-y += __ashldi3.o __ashrdi3.o __lshrdi3.o negdi2.o __ucmpdi2.o diff --git a/arch/mn10300/lib/__ashldi3.S b/arch/mn10300/lib/__ashldi3.S deleted file mode 100644 index a51a9506f00c1..0000000000000 --- a/arch/mn10300/lib/__ashldi3.S +++ /dev/null @@ -1,51 +0,0 @@ -/* MN10300 64-bit arithmetic left shift - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include - - .text - .balign L1_CACHE_BYTES - -############################################################################### -# -# unsigned long long __ashldi3(unsigned long long value [D1:D0], -# unsigned by [(12,SP)]) -# -############################################################################### - .globl __ashldi3 - .type __ashldi3,@function -__ashldi3: - mov (12,sp),a0 - and +63,a0 - beq __ashldi3_zero - - cmp +31,a0 - bhi __ashldi3_32plus - - # the count is in the range 1-31 - asl a0,d1 - - mov +32,a1 - sub a0,a1,a1 # a1 = 32 - count - lsr a1,d0,a1 # get overflow from LSW -> MSW - - or_asl a1,d1,a0,d0 # insert overflow into MSW and - # shift the LSW - rets - - .balign L1_CACHE_BYTES - # the count is in the range 32-63 -__ashldi3_32plus: - asl a0,d0,d1 - clr d0 -__ashldi3_zero: - rets - - .size __ashldi3, .-__ashldi3 diff --git a/arch/mn10300/lib/__ashrdi3.S b/arch/mn10300/lib/__ashrdi3.S deleted file mode 100644 index 6f42382728cb3..0000000000000 --- a/arch/mn10300/lib/__ashrdi3.S +++ /dev/null @@ -1,52 +0,0 @@ -/* MN10300 64-bit arithmetic right shift - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include - - .text - .balign L1_CACHE_BYTES - -############################################################################### -# -# unsigned long long __ashrdi3(unsigned long long value [D1:D0], -# unsigned by [(12,SP)]) -# -############################################################################### - .globl __ashrdi3 - .type __ashrdi3,@function -__ashrdi3: - mov (12,sp),a0 - and +63,a0 - beq __ashrdi3_zero - - cmp +31,a0 - bhi __ashrdi3_32plus - - # the count is in the range 1-31 - lsr a0,d0 - - mov +32,a1 - sub a0,a1,a1 # a1 = 32 - count - asl a1,d1,a1 # get underflow from MSW -> LSW - - or_asr a1,d0,a0,d1 # insert underflow into LSW and - # shift the MSW - rets - - .balign L1_CACHE_BYTES - # the count is in the range 32-63 -__ashrdi3_32plus: - asr a0,d1,d0 - ext d0 # sign-extend result through MDR - mov mdr,d1 -__ashrdi3_zero: - rets - - .size __ashrdi3, .-__ashrdi3 diff --git a/arch/mn10300/lib/__lshrdi3.S b/arch/mn10300/lib/__lshrdi3.S deleted file mode 100644 index a686aef31e904..0000000000000 --- a/arch/mn10300/lib/__lshrdi3.S +++ /dev/null @@ -1,52 +0,0 @@ -/* MN10300 64-bit logical right shift - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - -#include - - .text - .balign L1_CACHE_BYTES - -############################################################################### -# -# unsigned long long __lshrdi3(unsigned long long value [D1:D0], -# unsigned by [(12,SP)]) -# -############################################################################### - .globl __lshrdi3 - .type __lshrdi3,@function -__lshrdi3: - mov (12,sp),a0 - and +63,a0 - beq __lshrdi3_zero - - cmp +31,a0 - bhi __lshrdi3_32plus - - # the count is in the range 1-31 - lsr a0,d0 - - mov +32,a1 - sub a0,a1,a1 # a1 = 32 - count - asl a1,d1,a1 # get underflow from MSW -> LSW - - or_lsr a1,d0,a0,d1 # insert underflow into LSW and - # shift the MSW - rets - - .balign L1_CACHE_BYTES - # the count is in the range 32-63 -__lshrdi3_32plus: - lsr a0,d1,d0 - clr d1 -__lshrdi3_zero: - rets - - .size __lshrdi3, .-__lshrdi3 diff --git a/arch/mn10300/lib/__ucmpdi2.S b/arch/mn10300/lib/__ucmpdi2.S deleted file mode 100644 index 60dcbdfe386cf..0000000000000 --- a/arch/mn10300/lib/__ucmpdi2.S +++ /dev/null @@ -1,43 +0,0 @@ -/* __ucmpdi2.S: 64-bit unsigned compare - * - * Copyright (C) 2008 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - - - .text - .p2align 4 - -############################################################################### -# -# int __ucmpdi2(unsigned long long a [D0:D1], -# unsigned long long b [(SP,12),(SP,16)]) -# -# - returns 0, 1, or 2 as a <, =, > b respectively. -# -############################################################################### - .globl __ucmpdi2 - .type __ucmpdi2,@function -__ucmpdi2: - mov (12,sp),a0 # b.lsw - mov (16,sp),a1 # b.msw - - sub a0,d0 - subc a1,d1 # may clear Z, never sets it - bne __ucmpdi2_differ # a.msw != b.msw - mov +1,d0 - rets - -__ucmpdi2_differ: - # C flag is set if LE, clear if GE - subc d0,d0 # -1 if LE, 0 if GE - add +1,d0 # 0 if LE, 1 if GE - add d0,d0 # 0 if LE, 2 if GE - rets - - .size __ucmpdi2, .-__ucmpdi2 diff --git a/arch/mn10300/lib/ashrdi3.c b/arch/mn10300/lib/ashrdi3.c deleted file mode 100644 index c54f61ddf0b5c..0000000000000 --- a/arch/mn10300/lib/ashrdi3.c +++ /dev/null @@ -1,61 +0,0 @@ -/* ashrdi3.c extracted from gcc-2.7.2/libgcc2.c which is: */ -/* Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public Licence as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU CC 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 Licence for more details. - -You should have received a copy of the GNU General Public Licence -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#define BITS_PER_UNIT 8 - -typedef int SItype __attribute__((mode(SI))); -typedef unsigned int USItype __attribute__((mode(SI))); -typedef int DItype __attribute__((mode(DI))); -typedef int word_type __attribute__((mode(__word__))); - -struct DIstruct { - SItype low; - SItype high; -}; - -union DIunion { - struct DIstruct s; - DItype ll; -}; - -DItype __ashrdi3(DItype u, word_type b) -{ - union DIunion w; - union DIunion uu; - word_type bm; - - if (b == 0) - return u; - - uu.ll = u; - - bm = (sizeof(SItype) * BITS_PER_UNIT) - b; - if (bm <= 0) { - /* w.s.high = 1..1 or 0..0 */ - w.s.high = uu.s.high >> (sizeof(SItype) * BITS_PER_UNIT - 1); - w.s.low = uu.s.high >> -bm; - } else { - USItype carries = (USItype)uu.s.high << bm; - w.s.high = uu.s.high >> b; - w.s.low = ((USItype)uu.s.low >> b) | carries; - } - - return w.ll; -} diff --git a/arch/mn10300/lib/bitops.c b/arch/mn10300/lib/bitops.c deleted file mode 100644 index 37309cdb75840..0000000000000 --- a/arch/mn10300/lib/bitops.c +++ /dev/null @@ -1,50 +0,0 @@ -/* MN10300 Non-trivial bit operations - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include - -/* - * try flipping a bit using BSET and BCLR - */ -void change_bit(unsigned long nr, volatile void *addr) -{ - if (test_bit(nr, addr)) - goto try_clear_bit; - -try_set_bit: - if (!test_and_set_bit(nr, addr)) - return; - -try_clear_bit: - if (test_and_clear_bit(nr, addr)) - return; - - goto try_set_bit; -} - -/* - * try flipping a bit using BSET and BCLR and returning the old value - */ -int test_and_change_bit(unsigned long nr, volatile void *addr) -{ - if (test_bit(nr, addr)) - goto try_clear_bit; - -try_set_bit: - if (!test_and_set_bit(nr, addr)) - return 0; - -try_clear_bit: - if (test_and_clear_bit(nr, addr)) - return 1; - - goto try_set_bit; -} diff --git a/arch/mn10300/lib/checksum.c b/arch/mn10300/lib/checksum.c deleted file mode 100644 index 0f569151ef11b..0000000000000 --- a/arch/mn10300/lib/checksum.c +++ /dev/null @@ -1,100 +0,0 @@ -/* MN10300 Optimised checksumming wrappers - * - * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd. - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include -#include -#include -#include -#include "internal.h" - -static inline unsigned short from32to16(__wsum sum) -{ - asm(" add %1,%0 \n" - " addc 0xffff,%0 \n" - : "=r" (sum) - : "r" (sum << 16), "0" (sum & 0xffff0000) - : "cc" - ); - return sum >> 16; -} - -__sum16 ip_fast_csum(const void *iph, unsigned int ihl) -{ - return ~do_csum(iph, ihl * 4); -} -EXPORT_SYMBOL(ip_fast_csum); - -__wsum csum_partial(const void *buff, int len, __wsum sum) -{ - __wsum result; - - result = do_csum(buff, len); - result += sum; - if (sum > result) - result++; - return result; -} -EXPORT_SYMBOL(csum_partial); - -__sum16 ip_compute_csum(const void *buff, int len) -{ - return ~from32to16(do_csum(buff, len)); -} -EXPORT_SYMBOL(ip_compute_csum); - -__wsum csum_partial_copy(const void *src, void *dst, int len, __wsum sum) -{ - copy_from_user(dst, src, len); - return csum_partial(dst, len, sum); -} -EXPORT_SYMBOL(csum_partial_copy); - -__wsum csum_partial_copy_nocheck(const void *src, void *dst, - int len, __wsum sum) -{ - sum = csum_partial(src, len, sum); - memcpy(dst, src, len); - return sum; -} -EXPORT_SYMBOL(csum_partial_copy_nocheck); - -__wsum csum_partial_copy_from_user(const void *src, void *dst, - int len, __wsum sum, - int *err_ptr) -{ - int missing; - - missing = copy_from_user(dst, src, len); - if (missing) { - memset(dst + len - missing, 0, missing); - *err_ptr = -EFAULT; - } - - return csum_partial(dst, len, sum); -} -EXPORT_SYMBOL(csum_partial_copy_from_user); - -__wsum csum_and_copy_to_user(const void *src, void *dst, - int len, __wsum sum, - int *err_ptr) -{ - int missing; - - missing = copy_to_user(dst, src, len); - if (missing) { - memset(dst + len - missing, 0, missing); - *err_ptr = -EFAULT; - } - - return csum_partial(src, len, sum); -} -EXPORT_SYMBOL(csum_and_copy_to_user); diff --git a/arch/mn10300/lib/delay.c b/arch/mn10300/lib/delay.c deleted file mode 100644 index 8e7ceb8ba33dd..0000000000000 --- a/arch/mn10300/lib/delay.c +++ /dev/null @@ -1,51 +0,0 @@ -/* MN10300 Short delay interpolation routines - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include -#include -#include - -/* - * basic delay loop - */ -void __delay(unsigned long loops) -{ - int d0; - - asm volatile( - " bra 1f \n" - " .align 4 \n" - "1: bra 2f \n" - " .align 4 \n" - "2: add -1,%0 \n" - " bne 2b \n" - : "=&d" (d0) - : "0" (loops) - : "cc"); -} -EXPORT_SYMBOL(__delay); - -/* - * handle a delay specified in terms of microseconds - */ -void __udelay(unsigned long usecs) -{ - unsigned long start, stop, cnt; - - /* usecs * CLK / 1E6 */ - stop = __muldiv64u(usecs, MN10300_TSCCLK, 1000000); - start = TMTSCBC; - - do { - cnt = start - TMTSCBC; - } while (cnt < stop); -} -EXPORT_SYMBOL(__udelay); diff --git a/arch/mn10300/lib/do_csum.S b/arch/mn10300/lib/do_csum.S deleted file mode 100644 index 1d27bba0cd8fc..0000000000000 --- a/arch/mn10300/lib/do_csum.S +++ /dev/null @@ -1,157 +0,0 @@ -/* Optimised simple memory checksum - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include - - .section .text - .balign L1_CACHE_BYTES - -############################################################################### -# -# unsigned int do_csum(const unsigned char *buff, int len) -# -############################################################################### - .globl do_csum - .type do_csum,@function -do_csum: - movm [d2,d3],(sp) - mov d1,d2 # count - mov d0,a0 # buff - mov a0,a1 - clr d1 # accumulator - - cmp +0,d2 - ble do_csum_done # check for zero length or negative - - # 4-byte align the buffer pointer - btst +3,a0 - beq do_csum_now_4b_aligned - - btst +1,a0 - beq do_csum_addr_not_odd - movbu (a0),d0 - inc a0 - asl +8,d0 - add d0,d1 - add -1,d2 - -do_csum_addr_not_odd: - cmp +2,d2 - bcs do_csum_fewer_than_4 - btst +2,a0 - beq do_csum_now_4b_aligned - movhu (a0+),d0 - add d0,d1 - add -2,d2 - cmp +4,d2 - bcs do_csum_fewer_than_4 - -do_csum_now_4b_aligned: - # we want to checksum as much as we can in chunks of 32 bytes - cmp +31,d2 - bls do_csum_remainder # 4-byte aligned remainder - - add -32,d2 - mov +32,d3 - -do_csum_loop: - mov (a0+),d0 - mov (a0+),e0 - mov (a0+),e1 - mov (a0+),e3 - add d0,d1 - addc e0,d1 - addc e1,d1 - addc e3,d1 - mov (a0+),d0 - mov (a0+),e0 - mov (a0+),e1 - mov (a0+),e3 - addc d0,d1 - addc e0,d1 - addc e1,d1 - addc e3,d1 - addc +0,d1 - - sub d3,d2 - bcc do_csum_loop - - add d3,d2 - beq do_csum_done - -do_csum_remainder: - # cut 16-31 bytes down to 0-15 - cmp +16,d2 - bcs do_csum_fewer_than_16 - mov (a0+),d0 - mov (a0+),e0 - mov (a0+),e1 - mov (a0+),e3 - add d0,d1 - addc e0,d1 - addc e1,d1 - addc e3,d1 - addc +0,d1 - add -16,d2 - beq do_csum_done - -do_csum_fewer_than_16: - # copy the remaining whole words - cmp +4,d2 - bcs do_csum_fewer_than_4 - cmp +8,d2 - bcs do_csum_one_word - cmp +12,d2 - bcs do_csum_two_words - mov (a0+),d0 - add d0,d1 - addc +0,d1 -do_csum_two_words: - mov (a0+),d0 - add d0,d1 - addc +0,d1 -do_csum_one_word: - mov (a0+),d0 - add d0,d1 - addc +0,d1 - -do_csum_fewer_than_4: - and +3,d2 - beq do_csum_done - xor_cmp d0,d0,+2,d2 - bcs do_csum_fewer_than_2 - movhu (a0+),d0 - and +1,d2 - beq do_csum_add_last_bit -do_csum_fewer_than_2: - movbu (a0),d3 - add d3,d0 -do_csum_add_last_bit: - add d0,d1 - addc +0,d1 - -do_csum_done: - # compress the checksum down to 16 bits - mov +0xffff0000,d0 - and d1,d0 - asl +16,d1 - add d1,d0 - addc +0xffff,d0 - lsr +16,d0 - - # flip the halves of the word result if the buffer was oddly aligned - and +1,a1 - beq do_csum_not_oddly_aligned - swaph d0,d0 # exchange bits 15:8 with 7:0 - -do_csum_not_oddly_aligned: - ret [d2,d3],8 - - .size do_csum, .-do_csum diff --git a/arch/mn10300/lib/internal.h b/arch/mn10300/lib/internal.h deleted file mode 100644 index 0014eee5f04f1..0000000000000 --- a/arch/mn10300/lib/internal.h +++ /dev/null @@ -1,15 +0,0 @@ -/* Internal definitions for the arch part of the kernel library - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - -/* - * do_csum.S - */ -extern unsigned int do_csum(const unsigned char *, size_t); diff --git a/arch/mn10300/lib/lshrdi3.c b/arch/mn10300/lib/lshrdi3.c deleted file mode 100644 index e05e64e9ce969..0000000000000 --- a/arch/mn10300/lib/lshrdi3.c +++ /dev/null @@ -1,60 +0,0 @@ -/* lshrdi3.c extracted from gcc-2.7.2/libgcc2.c which is: */ -/* Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public Licence as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU CC 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 Licence for more details. - -You should have received a copy of the GNU General Public Licence -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -#define BITS_PER_UNIT 8 - -typedef int SItype __attribute__((mode(SI))); -typedef unsigned int USItype __attribute__((mode(SI))); -typedef int DItype __attribute__((mode(DI))); -typedef int word_type __attribute__((mode(__word__))); - -struct DIstruct { - SItype low; - SItype high; -}; - -union DIunion { - struct DIstruct s; - DItype ll; -}; - -DItype __lshrdi3(DItype u, word_type b) -{ - union DIunion w; - word_type bm; - union DIunion uu; - - if (b == 0) - return u; - - uu.ll = u; - - bm = (sizeof(SItype) * BITS_PER_UNIT) - b; - if (bm <= 0) { - w.s.high = 0; - w.s.low = (USItype) uu.s.high >> -bm; - } else { - USItype carries = (USItype) uu.s.high << bm; - w.s.high = (USItype) uu.s.high >> b; - w.s.low = ((USItype) uu.s.low >> b) | carries; - } - - return w.ll; -} diff --git a/arch/mn10300/lib/memcpy.S b/arch/mn10300/lib/memcpy.S deleted file mode 100644 index 25fb9bb2604f5..0000000000000 --- a/arch/mn10300/lib/memcpy.S +++ /dev/null @@ -1,135 +0,0 @@ -/* MN10300 Optimised simple memory to memory copy - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include - - .section .text - .balign L1_CACHE_BYTES - -############################################################################### -# -# void *memcpy(void *dst, const void *src, size_t n) -# -############################################################################### - .globl memcpy - .type memcpy,@function -memcpy: - movm [d2,d3],(sp) - mov d0,(12,sp) - mov d1,(16,sp) - mov (20,sp),d2 # count - mov d0,a0 # dst - mov d1,a1 # src - mov d0,e3 # the return value - - cmp +0,d2 - beq memcpy_done # return if zero-length copy - - # see if the three parameters are all four-byte aligned - or d0,d1,d3 - or d2,d3 - and +3,d3 - bne memcpy_1 # jump if not - - # we want to transfer as much as we can in chunks of 32 bytes - cmp +31,d2 - bls memcpy_4_remainder # 4-byte aligned remainder - - movm [exreg1],(sp) - add -32,d2 - mov +32,d3 - -memcpy_4_loop: - mov (a1+),d0 - mov (a1+),d1 - mov (a1+),e0 - mov (a1+),e1 - mov (a1+),e4 - mov (a1+),e5 - mov (a1+),e6 - mov (a1+),e7 - mov d0,(a0+) - mov d1,(a0+) - mov e0,(a0+) - mov e1,(a0+) - mov e4,(a0+) - mov e5,(a0+) - mov e6,(a0+) - mov e7,(a0+) - - sub d3,d2 - bcc memcpy_4_loop - - movm (sp),[exreg1] - add d3,d2 - beq memcpy_4_no_remainder - -memcpy_4_remainder: - # cut 4-7 words down to 0-3 - cmp +16,d2 - bcs memcpy_4_three_or_fewer_words - mov (a1+),d0 - mov (a1+),d1 - mov (a1+),e0 - mov (a1+),e1 - mov d0,(a0+) - mov d1,(a0+) - mov e0,(a0+) - mov e1,(a0+) - add -16,d2 - beq memcpy_4_no_remainder - - # copy the remaining 1, 2 or 3 words -memcpy_4_three_or_fewer_words: - cmp +8,d2 - bcs memcpy_4_one_word - beq memcpy_4_two_words - mov (a1+),d0 - mov d0,(a0+) -memcpy_4_two_words: - mov (a1+),d0 - mov d0,(a0+) -memcpy_4_one_word: - mov (a1+),d0 - mov d0,(a0+) - -memcpy_4_no_remainder: - # check we copied the correct amount - # TODO: REMOVE CHECK - sub e3,a0,d2 - mov (20,sp),d1 - cmp d2,d1 - beq memcpy_done - break - break - break - -memcpy_done: - mov e3,a0 - ret [d2,d3],8 - - # handle misaligned copying -memcpy_1: - add -1,d2 - mov +1,d3 - setlb # setlb requires the next insns - # to occupy exactly 4 bytes - - sub d3,d2 - movbu (a1),d0 - movbu d0,(a0) - add_add d3,a1,d3,a0 - lcc - - mov e3,a0 - ret [d2,d3],8 - -memcpy_end: - .size memcpy, memcpy_end-memcpy diff --git a/arch/mn10300/lib/memmove.S b/arch/mn10300/lib/memmove.S deleted file mode 100644 index 20b07b62b77c3..0000000000000 --- a/arch/mn10300/lib/memmove.S +++ /dev/null @@ -1,160 +0,0 @@ -/* MN10300 Optimised simple memory to memory copy, with support for overlapping - * regions - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include - - .section .text - .balign L1_CACHE_BYTES - -############################################################################### -# -# void *memmove(void *dst, const void *src, size_t n) -# -############################################################################### - .globl memmove - .type memmove,@function -memmove: - # fall back to memcpy if dst < src to work bottom up - cmp d1,d0 - bcs memmove_memcpy - - # work top down - movm [d2,d3],(sp) - mov d0,(12,sp) - mov d1,(16,sp) - mov (20,sp),d2 # count - add d0,d2,a0 # dst end - add d1,d2,a1 # src end - mov d0,e3 # the return value - - cmp +0,d2 - beq memmove_done # return if zero-length copy - - # see if the three parameters are all four-byte aligned - or d0,d1,d3 - or d2,d3 - and +3,d3 - bne memmove_1 # jump if not - - # we want to transfer as much as we can in chunks of 32 bytes - add -4,a1 - cmp +31,d2 - bls memmove_4_remainder # 4-byte aligned remainder - - add -32,d2 - mov +32,d3 - -memmove_4_loop: - mov (a1),d0 - sub_sub +4,a1,+4,a0 - mov d0,(a0) - mov (a1),d1 - sub_sub +4,a1,+4,a0 - mov d1,(a0) - - mov (a1),d0 - sub_sub +4,a1,+4,a0 - mov d0,(a0) - mov (a1),d1 - sub_sub +4,a1,+4,a0 - mov d1,(a0) - - mov (a1),d0 - sub_sub +4,a1,+4,a0 - mov d0,(a0) - mov (a1),d1 - sub_sub +4,a1,+4,a0 - mov d1,(a0) - - mov (a1),d0 - sub_sub +4,a1,+4,a0 - mov d0,(a0) - mov (a1),d1 - sub_sub +4,a1,+4,a0 - mov d1,(a0) - - sub d3,d2 - bcc memmove_4_loop - - add d3,d2 - beq memmove_4_no_remainder - -memmove_4_remainder: - # cut 4-7 words down to 0-3 - cmp +16,d2 - bcs memmove_4_three_or_fewer_words - mov (a1),d0 - sub_sub +4,a1,+4,a0 - mov d0,(a0) - mov (a1),d1 - sub_sub +4,a1,+4,a0 - mov d1,(a0) - mov (a1),e0 - sub_sub +4,a1,+4,a0 - mov e0,(a0) - mov (a1),e1 - sub_sub +4,a1,+4,a0 - mov e1,(a0) - add -16,d2 - beq memmove_4_no_remainder - - # copy the remaining 1, 2 or 3 words -memmove_4_three_or_fewer_words: - cmp +8,d2 - bcs memmove_4_one_word - beq memmove_4_two_words - mov (a1),d0 - sub_sub +4,a1,+4,a0 - mov d0,(a0) -memmove_4_two_words: - mov (a1),d0 - sub_sub +4,a1,+4,a0 - mov d0,(a0) -memmove_4_one_word: - mov (a1),d0 - sub_sub +4,a1,+4,a0 - mov d0,(a0) - -memmove_4_no_remainder: - # check we copied the correct amount - # TODO: REMOVE CHECK - sub e3,a0,d2 - beq memmove_done - break - break - break - -memmove_done: - mov e3,a0 - ret [d2,d3],8 - - # handle misaligned copying -memmove_1: - add -1,a1 - add -1,d2 - mov +1,d3 - setlb # setlb requires the next insns - # to occupy exactly 4 bytes - - sub d3,d2 - movbu (a1),d0 - sub_sub d3,a1,d3,a0 - movbu d0,(a0) - lcc - - mov e3,a0 - ret [d2,d3],8 - -memmove_memcpy: - jmp memcpy - -memmove_end: - .size memmove, memmove_end-memmove diff --git a/arch/mn10300/lib/memset.S b/arch/mn10300/lib/memset.S deleted file mode 100644 index bc02e39629b7f..0000000000000 --- a/arch/mn10300/lib/memset.S +++ /dev/null @@ -1,121 +0,0 @@ -/* Optimised simple memory fill - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include - - .section .text - .balign L1_CACHE_BYTES - -############################################################################### -# -# void *memset(void *dst, int c, size_t n) -# -############################################################################### - .globl memset - .type memset,@function -memset: - movm [d2,d3],(sp) - mov d0,(12,sp) - mov d1,(16,sp) - mov (20,sp),d2 # count - mov d0,a0 # dst - mov d0,e3 # the return value - - cmp +0,d2 - beq memset_done # return if zero-length fill - - # see if the region parameters are four-byte aligned - or d0,d2,d3 - and +3,d3 - bne memset_1 # jump if not - - extbu d1 - mov_asl d1,d3,8,d1 - or_asl d1,d3,8,d1 - or_asl d1,d3,8,d1 - or d3,d1 - - # we want to transfer as much as we can in chunks of 32 bytes - cmp +31,d2 - bls memset_4_remainder # 4-byte aligned remainder - - add -32,d2 - mov +32,d3 - -memset_4_loop: - mov d1,(a0+) - mov d1,(a0+) - mov d1,(a0+) - mov d1,(a0+) - mov d1,(a0+) - mov d1,(a0+) - mov d1,(a0+) - mov d1,(a0+) - - sub d3,d2 - bcc memset_4_loop - - add d3,d2 - beq memset_4_no_remainder - -memset_4_remainder: - # cut 4-7 words down to 0-3 - cmp +16,d2 - bcs memset_4_three_or_fewer_words - mov d1,(a0+) - mov d1,(a0+) - mov d1,(a0+) - mov d1,(a0+) - add -16,d2 - beq memset_4_no_remainder - - # copy the remaining 1, 2 or 3 words -memset_4_three_or_fewer_words: - cmp +8,d2 - bcs memset_4_one_word - beq memset_4_two_words - mov d1,(a0+) -memset_4_two_words: - mov d1,(a0+) -memset_4_one_word: - mov d1,(a0+) - -memset_4_no_remainder: - # check we set the correct amount - # TODO: REMOVE CHECK - sub e3,a0,d2 - mov (20,sp),d1 - cmp d2,d1 - beq memset_done - break - break - break - -memset_done: - mov e3,a0 - ret [d2,d3],8 - - # handle misaligned copying -memset_1: - add -1,d2 - mov +1,d3 - setlb # setlb requires the next insns - # to occupy exactly 4 bytes - - sub d3,d2 - movbu d1,(a0) - inc a0 - lcc - - mov e3,a0 - ret [d2,d3],8 - -memset_end: - .size memset, memset_end-memset diff --git a/arch/mn10300/lib/negdi2.c b/arch/mn10300/lib/negdi2.c deleted file mode 100644 index eae4ecdd5f693..0000000000000 --- a/arch/mn10300/lib/negdi2.c +++ /dev/null @@ -1,57 +0,0 @@ -/* More subroutines needed by GCC output code on some machines. */ -/* Compile this one with gcc. */ -/* Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001 Free Software Foundation, Inc. - -This file is part of GNU CC. - -GNU CC is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public Licence as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -In addition to the permissions in the GNU General Public Licence, the -Free Software Foundation gives you unlimited permission to link the -compiled version of this file into combinations with other programs, -and to distribute those combinations without any restriction coming -from the use of this file. (The General Public Licence restrictions -do apply in other respects; for example, they cover modification of -the file, and distribution when not linked into a combine -executable.) - -GNU CC 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 Licence for more details. - -You should have received a copy of the GNU General Public Licence -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ - -/* It is incorrect to include config.h here, because this file is being - compiled for the target, and hence definitions concerning only the host - do not apply. */ - -#include - -union DWunion { - s64 ll; - struct { - s32 low; - s32 high; - } s; -}; - -s64 __negdi2(s64 u) -{ - union DWunion w; - union DWunion uu; - - uu.ll = u; - - w.s.low = -uu.s.low; - w.s.high = -uu.s.high - ((u32) w.s.low > 0); - - return w.ll; -} diff --git a/arch/mn10300/lib/usercopy.c b/arch/mn10300/lib/usercopy.c deleted file mode 100644 index 39626912de986..0000000000000 --- a/arch/mn10300/lib/usercopy.c +++ /dev/null @@ -1,142 +0,0 @@ -/* MN10300 Userspace accessor functions - * - * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd. - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include - -/* - * Copy a null terminated string from userspace. - */ -#define __do_strncpy_from_user(dst, src, count, res) \ -do { \ - int w; \ - asm volatile( \ - " mov %1,%0\n" \ - " cmp 0,%1\n" \ - " beq 2f\n" \ - "0:\n" \ - " movbu (%5),%2\n" \ - "1:\n" \ - " movbu %2,(%6)\n" \ - " inc %5\n" \ - " inc %6\n" \ - " cmp 0,%2\n" \ - " beq 2f\n" \ - " add -1,%1\n" \ - " bne 0b\n" \ - "2:\n" \ - " sub %1,%0\n" \ - "3:\n" \ - " .section .fixup,\"ax\"\n" \ - "4:\n" \ - " mov %3,%0\n" \ - " jmp 3b\n" \ - " .previous\n" \ - " .section __ex_table,\"a\"\n" \ - " .balign 4\n" \ - " .long 0b,4b\n" \ - " .long 1b,4b\n" \ - " .previous" \ - :"=&r"(res), "=r"(count), "=&r"(w) \ - :"i"(-EFAULT), "1"(count), "a"(src), "a"(dst) \ - : "memory", "cc"); \ -} while (0) - -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; -} - - -/* - * Clear a userspace memory - */ -#define __do_clear_user(addr, size) \ -do { \ - int w; \ - asm volatile( \ - " cmp 0,%0\n" \ - " beq 1f\n" \ - " clr %1\n" \ - "0: movbu %1,(%3,%2)\n" \ - " inc %3\n" \ - " cmp %0,%3\n" \ - " bne 0b\n" \ - "1:\n" \ - " sub %3,%0\n" \ - "2:\n" \ - ".section .fixup,\"ax\"\n" \ - "3: jmp 2b\n" \ - ".previous\n" \ - ".section __ex_table,\"a\"\n" \ - " .balign 4\n" \ - " .long 0b,3b\n" \ - ".previous\n" \ - : "+r"(size), "=&r"(w) \ - : "a"(addr), "d"(0) \ - : "memory", "cc"); \ -} while (0) - -unsigned long -__clear_user(void *to, unsigned long n) -{ - __do_clear_user(to, n); - return n; -} - -unsigned long -clear_user(void *to, unsigned long n) -{ - if (access_ok(VERIFY_WRITE, to, n)) - __do_clear_user(to, n); - return n; -} - -/* - * Return the size of a string (including the ending 0) - * - * Return 0 on exception, a value greater than N if too long - */ -long strnlen_user(const char *s, long n) -{ - unsigned long res, w; - - if (!__addr_ok(s)) - return 0; - - if (n < 0 || n + (u_long) s > current_thread_info()->addr_limit.seg) - n = current_thread_info()->addr_limit.seg - (u_long)s; - - asm volatile( - "0: cmp %4,%0\n" - " beq 2f\n" - "1: movbu (%0,%3),%1\n" - " inc %0\n" - " cmp 0,%1\n" - " beq 3f\n" - " bra 0b\n" - "2: clr %0\n" - "3:\n" - ".section .fixup,\"ax\"\n" - "4: jmp 2b\n" - ".previous\n" - ".section __ex_table,\"a\"\n" - " .balign 4\n" - " .long 1b,4b\n" - ".previous\n" - :"=d"(res), "=&r"(w) - :"0"(0), "a"(s), "r"(n) - : "memory", "cc"); - return res; -} diff --git a/arch/mn10300/mm/Kconfig.cache b/arch/mn10300/mm/Kconfig.cache deleted file mode 100644 index 8cc5d9ec3b6cd..0000000000000 --- a/arch/mn10300/mm/Kconfig.cache +++ /dev/null @@ -1,148 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# -# MN10300 CPU cache options -# - -choice - prompt "CPU Caching mode" - default MN10300_CACHE_WBACK - help - This option determines the caching mode for the kernel. - - Write-Back caching mode involves the all reads and writes causing - the affected cacheline to be read into the cache first before being - operated upon. Memory is not then updated by a write until the cache - is filled and a cacheline needs to be displaced from the cache to - make room. Only at that point is it written back. - - Write-Through caching only fetches cachelines from memory on a - read. Writes always get written directly to memory. If the affected - cacheline is also in cache, it will be updated too. - - The final option is to turn of caching entirely. - -config MN10300_CACHE_WBACK - bool "Write-Back" - help - The dcache operates in delayed write-back mode. It must be manually - flushed if writes are made that subsequently need to be executed or - to be DMA'd by a device. - -config MN10300_CACHE_WTHRU - bool "Write-Through" - help - The dcache operates in immediate write-through mode. Writes are - committed to RAM immediately in addition to being stored in the - cache. This means that the written data is immediately available for - execution or DMA. - - This is not available for use with an SMP kernel if cache flushing - and invalidation by automatic purge register is not selected. - -config MN10300_CACHE_DISABLED - bool "Disabled" - help - The icache and dcache are disabled. - -endchoice - -config MN10300_CACHE_ENABLED - def_bool y if !MN10300_CACHE_DISABLED - - -choice - prompt "CPU cache flush/invalidate method" - default MN10300_CACHE_MANAGE_BY_TAG if !AM34_2 - default MN10300_CACHE_MANAGE_BY_REG if AM34_2 - depends on MN10300_CACHE_ENABLED - help - This determines the method by which CPU cache flushing and - invalidation is performed. - -config MN10300_CACHE_MANAGE_BY_TAG - bool "Use the cache tag registers directly" - depends on !(SMP && MN10300_CACHE_WTHRU) - -config MN10300_CACHE_MANAGE_BY_REG - bool "Flush areas by way of automatic purge registers (AM34 only)" - depends on AM34_2 - -endchoice - -config MN10300_CACHE_INV_BY_TAG - def_bool y if MN10300_CACHE_MANAGE_BY_TAG && MN10300_CACHE_ENABLED - -config MN10300_CACHE_INV_BY_REG - def_bool y if MN10300_CACHE_MANAGE_BY_REG && MN10300_CACHE_ENABLED - -config MN10300_CACHE_FLUSH_BY_TAG - def_bool y if MN10300_CACHE_MANAGE_BY_TAG && MN10300_CACHE_WBACK - -config MN10300_CACHE_FLUSH_BY_REG - def_bool y if MN10300_CACHE_MANAGE_BY_REG && MN10300_CACHE_WBACK - - -config MN10300_HAS_CACHE_SNOOP - def_bool n - -config MN10300_CACHE_SNOOP - bool "Use CPU Cache Snooping" - depends on MN10300_CACHE_ENABLED && MN10300_HAS_CACHE_SNOOP - default y - -config MN10300_CACHE_FLUSH_ICACHE - def_bool y if MN10300_CACHE_WBACK && !MN10300_CACHE_SNOOP - help - Set if we need the dcache flushing before the icache is invalidated. - -config MN10300_CACHE_INV_ICACHE - def_bool y if MN10300_CACHE_WTHRU && !MN10300_CACHE_SNOOP - help - Set if we need the icache to be invalidated, even if the dcache is in - write-through mode and doesn't need flushing. - -# -# The kernel debugger gets its own separate cache flushing functions -# -config MN10300_DEBUGGER_CACHE_FLUSH_BY_TAG - def_bool y if KERNEL_DEBUGGER && \ - MN10300_CACHE_WBACK && \ - !MN10300_CACHE_SNOOP && \ - MN10300_CACHE_MANAGE_BY_TAG - help - Set if the debugger needs to flush the dcache and invalidate the - icache using the cache tag registers to make breakpoints work. - -config MN10300_DEBUGGER_CACHE_FLUSH_BY_REG - def_bool y if KERNEL_DEBUGGER && \ - MN10300_CACHE_WBACK && \ - !MN10300_CACHE_SNOOP && \ - MN10300_CACHE_MANAGE_BY_REG - help - Set if the debugger needs to flush the dcache and invalidate the - icache using automatic purge registers to make breakpoints work. - -config MN10300_DEBUGGER_CACHE_INV_BY_TAG - def_bool y if KERNEL_DEBUGGER && \ - MN10300_CACHE_WTHRU && \ - !MN10300_CACHE_SNOOP && \ - MN10300_CACHE_MANAGE_BY_TAG - help - Set if the debugger needs to invalidate the icache using the cache - tag registers to make breakpoints work. - -config MN10300_DEBUGGER_CACHE_INV_BY_REG - def_bool y if KERNEL_DEBUGGER && \ - MN10300_CACHE_WTHRU && \ - !MN10300_CACHE_SNOOP && \ - MN10300_CACHE_MANAGE_BY_REG - help - Set if the debugger needs to invalidate the icache using automatic - purge registers to make breakpoints work. - -config MN10300_DEBUGGER_CACHE_NO_FLUSH - def_bool y if KERNEL_DEBUGGER && \ - (MN10300_CACHE_DISABLED || MN10300_CACHE_SNOOP) - help - Set if the debugger does not need to flush the dcache and/or - invalidate the icache to make breakpoints work. diff --git a/arch/mn10300/mm/Makefile b/arch/mn10300/mm/Makefile deleted file mode 100644 index 048ba6f67f9af..0000000000000 --- a/arch/mn10300/mm/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# -# Makefile for the MN10300-specific memory management code -# - -cache-smp-wback-$(CONFIG_MN10300_CACHE_WBACK) := cache-smp-flush.o - -cacheflush-y := cache.o -cacheflush-$(CONFIG_SMP) += cache-smp.o cache-smp-inv.o $(cache-smp-wback-y) -cacheflush-$(CONFIG_MN10300_CACHE_INV_ICACHE) += cache-inv-icache.o -cacheflush-$(CONFIG_MN10300_CACHE_FLUSH_ICACHE) += cache-flush-icache.o -cacheflush-$(CONFIG_MN10300_CACHE_INV_BY_TAG) += cache-inv-by-tag.o -cacheflush-$(CONFIG_MN10300_CACHE_INV_BY_REG) += cache-inv-by-reg.o -cacheflush-$(CONFIG_MN10300_CACHE_FLUSH_BY_TAG) += cache-flush-by-tag.o -cacheflush-$(CONFIG_MN10300_CACHE_FLUSH_BY_REG) += cache-flush-by-reg.o - -cacheflush-$(CONFIG_MN10300_DEBUGGER_CACHE_FLUSH_BY_TAG) += \ - cache-dbg-flush-by-tag.o cache-dbg-inv-by-tag.o -cacheflush-$(CONFIG_MN10300_DEBUGGER_CACHE_FLUSH_BY_REG) += \ - cache-dbg-flush-by-reg.o -cacheflush-$(CONFIG_MN10300_DEBUGGER_CACHE_INV_BY_TAG) += \ - cache-dbg-inv-by-tag.o cache-dbg-inv.o -cacheflush-$(CONFIG_MN10300_DEBUGGER_CACHE_INV_BY_REG) += \ - cache-dbg-inv-by-reg.o cache-dbg-inv.o - -cacheflush-$(CONFIG_MN10300_CACHE_DISABLED) := cache-disabled.o - -obj-y := \ - init.o fault.o pgtable.o extable.o tlb-mn10300.o mmu-context.o \ - misalignment.o dma-alloc.o $(cacheflush-y) - -obj-$(CONFIG_SMP) += tlb-smp.o diff --git a/arch/mn10300/mm/cache-dbg-flush-by-reg.S b/arch/mn10300/mm/cache-dbg-flush-by-reg.S deleted file mode 100644 index a775ea5d7cee0..0000000000000 --- a/arch/mn10300/mm/cache-dbg-flush-by-reg.S +++ /dev/null @@ -1,160 +0,0 @@ -/* MN10300 CPU cache invalidation routines, using automatic purge registers - * - * Copyright (C) 2011 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include -#include -#include -#include -#include -#include -#include "cache.inc" - - .am33_2 - -############################################################################### -# -# void debugger_local_cache_flushinv(void) -# Flush the entire data cache back to RAM and invalidate the icache -# -############################################################################### - ALIGN - .globl debugger_local_cache_flushinv - .type debugger_local_cache_flushinv,@function -debugger_local_cache_flushinv: - # - # firstly flush the dcache - # - movhu (CHCTR),d0 - btst CHCTR_DCEN|CHCTR_ICEN,d0 - beq debugger_local_cache_flushinv_end - - mov DCPGCR,a0 - - mov epsw,d1 - and ~EPSW_IE,epsw - or EPSW_NMID,epsw - nop - - btst CHCTR_DCEN,d0 - beq debugger_local_cache_flushinv_no_dcache - - # wait for busy bit of area purge - setlb - mov (a0),d0 - btst DCPGCR_DCPGBSY,d0 - lne - - # set mask - clr d0 - mov d0,(DCPGMR) - - # area purge - # - # DCPGCR = DCPGCR_DCP - # - mov DCPGCR_DCP,d0 - mov d0,(a0) - - # wait for busy bit of area purge - setlb - mov (a0),d0 - btst DCPGCR_DCPGBSY,d0 - lne - -debugger_local_cache_flushinv_no_dcache: - # - # secondly, invalidate the icache if it is enabled - # - mov CHCTR,a0 - movhu (a0),d0 - btst CHCTR_ICEN,d0 - beq debugger_local_cache_flushinv_done - - invalidate_icache 0 - -debugger_local_cache_flushinv_done: - mov d1,epsw - -debugger_local_cache_flushinv_end: - ret [],0 - .size debugger_local_cache_flushinv,.-debugger_local_cache_flushinv - -############################################################################### -# -# void debugger_local_cache_flushinv_one(u8 *addr) -# -# Invalidate one particular cacheline if it's in the icache -# -############################################################################### - ALIGN - .globl debugger_local_cache_flushinv_one - .type debugger_local_cache_flushinv_one,@function -debugger_local_cache_flushinv_one: - movhu (CHCTR),d1 - btst CHCTR_DCEN|CHCTR_ICEN,d1 - beq debugger_local_cache_flushinv_one_end - btst CHCTR_DCEN,d1 - beq debugger_local_cache_flushinv_one_no_dcache - - # round cacheline addr down - and L1_CACHE_TAG_MASK,d0 - mov d0,a1 - mov d0,d1 - - # determine the dcache purge control reg address - mov DCACHE_PURGE(0,0),a0 - and L1_CACHE_TAG_ENTRY,d0 - add d0,a0 - - # retain valid entries in the cache - or L1_CACHE_TAG_VALID,d1 - - # conditionally purge this line in all ways - mov d1,(L1_CACHE_WAYDISP*0,a0) - -debugger_local_cache_flushinv_one_no_dcache: - # - # now try to flush the icache - # - mov CHCTR,a0 - movhu (a0),d0 - btst CHCTR_ICEN,d0 - beq debugger_local_cache_flushinv_one_end - - LOCAL_CLI_SAVE(d1) - - mov ICIVCR,a0 - - # wait for the invalidator to quiesce - setlb - mov (a0),d0 - btst ICIVCR_ICIVBSY,d0 - lne - - # set the mask - mov L1_CACHE_TAG_MASK,d0 - mov d0,(ICIVMR) - - # invalidate the cache line at the given address - or ICIVCR_ICI,a1 - mov a1,(a0) - - # wait for the invalidator to quiesce again - setlb - mov (a0),d0 - btst ICIVCR_ICIVBSY,d0 - lne - - LOCAL_IRQ_RESTORE(d1) - -debugger_local_cache_flushinv_one_end: - ret [],0 - .size debugger_local_cache_flushinv_one,.-debugger_local_cache_flushinv_one diff --git a/arch/mn10300/mm/cache-dbg-flush-by-tag.S b/arch/mn10300/mm/cache-dbg-flush-by-tag.S deleted file mode 100644 index bf56930e6e700..0000000000000 --- a/arch/mn10300/mm/cache-dbg-flush-by-tag.S +++ /dev/null @@ -1,114 +0,0 @@ -/* MN10300 CPU cache invalidation routines, using direct tag flushing - * - * Copyright (C) 2011 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include -#include -#include -#include -#include -#include -#include "cache.inc" - - .am33_2 - -############################################################################### -# -# void debugger_local_cache_flushinv(void) -# -# Flush the entire data cache back to RAM and invalidate the icache -# -############################################################################### - ALIGN - .globl debugger_local_cache_flushinv - .type debugger_local_cache_flushinv,@function -debugger_local_cache_flushinv: - # - # firstly flush the dcache - # - movhu (CHCTR),d0 - btst CHCTR_DCEN|CHCTR_ICEN,d0 - beq debugger_local_cache_flushinv_end - - btst CHCTR_DCEN,d0 - beq debugger_local_cache_flushinv_no_dcache - - # read the addresses tagged in the cache's tag RAM and attempt to flush - # those addresses specifically - # - we rely on the hardware to filter out invalid tag entry addresses - mov DCACHE_TAG(0,0),a0 # dcache tag RAM access address - mov DCACHE_PURGE(0,0),a1 # dcache purge request address - mov L1_CACHE_NWAYS*L1_CACHE_NENTRIES,e0 # total number of entries - -mn10300_local_dcache_flush_loop: - mov (a0),d0 - and L1_CACHE_TAG_MASK,d0 - or L1_CACHE_TAG_VALID,d0 # retain valid entries in the - # cache - mov d0,(a1) # conditional purge - - add L1_CACHE_BYTES,a0 - add L1_CACHE_BYTES,a1 - add -1,e0 - bne mn10300_local_dcache_flush_loop - -debugger_local_cache_flushinv_no_dcache: - # - # secondly, invalidate the icache if it is enabled - # - mov CHCTR,a0 - movhu (a0),d0 - btst CHCTR_ICEN,d0 - beq debugger_local_cache_flushinv_end - - invalidate_icache 1 - -debugger_local_cache_flushinv_end: - ret [],0 - .size debugger_local_cache_flushinv,.-debugger_local_cache_flushinv - -############################################################################### -# -# void debugger_local_cache_flushinv_one(u8 *addr) -# -# Invalidate one particular cacheline if it's in the icache -# -############################################################################### - ALIGN - .globl debugger_local_cache_flushinv_one - .type debugger_local_cache_flushinv_one,@function -debugger_local_cache_flushinv_one: - movhu (CHCTR),d1 - btst CHCTR_DCEN|CHCTR_ICEN,d1 - beq debugger_local_cache_flushinv_one_end - btst CHCTR_DCEN,d1 - beq debugger_local_cache_flushinv_one_icache - - # round cacheline addr down - and L1_CACHE_TAG_MASK,d0 - mov d0,a1 - - # determine the dcache purge control reg address - mov DCACHE_PURGE(0,0),a0 - and L1_CACHE_TAG_ENTRY,d0 - add d0,a0 - - # retain valid entries in the cache - or L1_CACHE_TAG_VALID,a1 - - # conditionally purge this line in all ways - mov a1,(L1_CACHE_WAYDISP*0,a0) - - # now go and do the icache - bra debugger_local_cache_flushinv_one_icache - -debugger_local_cache_flushinv_one_end: - ret [],0 - .size debugger_local_cache_flushinv_one,.-debugger_local_cache_flushinv_one diff --git a/arch/mn10300/mm/cache-dbg-inv-by-reg.S b/arch/mn10300/mm/cache-dbg-inv-by-reg.S deleted file mode 100644 index c4e6252941b11..0000000000000 --- a/arch/mn10300/mm/cache-dbg-inv-by-reg.S +++ /dev/null @@ -1,69 +0,0 @@ -/* MN10300 CPU cache invalidation routines, using automatic purge registers - * - * Copyright (C) 2011 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include -#include -#include -#include -#include "cache.inc" - - .am33_2 - - .globl debugger_local_cache_flushinv_one - -############################################################################### -# -# void debugger_local_cache_flushinv_one(u8 *addr) -# -# Invalidate one particular cacheline if it's in the icache -# -############################################################################### - ALIGN - .globl debugger_local_cache_flushinv_one - .type debugger_local_cache_flushinv_one,@function -debugger_local_cache_flushinv_one: - mov d0,a1 - - mov CHCTR,a0 - movhu (a0),d0 - btst CHCTR_ICEN,d0 - beq mn10300_local_icache_inv_range_reg_end - - LOCAL_CLI_SAVE(d1) - - mov ICIVCR,a0 - - # wait for the invalidator to quiesce - setlb - mov (a0),d0 - btst ICIVCR_ICIVBSY,d0 - lne - - # set the mask - mov ~L1_CACHE_TAG_MASK,d0 - mov d0,(ICIVMR) - - # invalidate the cache line at the given address - and ~L1_CACHE_TAG_MASK,a1 - or ICIVCR_ICI,a1 - mov a1,(a0) - - # wait for the invalidator to quiesce again - setlb - mov (a0),d0 - btst ICIVCR_ICIVBSY,d0 - lne - - LOCAL_IRQ_RESTORE(d1) - -mn10300_local_icache_inv_range_reg_end: - ret [],0 - .size debugger_local_cache_flushinv_one,.-debugger_local_cache_flushinv_one diff --git a/arch/mn10300/mm/cache-dbg-inv-by-tag.S b/arch/mn10300/mm/cache-dbg-inv-by-tag.S deleted file mode 100644 index d8ec821e5f88d..0000000000000 --- a/arch/mn10300/mm/cache-dbg-inv-by-tag.S +++ /dev/null @@ -1,120 +0,0 @@ -/* MN10300 CPU cache invalidation routines, using direct tag flushing - * - * Copyright (C) 2011 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include -#include -#include -#include -#include -#include -#include "cache.inc" - - .am33_2 - - .globl debugger_local_cache_flushinv_one_icache - -############################################################################### -# -# void debugger_local_cache_flushinv_one(u8 *addr) -# -# Invalidate one particular cacheline if it's in the icache -# -############################################################################### - ALIGN - .globl debugger_local_cache_flushinv_one_icache - .type debugger_local_cache_flushinv_one_icache,@function -debugger_local_cache_flushinv_one_icache: - movm [d3,a2],(sp) - - mov CHCTR,a2 - movhu (a2),d0 - btst CHCTR_ICEN,d0 - beq debugger_local_cache_flushinv_one_icache_end - - mov d0,a1 - and L1_CACHE_TAG_MASK,a1 - - # read the tags from the tag RAM, and if they indicate a matching valid - # cache line then we invalidate that line - mov ICACHE_TAG(0,0),a0 - mov a1,d0 - and L1_CACHE_TAG_ENTRY,d0 - add d0,a0 # starting icache tag RAM - # access address - - and ~(L1_CACHE_DISPARITY-1),a1 # determine comparator base - or L1_CACHE_TAG_VALID,a1 - mov L1_CACHE_TAG_ADDRESS|L1_CACHE_TAG_VALID,d1 - - LOCAL_CLI_SAVE(d3) - - # disable the icache - movhu (a2),d0 - and ~CHCTR_ICEN,d0 - movhu d0,(a2) - - # and wait for it to calm down - setlb - movhu (a2),d0 - btst CHCTR_ICBUSY,d0 - lne - - # check all the way tags for this cache entry - mov (a0),d0 # read the tag in the way 0 slot - xor a1,d0 - and d1,d0 - beq debugger_local_icache_kill # jump if matched - - add L1_CACHE_WAYDISP,a0 - mov (a0),d0 # read the tag in the way 1 slot - xor a1,d0 - and d1,d0 - beq debugger_local_icache_kill # jump if matched - - add L1_CACHE_WAYDISP,a0 - mov (a0),d0 # read the tag in the way 2 slot - xor a1,d0 - and d1,d0 - beq debugger_local_icache_kill # jump if matched - - add L1_CACHE_WAYDISP,a0 - mov (a0),d0 # read the tag in the way 3 slot - xor a1,d0 - and d1,d0 - bne debugger_local_icache_finish # jump if not matched - -debugger_local_icache_kill: - mov d0,(a0) # kill the tag (D0 is 0 at this point) - -debugger_local_icache_finish: - # wait for the cache to finish what it's doing - setlb - movhu (a2),d0 - btst CHCTR_ICBUSY,d0 - lne - - # and reenable it - or CHCTR_ICEN,d0 - movhu d0,(a2) - movhu (a2),d0 - - # re-enable interrupts - LOCAL_IRQ_RESTORE(d3) - -debugger_local_cache_flushinv_one_icache_end: - ret [d3,a2],8 - .size debugger_local_cache_flushinv_one_icache,.-debugger_local_cache_flushinv_one_icache - -#ifdef CONFIG_MN10300_DEBUGGER_CACHE_INV_BY_TAG - .globl debugger_local_cache_flushinv_one - .type debugger_local_cache_flushinv_one,@function -debugger_local_cache_flushinv_one = debugger_local_cache_flushinv_one_icache -#endif diff --git a/arch/mn10300/mm/cache-dbg-inv.S b/arch/mn10300/mm/cache-dbg-inv.S deleted file mode 100644 index eba2d6dca0664..0000000000000 --- a/arch/mn10300/mm/cache-dbg-inv.S +++ /dev/null @@ -1,47 +0,0 @@ -/* MN10300 CPU cache invalidation routines - * - * Copyright (C) 2011 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include -#include -#include -#include -#include -#include -#include "cache.inc" - - .am33_2 - - .globl debugger_local_cache_flushinv - -############################################################################### -# -# void debugger_local_cache_flushinv(void) -# -# Invalidate the entire icache -# -############################################################################### - ALIGN - .globl debugger_local_cache_flushinv - .type debugger_local_cache_flushinv,@function -debugger_local_cache_flushinv: - # - # we only need to invalidate the icache in this cache mode - # - mov CHCTR,a0 - movhu (a0),d0 - btst CHCTR_ICEN,d0 - beq debugger_local_cache_flushinv_end - - invalidate_icache 1 - -debugger_local_cache_flushinv_end: - ret [],0 - .size debugger_local_cache_flushinv,.-debugger_local_cache_flushinv diff --git a/arch/mn10300/mm/cache-disabled.c b/arch/mn10300/mm/cache-disabled.c deleted file mode 100644 index f669ea42aba63..0000000000000 --- a/arch/mn10300/mm/cache-disabled.c +++ /dev/null @@ -1,21 +0,0 @@ -/* Handle the cache being disabled - * - * Copyright (C) 2010 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include - -/* - * allow userspace to flush the instruction cache - */ -asmlinkage long sys_cacheflush(unsigned long start, unsigned long end) -{ - if (end < start) - return -EINVAL; - return 0; -} diff --git a/arch/mn10300/mm/cache-flush-by-reg.S b/arch/mn10300/mm/cache-flush-by-reg.S deleted file mode 100644 index 1dcae0211671d..0000000000000 --- a/arch/mn10300/mm/cache-flush-by-reg.S +++ /dev/null @@ -1,308 +0,0 @@ -/* MN10300 CPU core caching routines, using indirect regs on cache controller - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include - - .am33_2 - -#ifndef CONFIG_SMP - .globl mn10300_dcache_flush - .globl mn10300_dcache_flush_page - .globl mn10300_dcache_flush_range - .globl mn10300_dcache_flush_range2 - .globl mn10300_dcache_flush_inv - .globl mn10300_dcache_flush_inv_page - .globl mn10300_dcache_flush_inv_range - .globl mn10300_dcache_flush_inv_range2 - -mn10300_dcache_flush = mn10300_local_dcache_flush -mn10300_dcache_flush_page = mn10300_local_dcache_flush_page -mn10300_dcache_flush_range = mn10300_local_dcache_flush_range -mn10300_dcache_flush_range2 = mn10300_local_dcache_flush_range2 -mn10300_dcache_flush_inv = mn10300_local_dcache_flush_inv -mn10300_dcache_flush_inv_page = mn10300_local_dcache_flush_inv_page -mn10300_dcache_flush_inv_range = mn10300_local_dcache_flush_inv_range -mn10300_dcache_flush_inv_range2 = mn10300_local_dcache_flush_inv_range2 - -#endif /* !CONFIG_SMP */ - -############################################################################### -# -# void mn10300_local_dcache_flush(void) -# Flush the entire data cache back to RAM -# -############################################################################### - ALIGN - .globl mn10300_local_dcache_flush - .type mn10300_local_dcache_flush,@function -mn10300_local_dcache_flush: - movhu (CHCTR),d0 - btst CHCTR_DCEN,d0 - beq mn10300_local_dcache_flush_end - - mov DCPGCR,a0 - - LOCAL_CLI_SAVE(d1) - - # wait for busy bit of area purge - setlb - mov (a0),d0 - btst DCPGCR_DCPGBSY,d0 - lne - - # set mask - clr d0 - mov d0,(DCPGMR) - - # area purge - # - # DCPGCR = DCPGCR_DCP - # - mov DCPGCR_DCP,d0 - mov d0,(a0) - - # wait for busy bit of area purge - setlb - mov (a0),d0 - btst DCPGCR_DCPGBSY,d0 - lne - - LOCAL_IRQ_RESTORE(d1) - -mn10300_local_dcache_flush_end: - ret [],0 - .size mn10300_local_dcache_flush,.-mn10300_local_dcache_flush - -############################################################################### -# -# void mn10300_local_dcache_flush_page(unsigned long start) -# void mn10300_local_dcache_flush_range(unsigned long start, unsigned long end) -# void mn10300_local_dcache_flush_range2(unsigned long start, unsigned long size) -# Flush a range of addresses on a page in the dcache -# -############################################################################### - ALIGN - .globl mn10300_local_dcache_flush_page - .globl mn10300_local_dcache_flush_range - .globl mn10300_local_dcache_flush_range2 - .type mn10300_local_dcache_flush_page,@function - .type mn10300_local_dcache_flush_range,@function - .type mn10300_local_dcache_flush_range2,@function -mn10300_local_dcache_flush_page: - and ~(PAGE_SIZE-1),d0 - mov PAGE_SIZE,d1 -mn10300_local_dcache_flush_range2: - add d0,d1 -mn10300_local_dcache_flush_range: - movm [d2,d3,a2],(sp) - - movhu (CHCTR),d2 - btst CHCTR_DCEN,d2 - beq mn10300_local_dcache_flush_range_end - - # calculate alignsize - # - # alignsize = L1_CACHE_BYTES; - # for (i = (end - start - 1) / L1_CACHE_BYTES ; i > 0; i >>= 1) - # alignsize <<= 1; - # d2 = alignsize; - # - mov L1_CACHE_BYTES,d2 - sub d0,d1,d3 - add -1,d3 - lsr L1_CACHE_SHIFT,d3 - beq 2f -1: - add d2,d2 - lsr 1,d3 - bne 1b -2: - mov d1,a1 # a1 = end - - LOCAL_CLI_SAVE(d3) - mov DCPGCR,a0 - - # wait for busy bit of area purge - setlb - mov (a0),d1 - btst DCPGCR_DCPGBSY,d1 - lne - - # determine the mask - mov d2,d1 - add -1,d1 - not d1 # d1 = mask = ~(alignsize-1) - mov d1,(DCPGMR) - - and d1,d0,a2 # a2 = mask & start - -dcpgloop: - # area purge - mov a2,d0 - or DCPGCR_DCP,d0 - mov d0,(a0) # DCPGCR = (mask & start) | DCPGCR_DCP - - # wait for busy bit of area purge - setlb - mov (a0),d1 - btst DCPGCR_DCPGBSY,d1 - lne - - # check purge of end address - add d2,a2 # a2 += alignsize - cmp a1,a2 # if (a2 < end) goto dcpgloop - bns dcpgloop - - LOCAL_IRQ_RESTORE(d3) - -mn10300_local_dcache_flush_range_end: - ret [d2,d3,a2],12 - - .size mn10300_local_dcache_flush_page,.-mn10300_local_dcache_flush_page - .size mn10300_local_dcache_flush_range,.-mn10300_local_dcache_flush_range - .size mn10300_local_dcache_flush_range2,.-mn10300_local_dcache_flush_range2 - -############################################################################### -# -# void mn10300_local_dcache_flush_inv(void) -# Flush the entire data cache and invalidate all entries -# -############################################################################### - ALIGN - .globl mn10300_local_dcache_flush_inv - .type mn10300_local_dcache_flush_inv,@function -mn10300_local_dcache_flush_inv: - movhu (CHCTR),d0 - btst CHCTR_DCEN,d0 - beq mn10300_local_dcache_flush_inv_end - - mov DCPGCR,a0 - - LOCAL_CLI_SAVE(d1) - - # wait for busy bit of area purge & invalidate - setlb - mov (a0),d0 - btst DCPGCR_DCPGBSY,d0 - lne - - # set the mask to cover everything - clr d0 - mov d0,(DCPGMR) - - # area purge & invalidate - mov DCPGCR_DCP|DCPGCR_DCI,d0 - mov d0,(a0) - - # wait for busy bit of area purge & invalidate - setlb - mov (a0),d0 - btst DCPGCR_DCPGBSY,d0 - lne - - LOCAL_IRQ_RESTORE(d1) - -mn10300_local_dcache_flush_inv_end: - ret [],0 - .size mn10300_local_dcache_flush_inv,.-mn10300_local_dcache_flush_inv - -############################################################################### -# -# void mn10300_local_dcache_flush_inv_page(unsigned long start) -# void mn10300_local_dcache_flush_inv_range(unsigned long start, unsigned long end) -# void mn10300_local_dcache_flush_inv_range2(unsigned long start, unsigned long size) -# Flush and invalidate a range of addresses on a page in the dcache -# -############################################################################### - ALIGN - .globl mn10300_local_dcache_flush_inv_page - .globl mn10300_local_dcache_flush_inv_range - .globl mn10300_local_dcache_flush_inv_range2 - .type mn10300_local_dcache_flush_inv_page,@function - .type mn10300_local_dcache_flush_inv_range,@function - .type mn10300_local_dcache_flush_inv_range2,@function -mn10300_local_dcache_flush_inv_page: - and ~(PAGE_SIZE-1),d0 - mov PAGE_SIZE,d1 -mn10300_local_dcache_flush_inv_range2: - add d0,d1 -mn10300_local_dcache_flush_inv_range: - movm [d2,d3,a2],(sp) - - movhu (CHCTR),d2 - btst CHCTR_DCEN,d2 - beq mn10300_local_dcache_flush_inv_range_end - - # calculate alignsize - # - # alignsize = L1_CACHE_BYTES; - # for (i = (end - start - 1) / L1_CACHE_BYTES; i > 0; i >>= 1) - # alignsize <<= 1; - # d2 = alignsize - # - mov L1_CACHE_BYTES,d2 - sub d0,d1,d3 - add -1,d3 - lsr L1_CACHE_SHIFT,d3 - beq 2f -1: - add d2,d2 - lsr 1,d3 - bne 1b -2: - mov d1,a1 # a1 = end - - LOCAL_CLI_SAVE(d3) - mov DCPGCR,a0 - - # wait for busy bit of area purge & invalidate - setlb - mov (a0),d1 - btst DCPGCR_DCPGBSY,d1 - lne - - # set the mask - mov d2,d1 - add -1,d1 - not d1 # d1 = mask = ~(alignsize-1) - mov d1,(DCPGMR) - - and d1,d0,a2 # a2 = mask & start - -dcpgivloop: - # area purge & invalidate - mov a2,d0 - or DCPGCR_DCP|DCPGCR_DCI,d0 - mov d0,(a0) # DCPGCR = (mask & start)|DCPGCR_DCP|DCPGCR_DCI - - # wait for busy bit of area purge & invalidate - setlb - mov (a0),d1 - btst DCPGCR_DCPGBSY,d1 - lne - - # check purge & invalidate of end address - add d2,a2 # a2 += alignsize - cmp a1,a2 # if (a2 < end) goto dcpgivloop - bns dcpgivloop - - LOCAL_IRQ_RESTORE(d3) - -mn10300_local_dcache_flush_inv_range_end: - ret [d2,d3,a2],12 - .size mn10300_local_dcache_flush_inv_page,.-mn10300_local_dcache_flush_inv_page - .size mn10300_local_dcache_flush_inv_range,.-mn10300_local_dcache_flush_inv_range - .size mn10300_local_dcache_flush_inv_range2,.-mn10300_local_dcache_flush_inv_range2 diff --git a/arch/mn10300/mm/cache-flush-by-tag.S b/arch/mn10300/mm/cache-flush-by-tag.S deleted file mode 100644 index 1ddc068492429..0000000000000 --- a/arch/mn10300/mm/cache-flush-by-tag.S +++ /dev/null @@ -1,250 +0,0 @@ -/* MN10300 CPU core caching routines, using direct tag flushing - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include - - .am33_2 - -#ifndef CONFIG_SMP - .globl mn10300_dcache_flush - .globl mn10300_dcache_flush_page - .globl mn10300_dcache_flush_range - .globl mn10300_dcache_flush_range2 - .globl mn10300_dcache_flush_inv - .globl mn10300_dcache_flush_inv_page - .globl mn10300_dcache_flush_inv_range - .globl mn10300_dcache_flush_inv_range2 - -mn10300_dcache_flush = mn10300_local_dcache_flush -mn10300_dcache_flush_page = mn10300_local_dcache_flush_page -mn10300_dcache_flush_range = mn10300_local_dcache_flush_range -mn10300_dcache_flush_range2 = mn10300_local_dcache_flush_range2 -mn10300_dcache_flush_inv = mn10300_local_dcache_flush_inv -mn10300_dcache_flush_inv_page = mn10300_local_dcache_flush_inv_page -mn10300_dcache_flush_inv_range = mn10300_local_dcache_flush_inv_range -mn10300_dcache_flush_inv_range2 = mn10300_local_dcache_flush_inv_range2 - -#endif /* !CONFIG_SMP */ - -############################################################################### -# -# void mn10300_local_dcache_flush(void) -# Flush the entire data cache back to RAM -# -############################################################################### - ALIGN - .globl mn10300_local_dcache_flush - .type mn10300_local_dcache_flush,@function -mn10300_local_dcache_flush: - movhu (CHCTR),d0 - btst CHCTR_DCEN,d0 - beq mn10300_local_dcache_flush_end - - # read the addresses tagged in the cache's tag RAM and attempt to flush - # those addresses specifically - # - we rely on the hardware to filter out invalid tag entry addresses - mov DCACHE_TAG(0,0),a0 # dcache tag RAM access address - mov DCACHE_PURGE(0,0),a1 # dcache purge request address - mov L1_CACHE_NWAYS*L1_CACHE_NENTRIES,d1 # total number of entries - -mn10300_local_dcache_flush_loop: - mov (a0),d0 - and L1_CACHE_TAG_MASK,d0 - or L1_CACHE_TAG_VALID,d0 # retain valid entries in the - # cache - mov d0,(a1) # conditional purge - - add L1_CACHE_BYTES,a0 - add L1_CACHE_BYTES,a1 - add -1,d1 - bne mn10300_local_dcache_flush_loop - -mn10300_local_dcache_flush_end: - ret [],0 - .size mn10300_local_dcache_flush,.-mn10300_local_dcache_flush - -############################################################################### -# -# void mn10300_local_dcache_flush_page(unsigned long start) -# void mn10300_local_dcache_flush_range(unsigned long start, unsigned long end) -# void mn10300_local_dcache_flush_range2(unsigned long start, unsigned long size) -# Flush a range of addresses on a page in the dcache -# -############################################################################### - ALIGN - .globl mn10300_local_dcache_flush_page - .globl mn10300_local_dcache_flush_range - .globl mn10300_local_dcache_flush_range2 - .type mn10300_local_dcache_flush_page,@function - .type mn10300_local_dcache_flush_range,@function - .type mn10300_local_dcache_flush_range2,@function -mn10300_local_dcache_flush_page: - and ~(PAGE_SIZE-1),d0 - mov PAGE_SIZE,d1 -mn10300_local_dcache_flush_range2: - add d0,d1 -mn10300_local_dcache_flush_range: - movm [d2],(sp) - - movhu (CHCTR),d2 - btst CHCTR_DCEN,d2 - beq mn10300_local_dcache_flush_range_end - - sub d0,d1,a0 - cmp MN10300_DCACHE_FLUSH_BORDER,a0 - ble 1f - - movm (sp),[d2] - bra mn10300_local_dcache_flush -1: - - # round start addr down - and L1_CACHE_TAG_MASK,d0 - mov d0,a1 - - add L1_CACHE_BYTES,d1 # round end addr up - and L1_CACHE_TAG_MASK,d1 - - # write a request to flush all instances of an address from the cache - mov DCACHE_PURGE(0,0),a0 - mov a1,d0 - and L1_CACHE_TAG_ENTRY,d0 - add d0,a0 # starting dcache purge control - # reg address - - sub a1,d1 - lsr L1_CACHE_SHIFT,d1 # total number of entries to - # examine - - or L1_CACHE_TAG_VALID,a1 # retain valid entries in the - # cache - -mn10300_local_dcache_flush_range_loop: - mov a1,(L1_CACHE_WAYDISP*0,a0) # conditionally purge this line - # all ways - - add L1_CACHE_BYTES,a0 - add L1_CACHE_BYTES,a1 - and ~L1_CACHE_WAYDISP,a0 # make sure way stay on way 0 - add -1,d1 - bne mn10300_local_dcache_flush_range_loop - -mn10300_local_dcache_flush_range_end: - ret [d2],4 - - .size mn10300_local_dcache_flush_page,.-mn10300_local_dcache_flush_page - .size mn10300_local_dcache_flush_range,.-mn10300_local_dcache_flush_range - .size mn10300_local_dcache_flush_range2,.-mn10300_local_dcache_flush_range2 - -############################################################################### -# -# void mn10300_local_dcache_flush_inv(void) -# Flush the entire data cache and invalidate all entries -# -############################################################################### - ALIGN - .globl mn10300_local_dcache_flush_inv - .type mn10300_local_dcache_flush_inv,@function -mn10300_local_dcache_flush_inv: - movhu (CHCTR),d0 - btst CHCTR_DCEN,d0 - beq mn10300_local_dcache_flush_inv_end - - mov L1_CACHE_NENTRIES,d1 - clr a1 - -mn10300_local_dcache_flush_inv_loop: - mov (DCACHE_PURGE_WAY0(0),a1),d0 # unconditional purge - mov (DCACHE_PURGE_WAY1(0),a1),d0 # unconditional purge - mov (DCACHE_PURGE_WAY2(0),a1),d0 # unconditional purge - mov (DCACHE_PURGE_WAY3(0),a1),d0 # unconditional purge - - add L1_CACHE_BYTES,a1 - add -1,d1 - bne mn10300_local_dcache_flush_inv_loop - -mn10300_local_dcache_flush_inv_end: - ret [],0 - .size mn10300_local_dcache_flush_inv,.-mn10300_local_dcache_flush_inv - -############################################################################### -# -# void mn10300_local_dcache_flush_inv_page(unsigned long start) -# void mn10300_local_dcache_flush_inv_range(unsigned long start, unsigned long end) -# void mn10300_local_dcache_flush_inv_range2(unsigned long start, unsigned long size) -# Flush and invalidate a range of addresses on a page in the dcache -# -############################################################################### - ALIGN - .globl mn10300_local_dcache_flush_inv_page - .globl mn10300_local_dcache_flush_inv_range - .globl mn10300_local_dcache_flush_inv_range2 - .type mn10300_local_dcache_flush_inv_page,@function - .type mn10300_local_dcache_flush_inv_range,@function - .type mn10300_local_dcache_flush_inv_range2,@function -mn10300_local_dcache_flush_inv_page: - and ~(PAGE_SIZE-1),d0 - mov PAGE_SIZE,d1 -mn10300_local_dcache_flush_inv_range2: - add d0,d1 -mn10300_local_dcache_flush_inv_range: - movm [d2],(sp) - - movhu (CHCTR),d2 - btst CHCTR_DCEN,d2 - beq mn10300_local_dcache_flush_inv_range_end - - sub d0,d1,a0 - cmp MN10300_DCACHE_FLUSH_INV_BORDER,a0 - ble 1f - - movm (sp),[d2] - bra mn10300_local_dcache_flush_inv -1: - - and L1_CACHE_TAG_MASK,d0 # round start addr down - mov d0,a1 - - add L1_CACHE_BYTES,d1 # round end addr up - and L1_CACHE_TAG_MASK,d1 - - # write a request to flush and invalidate all instances of an address - # from the cache - mov DCACHE_PURGE(0,0),a0 - mov a1,d0 - and L1_CACHE_TAG_ENTRY,d0 - add d0,a0 # starting dcache purge control - # reg address - - sub a1,d1 - lsr L1_CACHE_SHIFT,d1 # total number of entries to - # examine - -mn10300_local_dcache_flush_inv_range_loop: - mov a1,(L1_CACHE_WAYDISP*0,a0) # conditionally purge this line - # in all ways - - add L1_CACHE_BYTES,a0 - add L1_CACHE_BYTES,a1 - and ~L1_CACHE_WAYDISP,a0 # make sure way stay on way 0 - add -1,d1 - bne mn10300_local_dcache_flush_inv_range_loop - -mn10300_local_dcache_flush_inv_range_end: - ret [d2],4 - .size mn10300_local_dcache_flush_inv_page,.-mn10300_local_dcache_flush_inv_page - .size mn10300_local_dcache_flush_inv_range,.-mn10300_local_dcache_flush_inv_range - .size mn10300_local_dcache_flush_inv_range2,.-mn10300_local_dcache_flush_inv_range2 diff --git a/arch/mn10300/mm/cache-flush-icache.c b/arch/mn10300/mm/cache-flush-icache.c deleted file mode 100644 index fdb1a9db20f0b..0000000000000 --- a/arch/mn10300/mm/cache-flush-icache.c +++ /dev/null @@ -1,155 +0,0 @@ -/* Flush dcache and invalidate icache when the dcache is in writeback mode - * - * Copyright (C) 2010 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include -#include -#include -#include "cache-smp.h" - -/** - * flush_icache_page - Flush a page from the dcache and invalidate the icache - * @vma: The VMA the page is part of. - * @page: The page to be flushed. - * - * Write a page back from the dcache and invalidate the icache so that we can - * run code from it that we've just written into it - */ -void flush_icache_page(struct vm_area_struct *vma, struct page *page) -{ - unsigned long start = page_to_phys(page); - unsigned long flags; - - flags = smp_lock_cache(); - - mn10300_local_dcache_flush_page(start); - mn10300_local_icache_inv_page(start); - - smp_cache_call(SMP_IDCACHE_INV_FLUSH_RANGE, start, start + PAGE_SIZE); - smp_unlock_cache(flags); -} -EXPORT_SYMBOL(flush_icache_page); - -/** - * flush_icache_page_range - Flush dcache and invalidate icache for part of a - * single page - * @start: The starting virtual address of the page part. - * @end: The ending virtual address of the page part. - * - * Flush the dcache and invalidate the icache for part of a single page, as - * determined by the virtual addresses given. The page must be in the paged - * area. - */ -static void flush_icache_page_range(unsigned long start, unsigned long end) -{ - unsigned long addr, size, off; - struct page *page; - pgd_t *pgd; - pud_t *pud; - pmd_t *pmd; - pte_t *ppte, pte; - - /* work out how much of the page to flush */ - off = start & ~PAGE_MASK; - size = end - start; - - /* get the physical address the page is mapped to from the page - * tables */ - pgd = pgd_offset(current->mm, start); - if (!pgd || !pgd_val(*pgd)) - return; - - pud = pud_offset(pgd, start); - if (!pud || !pud_val(*pud)) - return; - - pmd = pmd_offset(pud, start); - if (!pmd || !pmd_val(*pmd)) - return; - - ppte = pte_offset_map(pmd, start); - if (!ppte) - return; - pte = *ppte; - pte_unmap(ppte); - - if (pte_none(pte)) - return; - - page = pte_page(pte); - if (!page) - return; - - addr = page_to_phys(page); - - /* flush the dcache and invalidate the icache coverage on that - * region */ - mn10300_local_dcache_flush_range2(addr + off, size); - mn10300_local_icache_inv_range2(addr + off, size); - smp_cache_call(SMP_IDCACHE_INV_FLUSH_RANGE, start, end); -} - -/** - * flush_icache_range - Globally flush dcache and invalidate icache for region - * @start: The starting virtual address of the region. - * @end: The ending virtual address of the region. - * - * This is used by the kernel to globally flush some code it has just written - * from the dcache back to RAM and then to globally invalidate the icache over - * that region so that that code can be run on all CPUs in the system. - */ -void flush_icache_range(unsigned long start, unsigned long end) -{ - unsigned long start_page, end_page; - unsigned long flags; - - flags = smp_lock_cache(); - - if (end > 0x80000000UL) { - /* addresses above 0xa0000000 do not go through the cache */ - if (end > 0xa0000000UL) { - end = 0xa0000000UL; - if (start >= end) - goto done; - } - - /* kernel addresses between 0x80000000 and 0x9fffffff do not - * require page tables, so we just map such addresses - * directly */ - start_page = (start >= 0x80000000UL) ? start : 0x80000000UL; - mn10300_local_dcache_flush_range(start_page, end); - mn10300_local_icache_inv_range(start_page, end); - smp_cache_call(SMP_IDCACHE_INV_FLUSH_RANGE, start_page, end); - if (start_page == start) - goto done; - end = start_page; - } - - start_page = start & PAGE_MASK; - end_page = (end - 1) & PAGE_MASK; - - if (start_page == end_page) { - /* the first and last bytes are on the same page */ - flush_icache_page_range(start, end); - } else if (start_page + 1 == end_page) { - /* split over two virtually contiguous pages */ - flush_icache_page_range(start, end_page); - flush_icache_page_range(end_page, end); - } else { - /* more than 2 pages; just flush the entire cache */ - mn10300_dcache_flush(); - mn10300_icache_inv(); - smp_cache_call(SMP_IDCACHE_INV_FLUSH, 0, 0); - } - -done: - smp_unlock_cache(flags); -} -EXPORT_SYMBOL(flush_icache_range); diff --git a/arch/mn10300/mm/cache-inv-by-reg.S b/arch/mn10300/mm/cache-inv-by-reg.S deleted file mode 100644 index a60825b91e772..0000000000000 --- a/arch/mn10300/mm/cache-inv-by-reg.S +++ /dev/null @@ -1,350 +0,0 @@ -/* MN10300 CPU cache invalidation routines, using automatic purge registers - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include -#include -#include -#include -#include -#include -#include "cache.inc" - -#define mn10300_local_dcache_inv_range_intr_interval \ - +((1 << MN10300_DCACHE_INV_RANGE_INTR_LOG2_INTERVAL) - 1) - -#if mn10300_local_dcache_inv_range_intr_interval > 0xff -#error MN10300_DCACHE_INV_RANGE_INTR_LOG2_INTERVAL must be 8 or less -#endif - - .am33_2 - -#ifndef CONFIG_SMP - .globl mn10300_icache_inv - .globl mn10300_icache_inv_page - .globl mn10300_icache_inv_range - .globl mn10300_icache_inv_range2 - .globl mn10300_dcache_inv - .globl mn10300_dcache_inv_page - .globl mn10300_dcache_inv_range - .globl mn10300_dcache_inv_range2 - -mn10300_icache_inv = mn10300_local_icache_inv -mn10300_icache_inv_page = mn10300_local_icache_inv_page -mn10300_icache_inv_range = mn10300_local_icache_inv_range -mn10300_icache_inv_range2 = mn10300_local_icache_inv_range2 -mn10300_dcache_inv = mn10300_local_dcache_inv -mn10300_dcache_inv_page = mn10300_local_dcache_inv_page -mn10300_dcache_inv_range = mn10300_local_dcache_inv_range -mn10300_dcache_inv_range2 = mn10300_local_dcache_inv_range2 - -#endif /* !CONFIG_SMP */ - -############################################################################### -# -# void mn10300_local_icache_inv(void) -# Invalidate the entire icache -# -############################################################################### - ALIGN - .globl mn10300_local_icache_inv - .type mn10300_local_icache_inv,@function -mn10300_local_icache_inv: - mov CHCTR,a0 - - movhu (a0),d0 - btst CHCTR_ICEN,d0 - beq mn10300_local_icache_inv_end - - invalidate_icache 1 - -mn10300_local_icache_inv_end: - ret [],0 - .size mn10300_local_icache_inv,.-mn10300_local_icache_inv - -############################################################################### -# -# void mn10300_local_dcache_inv(void) -# Invalidate the entire dcache -# -############################################################################### - ALIGN - .globl mn10300_local_dcache_inv - .type mn10300_local_dcache_inv,@function -mn10300_local_dcache_inv: - mov CHCTR,a0 - - movhu (a0),d0 - btst CHCTR_DCEN,d0 - beq mn10300_local_dcache_inv_end - - invalidate_dcache 1 - -mn10300_local_dcache_inv_end: - ret [],0 - .size mn10300_local_dcache_inv,.-mn10300_local_dcache_inv - -############################################################################### -# -# void mn10300_local_dcache_inv_range(unsigned long start, unsigned long end) -# void mn10300_local_dcache_inv_range2(unsigned long start, unsigned long size) -# void mn10300_local_dcache_inv_page(unsigned long start) -# Invalidate a range of addresses on a page in the dcache -# -############################################################################### - ALIGN - .globl mn10300_local_dcache_inv_page - .globl mn10300_local_dcache_inv_range - .globl mn10300_local_dcache_inv_range2 - .type mn10300_local_dcache_inv_page,@function - .type mn10300_local_dcache_inv_range,@function - .type mn10300_local_dcache_inv_range2,@function -mn10300_local_dcache_inv_page: - and ~(PAGE_SIZE-1),d0 - mov PAGE_SIZE,d1 -mn10300_local_dcache_inv_range2: - add d0,d1 -mn10300_local_dcache_inv_range: - # If we are in writeback mode we check the start and end alignments, - # and if they're not cacheline-aligned, we must flush any bits outside - # the range that share cachelines with stuff inside the range -#ifdef CONFIG_MN10300_CACHE_WBACK - btst ~L1_CACHE_TAG_MASK,d0 - bne 1f - btst ~L1_CACHE_TAG_MASK,d1 - beq 2f -1: - bra mn10300_local_dcache_flush_inv_range -2: -#endif /* CONFIG_MN10300_CACHE_WBACK */ - - movm [d2,d3,a2],(sp) - - mov CHCTR,a0 - movhu (a0),d2 - btst CHCTR_DCEN,d2 - beq mn10300_local_dcache_inv_range_end - - # round the addresses out to be full cachelines, unless we're in - # writeback mode, in which case we would be in flush and invalidate by - # now -#ifndef CONFIG_MN10300_CACHE_WBACK - and L1_CACHE_TAG_MASK,d0 # round start addr down - - mov L1_CACHE_BYTES-1,d2 - add d2,d1 - and L1_CACHE_TAG_MASK,d1 # round end addr up -#endif /* !CONFIG_MN10300_CACHE_WBACK */ - - sub d0,d1,d2 # calculate the total size - mov d0,a2 # A2 = start address - mov d1,a1 # A1 = end address - - LOCAL_CLI_SAVE(d3) - - mov DCPGCR,a0 # make sure the purger isn't busy - setlb - mov (a0),d0 - btst DCPGCR_DCPGBSY,d0 - lne - - # skip initial address alignment calculation if address is zero - mov d2,d1 - cmp 0,a2 - beq 1f - -dcivloop: - /* calculate alignsize - * - * alignsize = L1_CACHE_BYTES; - * while (! start & alignsize) { - * alignsize <<=1; - * } - * d1 = alignsize; - */ - mov L1_CACHE_BYTES,d1 - lsr 1,d1 - setlb - add d1,d1 - mov d1,d0 - and a2,d0 - leq - -1: - /* calculate invsize - * - * if (totalsize > alignsize) { - * invsize = alignsize; - * } else { - * invsize = totalsize; - * tmp = 0x80000000; - * while (! invsize & tmp) { - * tmp >>= 1; - * } - * invsize = tmp; - * } - * d1 = invsize - */ - cmp d2,d1 - bns 2f - mov d2,d1 - - mov 0x80000000,d0 # start from 31bit=1 - setlb - lsr 1,d0 - mov d0,e0 - and d1,e0 - leq - mov d0,d1 - -2: - /* set mask - * - * mask = ~(invsize-1); - * DCPGMR = mask; - */ - mov d1,d0 - add -1,d0 - not d0 - mov d0,(DCPGMR) - - # invalidate area - mov a2,d0 - or DCPGCR_DCI,d0 - mov d0,(a0) # DCPGCR = (mask & start) | DCPGCR_DCI - - setlb # wait for the purge to complete - mov (a0),d0 - btst DCPGCR_DCPGBSY,d0 - lne - - sub d1,d2 # decrease size remaining - add d1,a2 # increase next start address - - /* check invalidating of end address - * - * a2 = a2 + invsize - * if (a2 < end) { - * goto dcivloop; - * } */ - cmp a1,a2 - bns dcivloop - - LOCAL_IRQ_RESTORE(d3) - -mn10300_local_dcache_inv_range_end: - ret [d2,d3,a2],12 - .size mn10300_local_dcache_inv_page,.-mn10300_local_dcache_inv_page - .size mn10300_local_dcache_inv_range,.-mn10300_local_dcache_inv_range - .size mn10300_local_dcache_inv_range2,.-mn10300_local_dcache_inv_range2 - -############################################################################### -# -# void mn10300_local_icache_inv_page(unsigned long start) -# void mn10300_local_icache_inv_range2(unsigned long start, unsigned long size) -# void mn10300_local_icache_inv_range(unsigned long start, unsigned long end) -# Invalidate a range of addresses on a page in the icache -# -############################################################################### - ALIGN - .globl mn10300_local_icache_inv_page - .globl mn10300_local_icache_inv_range - .globl mn10300_local_icache_inv_range2 - .type mn10300_local_icache_inv_page,@function - .type mn10300_local_icache_inv_range,@function - .type mn10300_local_icache_inv_range2,@function -mn10300_local_icache_inv_page: - and ~(PAGE_SIZE-1),d0 - mov PAGE_SIZE,d1 -mn10300_local_icache_inv_range2: - add d0,d1 -mn10300_local_icache_inv_range: - movm [d2,d3,a2],(sp) - - mov CHCTR,a0 - movhu (a0),d2 - btst CHCTR_ICEN,d2 - beq mn10300_local_icache_inv_range_reg_end - - /* calculate alignsize - * - * alignsize = L1_CACHE_BYTES; - * for (i = (end - start - 1) / L1_CACHE_BYTES ; i > 0; i >>= 1) { - * alignsize <<= 1; - * } - * d2 = alignsize; - */ - mov L1_CACHE_BYTES,d2 - sub d0,d1,d3 - add -1,d3 - lsr L1_CACHE_SHIFT,d3 - beq 2f -1: - add d2,d2 - lsr 1,d3 - bne 1b -2: - - /* a1 = end */ - mov d1,a1 - - LOCAL_CLI_SAVE(d3) - - mov ICIVCR,a0 - /* wait for busy bit of area invalidation */ - setlb - mov (a0),d1 - btst ICIVCR_ICIVBSY,d1 - lne - - /* set mask - * - * mask = ~(alignsize-1); - * ICIVMR = mask; - */ - mov d2,d1 - add -1,d1 - not d1 - mov d1,(ICIVMR) - /* a2 = mask & start */ - and d1,d0,a2 - -icivloop: - /* area invalidate - * - * ICIVCR = (mask & start) | ICIVCR_ICI - */ - mov a2,d0 - or ICIVCR_ICI,d0 - mov d0,(a0) - - /* wait for busy bit of area invalidation */ - setlb - mov (a0),d1 - btst ICIVCR_ICIVBSY,d1 - lne - - /* check invalidating of end address - * - * a2 = a2 + alignsize - * if (a2 < end) { - * goto icivloop; - * } */ - add d2,a2 - cmp a1,a2 - bns icivloop - - LOCAL_IRQ_RESTORE(d3) - -mn10300_local_icache_inv_range_reg_end: - ret [d2,d3,a2],12 - .size mn10300_local_icache_inv_page,.-mn10300_local_icache_inv_page - .size mn10300_local_icache_inv_range,.-mn10300_local_icache_inv_range - .size mn10300_local_icache_inv_range2,.-mn10300_local_icache_inv_range2 diff --git a/arch/mn10300/mm/cache-inv-by-tag.S b/arch/mn10300/mm/cache-inv-by-tag.S deleted file mode 100644 index ccedce9c144d3..0000000000000 --- a/arch/mn10300/mm/cache-inv-by-tag.S +++ /dev/null @@ -1,276 +0,0 @@ -/* MN10300 CPU core caching routines - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include -#include -#include -#include -#include -#include -#include "cache.inc" - -#define mn10300_local_dcache_inv_range_intr_interval \ - +((1 << MN10300_DCACHE_INV_RANGE_INTR_LOG2_INTERVAL) - 1) - -#if mn10300_local_dcache_inv_range_intr_interval > 0xff -#error MN10300_DCACHE_INV_RANGE_INTR_LOG2_INTERVAL must be 8 or less -#endif - - .am33_2 - - .globl mn10300_local_icache_inv_page - .globl mn10300_local_icache_inv_range - .globl mn10300_local_icache_inv_range2 - -mn10300_local_icache_inv_page = mn10300_local_icache_inv -mn10300_local_icache_inv_range = mn10300_local_icache_inv -mn10300_local_icache_inv_range2 = mn10300_local_icache_inv - -#ifndef CONFIG_SMP - .globl mn10300_icache_inv - .globl mn10300_icache_inv_page - .globl mn10300_icache_inv_range - .globl mn10300_icache_inv_range2 - .globl mn10300_dcache_inv - .globl mn10300_dcache_inv_page - .globl mn10300_dcache_inv_range - .globl mn10300_dcache_inv_range2 - -mn10300_icache_inv = mn10300_local_icache_inv -mn10300_icache_inv_page = mn10300_local_icache_inv_page -mn10300_icache_inv_range = mn10300_local_icache_inv_range -mn10300_icache_inv_range2 = mn10300_local_icache_inv_range2 -mn10300_dcache_inv = mn10300_local_dcache_inv -mn10300_dcache_inv_page = mn10300_local_dcache_inv_page -mn10300_dcache_inv_range = mn10300_local_dcache_inv_range -mn10300_dcache_inv_range2 = mn10300_local_dcache_inv_range2 - -#endif /* !CONFIG_SMP */ - -############################################################################### -# -# void mn10300_local_icache_inv(void) -# Invalidate the entire icache -# -############################################################################### - ALIGN - .globl mn10300_local_icache_inv - .type mn10300_local_icache_inv,@function -mn10300_local_icache_inv: - mov CHCTR,a0 - - movhu (a0),d0 - btst CHCTR_ICEN,d0 - beq mn10300_local_icache_inv_end - - invalidate_icache 1 - -mn10300_local_icache_inv_end: - ret [],0 - .size mn10300_local_icache_inv,.-mn10300_local_icache_inv - -############################################################################### -# -# void mn10300_local_dcache_inv(void) -# Invalidate the entire dcache -# -############################################################################### - ALIGN - .globl mn10300_local_dcache_inv - .type mn10300_local_dcache_inv,@function -mn10300_local_dcache_inv: - mov CHCTR,a0 - - movhu (a0),d0 - btst CHCTR_DCEN,d0 - beq mn10300_local_dcache_inv_end - - invalidate_dcache 1 - -mn10300_local_dcache_inv_end: - ret [],0 - .size mn10300_local_dcache_inv,.-mn10300_local_dcache_inv - -############################################################################### -# -# void mn10300_local_dcache_inv_range(unsigned long start, unsigned long end) -# void mn10300_local_dcache_inv_range2(unsigned long start, unsigned long size) -# void mn10300_local_dcache_inv_page(unsigned long start) -# Invalidate a range of addresses on a page in the dcache -# -############################################################################### - ALIGN - .globl mn10300_local_dcache_inv_page - .globl mn10300_local_dcache_inv_range - .globl mn10300_local_dcache_inv_range2 - .type mn10300_local_dcache_inv_page,@function - .type mn10300_local_dcache_inv_range,@function - .type mn10300_local_dcache_inv_range2,@function -mn10300_local_dcache_inv_page: - and ~(PAGE_SIZE-1),d0 - mov PAGE_SIZE,d1 -mn10300_local_dcache_inv_range2: - add d0,d1 -mn10300_local_dcache_inv_range: - # If we are in writeback mode we check the start and end alignments, - # and if they're not cacheline-aligned, we must flush any bits outside - # the range that share cachelines with stuff inside the range -#ifdef CONFIG_MN10300_CACHE_WBACK - btst ~L1_CACHE_TAG_MASK,d0 - bne 1f - btst ~L1_CACHE_TAG_MASK,d1 - beq 2f -1: - bra mn10300_local_dcache_flush_inv_range -2: -#endif /* CONFIG_MN10300_CACHE_WBACK */ - - movm [d2,d3,a2],(sp) - - mov CHCTR,a2 - movhu (a2),d2 - btst CHCTR_DCEN,d2 - beq mn10300_local_dcache_inv_range_end - -#ifndef CONFIG_MN10300_CACHE_WBACK - and L1_CACHE_TAG_MASK,d0 # round start addr down - - add L1_CACHE_BYTES,d1 # round end addr up - and L1_CACHE_TAG_MASK,d1 -#endif /* !CONFIG_MN10300_CACHE_WBACK */ - mov d0,a1 - - clr d2 # we're going to clear tag RAM - # entries - - # read the tags from the tag RAM, and if they indicate a valid dirty - # cache line then invalidate that line - mov DCACHE_TAG(0,0),a0 - mov a1,d0 - and L1_CACHE_TAG_ENTRY,d0 - add d0,a0 # starting dcache tag RAM - # access address - - sub a1,d1 - lsr L1_CACHE_SHIFT,d1 # total number of entries to - # examine - - and ~(L1_CACHE_DISPARITY-1),a1 # determine comparator base - -mn10300_local_dcache_inv_range_outer_loop: - LOCAL_CLI_SAVE(d3) - - # disable the dcache - movhu (a2),d0 - and ~CHCTR_DCEN,d0 - movhu d0,(a2) - - # and wait for it to calm down - setlb - movhu (a2),d0 - btst CHCTR_DCBUSY,d0 - lne - -mn10300_local_dcache_inv_range_loop: - - # process the way 0 slot - mov (L1_CACHE_WAYDISP*0,a0),d0 # read the tag in the way 0 slot - btst L1_CACHE_TAG_VALID,d0 - beq mn10300_local_dcache_inv_range_skip_0 # jump if this cacheline - # is not valid - - xor a1,d0 - lsr 12,d0 - bne mn10300_local_dcache_inv_range_skip_0 # jump if not this cacheline - - mov d2,(L1_CACHE_WAYDISP*0,a0) # kill the tag - -mn10300_local_dcache_inv_range_skip_0: - - # process the way 1 slot - mov (L1_CACHE_WAYDISP*1,a0),d0 # read the tag in the way 1 slot - btst L1_CACHE_TAG_VALID,d0 - beq mn10300_local_dcache_inv_range_skip_1 # jump if this cacheline - # is not valid - - xor a1,d0 - lsr 12,d0 - bne mn10300_local_dcache_inv_range_skip_1 # jump if not this cacheline - - mov d2,(L1_CACHE_WAYDISP*1,a0) # kill the tag - -mn10300_local_dcache_inv_range_skip_1: - - # process the way 2 slot - mov (L1_CACHE_WAYDISP*2,a0),d0 # read the tag in the way 2 slot - btst L1_CACHE_TAG_VALID,d0 - beq mn10300_local_dcache_inv_range_skip_2 # jump if this cacheline - # is not valid - - xor a1,d0 - lsr 12,d0 - bne mn10300_local_dcache_inv_range_skip_2 # jump if not this cacheline - - mov d2,(L1_CACHE_WAYDISP*2,a0) # kill the tag - -mn10300_local_dcache_inv_range_skip_2: - - # process the way 3 slot - mov (L1_CACHE_WAYDISP*3,a0),d0 # read the tag in the way 3 slot - btst L1_CACHE_TAG_VALID,d0 - beq mn10300_local_dcache_inv_range_skip_3 # jump if this cacheline - # is not valid - - xor a1,d0 - lsr 12,d0 - bne mn10300_local_dcache_inv_range_skip_3 # jump if not this cacheline - - mov d2,(L1_CACHE_WAYDISP*3,a0) # kill the tag - -mn10300_local_dcache_inv_range_skip_3: - - # approx every N steps we re-enable the cache and see if there are any - # interrupts to be processed - # we also break out if we've reached the end of the loop - # (the bottom nibble of the count is zero in both cases) - add L1_CACHE_BYTES,a0 - add L1_CACHE_BYTES,a1 - and ~L1_CACHE_WAYDISP,a0 - add -1,d1 - btst mn10300_local_dcache_inv_range_intr_interval,d1 - bne mn10300_local_dcache_inv_range_loop - - # wait for the cache to finish what it's doing - setlb - movhu (a2),d0 - btst CHCTR_DCBUSY,d0 - lne - - # and reenable it - or CHCTR_DCEN,d0 - movhu d0,(a2) - movhu (a2),d0 - - # re-enable interrupts - # - we don't bother with delay NOPs as we'll have enough instructions - # before we disable interrupts again to give the interrupts a chance - # to happen - LOCAL_IRQ_RESTORE(d3) - - # go around again if the counter hasn't yet reached zero - add 0,d1 - bne mn10300_local_dcache_inv_range_outer_loop - -mn10300_local_dcache_inv_range_end: - ret [d2,d3,a2],12 - .size mn10300_local_dcache_inv_page,.-mn10300_local_dcache_inv_page - .size mn10300_local_dcache_inv_range,.-mn10300_local_dcache_inv_range - .size mn10300_local_dcache_inv_range2,.-mn10300_local_dcache_inv_range2 diff --git a/arch/mn10300/mm/cache-inv-icache.c b/arch/mn10300/mm/cache-inv-icache.c deleted file mode 100644 index a6b63dde603d5..0000000000000 --- a/arch/mn10300/mm/cache-inv-icache.c +++ /dev/null @@ -1,129 +0,0 @@ -/* Invalidate icache when dcache doesn't need invalidation as it's in - * write-through mode - * - * Copyright (C) 2010 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include -#include -#include -#include "cache-smp.h" - -/** - * flush_icache_page_range - Flush dcache and invalidate icache for part of a - * single page - * @start: The starting virtual address of the page part. - * @end: The ending virtual address of the page part. - * - * Invalidate the icache for part of a single page, as determined by the - * virtual addresses given. The page must be in the paged area. The dcache is - * not flushed as the cache must be in write-through mode to get here. - */ -static void flush_icache_page_range(unsigned long start, unsigned long end) -{ - unsigned long addr, size, off; - struct page *page; - pgd_t *pgd; - pud_t *pud; - pmd_t *pmd; - pte_t *ppte, pte; - - /* work out how much of the page to flush */ - off = start & ~PAGE_MASK; - size = end - start; - - /* get the physical address the page is mapped to from the page - * tables */ - pgd = pgd_offset(current->mm, start); - if (!pgd || !pgd_val(*pgd)) - return; - - pud = pud_offset(pgd, start); - if (!pud || !pud_val(*pud)) - return; - - pmd = pmd_offset(pud, start); - if (!pmd || !pmd_val(*pmd)) - return; - - ppte = pte_offset_map(pmd, start); - if (!ppte) - return; - pte = *ppte; - pte_unmap(ppte); - - if (pte_none(pte)) - return; - - page = pte_page(pte); - if (!page) - return; - - addr = page_to_phys(page); - - /* invalidate the icache coverage on that region */ - mn10300_local_icache_inv_range2(addr + off, size); - smp_cache_call(SMP_ICACHE_INV_RANGE, start, end); -} - -/** - * flush_icache_range - Globally flush dcache and invalidate icache for region - * @start: The starting virtual address of the region. - * @end: The ending virtual address of the region. - * - * This is used by the kernel to globally flush some code it has just written - * from the dcache back to RAM and then to globally invalidate the icache over - * that region so that that code can be run on all CPUs in the system. - */ -void flush_icache_range(unsigned long start, unsigned long end) -{ - unsigned long start_page, end_page; - unsigned long flags; - - flags = smp_lock_cache(); - - if (end > 0x80000000UL) { - /* addresses above 0xa0000000 do not go through the cache */ - if (end > 0xa0000000UL) { - end = 0xa0000000UL; - if (start >= end) - goto done; - } - - /* kernel addresses between 0x80000000 and 0x9fffffff do not - * require page tables, so we just map such addresses - * directly */ - start_page = (start >= 0x80000000UL) ? start : 0x80000000UL; - mn10300_icache_inv_range(start_page, end); - smp_cache_call(SMP_ICACHE_INV_RANGE, start, end); - if (start_page == start) - goto done; - end = start_page; - } - - start_page = start & PAGE_MASK; - end_page = (end - 1) & PAGE_MASK; - - if (start_page == end_page) { - /* the first and last bytes are on the same page */ - flush_icache_page_range(start, end); - } else if (start_page + 1 == end_page) { - /* split over two virtually contiguous pages */ - flush_icache_page_range(start, end_page); - flush_icache_page_range(end_page, end); - } else { - /* more than 2 pages; just flush the entire cache */ - mn10300_local_icache_inv(); - smp_cache_call(SMP_ICACHE_INV, 0, 0); - } - -done: - smp_unlock_cache(flags); -} -EXPORT_SYMBOL(flush_icache_range); diff --git a/arch/mn10300/mm/cache-smp-flush.c b/arch/mn10300/mm/cache-smp-flush.c deleted file mode 100644 index fd51af5eaf70f..0000000000000 --- a/arch/mn10300/mm/cache-smp-flush.c +++ /dev/null @@ -1,156 +0,0 @@ -/* Functions for global dcache flush when writeback caching in SMP - * - * Copyright (C) 2010 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include -#include "cache-smp.h" - -/** - * mn10300_dcache_flush - Globally flush data cache - * - * Flush the data cache on all CPUs. - */ -void mn10300_dcache_flush(void) -{ - unsigned long flags; - - flags = smp_lock_cache(); - mn10300_local_dcache_flush(); - smp_cache_call(SMP_DCACHE_FLUSH, 0, 0); - smp_unlock_cache(flags); -} - -/** - * mn10300_dcache_flush_page - Globally flush a page of data cache - * @start: The address of the page of memory to be flushed. - * - * Flush a range of addresses in the data cache on all CPUs covering - * the page that includes the given address. - */ -void mn10300_dcache_flush_page(unsigned long start) -{ - unsigned long flags; - - start &= ~(PAGE_SIZE-1); - - flags = smp_lock_cache(); - mn10300_local_dcache_flush_page(start); - smp_cache_call(SMP_DCACHE_FLUSH_RANGE, start, start + PAGE_SIZE); - smp_unlock_cache(flags); -} - -/** - * mn10300_dcache_flush_range - Globally flush range of data cache - * @start: The start address of the region to be flushed. - * @end: The end address of the region to be flushed. - * - * Flush a range of addresses in the data cache on all CPUs, between start and - * end-1 inclusive. - */ -void mn10300_dcache_flush_range(unsigned long start, unsigned long end) -{ - unsigned long flags; - - flags = smp_lock_cache(); - mn10300_local_dcache_flush_range(start, end); - smp_cache_call(SMP_DCACHE_FLUSH_RANGE, start, end); - smp_unlock_cache(flags); -} - -/** - * mn10300_dcache_flush_range2 - Globally flush range of data cache - * @start: The start address of the region to be flushed. - * @size: The size of the region to be flushed. - * - * Flush a range of addresses in the data cache on all CPUs, between start and - * start+size-1 inclusive. - */ -void mn10300_dcache_flush_range2(unsigned long start, unsigned long size) -{ - unsigned long flags; - - flags = smp_lock_cache(); - mn10300_local_dcache_flush_range2(start, size); - smp_cache_call(SMP_DCACHE_FLUSH_RANGE, start, start + size); - smp_unlock_cache(flags); -} - -/** - * mn10300_dcache_flush_inv - Globally flush and invalidate data cache - * - * Flush and invalidate the data cache on all CPUs. - */ -void mn10300_dcache_flush_inv(void) -{ - unsigned long flags; - - flags = smp_lock_cache(); - mn10300_local_dcache_flush_inv(); - smp_cache_call(SMP_DCACHE_FLUSH_INV, 0, 0); - smp_unlock_cache(flags); -} - -/** - * mn10300_dcache_flush_inv_page - Globally flush and invalidate a page of data - * cache - * @start: The address of the page of memory to be flushed and invalidated. - * - * Flush and invalidate a range of addresses in the data cache on all CPUs - * covering the page that includes the given address. - */ -void mn10300_dcache_flush_inv_page(unsigned long start) -{ - unsigned long flags; - - start &= ~(PAGE_SIZE-1); - - flags = smp_lock_cache(); - mn10300_local_dcache_flush_inv_page(start); - smp_cache_call(SMP_DCACHE_FLUSH_INV_RANGE, start, start + PAGE_SIZE); - smp_unlock_cache(flags); -} - -/** - * mn10300_dcache_flush_inv_range - Globally flush and invalidate range of data - * cache - * @start: The start address of the region to be flushed and invalidated. - * @end: The end address of the region to be flushed and invalidated. - * - * Flush and invalidate a range of addresses in the data cache on all CPUs, - * between start and end-1 inclusive. - */ -void mn10300_dcache_flush_inv_range(unsigned long start, unsigned long end) -{ - unsigned long flags; - - flags = smp_lock_cache(); - mn10300_local_dcache_flush_inv_range(start, end); - smp_cache_call(SMP_DCACHE_FLUSH_INV_RANGE, start, end); - smp_unlock_cache(flags); -} - -/** - * mn10300_dcache_flush_inv_range2 - Globally flush and invalidate range of data - * cache - * @start: The start address of the region to be flushed and invalidated. - * @size: The size of the region to be flushed and invalidated. - * - * Flush and invalidate a range of addresses in the data cache on all CPUs, - * between start and start+size-1 inclusive. - */ -void mn10300_dcache_flush_inv_range2(unsigned long start, unsigned long size) -{ - unsigned long flags; - - flags = smp_lock_cache(); - mn10300_local_dcache_flush_inv_range2(start, size); - smp_cache_call(SMP_DCACHE_FLUSH_INV_RANGE, start, start + size); - smp_unlock_cache(flags); -} diff --git a/arch/mn10300/mm/cache-smp-inv.c b/arch/mn10300/mm/cache-smp-inv.c deleted file mode 100644 index ff1787358c8e6..0000000000000 --- a/arch/mn10300/mm/cache-smp-inv.c +++ /dev/null @@ -1,153 +0,0 @@ -/* Functions for global i/dcache invalidation when caching in SMP - * - * Copyright (C) 2010 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include -#include "cache-smp.h" - -/** - * mn10300_icache_inv - Globally invalidate instruction cache - * - * Invalidate the instruction cache on all CPUs. - */ -void mn10300_icache_inv(void) -{ - unsigned long flags; - - flags = smp_lock_cache(); - mn10300_local_icache_inv(); - smp_cache_call(SMP_ICACHE_INV, 0, 0); - smp_unlock_cache(flags); -} - -/** - * mn10300_icache_inv_page - Globally invalidate a page of instruction cache - * @start: The address of the page of memory to be invalidated. - * - * Invalidate a range of addresses in the instruction cache on all CPUs - * covering the page that includes the given address. - */ -void mn10300_icache_inv_page(unsigned long start) -{ - unsigned long flags; - - start &= ~(PAGE_SIZE-1); - - flags = smp_lock_cache(); - mn10300_local_icache_inv_page(start); - smp_cache_call(SMP_ICACHE_INV_RANGE, start, start + PAGE_SIZE); - smp_unlock_cache(flags); -} - -/** - * mn10300_icache_inv_range - Globally invalidate range of instruction cache - * @start: The start address of the region to be invalidated. - * @end: The end address of the region to be invalidated. - * - * Invalidate a range of addresses in the instruction cache on all CPUs, - * between start and end-1 inclusive. - */ -void mn10300_icache_inv_range(unsigned long start, unsigned long end) -{ - unsigned long flags; - - flags = smp_lock_cache(); - mn10300_local_icache_inv_range(start, end); - smp_cache_call(SMP_ICACHE_INV_RANGE, start, end); - smp_unlock_cache(flags); -} - -/** - * mn10300_icache_inv_range2 - Globally invalidate range of instruction cache - * @start: The start address of the region to be invalidated. - * @size: The size of the region to be invalidated. - * - * Invalidate a range of addresses in the instruction cache on all CPUs, - * between start and start+size-1 inclusive. - */ -void mn10300_icache_inv_range2(unsigned long start, unsigned long size) -{ - unsigned long flags; - - flags = smp_lock_cache(); - mn10300_local_icache_inv_range2(start, size); - smp_cache_call(SMP_ICACHE_INV_RANGE, start, start + size); - smp_unlock_cache(flags); -} - -/** - * mn10300_dcache_inv - Globally invalidate data cache - * - * Invalidate the data cache on all CPUs. - */ -void mn10300_dcache_inv(void) -{ - unsigned long flags; - - flags = smp_lock_cache(); - mn10300_local_dcache_inv(); - smp_cache_call(SMP_DCACHE_INV, 0, 0); - smp_unlock_cache(flags); -} - -/** - * mn10300_dcache_inv_page - Globally invalidate a page of data cache - * @start: The address of the page of memory to be invalidated. - * - * Invalidate a range of addresses in the data cache on all CPUs covering the - * page that includes the given address. - */ -void mn10300_dcache_inv_page(unsigned long start) -{ - unsigned long flags; - - start &= ~(PAGE_SIZE-1); - - flags = smp_lock_cache(); - mn10300_local_dcache_inv_page(start); - smp_cache_call(SMP_DCACHE_INV_RANGE, start, start + PAGE_SIZE); - smp_unlock_cache(flags); -} - -/** - * mn10300_dcache_inv_range - Globally invalidate range of data cache - * @start: The start address of the region to be invalidated. - * @end: The end address of the region to be invalidated. - * - * Invalidate a range of addresses in the data cache on all CPUs, between start - * and end-1 inclusive. - */ -void mn10300_dcache_inv_range(unsigned long start, unsigned long end) -{ - unsigned long flags; - - flags = smp_lock_cache(); - mn10300_local_dcache_inv_range(start, end); - smp_cache_call(SMP_DCACHE_INV_RANGE, start, end); - smp_unlock_cache(flags); -} - -/** - * mn10300_dcache_inv_range2 - Globally invalidate range of data cache - * @start: The start address of the region to be invalidated. - * @size: The size of the region to be invalidated. - * - * Invalidate a range of addresses in the data cache on all CPUs, between start - * and start+size-1 inclusive. - */ -void mn10300_dcache_inv_range2(unsigned long start, unsigned long size) -{ - unsigned long flags; - - flags = smp_lock_cache(); - mn10300_local_dcache_inv_range2(start, size); - smp_cache_call(SMP_DCACHE_INV_RANGE, start, start + size); - smp_unlock_cache(flags); -} diff --git a/arch/mn10300/mm/cache-smp.c b/arch/mn10300/mm/cache-smp.c deleted file mode 100644 index e80996064d3d5..0000000000000 --- a/arch/mn10300/mm/cache-smp.c +++ /dev/null @@ -1,105 +0,0 @@ -/* SMP global caching code - * - * Copyright (C) 2010 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "cache-smp.h" - -DEFINE_SPINLOCK(smp_cache_lock); -static unsigned long smp_cache_mask; -static unsigned long smp_cache_start; -static unsigned long smp_cache_end; -static cpumask_t smp_cache_ipi_map; /* Bitmask of cache IPI done CPUs */ - -/** - * smp_cache_interrupt - Handle IPI request to flush caches. - * - * Handle a request delivered by IPI to flush the current CPU's - * caches. The parameters are stored in smp_cache_*. - */ -void smp_cache_interrupt(void) -{ - unsigned long opr_mask = smp_cache_mask; - - switch ((enum smp_dcache_ops)(opr_mask & SMP_DCACHE_OP_MASK)) { - case SMP_DCACHE_NOP: - break; - case SMP_DCACHE_INV: - mn10300_local_dcache_inv(); - break; - case SMP_DCACHE_INV_RANGE: - mn10300_local_dcache_inv_range(smp_cache_start, smp_cache_end); - break; - case SMP_DCACHE_FLUSH: - mn10300_local_dcache_flush(); - break; - case SMP_DCACHE_FLUSH_RANGE: - mn10300_local_dcache_flush_range(smp_cache_start, - smp_cache_end); - break; - case SMP_DCACHE_FLUSH_INV: - mn10300_local_dcache_flush_inv(); - break; - case SMP_DCACHE_FLUSH_INV_RANGE: - mn10300_local_dcache_flush_inv_range(smp_cache_start, - smp_cache_end); - break; - } - - switch ((enum smp_icache_ops)(opr_mask & SMP_ICACHE_OP_MASK)) { - case SMP_ICACHE_NOP: - break; - case SMP_ICACHE_INV: - mn10300_local_icache_inv(); - break; - case SMP_ICACHE_INV_RANGE: - mn10300_local_icache_inv_range(smp_cache_start, smp_cache_end); - break; - } - - cpumask_clear_cpu(smp_processor_id(), &smp_cache_ipi_map); -} - -/** - * smp_cache_call - Issue an IPI to request the other CPUs flush caches - * @opr_mask: Cache operation flags - * @start: Start address of request - * @end: End address of request - * - * Send cache flush IPI to other CPUs. This invokes smp_cache_interrupt() - * above on those other CPUs and then waits for them to finish. - * - * The caller must hold smp_cache_lock. - */ -void smp_cache_call(unsigned long opr_mask, - unsigned long start, unsigned long end) -{ - smp_cache_mask = opr_mask; - smp_cache_start = start; - smp_cache_end = end; - cpumask_copy(&smp_cache_ipi_map, cpu_online_mask); - cpumask_clear_cpu(smp_processor_id(), &smp_cache_ipi_map); - - send_IPI_allbutself(FLUSH_CACHE_IPI); - - while (!cpumask_empty(&smp_cache_ipi_map)) - /* nothing. lockup detection does not belong here */ - mb(); -} diff --git a/arch/mn10300/mm/cache-smp.h b/arch/mn10300/mm/cache-smp.h deleted file mode 100644 index cb52892aa66a0..0000000000000 --- a/arch/mn10300/mm/cache-smp.h +++ /dev/null @@ -1,69 +0,0 @@ -/* SMP caching definitions - * - * Copyright (C) 2010 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - - -/* - * Operation requests for smp_cache_call(). - * - * One of smp_icache_ops and one of smp_dcache_ops can be OR'd together. - */ -enum smp_icache_ops { - SMP_ICACHE_NOP = 0x0000, - SMP_ICACHE_INV = 0x0001, - SMP_ICACHE_INV_RANGE = 0x0002, -}; -#define SMP_ICACHE_OP_MASK 0x0003 - -enum smp_dcache_ops { - SMP_DCACHE_NOP = 0x0000, - SMP_DCACHE_INV = 0x0004, - SMP_DCACHE_INV_RANGE = 0x0008, - SMP_DCACHE_FLUSH = 0x000c, - SMP_DCACHE_FLUSH_RANGE = 0x0010, - SMP_DCACHE_FLUSH_INV = 0x0014, - SMP_DCACHE_FLUSH_INV_RANGE = 0x0018, -}; -#define SMP_DCACHE_OP_MASK 0x001c - -#define SMP_IDCACHE_INV_FLUSH (SMP_ICACHE_INV | SMP_DCACHE_FLUSH) -#define SMP_IDCACHE_INV_FLUSH_RANGE (SMP_ICACHE_INV_RANGE | SMP_DCACHE_FLUSH_RANGE) - -/* - * cache-smp.c - */ -#ifdef CONFIG_SMP -extern spinlock_t smp_cache_lock; - -extern void smp_cache_call(unsigned long opr_mask, - unsigned long addr, unsigned long end); - -static inline unsigned long smp_lock_cache(void) - __acquires(&smp_cache_lock) -{ - unsigned long flags; - spin_lock_irqsave(&smp_cache_lock, flags); - return flags; -} - -static inline void smp_unlock_cache(unsigned long flags) - __releases(&smp_cache_lock) -{ - spin_unlock_irqrestore(&smp_cache_lock, flags); -} - -#else -static inline unsigned long smp_lock_cache(void) { return 0; } -static inline void smp_unlock_cache(unsigned long flags) {} -static inline void smp_cache_call(unsigned long opr_mask, - unsigned long addr, unsigned long end) -{ -} -#endif /* CONFIG_SMP */ diff --git a/arch/mn10300/mm/cache.c b/arch/mn10300/mm/cache.c deleted file mode 100644 index 0b925cce2b832..0000000000000 --- a/arch/mn10300/mm/cache.c +++ /dev/null @@ -1,54 +0,0 @@ -/* MN10300 Cache flushing routines - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "cache-smp.h" - -EXPORT_SYMBOL(mn10300_icache_inv); -EXPORT_SYMBOL(mn10300_icache_inv_range); -EXPORT_SYMBOL(mn10300_icache_inv_range2); -EXPORT_SYMBOL(mn10300_icache_inv_page); -EXPORT_SYMBOL(mn10300_dcache_inv); -EXPORT_SYMBOL(mn10300_dcache_inv_range); -EXPORT_SYMBOL(mn10300_dcache_inv_range2); -EXPORT_SYMBOL(mn10300_dcache_inv_page); - -#ifdef CONFIG_MN10300_CACHE_WBACK -EXPORT_SYMBOL(mn10300_dcache_flush); -EXPORT_SYMBOL(mn10300_dcache_flush_inv); -EXPORT_SYMBOL(mn10300_dcache_flush_inv_range); -EXPORT_SYMBOL(mn10300_dcache_flush_inv_range2); -EXPORT_SYMBOL(mn10300_dcache_flush_inv_page); -EXPORT_SYMBOL(mn10300_dcache_flush_range); -EXPORT_SYMBOL(mn10300_dcache_flush_range2); -EXPORT_SYMBOL(mn10300_dcache_flush_page); -#endif - -/* - * allow userspace to flush the instruction cache - */ -asmlinkage long sys_cacheflush(unsigned long start, unsigned long end) -{ - if (end < start) - return -EINVAL; - - flush_icache_range(start, end); - return 0; -} diff --git a/arch/mn10300/mm/cache.inc b/arch/mn10300/mm/cache.inc deleted file mode 100644 index 394a119b9c733..0000000000000 --- a/arch/mn10300/mm/cache.inc +++ /dev/null @@ -1,133 +0,0 @@ -/* MN10300 CPU core caching macros -*- asm -*- - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - - -############################################################################### -# -# Invalidate the instruction cache. -# A0: Should hold CHCTR -# D0: Should have been read from CHCTR -# D1: Will be clobbered -# -# On some cores it is necessary to disable the icache whilst we do this. -# -############################################################################### - .macro invalidate_icache,disable_irq - -#if defined(CONFIG_AM33_2) || defined(CONFIG_AM33_3) - .if \disable_irq - # don't want an interrupt routine seeing a disabled cache - mov epsw,d1 - and ~EPSW_IE,epsw - or EPSW_NMID,epsw - nop - nop - .endif - - # disable the icache - and ~CHCTR_ICEN,d0 - movhu d0,(a0) - - # and wait for it to calm down - setlb - movhu (a0),d0 - btst CHCTR_ICBUSY,d0 - lne - - # invalidate - or CHCTR_ICINV,d0 - movhu d0,(a0) - - # wait for the cache to finish - setlb - movhu (a0),d0 - btst CHCTR_ICBUSY,d0 - lne - - # and reenable it - or CHCTR_ICEN,d0 - movhu d0,(a0) - movhu (a0),d0 - - .if \disable_irq - LOCAL_IRQ_RESTORE(d1) - .endif - -#else /* CONFIG_AM33_2 || CONFIG_AM33_3 */ - - # invalidate - or CHCTR_ICINV,d0 - movhu d0,(a0) - movhu (a0),d0 - -#endif /* CONFIG_AM33_2 || CONFIG_AM33_3 */ - .endm - -############################################################################### -# -# Invalidate the data cache. -# A0: Should hold CHCTR -# D0: Should have been read from CHCTR -# D1: Will be clobbered -# -# On some cores it is necessary to disable the dcache whilst we do this. -# -############################################################################### - .macro invalidate_dcache,disable_irq - -#if defined(CONFIG_AM33_2) || defined(CONFIG_AM33_3) - .if \disable_irq - # don't want an interrupt routine seeing a disabled cache - mov epsw,d1 - and ~EPSW_IE,epsw - or EPSW_NMID,epsw - nop - nop - .endif - - # disable the dcache - and ~CHCTR_DCEN,d0 - movhu d0,(a0) - - # and wait for it to calm down - setlb - movhu (a0),d0 - btst CHCTR_DCBUSY,d0 - lne - - # invalidate - or CHCTR_DCINV,d0 - movhu d0,(a0) - - # wait for the cache to finish - setlb - movhu (a0),d0 - btst CHCTR_DCBUSY,d0 - lne - - # and reenable it - or CHCTR_DCEN,d0 - movhu d0,(a0) - movhu (a0),d0 - - .if \disable_irq - LOCAL_IRQ_RESTORE(d1) - .endif - -#else /* CONFIG_AM33_2 || CONFIG_AM33_3 */ - - # invalidate - or CHCTR_DCINV,d0 - movhu d0,(a0) - movhu (a0),d0 - -#endif /* CONFIG_AM33_2 || CONFIG_AM33_3 */ - .endm diff --git a/arch/mn10300/mm/dma-alloc.c b/arch/mn10300/mm/dma-alloc.c deleted file mode 100644 index e3910d4db102b..0000000000000 --- a/arch/mn10300/mm/dma-alloc.c +++ /dev/null @@ -1,128 +0,0 @@ -/* MN10300 Dynamic DMA mapping support - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * Derived from: arch/i386/kernel/pci-dma.c - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include -#include - -static unsigned long pci_sram_allocated = 0xbc000000; - -static void *mn10300_dma_alloc(struct device *dev, size_t size, - dma_addr_t *dma_handle, gfp_t gfp, unsigned long attrs) -{ - unsigned long addr; - void *ret; - - pr_debug("dma_alloc_coherent(%s,%zu,%x)\n", - dev ? dev_name(dev) : "?", size, gfp); - - if (0xbe000000 - pci_sram_allocated >= size) { - size = (size + 255) & ~255; - addr = pci_sram_allocated; - pci_sram_allocated += size; - ret = (void *) addr; - goto done; - } - - if (dev == NULL || dev->coherent_dma_mask < 0xffffffff) - gfp |= GFP_DMA; - - addr = __get_free_pages(gfp, get_order(size)); - if (!addr) - return NULL; - - /* map the coherent memory through the uncached memory window */ - ret = (void *) (addr | 0x20000000); - - /* fill the memory with obvious rubbish */ - memset((void *) addr, 0xfb, size); - - /* write back and evict all cache lines covering this region */ - mn10300_dcache_flush_inv_range2(virt_to_phys((void *) addr), PAGE_SIZE); - -done: - *dma_handle = virt_to_bus((void *) addr); - printk("dma_alloc_coherent() = %p [%x]\n", ret, *dma_handle); - return ret; -} - -static void mn10300_dma_free(struct device *dev, size_t size, void *vaddr, - dma_addr_t dma_handle, unsigned long attrs) -{ - unsigned long addr = (unsigned long) vaddr & ~0x20000000; - - if (addr >= 0x9c000000) - return; - - free_pages(addr, get_order(size)); -} - -static int mn10300_dma_map_sg(struct device *dev, struct scatterlist *sglist, - int nents, enum dma_data_direction direction, - unsigned long attrs) -{ - struct scatterlist *sg; - int i; - - for_each_sg(sglist, sg, nents, i) { - BUG_ON(!sg_page(sg)); - - sg->dma_address = sg_phys(sg); - } - - mn10300_dcache_flush_inv(); - return nents; -} - -static dma_addr_t mn10300_dma_map_page(struct device *dev, struct page *page, - unsigned long offset, size_t size, - enum dma_data_direction direction, unsigned long attrs) -{ - return page_to_bus(page) + offset; -} - -static void mn10300_dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, - size_t size, enum dma_data_direction direction) -{ - mn10300_dcache_flush_inv(); -} - -static void mn10300_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, - int nelems, enum dma_data_direction direction) -{ - mn10300_dcache_flush_inv(); -} - -static int mn10300_dma_supported(struct device *dev, u64 mask) -{ - /* - * we fall back to GFP_DMA when the mask isn't all 1s, so we can't - * guarantee allocations that must be within a tighter range than - * GFP_DMA - */ - if (mask < 0x00ffffff) - return 0; - return 1; -} - -const struct dma_map_ops mn10300_dma_ops = { - .alloc = mn10300_dma_alloc, - .free = mn10300_dma_free, - .map_page = mn10300_dma_map_page, - .map_sg = mn10300_dma_map_sg, - .sync_single_for_device = mn10300_dma_sync_single_for_device, - .sync_sg_for_device = mn10300_dma_sync_sg_for_device, -}; diff --git a/arch/mn10300/mm/extable.c b/arch/mn10300/mm/extable.c deleted file mode 100644 index 045a903ee6b94..0000000000000 --- a/arch/mn10300/mm/extable.c +++ /dev/null @@ -1,26 +0,0 @@ -/* MN10300 In-kernel exception handling - * - * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd. - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include -#include - -int fixup_exception(struct pt_regs *regs) -{ - const struct exception_table_entry *fixup; - - fixup = search_exception_tables(regs->pc); - if (fixup) { - regs->pc = fixup->fixup; - return 1; - } - - return 0; -} diff --git a/arch/mn10300/mm/fault.c b/arch/mn10300/mm/fault.c deleted file mode 100644 index f0bfa14487447..0000000000000 --- a/arch/mn10300/mm/fault.c +++ /dev/null @@ -1,414 +0,0 @@ -/* MN10300 MMU Fault handler - * - * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd. - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Modified by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include /* For unblank_screen() */ -#include - -#include -#include -#include -#include -#include - -/* - * Unlock any spinlocks which will prevent us from getting the - * message out - */ -void bust_spinlocks(int yes) -{ - if (yes) { - oops_in_progress = 1; - } else { - int loglevel_save = console_loglevel; -#ifdef CONFIG_VT - unblank_screen(); -#endif - oops_in_progress = 0; - /* - * OK, the message is on the console. Now we call printk() - * without oops_in_progress set so that printk will give klogd - * a poke. Hold onto your hats... - */ - console_loglevel = 15; /* NMI oopser may have shut the console - * up */ - printk(" "); - console_loglevel = loglevel_save; - } -} - -void do_BUG(const char *file, int line) -{ - bust_spinlocks(1); - printk(KERN_EMERG CUT_HERE); - printk(KERN_EMERG "kernel BUG at %s:%d!\n", file, line); -} - -#if 0 -static void print_pagetable_entries(pgd_t *pgdir, unsigned long address) -{ - pgd_t *pgd; - pmd_t *pmd; - pte_t *pte; - - pgd = pgdir + __pgd_offset(address); - printk(KERN_DEBUG "pgd entry %p: %016Lx\n", - pgd, (long long) pgd_val(*pgd)); - - if (!pgd_present(*pgd)) { - printk(KERN_DEBUG "... pgd not present!\n"); - return; - } - pmd = pmd_offset(pgd, address); - printk(KERN_DEBUG "pmd entry %p: %016Lx\n", - pmd, (long long)pmd_val(*pmd)); - - if (!pmd_present(*pmd)) { - printk(KERN_DEBUG "... pmd not present!\n"); - return; - } - pte = pte_offset(pmd, address); - printk(KERN_DEBUG "pte entry %p: %016Lx\n", - pte, (long long) pte_val(*pte)); - - if (!pte_present(*pte)) - printk(KERN_DEBUG "... pte not present!\n"); -} -#endif - -/* - * This routine handles page faults. It determines the address, - * and the problem, and then passes it off to one of the appropriate - * routines. - * - * fault_code: - * - LSW: either MMUFCR_IFC or MMUFCR_DFC as appropriate - * - MSW: 0 if data access, 1 if instruction access - * - bit 0: TLB miss flag - * - bit 1: initial write - * - bit 2: page invalid - * - bit 3: protection violation - * - bit 4: accessor (0=user 1=kernel) - * - bit 5: 0=read 1=write - * - bit 6-8: page protection spec - * - bit 9: illegal address - * - bit 16: 0=data 1=ins - * - */ -asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long fault_code, - unsigned long address) -{ - struct vm_area_struct *vma; - struct task_struct *tsk; - struct mm_struct *mm; - unsigned long page; - siginfo_t info; - int fault; - unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE; - -#ifdef CONFIG_GDBSTUB - /* handle GDB stub causing a fault */ - if (gdbstub_busy) { - gdbstub_exception(regs, TBR & TBR_INT_CODE); - return; - } -#endif - -#if 0 - printk(KERN_DEBUG "--- do_page_fault(%p,%s:%04lx,%08lx)\n", - regs, - fault_code & 0x10000 ? "ins" : "data", - fault_code & 0xffff, address); -#endif - - tsk = current; - - /* - * We fault-in kernel-space virtual memory on-demand. The - * 'reference' page table is init_mm.pgd. - * - * NOTE! We MUST NOT take any locks for this case. We may - * be in an interrupt or a critical region, and should - * only copy the information from the master page table, - * nothing more. - * - * This verifies that the fault happens in kernel space - * and that the fault was a page not present (invalid) error - */ - if (address >= VMALLOC_START && address < VMALLOC_END && - (fault_code & MMUFCR_xFC_ACCESS) == MMUFCR_xFC_ACCESS_SR && - (fault_code & MMUFCR_xFC_PGINVAL) == MMUFCR_xFC_PGINVAL - ) - goto vmalloc_fault; - - mm = tsk->mm; - info.si_code = SEGV_MAPERR; - - /* - * If we're in an interrupt or have no user - * context, we must not take the fault.. - */ - if (faulthandler_disabled() || !mm) - goto no_context; - - if ((fault_code & MMUFCR_xFC_ACCESS) == MMUFCR_xFC_ACCESS_USR) - flags |= FAULT_FLAG_USER; -retry: - down_read(&mm->mmap_sem); - - vma = find_vma(mm, address); - if (!vma) - goto bad_area; - if (vma->vm_start <= address) - goto good_area; - if (!(vma->vm_flags & VM_GROWSDOWN)) - goto bad_area; - - if ((fault_code & MMUFCR_xFC_ACCESS) == MMUFCR_xFC_ACCESS_USR) { - /* accessing the stack below the stack pointer is always a - * bug */ - if ((address & PAGE_MASK) + 2 * PAGE_SIZE < regs->sp) { -#if 0 - printk(KERN_WARNING - "[%d] ### Access below stack @%lx (sp=%lx)\n", - current->pid, address, regs->sp); - printk(KERN_WARNING - "vma [%08x - %08x]\n", - vma->vm_start, vma->vm_end); - show_registers(regs); - printk(KERN_WARNING - "[%d] ### Code: [%08lx]" - " %02x %02x %02x %02x %02x %02x %02x %02x\n", - current->pid, - regs->pc, - ((u8 *) regs->pc)[0], - ((u8 *) regs->pc)[1], - ((u8 *) regs->pc)[2], - ((u8 *) regs->pc)[3], - ((u8 *) regs->pc)[4], - ((u8 *) regs->pc)[5], - ((u8 *) regs->pc)[6], - ((u8 *) regs->pc)[7] - ); -#endif - goto bad_area; - } - } - - if (expand_stack(vma, address)) - goto bad_area; - -/* - * Ok, we have a good vm_area for this memory access, so - * we can handle it.. - */ -good_area: - info.si_code = SEGV_ACCERR; - switch (fault_code & (MMUFCR_xFC_PGINVAL|MMUFCR_xFC_TYPE)) { - default: /* 3: write, present */ - case MMUFCR_xFC_TYPE_WRITE: -#ifdef TEST_VERIFY_AREA - if ((fault_code & MMUFCR_xFC_ACCESS) == MMUFCR_xFC_ACCESS_SR) - printk(KERN_DEBUG "WP fault at %08lx\n", regs->pc); -#endif - /* write to absent page */ - case MMUFCR_xFC_PGINVAL | MMUFCR_xFC_TYPE_WRITE: - if (!(vma->vm_flags & VM_WRITE)) - goto bad_area; - flags |= FAULT_FLAG_WRITE; - break; - - /* read from protected page */ - case MMUFCR_xFC_TYPE_READ: - goto bad_area; - - /* read from absent page present */ - case MMUFCR_xFC_PGINVAL | MMUFCR_xFC_TYPE_READ: - if (!(vma->vm_flags & (VM_READ | VM_EXEC))) - goto bad_area; - break; - } - - /* - * If for any reason at all we couldn't handle the fault, - * make sure we exit gracefully rather than endlessly redo - * the fault. - */ - fault = handle_mm_fault(vma, address, flags); - - if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current)) - return; - - if (unlikely(fault & VM_FAULT_ERROR)) { - if (fault & VM_FAULT_OOM) - goto out_of_memory; - else if (fault & VM_FAULT_SIGSEGV) - goto bad_area; - else if (fault & VM_FAULT_SIGBUS) - goto do_sigbus; - BUG(); - } - if (flags & FAULT_FLAG_ALLOW_RETRY) { - if (fault & VM_FAULT_MAJOR) - current->maj_flt++; - else - current->min_flt++; - if (fault & VM_FAULT_RETRY) { - flags &= ~FAULT_FLAG_ALLOW_RETRY; - - /* No need to up_read(&mm->mmap_sem) as we would - * have already released it in __lock_page_or_retry - * in mm/filemap.c. - */ - - goto retry; - } - } - - up_read(&mm->mmap_sem); - return; - -/* - * Something tried to access memory that isn't in our memory map.. - * Fix it, but check if it's kernel or user first.. - */ -bad_area: - up_read(&mm->mmap_sem); - - /* User mode accesses just cause a SIGSEGV */ - if ((fault_code & MMUFCR_xFC_ACCESS) == MMUFCR_xFC_ACCESS_USR) { - info.si_signo = SIGSEGV; - info.si_errno = 0; - /* info.si_code has been set above */ - info.si_addr = (void *)address; - force_sig_info(SIGSEGV, &info, tsk); - return; - } - -no_context: - /* Are we prepared to handle this kernel fault? */ - if (fixup_exception(regs)) - return; - -/* - * Oops. The kernel tried to access some bad page. We'll have to - * terminate things with extreme prejudice. - */ - - bust_spinlocks(1); - - if (address < PAGE_SIZE) - printk(KERN_ALERT - "Unable to handle kernel NULL pointer dereference"); - else - printk(KERN_ALERT - "Unable to handle kernel paging request"); - printk(" at virtual address %08lx\n", address); - printk(" printing pc:\n"); - printk(KERN_ALERT "%08lx\n", regs->pc); - - debugger_intercept(fault_code & 0x00010000 ? EXCEP_IAERROR : EXCEP_DAERROR, - SIGSEGV, SEGV_ACCERR, regs); - - page = PTBR; - page = ((unsigned long *) __va(page))[address >> 22]; - printk(KERN_ALERT "*pde = %08lx\n", page); - if (page & 1) { - page &= PAGE_MASK; - address &= 0x003ff000; - page = ((unsigned long *) __va(page))[address >> PAGE_SHIFT]; - printk(KERN_ALERT "*pte = %08lx\n", page); - } - - die("Oops", regs, fault_code); - do_exit(SIGKILL); - -/* - * We ran out of memory, or some other thing happened to us that made - * us unable to handle the page fault gracefully. - */ -out_of_memory: - up_read(&mm->mmap_sem); - if ((fault_code & MMUFCR_xFC_ACCESS) == MMUFCR_xFC_ACCESS_USR) { - pagefault_out_of_memory(); - return; - } - goto no_context; - -do_sigbus: - up_read(&mm->mmap_sem); - - /* - * Send a sigbus, regardless of whether we were in kernel - * or user mode. - */ - info.si_signo = SIGBUS; - info.si_errno = 0; - info.si_code = BUS_ADRERR; - info.si_addr = (void *)address; - force_sig_info(SIGBUS, &info, tsk); - - /* Kernel mode? Handle exceptions or die */ - if ((fault_code & MMUFCR_xFC_ACCESS) == MMUFCR_xFC_ACCESS_SR) - goto no_context; - return; - -vmalloc_fault: - { - /* - * Synchronize this task's top level page-table - * with the 'reference' page table. - * - * Do _not_ use "tsk" here. We might be inside - * an interrupt in the middle of a task switch.. - */ - int index = pgd_index(address); - pgd_t *pgd, *pgd_k; - pud_t *pud, *pud_k; - pmd_t *pmd, *pmd_k; - pte_t *pte_k; - - pgd_k = init_mm.pgd + index; - - if (!pgd_present(*pgd_k)) - goto no_context; - - pud_k = pud_offset(pgd_k, address); - if (!pud_present(*pud_k)) - goto no_context; - - pmd_k = pmd_offset(pud_k, address); - if (!pmd_present(*pmd_k)) - goto no_context; - - pgd = (pgd_t *) PTBR + index; - pud = pud_offset(pgd, address); - pmd = pmd_offset(pud, address); - set_pmd(pmd, *pmd_k); - - pte_k = pte_offset_kernel(pmd_k, address); - if (!pte_present(*pte_k)) - goto no_context; - return; - } -} diff --git a/arch/mn10300/mm/init.c b/arch/mn10300/mm/init.c deleted file mode 100644 index 8ce677d5575ec..0000000000000 --- a/arch/mn10300/mm/init.c +++ /dev/null @@ -1,136 +0,0 @@ -/* MN10300 Memory management initialisation - * - * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd. - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Modified by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -unsigned long highstart_pfn, highend_pfn; - -#ifdef CONFIG_MN10300_HAS_ATOMIC_OPS_UNIT -static struct vm_struct user_iomap_vm; -#endif - -/* - * set up paging - */ -void __init paging_init(void) -{ - unsigned long zones_size[MAX_NR_ZONES] = {0,}; - pte_t *ppte; - int loop; - - /* main kernel space -> RAM mapping is handled as 1:1 transparent by - * the MMU */ - memset(swapper_pg_dir, 0, sizeof(swapper_pg_dir)); - memset(kernel_vmalloc_ptes, 0, sizeof(kernel_vmalloc_ptes)); - - /* load the VMALLOC area PTE table addresses into the kernel PGD */ - ppte = kernel_vmalloc_ptes; - for (loop = VMALLOC_START / (PAGE_SIZE * PTRS_PER_PTE); - loop < VMALLOC_END / (PAGE_SIZE * PTRS_PER_PTE); - loop++ - ) { - set_pgd(swapper_pg_dir + loop, __pgd(__pa(ppte) | _PAGE_TABLE)); - ppte += PAGE_SIZE / sizeof(pte_t); - } - - /* declare the sizes of the RAM zones (only use the normal zone) */ - zones_size[ZONE_NORMAL] = - contig_page_data.bdata->node_low_pfn - - contig_page_data.bdata->node_min_pfn; - - /* pass the memory from the bootmem allocator to the main allocator */ - free_area_init(zones_size); - -#ifdef CONFIG_MN10300_HAS_ATOMIC_OPS_UNIT - /* The Atomic Operation Unit registers need to be mapped to userspace - * for all processes. The following uses vm_area_register_early() to - * reserve the first page of the vmalloc area and sets the pte for that - * page. - * - * glibc hardcodes this virtual mapping, so we're pretty much stuck with - * it from now on. - */ - user_iomap_vm.flags = VM_USERMAP; - user_iomap_vm.size = 1 << PAGE_SHIFT; - vm_area_register_early(&user_iomap_vm, PAGE_SIZE); - ppte = kernel_vmalloc_ptes; - set_pte(ppte, pfn_pte(USER_ATOMIC_OPS_PAGE_ADDR >> PAGE_SHIFT, - PAGE_USERIO)); -#endif - - local_flush_tlb_all(); -} - -/* - * transfer all the memory from the bootmem allocator to the runtime allocator - */ -void __init mem_init(void) -{ - BUG_ON(!mem_map); - -#define START_PFN (contig_page_data.bdata->node_min_pfn) -#define MAX_LOW_PFN (contig_page_data.bdata->node_low_pfn) - - max_mapnr = MAX_LOW_PFN - START_PFN; - high_memory = (void *) __va(MAX_LOW_PFN * PAGE_SIZE); - - /* clear the zero-page */ - memset(empty_zero_page, 0, PAGE_SIZE); - - /* this will put all low memory onto the freelists */ - free_all_bootmem(); - - mem_init_print_info(NULL); -} - -/* - * recycle memory containing stuff only required for initialisation - */ -void free_initmem(void) -{ - free_initmem_default(POISON_FREE_INITMEM); -} - -/* - * dispose of the memory on which the initial ramdisk resided - */ -#ifdef CONFIG_BLK_DEV_INITRD -void free_initrd_mem(unsigned long start, unsigned long end) -{ - free_reserved_area((void *)start, (void *)end, POISON_FREE_INITMEM, - "initrd"); -} -#endif diff --git a/arch/mn10300/mm/misalignment.c b/arch/mn10300/mm/misalignment.c deleted file mode 100644 index 8ace89617c1c9..0000000000000 --- a/arch/mn10300/mm/misalignment.c +++ /dev/null @@ -1,966 +0,0 @@ -/* MN10300 Misalignment fixup handler - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if 0 -#define kdebug(FMT, ...) printk(KERN_DEBUG "MISALIGN: "FMT"\n", ##__VA_ARGS__) -#else -#define kdebug(FMT, ...) do {} while (0) -#endif - -static int misalignment_addr(unsigned long *registers, unsigned long sp, - unsigned params, unsigned opcode, - unsigned long disp, - void **_address, unsigned long **_postinc, - unsigned long *_inc); - -static int misalignment_reg(unsigned long *registers, unsigned params, - unsigned opcode, unsigned long disp, - unsigned long **_register); - -static void misalignment_MOV_Lcc(struct pt_regs *regs, uint32_t opcode); - -static const unsigned Dreg_index[] = { - REG_D0 >> 2, REG_D1 >> 2, REG_D2 >> 2, REG_D3 >> 2 -}; - -static const unsigned Areg_index[] = { - REG_A0 >> 2, REG_A1 >> 2, REG_A2 >> 2, REG_A3 >> 2 -}; - -static const unsigned Rreg_index[] = { - REG_E0 >> 2, REG_E1 >> 2, REG_E2 >> 2, REG_E3 >> 2, - REG_E4 >> 2, REG_E5 >> 2, REG_E6 >> 2, REG_E7 >> 2, - REG_A0 >> 2, REG_A1 >> 2, REG_A2 >> 2, REG_A3 >> 2, - REG_D0 >> 2, REG_D1 >> 2, REG_D2 >> 2, REG_D3 >> 2 -}; - -enum format_id { - FMT_S0, - FMT_S1, - FMT_S2, - FMT_S4, - FMT_D0, - FMT_D1, - FMT_D2, - FMT_D4, - FMT_D6, - FMT_D7, - FMT_D8, - FMT_D9, - FMT_D10, -}; - -static const struct { - u_int8_t opsz, dispsz; -} format_tbl[16] = { - [FMT_S0] = { 8, 0 }, - [FMT_S1] = { 8, 8 }, - [FMT_S2] = { 8, 16 }, - [FMT_S4] = { 8, 32 }, - [FMT_D0] = { 16, 0 }, - [FMT_D1] = { 16, 8 }, - [FMT_D2] = { 16, 16 }, - [FMT_D4] = { 16, 32 }, - [FMT_D6] = { 24, 0 }, - [FMT_D7] = { 24, 8 }, - [FMT_D8] = { 24, 24 }, - [FMT_D9] = { 24, 32 }, - [FMT_D10] = { 32, 0 }, -}; - -enum value_id { - DM0, /* data reg in opcode in bits 0-1 */ - DM1, /* data reg in opcode in bits 2-3 */ - DM2, /* data reg in opcode in bits 4-5 */ - AM0, /* addr reg in opcode in bits 0-1 */ - AM1, /* addr reg in opcode in bits 2-3 */ - AM2, /* addr reg in opcode in bits 4-5 */ - RM0, /* reg in opcode in bits 0-3 */ - RM1, /* reg in opcode in bits 2-5 */ - RM2, /* reg in opcode in bits 4-7 */ - RM4, /* reg in opcode in bits 8-11 */ - RM6, /* reg in opcode in bits 12-15 */ - - RD0, /* reg in displacement in bits 0-3 */ - RD2, /* reg in displacement in bits 4-7 */ - - SP, /* stack pointer */ - - SD8, /* 8-bit signed displacement */ - SD16, /* 16-bit signed displacement */ - SD24, /* 24-bit signed displacement */ - SIMM4_2, /* 4-bit signed displacement in opcode bits 4-7 */ - SIMM8, /* 8-bit signed immediate */ - IMM8, /* 8-bit unsigned immediate */ - IMM16, /* 16-bit unsigned immediate */ - IMM24, /* 24-bit unsigned immediate */ - IMM32, /* 32-bit unsigned immediate */ - IMM32_HIGH8, /* 32-bit unsigned immediate, LSB in opcode */ - - IMM32_MEM, /* 32-bit unsigned displacement */ - IMM32_HIGH8_MEM, /* 32-bit unsigned displacement, LSB in opcode */ - - DN0 = DM0, - DN1 = DM1, - DN2 = DM2, - AN0 = AM0, - AN1 = AM1, - AN2 = AM2, - RN0 = RM0, - RN1 = RM1, - RN2 = RM2, - RN4 = RM4, - RN6 = RM6, - DI = DM1, - RI = RM2, - -}; - -struct mn10300_opcode { - const char name[8]; - u_int32_t opcode; - u_int32_t opmask; - unsigned exclusion; - - enum format_id format; - - unsigned cpu_mask; -#define AM33 330 - - unsigned params[2]; -#define MEM(ADDR) (0x80000000 | (ADDR)) -#define MEM2(ADDR1, ADDR2) (0x80000000 | (ADDR1) << 8 | (ADDR2)) -#define MEMINC(ADDR) (0x81000000 | (ADDR)) -#define MEMINC2(ADDR, INC) (0x81000000 | (ADDR) << 8 | (INC)) -}; - -/* LIBOPCODES EXCERPT - Assemble Matsushita MN10300 instructions. - Copyright 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public Licence as published by - the Free Software Foundation; either version 2 of the Licence, 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 Licence for more details. - - You should have received a copy of the GNU General Public Licence - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -static const struct mn10300_opcode mn10300_opcodes[] = { -{ "mov", 0x4200, 0xf300, 0, FMT_S1, 0, {DM1, MEM2(IMM8, SP)}}, -{ "mov", 0x4300, 0xf300, 0, FMT_S1, 0, {AM1, MEM2(IMM8, SP)}}, -{ "mov", 0x5800, 0xfc00, 0, FMT_S1, 0, {MEM2(IMM8, SP), DN0}}, -{ "mov", 0x5c00, 0xfc00, 0, FMT_S1, 0, {MEM2(IMM8, SP), AN0}}, -{ "mov", 0x60, 0xf0, 0, FMT_S0, 0, {DM1, MEM(AN0)}}, -{ "mov", 0x70, 0xf0, 0, FMT_S0, 0, {MEM(AM0), DN1}}, -{ "mov", 0xf000, 0xfff0, 0, FMT_D0, 0, {MEM(AM0), AN1}}, -{ "mov", 0xf010, 0xfff0, 0, FMT_D0, 0, {AM1, MEM(AN0)}}, -{ "mov", 0xf300, 0xffc0, 0, FMT_D0, 0, {MEM2(DI, AM0), DN2}}, -{ "mov", 0xf340, 0xffc0, 0, FMT_D0, 0, {DM2, MEM2(DI, AN0)}}, -{ "mov", 0xf380, 0xffc0, 0, FMT_D0, 0, {MEM2(DI, AM0), AN2}}, -{ "mov", 0xf3c0, 0xffc0, 0, FMT_D0, 0, {AM2, MEM2(DI, AN0)}}, -{ "mov", 0xf80000, 0xfff000, 0, FMT_D1, 0, {MEM2(SD8, AM0), DN1}}, -{ "mov", 0xf81000, 0xfff000, 0, FMT_D1, 0, {DM1, MEM2(SD8, AN0)}}, -{ "mov", 0xf82000, 0xfff000, 0, FMT_D1, 0, {MEM2(SD8,AM0), AN1}}, -{ "mov", 0xf83000, 0xfff000, 0, FMT_D1, 0, {AM1, MEM2(SD8, AN0)}}, -{ "mov", 0xf90a00, 0xffff00, 0, FMT_D6, AM33, {MEM(RM0), RN2}}, -{ "mov", 0xf91a00, 0xffff00, 0, FMT_D6, AM33, {RM2, MEM(RN0)}}, -{ "mov", 0xf96a00, 0xffff00, 0x12, FMT_D6, AM33, {MEMINC(RM0), RN2}}, -{ "mov", 0xf97a00, 0xffff00, 0, FMT_D6, AM33, {RM2, MEMINC(RN0)}}, -{ "mov", 0xfa000000, 0xfff00000, 0, FMT_D2, 0, {MEM2(SD16, AM0), DN1}}, -{ "mov", 0xfa100000, 0xfff00000, 0, FMT_D2, 0, {DM1, MEM2(SD16, AN0)}}, -{ "mov", 0xfa200000, 0xfff00000, 0, FMT_D2, 0, {MEM2(SD16, AM0), AN1}}, -{ "mov", 0xfa300000, 0xfff00000, 0, FMT_D2, 0, {AM1, MEM2(SD16, AN0)}}, -{ "mov", 0xfa900000, 0xfff30000, 0, FMT_D2, 0, {AM1, MEM2(IMM16, SP)}}, -{ "mov", 0xfa910000, 0xfff30000, 0, FMT_D2, 0, {DM1, MEM2(IMM16, SP)}}, -{ "mov", 0xfab00000, 0xfffc0000, 0, FMT_D2, 0, {MEM2(IMM16, SP), AN0}}, -{ "mov", 0xfab40000, 0xfffc0000, 0, FMT_D2, 0, {MEM2(IMM16, SP), DN0}}, -{ "mov", 0xfb0a0000, 0xffff0000, 0, FMT_D7, AM33, {MEM2(SD8, RM0), RN2}}, -{ "mov", 0xfb1a0000, 0xffff0000, 0, FMT_D7, AM33, {RM2, MEM2(SD8, RN0)}}, -{ "mov", 0xfb6a0000, 0xffff0000, 0x22, FMT_D7, AM33, {MEMINC2 (RM0, SIMM8), RN2}}, -{ "mov", 0xfb7a0000, 0xffff0000, 0, FMT_D7, AM33, {RM2, MEMINC2 (RN0, SIMM8)}}, -{ "mov", 0xfb8a0000, 0xffff0f00, 0, FMT_D7, AM33, {MEM2(IMM8, SP), RN2}}, -{ "mov", 0xfb8e0000, 0xffff000f, 0, FMT_D7, AM33, {MEM2(RI, RM0), RD2}}, -{ "mov", 0xfb9a0000, 0xffff0f00, 0, FMT_D7, AM33, {RM2, MEM2(IMM8, SP)}}, -{ "mov", 0xfb9e0000, 0xffff000f, 0, FMT_D7, AM33, {RD2, MEM2(RI, RN0)}}, -{ "mov", 0xfc000000, 0xfff00000, 0, FMT_D4, 0, {MEM2(IMM32,AM0), DN1}}, -{ "mov", 0xfc100000, 0xfff00000, 0, FMT_D4, 0, {DM1, MEM2(IMM32,AN0)}}, -{ "mov", 0xfc200000, 0xfff00000, 0, FMT_D4, 0, {MEM2(IMM32,AM0), AN1}}, -{ "mov", 0xfc300000, 0xfff00000, 0, FMT_D4, 0, {AM1, MEM2(IMM32,AN0)}}, -{ "mov", 0xfc800000, 0xfff30000, 0, FMT_D4, 0, {AM1, MEM(IMM32_MEM)}}, -{ "mov", 0xfc810000, 0xfff30000, 0, FMT_D4, 0, {DM1, MEM(IMM32_MEM)}}, -{ "mov", 0xfc900000, 0xfff30000, 0, FMT_D4, 0, {AM1, MEM2(IMM32, SP)}}, -{ "mov", 0xfc910000, 0xfff30000, 0, FMT_D4, 0, {DM1, MEM2(IMM32, SP)}}, -{ "mov", 0xfca00000, 0xfffc0000, 0, FMT_D4, 0, {MEM(IMM32_MEM), AN0}}, -{ "mov", 0xfca40000, 0xfffc0000, 0, FMT_D4, 0, {MEM(IMM32_MEM), DN0}}, -{ "mov", 0xfcb00000, 0xfffc0000, 0, FMT_D4, 0, {MEM2(IMM32, SP), AN0}}, -{ "mov", 0xfcb40000, 0xfffc0000, 0, FMT_D4, 0, {MEM2(IMM32, SP), DN0}}, -{ "mov", 0xfd0a0000, 0xffff0000, 0, FMT_D8, AM33, {MEM2(SD24, RM0), RN2}}, -{ "mov", 0xfd1a0000, 0xffff0000, 0, FMT_D8, AM33, {RM2, MEM2(SD24, RN0)}}, -{ "mov", 0xfd6a0000, 0xffff0000, 0x22, FMT_D8, AM33, {MEMINC2 (RM0, IMM24), RN2}}, -{ "mov", 0xfd7a0000, 0xffff0000, 0, FMT_D8, AM33, {RM2, MEMINC2 (RN0, IMM24)}}, -{ "mov", 0xfd8a0000, 0xffff0f00, 0, FMT_D8, AM33, {MEM2(IMM24, SP), RN2}}, -{ "mov", 0xfd9a0000, 0xffff0f00, 0, FMT_D8, AM33, {RM2, MEM2(IMM24, SP)}}, -{ "mov", 0xfe0a0000, 0xffff0000, 0, FMT_D9, AM33, {MEM2(IMM32_HIGH8,RM0), RN2}}, -{ "mov", 0xfe0a0000, 0xffff0000, 0, FMT_D9, AM33, {MEM2(IMM32_HIGH8,RM0), RN2}}, -{ "mov", 0xfe0e0000, 0xffff0f00, 0, FMT_D9, AM33, {MEM(IMM32_HIGH8_MEM), RN2}}, -{ "mov", 0xfe1a0000, 0xffff0000, 0, FMT_D9, AM33, {RM2, MEM2(IMM32_HIGH8, RN0)}}, -{ "mov", 0xfe1a0000, 0xffff0000, 0, FMT_D9, AM33, {RM2, MEM2(IMM32_HIGH8, RN0)}}, -{ "mov", 0xfe1e0000, 0xffff0f00, 0, FMT_D9, AM33, {RM2, MEM(IMM32_HIGH8_MEM)}}, -{ "mov", 0xfe6a0000, 0xffff0000, 0x22, FMT_D9, AM33, {MEMINC2 (RM0, IMM32_HIGH8), RN2}}, -{ "mov", 0xfe7a0000, 0xffff0000, 0, FMT_D9, AM33, {RN2, MEMINC2 (RM0, IMM32_HIGH8)}}, -{ "mov", 0xfe8a0000, 0xffff0f00, 0, FMT_D9, AM33, {MEM2(IMM32_HIGH8, SP), RN2}}, -{ "mov", 0xfe9a0000, 0xffff0f00, 0, FMT_D9, AM33, {RM2, MEM2(IMM32_HIGH8, SP)}}, - -{ "movhu", 0xf060, 0xfff0, 0, FMT_D0, 0, {MEM(AM0), DN1}}, -{ "movhu", 0xf070, 0xfff0, 0, FMT_D0, 0, {DM1, MEM(AN0)}}, -{ "movhu", 0xf480, 0xffc0, 0, FMT_D0, 0, {MEM2(DI, AM0), DN2}}, -{ "movhu", 0xf4c0, 0xffc0, 0, FMT_D0, 0, {DM2, MEM2(DI, AN0)}}, -{ "movhu", 0xf86000, 0xfff000, 0, FMT_D1, 0, {MEM2(SD8, AM0), DN1}}, -{ "movhu", 0xf87000, 0xfff000, 0, FMT_D1, 0, {DM1, MEM2(SD8, AN0)}}, -{ "movhu", 0xf89300, 0xfff300, 0, FMT_D1, 0, {DM1, MEM2(IMM8, SP)}}, -{ "movhu", 0xf8bc00, 0xfffc00, 0, FMT_D1, 0, {MEM2(IMM8, SP), DN0}}, -{ "movhu", 0xf94a00, 0xffff00, 0, FMT_D6, AM33, {MEM(RM0), RN2}}, -{ "movhu", 0xf95a00, 0xffff00, 0, FMT_D6, AM33, {RM2, MEM(RN0)}}, -{ "movhu", 0xf9ea00, 0xffff00, 0x12, FMT_D6, AM33, {MEMINC(RM0), RN2}}, -{ "movhu", 0xf9fa00, 0xffff00, 0, FMT_D6, AM33, {RM2, MEMINC(RN0)}}, -{ "movhu", 0xfa600000, 0xfff00000, 0, FMT_D2, 0, {MEM2(SD16, AM0), DN1}}, -{ "movhu", 0xfa700000, 0xfff00000, 0, FMT_D2, 0, {DM1, MEM2(SD16, AN0)}}, -{ "movhu", 0xfa930000, 0xfff30000, 0, FMT_D2, 0, {DM1, MEM2(IMM16, SP)}}, -{ "movhu", 0xfabc0000, 0xfffc0000, 0, FMT_D2, 0, {MEM2(IMM16, SP), DN0}}, -{ "movhu", 0xfb4a0000, 0xffff0000, 0, FMT_D7, AM33, {MEM2(SD8, RM0), RN2}}, -{ "movhu", 0xfb5a0000, 0xffff0000, 0, FMT_D7, AM33, {RM2, MEM2(SD8, RN0)}}, -{ "movhu", 0xfbca0000, 0xffff0f00, 0, FMT_D7, AM33, {MEM2(IMM8, SP), RN2}}, -{ "movhu", 0xfbce0000, 0xffff000f, 0, FMT_D7, AM33, {MEM2(RI, RM0), RD2}}, -{ "movhu", 0xfbda0000, 0xffff0f00, 0, FMT_D7, AM33, {RM2, MEM2(IMM8, SP)}}, -{ "movhu", 0xfbde0000, 0xffff000f, 0, FMT_D7, AM33, {RD2, MEM2(RI, RN0)}}, -{ "movhu", 0xfbea0000, 0xffff0000, 0x22, FMT_D7, AM33, {MEMINC2 (RM0, SIMM8), RN2}}, -{ "movhu", 0xfbfa0000, 0xffff0000, 0, FMT_D7, AM33, {RM2, MEMINC2 (RN0, SIMM8)}}, -{ "movhu", 0xfc600000, 0xfff00000, 0, FMT_D4, 0, {MEM2(IMM32,AM0), DN1}}, -{ "movhu", 0xfc700000, 0xfff00000, 0, FMT_D4, 0, {DM1, MEM2(IMM32,AN0)}}, -{ "movhu", 0xfc830000, 0xfff30000, 0, FMT_D4, 0, {DM1, MEM(IMM32_MEM)}}, -{ "movhu", 0xfc930000, 0xfff30000, 0, FMT_D4, 0, {DM1, MEM2(IMM32, SP)}}, -{ "movhu", 0xfcac0000, 0xfffc0000, 0, FMT_D4, 0, {MEM(IMM32_MEM), DN0}}, -{ "movhu", 0xfcbc0000, 0xfffc0000, 0, FMT_D4, 0, {MEM2(IMM32, SP), DN0}}, -{ "movhu", 0xfd4a0000, 0xffff0000, 0, FMT_D8, AM33, {MEM2(SD24, RM0), RN2}}, -{ "movhu", 0xfd5a0000, 0xffff0000, 0, FMT_D8, AM33, {RM2, MEM2(SD24, RN0)}}, -{ "movhu", 0xfdca0000, 0xffff0f00, 0, FMT_D8, AM33, {MEM2(IMM24, SP), RN2}}, -{ "movhu", 0xfdda0000, 0xffff0f00, 0, FMT_D8, AM33, {RM2, MEM2(IMM24, SP)}}, -{ "movhu", 0xfdea0000, 0xffff0000, 0x22, FMT_D8, AM33, {MEMINC2 (RM0, IMM24), RN2}}, -{ "movhu", 0xfdfa0000, 0xffff0000, 0, FMT_D8, AM33, {RM2, MEMINC2 (RN0, IMM24)}}, -{ "movhu", 0xfe4a0000, 0xffff0000, 0, FMT_D9, AM33, {MEM2(IMM32_HIGH8,RM0), RN2}}, -{ "movhu", 0xfe4e0000, 0xffff0f00, 0, FMT_D9, AM33, {MEM(IMM32_HIGH8_MEM), RN2}}, -{ "movhu", 0xfe5a0000, 0xffff0000, 0, FMT_D9, AM33, {RM2, MEM2(IMM32_HIGH8, RN0)}}, -{ "movhu", 0xfe5e0000, 0xffff0f00, 0, FMT_D9, AM33, {RM2, MEM(IMM32_HIGH8_MEM)}}, -{ "movhu", 0xfeca0000, 0xffff0f00, 0, FMT_D9, AM33, {MEM2(IMM32_HIGH8, SP), RN2}}, -{ "movhu", 0xfeda0000, 0xffff0f00, 0, FMT_D9, AM33, {RM2, MEM2(IMM32_HIGH8, SP)}}, -{ "movhu", 0xfeea0000, 0xffff0000, 0x22, FMT_D9, AM33, {MEMINC2 (RM0, IMM32_HIGH8), RN2}}, -{ "movhu", 0xfefa0000, 0xffff0000, 0, FMT_D9, AM33, {RN2, MEMINC2 (RM0, IMM32_HIGH8)}}, - -{ "mov_llt", 0xf7e00000, 0xffff000f, 0x22, FMT_D10, AM33, {MEMINC2 (RN4,SIMM4_2), RM6}}, -{ "mov_lgt", 0xf7e00001, 0xffff000f, 0x22, FMT_D10, AM33, {MEMINC2 (RN4,SIMM4_2), RM6}}, -{ "mov_lge", 0xf7e00002, 0xffff000f, 0x22, FMT_D10, AM33, {MEMINC2 (RN4,SIMM4_2), RM6}}, -{ "mov_lle", 0xf7e00003, 0xffff000f, 0x22, FMT_D10, AM33, {MEMINC2 (RN4,SIMM4_2), RM6}}, -{ "mov_lcs", 0xf7e00004, 0xffff000f, 0x22, FMT_D10, AM33, {MEMINC2 (RN4,SIMM4_2), RM6}}, -{ "mov_lhi", 0xf7e00005, 0xffff000f, 0x22, FMT_D10, AM33, {MEMINC2 (RN4,SIMM4_2), RM6}}, -{ "mov_lcc", 0xf7e00006, 0xffff000f, 0x22, FMT_D10, AM33, {MEMINC2 (RN4,SIMM4_2), RM6}}, -{ "mov_lls", 0xf7e00007, 0xffff000f, 0x22, FMT_D10, AM33, {MEMINC2 (RN4,SIMM4_2), RM6}}, -{ "mov_leq", 0xf7e00008, 0xffff000f, 0x22, FMT_D10, AM33, {MEMINC2 (RN4,SIMM4_2), RM6}}, -{ "mov_lne", 0xf7e00009, 0xffff000f, 0x22, FMT_D10, AM33, {MEMINC2 (RN4,SIMM4_2), RM6}}, -{ "mov_lra", 0xf7e0000a, 0xffff000f, 0x22, FMT_D10, AM33, {MEMINC2 (RN4,SIMM4_2), RM6}}, - -{ "", 0, 0, 0, 0, 0, {0}}, -}; - -/* - * fix up misalignment problems where possible - */ -asmlinkage void misalignment(struct pt_regs *regs, enum exception_code code) -{ - const struct exception_table_entry *fixup; - const struct mn10300_opcode *pop; - unsigned long *registers = (unsigned long *) regs; - unsigned long data, *store, *postinc, disp, inc, sp; - mm_segment_t seg; - siginfo_t info; - uint32_t opcode, noc, xo, xm; - uint8_t *pc, byte, datasz; - void *address; - unsigned tmp, npop, dispsz, loop; - - /* we don't fix up userspace misalignment faults */ - if (user_mode(regs)) - goto bus_error; - - sp = (unsigned long) regs + sizeof(*regs); - - kdebug("==>misalignment({pc=%lx,sp=%lx})", regs->pc, sp); - - if (regs->epsw & EPSW_IE) - asm volatile("or %0,epsw" : : "i"(EPSW_IE)); - - seg = get_fs(); - set_fs(KERNEL_DS); - - fixup = search_exception_tables(regs->pc); - - /* first thing to do is to match the opcode */ - pc = (u_int8_t *) regs->pc; - - if (__get_user(byte, pc) != 0) - goto fetch_error; - opcode = byte; - noc = 8; - - for (pop = mn10300_opcodes; pop->name[0]; pop++) { - npop = ilog2(pop->opcode | pop->opmask); - if (npop <= 0 || npop > 31) - continue; - npop = (npop + 8) & ~7; - - got_more_bits: - if (npop == noc) { - if ((opcode & pop->opmask) == pop->opcode) - goto found_opcode; - } else if (npop > noc) { - xo = pop->opcode >> (npop - noc); - xm = pop->opmask >> (npop - noc); - - if ((opcode & xm) != xo) - continue; - - /* we've got a partial match (an exact match on the - * first N bytes), so we need to get some more data */ - pc++; - if (__get_user(byte, pc) != 0) - goto fetch_error; - opcode = opcode << 8 | byte; - noc += 8; - goto got_more_bits; - } else { - /* there's already been a partial match as long as the - * complete match we're now considering, so this one - * should't match */ - continue; - } - } - - /* didn't manage to find a fixup */ - printk(KERN_CRIT "MISALIGN: %lx: unsupported instruction %x\n", - regs->pc, opcode); - -failed: - set_fs(seg); - if (die_if_no_fixup("misalignment error", regs, code)) - return; - -bus_error: - info.si_signo = SIGBUS; - info.si_errno = 0; - info.si_code = BUS_ADRALN; - info.si_addr = (void *) regs->pc; - force_sig_info(SIGBUS, &info, current); - return; - - /* error reading opcodes */ -fetch_error: - printk(KERN_CRIT - "MISALIGN: %p: fault whilst reading instruction data\n", - pc); - goto failed; - -bad_addr_mode: - printk(KERN_CRIT - "MISALIGN: %lx: unsupported addressing mode %x\n", - regs->pc, opcode); - goto failed; - -bad_reg_mode: - printk(KERN_CRIT - "MISALIGN: %lx: unsupported register mode %x\n", - regs->pc, opcode); - goto failed; - -unsupported_instruction: - printk(KERN_CRIT - "MISALIGN: %lx: unsupported instruction %x (%s)\n", - regs->pc, opcode, pop->name); - goto failed; - -transfer_failed: - set_fs(seg); - if (fixup) { - regs->pc = fixup->fixup; - return; - } - if (die_if_no_fixup("misalignment fixup", regs, code)) - return; - - info.si_signo = SIGSEGV; - info.si_errno = 0; - info.si_code = SEGV_MAPERR; - info.si_addr = (void *) regs->pc; - force_sig_info(SIGSEGV, &info, current); - return; - - /* we matched the opcode */ -found_opcode: - kdebug("%lx: %x==%x { %x, %x }", - regs->pc, opcode, pop->opcode, pop->params[0], pop->params[1]); - - tmp = format_tbl[pop->format].opsz; - BUG_ON(tmp > noc); /* match was less complete than it ought to have been */ - - if (tmp < noc) { - tmp = noc - tmp; - opcode >>= tmp; - pc -= tmp >> 3; - } - - /* grab the extra displacement (note it's LSB first) */ - disp = 0; - dispsz = format_tbl[pop->format].dispsz; - for (loop = 0; loop < dispsz; loop += 8) { - pc++; - if (__get_user(byte, pc) != 0) - goto fetch_error; - disp |= byte << loop; - kdebug("{%p} disp[%02x]=%02x", pc, loop, byte); - } - - kdebug("disp=%lx", disp); - - set_fs(KERNEL_XDS); - if (fixup) - set_fs(seg); - - tmp = (pop->params[0] ^ pop->params[1]) & 0x80000000; - if (!tmp) { - printk(KERN_CRIT - "MISALIGN: %lx: insn not move to/from memory %x\n", - regs->pc, opcode); - goto failed; - } - - /* determine the data transfer size of the move */ - if (pop->name[3] == 0 || /* "mov" */ - pop->name[4] == 'l') /* mov_lcc */ - inc = datasz = 4; - else if (pop->name[3] == 'h') /* movhu */ - inc = datasz = 2; - else - goto unsupported_instruction; - - if (pop->params[0] & 0x80000000) { - /* move memory to register */ - if (!misalignment_addr(registers, sp, - pop->params[0], opcode, disp, - &address, &postinc, &inc)) - goto bad_addr_mode; - - if (!misalignment_reg(registers, pop->params[1], opcode, disp, - &store)) - goto bad_reg_mode; - - kdebug("mov%u (%p),DARn", datasz, address); - if (copy_from_user(&data, (void *) address, datasz) != 0) - goto transfer_failed; - if (pop->params[0] & 0x1000000) { - kdebug("inc=%lx", inc); - *postinc += inc; - } - - *store = data; - kdebug("loaded %lx", data); - } else { - /* move register to memory */ - if (!misalignment_reg(registers, pop->params[0], opcode, disp, - &store)) - goto bad_reg_mode; - - if (!misalignment_addr(registers, sp, - pop->params[1], opcode, disp, - &address, &postinc, &inc)) - goto bad_addr_mode; - - data = *store; - - kdebug("mov%u %lx,(%p)", datasz, data, address); - if (copy_to_user((void *) address, &data, datasz) != 0) - goto transfer_failed; - if (pop->params[1] & 0x1000000) - *postinc += inc; - } - - tmp = format_tbl[pop->format].opsz + format_tbl[pop->format].dispsz; - regs->pc += tmp >> 3; - - /* handle MOV_Lcc, which are currently the only FMT_D10 insns that - * access memory */ - if (pop->format == FMT_D10) - misalignment_MOV_Lcc(regs, opcode); - - set_fs(seg); -} - -/* - * determine the address that was being accessed - */ -static int misalignment_addr(unsigned long *registers, unsigned long sp, - unsigned params, unsigned opcode, - unsigned long disp, - void **_address, unsigned long **_postinc, - unsigned long *_inc) -{ - unsigned long *postinc = NULL, address = 0, tmp; - - if (!(params & 0x1000000)) { - kdebug("noinc"); - *_inc = 0; - _inc = NULL; - } - - params &= 0x00ffffff; - - do { - switch (params & 0xff) { - case DM0: - postinc = ®isters[Dreg_index[opcode & 0x03]]; - address += *postinc; - break; - case DM1: - postinc = ®isters[Dreg_index[opcode >> 2 & 0x03]]; - address += *postinc; - break; - case DM2: - postinc = ®isters[Dreg_index[opcode >> 4 & 0x03]]; - address += *postinc; - break; - case AM0: - postinc = ®isters[Areg_index[opcode & 0x03]]; - address += *postinc; - break; - case AM1: - postinc = ®isters[Areg_index[opcode >> 2 & 0x03]]; - address += *postinc; - break; - case AM2: - postinc = ®isters[Areg_index[opcode >> 4 & 0x03]]; - address += *postinc; - break; - case RM0: - postinc = ®isters[Rreg_index[opcode & 0x0f]]; - address += *postinc; - break; - case RM1: - postinc = ®isters[Rreg_index[opcode >> 2 & 0x0f]]; - address += *postinc; - break; - case RM2: - postinc = ®isters[Rreg_index[opcode >> 4 & 0x0f]]; - address += *postinc; - break; - case RM4: - postinc = ®isters[Rreg_index[opcode >> 8 & 0x0f]]; - address += *postinc; - break; - case RM6: - postinc = ®isters[Rreg_index[opcode >> 12 & 0x0f]]; - address += *postinc; - break; - case RD0: - postinc = ®isters[Rreg_index[disp & 0x0f]]; - address += *postinc; - break; - case RD2: - postinc = ®isters[Rreg_index[disp >> 4 & 0x0f]]; - address += *postinc; - break; - case SP: - address += sp; - break; - - /* displacements are either to be added to the address - * before use, or, in the case of post-inc addressing, - * to be added into the base register after use */ - case SD8: - case SIMM8: - disp = (long) (int8_t) (disp & 0xff); - goto displace_or_inc; - case SD16: - disp = (long) (int16_t) (disp & 0xffff); - goto displace_or_inc; - case SD24: - tmp = disp << 8; - asm("asr 8,%0" : "=r"(tmp) : "0"(tmp) : "cc"); - disp = (long) tmp; - goto displace_or_inc; - case SIMM4_2: - tmp = opcode >> 4 & 0x0f; - tmp <<= 28; - asm("asr 28,%0" : "=r"(tmp) : "0"(tmp) : "cc"); - disp = (long) tmp; - goto displace_or_inc; - case IMM8: - disp &= 0x000000ff; - goto displace_or_inc; - case IMM16: - disp &= 0x0000ffff; - goto displace_or_inc; - case IMM24: - disp &= 0x00ffffff; - goto displace_or_inc; - case IMM32: - case IMM32_MEM: - case IMM32_HIGH8: - case IMM32_HIGH8_MEM: - displace_or_inc: - kdebug("%s %lx", _inc ? "incr" : "disp", disp); - if (!_inc) - address += disp; - else - *_inc = disp; - break; - default: - BUG(); - return 0; - } - } while ((params >>= 8)); - - *_address = (void *) address; - *_postinc = postinc; - return 1; -} - -/* - * determine the register that is acting as source/dest - */ -static int misalignment_reg(unsigned long *registers, unsigned params, - unsigned opcode, unsigned long disp, - unsigned long **_register) -{ - params &= 0x7fffffff; - - if (params & 0xffffff00) - return 0; - - switch (params & 0xff) { - case DM0: - *_register = ®isters[Dreg_index[opcode & 0x03]]; - break; - case DM1: - *_register = ®isters[Dreg_index[opcode >> 2 & 0x03]]; - break; - case DM2: - *_register = ®isters[Dreg_index[opcode >> 4 & 0x03]]; - break; - case AM0: - *_register = ®isters[Areg_index[opcode & 0x03]]; - break; - case AM1: - *_register = ®isters[Areg_index[opcode >> 2 & 0x03]]; - break; - case AM2: - *_register = ®isters[Areg_index[opcode >> 4 & 0x03]]; - break; - case RM0: - *_register = ®isters[Rreg_index[opcode & 0x0f]]; - break; - case RM1: - *_register = ®isters[Rreg_index[opcode >> 2 & 0x0f]]; - break; - case RM2: - *_register = ®isters[Rreg_index[opcode >> 4 & 0x0f]]; - break; - case RM4: - *_register = ®isters[Rreg_index[opcode >> 8 & 0x0f]]; - break; - case RM6: - *_register = ®isters[Rreg_index[opcode >> 12 & 0x0f]]; - break; - case RD0: - *_register = ®isters[Rreg_index[disp & 0x0f]]; - break; - case RD2: - *_register = ®isters[Rreg_index[disp >> 4 & 0x0f]]; - break; - case SP: - *_register = ®isters[REG_SP >> 2]; - break; - - default: - BUG(); - return 0; - } - - return 1; -} - -/* - * handle the conditional loop part of the move-and-loop instructions - */ -static void misalignment_MOV_Lcc(struct pt_regs *regs, uint32_t opcode) -{ - unsigned long epsw = regs->epsw; - unsigned long NxorV; - - kdebug("MOV_Lcc %x [flags=%lx]", opcode, epsw & 0xf); - - /* calculate N^V and shift onto the same bit position as Z */ - NxorV = ((epsw >> 3) ^ epsw >> 1) & 1; - - switch (opcode & 0xf) { - case 0x0: /* MOV_LLT: N^V */ - if (NxorV) - goto take_the_loop; - return; - case 0x1: /* MOV_LGT: ~(Z or (N^V))*/ - if (!((epsw & EPSW_FLAG_Z) | NxorV)) - goto take_the_loop; - return; - case 0x2: /* MOV_LGE: ~(N^V) */ - if (!NxorV) - goto take_the_loop; - return; - case 0x3: /* MOV_LLE: Z or (N^V) */ - if ((epsw & EPSW_FLAG_Z) | NxorV) - goto take_the_loop; - return; - - case 0x4: /* MOV_LCS: C */ - if (epsw & EPSW_FLAG_C) - goto take_the_loop; - return; - case 0x5: /* MOV_LHI: ~(C or Z) */ - if (!(epsw & (EPSW_FLAG_C | EPSW_FLAG_Z))) - goto take_the_loop; - return; - case 0x6: /* MOV_LCC: ~C */ - if (!(epsw & EPSW_FLAG_C)) - goto take_the_loop; - return; - case 0x7: /* MOV_LLS: C or Z */ - if (epsw & (EPSW_FLAG_C | EPSW_FLAG_Z)) - goto take_the_loop; - return; - - case 0x8: /* MOV_LEQ: Z */ - if (epsw & EPSW_FLAG_Z) - goto take_the_loop; - return; - case 0x9: /* MOV_LNE: ~Z */ - if (!(epsw & EPSW_FLAG_Z)) - goto take_the_loop; - return; - case 0xa: /* MOV_LRA: always */ - goto take_the_loop; - - default: - BUG(); - } - -take_the_loop: - /* wind the PC back to just after the SETLB insn */ - kdebug("loop LAR=%lx", regs->lar); - regs->pc = regs->lar - 4; -} - -/* - * misalignment handler tests - */ -#ifdef CONFIG_TEST_MISALIGNMENT_HANDLER -static u8 __initdata testbuf[512] __attribute__((aligned(16))) = { - [257] = 0x11, - [258] = 0x22, - [259] = 0x33, - [260] = 0x44, -}; - -#define ASSERTCMP(X, OP, Y) \ -do { \ - if (unlikely(!((X) OP (Y)))) { \ - printk(KERN_ERR "\n"); \ - printk(KERN_ERR "MISALIGN: Assertion failed at line %u\n", \ - __LINE__); \ - printk(KERN_ERR "0x%lx " #OP " 0x%lx is false\n", \ - (unsigned long)(X), (unsigned long)(Y)); \ - BUG(); \ - } \ -} while(0) - -static int __init test_misalignment(void) -{ - register void *r asm("e0"); - register u32 y asm("e1"); - void *p = testbuf, *q; - u32 tmp, tmp2, x; - - printk(KERN_NOTICE "==>test_misalignment() [testbuf=%p]\n", p); - p++; - - printk(KERN_NOTICE "___ MOV (Am),Dn ___\n"); - q = p + 256; - asm volatile("mov (%0),%1" : "+a"(q), "=d"(x)); - ASSERTCMP(q, ==, p + 256); - ASSERTCMP(x, ==, 0x44332211); - - printk(KERN_NOTICE "___ MOV (256,Am),Dn ___\n"); - q = p; - asm volatile("mov (256,%0),%1" : "+a"(q), "=d"(x)); - ASSERTCMP(q, ==, p); - ASSERTCMP(x, ==, 0x44332211); - - printk(KERN_NOTICE "___ MOV (Di,Am),Dn ___\n"); - tmp = 256; - q = p; - asm volatile("mov (%2,%0),%1" : "+a"(q), "=d"(x), "+d"(tmp)); - ASSERTCMP(q, ==, p); - ASSERTCMP(x, ==, 0x44332211); - ASSERTCMP(tmp, ==, 256); - - printk(KERN_NOTICE "___ MOV (256,Rm),Rn ___\n"); - r = p; - asm volatile("mov (256,%0),%1" : "+r"(r), "=r"(y)); - ASSERTCMP(r, ==, p); - ASSERTCMP(y, ==, 0x44332211); - - printk(KERN_NOTICE "___ MOV (Rm+),Rn ___\n"); - r = p + 256; - asm volatile("mov (%0+),%1" : "+r"(r), "=r"(y)); - ASSERTCMP(r, ==, p + 256 + 4); - ASSERTCMP(y, ==, 0x44332211); - - printk(KERN_NOTICE "___ MOV (Rm+,8),Rn ___\n"); - r = p + 256; - asm volatile("mov (%0+,8),%1" : "+r"(r), "=r"(y)); - ASSERTCMP(r, ==, p + 256 + 8); - ASSERTCMP(y, ==, 0x44332211); - - printk(KERN_NOTICE "___ MOV (7,SP),Rn ___\n"); - asm volatile( - "add -16,sp \n" - "mov +0x11,%0 \n" - "movbu %0,(7,sp) \n" - "mov +0x22,%0 \n" - "movbu %0,(8,sp) \n" - "mov +0x33,%0 \n" - "movbu %0,(9,sp) \n" - "mov +0x44,%0 \n" - "movbu %0,(10,sp) \n" - "mov (7,sp),%1 \n" - "add +16,sp \n" - : "+a"(q), "=d"(x)); - ASSERTCMP(x, ==, 0x44332211); - - printk(KERN_NOTICE "___ MOV (259,SP),Rn ___\n"); - asm volatile( - "add -264,sp \n" - "mov +0x11,%0 \n" - "movbu %0,(259,sp) \n" - "mov +0x22,%0 \n" - "movbu %0,(260,sp) \n" - "mov +0x33,%0 \n" - "movbu %0,(261,sp) \n" - "mov +0x55,%0 \n" - "movbu %0,(262,sp) \n" - "mov (259,sp),%1 \n" - "add +264,sp \n" - : "+d"(tmp), "=d"(x)); - ASSERTCMP(x, ==, 0x55332211); - - printk(KERN_NOTICE "___ MOV (260,SP),Rn ___\n"); - asm volatile( - "add -264,sp \n" - "mov +0x11,%0 \n" - "movbu %0,(260,sp) \n" - "mov +0x22,%0 \n" - "movbu %0,(261,sp) \n" - "mov +0x33,%0 \n" - "movbu %0,(262,sp) \n" - "mov +0x55,%0 \n" - "movbu %0,(263,sp) \n" - "mov (260,sp),%1 \n" - "add +264,sp \n" - : "+d"(tmp), "=d"(x)); - ASSERTCMP(x, ==, 0x55332211); - - - printk(KERN_NOTICE "___ MOV_LNE ___\n"); - tmp = 1; - tmp2 = 2; - q = p + 256; - asm volatile( - "setlb \n" - "mov %2,%3 \n" - "mov %1,%2 \n" - "cmp +0,%1 \n" - "mov_lne (%0+,4),%1" - : "+r"(q), "+d"(tmp), "+d"(tmp2), "=d"(x) - : - : "cc"); - ASSERTCMP(q, ==, p + 256 + 12); - ASSERTCMP(x, ==, 0x44332211); - - printk(KERN_NOTICE "___ MOV in SETLB ___\n"); - tmp = 1; - tmp2 = 2; - q = p + 256; - asm volatile( - "setlb \n" - "mov %1,%3 \n" - "mov (%0+),%1 \n" - "cmp +0,%1 \n" - "lne " - : "+a"(q), "+d"(tmp), "+d"(tmp2), "=d"(x) - : - : "cc"); - - ASSERTCMP(q, ==, p + 256 + 8); - ASSERTCMP(x, ==, 0x44332211); - - printk(KERN_NOTICE "<==test_misalignment()\n"); - return 0; -} - -arch_initcall(test_misalignment); - -#endif /* CONFIG_TEST_MISALIGNMENT_HANDLER */ diff --git a/arch/mn10300/mm/mmu-context.c b/arch/mn10300/mm/mmu-context.c deleted file mode 100644 index a4f7d3dcc6e6f..0000000000000 --- a/arch/mn10300/mm/mmu-context.c +++ /dev/null @@ -1,62 +0,0 @@ -/* MN10300 MMU context allocation and management - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include -#include -#include - -#ifdef CONFIG_MN10300_TLB_USE_PIDR -/* - * list of the MMU contexts last allocated on each CPU - */ -unsigned long mmu_context_cache[NR_CPUS] = { - [0 ... NR_CPUS - 1] = - MMU_CONTEXT_FIRST_VERSION * 2 - (1 - MMU_CONTEXT_TLBPID_LOCK_NR), -}; -#endif /* CONFIG_MN10300_TLB_USE_PIDR */ - -/* - * preemptively set a TLB entry - */ -void update_mmu_cache(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep) -{ - unsigned long pteu, ptel, cnx, flags; - pte_t pte = *ptep; - - addr &= PAGE_MASK; - ptel = pte_val(pte) & ~(xPTEL_UNUSED1 | xPTEL_UNUSED2); - - /* make sure the context doesn't migrate and defend against - * interference from vmalloc'd regions */ - local_irq_save(flags); - - cnx = ~MMU_NO_CONTEXT; -#ifdef CONFIG_MN10300_TLB_USE_PIDR - cnx = mm_context(vma->vm_mm); -#endif - - if (cnx != MMU_NO_CONTEXT) { - pteu = addr; -#ifdef CONFIG_MN10300_TLB_USE_PIDR - pteu |= cnx & MMU_CONTEXT_TLBPID_MASK; -#endif - if (!(pte_val(pte) & _PAGE_NX)) { - IPTEU = pteu; - if (IPTEL & xPTEL_V) - IPTEL = ptel; - } - DPTEU = pteu; - if (DPTEL & xPTEL_V) - DPTEL = ptel; - } - - local_irq_restore(flags); -} diff --git a/arch/mn10300/mm/pgtable.c b/arch/mn10300/mm/pgtable.c deleted file mode 100644 index 9577cf768875c..0000000000000 --- a/arch/mn10300/mm/pgtable.c +++ /dev/null @@ -1,174 +0,0 @@ -/* MN10300 Page table management - * - * Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd. - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Modified by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -/* - * Associate a large virtual page frame with a given physical page frame - * and protection flags for that frame. pfn is for the base of the page, - * vaddr is what the page gets mapped to - both must be properly aligned. - * The pmd must already be instantiated. Assumes PAE mode. - */ -void set_pmd_pfn(unsigned long vaddr, unsigned long pfn, pgprot_t flags) -{ - pgd_t *pgd; - pud_t *pud; - pmd_t *pmd; - - if (vaddr & (PMD_SIZE-1)) { /* vaddr is misaligned */ - printk(KERN_ERR "set_pmd_pfn: vaddr misaligned\n"); - return; /* BUG(); */ - } - if (pfn & (PTRS_PER_PTE-1)) { /* pfn is misaligned */ - printk(KERN_ERR "set_pmd_pfn: pfn misaligned\n"); - return; /* BUG(); */ - } - pgd = swapper_pg_dir + pgd_index(vaddr); - if (pgd_none(*pgd)) { - printk(KERN_ERR "set_pmd_pfn: pgd_none\n"); - return; /* BUG(); */ - } - pud = pud_offset(pgd, vaddr); - pmd = pmd_offset(pud, vaddr); - set_pmd(pmd, pfn_pmd(pfn, flags)); - /* - * It's enough to flush this one mapping. - * (PGE mappings get flushed as well) - */ - local_flush_tlb_one(vaddr); -} - -pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address) -{ - pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL); - if (pte) - clear_page(pte); - return pte; -} - -struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address) -{ - struct page *pte; - -#ifdef CONFIG_HIGHPTE - pte = alloc_pages(GFP_KERNEL|__GFP_HIGHMEM, 0); -#else - pte = alloc_pages(GFP_KERNEL, 0); -#endif - if (!pte) - return NULL; - clear_highpage(pte); - if (!pgtable_page_ctor(pte)) { - __free_page(pte); - return NULL; - } - return pte; -} - -/* - * List of all pgd's needed for non-PAE so it can invalidate entries - * in both cached and uncached pgd's; not needed for PAE since the - * kernel pmd is shared. If PAE were not to share the pmd a similar - * tactic would be needed. This is essentially codepath-based locking - * against pageattr.c; it is the unique case in which a valid change - * of kernel pagetables can't be lazily synchronized by vmalloc faults. - * vmalloc faults work because attached pagetables are never freed. - * If the locking proves to be non-performant, a ticketing scheme with - * checks at dup_mmap(), exec(), and other mmlist addition points - * could be used. The locking scheme was chosen on the basis of - * manfred's recommendations and having no core impact whatsoever. - * -- nyc - */ -DEFINE_SPINLOCK(pgd_lock); -struct page *pgd_list; - -static inline void pgd_list_add(pgd_t *pgd) -{ - struct page *page = virt_to_page(pgd); - page->index = (unsigned long) pgd_list; - if (pgd_list) - set_page_private(pgd_list, (unsigned long) &page->index); - pgd_list = page; - set_page_private(page, (unsigned long) &pgd_list); -} - -static inline void pgd_list_del(pgd_t *pgd) -{ - struct page *next, **pprev, *page = virt_to_page(pgd); - next = (struct page *) page->index; - pprev = (struct page **) page_private(page); - *pprev = next; - if (next) - set_page_private(next, (unsigned long) pprev); -} - -void pgd_ctor(void *pgd) -{ - unsigned long flags; - - if (PTRS_PER_PMD == 1) - spin_lock_irqsave(&pgd_lock, flags); - - memcpy((pgd_t *)pgd + USER_PTRS_PER_PGD, - swapper_pg_dir + USER_PTRS_PER_PGD, - (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t)); - - if (PTRS_PER_PMD > 1) - return; - - pgd_list_add(pgd); - spin_unlock_irqrestore(&pgd_lock, flags); - memset(pgd, 0, USER_PTRS_PER_PGD * sizeof(pgd_t)); -} - -/* never called when PTRS_PER_PMD > 1 */ -void pgd_dtor(void *pgd) -{ - unsigned long flags; /* can be called from interrupt context */ - - spin_lock_irqsave(&pgd_lock, flags); - pgd_list_del(pgd); - spin_unlock_irqrestore(&pgd_lock, flags); -} - -pgd_t *pgd_alloc(struct mm_struct *mm) -{ - return quicklist_alloc(0, GFP_KERNEL, pgd_ctor); -} - -void pgd_free(struct mm_struct *mm, pgd_t *pgd) -{ - quicklist_free(0, pgd_dtor, pgd); -} - -void __init pgtable_cache_init(void) -{ -} - -void check_pgt_cache(void) -{ - quicklist_trim(0, pgd_dtor, 25, 16); -} diff --git a/arch/mn10300/mm/tlb-mn10300.S b/arch/mn10300/mm/tlb-mn10300.S deleted file mode 100644 index b9940177d81be..0000000000000 --- a/arch/mn10300/mm/tlb-mn10300.S +++ /dev/null @@ -1,220 +0,0 @@ -############################################################################### -# -# TLB loading functions -# -# Copyright (C) 2007 Matsushita Electric Industrial Co., Ltd. -# Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. -# Modified by David Howells (dhowells@redhat.com) -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public Licence -# as published by the Free Software Foundation; either version -# 2 of the Licence, or (at your option) any later version. -# -############################################################################### -#include -#include -#include -#include -#include -#include -#include - -############################################################################### -# -# Instruction TLB Miss handler entry point -# -############################################################################### - .type itlb_miss,@function -ENTRY(itlb_miss) -#ifdef CONFIG_GDBSTUB - movm [d2,d3,a2],(sp) -#else - or EPSW_nAR,epsw # switch D0-D3 & A0-A3 to the alternate - # register bank - nop - nop - nop -#endif - -#if defined(CONFIG_ERRATUM_NEED_TO_RELOAD_MMUCTR) - mov (MMUCTR),d2 - mov d2,(MMUCTR) -#endif - - and ~EPSW_NMID,epsw - mov (IPTEU),d3 - mov (PTBR),a2 - mov d3,d2 - and 0xffc00000,d2 - lsr 20,d2 - mov (a2,d2),a2 # PTD *ptd = PGD[addr 31..22] - btst _PAGE_VALID,a2 - beq itlb_miss_fault # jump if doesn't point anywhere - - and ~(PAGE_SIZE-1),a2 - mov d3,d2 - and 0x003ff000,d2 - lsr 10,d2 - add d2,a2 - mov (a2),d2 # get pte from PTD[addr 21..12] - btst _PAGE_VALID,d2 - beq itlb_miss_fault # jump if doesn't point to a page - # (might be a swap id) -#if ((_PAGE_ACCESSED & 0xffffff00) == 0) - bset _PAGE_ACCESSED,(0,a2) -#elif ((_PAGE_ACCESSED & 0xffff00ff) == 0) - bset +(_PAGE_ACCESSED >> 8),(1,a2) -#else -#error "_PAGE_ACCESSED value is out of range" -#endif - and ~xPTEL2_UNUSED1,d2 -itlb_miss_set: - mov d2,(IPTEL2) # change the TLB -#ifdef CONFIG_GDBSTUB - movm (sp),[d2,d3,a2] -#endif - rti - -itlb_miss_fault: - mov _PAGE_VALID,d2 # force address error handler to be - # invoked - bra itlb_miss_set - - .size itlb_miss, . - itlb_miss - -############################################################################### -# -# Data TLB Miss handler entry point -# -############################################################################### - .type dtlb_miss,@function -ENTRY(dtlb_miss) -#ifdef CONFIG_GDBSTUB - movm [d2,d3,a2],(sp) -#else - or EPSW_nAR,epsw # switch D0-D3 & A0-A3 to the alternate - # register bank - nop - nop - nop -#endif - -#if defined(CONFIG_ERRATUM_NEED_TO_RELOAD_MMUCTR) - mov (MMUCTR),d2 - mov d2,(MMUCTR) -#endif - - and ~EPSW_NMID,epsw - mov (DPTEU),d3 - mov (PTBR),a2 - mov d3,d2 - and 0xffc00000,d2 - lsr 20,d2 - mov (a2,d2),a2 # PTD *ptd = PGD[addr 31..22] - btst _PAGE_VALID,a2 - beq dtlb_miss_fault # jump if doesn't point anywhere - - and ~(PAGE_SIZE-1),a2 - mov d3,d2 - and 0x003ff000,d2 - lsr 10,d2 - add d2,a2 - mov (a2),d2 # get pte from PTD[addr 21..12] - btst _PAGE_VALID,d2 - beq dtlb_miss_fault # jump if doesn't point to a page - # (might be a swap id) -#if ((_PAGE_ACCESSED & 0xffffff00) == 0) - bset _PAGE_ACCESSED,(0,a2) -#elif ((_PAGE_ACCESSED & 0xffff00ff) == 0) - bset +(_PAGE_ACCESSED >> 8),(1,a2) -#else -#error "_PAGE_ACCESSED value is out of range" -#endif - and ~xPTEL2_UNUSED1,d2 -dtlb_miss_set: - mov d2,(DPTEL2) # change the TLB -#ifdef CONFIG_GDBSTUB - movm (sp),[d2,d3,a2] -#endif - rti - -dtlb_miss_fault: - mov _PAGE_VALID,d2 # force address error handler to be - # invoked - bra dtlb_miss_set - .size dtlb_miss, . - dtlb_miss - -############################################################################### -# -# Instruction TLB Address Error handler entry point -# -############################################################################### - .type itlb_aerror,@function -ENTRY(itlb_aerror) - add -4,sp - SAVE_ALL - -#if defined(CONFIG_ERRATUM_NEED_TO_RELOAD_MMUCTR) - mov (MMUCTR),d1 - mov d1,(MMUCTR) -#endif - - and ~EPSW_NMID,epsw - add -4,sp # need to pass three params - - # calculate the fault code - movhu (MMUFCR_IFC),d1 - or 0x00010000,d1 # it's an instruction fetch - - # determine the page address - mov (IPTEU),d0 - and PAGE_MASK,d0 - mov d0,(12,sp) - - clr d0 - mov d0,(IPTEL2) - - or EPSW_IE,epsw - mov fp,d0 - call do_page_fault[],0 # do_page_fault(regs,code,addr - - jmp ret_from_exception - .size itlb_aerror, . - itlb_aerror - -############################################################################### -# -# Data TLB Address Error handler entry point -# -############################################################################### - .type dtlb_aerror,@function -ENTRY(dtlb_aerror) - add -4,sp - SAVE_ALL - -#if defined(CONFIG_ERRATUM_NEED_TO_RELOAD_MMUCTR) - mov (MMUCTR),d1 - mov d1,(MMUCTR) -#endif - - add -4,sp # need to pass three params - and ~EPSW_NMID,epsw - - # calculate the fault code - movhu (MMUFCR_DFC),d1 - - # determine the page address - mov (DPTEU),a2 - mov a2,d0 - and PAGE_MASK,d0 - mov d0,(12,sp) - - clr d0 - mov d0,(DPTEL2) - - or EPSW_IE,epsw - mov fp,d0 - call do_page_fault[],0 # do_page_fault(regs,code,addr - - jmp ret_from_exception - .size dtlb_aerror, . - dtlb_aerror diff --git a/arch/mn10300/mm/tlb-smp.c b/arch/mn10300/mm/tlb-smp.c deleted file mode 100644 index 085f2bb691aca..0000000000000 --- a/arch/mn10300/mm/tlb-smp.c +++ /dev/null @@ -1,213 +0,0 @@ -/* SMP TLB support routines. - * - * Copyright (C) 2006-2008 Panasonic Corporation - * All Rights Reserved. - * - * 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. - * - * 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. - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * For flush TLB - */ -#define FLUSH_ALL 0xffffffff - -static cpumask_t flush_cpumask; -static struct mm_struct *flush_mm; -static unsigned long flush_va; -static DEFINE_SPINLOCK(tlbstate_lock); - -DEFINE_PER_CPU_SHARED_ALIGNED(struct tlb_state, cpu_tlbstate) = { - &init_mm, 0 -}; - -static void flush_tlb_others(cpumask_t cpumask, struct mm_struct *mm, - unsigned long va); -static void do_flush_tlb_all(void *info); - -/** - * smp_flush_tlb - Callback to invalidate the TLB. - * @unused: Callback context (ignored). - */ -void smp_flush_tlb(void *unused) -{ - unsigned long cpu_id; - - cpu_id = get_cpu(); - - if (!cpumask_test_cpu(cpu_id, &flush_cpumask)) - /* This was a BUG() but until someone can quote me the line - * from the intel manual that guarantees an IPI to multiple - * CPUs is retried _only_ on the erroring CPUs its staying as a - * return - * - * BUG(); - */ - goto out; - - if (flush_va == FLUSH_ALL) - local_flush_tlb(); - else - local_flush_tlb_page(flush_mm, flush_va); - - smp_mb__before_atomic(); - cpumask_clear_cpu(cpu_id, &flush_cpumask); - smp_mb__after_atomic(); -out: - put_cpu(); -} - -/** - * flush_tlb_others - Tell the specified CPUs to invalidate their TLBs - * @cpumask: The list of CPUs to target. - * @mm: The VM context to flush from (if va!=FLUSH_ALL). - * @va: Virtual address to flush or FLUSH_ALL to flush everything. - */ -static void flush_tlb_others(cpumask_t cpumask, struct mm_struct *mm, - unsigned long va) -{ - cpumask_t tmp; - - /* A couple of sanity checks (to be removed): - * - mask must not be empty - * - current CPU must not be in mask - * - we do not send IPIs to as-yet unbooted CPUs. - */ - BUG_ON(!mm); - BUG_ON(cpumask_empty(&cpumask)); - BUG_ON(cpumask_test_cpu(smp_processor_id(), &cpumask)); - - cpumask_and(&tmp, &cpumask, cpu_online_mask); - BUG_ON(!cpumask_equal(&cpumask, &tmp)); - - /* I'm not happy about this global shared spinlock in the MM hot path, - * but we'll see how contended it is. - * - * Temporarily this turns IRQs off, so that lockups are detected by the - * NMI watchdog. - */ - spin_lock(&tlbstate_lock); - - flush_mm = mm; - flush_va = va; -#if NR_CPUS <= BITS_PER_LONG - atomic_or(cpumask.bits[0], (atomic_t *)&flush_cpumask.bits[0]); -#else -#error Not supported. -#endif - - /* FIXME: if NR_CPUS>=3, change send_IPI_mask */ - smp_call_function(smp_flush_tlb, NULL, 1); - - while (!cpumask_empty(&flush_cpumask)) - /* Lockup detection does not belong here */ - smp_mb(); - - flush_mm = NULL; - flush_va = 0; - spin_unlock(&tlbstate_lock); -} - -/** - * flush_tlb_mm - Invalidate TLB of specified VM context - * @mm: The VM context to invalidate. - */ -void flush_tlb_mm(struct mm_struct *mm) -{ - cpumask_t cpu_mask; - - preempt_disable(); - cpumask_copy(&cpu_mask, mm_cpumask(mm)); - cpumask_clear_cpu(smp_processor_id(), &cpu_mask); - - local_flush_tlb(); - if (!cpumask_empty(&cpu_mask)) - flush_tlb_others(cpu_mask, mm, FLUSH_ALL); - - preempt_enable(); -} - -/** - * flush_tlb_current_task - Invalidate TLB of current task - */ -void flush_tlb_current_task(void) -{ - struct mm_struct *mm = current->mm; - cpumask_t cpu_mask; - - preempt_disable(); - cpumask_copy(&cpu_mask, mm_cpumask(mm)); - cpumask_clear_cpu(smp_processor_id(), &cpu_mask); - - local_flush_tlb(); - if (!cpumask_empty(&cpu_mask)) - flush_tlb_others(cpu_mask, mm, FLUSH_ALL); - - preempt_enable(); -} - -/** - * flush_tlb_page - Invalidate TLB of page - * @vma: The VM context to invalidate the page for. - * @va: The virtual address of the page to invalidate. - */ -void flush_tlb_page(struct vm_area_struct *vma, unsigned long va) -{ - struct mm_struct *mm = vma->vm_mm; - cpumask_t cpu_mask; - - preempt_disable(); - cpumask_copy(&cpu_mask, mm_cpumask(mm)); - cpumask_clear_cpu(smp_processor_id(), &cpu_mask); - - local_flush_tlb_page(mm, va); - if (!cpumask_empty(&cpu_mask)) - flush_tlb_others(cpu_mask, mm, va); - - preempt_enable(); -} - -/** - * do_flush_tlb_all - Callback to completely invalidate a TLB - * @unused: Callback context (ignored). - */ -static void do_flush_tlb_all(void *unused) -{ - local_flush_tlb_all(); -} - -/** - * flush_tlb_all - Completely invalidate TLBs on all CPUs - */ -void flush_tlb_all(void) -{ - on_each_cpu(do_flush_tlb_all, 0, 1); -} diff --git a/arch/mn10300/oprofile/Makefile b/arch/mn10300/oprofile/Makefile deleted file mode 100644 index 9fa95aaf496b3..0000000000000 --- a/arch/mn10300/oprofile/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# -# Makefile for the MN10300-specific profiling code -# -obj-$(CONFIG_OPROFILE) += oprofile.o - -DRIVER_OBJS = $(addprefix ../../../drivers/oprofile/, \ - oprof.o cpu_buffer.o buffer_sync.o \ - event_buffer.o oprofile_files.o \ - oprofilefs.o oprofile_stats.o \ - timer_int.o ) - -oprofile-y := $(DRIVER_OBJS) op_model_null.o - diff --git a/arch/mn10300/oprofile/op_model_null.c b/arch/mn10300/oprofile/op_model_null.c deleted file mode 100644 index cd4ab374bc4fa..0000000000000 --- a/arch/mn10300/oprofile/op_model_null.c +++ /dev/null @@ -1,22 +0,0 @@ -/* Null profiling driver - * - * Copyright (C) 2003 Paul Mundt - * - * This file is subject to the terms and conditions of the GNU General Public - * Licence. See the file "COPYING" in the main directory of this archive - * for more details. - */ -#include -#include -#include -#include - -int __init oprofile_arch_init(struct oprofile_operations *ops) -{ - return -ENODEV; -} - -void oprofile_arch_exit(void) -{ -} - diff --git a/arch/mn10300/proc-mn103e010/Makefile b/arch/mn10300/proc-mn103e010/Makefile deleted file mode 100644 index ac2c9784cd210..0000000000000 --- a/arch/mn10300/proc-mn103e010/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# -# Makefile for the MN103E010 processor chip specific code -# -obj-y := proc-init.o - diff --git a/arch/mn10300/proc-mn103e010/include/proc/cache.h b/arch/mn10300/proc-mn103e010/include/proc/cache.h deleted file mode 100644 index 967d144f307e5..0000000000000 --- a/arch/mn10300/proc-mn103e010/include/proc/cache.h +++ /dev/null @@ -1,43 +0,0 @@ -/* MN103E010 Cache specification - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_PROC_CACHE_H -#define _ASM_PROC_CACHE_H - -/* L1 cache */ - -#define L1_CACHE_NWAYS 4 /* number of ways in caches */ -#define L1_CACHE_NENTRIES 256 /* number of entries in each way */ -#define L1_CACHE_BYTES 16 /* bytes per entry */ -#define L1_CACHE_SHIFT 4 /* shift for bytes per entry */ -#define L1_CACHE_WAYDISP 0x1000 /* displacement of one way from the next */ - -#define L1_CACHE_TAG_VALID 0x00000001 /* cache tag valid bit */ -#define L1_CACHE_TAG_DIRTY 0x00000008 /* data cache tag dirty bit */ -#define L1_CACHE_TAG_ENTRY 0x00000ff0 /* cache tag entry address mask */ -#define L1_CACHE_TAG_ADDRESS 0xfffff000 /* cache tag line address mask */ -#define L1_CACHE_TAG_MASK +(L1_CACHE_TAG_ADDRESS|L1_CACHE_TAG_ENTRY) - -/* - * specification of the interval between interrupt checking intervals whilst - * managing the cache with the interrupts disabled - */ -#define MN10300_DCACHE_INV_RANGE_INTR_LOG2_INTERVAL 4 - -/* - * The size of range at which it becomes more economical to just flush the - * whole cache rather than trying to flush the specified range. - */ -#define MN10300_DCACHE_FLUSH_BORDER \ - +(L1_CACHE_NWAYS * L1_CACHE_NENTRIES * L1_CACHE_BYTES) -#define MN10300_DCACHE_FLUSH_INV_BORDER \ - +(L1_CACHE_NWAYS * L1_CACHE_NENTRIES * L1_CACHE_BYTES) - -#endif /* _ASM_PROC_CACHE_H */ diff --git a/arch/mn10300/proc-mn103e010/include/proc/clock.h b/arch/mn10300/proc-mn103e010/include/proc/clock.h deleted file mode 100644 index 704a819f1f4b1..0000000000000 --- a/arch/mn10300/proc-mn103e010/include/proc/clock.h +++ /dev/null @@ -1,16 +0,0 @@ -/* MN103E010-specific clocks - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_PROC_CLOCK_H -#define _ASM_PROC_CLOCK_H - -#include - -#endif /* _ASM_PROC_CLOCK_H */ diff --git a/arch/mn10300/proc-mn103e010/include/proc/dmactl-regs.h b/arch/mn10300/proc-mn103e010/include/proc/dmactl-regs.h deleted file mode 100644 index d72d328d1f9ca..0000000000000 --- a/arch/mn10300/proc-mn103e010/include/proc/dmactl-regs.h +++ /dev/null @@ -1,102 +0,0 @@ -/* MN103E010 on-board DMA controller registers - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - -#ifndef _ASM_PROC_DMACTL_REGS_H -#define _ASM_PROC_DMACTL_REGS_H - -#include - -#ifdef __KERNEL__ - -/* DMA registers */ -#define DMxCTR(N) __SYSREG(0xd2000000 + ((N) * 0x100), u32) /* control reg */ -#define DMxCTR_BG 0x0000001f /* transfer request source */ -#define DMxCTR_BG_SOFT 0x00000000 /* - software source */ -#define DMxCTR_BG_SC0TX 0x00000002 /* - serial port 0 transmission */ -#define DMxCTR_BG_SC0RX 0x00000003 /* - serial port 0 reception */ -#define DMxCTR_BG_SC1TX 0x00000004 /* - serial port 1 transmission */ -#define DMxCTR_BG_SC1RX 0x00000005 /* - serial port 1 reception */ -#define DMxCTR_BG_SC2TX 0x00000006 /* - serial port 2 transmission */ -#define DMxCTR_BG_SC2RX 0x00000007 /* - serial port 2 reception */ -#define DMxCTR_BG_TM0UFLOW 0x00000008 /* - timer 0 underflow */ -#define DMxCTR_BG_TM1UFLOW 0x00000009 /* - timer 1 underflow */ -#define DMxCTR_BG_TM2UFLOW 0x0000000a /* - timer 2 underflow */ -#define DMxCTR_BG_TM3UFLOW 0x0000000b /* - timer 3 underflow */ -#define DMxCTR_BG_TM6ACMPCAP 0x0000000c /* - timer 6A compare/capture */ -#define DMxCTR_BG_AFE 0x0000000d /* - analogue front-end interrupt source */ -#define DMxCTR_BG_ADC 0x0000000e /* - A/D conversion end interrupt source */ -#define DMxCTR_BG_IRDA 0x0000000f /* - IrDA interrupt source */ -#define DMxCTR_BG_RTC 0x00000010 /* - RTC interrupt source */ -#define DMxCTR_BG_XIRQ0 0x00000011 /* - XIRQ0 pin interrupt source */ -#define DMxCTR_BG_XIRQ1 0x00000012 /* - XIRQ1 pin interrupt source */ -#define DMxCTR_BG_XDMR0 0x00000013 /* - external request 0 source (XDMR0 pin) */ -#define DMxCTR_BG_XDMR1 0x00000014 /* - external request 1 source (XDMR1 pin) */ -#define DMxCTR_SAM 0x000000e0 /* DMA transfer src addr mode */ -#define DMxCTR_SAM_INCR 0x00000000 /* - increment */ -#define DMxCTR_SAM_DECR 0x00000020 /* - decrement */ -#define DMxCTR_SAM_FIXED 0x00000040 /* - fixed */ -#define DMxCTR_DAM 0x00000000 /* DMA transfer dest addr mode */ -#define DMxCTR_DAM_INCR 0x00000000 /* - increment */ -#define DMxCTR_DAM_DECR 0x00000100 /* - decrement */ -#define DMxCTR_DAM_FIXED 0x00000200 /* - fixed */ -#define DMxCTR_TM 0x00001800 /* DMA transfer mode */ -#define DMxCTR_TM_BATCH 0x00000000 /* - batch transfer */ -#define DMxCTR_TM_INTERM 0x00001000 /* - intermittent transfer */ -#define DMxCTR_UT 0x00006000 /* DMA transfer unit */ -#define DMxCTR_UT_1 0x00000000 /* - 1 byte */ -#define DMxCTR_UT_2 0x00002000 /* - 2 byte */ -#define DMxCTR_UT_4 0x00004000 /* - 4 byte */ -#define DMxCTR_UT_16 0x00006000 /* - 16 byte */ -#define DMxCTR_TEN 0x00010000 /* DMA channel transfer enable */ -#define DMxCTR_RQM 0x00060000 /* external request input source mode */ -#define DMxCTR_RQM_FALLEDGE 0x00000000 /* - falling edge */ -#define DMxCTR_RQM_RISEEDGE 0x00020000 /* - rising edge */ -#define DMxCTR_RQM_LOLEVEL 0x00040000 /* - low level */ -#define DMxCTR_RQM_HILEVEL 0x00060000 /* - high level */ -#define DMxCTR_RQF 0x01000000 /* DMA transfer request flag */ -#define DMxCTR_XEND 0x80000000 /* DMA transfer end flag */ - -#define DMxSRC(N) __SYSREG(0xd2000004 + ((N) * 0x100), u32) /* control reg */ - -#define DMxDST(N) __SYSREG(0xd2000008 + ((N) * 0x100), u32) /* src addr reg */ - -#define DMxSIZ(N) __SYSREG(0xd200000c + ((N) * 0x100), u32) /* dest addr reg */ -#define DMxSIZ_CT 0x000fffff /* number of bytes to transfer */ - -#define DMxCYC(N) __SYSREG(0xd2000010 + ((N) * 0x100), u32) /* intermittent - * size reg */ -#define DMxCYC_CYC 0x000000ff /* number of interrmittent transfers -1 */ - -#define DM0IRQ 16 /* DMA channel 0 complete IRQ */ -#define DM1IRQ 17 /* DMA channel 1 complete IRQ */ -#define DM2IRQ 18 /* DMA channel 2 complete IRQ */ -#define DM3IRQ 19 /* DMA channel 3 complete IRQ */ - -#define DM0ICR GxICR(DM0IRQ) /* DMA channel 0 complete intr ctrl reg */ -#define DM1ICR GxICR(DM0IR1) /* DMA channel 1 complete intr ctrl reg */ -#define DM2ICR GxICR(DM0IR2) /* DMA channel 2 complete intr ctrl reg */ -#define DM3ICR GxICR(DM0IR3) /* DMA channel 3 complete intr ctrl reg */ - -#ifndef __ASSEMBLY__ - -struct mn10300_dmactl_regs { - u32 ctr; - const void *src; - void *dst; - u32 siz; - u32 cyc; -} __attribute__((aligned(0x100))); - -#endif /* __ASSEMBLY__ */ - -#endif /* __KERNEL__ */ - -#endif /* _ASM_PROC_DMACTL_REGS_H */ diff --git a/arch/mn10300/proc-mn103e010/include/proc/intctl-regs.h b/arch/mn10300/proc-mn103e010/include/proc/intctl-regs.h deleted file mode 100644 index 516afe8240559..0000000000000 --- a/arch/mn10300/proc-mn103e010/include/proc/intctl-regs.h +++ /dev/null @@ -1,30 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_PROC_INTCTL_REGS_H -#define _ASM_PROC_INTCTL_REGS_H - -#ifndef _ASM_INTCTL_REGS_H -# error "please don't include this file directly" -#endif - -/* intr acceptance group reg */ -#define IAGR __SYSREG(0xd4000100, u16) - -/* group number register */ -#define IAGR_GN 0x00fc - -#define __GET_XIRQ_TRIGGER(X, Z) (((Z) >> ((X) * 2)) & 3) - -#define __SET_XIRQ_TRIGGER(X, Y, Z) \ -({ \ - typeof(Z) x = (Z); \ - x &= ~(3 << ((X) * 2)); \ - x |= ((Y) & 3) << ((X) * 2); \ - (Z) = x; \ -}) - -/* external pin intr spec reg */ -#define EXTMD __SYSREG(0xd4000200, u16) -#define GET_XIRQ_TRIGGER(X) __GET_XIRQ_TRIGGER(X, EXTMD) -#define SET_XIRQ_TRIGGER(X, Y) __SET_XIRQ_TRIGGER(X, Y, EXTMD) - -#endif /* _ASM_PROC_INTCTL_REGS_H */ diff --git a/arch/mn10300/proc-mn103e010/include/proc/irq.h b/arch/mn10300/proc-mn103e010/include/proc/irq.h deleted file mode 100644 index aa6ee8f98b1b5..0000000000000 --- a/arch/mn10300/proc-mn103e010/include/proc/irq.h +++ /dev/null @@ -1,34 +0,0 @@ -/* MN103E010 On-board interrupt controller numbers - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - -#ifndef _ASM_PROC_IRQ_H -#define _ASM_PROC_IRQ_H - -#ifdef __KERNEL__ - -#define GxICR_NUM_IRQS 42 - -#define GxICR_NUM_XIRQS 8 - -#define XIRQ0 34 -#define XIRQ1 35 -#define XIRQ2 36 -#define XIRQ3 37 -#define XIRQ4 38 -#define XIRQ5 39 -#define XIRQ6 40 -#define XIRQ7 41 - -#define XIRQ2IRQ(num) (XIRQ0 + num) - -#endif /* __KERNEL__ */ - -#endif /* _ASM_PROC_IRQ_H */ diff --git a/arch/mn10300/proc-mn103e010/include/proc/proc.h b/arch/mn10300/proc-mn103e010/include/proc/proc.h deleted file mode 100644 index 39c4f8e7d2d32..0000000000000 --- a/arch/mn10300/proc-mn103e010/include/proc/proc.h +++ /dev/null @@ -1,18 +0,0 @@ -/* MN103E010 Processor description - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - -#ifndef _ASM_PROC_PROC_H -#define _ASM_PROC_PROC_H - -#define PROCESSOR_VENDOR_NAME "Panasonic" -#define PROCESSOR_MODEL_NAME "mn103e010" - -#endif /* _ASM_PROC_PROC_H */ diff --git a/arch/mn10300/proc-mn103e010/proc-init.c b/arch/mn10300/proc-mn103e010/proc-init.c deleted file mode 100644 index 102d86a6ae563..0000000000000 --- a/arch/mn10300/proc-mn103e010/proc-init.c +++ /dev/null @@ -1,115 +0,0 @@ -/* MN103E010 Processor initialisation - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include -#include -#include -#include -#include -#include - -/* - * initialise the on-silicon processor peripherals - */ -asmlinkage void __init processor_init(void) -{ - int loop; - - /* set up the exception table first */ - for (loop = 0x000; loop < 0x400; loop += 8) - __set_intr_stub(loop, __common_exception); - - __set_intr_stub(EXCEP_ITLBMISS, itlb_miss); - __set_intr_stub(EXCEP_DTLBMISS, dtlb_miss); - __set_intr_stub(EXCEP_IAERROR, itlb_aerror); - __set_intr_stub(EXCEP_DAERROR, dtlb_aerror); - __set_intr_stub(EXCEP_BUSERROR, raw_bus_error); - __set_intr_stub(EXCEP_DOUBLE_FAULT, double_fault); - __set_intr_stub(EXCEP_FPU_DISABLED, fpu_disabled); - __set_intr_stub(EXCEP_SYSCALL0, system_call); - - __set_intr_stub(EXCEP_NMI, nmi_handler); - __set_intr_stub(EXCEP_WDT, nmi_handler); - __set_intr_stub(EXCEP_IRQ_LEVEL0, irq_handler); - __set_intr_stub(EXCEP_IRQ_LEVEL1, irq_handler); - __set_intr_stub(EXCEP_IRQ_LEVEL2, irq_handler); - __set_intr_stub(EXCEP_IRQ_LEVEL3, irq_handler); - __set_intr_stub(EXCEP_IRQ_LEVEL4, irq_handler); - __set_intr_stub(EXCEP_IRQ_LEVEL5, irq_handler); - __set_intr_stub(EXCEP_IRQ_LEVEL6, irq_handler); - - IVAR0 = EXCEP_IRQ_LEVEL0; - IVAR1 = EXCEP_IRQ_LEVEL1; - IVAR2 = EXCEP_IRQ_LEVEL2; - IVAR3 = EXCEP_IRQ_LEVEL3; - IVAR4 = EXCEP_IRQ_LEVEL4; - IVAR5 = EXCEP_IRQ_LEVEL5; - IVAR6 = EXCEP_IRQ_LEVEL6; - - mn10300_dcache_flush_inv(); - mn10300_icache_inv(); - - /* disable all interrupts and set to priority 6 (lowest) */ - for (loop = 0; loop < NR_IRQS; loop++) - GxICR(loop) = GxICR_LEVEL_6 | GxICR_DETECT; - - /* clear the timers */ - TM0MD = 0; - TM1MD = 0; - TM2MD = 0; - TM3MD = 0; - TM4MD = 0; - TM5MD = 0; - TM6MD = 0; - TM6MDA = 0; - TM6MDB = 0; - TM7MD = 0; - TM8MD = 0; - TM9MD = 0; - TM10MD = 0; - TM11MD = 0; - - calibrate_clock(); -} - -/* - * determine the memory size and base from the memory controller regs - */ -void __init get_mem_info(unsigned long *mem_base, unsigned long *mem_size) -{ - unsigned long base, size; - - *mem_base = 0; - *mem_size = 0; - - base = SDBASE(0); - if (base & SDBASE_CE) { - size = (base & SDBASE_CBAM) << SDBASE_CBAM_SHIFT; - size = ~size + 1; - base &= SDBASE_CBA; - - printk(KERN_INFO "SDRAM[0]: %luMb @%08lx\n", size >> 20, base); - *mem_size += size; - *mem_base = base; - } - - base = SDBASE(1); - if (base & SDBASE_CE) { - size = (base & SDBASE_CBAM) << SDBASE_CBAM_SHIFT; - size = ~size + 1; - base &= SDBASE_CBA; - - printk(KERN_INFO "SDRAM[1]: %luMb @%08lx\n", size >> 20, base); - *mem_size += size; - if (*mem_base == 0) - *mem_base = base; - } -} diff --git a/arch/mn10300/proc-mn2ws0050/Makefile b/arch/mn10300/proc-mn2ws0050/Makefile deleted file mode 100644 index d4ca13309a853..0000000000000 --- a/arch/mn10300/proc-mn2ws0050/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# -# Makefile for the linux kernel. -# - -obj-y := proc-init.o diff --git a/arch/mn10300/proc-mn2ws0050/include/proc/cache.h b/arch/mn10300/proc-mn2ws0050/include/proc/cache.h deleted file mode 100644 index bcb5df2d892f9..0000000000000 --- a/arch/mn10300/proc-mn2ws0050/include/proc/cache.h +++ /dev/null @@ -1,49 +0,0 @@ -/* Cache specification - * - * Copyright (C) 2005 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * Modified by Matsushita Electric Industrial Co., Ltd. - * Modifications: - * 13-Nov-2006 MEI Add L1_CACHE_SHIFT_MAX definition. - * 29-Jul-2008 MEI Add define for MN10300_HAS_AREAPURGE_REG. - * - * 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_PROC_CACHE_H -#define _ASM_PROC_CACHE_H - -/* - * L1 cache - */ -#define L1_CACHE_NWAYS 4 /* number of ways in caches */ -#define L1_CACHE_NENTRIES 128 /* number of entries in each way */ -#define L1_CACHE_BYTES 32 /* bytes per entry */ -#define L1_CACHE_SHIFT 5 /* shift for bytes per entry */ -#define L1_CACHE_WAYDISP 0x1000 /* distance from one way to the next */ - -#define L1_CACHE_TAG_VALID 0x00000001 /* cache tag valid bit */ -#define L1_CACHE_TAG_DIRTY 0x00000008 /* data cache tag dirty bit */ -#define L1_CACHE_TAG_ENTRY 0x00000fe0 /* cache tag entry address mask */ -#define L1_CACHE_TAG_ADDRESS 0xfffff000 /* cache tag line address mask */ -#define L1_CACHE_TAG_MASK +(L1_CACHE_TAG_ADDRESS|L1_CACHE_TAG_ENTRY) - -/* - * specification of the interval between interrupt checking intervals whilst - * managing the cache with the interrupts disabled - */ -#define MN10300_DCACHE_INV_RANGE_INTR_LOG2_INTERVAL 4 - -/* - * The size of range at which it becomes more economical to just flush the - * whole cache rather than trying to flush the specified range. - */ -#define MN10300_DCACHE_FLUSH_BORDER \ - +(L1_CACHE_NWAYS * L1_CACHE_NENTRIES * L1_CACHE_BYTES) -#define MN10300_DCACHE_FLUSH_INV_BORDER \ - +(L1_CACHE_NWAYS * L1_CACHE_NENTRIES * L1_CACHE_BYTES) - -#endif /* _ASM_PROC_CACHE_H */ diff --git a/arch/mn10300/proc-mn2ws0050/include/proc/clock.h b/arch/mn10300/proc-mn2ws0050/include/proc/clock.h deleted file mode 100644 index fe4c0a4a53a2c..0000000000000 --- a/arch/mn10300/proc-mn2ws0050/include/proc/clock.h +++ /dev/null @@ -1,20 +0,0 @@ -/* clock.h: proc-specific clocks - * - * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * Modified by Matsushita Electric Industrial Co., Ltd. - * Modifications: - * 23-Feb-2007 MEI Delete define for watchdog timer. - * - * 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_PROC_CLOCK_H -#define _ASM_PROC_CLOCK_H - -#include - -#endif /* _ASM_PROC_CLOCK_H */ diff --git a/arch/mn10300/proc-mn2ws0050/include/proc/dmactl-regs.h b/arch/mn10300/proc-mn2ws0050/include/proc/dmactl-regs.h deleted file mode 100644 index 4c4319e241d18..0000000000000 --- a/arch/mn10300/proc-mn2ws0050/include/proc/dmactl-regs.h +++ /dev/null @@ -1,103 +0,0 @@ -/* MN2WS0050 on-board DMA controller registers - * - * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * 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. - */ - -#ifndef _ASM_PROC_DMACTL_REGS_H -#define _ASM_PROC_DMACTL_REGS_H - -#include - -#ifdef __KERNEL__ - -/* DMA registers */ -#define DMxCTR(N) __SYSREG(0xd4005000+(N*0x100), u32) /* control reg */ -#define DMxCTR_BG 0x0000001f /* transfer request source */ -#define DMxCTR_BG_SOFT 0x00000000 /* - software source */ -#define DMxCTR_BG_SC0TX 0x00000002 /* - serial port 0 transmission */ -#define DMxCTR_BG_SC0RX 0x00000003 /* - serial port 0 reception */ -#define DMxCTR_BG_SC1TX 0x00000004 /* - serial port 1 transmission */ -#define DMxCTR_BG_SC1RX 0x00000005 /* - serial port 1 reception */ -#define DMxCTR_BG_SC2TX 0x00000006 /* - serial port 2 transmission */ -#define DMxCTR_BG_SC2RX 0x00000007 /* - serial port 2 reception */ -#define DMxCTR_BG_TM0UFLOW 0x00000008 /* - timer 0 underflow */ -#define DMxCTR_BG_TM1UFLOW 0x00000009 /* - timer 1 underflow */ -#define DMxCTR_BG_TM2UFLOW 0x0000000a /* - timer 2 underflow */ -#define DMxCTR_BG_TM3UFLOW 0x0000000b /* - timer 3 underflow */ -#define DMxCTR_BG_TM6ACMPCAP 0x0000000c /* - timer 6A compare/capture */ -#define DMxCTR_BG_RYBY 0x0000000d /* - NAND Flash RY/BY request source */ -#define DMxCTR_BG_RMC 0x0000000e /* - remote controller output */ -#define DMxCTR_BG_XIRQ12 0x00000011 /* - XIRQ12 pin interrupt source */ -#define DMxCTR_BG_XIRQ13 0x00000012 /* - XIRQ13 pin interrupt source */ -#define DMxCTR_BG_TCK 0x00000014 /* - tick timer underflow */ -#define DMxCTR_BG_SC4TX 0x00000019 /* - serial port4 transmission */ -#define DMxCTR_BG_SC4RX 0x0000001a /* - serial port4 reception */ -#define DMxCTR_BG_SC5TX 0x0000001b /* - serial port5 transmission */ -#define DMxCTR_BG_SC5RX 0x0000001c /* - serial port5 reception */ -#define DMxCTR_BG_SC6TX 0x0000001d /* - serial port6 transmission */ -#define DMxCTR_BG_SC6RX 0x0000001e /* - serial port6 reception */ -#define DMxCTR_BG_TMSUFLOW 0x0000001f /* - timestamp timer underflow */ -#define DMxCTR_SAM 0x00000060 /* DMA transfer src addr mode */ -#define DMxCTR_SAM_INCR 0x00000000 /* - increment */ -#define DMxCTR_SAM_DECR 0x00000020 /* - decrement */ -#define DMxCTR_SAM_FIXED 0x00000040 /* - fixed */ -#define DMxCTR_DAM 0x00000300 /* DMA transfer dest addr mode */ -#define DMxCTR_DAM_INCR 0x00000000 /* - increment */ -#define DMxCTR_DAM_DECR 0x00000100 /* - decrement */ -#define DMxCTR_DAM_FIXED 0x00000200 /* - fixed */ -#define DMxCTR_UT 0x00006000 /* DMA transfer unit */ -#define DMxCTR_UT_1 0x00000000 /* - 1 byte */ -#define DMxCTR_UT_2 0x00002000 /* - 2 byte */ -#define DMxCTR_UT_4 0x00004000 /* - 4 byte */ -#define DMxCTR_UT_16 0x00006000 /* - 16 byte */ -#define DMxCTR_RRE 0x00008000 /* DMA round robin enable */ -#define DMxCTR_TEN 0x00010000 /* DMA channel transfer enable */ -#define DMxCTR_RQM 0x00060000 /* external request input source mode */ -#define DMxCTR_RQM_FALLEDGE 0x00000000 /* - falling edge */ -#define DMxCTR_RQM_RISEEDGE 0x00020000 /* - rising edge */ -#define DMxCTR_RQM_LOLEVEL 0x00040000 /* - low level */ -#define DMxCTR_RQM_HILEVEL 0x00060000 /* - high level */ -#define DMxCTR_RQF 0x01000000 /* DMA transfer request flag */ -#define DMxCTR_PERR 0x40000000 /* DMA transfer parameter error flag */ -#define DMxCTR_XEND 0x80000000 /* DMA transfer end flag */ - -#define DMxSRC(N) __SYSREG(0xd4005004+(N*0x100), u32) /* control reg */ - -#define DMxDST(N) __SYSREG(0xd4005008+(N*0x100), u32) /* source addr reg */ - -#define DMxSIZ(N) __SYSREG(0xd400500c+(N*0x100), u32) /* dest addr reg */ -#define DMxSIZ_CT 0x000fffff /* number of bytes to transfer */ - -#define DMxCYC(N) __SYSREG(0xd4005010+(N*0x100), u32) /* intermittent size reg */ -#define DMxCYC_CYC 0x000000ff /* number of interrmittent transfers -1 */ - -#define DM0IRQ 16 /* DMA channel 0 complete IRQ */ -#define DM1IRQ 17 /* DMA channel 1 complete IRQ */ -#define DM2IRQ 18 /* DMA channel 2 complete IRQ */ -#define DM3IRQ 19 /* DMA channel 3 complete IRQ */ - -#define DM0ICR GxICR(DM0IRQ) /* DMA channel 0 complete intr ctrl reg */ -#define DM1ICR GxICR(DM0IR1) /* DMA channel 1 complete intr ctrl reg */ -#define DM2ICR GxICR(DM0IR2) /* DMA channel 2 complete intr ctrl reg */ -#define DM3ICR GxICR(DM0IR3) /* DMA channel 3 complete intr ctrl reg */ - -#ifndef __ASSEMBLY__ - -struct mn10300_dmactl_regs { - u32 ctr; - const void *src; - void *dst; - u32 siz; - u32 cyc; -} __attribute__((aligned(0x100))); - -#endif /* __ASSEMBLY__ */ - -#endif /* __KERNEL__ */ - -#endif /* _ASM_PROC_DMACTL_REGS_H */ diff --git a/arch/mn10300/proc-mn2ws0050/include/proc/intctl-regs.h b/arch/mn10300/proc-mn2ws0050/include/proc/intctl-regs.h deleted file mode 100644 index 4d4084ea66940..0000000000000 --- a/arch/mn10300/proc-mn2ws0050/include/proc/intctl-regs.h +++ /dev/null @@ -1,30 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_PROC_INTCTL_REGS_H -#define _ASM_PROC_INTCTL_REGS_H - -#ifndef _ASM_INTCTL_REGS_H -# error "please don't include this file directly" -#endif - -/* intr acceptance group reg */ -#define IAGR __SYSREG(0xd4000100, u16) - -/* group number register */ -#define IAGR_GN 0x003fc - -#define __GET_XIRQ_TRIGGER(X, Z) (((Z) >> ((X) * 2)) & 3) - -#define __SET_XIRQ_TRIGGER(X, Y, Z) \ -({ \ - typeof(Z) x = (Z); \ - x &= ~(3 << ((X) * 2)); \ - x |= ((Y) & 3) << ((X) * 2); \ - (Z) = x; \ -}) - -/* external pin intr spec reg */ -#define EXTMD0 __SYSREG(0xd4000200, u32) -#define GET_XIRQ_TRIGGER(X) __GET_XIRQ_TRIGGER(X, EXTMD0) -#define SET_XIRQ_TRIGGER(X, Y) __SET_XIRQ_TRIGGER(X, Y, EXTMD0) - -#endif /* _ASM_PROC_INTCTL_REGS_H */ diff --git a/arch/mn10300/proc-mn2ws0050/include/proc/irq.h b/arch/mn10300/proc-mn2ws0050/include/proc/irq.h deleted file mode 100644 index 37777a85ab6f1..0000000000000 --- a/arch/mn10300/proc-mn2ws0050/include/proc/irq.h +++ /dev/null @@ -1,49 +0,0 @@ -/* MN2WS0050 on-board interrupt controller registers - * - * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * Modified by Matsushita Electric Industrial Co., Ltd. - * Modifications: - * 13-Nov-2006 MEI Define extended IRQ number for SMP support. - * - * 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 _PROC_IRQ_H -#define _PROC_IRQ_H - -#ifdef __KERNEL__ - -#define GxICR_NUM_IRQS 163 -#ifdef CONFIG_SMP -#define GxICR_NUM_EXT_IRQS 197 -#endif /* CONFIG_SMP */ - -#define GxICR_NUM_XIRQS 16 - -#define XIRQ0 34 -#define XIRQ1 35 -#define XIRQ2 36 -#define XIRQ3 37 -#define XIRQ4 38 -#define XIRQ5 39 -#define XIRQ6 40 -#define XIRQ7 41 -#define XIRQ8 42 -#define XIRQ9 43 -#define XIRQ10 44 -#define XIRQ11 45 -#define XIRQ12 46 -#define XIRQ13 47 -#define XIRQ14 48 -#define XIRQ15 49 - -#define XIRQ2IRQ(num) (XIRQ0 + num) - -#endif /* __KERNEL__ */ - -#endif /* _PROC_IRQ_H */ diff --git a/arch/mn10300/proc-mn2ws0050/include/proc/nand-regs.h b/arch/mn10300/proc-mn2ws0050/include/proc/nand-regs.h deleted file mode 100644 index 84448f3828b3c..0000000000000 --- a/arch/mn10300/proc-mn2ws0050/include/proc/nand-regs.h +++ /dev/null @@ -1,120 +0,0 @@ -/* NAND flash interface register definitions - * - * Copyright (C) 2008-2009 Panasonic Corporation - * All Rights Reserved. - * - * 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. - * - * 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. - */ - -#ifndef _PROC_NAND_REGS_H_ -#define _PROC_NAND_REGS_H_ - -/* command register */ -#define FCOMMAND_0 __SYSREG(0xd8f00000, u8) /* fcommand[24:31] */ -#define FCOMMAND_1 __SYSREG(0xd8f00001, u8) /* fcommand[16:23] */ -#define FCOMMAND_2 __SYSREG(0xd8f00002, u8) /* fcommand[8:15] */ -#define FCOMMAND_3 __SYSREG(0xd8f00003, u8) /* fcommand[0:7] */ - -/* for dma 16 byte trans, use FCOMMAND2 register */ -#define FCOMMAND2_0 __SYSREG(0xd8f00110, u8) /* fcommand2[24:31] */ -#define FCOMMAND2_1 __SYSREG(0xd8f00111, u8) /* fcommand2[16:23] */ -#define FCOMMAND2_2 __SYSREG(0xd8f00112, u8) /* fcommand2[8:15] */ -#define FCOMMAND2_3 __SYSREG(0xd8f00113, u8) /* fcommand2[0:7] */ - -#define FCOMMAND_FIEN 0x80 /* nand flash I/F enable */ -#define FCOMMAND_BW_8BIT 0x00 /* 8bit bus width */ -#define FCOMMAND_BW_16BIT 0x40 /* 16bit bus width */ -#define FCOMMAND_BLOCKSZ_SMALL 0x00 /* small block */ -#define FCOMMAND_BLOCKSZ_LARGE 0x20 /* large block */ -#define FCOMMAND_DMASTART 0x10 /* dma start */ -#define FCOMMAND_RYBY 0x08 /* ready/busy flag */ -#define FCOMMAND_RYBYINTMSK 0x04 /* mask ready/busy interrupt */ -#define FCOMMAND_XFWP 0x02 /* write protect enable */ -#define FCOMMAND_XFCE 0x01 /* flash device disable */ -#define FCOMMAND_SEQKILL 0x10 /* stop seq-read */ -#define FCOMMAND_ANUM 0x07 /* address cycle */ -#define FCOMMAND_ANUM_NONE 0x00 /* address cycle none */ -#define FCOMMAND_ANUM_1CYC 0x01 /* address cycle 1cycle */ -#define FCOMMAND_ANUM_2CYC 0x02 /* address cycle 2cycle */ -#define FCOMMAND_ANUM_3CYC 0x03 /* address cycle 3cycle */ -#define FCOMMAND_ANUM_4CYC 0x04 /* address cycle 4cycle */ -#define FCOMMAND_ANUM_5CYC 0x05 /* address cycle 5cycle */ -#define FCOMMAND_FCMD_READ0 0x00 /* read1 command */ -#define FCOMMAND_FCMD_SEQIN 0x80 /* page program 1st command */ -#define FCOMMAND_FCMD_PAGEPROG 0x10 /* page program 2nd command */ -#define FCOMMAND_FCMD_RESET 0xff /* reset command */ -#define FCOMMAND_FCMD_ERASE1 0x60 /* erase 1st command */ -#define FCOMMAND_FCMD_ERASE2 0xd0 /* erase 2nd command */ -#define FCOMMAND_FCMD_STATUS 0x70 /* read status command */ -#define FCOMMAND_FCMD_READID 0x90 /* read id command */ -#define FCOMMAND_FCMD_READOOB 0x50 /* read3 command */ -/* address register */ -#define FADD __SYSREG(0xd8f00004, u32) -/* address register 2 */ -#define FADD2 __SYSREG(0xd8f00008, u32) -/* error judgement register */ -#define FJUDGE __SYSREG(0xd8f0000c, u32) -#define FJUDGE_NOERR 0x0 /* no error */ -#define FJUDGE_1BITERR 0x1 /* 1bit error in data area */ -#define FJUDGE_PARITYERR 0x2 /* parity error */ -#define FJUDGE_UNCORRECTABLE 0x3 /* uncorrectable error */ -#define FJUDGE_ERRJDG_MSK 0x3 /* mask of judgement result */ -/* 1st ECC store register */ -#define FECC11 __SYSREG(0xd8f00010, u32) -/* 2nd ECC store register */ -#define FECC12 __SYSREG(0xd8f00014, u32) -/* 3rd ECC store register */ -#define FECC21 __SYSREG(0xd8f00018, u32) -/* 4th ECC store register */ -#define FECC22 __SYSREG(0xd8f0001c, u32) -/* 5th ECC store register */ -#define FECC31 __SYSREG(0xd8f00020, u32) -/* 6th ECC store register */ -#define FECC32 __SYSREG(0xd8f00024, u32) -/* 7th ECC store register */ -#define FECC41 __SYSREG(0xd8f00028, u32) -/* 8th ECC store register */ -#define FECC42 __SYSREG(0xd8f0002c, u32) -/* data register */ -#define FDATA __SYSREG(0xd8f00030, u32) -/* access pulse register */ -#define FPWS __SYSREG(0xd8f00100, u32) -#define FPWS_PWS1W_2CLK 0x00000000 /* write pulse width 1clock */ -#define FPWS_PWS1W_3CLK 0x01000000 /* write pulse width 2clock */ -#define FPWS_PWS1W_4CLK 0x02000000 /* write pulse width 4clock */ -#define FPWS_PWS1W_5CLK 0x03000000 /* write pulse width 5clock */ -#define FPWS_PWS1W_6CLK 0x04000000 /* write pulse width 6clock */ -#define FPWS_PWS1W_7CLK 0x05000000 /* write pulse width 7clock */ -#define FPWS_PWS1W_8CLK 0x06000000 /* write pulse width 8clock */ -#define FPWS_PWS1R_3CLK 0x00010000 /* read pulse width 3clock */ -#define FPWS_PWS1R_4CLK 0x00020000 /* read pulse width 4clock */ -#define FPWS_PWS1R_5CLK 0x00030000 /* read pulse width 5clock */ -#define FPWS_PWS1R_6CLK 0x00040000 /* read pulse width 6clock */ -#define FPWS_PWS1R_7CLK 0x00050000 /* read pulse width 7clock */ -#define FPWS_PWS1R_8CLK 0x00060000 /* read pulse width 8clock */ -#define FPWS_PWS2W_2CLK 0x00000100 /* write pulse interval 2clock */ -#define FPWS_PWS2W_3CLK 0x00000200 /* write pulse interval 3clock */ -#define FPWS_PWS2W_4CLK 0x00000300 /* write pulse interval 4clock */ -#define FPWS_PWS2W_5CLK 0x00000400 /* write pulse interval 5clock */ -#define FPWS_PWS2W_6CLK 0x00000500 /* write pulse interval 6clock */ -#define FPWS_PWS2R_2CLK 0x00000001 /* read pulse interval 2clock */ -#define FPWS_PWS2R_3CLK 0x00000002 /* read pulse interval 3clock */ -#define FPWS_PWS2R_4CLK 0x00000003 /* read pulse interval 4clock */ -#define FPWS_PWS2R_5CLK 0x00000004 /* read pulse interval 5clock */ -#define FPWS_PWS2R_6CLK 0x00000005 /* read pulse interval 6clock */ -/* command register 2 */ -#define FCOMMAND2 __SYSREG(0xd8f00110, u32) -/* transfer frequency register */ -#define FNUM __SYSREG(0xd8f00114, u32) -#define FSDATA_ADDR 0xd8f00400 -/* active data register */ -#define FSDATA __SYSREG(FSDATA_ADDR, u32) - -#endif /* _PROC_NAND_REGS_H_ */ diff --git a/arch/mn10300/proc-mn2ws0050/include/proc/proc.h b/arch/mn10300/proc-mn2ws0050/include/proc/proc.h deleted file mode 100644 index 90d5cadd05bdb..0000000000000 --- a/arch/mn10300/proc-mn2ws0050/include/proc/proc.h +++ /dev/null @@ -1,18 +0,0 @@ -/* proc.h: MN2WS0050 processor description - * - * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#ifndef _ASM_PROC_PROC_H -#define _ASM_PROC_PROC_H - -#define PROCESSOR_VENDOR_NAME "Panasonic" -#define PROCESSOR_MODEL_NAME "mn2ws0050" - -#endif /* _ASM_PROC_PROC_H */ diff --git a/arch/mn10300/proc-mn2ws0050/include/proc/smp-regs.h b/arch/mn10300/proc-mn2ws0050/include/proc/smp-regs.h deleted file mode 100644 index 22f277fbb4de3..0000000000000 --- a/arch/mn10300/proc-mn2ws0050/include/proc/smp-regs.h +++ /dev/null @@ -1,51 +0,0 @@ -/* MN10300/AM33v2 Microcontroller SMP registers - * - * Copyright (C) 2006 Matsushita Electric Industrial Co., Ltd. - * All Rights Reserved. - * Created: - * 13-Nov-2006 MEI Add extended cache and atomic operation register - * for SMP support. - * 23-Feb-2007 MEI Add define for gdbstub SMP. - * - * 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_PROC_SMP_REGS_H -#define _ASM_PROC_SMP_REGS_H - -#ifdef __KERNEL__ - -#ifndef __ASSEMBLY__ -#include -#endif -#include - -/* - * Reference to the interrupt controllers of other CPUs - */ -#define CROSS_ICR_CPU_SHIFT 16 - -#define CROSS_GxICR(X, CPU) __SYSREG(0xc4000000 + (X) * 4 + \ - ((X) >= 64 && (X) < 192) * 0xf00 + ((CPU) << CROSS_ICR_CPU_SHIFT), u16) -#define CROSS_GxICR_u8(X, CPU) __SYSREG(0xc4000000 + (X) * 4 + \ - (((X) >= 64) && ((X) < 192)) * 0xf00 + ((CPU) << CROSS_ICR_CPU_SHIFT), u8) - -/* CPU ID register */ -#define CPUID __SYSREGC(0xc0000054, u32) -#define CPUID_MASK 0x00000007 /* CPU ID mask */ - -/* extended cache control register */ -#define ECHCTR __SYSREG(0xc0000c20, u32) -#define ECHCTR_IBCM 0x00000001 /* instruction cache broad cast mask */ -#define ECHCTR_DBCM 0x00000002 /* data cache broad cast mask */ -#define ECHCTR_ISPM 0x00000004 /* instruction cache snoop mask */ -#define ECHCTR_DSPM 0x00000008 /* data cache snoop mask */ - -#define NMIAGR __SYSREG(0xd400013c, u16) -#define NMIAGR_GN 0x03fc - -#endif /* __KERNEL__ */ -#endif /* _ASM_PROC_SMP_REGS_H */ diff --git a/arch/mn10300/proc-mn2ws0050/proc-init.c b/arch/mn10300/proc-mn2ws0050/proc-init.c deleted file mode 100644 index 25b1b453c515d..0000000000000 --- a/arch/mn10300/proc-mn2ws0050/proc-init.c +++ /dev/null @@ -1,134 +0,0 @@ -/* MN2WS0050 processor initialisation - * - * Copyright (C) 2005 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define MEMCONF __SYSREGC(0xdf800400, u32) - -/* - * initialise the on-silicon processor peripherals - */ -asmlinkage void __init processor_init(void) -{ - int loop; - - /* set up the exception table first */ - for (loop = 0x000; loop < 0x400; loop += 8) - __set_intr_stub(loop, __common_exception); - - __set_intr_stub(EXCEP_ITLBMISS, itlb_miss); - __set_intr_stub(EXCEP_DTLBMISS, dtlb_miss); - __set_intr_stub(EXCEP_IAERROR, itlb_aerror); - __set_intr_stub(EXCEP_DAERROR, dtlb_aerror); - __set_intr_stub(EXCEP_BUSERROR, raw_bus_error); - __set_intr_stub(EXCEP_DOUBLE_FAULT, double_fault); - __set_intr_stub(EXCEP_FPU_DISABLED, fpu_disabled); - __set_intr_stub(EXCEP_SYSCALL0, system_call); - - __set_intr_stub(EXCEP_NMI, nmi_handler); - __set_intr_stub(EXCEP_WDT, nmi_handler); - __set_intr_stub(EXCEP_IRQ_LEVEL0, irq_handler); - __set_intr_stub(EXCEP_IRQ_LEVEL1, irq_handler); - __set_intr_stub(EXCEP_IRQ_LEVEL2, irq_handler); - __set_intr_stub(EXCEP_IRQ_LEVEL3, irq_handler); - __set_intr_stub(EXCEP_IRQ_LEVEL4, irq_handler); - __set_intr_stub(EXCEP_IRQ_LEVEL5, irq_handler); - __set_intr_stub(EXCEP_IRQ_LEVEL6, irq_handler); - - IVAR0 = EXCEP_IRQ_LEVEL0; - IVAR1 = EXCEP_IRQ_LEVEL1; - IVAR2 = EXCEP_IRQ_LEVEL2; - IVAR3 = EXCEP_IRQ_LEVEL3; - IVAR4 = EXCEP_IRQ_LEVEL4; - IVAR5 = EXCEP_IRQ_LEVEL5; - IVAR6 = EXCEP_IRQ_LEVEL6; - -#ifndef CONFIG_MN10300_HAS_CACHE_SNOOP - mn10300_dcache_flush_inv(); - mn10300_icache_inv(); -#endif - - /* disable all interrupts and set to priority 6 (lowest) */ -#ifdef CONFIG_SMP - for (loop = 0; loop < GxICR_NUM_IRQS; loop++) - GxICR(loop) = GxICR_LEVEL_6 | GxICR_DETECT; -#else /* !CONFIG_SMP */ - for (loop = 0; loop < NR_IRQS; loop++) - GxICR(loop) = GxICR_LEVEL_6 | GxICR_DETECT; -#endif /* !CONFIG_SMP */ - - /* clear the timers */ - TM0MD = 0; - TM1MD = 0; - TM2MD = 0; - TM3MD = 0; - TM4MD = 0; - TM5MD = 0; - TM6MD = 0; - TM6MDA = 0; - TM6MDB = 0; - TM7MD = 0; - TM8MD = 0; - TM9MD = 0; - TM10MD = 0; - TM11MD = 0; - TM12MD = 0; - TM13MD = 0; - TM14MD = 0; - TM15MD = 0; - - calibrate_clock(); -} - -/* - * determine the memory size and base from the memory controller regs - */ -void __init get_mem_info(unsigned long *mem_base, unsigned long *mem_size) -{ - unsigned long memconf = MEMCONF; - unsigned long size = 0; /* order: MByte */ - - *mem_base = 0x90000000; /* fixed address */ - - switch (memconf & 0x00000003) { - case 0x01: - size = 256 / 8; /* 256 Mbit per chip */ - break; - case 0x02: - size = 512 / 8; /* 512 Mbit per chip */ - break; - case 0x03: - size = 1024 / 8; /* 1 Gbit per chip */ - break; - default: - panic("Invalid SDRAM size"); - break; - } - - printk(KERN_INFO "DDR2-SDRAM: %luMB x 2 @%08lx\n", size, *mem_base); - - *mem_size = (size * 2) << 20; -} diff --git a/arch/mn10300/unit-asb2303/Makefile b/arch/mn10300/unit-asb2303/Makefile deleted file mode 100644 index 38a5bb43b0bb7..0000000000000 --- a/arch/mn10300/unit-asb2303/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -############################################################################### -# -# Makefile for the ASB2303 board -# -############################################################################### -obj-y := unit-init.o smc91111.o flash.o leds.o diff --git a/arch/mn10300/unit-asb2303/flash.c b/arch/mn10300/unit-asb2303/flash.c deleted file mode 100644 index b03d8738d67cd..0000000000000 --- a/arch/mn10300/unit-asb2303/flash.c +++ /dev/null @@ -1,99 +0,0 @@ -/* Handle mapping of the flash on the ASB2303 board - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include -#include -#include - -#define ASB2303_PROM_ADDR 0xA0000000 /* Boot PROM */ -#define ASB2303_PROM_SIZE (2 * 1024 * 1024) -#define ASB2303_FLASH_ADDR 0xA4000000 /* System Flash */ -#define ASB2303_FLASH_SIZE (32 * 1024 * 1024) -#define ASB2303_CONFIG_ADDR 0xA6000000 /* System Config EEPROM */ -#define ASB2303_CONFIG_SIZE (8 * 1024) - -/* - * default MTD partition table for both main flash devices, expected to be - * overridden by RedBoot - */ -static struct mtd_partition asb2303_partitions[] = { - { - .name = "Bootloader", - .size = 0x00040000, - .offset = 0, - .mask_flags = MTD_CAP_ROM /* force read-only */ - }, { - .name = "Kernel", - .size = 0x00400000, - .offset = 0x00040000, - }, { - .name = "Filesystem", - .size = MTDPART_SIZ_FULL, - .offset = 0x00440000 - } -}; - -/* - * the ASB2303 Boot PROM definition - */ -static struct physmap_flash_data asb2303_bootprom_data = { - .width = 2, - .nr_parts = 1, - .parts = asb2303_partitions, -}; - -static struct resource asb2303_bootprom_resource = { - .start = ASB2303_PROM_ADDR, - .end = ASB2303_PROM_ADDR + ASB2303_PROM_SIZE, - .flags = IORESOURCE_MEM, -}; - -static struct platform_device asb2303_bootprom = { - .name = "physmap-flash", - .id = 0, - .dev.platform_data = &asb2303_bootprom_data, - .num_resources = 1, - .resource = &asb2303_bootprom_resource, -}; - -/* - * the ASB2303 System Flash definition - */ -static struct physmap_flash_data asb2303_sysflash_data = { - .width = 4, - .nr_parts = 1, - .parts = asb2303_partitions, -}; - -static struct resource asb2303_sysflash_resource = { - .start = ASB2303_FLASH_ADDR, - .end = ASB2303_FLASH_ADDR + ASB2303_FLASH_SIZE, - .flags = IORESOURCE_MEM, -}; - -static struct platform_device asb2303_sysflash = { - .name = "physmap-flash", - .id = 1, - .dev.platform_data = &asb2303_sysflash_data, - .num_resources = 1, - .resource = &asb2303_sysflash_resource, -}; - -/* - * register the ASB2303 flashes - */ -static int __init asb2303_mtd_init(void) -{ - platform_device_register(&asb2303_bootprom); - platform_device_register(&asb2303_sysflash); - return 0; -} -device_initcall(asb2303_mtd_init); diff --git a/arch/mn10300/unit-asb2303/include/unit/clock.h b/arch/mn10300/unit-asb2303/include/unit/clock.h deleted file mode 100644 index 0316907a012ef..0000000000000 --- a/arch/mn10300/unit-asb2303/include/unit/clock.h +++ /dev/null @@ -1,24 +0,0 @@ -/* ASB2303-specific clocks - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - -#ifndef _ASM_UNIT_CLOCK_H -#define _ASM_UNIT_CLOCK_H - -#ifndef __ASSEMBLY__ - -#define MN10300_IOCLK 33333333UL -/* #define MN10300_IOBCLK 66666666UL */ - -#endif /* !__ASSEMBLY__ */ - -#define MN10300_WDCLK MN10300_IOCLK - -#endif /* _ASM_UNIT_CLOCK_H */ diff --git a/arch/mn10300/unit-asb2303/include/unit/leds.h b/arch/mn10300/unit-asb2303/include/unit/leds.h deleted file mode 100644 index 3a7543ea7b5cd..0000000000000 --- a/arch/mn10300/unit-asb2303/include/unit/leds.h +++ /dev/null @@ -1,43 +0,0 @@ -/* ASB2303-specific LEDs - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - -#ifndef _ASM_UNIT_LEDS_H -#define _ASM_UNIT_LEDS_H - -#include -#include -#include - -#define ASB2303_GPIO0DEF __SYSREG(0xDB000000, u32) -#define ASB2303_7SEGLEDS __SYSREG(0xDB000008, u32) - -/* - * use the 7-segment LEDs to indicate states - */ - -/* flip the 7-segment LEDs between "G" and "-" */ -#define mn10300_set_gdbleds(ONOFF) \ -do { \ - ASB2303_7SEGLEDS = (ONOFF) ? 0x85 : 0x7f; \ -} while (0) - -/* indicate double-fault by displaying "d" on the LEDs */ -#define mn10300_set_dbfleds \ - mov 0x43,d0 ; \ - movbu d0,(ASB2303_7SEGLEDS) - -#ifndef __ASSEMBLY__ -extern void peripheral_leds_display_exception(enum exception_code code); -extern void peripheral_leds_led_chase(void); -extern void debug_to_serial(const char *p, int n); -#endif /* __ASSEMBLY__ */ - -#endif /* _ASM_UNIT_LEDS_H */ diff --git a/arch/mn10300/unit-asb2303/include/unit/serial.h b/arch/mn10300/unit-asb2303/include/unit/serial.h deleted file mode 100644 index 991e356bac5f9..0000000000000 --- a/arch/mn10300/unit-asb2303/include/unit/serial.h +++ /dev/null @@ -1,141 +0,0 @@ -/* ASB2303-specific 8250 serial ports - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - -#ifndef _ASM_UNIT_SERIAL_H -#define _ASM_UNIT_SERIAL_H - -#include -#include -#include - -#define SERIAL_PORT0_BASE_ADDRESS 0xA6FB0000 -#define SERIAL_PORT1_BASE_ADDRESS 0xA6FC0000 - -#define SERIAL_IRQ XIRQ0 /* Dual serial (PC16552) (Hi) */ - -/* - * The ASB2303 has an 18.432 MHz clock the UART - */ -#define BASE_BAUD (18432000 / 16) - -/* - * dispose of the /dev/ttyS0 and /dev/ttyS1 serial ports - */ -#ifndef CONFIG_GDBSTUB_ON_TTYSx - -#define SERIAL_PORT_DFNS \ - { \ - .baud_base = BASE_BAUD, \ - .irq = SERIAL_IRQ, \ - .flags = STD_COM_FLAGS, \ - .iomem_base = (u8 *) SERIAL_PORT0_BASE_ADDRESS, \ - .iomem_reg_shift = 2, \ - .io_type = SERIAL_IO_MEM, \ - }, \ - { \ - .baud_base = BASE_BAUD, \ - .irq = SERIAL_IRQ, \ - .flags = STD_COM_FLAGS, \ - .iomem_base = (u8 *) SERIAL_PORT1_BASE_ADDRESS, \ - .iomem_reg_shift = 2, \ - .io_type = SERIAL_IO_MEM, \ - }, - -#ifndef __ASSEMBLY__ - -static inline void __debug_to_serial(const char *p, int n) -{ -} - -#endif /* !__ASSEMBLY__ */ - -#else /* CONFIG_GDBSTUB_ON_TTYSx */ - -#define SERIAL_PORT_DFNS /* both stolen by gdb-stub because they share an IRQ */ - -#if defined(CONFIG_GDBSTUB_ON_TTYS0) -#define GDBPORT_SERIAL_RX __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_RX * 4, u8) -#define GDBPORT_SERIAL_TX __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_TX * 4, u8) -#define GDBPORT_SERIAL_DLL __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_DLL * 4, u8) -#define GDBPORT_SERIAL_DLM __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_DLM * 4, u8) -#define GDBPORT_SERIAL_IER __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_IER * 4, u8) -#define GDBPORT_SERIAL_IIR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_IIR * 4, u8) -#define GDBPORT_SERIAL_FCR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_FCR * 4, u8) -#define GDBPORT_SERIAL_LCR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_LCR * 4, u8) -#define GDBPORT_SERIAL_MCR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_MCR * 4, u8) -#define GDBPORT_SERIAL_LSR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_LSR * 4, u8) -#define GDBPORT_SERIAL_MSR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_MSR * 4, u8) -#define GDBPORT_SERIAL_SCR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_SCR * 4, u8) -#define GDBPORT_SERIAL_IRQ SERIAL_IRQ - -#elif defined(CONFIG_GDBSTUB_ON_TTYS1) -#define GDBPORT_SERIAL_RX __SYSREG(SERIAL_PORT1_BASE_ADDRESS + UART_RX * 4, u8) -#define GDBPORT_SERIAL_TX __SYSREG(SERIAL_PORT1_BASE_ADDRESS + UART_TX * 4, u8) -#define GDBPORT_SERIAL_DLL __SYSREG(SERIAL_PORT1_BASE_ADDRESS + UART_DLL * 4, u8) -#define GDBPORT_SERIAL_DLM __SYSREG(SERIAL_PORT1_BASE_ADDRESS + UART_DLM * 4, u8) -#define GDBPORT_SERIAL_IER __SYSREG(SERIAL_PORT1_BASE_ADDRESS + UART_IER * 4, u8) -#define GDBPORT_SERIAL_IIR __SYSREG(SERIAL_PORT1_BASE_ADDRESS + UART_IIR * 4, u8) -#define GDBPORT_SERIAL_FCR __SYSREG(SERIAL_PORT1_BASE_ADDRESS + UART_FCR * 4, u8) -#define GDBPORT_SERIAL_LCR __SYSREG(SERIAL_PORT1_BASE_ADDRESS + UART_LCR * 4, u8) -#define GDBPORT_SERIAL_MCR __SYSREG(SERIAL_PORT1_BASE_ADDRESS + UART_MCR * 4, u8) -#define GDBPORT_SERIAL_LSR __SYSREG(SERIAL_PORT1_BASE_ADDRESS + UART_LSR * 4, u8) -#define GDBPORT_SERIAL_MSR __SYSREG(SERIAL_PORT1_BASE_ADDRESS + UART_MSR * 4, u8) -#define GDBPORT_SERIAL_SCR __SYSREG(SERIAL_PORT1_BASE_ADDRESS + UART_SCR * 4, u8) -#define GDBPORT_SERIAL_IRQ SERIAL_IRQ -#endif - -#ifndef __ASSEMBLY__ - -#define LSR_WAIT_FOR(STATE) \ -do { \ - while (!(GDBPORT_SERIAL_LSR & UART_LSR_##STATE)) {} \ -} while (0) -#define FLOWCTL_WAIT_FOR(LINE) \ -do { \ - while (!(GDBPORT_SERIAL_MSR & UART_MSR_##LINE)) {} \ -} while (0) -#define FLOWCTL_CLEAR(LINE) \ -do { \ - GDBPORT_SERIAL_MCR &= ~UART_MCR_##LINE; \ -} while (0) -#define FLOWCTL_SET(LINE) \ -do { \ - GDBPORT_SERIAL_MCR |= UART_MCR_##LINE; \ -} while (0) -#define FLOWCTL_QUERY(LINE) ({ GDBPORT_SERIAL_MSR & UART_MSR_##LINE; }) - -static inline void __debug_to_serial(const char *p, int n) -{ - char ch; - - FLOWCTL_SET(DTR); - - for (; n > 0; n--) { - LSR_WAIT_FOR(THRE); - FLOWCTL_WAIT_FOR(CTS); - - ch = *p++; - if (ch == 0x0a) { - GDBPORT_SERIAL_TX = 0x0d; - LSR_WAIT_FOR(THRE); - FLOWCTL_WAIT_FOR(CTS); - } - GDBPORT_SERIAL_TX = ch; - } - - FLOWCTL_CLEAR(DTR); -} - -#endif /* !__ASSEMBLY__ */ - -#endif /* CONFIG_GDBSTUB_ON_TTYSx */ - -#endif /* _ASM_UNIT_SERIAL_H */ diff --git a/arch/mn10300/unit-asb2303/include/unit/smc91111.h b/arch/mn10300/unit-asb2303/include/unit/smc91111.h deleted file mode 100644 index dd4e2946438e4..0000000000000 --- a/arch/mn10300/unit-asb2303/include/unit/smc91111.h +++ /dev/null @@ -1,50 +0,0 @@ -/* Support for the SMC91C111 NIC on an ASB2303 - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_UNIT_SMC91111_H -#define _ASM_UNIT_SMC91111_H - -#include - -#define SMC91111_BASE 0xAA000300UL -#define SMC91111_BASE_END 0xAA000400UL -#define SMC91111_IRQ XIRQ3 - -#define SMC_CAN_USE_8BIT 0 -#define SMC_CAN_USE_16BIT 1 -#define SMC_CAN_USE_32BIT 0 -#define SMC_NOWAIT 1 -#define SMC_IRQ_FLAGS (0) - -#if SMC_CAN_USE_8BIT -#define SMC_inb(a, r) inb((unsigned long) ((a) + (r))) -#define SMC_outb(v, a, r) outb(v, (unsigned long) ((a) + (r))) -#endif - -#if SMC_CAN_USE_16BIT -#define SMC_inw(a, r) inw((unsigned long) ((a) + (r))) -#define SMC_outw(lp, v, a, r) outw(v, (unsigned long) ((a) + (r))) -#define SMC_insw(a, r, p, l) insw((unsigned long) ((a) + (r)), (p), (l)) -#define SMC_outsw(a, r, p, l) outsw((unsigned long) ((a) + (r)), (p), (l)) -#endif - -#if SMC_CAN_USE_32BIT -#define SMC_inl(a, r) inl((unsigned long) ((a) + (r))) -#define SMC_outl(v, a, r) outl(v, (unsigned long) ((a) + (r))) -#define SMC_insl(a, r, p, l) insl((unsigned long) ((a) + (r)), (p), (l)) -#define SMC_outsl(a, r, p, l) outsl((unsigned long) ((a) + (r)), (p), (l)) -#endif - -#define RPC_LSA_DEFAULT RPC_LED_100_10 -#define RPC_LSB_DEFAULT RPC_LED_TX_RX - -#define set_irq_type(irq, type) - -#endif /* _ASM_UNIT_SMC91111_H */ diff --git a/arch/mn10300/unit-asb2303/include/unit/timex.h b/arch/mn10300/unit-asb2303/include/unit/timex.h deleted file mode 100644 index c37f9832cf17d..0000000000000 --- a/arch/mn10300/unit-asb2303/include/unit/timex.h +++ /dev/null @@ -1,146 +0,0 @@ -/* ASB2303-specific timer specifications - * - * Copyright (C) 2007, 2010 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_UNIT_TIMEX_H -#define _ASM_UNIT_TIMEX_H - -#include -#include -#include - -/* - * jiffies counter specifications - */ - -#define TMJCBR_MAX 0xffff -#define TMJCIRQ TM1IRQ -#define TMJCICR TM1ICR - -#ifndef __ASSEMBLY__ - -#define MN10300_SRC_IOCLK MN10300_IOCLK - -#ifndef HZ -# error HZ undeclared. -#endif /* !HZ */ -/* use as little prescaling as possible to avoid losing accuracy */ -#if (MN10300_SRC_IOCLK + HZ / 2) / HZ - 1 <= TMJCBR_MAX -# define IOCLK_PRESCALE 1 -# define JC_TIMER_CLKSRC TM0MD_SRC_IOCLK -# define TSC_TIMER_CLKSRC TM4MD_SRC_IOCLK -#elif (MN10300_SRC_IOCLK / 8 + HZ / 2) / HZ - 1 <= TMJCBR_MAX -# define IOCLK_PRESCALE 8 -# define JC_TIMER_CLKSRC TM0MD_SRC_IOCLK_8 -# define TSC_TIMER_CLKSRC TM4MD_SRC_IOCLK_8 -#elif (MN10300_SRC_IOCLK / 32 + HZ / 2) / HZ - 1 <= TMJCBR_MAX -# define IOCLK_PRESCALE 32 -# define JC_TIMER_CLKSRC TM0MD_SRC_IOCLK_32 -# define TSC_TIMER_CLKSRC TM4MD_SRC_IOCLK_32 -#else -# error You lose. -#endif - -#define MN10300_JCCLK (MN10300_SRC_IOCLK / IOCLK_PRESCALE) -#define MN10300_TSCCLK (MN10300_SRC_IOCLK / IOCLK_PRESCALE) - -#define MN10300_JC_PER_HZ ((MN10300_JCCLK + HZ / 2) / HZ) -#define MN10300_TSC_PER_HZ ((MN10300_TSCCLK + HZ / 2) / HZ) - -static inline void stop_jiffies_counter(void) -{ - u16 tmp; - TM01MD = JC_TIMER_CLKSRC | TM1MD_SRC_TM0CASCADE << 8; - tmp = TM01MD; -} - -static inline void reload_jiffies_counter(u32 cnt) -{ - u32 tmp; - - TM01BR = cnt; - tmp = TM01BR; - - TM01MD = JC_TIMER_CLKSRC | \ - TM1MD_SRC_TM0CASCADE << 8 | \ - TM0MD_INIT_COUNTER | \ - TM1MD_INIT_COUNTER << 8; - - - TM01MD = JC_TIMER_CLKSRC | \ - TM1MD_SRC_TM0CASCADE << 8 | \ - TM0MD_COUNT_ENABLE | \ - TM1MD_COUNT_ENABLE << 8; - - tmp = TM01MD; -} - -#endif /* !__ASSEMBLY__ */ - - -/* - * timestamp counter specifications - */ - -#define TMTSCBR_MAX 0xffffffff -#define TMTSCBC TM45BC - -#ifndef __ASSEMBLY__ - -static inline void startup_timestamp_counter(void) -{ - u32 t32; - - /* set up timer 4 & 5 cascaded as a 32-bit counter to count real time - * - count down from 4Gig-1 to 0 and wrap at IOCLK rate - */ - TM45BR = TMTSCBR_MAX; - t32 = TM45BR; - - TM4MD = TSC_TIMER_CLKSRC; - TM4MD |= TM4MD_INIT_COUNTER; - TM4MD &= ~TM4MD_INIT_COUNTER; - TM4ICR = 0; - t32 = TM4ICR; - - TM5MD = TM5MD_SRC_TM4CASCADE; - TM5MD |= TM5MD_INIT_COUNTER; - TM5MD &= ~TM5MD_INIT_COUNTER; - TM5ICR = 0; - t32 = TM5ICR; - - TM5MD |= TM5MD_COUNT_ENABLE; - TM4MD |= TM4MD_COUNT_ENABLE; - t32 = TM5MD; - t32 = TM4MD; -} - -static inline void shutdown_timestamp_counter(void) -{ - u8 t8; - TM4MD = 0; - TM5MD = 0; - t8 = TM4MD; - t8 = TM5MD; -} - -/* - * we use a cascaded pair of 16-bit down-counting timers to count I/O - * clock cycles for the purposes of time keeping - */ -typedef unsigned long cycles_t; - -static inline cycles_t read_timestamp_counter(void) -{ - return (cycles_t)~TMTSCBC; -} - -#endif /* !__ASSEMBLY__ */ - -#endif /* _ASM_UNIT_TIMEX_H */ diff --git a/arch/mn10300/unit-asb2303/leds.c b/arch/mn10300/unit-asb2303/leds.c deleted file mode 100644 index c03839357a140..0000000000000 --- a/arch/mn10300/unit-asb2303/leds.c +++ /dev/null @@ -1,52 +0,0 @@ -/* ASB2303 peripheral 7-segment LEDs x1 support - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include -#include - -#include -#include -#include -#include -#include - -#if 0 -static const u8 asb2303_led_hex_tbl[16] = { - 0x80, 0xf2, 0x48, 0x60, 0x32, 0x24, 0x04, 0xf0, - 0x00, 0x20, 0x10, 0x06, 0x8c, 0x42, 0x0c, 0x1c -}; -#endif - -static const u8 asb2303_led_chase_tbl[6] = { - ~0x02, /* top - segA */ - ~0x04, /* right top - segB */ - ~0x08, /* right bottom - segC */ - ~0x10, /* bottom - segD */ - ~0x20, /* left bottom - segE */ - ~0x40, /* left top - segF */ -}; - -static unsigned asb2303_led_chase; - -void peripheral_leds_display_exception(enum exception_code code) -{ - ASB2303_GPIO0DEF = 0x5555; /* configure as an output port */ - ASB2303_7SEGLEDS = 0x6d; /* triple horizontal bar */ -} - -void peripheral_leds_led_chase(void) -{ - ASB2303_GPIO0DEF = 0x5555; /* configure as an output port */ - ASB2303_7SEGLEDS = asb2303_led_chase_tbl[asb2303_led_chase]; - asb2303_led_chase++; - if (asb2303_led_chase >= 6) - asb2303_led_chase = 0; -} diff --git a/arch/mn10300/unit-asb2303/smc91111.c b/arch/mn10300/unit-asb2303/smc91111.c deleted file mode 100644 index 53677694b1655..0000000000000 --- a/arch/mn10300/unit-asb2303/smc91111.c +++ /dev/null @@ -1,53 +0,0 @@ -/* ASB2303 initialisation - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -static struct resource smc91c111_resources[] = { - [0] = { - .start = SMC91111_BASE, - .end = SMC91111_BASE_END, - .flags = IORESOURCE_MEM, - }, - [1] = { - .start = SMC91111_IRQ, - .end = SMC91111_IRQ, - .flags = IORESOURCE_IRQ, - }, -}; - -static struct platform_device smc91c111_device = { - .name = "smc91x", - .id = 0, - .num_resources = ARRAY_SIZE(smc91c111_resources), - .resource = smc91c111_resources, -}; - -/* - * add platform devices - */ -static int __init unit_device_init(void) -{ - platform_device_register(&smc91c111_device); - return 0; -} - -device_initcall(unit_device_init); diff --git a/arch/mn10300/unit-asb2303/unit-init.c b/arch/mn10300/unit-asb2303/unit-init.c deleted file mode 100644 index 834a76aa551a0..0000000000000 --- a/arch/mn10300/unit-asb2303/unit-init.c +++ /dev/null @@ -1,68 +0,0 @@ -/* ASB2303 initialisation - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -/* - * initialise some of the unit hardware before gdbstub is set up - */ -asmlinkage void __init unit_init(void) -{ - /* set up the external interrupts */ - SET_XIRQ_TRIGGER(0, XIRQ_TRIGGER_HILEVEL); - SET_XIRQ_TRIGGER(2, XIRQ_TRIGGER_LOWLEVEL); - SET_XIRQ_TRIGGER(3, XIRQ_TRIGGER_HILEVEL); - SET_XIRQ_TRIGGER(4, XIRQ_TRIGGER_LOWLEVEL); - SET_XIRQ_TRIGGER(5, XIRQ_TRIGGER_LOWLEVEL); - -#ifdef CONFIG_EXT_SERIAL_IRQ_LEVEL - set_intr_level(XIRQ0, NUM2GxICR_LEVEL(CONFIG_EXT_SERIAL_IRQ_LEVEL)); -#endif - -#ifdef CONFIG_ETHERNET_IRQ_LEVEL - set_intr_level(XIRQ3, NUM2GxICR_LEVEL(CONFIG_ETHERNET_IRQ_LEVEL)); -#endif -} - -/* - * initialise the rest of the unit hardware after gdbstub is ready - */ -void __init unit_setup(void) -{ -} - -/* - * initialise the external interrupts used by a unit of this type - */ -void __init unit_init_IRQ(void) -{ - unsigned int extnum; - - for (extnum = 0; extnum < NR_XIRQS; extnum++) { - switch (GET_XIRQ_TRIGGER(extnum)) { - case XIRQ_TRIGGER_HILEVEL: - case XIRQ_TRIGGER_LOWLEVEL: - mn10300_set_lateack_irq_type(XIRQ2IRQ(extnum)); - break; - default: - break; - } - } -} diff --git a/arch/mn10300/unit-asb2305/Makefile b/arch/mn10300/unit-asb2305/Makefile deleted file mode 100644 index cbc5abaa939a0..0000000000000 --- a/arch/mn10300/unit-asb2305/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -############################################################################### -# -# Makefile for the ASB2305 board -# -############################################################################### -obj-y := unit-init.o leds.o - -obj-$(CONFIG_PCI) += pci.o pci-asb2305.o pci-irq.o diff --git a/arch/mn10300/unit-asb2305/include/unit/clock.h b/arch/mn10300/unit-asb2305/include/unit/clock.h deleted file mode 100644 index 29e3425431cfc..0000000000000 --- a/arch/mn10300/unit-asb2305/include/unit/clock.h +++ /dev/null @@ -1,24 +0,0 @@ -/* ASB2305-specific clocks - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - -#ifndef _ASM_UNIT_CLOCK_H -#define _ASM_UNIT_CLOCK_H - -#ifndef __ASSEMBLY__ - -#define MN10300_IOCLK 33333333UL -/* #define MN10300_IOBCLK 66666666UL */ - -#endif /* !__ASSEMBLY__ */ - -#define MN10300_WDCLK MN10300_IOCLK - -#endif /* _ASM_UNIT_CLOCK_H */ diff --git a/arch/mn10300/unit-asb2305/include/unit/leds.h b/arch/mn10300/unit-asb2305/include/unit/leds.h deleted file mode 100644 index bc471f617fd17..0000000000000 --- a/arch/mn10300/unit-asb2305/include/unit/leds.h +++ /dev/null @@ -1,51 +0,0 @@ -/* ASB2305-specific LEDs - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - -#ifndef _ASM_UNIT_LEDS_H -#define _ASM_UNIT_LEDS_H - -#include -#include -#include - -#define ASB2305_7SEGLEDS __SYSREG(0xA6F90000, u32) - -/* perform a hard reset by driving PIO06 low */ -#define mn10300_unit_hard_reset() \ -do { \ - P0OUT &= 0xbf; \ - P0MD = (P0MD & P0MD_6) | P0MD_6_OUT; \ -} while (0) - -/* - * use the 7-segment LEDs to indicate states - */ -/* indicate double-fault by displaying "db-f" on the LEDs */ -#define mn10300_set_dbfleds \ - mov 0x43077f1d,d0 ; \ - mov d0,(ASB2305_7SEGLEDS) - -/* flip the 7-segment LEDs between "Gdb-" and "----" */ -#define mn10300_set_gdbleds(ONOFF) \ -do { \ - ASB2305_7SEGLEDS = (ONOFF) ? 0x8543077f : 0x7f7f7f7f; \ -} while (0) - -#ifndef __ASSEMBLY__ -extern void peripheral_leds_display_exception(enum exception_code); -extern void peripheral_leds_led_chase(void); -extern void peripheral_leds7x4_display_dec(unsigned int, unsigned int); -extern void peripheral_leds7x4_display_hex(unsigned int, unsigned int); -extern void peripheral_leds7x4_display_minssecs(unsigned int, unsigned int); -extern void peripheral_leds7x4_display_rtc(void); -#endif /* __ASSEMBLY__ */ - -#endif /* _ASM_UNIT_LEDS_H */ diff --git a/arch/mn10300/unit-asb2305/include/unit/serial.h b/arch/mn10300/unit-asb2305/include/unit/serial.h deleted file mode 100644 index 88c08219315f5..0000000000000 --- a/arch/mn10300/unit-asb2305/include/unit/serial.h +++ /dev/null @@ -1,125 +0,0 @@ -/* ASB2305-specific 8250 serial ports - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_UNIT_SERIAL_H -#define _ASM_UNIT_SERIAL_H - -#include -#include -#include - -#define SERIAL_PORT0_BASE_ADDRESS 0xA6FB0000 -#define ASB2305_DEBUG_MCR __SYSREG(0xA6FB0000 + UART_MCR * 2, u8) - -#define SERIAL_IRQ XIRQ0 /* Dual serial (PC16552) (Hi) */ - -/* - * The ASB2305 has an 18.432 MHz clock the UART - */ -#define BASE_BAUD (18432000 / 16) - -/* - * dispose of the /dev/ttyS0 serial port - */ -#ifndef CONFIG_GDBSTUB_ON_TTYSx - -#define SERIAL_PORT_DFNS \ - { \ - .baud_base = BASE_BAUD, \ - .irq = SERIAL_IRQ, \ - .flags = STD_COM_FLAGS, \ - .iomem_base = (u8 *) SERIAL_PORT0_BASE_ADDRESS, \ - .iomem_reg_shift = 2, \ - .io_type = SERIAL_IO_MEM, \ - }, - -#ifndef __ASSEMBLY__ - -static inline void __debug_to_serial(const char *p, int n) -{ -} - -#endif /* !__ASSEMBLY__ */ - -#else /* CONFIG_GDBSTUB_ON_TTYSx */ - -#define SERIAL_PORT_DFNS /* stolen by gdb-stub */ - -#if defined(CONFIG_GDBSTUB_ON_TTYS0) -#define GDBPORT_SERIAL_RX __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_RX * 4, u8) -#define GDBPORT_SERIAL_TX __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_TX * 4, u8) -#define GDBPORT_SERIAL_DLL __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_DLL * 4, u8) -#define GDBPORT_SERIAL_DLM __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_DLM * 4, u8) -#define GDBPORT_SERIAL_IER __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_IER * 4, u8) -#define GDBPORT_SERIAL_IIR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_IIR * 4, u8) -#define GDBPORT_SERIAL_FCR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_FCR * 4, u8) -#define GDBPORT_SERIAL_LCR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_LCR * 4, u8) -#define GDBPORT_SERIAL_MCR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_MCR * 4, u8) -#define GDBPORT_SERIAL_LSR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_LSR * 4, u8) -#define GDBPORT_SERIAL_MSR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_MSR * 4, u8) -#define GDBPORT_SERIAL_SCR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_SCR * 4, u8) -#define GDBPORT_SERIAL_IRQ SERIAL_IRQ - -#elif defined(CONFIG_GDBSTUB_ON_TTYS1) -#error The ASB2305 doesnt have a /dev/ttyS1 -#endif - -#ifndef __ASSEMBLY__ - -#define TTYS0_TX __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_TX * 4, u8) -#define TTYS0_MCR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_MCR * 4, u8) -#define TTYS0_LSR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_LSR * 4, u8) -#define TTYS0_MSR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_MSR * 4, u8) - -#define LSR_WAIT_FOR(STATE) \ -do { \ - while (!(TTYS0_LSR & UART_LSR_##STATE)) {} \ -} while (0) -#define FLOWCTL_WAIT_FOR(LINE) \ -do { \ - while (!(TTYS0_MSR & UART_MSR_##LINE)) {} \ -} while (0) -#define FLOWCTL_CLEAR(LINE) \ -do { \ - TTYS0_MCR &= ~UART_MCR_##LINE; \ -} while (0) -#define FLOWCTL_SET(LINE) \ -do { \ - TTYS0_MCR |= UART_MCR_##LINE; \ -} while (0) -#define FLOWCTL_QUERY(LINE) ({ TTYS0_MSR & UART_MSR_##LINE; }) - -static inline void __debug_to_serial(const char *p, int n) -{ - char ch; - - FLOWCTL_SET(DTR); - - for (; n > 0; n--) { - LSR_WAIT_FOR(THRE); - FLOWCTL_WAIT_FOR(CTS); - - ch = *p++; - if (ch == 0x0a) { - TTYS0_TX = 0x0d; - LSR_WAIT_FOR(THRE); - FLOWCTL_WAIT_FOR(CTS); - } - TTYS0_TX = ch; - } - - FLOWCTL_CLEAR(DTR); -} - -#endif /* !__ASSEMBLY__ */ - -#endif /* CONFIG_GDBSTUB_ON_TTYSx */ - -#endif /* _ASM_UNIT_SERIAL_H */ diff --git a/arch/mn10300/unit-asb2305/include/unit/timex.h b/arch/mn10300/unit-asb2305/include/unit/timex.h deleted file mode 100644 index 4cefc224f448d..0000000000000 --- a/arch/mn10300/unit-asb2305/include/unit/timex.h +++ /dev/null @@ -1,146 +0,0 @@ -/* ASB2305-specific timer specifications - * - * Copyright (C) 2007, 2010 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _ASM_UNIT_TIMEX_H -#define _ASM_UNIT_TIMEX_H - -#include -#include -#include - -/* - * jiffies counter specifications - */ - -#define TMJCBR_MAX 0xffff -#define TMJCIRQ TM1IRQ -#define TMJCICR TM1ICR - -#ifndef __ASSEMBLY__ - -#define MN10300_SRC_IOCLK MN10300_IOCLK - -#ifndef HZ -# error HZ undeclared. -#endif /* !HZ */ -/* use as little prescaling as possible to avoid losing accuracy */ -#if (MN10300_SRC_IOCLK + HZ / 2) / HZ - 1 <= TMJCBR_MAX -# define IOCLK_PRESCALE 1 -# define JC_TIMER_CLKSRC TM0MD_SRC_IOCLK -# define TSC_TIMER_CLKSRC TM4MD_SRC_IOCLK -#elif (MN10300_SRC_IOCLK / 8 + HZ / 2) / HZ - 1 <= TMJCBR_MAX -# define IOCLK_PRESCALE 8 -# define JC_TIMER_CLKSRC TM0MD_SRC_IOCLK_8 -# define TSC_TIMER_CLKSRC TM4MD_SRC_IOCLK_8 -#elif (MN10300_SRC_IOCLK / 32 + HZ / 2) / HZ - 1 <= TMJCBR_MAX -# define IOCLK_PRESCALE 32 -# define JC_TIMER_CLKSRC TM0MD_SRC_IOCLK_32 -# define TSC_TIMER_CLKSRC TM4MD_SRC_IOCLK_32 -#else -# error You lose. -#endif - -#define MN10300_JCCLK (MN10300_SRC_IOCLK / IOCLK_PRESCALE) -#define MN10300_TSCCLK (MN10300_SRC_IOCLK / IOCLK_PRESCALE) - -#define MN10300_JC_PER_HZ ((MN10300_JCCLK + HZ / 2) / HZ) -#define MN10300_TSC_PER_HZ ((MN10300_TSCCLK + HZ / 2) / HZ) - -static inline void stop_jiffies_counter(void) -{ - u16 tmp; - TM01MD = JC_TIMER_CLKSRC | TM1MD_SRC_TM0CASCADE << 8; - tmp = TM01MD; -} - -static inline void reload_jiffies_counter(u32 cnt) -{ - u32 tmp; - - TM01BR = cnt; - tmp = TM01BR; - - TM01MD = JC_TIMER_CLKSRC | \ - TM1MD_SRC_TM0CASCADE << 8 | \ - TM0MD_INIT_COUNTER | \ - TM1MD_INIT_COUNTER << 8; - - - TM01MD = JC_TIMER_CLKSRC | \ - TM1MD_SRC_TM0CASCADE << 8 | \ - TM0MD_COUNT_ENABLE | \ - TM1MD_COUNT_ENABLE << 8; - - tmp = TM01MD; -} - -#endif /* !__ASSEMBLY__ */ - - -/* - * timestamp counter specifications - */ - -#define TMTSCBR_MAX 0xffffffff -#define TMTSCBC TM45BC - -#ifndef __ASSEMBLY__ - -static inline void startup_timestamp_counter(void) -{ - u32 t32; - - /* set up timer 4 & 5 cascaded as a 32-bit counter to count real time - * - count down from 4Gig-1 to 0 and wrap at IOCLK rate - */ - TM45BR = TMTSCBR_MAX; - t32 = TM45BR; - - TM4MD = TSC_TIMER_CLKSRC; - TM4MD |= TM4MD_INIT_COUNTER; - TM4MD &= ~TM4MD_INIT_COUNTER; - TM4ICR = 0; - t32 = TM4ICR; - - TM5MD = TM5MD_SRC_TM4CASCADE; - TM5MD |= TM5MD_INIT_COUNTER; - TM5MD &= ~TM5MD_INIT_COUNTER; - TM5ICR = 0; - t32 = TM5ICR; - - TM5MD |= TM5MD_COUNT_ENABLE; - TM4MD |= TM4MD_COUNT_ENABLE; - t32 = TM5MD; - t32 = TM4MD; -} - -static inline void shutdown_timestamp_counter(void) -{ - u8 t8; - TM4MD = 0; - TM5MD = 0; - t8 = TM4MD; - t8 = TM5MD; -} - -/* - * we use a cascaded pair of 16-bit down-counting timers to count I/O - * clock cycles for the purposes of time keeping - */ -typedef unsigned long cycles_t; - -static inline cycles_t read_timestamp_counter(void) -{ - return (cycles_t)~TMTSCBC; -} - -#endif /* !__ASSEMBLY__ */ - -#endif /* _ASM_UNIT_TIMEX_H */ diff --git a/arch/mn10300/unit-asb2305/leds.c b/arch/mn10300/unit-asb2305/leds.c deleted file mode 100644 index 6f8de99540263..0000000000000 --- a/arch/mn10300/unit-asb2305/leds.c +++ /dev/null @@ -1,124 +0,0 @@ -/* ASB2305 Peripheral 7-segment LEDs x4 support - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include -#include -#include -#include -#include -#include -#include - -static const u8 asb2305_led_hex_tbl[16] = { - 0x80, 0xf2, 0x48, 0x60, 0x32, 0x24, 0x04, 0xf0, - 0x00, 0x20, 0x10, 0x06, 0x8c, 0x42, 0x0c, 0x1c -}; - -static const u32 asb2305_led_chase_tbl[6] = { - ~0x02020202, /* top - segA */ - ~0x04040404, /* right top - segB */ - ~0x08080808, /* right bottom - segC */ - ~0x10101010, /* bottom - segD */ - ~0x20202020, /* left bottom - segE */ - ~0x40404040, /* left top - segF */ -}; - -static unsigned asb2305_led_chase; - -void peripheral_leds7x4_display_dec(unsigned int val, unsigned int points) -{ - u32 leds; - - leds = asb2305_led_hex_tbl[(val/1000) % 10]; - leds <<= 8; - leds |= asb2305_led_hex_tbl[(val/100) % 10]; - leds <<= 8; - leds |= asb2305_led_hex_tbl[(val/10) % 10]; - leds <<= 8; - leds |= asb2305_led_hex_tbl[val % 10]; - leds |= points^0x01010101; - - ASB2305_7SEGLEDS = leds; -} - -void peripheral_leds7x4_display_hex(unsigned int val, unsigned int points) -{ - u32 leds; - - leds = asb2305_led_hex_tbl[(val/1000) % 10]; - leds <<= 8; - leds |= asb2305_led_hex_tbl[(val/100) % 10]; - leds <<= 8; - leds |= asb2305_led_hex_tbl[(val/10) % 10]; - leds <<= 8; - leds |= asb2305_led_hex_tbl[val % 10]; - leds |= points^0x01010101; - - ASB2305_7SEGLEDS = leds; -} - -void peripheral_leds_display_exception(enum exception_code code) -{ - u32 leds; - - leds = asb2305_led_hex_tbl[(code/0x100) % 0x10]; - leds <<= 8; - leds |= asb2305_led_hex_tbl[(code/0x10) % 0x10]; - leds <<= 8; - leds |= asb2305_led_hex_tbl[code % 0x10]; - leds |= 0x6d010101; - - ASB2305_7SEGLEDS = leds; -} - -void peripheral_leds7x4_display_minssecs(unsigned int time, unsigned int points) -{ - u32 leds; - - leds = asb2305_led_hex_tbl[(time/600) % 6]; - leds <<= 8; - leds |= asb2305_led_hex_tbl[(time/60) % 10]; - leds <<= 8; - leds |= asb2305_led_hex_tbl[(time/10) % 6]; - leds <<= 8; - leds |= asb2305_led_hex_tbl[time % 10]; - leds |= points^0x01010101; - - ASB2305_7SEGLEDS = leds; -} - -void peripheral_leds7x4_display_rtc(void) -{ - unsigned int clock; - u8 mins, secs; - - mins = RTMCR; - secs = RTSCR; - - clock = ((mins & 0xf0) >> 4); - clock *= 10; - clock += (mins & 0x0f); - clock *= 6; - - clock += ((secs & 0xf0) >> 4); - clock *= 10; - clock += (secs & 0x0f); - - peripheral_leds7x4_display_minssecs(clock, 0); -} - -void peripheral_leds_led_chase(void) -{ - ASB2305_7SEGLEDS = asb2305_led_chase_tbl[asb2305_led_chase]; - asb2305_led_chase++; - if (asb2305_led_chase >= 6) - asb2305_led_chase = 0; -} diff --git a/arch/mn10300/unit-asb2305/pci-asb2305.c b/arch/mn10300/unit-asb2305/pci-asb2305.c deleted file mode 100644 index e0f4617c0c7a9..0000000000000 --- a/arch/mn10300/unit-asb2305/pci-asb2305.c +++ /dev/null @@ -1,212 +0,0 @@ -/* ASB2305 PCI resource stuff - * - * Copyright (C) 2001 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - Derived from arch/i386/pci-i386.c - * - Copyright 1997--2000 Martin Mares - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include -#include -#include -#include -#include -#include "pci-asb2305.h" - -/* - * We need to avoid collisions with `mirrored' VGA ports - * and other strange ISA hardware, so we always want the - * addresses to be allocated in the 0x000-0x0ff region - * modulo 0x400. - * - * Why? Because some silly external IO cards only decode - * the low 10 bits of the IO address. The 0x00-0xff region - * is reserved for motherboard devices that decode all 16 - * bits, so it's ok to allocate at, say, 0x2800-0x28ff, - * but we want to try to avoid allocating at 0x2900-0x2bff - * which might have be mirrored at 0x0100-0x03ff.. - */ -resource_size_t pcibios_align_resource(void *data, const struct resource *res, - resource_size_t size, resource_size_t align) -{ - resource_size_t start = res->start; - -#if 0 - struct pci_dev *dev = data; - - printk(KERN_DEBUG - "### PCIBIOS_ALIGN_RESOURCE(%s,,{%08lx-%08lx,%08lx},%lx)\n", - pci_name(dev), - res->start, - res->end, - res->flags, - size - ); -#endif - - if ((res->flags & IORESOURCE_IO) && (start & 0x300)) - start = (start + 0x3ff) & ~0x3ff; - - return start; -} - - -/* - * Handle resources of PCI devices. If the world were perfect, we could - * just allocate all the resource regions and do nothing more. It isn't. - * On the other hand, we cannot just re-allocate all devices, as it would - * require us to know lots of host bridge internals. So we attempt to - * keep as much of the original configuration as possible, but tweak it - * when it's found to be wrong. - * - * Known BIOS problems we have to work around: - * - I/O or memory regions not configured - * - regions configured, but not enabled in the command register - * - bogus I/O addresses above 64K used - * - expansion ROMs left enabled (this may sound harmless, but given - * the fact the PCI specs explicitly allow address decoders to be - * shared between expansion ROMs and other resource regions, it's - * at least dangerous) - * - * Our solution: - * (1) Allocate resources for all buses behind PCI-to-PCI bridges. - * This gives us fixed barriers on where we can allocate. - * (2) Allocate resources for all enabled devices. If there is - * a collision, just mark the resource as unallocated. Also - * disable expansion ROMs during this step. - * (3) Try to allocate resources for disabled devices. If the - * resources were assigned correctly, everything goes well, - * if they weren't, they won't disturb allocation of other - * resources. - * (4) Assign new addresses to resources which were either - * not configured at all or misconfigured. If explicitly - * requested by the user, configure expansion ROM address - * as well. - */ -static void __init pcibios_allocate_bus_resources(struct list_head *bus_list) -{ - struct pci_bus *bus; - struct pci_dev *dev; - int idx; - struct resource *r; - - /* Depth-First Search on bus tree */ - list_for_each_entry(bus, bus_list, node) { - dev = bus->self; - if (dev) { - for (idx = PCI_BRIDGE_RESOURCES; - idx < PCI_NUM_RESOURCES; - idx++) { - r = &dev->resource[idx]; - if (!r->flags) - continue; - if (!r->start || - pci_claim_bridge_resource(dev, idx) < 0) { - printk(KERN_ERR "PCI:" - " Cannot allocate resource" - " region %d of bridge %s\n", - idx, pci_name(dev)); - /* Something is wrong with the region. - * Invalidate the resource to prevent - * child resource allocations in this - * range. */ - r->start = r->end = 0; - r->flags = 0; - } - } - } - pcibios_allocate_bus_resources(&bus->children); - } -} - -static void __init pcibios_allocate_resources(int pass) -{ - struct pci_dev *dev = NULL; - int idx, disabled; - u16 command; - struct resource *r; - - for_each_pci_dev(dev) { - pci_read_config_word(dev, PCI_COMMAND, &command); - for (idx = 0; idx < 6; idx++) { - r = &dev->resource[idx]; - if (r->parent) /* Already allocated */ - continue; - if (!r->start) /* Address not assigned */ - continue; - if (r->flags & IORESOURCE_IO) - disabled = !(command & PCI_COMMAND_IO); - else - disabled = !(command & PCI_COMMAND_MEMORY); - if (pass == disabled) { - DBG("PCI[%s]: Resource %08lx-%08lx" - " (f=%lx, d=%d, p=%d)\n", - pci_name(dev), r->start, r->end, r->flags, - disabled, pass); - if (pci_claim_resource(dev, idx) < 0) { - printk(KERN_ERR "PCI:" - " Cannot allocate resource" - " region %d of device %s\n", - idx, pci_name(dev)); - /* We'll assign a new address later */ - r->end -= r->start; - r->start = 0; - } - } - } - if (!pass) { - r = &dev->resource[PCI_ROM_RESOURCE]; - if (r->flags & IORESOURCE_ROM_ENABLE) { - /* Turn the ROM off, leave the resource region, - * but keep it unregistered. */ - u32 reg; - DBG("PCI: Switching off ROM of %s\n", - pci_name(dev)); - r->flags &= ~IORESOURCE_ROM_ENABLE; - pci_read_config_dword( - dev, dev->rom_base_reg, ®); - pci_write_config_dword( - dev, dev->rom_base_reg, - reg & ~PCI_ROM_ADDRESS_ENABLE); - } - } - } -} - -static int __init pcibios_assign_resources(void) -{ - struct pci_dev *dev = NULL; - struct resource *r; - - /* Try to use BIOS settings for ROMs, otherwise let - pci_assign_unassigned_resources() allocate the new - addresses. */ - for_each_pci_dev(dev) { - r = &dev->resource[PCI_ROM_RESOURCE]; - if (!r->flags || !r->start) - continue; - if (pci_claim_resource(dev, PCI_ROM_RESOURCE) < 0) { - r->end -= r->start; - r->start = 0; - } - } - - pci_assign_unassigned_resources(); - - return 0; -} - -fs_initcall(pcibios_assign_resources); - -void __init pcibios_resource_survey(void) -{ - DBG("PCI: Allocating resources\n"); - pcibios_allocate_bus_resources(&pci_root_buses); - pcibios_allocate_resources(0); - pcibios_allocate_resources(1); -} diff --git a/arch/mn10300/unit-asb2305/pci-asb2305.h b/arch/mn10300/unit-asb2305/pci-asb2305.h deleted file mode 100644 index 0667f613b023c..0000000000000 --- a/arch/mn10300/unit-asb2305/pci-asb2305.h +++ /dev/null @@ -1,65 +0,0 @@ -/* ASB2305 Arch-specific PCI declarations - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * Derived from: arch/i386/kernel/pci-i386.h: (c) 1999 Martin Mares - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _PCI_ASB2305_H -#define _PCI_ASB2305_H - -#undef DEBUG - -#ifdef DEBUG -#define DBG(x...) printk(x) -#else -#define DBG(x...) -#endif - -extern unsigned int pci_probe; - -/* pci-asb2305.c */ - -extern void pcibios_resource_survey(void); - -/* pci.c */ - -extern struct pci_ops *pci_root_ops; - -/* pci-irq.c */ - -struct irq_info { - u8 bus, devfn; /* Bus, device and function */ - struct { - u8 link; /* IRQ line ID, chipset dependent, - * 0=not routed */ - u16 bitmap; /* Available IRQs */ - } __attribute__((packed)) irq[4]; - u8 slot; /* Slot number, 0=onboard */ - u8 rfu; -} __attribute__((packed)); - -struct irq_routing_table { - u32 signature; /* PIRQ_SIGNATURE should be here */ - u16 version; /* PIRQ_VERSION */ - u16 size; /* Table size in bytes */ - u8 rtr_bus, rtr_devfn; /* Where the interrupt router lies */ - u16 exclusive_irqs; /* IRQs devoted exclusively to PCI usage */ - u16 rtr_vendor, rtr_device; /* Vendor and device ID of interrupt router */ - u32 miniport_data; /* Crap */ - u8 rfu[11]; - u8 checksum; /* Modulo 256 checksum must give zero */ - struct irq_info slots[0]; -} __attribute__((packed)); - -extern unsigned int pcibios_irq_mask; - -extern void pcibios_irq_init(void); -extern void pcibios_fixup_irqs(void); -extern void pcibios_enable_irq(struct pci_dev *dev); - -#endif /* PCI_ASB2305_H */ diff --git a/arch/mn10300/unit-asb2305/pci-irq.c b/arch/mn10300/unit-asb2305/pci-irq.c deleted file mode 100644 index fcb28ceb824d6..0000000000000 --- a/arch/mn10300/unit-asb2305/pci-irq.c +++ /dev/null @@ -1,46 +0,0 @@ -/* PCI IRQ routing on the MN103E010 based ASB2305 - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - * - * This is simple: All PCI interrupts route through the CPU's XIRQ1 pin [IRQ 35] - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include "pci-asb2305.h" - -void __init pcibios_irq_init(void) -{ -} - -void __init pcibios_fixup_irqs(void) -{ - struct pci_dev *dev = NULL; - u8 line, pin; - - for_each_pci_dev(dev) { - pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin); - if (pin) { - dev->irq = XIRQ1; - pci_write_config_byte(dev, PCI_INTERRUPT_LINE, - dev->irq); - } - pci_read_config_byte(dev, PCI_INTERRUPT_LINE, &line); - } -} - -void pcibios_enable_irq(struct pci_dev *dev) -{ - pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq); -} diff --git a/arch/mn10300/unit-asb2305/pci.c b/arch/mn10300/unit-asb2305/pci.c deleted file mode 100644 index 3dfe2d31c67b2..0000000000000 --- a/arch/mn10300/unit-asb2305/pci.c +++ /dev/null @@ -1,505 +0,0 @@ -/* ASB2305 PCI support - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * Derived from arch/i386/kernel/pci-pc.c - * (c) 1999--2000 Martin Mares - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "pci-asb2305.h" - -unsigned int pci_probe = 1; - -struct pci_ops *pci_root_ops; - -/* - * The accessible PCI window does not cover the entire CPU address space, but - * there are devices we want to access outside of that window, so we need to - * insert specific PCI bus resources instead of using the platform-level bus - * resources directly for the PCI root bus. - * - * These are configured and inserted by pcibios_init(). - */ -static struct resource pci_ioport_resource = { - .name = "PCI IO", - .start = 0xbe000000, - .end = 0xbe03ffff, - .flags = IORESOURCE_IO, -}; - -static struct resource pci_iomem_resource = { - .name = "PCI mem", - .start = 0xb8000000, - .end = 0xbbffffff, - .flags = IORESOURCE_MEM, -}; - -/* - * Functions for accessing PCI configuration space - */ - -#define CONFIG_CMD(bus, devfn, where) \ - (0x80000000 | (bus->number << 16) | (devfn << 8) | (where & ~3)) - -#define MEM_PAGING_REG (*(volatile __u32 *) 0xBFFFFFF4) -#define CONFIG_ADDRESS (*(volatile __u32 *) 0xBFFFFFF8) -#define CONFIG_DATAL(X) (*(volatile __u32 *) 0xBFFFFFFC) -#define CONFIG_DATAW(X) (*(volatile __u16 *) (0xBFFFFFFC + ((X) & 2))) -#define CONFIG_DATAB(X) (*(volatile __u8 *) (0xBFFFFFFC + ((X) & 3))) - -#define BRIDGEREGB(X) (*(volatile __u8 *) (0xBE040000 + (X))) -#define BRIDGEREGW(X) (*(volatile __u16 *) (0xBE040000 + (X))) -#define BRIDGEREGL(X) (*(volatile __u32 *) (0xBE040000 + (X))) - -static inline int __query(const struct pci_bus *bus, unsigned int devfn) -{ -#if 0 - return bus->number == 0 && (devfn == PCI_DEVFN(0, 0)); - return bus->number == 1; - return bus->number == 0 && - (devfn == PCI_DEVFN(2, 0) || devfn == PCI_DEVFN(3, 0)); -#endif - return 1; -} - -/* - * - */ -static int pci_ampci_read_config_byte(struct pci_bus *bus, unsigned int devfn, - int where, u32 *_value) -{ - u32 rawval, value; - - if (bus->number == 0 && devfn == PCI_DEVFN(0, 0)) { - value = BRIDGEREGB(where); - __pcbdebug("=> %02hx", &BRIDGEREGL(where), value); - } else { - CONFIG_ADDRESS = CONFIG_CMD(bus, devfn, where); - rawval = CONFIG_ADDRESS; - value = CONFIG_DATAB(where); - if (__query(bus, devfn)) - __pcidebug("=> %02hx", bus, devfn, where, value); - } - - *_value = value; - return PCIBIOS_SUCCESSFUL; -} - -static int pci_ampci_read_config_word(struct pci_bus *bus, unsigned int devfn, - int where, u32 *_value) -{ - u32 rawval, value; - - if (bus->number == 0 && devfn == PCI_DEVFN(0, 0)) { - value = BRIDGEREGW(where); - __pcbdebug("=> %04hx", &BRIDGEREGL(where), value); - } else { - CONFIG_ADDRESS = CONFIG_CMD(bus, devfn, where); - rawval = CONFIG_ADDRESS; - value = CONFIG_DATAW(where); - if (__query(bus, devfn)) - __pcidebug("=> %04hx", bus, devfn, where, value); - } - - *_value = value; - return PCIBIOS_SUCCESSFUL; -} - -static int pci_ampci_read_config_dword(struct pci_bus *bus, unsigned int devfn, - int where, u32 *_value) -{ - u32 rawval, value; - - if (bus->number == 0 && devfn == PCI_DEVFN(0, 0)) { - value = BRIDGEREGL(where); - __pcbdebug("=> %08x", &BRIDGEREGL(where), value); - } else { - CONFIG_ADDRESS = CONFIG_CMD(bus, devfn, where); - rawval = CONFIG_ADDRESS; - value = CONFIG_DATAL(where); - if (__query(bus, devfn)) - __pcidebug("=> %08x", bus, devfn, where, value); - } - - *_value = value; - return PCIBIOS_SUCCESSFUL; -} - -static int pci_ampci_write_config_byte(struct pci_bus *bus, unsigned int devfn, - int where, u8 value) -{ - u32 rawval; - - if (bus->number == 0 && devfn == PCI_DEVFN(0, 0)) { - __pcbdebug("<= %02x", &BRIDGEREGB(where), value); - BRIDGEREGB(where) = value; - } else { - if (bus->number == 0 && - (devfn == PCI_DEVFN(2, 0) || devfn == PCI_DEVFN(3, 0)) - ) - __pcidebug("<= %02x", bus, devfn, where, value); - CONFIG_ADDRESS = CONFIG_CMD(bus, devfn, where); - rawval = CONFIG_ADDRESS; - CONFIG_DATAB(where) = value; - } - return PCIBIOS_SUCCESSFUL; -} - -static int pci_ampci_write_config_word(struct pci_bus *bus, unsigned int devfn, - int where, u16 value) -{ - u32 rawval; - - if (bus->number == 0 && devfn == PCI_DEVFN(0, 0)) { - __pcbdebug("<= %04hx", &BRIDGEREGW(where), value); - BRIDGEREGW(where) = value; - } else { - if (__query(bus, devfn)) - __pcidebug("<= %04hx", bus, devfn, where, value); - CONFIG_ADDRESS = CONFIG_CMD(bus, devfn, where); - rawval = CONFIG_ADDRESS; - CONFIG_DATAW(where) = value; - } - return PCIBIOS_SUCCESSFUL; -} - -static int pci_ampci_write_config_dword(struct pci_bus *bus, unsigned int devfn, - int where, u32 value) -{ - u32 rawval; - - if (bus->number == 0 && devfn == PCI_DEVFN(0, 0)) { - __pcbdebug("<= %08x", &BRIDGEREGL(where), value); - BRIDGEREGL(where) = value; - } else { - if (__query(bus, devfn)) - __pcidebug("<= %08x", bus, devfn, where, value); - CONFIG_ADDRESS = CONFIG_CMD(bus, devfn, where); - rawval = CONFIG_ADDRESS; - CONFIG_DATAL(where) = value; - } - return PCIBIOS_SUCCESSFUL; -} - -static int pci_ampci_read_config(struct pci_bus *bus, unsigned int devfn, - int where, int size, u32 *val) -{ - switch (size) { - case 1: - return pci_ampci_read_config_byte(bus, devfn, where, val); - case 2: - return pci_ampci_read_config_word(bus, devfn, where, val); - case 4: - return pci_ampci_read_config_dword(bus, devfn, where, val); - default: - BUG(); - return -EOPNOTSUPP; - } -} - -static int pci_ampci_write_config(struct pci_bus *bus, unsigned int devfn, - int where, int size, u32 val) -{ - switch (size) { - case 1: - return pci_ampci_write_config_byte(bus, devfn, where, val); - case 2: - return pci_ampci_write_config_word(bus, devfn, where, val); - case 4: - return pci_ampci_write_config_dword(bus, devfn, where, val); - default: - BUG(); - return -EOPNOTSUPP; - } -} - -static struct pci_ops pci_direct_ampci = { - .read = pci_ampci_read_config, - .write = pci_ampci_write_config, -}; - -/* - * Before we decide to use direct hardware access mechanisms, we try to do some - * trivial checks to ensure it at least _seems_ to be working -- we just test - * whether bus 00 contains a host bridge (this is similar to checking - * techniques used in XFree86, but ours should be more reliable since we - * attempt to make use of direct access hints provided by the PCI BIOS). - * - * This should be close to trivial, but it isn't, because there are buggy - * chipsets (yes, you guessed it, by Intel and Compaq) that have no class ID. - */ -static int __init pci_sanity_check(struct pci_ops *o) -{ - struct pci_bus bus; /* Fake bus and device */ - u32 x; - - bus.number = 0; - - if ((!o->read(&bus, 0, PCI_CLASS_DEVICE, 2, &x) && - (x == PCI_CLASS_BRIDGE_HOST || x == PCI_CLASS_DISPLAY_VGA)) || - (!o->read(&bus, 0, PCI_VENDOR_ID, 2, &x) && - (x == PCI_VENDOR_ID_INTEL || x == PCI_VENDOR_ID_COMPAQ))) - return 1; - - printk(KERN_ERR "PCI: Sanity check failed\n"); - return 0; -} - -static int __init pci_check_direct(void) -{ - unsigned long flags; - - local_irq_save(flags); - - /* - * Check if access works. - */ - if (pci_sanity_check(&pci_direct_ampci)) { - local_irq_restore(flags); - printk(KERN_INFO "PCI: Using configuration ampci\n"); - request_mem_region(0xBE040000, 256, "AMPCI bridge"); - request_mem_region(0xBFFFFFF4, 12, "PCI ampci"); - request_mem_region(0xBC000000, 32 * 1024 * 1024, "PCI SRAM"); - return 0; - } - - local_irq_restore(flags); - return -ENODEV; -} - -static void pcibios_fixup_device_resources(struct pci_dev *dev) -{ - int idx; - - if (!dev->bus) - return; - - for (idx = 0; idx < PCI_BRIDGE_RESOURCES; idx++) { - struct resource *r = &dev->resource[idx]; - - if (!r->flags || r->parent || !r->start) - continue; - - pci_claim_resource(dev, idx); - } -} - -static void pcibios_fixup_bridge_resources(struct pci_dev *dev) -{ - int idx; - - if (!dev->bus) - return; - - for (idx = PCI_BRIDGE_RESOURCES; idx < PCI_NUM_RESOURCES; idx++) { - struct resource *r = &dev->resource[idx]; - - if (!r->flags || r->parent || !r->start) - continue; - - pci_claim_bridge_resource(dev, idx); - } -} - -/* - * Called after each bus is probed, but before its children - * are examined. - */ -void pcibios_fixup_bus(struct pci_bus *bus) -{ - struct pci_dev *dev; - - if (bus->self) { - pci_read_bridge_bases(bus); - pcibios_fixup_bridge_resources(bus->self); - } - - list_for_each_entry(dev, &bus->devices, bus_list) - pcibios_fixup_device_resources(dev); -} - -/* - * Initialization. Try all known PCI access methods. Note that we support - * using both PCI BIOS and direct access: in such cases, we use I/O ports - * to access config space, but we still keep BIOS order of cards to be - * compatible with 2.0.X. This should go away some day. - */ -static int __init pcibios_init(void) -{ - resource_size_t io_offset, mem_offset; - LIST_HEAD(resources); - struct pci_bus *bus; - - ioport_resource.start = 0xA0000000; - ioport_resource.end = 0xDFFFFFFF; - iomem_resource.start = 0xA0000000; - iomem_resource.end = 0xDFFFFFFF; - - if (insert_resource(&iomem_resource, &pci_iomem_resource) < 0) - panic("Unable to insert PCI IOMEM resource\n"); - if (insert_resource(&ioport_resource, &pci_ioport_resource) < 0) - panic("Unable to insert PCI IOPORT resource\n"); - - if (!pci_probe) - return 0; - - if (pci_check_direct() < 0) { - printk(KERN_WARNING "PCI: No PCI bus detected\n"); - return 0; - } - - printk(KERN_INFO "PCI: Probing PCI hardware [mempage %08x]\n", - MEM_PAGING_REG); - - io_offset = pci_ioport_resource.start - - (pci_ioport_resource.start & 0x00ffffff); - mem_offset = pci_iomem_resource.start - - ((pci_iomem_resource.start & 0x03ffffff) | MEM_PAGING_REG); - - pci_add_resource_offset(&resources, &pci_ioport_resource, io_offset); - pci_add_resource_offset(&resources, &pci_iomem_resource, mem_offset); - bus = pci_scan_root_bus(NULL, 0, &pci_direct_ampci, NULL, &resources); - if (!bus) - return 0; - - pcibios_irq_init(); - pcibios_fixup_irqs(); - pcibios_resource_survey(); - pci_bus_add_devices(bus); - return 0; -} - -arch_initcall(pcibios_init); - -char *__init pcibios_setup(char *str) -{ - if (!strcmp(str, "off")) { - pci_probe = 0; - return NULL; - } - - return str; -} - -int pcibios_enable_device(struct pci_dev *dev, int mask) -{ - int err; - - err = pci_enable_resources(dev, mask); - if (err == 0) - pcibios_enable_irq(dev); - return err; -} - -/* - * disable the ethernet chipset - */ -static void __init unit_disable_pcnet(struct pci_bus *bus, struct pci_ops *o) -{ - u32 x; - - bus->number = 0; - - o->read (bus, PCI_DEVFN(2, 0), PCI_VENDOR_ID, 4, &x); - o->read (bus, PCI_DEVFN(2, 0), PCI_COMMAND, 2, &x); - x |= PCI_COMMAND_MASTER | - PCI_COMMAND_IO | PCI_COMMAND_MEMORY | - PCI_COMMAND_SERR | PCI_COMMAND_PARITY; - o->write(bus, PCI_DEVFN(2, 0), PCI_COMMAND, 2, x); - o->read (bus, PCI_DEVFN(2, 0), PCI_COMMAND, 2, &x); - o->write(bus, PCI_DEVFN(2, 0), PCI_BASE_ADDRESS_0, 4, 0x00030001); - o->read (bus, PCI_DEVFN(2, 0), PCI_BASE_ADDRESS_0, 4, &x); - -#define RDP (*(volatile u32 *) 0xBE030010) -#define RAP (*(volatile u32 *) 0xBE030014) -#define __set_RAP(X) do { RAP = (X); x = RAP; } while (0) -#define __set_RDP(X) do { RDP = (X); x = RDP; } while (0) -#define __get_RDP() ({ RDP & 0xffff; }) - - __set_RAP(0); - __set_RDP(0x0004); /* CSR0 = STOP */ - - __set_RAP(88); /* check CSR88 indicates an Am79C973 */ - BUG_ON(__get_RDP() != 0x5003); - - for (x = 0; x < 100; x++) - asm volatile("nop"); - - __set_RDP(0x0004); /* CSR0 = STOP */ -} - -/* - * initialise the unit hardware - */ -asmlinkage void __init unit_pci_init(void) -{ - struct pci_bus bus; /* Fake bus and device */ - struct pci_ops *o = &pci_direct_ampci; - u32 x; - - set_intr_level(XIRQ1, NUM2GxICR_LEVEL(CONFIG_PCI_IRQ_LEVEL)); - - memset(&bus, 0, sizeof(bus)); - - MEM_PAGING_REG = 0xE8000000; - - /* we need to set up the bridge _now_ or we won't be able to access the - * PCI config registers - */ - BRIDGEREGW(PCI_COMMAND) |= - PCI_COMMAND_SERR | PCI_COMMAND_PARITY | - PCI_COMMAND_MEMORY | PCI_COMMAND_IO | PCI_COMMAND_MASTER; - BRIDGEREGW(PCI_STATUS) = 0xF800; - BRIDGEREGB(PCI_LATENCY_TIMER) = 0x10; - BRIDGEREGL(PCI_BASE_ADDRESS_0) = 0x80000000; - BRIDGEREGB(PCI_INTERRUPT_LINE) = 1; - BRIDGEREGL(0x48) = 0x98000000; /* AMPCI base addr */ - BRIDGEREGB(0x41) = 0x00; /* secondary bus - * number */ - BRIDGEREGB(0x42) = 0x01; /* subordinate bus - * number */ - BRIDGEREGB(0x44) = 0x01; - BRIDGEREGL(0x50) = 0x00000001; - BRIDGEREGL(0x58) = 0x00001002; - BRIDGEREGL(0x5C) = 0x00000011; - - /* we also need to set up the PCI-PCI bridge */ - bus.number = 0; - - /* IO: 0x00000000-0x00020000 */ - o->read (&bus, PCI_DEVFN(3, 0), PCI_COMMAND, 2, &x); - x |= PCI_COMMAND_MASTER | - PCI_COMMAND_IO | PCI_COMMAND_MEMORY | - PCI_COMMAND_SERR | PCI_COMMAND_PARITY; - o->write(&bus, PCI_DEVFN(3, 0), PCI_COMMAND, 2, x); - - o->read (&bus, PCI_DEVFN(3, 0), PCI_IO_BASE, 1, &x); - o->read (&bus, PCI_DEVFN(3, 0), PCI_IO_BASE_UPPER16, 4, &x); - o->read (&bus, PCI_DEVFN(3, 0), PCI_MEMORY_BASE, 4, &x); - o->read (&bus, PCI_DEVFN(3, 0), PCI_PREF_MEMORY_BASE, 4, &x); - - o->write(&bus, PCI_DEVFN(3, 0), PCI_IO_BASE, 1, 0x01); - o->read (&bus, PCI_DEVFN(3, 0), PCI_IO_BASE, 1, &x); - o->write(&bus, PCI_DEVFN(3, 0), PCI_IO_BASE_UPPER16, 4, 0x00020000); - o->read (&bus, PCI_DEVFN(3, 0), PCI_IO_BASE_UPPER16, 4, &x); - o->write(&bus, PCI_DEVFN(3, 0), PCI_MEMORY_BASE, 4, 0xEBB0EA00); - o->read (&bus, PCI_DEVFN(3, 0), PCI_MEMORY_BASE, 4, &x); - o->write(&bus, PCI_DEVFN(3, 0), PCI_PREF_MEMORY_BASE, 4, 0xE9F0E800); - o->read (&bus, PCI_DEVFN(3, 0), PCI_PREF_MEMORY_BASE, 4, &x); - - unit_disable_pcnet(&bus, o); -} diff --git a/arch/mn10300/unit-asb2305/unit-init.c b/arch/mn10300/unit-asb2305/unit-init.c deleted file mode 100644 index bc4adfaf815c1..0000000000000 --- a/arch/mn10300/unit-asb2305/unit-init.c +++ /dev/null @@ -1,63 +0,0 @@ -/* ASB2305 Initialisation - * - * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * initialise some of the unit hardware before gdbstub is set up - */ -asmlinkage void __init unit_init(void) -{ -#ifndef CONFIG_GDBSTUB_ON_TTYSx - /* set the 16550 interrupt line to level 3 if not being used for GDB */ -#ifdef CONFIG_EXT_SERIAL_IRQ_LEVEL - set_intr_level(XIRQ0, NUM2GxICR_LEVEL(CONFIG_EXT_SERIAL_IRQ_LEVEL)); -#endif -#endif /* CONFIG_GDBSTUB_ON_TTYSx */ -} - -/* - * initialise the rest of the unit hardware after gdbstub is ready - */ -void __init unit_setup(void) -{ -#ifdef CONFIG_PCI - unit_pci_init(); -#endif -} - -/* - * initialise the external interrupts used by a unit of this type - */ -void __init unit_init_IRQ(void) -{ - unsigned int extnum; - - for (extnum = 0; extnum < NR_XIRQS; extnum++) { - switch (GET_XIRQ_TRIGGER(extnum)) { - case XIRQ_TRIGGER_HILEVEL: - case XIRQ_TRIGGER_LOWLEVEL: - mn10300_set_lateack_irq_type(XIRQ2IRQ(extnum)); - break; - default: - break; - } - } -} diff --git a/arch/mn10300/unit-asb2364/Makefile b/arch/mn10300/unit-asb2364/Makefile deleted file mode 100644 index b3263ecfc4ff2..0000000000000 --- a/arch/mn10300/unit-asb2364/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# -# Makefile for the linux kernel. -# -# Note! Dependencies are done automagically by 'make dep', which also -# removes any old dependencies. DON'T put your own dependencies here -# unless it's something special (ie not a .c file). -# -# Note 2! The CFLAGS definitions are now in the main makefile... - -obj-y := unit-init.o leds.o irq-fpga.o - -obj-$(CONFIG_SMSC911X) += smsc911x.o diff --git a/arch/mn10300/unit-asb2364/include/unit/clock.h b/arch/mn10300/unit-asb2364/include/unit/clock.h deleted file mode 100644 index d34ac9a7508b1..0000000000000 --- a/arch/mn10300/unit-asb2364/include/unit/clock.h +++ /dev/null @@ -1,29 +0,0 @@ -/* clock.h: unit-specific clocks - * - * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * Modified by Matsushita Electric Industrial Co., Ltd. - * Modifications: - * 23-Feb-2007 MEI Add define for watchdog timer. - * - * 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_UNIT_CLOCK_H -#define _ASM_UNIT_CLOCK_H - -#ifndef __ASSEMBLY__ - -#define MN10300_IOCLK 100000000UL /* for DDR800 */ -/*#define MN10300_IOCLK 83333333UL */ /* for DDR667 */ -#define MN10300_IOBCLK MN10300_IOCLK /* IOBCLK is equal to IOCLK */ - -#endif /* !__ASSEMBLY__ */ - -#define MN10300_WDCLK 27000000UL - -#endif /* _ASM_UNIT_CLOCK_H */ diff --git a/arch/mn10300/unit-asb2364/include/unit/fpga-regs.h b/arch/mn10300/unit-asb2364/include/unit/fpga-regs.h deleted file mode 100644 index 2901ed344b3de..0000000000000 --- a/arch/mn10300/unit-asb2364/include/unit/fpga-regs.h +++ /dev/null @@ -1,53 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* ASB2364 FPGA registers - */ - -#ifndef _ASM_UNIT_FPGA_REGS_H -#define _ASM_UNIT_FPGA_REGS_H - -#include - -#ifdef __KERNEL__ - -#define ASB2364_FPGA_REG_RESET_LAN __SYSREG(0xa9001300, u16) -#define ASB2364_FPGA_REG_RESET_UART __SYSREG(0xa9001304, u16) -#define ASB2364_FPGA_REG_RESET_I2C __SYSREG(0xa9001308, u16) -#define ASB2364_FPGA_REG_RESET_USB __SYSREG(0xa900130c, u16) -#define ASB2364_FPGA_REG_RESET_AV __SYSREG(0xa9001310, u16) - -#define ASB2364_FPGA_REG_IRQ(X) __SYSREG(0xa9001510+((X)*4), u16) -#define ASB2364_FPGA_REG_IRQ_LAN ASB2364_FPGA_REG_IRQ(0) -#define ASB2364_FPGA_REG_IRQ_UART ASB2364_FPGA_REG_IRQ(1) -#define ASB2364_FPGA_REG_IRQ_I2C ASB2364_FPGA_REG_IRQ(2) -#define ASB2364_FPGA_REG_IRQ_USB ASB2364_FPGA_REG_IRQ(3) -#define ASB2364_FPGA_REG_IRQ_FPGA ASB2364_FPGA_REG_IRQ(5) - -#define ASB2364_FPGA_REG_MASK(X) __SYSREG(0xa9001590+((X)*4), u16) -#define ASB2364_FPGA_REG_MASK_LAN ASB2364_FPGA_REG_MASK(0) -#define ASB2364_FPGA_REG_MASK_UART ASB2364_FPGA_REG_MASK(1) -#define ASB2364_FPGA_REG_MASK_I2C ASB2364_FPGA_REG_MASK(2) -#define ASB2364_FPGA_REG_MASK_USB ASB2364_FPGA_REG_MASK(3) -#define ASB2364_FPGA_REG_MASK_FPGA ASB2364_FPGA_REG_MASK(5) - -#define ASB2364_FPGA_REG_CPLD5_SET1 __SYSREG(0xa9002500, u16) -#define ASB2364_FPGA_REG_CPLD5_SET2 __SYSREG(0xa9002504, u16) -#define ASB2364_FPGA_REG_CPLD6_SET1 __SYSREG(0xa9002600, u16) -#define ASB2364_FPGA_REG_CPLD6_SET2 __SYSREG(0xa9002604, u16) -#define ASB2364_FPGA_REG_CPLD7_SET1 __SYSREG(0xa9002700, u16) -#define ASB2364_FPGA_REG_CPLD7_SET2 __SYSREG(0xa9002704, u16) -#define ASB2364_FPGA_REG_CPLD8_SET1 __SYSREG(0xa9002800, u16) -#define ASB2364_FPGA_REG_CPLD8_SET2 __SYSREG(0xa9002804, u16) -#define ASB2364_FPGA_REG_CPLD9_SET1 __SYSREG(0xa9002900, u16) -#define ASB2364_FPGA_REG_CPLD9_SET2 __SYSREG(0xa9002904, u16) -#define ASB2364_FPGA_REG_CPLD10_SET1 __SYSREG(0xa9002a00, u16) -#define ASB2364_FPGA_REG_CPLD10_SET2 __SYSREG(0xa9002a04, u16) - -#define SyncExBus() \ - do { \ - unsigned short w; \ - w = *(volatile short *)0xa9000000; \ - } while (0) - -#endif /* __KERNEL__ */ - -#endif /* _ASM_UNIT_FPGA_REGS_H */ diff --git a/arch/mn10300/unit-asb2364/include/unit/irq.h b/arch/mn10300/unit-asb2364/include/unit/irq.h deleted file mode 100644 index 786148e46565a..0000000000000 --- a/arch/mn10300/unit-asb2364/include/unit/irq.h +++ /dev/null @@ -1,35 +0,0 @@ -/* ASB2364 FPGA irq numbers - * - * Copyright (C) 2010 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ -#ifndef _UNIT_IRQ_H -#define _UNIT_IRQ_H - -#ifndef __ASSEMBLY__ - -#ifdef CONFIG_SMP -#define NR_CPU_IRQS GxICR_NUM_EXT_IRQS -#else -#define NR_CPU_IRQS GxICR_NUM_IRQS -#endif - -enum { - FPGA_LAN_IRQ = NR_CPU_IRQS, - FPGA_UART_IRQ, - FPGA_I2C_IRQ, - FPGA_USB_IRQ, - FPGA_RESERVED_IRQ, - FPGA_FPGA_IRQ, - NR_IRQS -}; - -extern void __init irq_fpga_init(void); - -#endif /* !__ASSEMBLY__ */ -#endif /* _UNIT_IRQ_H */ diff --git a/arch/mn10300/unit-asb2364/include/unit/leds.h b/arch/mn10300/unit-asb2364/include/unit/leds.h deleted file mode 100644 index 03a3933ad3238..0000000000000 --- a/arch/mn10300/unit-asb2364/include/unit/leds.h +++ /dev/null @@ -1,54 +0,0 @@ -/* Unit-specific leds - * - * Copyright (C) 2005 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#ifndef _ASM_UNIT_LEDS_H -#define _ASM_UNIT_LEDS_H - -#include -#include -#include - -#define MN10300_USE_7SEGLEDS 0 - -#define ASB2364_7SEGLEDS __SYSREG(0xA9001630, u32) - -/* - * use the 7-segment LEDs to indicate states - */ - -#if MN10300_USE_7SEGLEDS -/* flip the 7-segment LEDs between "Gdb-" and "----" */ -#define mn10300_set_gdbleds(ONOFF) \ - do { \ - ASB2364_7SEGLEDS = (ONOFF) ? 0x8543077f : 0x7f7f7f7f; \ - } while (0) -#else -#define mn10300_set_gdbleds(ONOFF) do {} while (0) -#endif - -#if MN10300_USE_7SEGLEDS -/* indicate double-fault by displaying "db-f" on the LEDs */ -#define mn10300_set_dbfleds \ - mov 0x43077f1d,d0 ; \ - mov d0,(ASB2364_7SEGLEDS) -#else -#define mn10300_set_dbfleds -#endif - -#ifndef __ASSEMBLY__ -extern void peripheral_leds_display_exception(enum exception_code); -extern void peripheral_leds_led_chase(void); -extern void peripheral_leds7x4_display_dec(unsigned int, unsigned int); -extern void peripheral_leds7x4_display_hex(unsigned int, unsigned int); -extern void debug_to_serial(const char *, int); -#endif /* __ASSEMBLY__ */ - -#endif /* _ASM_UNIT_LEDS_H */ diff --git a/arch/mn10300/unit-asb2364/include/unit/serial.h b/arch/mn10300/unit-asb2364/include/unit/serial.h deleted file mode 100644 index 92f224a97efcc..0000000000000 --- a/arch/mn10300/unit-asb2364/include/unit/serial.h +++ /dev/null @@ -1,151 +0,0 @@ -/* Unit-specific 8250 serial ports - * - * Copyright (C) 2005 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#ifndef _ASM_UNIT_SERIAL_H -#define _ASM_UNIT_SERIAL_H - -#include -#include -#include -#include - -#define SERIAL_PORT0_BASE_ADDRESS 0xA8200000 - -#define SERIAL_IRQ XIRQ1 /* single serial (TL16C550C) (Lo) */ - -/* - * The ASB2364 has an 12.288 MHz clock - * for your UART. - * - * It'd be nice if someone built a serial card with a 24.576 MHz - * clock, since the 16550A is capable of handling a top speed of 1.5 - * megabits/second; but this requires the faster clock. - */ -#define BASE_BAUD (12288000 / 16) - -/* - * dispose of the /dev/ttyS0 and /dev/ttyS1 serial ports - */ -#ifndef CONFIG_GDBSTUB_ON_TTYSx - -#define SERIAL_PORT_DFNS \ - { \ - .baud_base = BASE_BAUD, \ - .irq = SERIAL_IRQ, \ - .flags = STD_COM_FLAGS, \ - .iomem_base = (u8 *) SERIAL_PORT0_BASE_ADDRESS, \ - .iomem_reg_shift = 1, \ - .io_type = SERIAL_IO_MEM, \ - }, - -#ifndef __ASSEMBLY__ - -static inline void __debug_to_serial(const char *p, int n) -{ -} - -#endif /* !__ASSEMBLY__ */ - -#else /* CONFIG_GDBSTUB_ON_TTYSx */ - -#define SERIAL_PORT_DFNS /* stolen by gdb-stub */ - -#if defined(CONFIG_GDBSTUB_ON_TTYS0) -#define GDBPORT_SERIAL_RX __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_RX * 2, u8) -#define GDBPORT_SERIAL_TX __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_TX * 2, u8) -#define GDBPORT_SERIAL_DLL __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_DLL * 2, u8) -#define GDBPORT_SERIAL_DLM __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_DLM * 2, u8) -#define GDBPORT_SERIAL_IER __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_IER * 2, u8) -#define GDBPORT_SERIAL_IIR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_IIR * 2, u8) -#define GDBPORT_SERIAL_FCR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_FCR * 2, u8) -#define GDBPORT_SERIAL_LCR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_LCR * 2, u8) -#define GDBPORT_SERIAL_MCR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_MCR * 2, u8) -#define GDBPORT_SERIAL_LSR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_LSR * 2, u8) -#define GDBPORT_SERIAL_MSR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_MSR * 2, u8) -#define GDBPORT_SERIAL_SCR __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_SCR * 2, u8) -#define GDBPORT_SERIAL_IRQ SERIAL_IRQ - -#elif defined(CONFIG_GDBSTUB_ON_TTYS1) -#error The ASB2364 does not have a /dev/ttyS1 -#endif - -#ifndef __ASSEMBLY__ - -static inline void __debug_to_serial(const char *p, int n) -{ - char ch; - -#define LSR_WAIT_FOR(STATE) \ - do {} while (!(GDBPORT_SERIAL_LSR & UART_LSR_##STATE)) -#define FLOWCTL_QUERY(LINE) \ - ({ GDBPORT_SERIAL_MSR & UART_MSR_##LINE; }) -#define FLOWCTL_WAIT_FOR(LINE) \ - do {} while (!(GDBPORT_SERIAL_MSR & UART_MSR_##LINE)) -#define FLOWCTL_CLEAR(LINE) \ - do { GDBPORT_SERIAL_MCR &= ~UART_MCR_##LINE; } while (0) -#define FLOWCTL_SET(LINE) \ - do { GDBPORT_SERIAL_MCR |= UART_MCR_##LINE; } while (0) - - FLOWCTL_SET(DTR); - - for (; n > 0; n--) { - LSR_WAIT_FOR(THRE); - FLOWCTL_WAIT_FOR(CTS); - - ch = *p++; - if (ch == 0x0a) { - GDBPORT_SERIAL_TX = 0x0d; - LSR_WAIT_FOR(THRE); - FLOWCTL_WAIT_FOR(CTS); - } - GDBPORT_SERIAL_TX = ch; - } - - FLOWCTL_CLEAR(DTR); -} - -#endif /* !__ASSEMBLY__ */ - -#endif /* CONFIG_GDBSTUB_ON_TTYSx */ - -#define SERIAL_INITIALIZE \ -do { \ - /* release reset */ \ - ASB2364_FPGA_REG_RESET_UART = 0x0001; \ - SyncExBus(); \ -} while (0) - -#define SERIAL_CHECK_INTERRUPT \ -do { \ - if ((ASB2364_FPGA_REG_IRQ_UART & 0x0001) == 0x0001) { \ - return IRQ_NONE; \ - } \ -} while (0) - -#define SERIAL_CLEAR_INTERRUPT \ -do { \ - ASB2364_FPGA_REG_IRQ_UART = 0x0001; \ - SyncExBus(); \ -} while (0) - -#define SERIAL_SET_INT_MASK \ -do { \ - ASB2364_FPGA_REG_MASK_UART = 0x0001; \ - SyncExBus(); \ -} while (0) - -#define SERIAL_CLEAR_INT_MASK \ -do { \ - ASB2364_FPGA_REG_MASK_UART = 0x0000; \ - SyncExBus(); \ -} while (0) - -#endif /* _ASM_UNIT_SERIAL_H */ diff --git a/arch/mn10300/unit-asb2364/include/unit/smsc911x.h b/arch/mn10300/unit-asb2364/include/unit/smsc911x.h deleted file mode 100644 index 4c1ede535fa96..0000000000000 --- a/arch/mn10300/unit-asb2364/include/unit/smsc911x.h +++ /dev/null @@ -1,171 +0,0 @@ -/* Support for the SMSC911x NIC - * - * Copyright (C) 2006 Matsushita Electric Industrial Co., Ltd. - * All Rights Reserved. - * - * 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_UNIT_SMSC911X_H -#define _ASM_UNIT_SMSC911X_H - -#include -#include -#include - -#define MN10300_USE_EXT_EEPROM - - -#define SMSC911X_BASE 0xA8000000UL -#define SMSC911X_BASE_END 0xA8000100UL -#define SMSC911X_IRQ FPGA_LAN_IRQ - -/* - * Allow the FPGA to be initialised by the SMSC911x driver - */ -#undef SMSC_INITIALIZE -#define SMSC_INITIALIZE() \ -do { \ - /* release reset */ \ - ASB2364_FPGA_REG_RESET_LAN = 0x0001; \ - SyncExBus(); \ -} while (0) - -#ifdef MN10300_USE_EXT_EEPROM -#include -#include - -#define EEPROM_ADDRESS 0xA0 -#define MAC_OFFSET 0x0008 -#define USE_IIC_CH 0 /* 0 or 1 */ -#define IIC_OFFSET (0x80000 * USE_IIC_CH) -#define IIC_DTRM __SYSREG(0xd8400000 + IIC_OFFSET, u32) -#define IIC_DREC __SYSREG(0xd8400004 + IIC_OFFSET, u32) -#define IIC_MYADD __SYSREG(0xd8400008 + IIC_OFFSET, u32) -#define IIC_CLK __SYSREG(0xd840000c + IIC_OFFSET, u32) -#define IIC_BRST __SYSREG(0xd8400010 + IIC_OFFSET, u32) -#define IIC_HOLD __SYSREG(0xd8400014 + IIC_OFFSET, u32) -#define IIC_BSTS __SYSREG(0xd8400018 + IIC_OFFSET, u32) -#define IIC_ICR __SYSREG(0xd4000080 + 4 * USE_IIC_CH, u16) - -#define IIC_CLK_PLS ((unsigned short)(MN10300_IOCLK / 100000 - 1)) -#define IIC_CLK_LOW ((unsigned short)(IIC_CLK_PLS / 2)) - -#define SYS_IIC_DTRM_Bit_STA ((unsigned short)0x0400) -#define SYS_IIC_DTRM_Bit_STO ((unsigned short)0x0200) -#define SYS_IIC_DTRM_Bit_ACK ((unsigned short)0x0100) -#define SYS_IIC_DTRM_Bit_DATA ((unsigned short)0x00FF) - -static inline void POLL_INT_REQ(volatile u16 *icr) -{ - unsigned long flags; - u16 tmp; - - while (!(*icr & GxICR_REQUEST)) - ; - flags = arch_local_cli_save(); - tmp = *icr; - *icr = (tmp & GxICR_LEVEL) | GxICR_DETECT; - tmp = *icr; - arch_local_irq_restore(flags); -} - -/* - * Implement the SMSC911x hook for MAC address retrieval - */ -#undef smsc_get_mac -static inline int smsc_get_mac(struct net_device *dev) -{ - unsigned char *mac_buf = dev->dev_addr; - int i; - unsigned short value; - unsigned int data; - int mac_length = 6; - int check; - u16 orig_gicr, tmp; - unsigned long flags; - - /* save original GnICR and clear GnICR.IE */ - flags = arch_local_cli_save(); - orig_gicr = IIC_ICR; - IIC_ICR = orig_gicr & GxICR_LEVEL; - tmp = IIC_ICR; - arch_local_irq_restore(flags); - - IIC_MYADD = 0x00000008; - IIC_CLK = (IIC_CLK_LOW << 16) + (IIC_CLK_PLS); - /* bus hung recovery */ - - while (1) { - check = 0; - for (i = 0; i < 3; i++) { - if ((IIC_BSTS & 0x00000003) == 0x00000003) - check++; - udelay(3); - } - - if (check == 3) { - IIC_BRST = 0x00000003; - break; - } else { - for (i = 0; i < 3; i++) { - IIC_BRST = 0x00000002; - udelay(8); - IIC_BRST = 0x00000003; - udelay(8); - } - } - } - - IIC_BRST = 0x00000002; - IIC_BRST = 0x00000003; - - value = SYS_IIC_DTRM_Bit_STA | SYS_IIC_DTRM_Bit_ACK; - value |= (((unsigned short)EEPROM_ADDRESS & SYS_IIC_DTRM_Bit_DATA) | - (unsigned short)0x0000); - IIC_DTRM = value; - POLL_INT_REQ(&IIC_ICR); - - /** send offset of MAC address in EEPROM **/ - IIC_DTRM = (unsigned char)((MAC_OFFSET & 0xFF00) >> 8); - POLL_INT_REQ(&IIC_ICR); - - IIC_DTRM = (unsigned char)(MAC_OFFSET & 0x00FF); - POLL_INT_REQ(&IIC_ICR); - - udelay(1000); - - value = SYS_IIC_DTRM_Bit_STA; - value |= (((unsigned short)EEPROM_ADDRESS & SYS_IIC_DTRM_Bit_DATA) | - (unsigned short)0x0001); - IIC_DTRM = value; - POLL_INT_REQ(&IIC_ICR); - - IIC_DTRM = 0x00000000; - while (mac_length > 0) { - POLL_INT_REQ(&IIC_ICR); - - data = IIC_DREC; - mac_length--; - if (mac_length == 0) - value = 0x00000300; /* stop IIC bus */ - else if (mac_length == 1) - value = 0x00000100; /* no ack */ - else - value = 0x00000000; /* ack */ - IIC_DTRM = value; - *mac_buf++ = (unsigned char)(data & 0xff); - } - - /* restore GnICR.LV and GnICR.IE */ - flags = arch_local_cli_save(); - IIC_ICR = (orig_gicr & (GxICR_LEVEL | GxICR_ENABLE)); - tmp = IIC_ICR; - arch_local_irq_restore(flags); - - return 0; -} -#endif /* MN10300_USE_EXT_EEPROM */ -#endif /* _ASM_UNIT_SMSC911X_H */ diff --git a/arch/mn10300/unit-asb2364/include/unit/timex.h b/arch/mn10300/unit-asb2364/include/unit/timex.h deleted file mode 100644 index 42f32db75087c..0000000000000 --- a/arch/mn10300/unit-asb2364/include/unit/timex.h +++ /dev/null @@ -1,155 +0,0 @@ -/* timex.h: MN2WS0038 architecture timer specifications - * - * Copyright (C) 2002, 2010 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ -#ifndef _ASM_UNIT_TIMEX_H -#define _ASM_UNIT_TIMEX_H - -#include -#include -#include - -/* - * jiffies counter specifications - */ - -#define TMJCBR_MAX 0xffffff /* 24bit */ -#define TMJCIRQ TMTIRQ - -#ifndef __ASSEMBLY__ - -#define MN10300_SRC_IOBCLK MN10300_IOBCLK - -#ifndef HZ -# error HZ undeclared. -#endif /* !HZ */ - -#define MN10300_JCCLK (MN10300_SRC_IOBCLK) -#define MN10300_TSCCLK (MN10300_SRC_IOBCLK) - -#define MN10300_JC_PER_HZ ((MN10300_JCCLK + HZ / 2) / HZ) -#define MN10300_TSC_PER_HZ ((MN10300_TSCCLK + HZ / 2) / HZ) - -/* Check bit width of MTM interval value that sets base register */ -#if (MN10300_JC_PER_HZ - 1) > TMJCBR_MAX -# error MTM tick timer interval value is overflow. -#endif - -static inline void stop_jiffies_counter(void) -{ - u16 tmp; - TMTMD = 0; - tmp = TMTMD; -} - -static inline void reload_jiffies_counter(u32 cnt) -{ - u32 tmp; - - TMTBR = cnt; - tmp = TMTBR; - - TMTMD = TMTMD_TMTLDE; - TMTMD = TMTMD_TMTCNE; - tmp = TMTMD; -} - -#if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_CLOCKEVENTS) && \ - !defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) -/* - * If we aren't using broadcasting, each core needs its own event timer. - * Since CPU0 uses the tick timer which is 24-bits, we use timer 4 & 5 - * cascaded to 32-bits for CPU1 (but only really use 24-bits to match - * CPU0). - */ - -#define TMJC1IRQ TM5IRQ - -static inline void stop_jiffies_counter1(void) -{ - u8 tmp; - TM4MD = 0; - TM5MD = 0; - tmp = TM4MD; - tmp = TM5MD; -} - -static inline void reload_jiffies_counter1(u32 cnt) -{ - u32 tmp; - - TM45BR = cnt; - tmp = TM45BR; - - TM4MD = TM4MD_INIT_COUNTER; - tmp = TM4MD; - - TM5MD = TM5MD_SRC_TM4CASCADE | TM5MD_INIT_COUNTER; - TM5MD = TM5MD_SRC_TM4CASCADE | TM5MD_COUNT_ENABLE; - tmp = TM5MD; - - TM4MD = TM4MD_COUNT_ENABLE; - tmp = TM4MD; -} -#endif /* CONFIG_SMP&GENERIC_CLOCKEVENTS&!GENERIC_CLOCKEVENTS_BROADCAST */ - -#endif /* !__ASSEMBLY__ */ - - -/* - * timestamp counter specifications - */ -#define TMTSCBR_MAX 0xffffffff - -#ifndef __ASSEMBLY__ - -/* Use 32-bit timestamp counter */ -#define TMTSCMD TMSMD -#define TMTSCBR TMSBR -#define TMTSCBC TMSBC -#define TMTSCICR TMSICR - -static inline void startup_timestamp_counter(void) -{ - u32 sync; - - /* set up TMS(Timestamp) 32bit timer register to count real time - * - count down from 4Gig-1 to 0 and wrap at IOBCLK rate - */ - - TMTSCBR = TMTSCBR_MAX; - sync = TMTSCBR; - - TMTSCICR = 0; - sync = TMTSCICR; - - TMTSCMD = TMTMD_TMTLDE; - TMTSCMD = TMTMD_TMTCNE; - sync = TMTSCMD; -} - -static inline void shutdown_timestamp_counter(void) -{ - TMTSCMD = 0; -} - -/* - * we use a cascaded pair of 16-bit down-counting timers to count I/O - * clock cycles for the purposes of time keeping - */ -typedef unsigned long cycles_t; - -static inline cycles_t read_timestamp_counter(void) -{ - return (cycles_t)~TMTSCBC; -} - -#endif /* !__ASSEMBLY__ */ - -#endif /* _ASM_UNIT_TIMEX_H */ diff --git a/arch/mn10300/unit-asb2364/irq-fpga.c b/arch/mn10300/unit-asb2364/irq-fpga.c deleted file mode 100644 index 073e2ccc4a441..0000000000000 --- a/arch/mn10300/unit-asb2364/irq-fpga.c +++ /dev/null @@ -1,108 +0,0 @@ -/* ASB2364 FPGA interrupt multiplexing - * - * Copyright (C) 2010 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - -#include -#include -#include -#include - -/* - * FPGA PIC operations - */ -static void asb2364_fpga_mask(struct irq_data *d) -{ - ASB2364_FPGA_REG_MASK(d->irq - NR_CPU_IRQS) = 0x0001; - SyncExBus(); -} - -static void asb2364_fpga_ack(struct irq_data *d) -{ - ASB2364_FPGA_REG_IRQ(d->irq - NR_CPU_IRQS) = 0x0001; - SyncExBus(); -} - -static void asb2364_fpga_mask_ack(struct irq_data *d) -{ - ASB2364_FPGA_REG_MASK(d->irq - NR_CPU_IRQS) = 0x0001; - SyncExBus(); - ASB2364_FPGA_REG_IRQ(d->irq - NR_CPU_IRQS) = 0x0001; - SyncExBus(); -} - -static void asb2364_fpga_unmask(struct irq_data *d) -{ - ASB2364_FPGA_REG_MASK(d->irq - NR_CPU_IRQS) = 0x0000; - SyncExBus(); -} - -static struct irq_chip asb2364_fpga_pic = { - .name = "fpga", - .irq_ack = asb2364_fpga_ack, - .irq_mask = asb2364_fpga_mask, - .irq_mask_ack = asb2364_fpga_mask_ack, - .irq_unmask = asb2364_fpga_unmask, -}; - -/* - * FPGA PIC interrupt handler - */ -static irqreturn_t fpga_interrupt(int irq, void *_mask) -{ - if ((ASB2364_FPGA_REG_IRQ_LAN & 0x0001) != 0x0001) - generic_handle_irq(FPGA_LAN_IRQ); - if ((ASB2364_FPGA_REG_IRQ_UART & 0x0001) != 0x0001) - generic_handle_irq(FPGA_UART_IRQ); - if ((ASB2364_FPGA_REG_IRQ_I2C & 0x0001) != 0x0001) - generic_handle_irq(FPGA_I2C_IRQ); - if ((ASB2364_FPGA_REG_IRQ_USB & 0x0001) != 0x0001) - generic_handle_irq(FPGA_USB_IRQ); - if ((ASB2364_FPGA_REG_IRQ_FPGA & 0x0001) != 0x0001) - generic_handle_irq(FPGA_FPGA_IRQ); - - return IRQ_HANDLED; -} - -/* - * Define an interrupt action for each FPGA PIC output - */ -static struct irqaction fpga_irq[] = { - [0] = { - .handler = fpga_interrupt, - .flags = IRQF_SHARED, - .name = "fpga", - }, -}; - -/* - * Initialise the FPGA's PIC - */ -void __init irq_fpga_init(void) -{ - int irq; - - ASB2364_FPGA_REG_MASK_LAN = 0x0001; - SyncExBus(); - ASB2364_FPGA_REG_MASK_UART = 0x0001; - SyncExBus(); - ASB2364_FPGA_REG_MASK_I2C = 0x0001; - SyncExBus(); - ASB2364_FPGA_REG_MASK_USB = 0x0001; - SyncExBus(); - ASB2364_FPGA_REG_MASK_FPGA = 0x0001; - SyncExBus(); - - for (irq = NR_CPU_IRQS; irq < NR_IRQS; irq++) - irq_set_chip_and_handler(irq, &asb2364_fpga_pic, - handle_level_irq); - - /* the FPGA drives the XIRQ1 input on the CPU PIC */ - setup_irq(XIRQ1, &fpga_irq[0]); -} diff --git a/arch/mn10300/unit-asb2364/leds.c b/arch/mn10300/unit-asb2364/leds.c deleted file mode 100644 index 1ff830c372b31..0000000000000 --- a/arch/mn10300/unit-asb2364/leds.c +++ /dev/null @@ -1,98 +0,0 @@ -/* leds.c: ASB2364 peripheral 7seg LEDs x4 support - * - * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#include -#include -#include - -#include -#include -#include -#include -#include - -#if MN10300_USE_7SEGLEDS -static const u8 asb2364_led_hex_tbl[16] = { - 0x80, 0xf2, 0x48, 0x60, 0x32, 0x24, 0x04, 0xf0, - 0x00, 0x20, 0x10, 0x06, 0x8c, 0x42, 0x0c, 0x1c -}; - -static const u32 asb2364_led_chase_tbl[6] = { - ~0x02020202, /* top - segA */ - ~0x04040404, /* right top - segB */ - ~0x08080808, /* right bottom - segC */ - ~0x10101010, /* bottom - segD */ - ~0x20202020, /* left bottom - segE */ - ~0x40404040, /* left top - segF */ -}; - -static unsigned asb2364_led_chase; - -void peripheral_leds7x4_display_dec(unsigned int val, unsigned int points) -{ - u32 leds; - - leds = asb2364_led_hex_tbl[(val/1000) % 10]; - leds <<= 8; - leds |= asb2364_led_hex_tbl[(val/100) % 10]; - leds <<= 8; - leds |= asb2364_led_hex_tbl[(val/10) % 10]; - leds <<= 8; - leds |= asb2364_led_hex_tbl[val % 10]; - leds |= points^0x01010101; - - ASB2364_7SEGLEDS = leds; -} - -void peripheral_leds7x4_display_hex(unsigned int val, unsigned int points) -{ - u32 leds; - - leds = asb2364_led_hex_tbl[(val/1000) % 10]; - leds <<= 8; - leds |= asb2364_led_hex_tbl[(val/100) % 10]; - leds <<= 8; - leds |= asb2364_led_hex_tbl[(val/10) % 10]; - leds <<= 8; - leds |= asb2364_led_hex_tbl[val % 10]; - leds |= points^0x01010101; - - ASB2364_7SEGLEDS = leds; -} - -/* display triple horizontal bar and exception code */ -void peripheral_leds_display_exception(enum exception_code code) -{ - u32 leds; - - leds = asb2364_led_hex_tbl[(code/0x100) % 0x10]; - leds <<= 8; - leds |= asb2364_led_hex_tbl[(code/0x10) % 0x10]; - leds <<= 8; - leds |= asb2364_led_hex_tbl[code % 0x10]; - leds |= 0x6d010101; - - ASB2364_7SEGLEDS = leds; -} - -void peripheral_leds_led_chase(void) -{ - ASB2364_7SEGLEDS = asb2364_led_chase_tbl[asb2364_led_chase]; - asb2364_led_chase++; - if (asb2364_led_chase >= 6) - asb2364_led_chase = 0; -} -#else /* MN10300_USE_7SEGLEDS */ -void peripheral_leds7x4_display_dec(unsigned int val, unsigned int points) { } -void peripheral_leds7x4_display_hex(unsigned int val, unsigned int points) { } -void peripheral_leds_display_exception(enum exception_code code) { } -void peripheral_leds_led_chase(void) { } -#endif /* MN10300_USE_7SEGLEDS */ diff --git a/arch/mn10300/unit-asb2364/smsc911x.c b/arch/mn10300/unit-asb2364/smsc911x.c deleted file mode 100644 index 544a73e94c810..0000000000000 --- a/arch/mn10300/unit-asb2364/smsc911x.c +++ /dev/null @@ -1,58 +0,0 @@ -/* Specification for the SMSC911x NIC - * - * Copyright (C) 2006 Matsushita Electric Industrial Co., Ltd. - * All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include -#include - -static struct smsc911x_platform_config smsc911x_config = { - .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, - .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN, - .flags = SMSC911X_USE_32BIT, -}; - -static struct resource smsc911x_resources[] = { - [0] = { - .start = SMSC911X_BASE, - .end = SMSC911X_BASE_END, - .flags = IORESOURCE_MEM, - }, - [1] = { - .start = SMSC911X_IRQ, - .end = SMSC911X_IRQ, - .flags = IORESOURCE_IRQ, - }, -}; - -static struct platform_device smsc911x_device = { - .name = "smsc911x", - .id = 0, - .num_resources = ARRAY_SIZE(smsc911x_resources), - .resource = smsc911x_resources, - .dev = { - .platform_data = &smsc911x_config, - } -}; - -/* - * add platform devices - */ -static int __init unit_device_init(void) -{ - platform_device_register(&smsc911x_device); - return 0; -} - -device_initcall(unit_device_init); diff --git a/arch/mn10300/unit-asb2364/unit-init.c b/arch/mn10300/unit-asb2364/unit-init.c deleted file mode 100644 index 6359b41ce7e97..0000000000000 --- a/arch/mn10300/unit-asb2364/unit-init.c +++ /dev/null @@ -1,132 +0,0 @@ -/* ASB2364 initialisation - * - * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define TTYS0_SERIAL_IER __SYSREG(SERIAL_PORT0_BASE_ADDRESS + UART_IER * 2, u8) -#define LAN_IRQ_CFG __SYSREG(SMSC911X_BASE + 0x54, u32) -#define LAN_INT_EN __SYSREG(SMSC911X_BASE + 0x5c, u32) - -/* - * initialise some of the unit hardware before gdbstub is set up - */ -asmlinkage void __init unit_init(void) -{ - /* Make sure we aren't going to get unexpected interrupts */ - TTYS0_SERIAL_IER = 0; - SC0RXICR = 0; - SC0TXICR = 0; - SC1RXICR = 0; - SC1TXICR = 0; - SC2RXICR = 0; - SC2TXICR = 0; - - /* Attempt to reset the FPGA attached peripherals */ - ASB2364_FPGA_REG_RESET_LAN = 0x0000; - SyncExBus(); - ASB2364_FPGA_REG_RESET_UART = 0x0000; - SyncExBus(); - ASB2364_FPGA_REG_RESET_I2C = 0x0000; - SyncExBus(); - ASB2364_FPGA_REG_RESET_USB = 0x0000; - SyncExBus(); - ASB2364_FPGA_REG_RESET_AV = 0x0000; - SyncExBus(); - - /* set up the external interrupts */ - - /* XIRQ[0]: NAND RXBY */ - /* SET_XIRQ_TRIGGER(0, XIRQ_TRIGGER_LOWLEVEL); */ - - /* XIRQ[1]: LAN, UART, I2C, USB, PCI, FPGA */ - SET_XIRQ_TRIGGER(1, XIRQ_TRIGGER_LOWLEVEL); - - /* XIRQ[2]: Extend Slot 1-9 */ - /* SET_XIRQ_TRIGGER(2, XIRQ_TRIGGER_LOWLEVEL); */ - -#if defined(CONFIG_EXT_SERIAL_IRQ_LEVEL) && \ - defined(CONFIG_ETHERNET_IRQ_LEVEL) && \ - (CONFIG_EXT_SERIAL_IRQ_LEVEL != CONFIG_ETHERNET_IRQ_LEVEL) -# error CONFIG_EXT_SERIAL_IRQ_LEVEL != CONFIG_ETHERNET_IRQ_LEVEL -#endif - -#if defined(CONFIG_EXT_SERIAL_IRQ_LEVEL) - set_intr_level(XIRQ1, NUM2GxICR_LEVEL(CONFIG_EXT_SERIAL_IRQ_LEVEL)); -#elif defined(CONFIG_ETHERNET_IRQ_LEVEL) - set_intr_level(XIRQ1, NUM2GxICR_LEVEL(CONFIG_ETHERNET_IRQ_LEVEL)); -#endif -} - -/* - * initialise the rest of the unit hardware after gdbstub is ready - */ -asmlinkage void __init unit_setup(void) -{ - /* Release the reset on the SMSC911X so that it is ready by the time we - * need it */ - ASB2364_FPGA_REG_RESET_LAN = 0x0001; - SyncExBus(); - ASB2364_FPGA_REG_RESET_UART = 0x0001; - SyncExBus(); - ASB2364_FPGA_REG_RESET_I2C = 0x0001; - SyncExBus(); - ASB2364_FPGA_REG_RESET_USB = 0x0001; - SyncExBus(); - ASB2364_FPGA_REG_RESET_AV = 0x0001; - SyncExBus(); - - /* Make sure the ethernet chipset isn't going to give us an interrupt - * storm from stuff it was doing pre-reset */ - LAN_IRQ_CFG = 0; - LAN_INT_EN = 0; -} - -/* - * initialise the external interrupts used by a unit of this type - */ -void __init unit_init_IRQ(void) -{ - unsigned int extnum; - - for (extnum = 0 ; extnum < NR_XIRQS ; extnum++) { - switch (GET_XIRQ_TRIGGER(extnum)) { - /* LEVEL triggered interrupts should be made - * post-ACK'able as they hold their lines until - * serviced - */ - case XIRQ_TRIGGER_HILEVEL: - case XIRQ_TRIGGER_LOWLEVEL: - mn10300_set_lateack_irq_type(XIRQ2IRQ(extnum)); - break; - default: - break; - } - } - -#define IRQCTL __SYSREG(0xd5000090, u32) - IRQCTL |= 0x02; - - irq_fpga_init(); -} diff --git a/crypto/sha3_generic.c b/crypto/sha3_generic.c index ded1487833033..264ec12c0b9c3 100644 --- a/crypto/sha3_generic.c +++ b/crypto/sha3_generic.c @@ -21,7 +21,7 @@ #include /* - * On some 32-bit architectures (mn10300 and h8300), GCC ends up using + * On some 32-bit architectures (h8300), GCC ends up using * over 1 KB of stack if we inline the round calculation into the loop * in keccakf(). On the other hand, on 64-bit architectures with plenty * of [64-bit wide] general purpose registers, not inlining it severely diff --git a/drivers/input/joystick/analog.c b/drivers/input/joystick/analog.c index c868a878c84f1..be1b4921f22a6 100644 --- a/drivers/input/joystick/analog.c +++ b/drivers/input/joystick/analog.c @@ -163,7 +163,7 @@ static unsigned int get_time_pit(void) #define GET_TIME(x) do { x = (unsigned int)rdtsc(); } while (0) #define DELTA(x,y) ((y)-(x)) #define TIME_NAME "TSC" -#elif defined(__alpha__) || defined(CONFIG_MN10300) || defined(CONFIG_ARM) || defined(CONFIG_ARM64) || defined(CONFIG_RISCV) || defined(CONFIG_TILE) +#elif defined(__alpha__) || defined(CONFIG_ARM) || defined(CONFIG_ARM64) || defined(CONFIG_RISCV) || defined(CONFIG_TILE) #define GET_TIME(x) do { x = get_cycles(); } while (0) #define DELTA(x,y) ((y)-(x)) #define TIME_NAME "get_cycles" diff --git a/drivers/net/ethernet/smsc/Kconfig b/drivers/net/ethernet/smsc/Kconfig index 4c2f612e4414d..948603e9b9054 100644 --- a/drivers/net/ethernet/smsc/Kconfig +++ b/drivers/net/ethernet/smsc/Kconfig @@ -6,7 +6,7 @@ config NET_VENDOR_SMSC bool "SMC (SMSC)/Western Digital devices" default y depends on ARM || ARM64 || ATARI_ETHERNAT || BLACKFIN || COLDFIRE || \ - ISA || M32R || MAC || MIPS || MN10300 || NIOS2 || PCI || \ + ISA || M32R || MAC || MIPS || NIOS2 || PCI || \ PCMCIA || SUPERH || XTENSA || H8300 ---help--- If you have a network (Ethernet) card belonging to this class, say Y. @@ -38,7 +38,7 @@ config SMC91X select MII depends on !OF || GPIOLIB depends on ARM || ARM64 || ATARI_ETHERNAT || BLACKFIN || COLDFIRE || \ - M32R || MIPS || MN10300 || NIOS2 || SUPERH || XTENSA || H8300 + M32R || MIPS || NIOS2 || SUPERH || XTENSA || H8300 ---help--- This is a driver for SMC's 91x series of Ethernet chipsets, including the SMC91C94 and the SMC91C111. Say Y if you want it @@ -77,7 +77,7 @@ config SMC911X tristate "SMSC LAN911[5678] support" select CRC32 select MII - depends on (ARM || SUPERH || MN10300) + depends on (ARM || SUPERH) ---help--- This is a driver for SMSC's LAN911x series of Ethernet chipsets including the new LAN9115, LAN9116, LAN9117, and LAN9118. diff --git a/drivers/net/ethernet/smsc/smc91x.h b/drivers/net/ethernet/smsc/smc91x.h index 08b17adf0a658..8445622dc4cf2 100644 --- a/drivers/net/ethernet/smsc/smc91x.h +++ b/drivers/net/ethernet/smsc/smc91x.h @@ -162,14 +162,6 @@ static inline void _SMC_outw_align4(u16 val, void __iomem *ioaddr, int reg, #define RPC_LSA_DEFAULT RPC_LED_TX_RX #define RPC_LSB_DEFAULT RPC_LED_100_10 -#elif defined(CONFIG_MN10300) - -/* - * MN10300/AM33 configuration - */ - -#include - #elif defined(CONFIG_ATARI) #define SMC_CAN_USE_8BIT 1 diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index 8ab5f0a5d3236..be5a3dc99c118 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig @@ -868,7 +868,7 @@ comment "Platform RTC drivers" config RTC_DRV_CMOS tristate "PC-style 'CMOS'" - depends on X86 || ARM || M32R || PPC || MIPS || SPARC64 || MN10300 + depends on X86 || ARM || M32R || PPC || MIPS || SPARC64 default y if X86 select RTC_MC146818_LIB help diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c index 9dca53df35845..f7c0f72abb56f 100644 --- a/drivers/rtc/rtc-cmos.c +++ b/drivers/rtc/rtc-cmos.c @@ -711,7 +711,7 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq) address_space = 64; #elif defined(__i386__) || defined(__x86_64__) || defined(__arm__) \ || defined(__sparc__) || defined(__mips__) \ - || defined(__powerpc__) || defined(CONFIG_MN10300) + || defined(__powerpc__) address_space = 128; #else #warning Assuming 128 bytes of RTC+NVRAM address space, not 64 bytes. diff --git a/drivers/staging/speakup/Kconfig b/drivers/staging/speakup/Kconfig index 7e8037e230b8e..efd6f4560d3e5 100644 --- a/drivers/staging/speakup/Kconfig +++ b/drivers/staging/speakup/Kconfig @@ -1,7 +1,7 @@ menu "Speakup console speech" config SPEAKUP - depends on VT && !MN10300 + depends on VT tristate "Speakup core" ---help--- This is the Speakup screen reader. Think of it as a diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig index 7f1f1fbcef9e2..005ed87c8216f 100644 --- a/drivers/video/console/Kconfig +++ b/drivers/video/console/Kconfig @@ -7,7 +7,7 @@ menu "Console display driver support" config VGA_CONSOLE bool "VGA text console" if EXPERT || !X86 depends on !4xx && !PPC_8xx && !SPARC && !M68K && !PARISC && !FRV && \ - !SUPERH && !BLACKFIN && !AVR32 && !MN10300 && !CRIS && \ + !SUPERH && !BLACKFIN && !AVR32 && !CRIS && \ (!ARM || ARCH_FOOTBRIDGE || ARCH_INTEGRATOR || ARCH_NETWINDER) && \ !ARM64 && !ARC && !MICROBLAZE && !OPENRISC default y diff --git a/include/asm-generic/atomic.h b/include/asm-generic/atomic.h index 3f38eb03649c9..abe6dd9ca2a86 100644 --- a/include/asm-generic/atomic.h +++ b/include/asm-generic/atomic.h @@ -2,8 +2,6 @@ * Generic C implementation of atomic counter operations. Usable on * UP systems only. Do not include in machine independent code. * - * Originally implemented for MN10300. - * * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. * Written by David Howells (dhowells@redhat.com) * diff --git a/include/asm-generic/barrier.h b/include/asm-generic/barrier.h index fe297b599b0a1..29458bbb2fa04 100644 --- a/include/asm-generic/barrier.h +++ b/include/asm-generic/barrier.h @@ -1,5 +1,5 @@ /* - * Generic barrier definitions, originally based on MN10300 definitions. + * Generic barrier definitions. * * It should be possible to use these on really simple architectures, * but it serves more as a starting point for new ports. diff --git a/include/asm-generic/exec.h b/include/asm-generic/exec.h index 567766b0074ae..32c0a216f576c 100644 --- a/include/asm-generic/exec.h +++ b/include/asm-generic/exec.h @@ -1,4 +1,4 @@ -/* Generic process execution definitions, based on MN10300 definitions. +/* Generic process execution definitions. * * It should be possible to use these on really simple architectures, * but it serves more as a starting point for new ports. diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h index b4531e3b21209..fe184b9bb6ea1 100644 --- a/include/asm-generic/io.h +++ b/include/asm-generic/io.h @@ -1,4 +1,4 @@ -/* Generic I/O port emulation, based on MN10300 code +/* Generic I/O port emulation. * * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. * Written by David Howells (dhowells@redhat.com) diff --git a/include/asm-generic/pci_iomap.h b/include/asm-generic/pci_iomap.h index 854f96ad5ccba..d4f16dcc2ed79 100644 --- a/include/asm-generic/pci_iomap.h +++ b/include/asm-generic/pci_iomap.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: GPL-2.0+ */ -/* Generic I/O port emulation, based on MN10300 code +/* Generic I/O port emulation. * * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. * Written by David Howells (dhowells@redhat.com) diff --git a/include/asm-generic/switch_to.h b/include/asm-generic/switch_to.h index 052c4ac04fd54..986acc9d34bbd 100644 --- a/include/asm-generic/switch_to.h +++ b/include/asm-generic/switch_to.h @@ -1,4 +1,4 @@ -/* Generic task switch macro wrapper, based on MN10300 definitions. +/* Generic task switch macro wrapper. * * It should be possible to use these on really simple architectures, * but it serves more as a starting point for new ports. diff --git a/include/linux/ide.h b/include/linux/ide.h index 771989d25ef88..20d42c0d9fb65 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -25,7 +25,7 @@ #include #include -#if defined(CONFIG_CRIS) || defined(CONFIG_FRV) || defined(CONFIG_MN10300) +#if defined(CONFIG_CRIS) || defined(CONFIG_FRV) # define SUPPORT_VLB_SYNC 0 #else # define SUPPORT_VLB_SYNC 1 diff --git a/init/Kconfig b/init/Kconfig index e37f4b2a64453..a14bcc9724a2b 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -1108,7 +1108,7 @@ config MULTIUSER config SGETMASK_SYSCALL bool "sgetmask/ssetmask syscalls support" if EXPERT - def_bool PARISC || MN10300 || BLACKFIN || M68K || PPC || MIPS || X86 || SPARC || CRIS || MICROBLAZE || SUPERH + def_bool PARISC || BLACKFIN || M68K || PPC || MIPS || X86 || SPARC || CRIS || MICROBLAZE || SUPERH ---help--- sys_sgetmask and sys_ssetmask are obsolete system calls no longer supported in libc but still enabled by default in some diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index d5964b051017c..41ac9d2942459 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -356,7 +356,7 @@ config FRAME_POINTER bool "Compile the kernel with frame pointers" depends on DEBUG_KERNEL && \ (CRIS || M68K || FRV || UML || \ - SUPERH || BLACKFIN || MN10300) || \ + SUPERH || BLACKFIN) || \ ARCH_WANT_FRAME_POINTERS default y if (DEBUG_INFO && UML) || ARCH_WANT_FRAME_POINTERS help diff --git a/lib/test_user_copy.c b/lib/test_user_copy.c index 4621db801b233..a6556f3364d16 100644 --- a/lib/test_user_copy.c +++ b/lib/test_user_copy.c @@ -35,7 +35,6 @@ !defined(CONFIG_M32R) && \ !defined(CONFIG_M68K) && \ !defined(CONFIG_MICROBLAZE) && \ - !defined(CONFIG_MN10300) && \ !defined(CONFIG_NIOS2) && \ !defined(CONFIG_PPC32) && \ !defined(CONFIG_SUPERH)) diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 9917f928d0fdf..4ff08a0ef5d3f 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -840,8 +840,7 @@ static const char *const section_white_list[] = ".debug*", ".cranges", /* sh64 */ ".zdebug*", /* Compressed debug sections. */ - ".GCC-command-line", /* mn10300 */ - ".GCC.command.line", /* record-gcc-switches, non mn10300 */ + ".GCC.command.line", /* record-gcc-switches */ ".mdebug*", /* alpha, score, mips etc. */ ".pdr", /* alpha, score, mips etc. */ ".stab*", @@ -1104,8 +1103,8 @@ static const struct sectioncheck *section_mismatch( /* * The target section could be the SHT_NUL section when we're * handling relocations to un-resolved symbols, trying to match it - * doesn't make much sense and causes build failures on parisc and - * mn10300 architectures. + * doesn't make much sense and causes build failures on parisc + * architectures. */ if (*tosec == '\0') return NULL; diff --git a/tools/arch/mn10300/include/uapi/asm/bitsperlong.h b/tools/arch/mn10300/include/uapi/asm/bitsperlong.h deleted file mode 100644 index 6dc0bb0c13b29..0000000000000 --- a/tools/arch/mn10300/include/uapi/asm/bitsperlong.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/tools/arch/mn10300/include/uapi/asm/mman.h b/tools/arch/mn10300/include/uapi/asm/mman.h deleted file mode 100644 index b9360639974f9..0000000000000 --- a/tools/arch/mn10300/include/uapi/asm/mman.h +++ /dev/null @@ -1,7 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef TOOLS_ARCH_MN10300_UAPI_ASM_MMAN_FIX_H -#define TOOLS_ARCH_MN10300_UAPI_ASM_MMAN_FIX_H -#include -/* MAP_32BIT is undefined on mn10300, fix it for perf */ -#define MAP_32BIT 0 -#endif diff --git a/tools/include/asm-generic/barrier.h b/tools/include/asm-generic/barrier.h index 47b933903eaf3..52278d880a61a 100644 --- a/tools/include/asm-generic/barrier.h +++ b/tools/include/asm-generic/barrier.h @@ -1,7 +1,7 @@ /* * Copied from the kernel sources to tools/perf/: * - * Generic barrier definitions, originally based on MN10300 definitions. + * Generic barrier definitions. * * It should be possible to use these on really simple architectures, * but it serves more as a starting point for new ports. -- GitLab From fd8773f9f544955f6f47dc2ac3ab85ad64376b7f Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Wed, 7 Mar 2018 21:21:59 +0100 Subject: [PATCH 13/74] arch: remove frv port The Fujitsu FRV kernel port has been around for a long time, but has not seen regular updates in several years and instead was marked 'Orphaned' in 2016 by long-time maintainer David Howells. The SoC product line apparently is apparently still around in the form of the Socionext Milbeaut image processor, but this one no longer uses the FRV CPU cores. This removes all FRV specific files from the kernel. Link: http://www.socionext.com/en/products/assp/milbeaut/ Cc: David Howells Signed-off-by: Arnd Bergmann --- Documentation/00-INDEX | 2 - Documentation/frv/README.txt | 51 - Documentation/frv/atomic-ops.txt | 134 - Documentation/frv/booting.txt | 182 -- Documentation/frv/clock.txt | 65 - Documentation/frv/configuring.txt | 125 - Documentation/frv/features.txt | 310 --- Documentation/frv/gdbinit | 102 - Documentation/frv/gdbstub.txt | 130 - Documentation/frv/kernel-ABI.txt | 262 -- Documentation/frv/mmu-layout.txt | 306 --- MAINTAINERS | 4 - arch/frv/Kconfig | 386 --- arch/frv/Kconfig.debug | 49 - arch/frv/Makefile | 90 - arch/frv/boot/Makefile | 76 - arch/frv/defconfig | 39 - arch/frv/include/asm/Kbuild | 12 - arch/frv/include/asm/asm-offsets.h | 1 - arch/frv/include/asm/atomic.h | 224 -- arch/frv/include/asm/atomic_defs.h | 175 -- arch/frv/include/asm/ax88796.h | 22 - arch/frv/include/asm/barrier.h | 23 - arch/frv/include/asm/bitops.h | 325 --- arch/frv/include/asm/bug.h | 56 - arch/frv/include/asm/bugs.h | 14 - arch/frv/include/asm/busctl-regs.h | 41 - arch/frv/include/asm/cache.h | 23 - arch/frv/include/asm/cacheflush.h | 105 - arch/frv/include/asm/checksum.h | 180 -- arch/frv/include/asm/cmpxchg.h | 171 -- arch/frv/include/asm/cpu-irqs.h | 81 - arch/frv/include/asm/current.h | 30 - arch/frv/include/asm/delay.h | 50 - arch/frv/include/asm/div64.h | 1 - arch/frv/include/asm/dm9000.h | 37 - arch/frv/include/asm/dma-mapping.h | 18 - arch/frv/include/asm/dma.h | 125 - arch/frv/include/asm/elf.h | 140 -- arch/frv/include/asm/emergency-restart.h | 6 - arch/frv/include/asm/fpu.h | 12 - arch/frv/include/asm/ftrace.h | 1 - arch/frv/include/asm/futex.h | 22 - arch/frv/include/asm/gdb-stub.h | 146 -- arch/frv/include/asm/gpio-regs.h | 116 - arch/frv/include/asm/hardirq.h | 26 - arch/frv/include/asm/highmem.h | 149 -- arch/frv/include/asm/hw_irq.h | 16 - arch/frv/include/asm/io.h | 414 ---- arch/frv/include/asm/irc-regs.h | 53 - arch/frv/include/asm/irq.h | 30 - arch/frv/include/asm/irq_regs.h | 27 - arch/frv/include/asm/irqflags.h | 158 -- arch/frv/include/asm/kdebug.h | 1 - arch/frv/include/asm/kmap_types.h | 8 - arch/frv/include/asm/linkage.h | 7 - arch/frv/include/asm/local.h | 7 - arch/frv/include/asm/local64.h | 1 - arch/frv/include/asm/math-emu.h | 302 --- arch/frv/include/asm/mb-regs.h | 200 -- arch/frv/include/asm/mb86943a.h | 42 - arch/frv/include/asm/mb93091-fpga-irqs.h | 42 - arch/frv/include/asm/mb93093-fpga-irqs.h | 29 - arch/frv/include/asm/mb93493-irqs.h | 50 - arch/frv/include/asm/mb93493-regs.h | 281 --- arch/frv/include/asm/mem-layout.h | 86 - arch/frv/include/asm/mmu.h | 41 - arch/frv/include/asm/mmu_context.h | 50 - arch/frv/include/asm/module.h | 22 - arch/frv/include/asm/page.h | 74 - arch/frv/include/asm/pci.h | 40 - arch/frv/include/asm/percpu.h | 7 - arch/frv/include/asm/perf_event.h | 15 - arch/frv/include/asm/pgalloc.h | 69 - arch/frv/include/asm/pgtable.h | 528 ---- arch/frv/include/asm/processor.h | 110 - arch/frv/include/asm/ptrace.h | 41 - arch/frv/include/asm/sections.h | 40 - arch/frv/include/asm/segment.h | 44 - arch/frv/include/asm/serial-regs.h | 44 - arch/frv/include/asm/serial.h | 14 - arch/frv/include/asm/setup.h | 26 - arch/frv/include/asm/shmparam.h | 8 - arch/frv/include/asm/signal.h | 7 - arch/frv/include/asm/smp.h | 10 - arch/frv/include/asm/spinlock.h | 17 - arch/frv/include/asm/spr-regs.h | 416 ---- arch/frv/include/asm/string.h | 50 - arch/frv/include/asm/switch_to.h | 35 - arch/frv/include/asm/syscall.h | 123 - arch/frv/include/asm/termios.h | 15 - arch/frv/include/asm/thread_info.h | 116 - arch/frv/include/asm/timer-regs.h | 106 - arch/frv/include/asm/timex.h | 27 - arch/frv/include/asm/tlb.h | 28 - arch/frv/include/asm/tlbflush.h | 73 - arch/frv/include/asm/topology.h | 13 - arch/frv/include/asm/types.h | 22 - arch/frv/include/asm/uaccess.h | 285 --- arch/frv/include/asm/ucontext.h | 13 - arch/frv/include/asm/unaligned.h | 22 - arch/frv/include/asm/unistd.h | 34 - arch/frv/include/asm/user.h | 80 - arch/frv/include/asm/vga.h | 17 - arch/frv/include/asm/virtconvert.h | 41 - arch/frv/include/asm/xor.h | 1 - arch/frv/include/uapi/asm/Kbuild | 5 - arch/frv/include/uapi/asm/auxvec.h | 4 - arch/frv/include/uapi/asm/bitsperlong.h | 2 - arch/frv/include/uapi/asm/byteorder.h | 7 - arch/frv/include/uapi/asm/errno.h | 8 - arch/frv/include/uapi/asm/fcntl.h | 2 - arch/frv/include/uapi/asm/ioctl.h | 2 - arch/frv/include/uapi/asm/ioctls.h | 11 - arch/frv/include/uapi/asm/ipcbuf.h | 2 - arch/frv/include/uapi/asm/kvm_para.h | 2 - arch/frv/include/uapi/asm/mman.h | 2 - arch/frv/include/uapi/asm/msgbuf.h | 33 - arch/frv/include/uapi/asm/param.h | 9 - arch/frv/include/uapi/asm/poll.h | 11 - arch/frv/include/uapi/asm/posix_types.h | 27 - arch/frv/include/uapi/asm/ptrace.h | 61 - arch/frv/include/uapi/asm/registers.h | 233 -- arch/frv/include/uapi/asm/resource.h | 8 - arch/frv/include/uapi/asm/sembuf.h | 27 - arch/frv/include/uapi/asm/setup.h | 19 - arch/frv/include/uapi/asm/shmbuf.h | 44 - arch/frv/include/uapi/asm/sigcontext.h | 27 - arch/frv/include/uapi/asm/signal.h | 37 - arch/frv/include/uapi/asm/socket.h | 109 - arch/frv/include/uapi/asm/sockios.h | 15 - arch/frv/include/uapi/asm/stat.h | 101 - arch/frv/include/uapi/asm/statfs.h | 8 - arch/frv/include/uapi/asm/swab.h | 11 - arch/frv/include/uapi/asm/termbits.h | 204 -- arch/frv/include/uapi/asm/termios.h | 47 - arch/frv/include/uapi/asm/types.h | 12 - arch/frv/include/uapi/asm/unistd.h | 349 --- arch/frv/kernel/.gitignore | 1 - arch/frv/kernel/Makefile | 24 - arch/frv/kernel/asm-offsets.c | 96 - arch/frv/kernel/break.S | 792 ------ arch/frv/kernel/cmode.S | 189 -- arch/frv/kernel/debug-stub.c | 258 -- arch/frv/kernel/dma.c | 463 ---- arch/frv/kernel/entry-table.S | 329 --- arch/frv/kernel/entry.S | 1519 ------------ arch/frv/kernel/frv_ksyms.c | 109 - arch/frv/kernel/futex.c | 223 -- arch/frv/kernel/gdb-io.c | 215 -- arch/frv/kernel/gdb-io.h | 55 - arch/frv/kernel/gdb-stub.c | 2149 ----------------- arch/frv/kernel/head-mmu-fr451.S | 374 --- arch/frv/kernel/head-uc-fr401.S | 311 --- arch/frv/kernel/head-uc-fr451.S | 174 -- arch/frv/kernel/head-uc-fr555.S | 347 --- arch/frv/kernel/head.S | 638 ----- arch/frv/kernel/head.inc | 50 - arch/frv/kernel/irq-mb93091.c | 157 -- arch/frv/kernel/irq-mb93093.c | 129 - arch/frv/kernel/irq-mb93493.c | 147 -- arch/frv/kernel/irq.c | 159 -- arch/frv/kernel/local.h | 59 - arch/frv/kernel/local64.h | 1 - arch/frv/kernel/module.c | 27 - arch/frv/kernel/pm-mb93093.c | 65 - arch/frv/kernel/pm.c | 352 --- arch/frv/kernel/process.c | 275 --- arch/frv/kernel/ptrace.c | 377 --- arch/frv/kernel/setup.c | 1178 --------- arch/frv/kernel/signal.c | 426 ---- arch/frv/kernel/sleep.S | 373 --- arch/frv/kernel/switch_to.S | 489 ---- arch/frv/kernel/sys_frv.c | 44 - arch/frv/kernel/sysctl.c | 221 -- arch/frv/kernel/time.c | 122 - arch/frv/kernel/traps.c | 642 ----- arch/frv/kernel/uaccess.c | 100 - arch/frv/kernel/vmlinux.lds.S | 136 -- arch/frv/lib/Makefile | 8 - arch/frv/lib/__ashldi3.S | 40 - arch/frv/lib/__ashrdi3.S | 41 - arch/frv/lib/__lshrdi3.S | 40 - arch/frv/lib/__muldi3.S | 32 - arch/frv/lib/__negdi2.S | 28 - arch/frv/lib/__ucmpdi2.S | 45 - arch/frv/lib/atomic-lib.c | 8 - arch/frv/lib/atomic-ops.S | 62 - arch/frv/lib/atomic64-ops.S | 68 - arch/frv/lib/cache.S | 98 - arch/frv/lib/checksum.c | 166 -- arch/frv/lib/insl_ns.S | 52 - arch/frv/lib/insl_sw.S | 40 - arch/frv/lib/memcpy.S | 135 -- arch/frv/lib/memset.S | 182 -- arch/frv/lib/outsl_ns.S | 59 - arch/frv/lib/outsl_sw.S | 45 - arch/frv/mb93090-mb00/Makefile | 16 - arch/frv/mb93090-mb00/flash.c | 90 - arch/frv/mb93090-mb00/pci-dma-nommu.c | 176 -- arch/frv/mb93090-mb00/pci-dma.c | 118 - arch/frv/mb93090-mb00/pci-frv.c | 193 -- arch/frv/mb93090-mb00/pci-frv.h | 33 - arch/frv/mb93090-mb00/pci-irq.c | 62 - arch/frv/mb93090-mb00/pci-vdk.c | 419 ---- arch/frv/mm/Makefile | 9 - arch/frv/mm/cache-page.c | 71 - arch/frv/mm/dma-alloc.c | 183 -- arch/frv/mm/elf-fdpic.c | 114 - arch/frv/mm/extable.c | 49 - arch/frv/mm/fault.c | 328 --- arch/frv/mm/highmem.c | 86 - arch/frv/mm/init.c | 144 -- arch/frv/mm/kmap.c | 51 - arch/frv/mm/mmu-context.c | 210 -- arch/frv/mm/pgalloc.c | 157 -- arch/frv/mm/tlb-flush.S | 184 -- arch/frv/mm/tlb-miss.S | 629 ----- tools/arch/frv/include/uapi/asm/bitsperlong.h | 2 - tools/arch/frv/include/uapi/asm/mman.h | 7 - 220 files changed, 28837 deletions(-) delete mode 100644 Documentation/frv/README.txt delete mode 100644 Documentation/frv/atomic-ops.txt delete mode 100644 Documentation/frv/booting.txt delete mode 100644 Documentation/frv/clock.txt delete mode 100644 Documentation/frv/configuring.txt delete mode 100644 Documentation/frv/features.txt delete mode 100644 Documentation/frv/gdbinit delete mode 100644 Documentation/frv/gdbstub.txt delete mode 100644 Documentation/frv/kernel-ABI.txt delete mode 100644 Documentation/frv/mmu-layout.txt delete mode 100644 arch/frv/Kconfig delete mode 100644 arch/frv/Kconfig.debug delete mode 100644 arch/frv/Makefile delete mode 100644 arch/frv/boot/Makefile delete mode 100644 arch/frv/defconfig delete mode 100644 arch/frv/include/asm/Kbuild delete mode 100644 arch/frv/include/asm/asm-offsets.h delete mode 100644 arch/frv/include/asm/atomic.h delete mode 100644 arch/frv/include/asm/atomic_defs.h delete mode 100644 arch/frv/include/asm/ax88796.h delete mode 100644 arch/frv/include/asm/barrier.h delete mode 100644 arch/frv/include/asm/bitops.h delete mode 100644 arch/frv/include/asm/bug.h delete mode 100644 arch/frv/include/asm/bugs.h delete mode 100644 arch/frv/include/asm/busctl-regs.h delete mode 100644 arch/frv/include/asm/cache.h delete mode 100644 arch/frv/include/asm/cacheflush.h delete mode 100644 arch/frv/include/asm/checksum.h delete mode 100644 arch/frv/include/asm/cmpxchg.h delete mode 100644 arch/frv/include/asm/cpu-irqs.h delete mode 100644 arch/frv/include/asm/current.h delete mode 100644 arch/frv/include/asm/delay.h delete mode 100644 arch/frv/include/asm/div64.h delete mode 100644 arch/frv/include/asm/dm9000.h delete mode 100644 arch/frv/include/asm/dma-mapping.h delete mode 100644 arch/frv/include/asm/dma.h delete mode 100644 arch/frv/include/asm/elf.h delete mode 100644 arch/frv/include/asm/emergency-restart.h delete mode 100644 arch/frv/include/asm/fpu.h delete mode 100644 arch/frv/include/asm/ftrace.h delete mode 100644 arch/frv/include/asm/futex.h delete mode 100644 arch/frv/include/asm/gdb-stub.h delete mode 100644 arch/frv/include/asm/gpio-regs.h delete mode 100644 arch/frv/include/asm/hardirq.h delete mode 100644 arch/frv/include/asm/highmem.h delete mode 100644 arch/frv/include/asm/hw_irq.h delete mode 100644 arch/frv/include/asm/io.h delete mode 100644 arch/frv/include/asm/irc-regs.h delete mode 100644 arch/frv/include/asm/irq.h delete mode 100644 arch/frv/include/asm/irq_regs.h delete mode 100644 arch/frv/include/asm/irqflags.h delete mode 100644 arch/frv/include/asm/kdebug.h delete mode 100644 arch/frv/include/asm/kmap_types.h delete mode 100644 arch/frv/include/asm/linkage.h delete mode 100644 arch/frv/include/asm/local.h delete mode 100644 arch/frv/include/asm/local64.h delete mode 100644 arch/frv/include/asm/math-emu.h delete mode 100644 arch/frv/include/asm/mb-regs.h delete mode 100644 arch/frv/include/asm/mb86943a.h delete mode 100644 arch/frv/include/asm/mb93091-fpga-irqs.h delete mode 100644 arch/frv/include/asm/mb93093-fpga-irqs.h delete mode 100644 arch/frv/include/asm/mb93493-irqs.h delete mode 100644 arch/frv/include/asm/mb93493-regs.h delete mode 100644 arch/frv/include/asm/mem-layout.h delete mode 100644 arch/frv/include/asm/mmu.h delete mode 100644 arch/frv/include/asm/mmu_context.h delete mode 100644 arch/frv/include/asm/module.h delete mode 100644 arch/frv/include/asm/page.h delete mode 100644 arch/frv/include/asm/pci.h delete mode 100644 arch/frv/include/asm/percpu.h delete mode 100644 arch/frv/include/asm/perf_event.h delete mode 100644 arch/frv/include/asm/pgalloc.h delete mode 100644 arch/frv/include/asm/pgtable.h delete mode 100644 arch/frv/include/asm/processor.h delete mode 100644 arch/frv/include/asm/ptrace.h delete mode 100644 arch/frv/include/asm/sections.h delete mode 100644 arch/frv/include/asm/segment.h delete mode 100644 arch/frv/include/asm/serial-regs.h delete mode 100644 arch/frv/include/asm/serial.h delete mode 100644 arch/frv/include/asm/setup.h delete mode 100644 arch/frv/include/asm/shmparam.h delete mode 100644 arch/frv/include/asm/signal.h delete mode 100644 arch/frv/include/asm/smp.h delete mode 100644 arch/frv/include/asm/spinlock.h delete mode 100644 arch/frv/include/asm/spr-regs.h delete mode 100644 arch/frv/include/asm/string.h delete mode 100644 arch/frv/include/asm/switch_to.h delete mode 100644 arch/frv/include/asm/syscall.h delete mode 100644 arch/frv/include/asm/termios.h delete mode 100644 arch/frv/include/asm/thread_info.h delete mode 100644 arch/frv/include/asm/timer-regs.h delete mode 100644 arch/frv/include/asm/timex.h delete mode 100644 arch/frv/include/asm/tlb.h delete mode 100644 arch/frv/include/asm/tlbflush.h delete mode 100644 arch/frv/include/asm/topology.h delete mode 100644 arch/frv/include/asm/types.h delete mode 100644 arch/frv/include/asm/uaccess.h delete mode 100644 arch/frv/include/asm/ucontext.h delete mode 100644 arch/frv/include/asm/unaligned.h delete mode 100644 arch/frv/include/asm/unistd.h delete mode 100644 arch/frv/include/asm/user.h delete mode 100644 arch/frv/include/asm/vga.h delete mode 100644 arch/frv/include/asm/virtconvert.h delete mode 100644 arch/frv/include/asm/xor.h delete mode 100644 arch/frv/include/uapi/asm/Kbuild delete mode 100644 arch/frv/include/uapi/asm/auxvec.h delete mode 100644 arch/frv/include/uapi/asm/bitsperlong.h delete mode 100644 arch/frv/include/uapi/asm/byteorder.h delete mode 100644 arch/frv/include/uapi/asm/errno.h delete mode 100644 arch/frv/include/uapi/asm/fcntl.h delete mode 100644 arch/frv/include/uapi/asm/ioctl.h delete mode 100644 arch/frv/include/uapi/asm/ioctls.h delete mode 100644 arch/frv/include/uapi/asm/ipcbuf.h delete mode 100644 arch/frv/include/uapi/asm/kvm_para.h delete mode 100644 arch/frv/include/uapi/asm/mman.h delete mode 100644 arch/frv/include/uapi/asm/msgbuf.h delete mode 100644 arch/frv/include/uapi/asm/param.h delete mode 100644 arch/frv/include/uapi/asm/poll.h delete mode 100644 arch/frv/include/uapi/asm/posix_types.h delete mode 100644 arch/frv/include/uapi/asm/ptrace.h delete mode 100644 arch/frv/include/uapi/asm/registers.h delete mode 100644 arch/frv/include/uapi/asm/resource.h delete mode 100644 arch/frv/include/uapi/asm/sembuf.h delete mode 100644 arch/frv/include/uapi/asm/setup.h delete mode 100644 arch/frv/include/uapi/asm/shmbuf.h delete mode 100644 arch/frv/include/uapi/asm/sigcontext.h delete mode 100644 arch/frv/include/uapi/asm/signal.h delete mode 100644 arch/frv/include/uapi/asm/socket.h delete mode 100644 arch/frv/include/uapi/asm/sockios.h delete mode 100644 arch/frv/include/uapi/asm/stat.h delete mode 100644 arch/frv/include/uapi/asm/statfs.h delete mode 100644 arch/frv/include/uapi/asm/swab.h delete mode 100644 arch/frv/include/uapi/asm/termbits.h delete mode 100644 arch/frv/include/uapi/asm/termios.h delete mode 100644 arch/frv/include/uapi/asm/types.h delete mode 100644 arch/frv/include/uapi/asm/unistd.h delete mode 100644 arch/frv/kernel/.gitignore delete mode 100644 arch/frv/kernel/Makefile delete mode 100644 arch/frv/kernel/asm-offsets.c delete mode 100644 arch/frv/kernel/break.S delete mode 100644 arch/frv/kernel/cmode.S delete mode 100644 arch/frv/kernel/debug-stub.c delete mode 100644 arch/frv/kernel/dma.c delete mode 100644 arch/frv/kernel/entry-table.S delete mode 100644 arch/frv/kernel/entry.S delete mode 100644 arch/frv/kernel/frv_ksyms.c delete mode 100644 arch/frv/kernel/futex.c delete mode 100644 arch/frv/kernel/gdb-io.c delete mode 100644 arch/frv/kernel/gdb-io.h delete mode 100644 arch/frv/kernel/gdb-stub.c delete mode 100644 arch/frv/kernel/head-mmu-fr451.S delete mode 100644 arch/frv/kernel/head-uc-fr401.S delete mode 100644 arch/frv/kernel/head-uc-fr451.S delete mode 100644 arch/frv/kernel/head-uc-fr555.S delete mode 100644 arch/frv/kernel/head.S delete mode 100644 arch/frv/kernel/head.inc delete mode 100644 arch/frv/kernel/irq-mb93091.c delete mode 100644 arch/frv/kernel/irq-mb93093.c delete mode 100644 arch/frv/kernel/irq-mb93493.c delete mode 100644 arch/frv/kernel/irq.c delete mode 100644 arch/frv/kernel/local.h delete mode 100644 arch/frv/kernel/local64.h delete mode 100644 arch/frv/kernel/module.c delete mode 100644 arch/frv/kernel/pm-mb93093.c delete mode 100644 arch/frv/kernel/pm.c delete mode 100644 arch/frv/kernel/process.c delete mode 100644 arch/frv/kernel/ptrace.c delete mode 100644 arch/frv/kernel/setup.c delete mode 100644 arch/frv/kernel/signal.c delete mode 100644 arch/frv/kernel/sleep.S delete mode 100644 arch/frv/kernel/switch_to.S delete mode 100644 arch/frv/kernel/sys_frv.c delete mode 100644 arch/frv/kernel/sysctl.c delete mode 100644 arch/frv/kernel/time.c delete mode 100644 arch/frv/kernel/traps.c delete mode 100644 arch/frv/kernel/uaccess.c delete mode 100644 arch/frv/kernel/vmlinux.lds.S delete mode 100644 arch/frv/lib/Makefile delete mode 100644 arch/frv/lib/__ashldi3.S delete mode 100644 arch/frv/lib/__ashrdi3.S delete mode 100644 arch/frv/lib/__lshrdi3.S delete mode 100644 arch/frv/lib/__muldi3.S delete mode 100644 arch/frv/lib/__negdi2.S delete mode 100644 arch/frv/lib/__ucmpdi2.S delete mode 100644 arch/frv/lib/atomic-lib.c delete mode 100644 arch/frv/lib/atomic-ops.S delete mode 100644 arch/frv/lib/atomic64-ops.S delete mode 100644 arch/frv/lib/cache.S delete mode 100644 arch/frv/lib/checksum.c delete mode 100644 arch/frv/lib/insl_ns.S delete mode 100644 arch/frv/lib/insl_sw.S delete mode 100644 arch/frv/lib/memcpy.S delete mode 100644 arch/frv/lib/memset.S delete mode 100644 arch/frv/lib/outsl_ns.S delete mode 100644 arch/frv/lib/outsl_sw.S delete mode 100644 arch/frv/mb93090-mb00/Makefile delete mode 100644 arch/frv/mb93090-mb00/flash.c delete mode 100644 arch/frv/mb93090-mb00/pci-dma-nommu.c delete mode 100644 arch/frv/mb93090-mb00/pci-dma.c delete mode 100644 arch/frv/mb93090-mb00/pci-frv.c delete mode 100644 arch/frv/mb93090-mb00/pci-frv.h delete mode 100644 arch/frv/mb93090-mb00/pci-irq.c delete mode 100644 arch/frv/mb93090-mb00/pci-vdk.c delete mode 100644 arch/frv/mm/Makefile delete mode 100644 arch/frv/mm/cache-page.c delete mode 100644 arch/frv/mm/dma-alloc.c delete mode 100644 arch/frv/mm/elf-fdpic.c delete mode 100644 arch/frv/mm/extable.c delete mode 100644 arch/frv/mm/fault.c delete mode 100644 arch/frv/mm/highmem.c delete mode 100644 arch/frv/mm/init.c delete mode 100644 arch/frv/mm/kmap.c delete mode 100644 arch/frv/mm/mmu-context.c delete mode 100644 arch/frv/mm/pgalloc.c delete mode 100644 arch/frv/mm/tlb-flush.S delete mode 100644 arch/frv/mm/tlb-miss.S delete mode 100644 tools/arch/frv/include/uapi/asm/bitsperlong.h delete mode 100644 tools/arch/frv/include/uapi/asm/mman.h diff --git a/Documentation/00-INDEX b/Documentation/00-INDEX index bd7e2d08d7904..b56b88e201963 100644 --- a/Documentation/00-INDEX +++ b/Documentation/00-INDEX @@ -172,8 +172,6 @@ fmc/ - information about the FMC bus abstraction fpga/ - FPGA Manager Core. -frv/ - - Fujitsu FR-V Linux documentation. futex-requeue-pi.txt - info on requeueing of tasks from a non-PI futex to a PI futex gcc-plugins.txt diff --git a/Documentation/frv/README.txt b/Documentation/frv/README.txt deleted file mode 100644 index a984faa968e8e..0000000000000 --- a/Documentation/frv/README.txt +++ /dev/null @@ -1,51 +0,0 @@ - ================================ - Fujitsu FR-V LINUX DOCUMENTATION - ================================ - -This directory contains documentation for the Fujitsu FR-V CPU architecture -port of Linux. - -The following documents are available: - - (*) features.txt - - A description of the basic features inherent in this architecture port. - - - (*) configuring.txt - - A summary of the configuration options particular to this architecture. - - - (*) booting.txt - - A description of how to boot the kernel image and a summary of the kernel - command line options. - - - (*) gdbstub.txt - - A description of how to debug the kernel using GDB attached by serial - port, and a summary of the services available. - - - (*) mmu-layout.txt - - A description of the virtual and physical memory layout used in the - MMU linux kernel, and the registers used to support it. - - - (*) gdbinit - - An example .gdbinit file for use with GDB. It includes macros for viewing - MMU state on the FR451. See mmu-layout.txt for more information. - - - (*) clock.txt - - A description of the CPU clock scaling interface. - - - (*) atomic-ops.txt - - A description of how the FR-V kernel's atomic operations work. diff --git a/Documentation/frv/atomic-ops.txt b/Documentation/frv/atomic-ops.txt deleted file mode 100644 index 96638e9b9fe0b..0000000000000 --- a/Documentation/frv/atomic-ops.txt +++ /dev/null @@ -1,134 +0,0 @@ - ===================================== - FUJITSU FR-V KERNEL ATOMIC OPERATIONS - ===================================== - -On the FR-V CPUs, there is only one atomic Read-Modify-Write operation: the SWAP/SWAPI -instruction. Unfortunately, this alone can't be used to implement the following operations: - - (*) Atomic add to memory - - (*) Atomic subtract from memory - - (*) Atomic bit modification (set, clear or invert) - - (*) Atomic compare and exchange - -On such CPUs, the standard way of emulating such operations in uniprocessor mode is to disable -interrupts, but on the FR-V CPUs, modifying the PSR takes a lot of clock cycles, and it has to be -done twice. This means the CPU runs for a relatively long time with interrupts disabled, -potentially having a great effect on interrupt latency. - - -============= -NEW ALGORITHM -============= - -To get around this, the following algorithm has been implemented. It operates in a way similar to -the LL/SC instruction pairs supported on a number of platforms. - - (*) The CCCR.CC3 register is reserved within the kernel to act as an atomic modify abort flag. - - (*) In the exception prologues run on kernel->kernel entry, CCCR.CC3 is set to 0 (Undefined - state). - - (*) All atomic operations can then be broken down into the following algorithm: - - (1) Set ICC3.Z to true and set CC3 to True (ORCC/CKEQ/ORCR). - - (2) Load the value currently in the memory to be modified into a register. - - (3) Make changes to the value. - - (4) If CC3 is still True, simultaneously and atomically (by VLIW packing): - - (a) Store the modified value back to memory. - - (b) Set ICC3.Z to false (CORCC on GR29 is sufficient for this - GR29 holds the current - task pointer in the kernel, and so is guaranteed to be non-zero). - - (5) If ICC3.Z is still true, go back to step (1). - -This works in a non-SMP environment because any interrupt or other exception that happens between -steps (1) and (4) will set CC3 to the Undefined, thus aborting the store in (4a), and causing the -condition in ICC3 to remain with the Z flag set, thus causing step (5) to loop back to step (1). - - -This algorithm suffers from two problems: - - (1) The condition CCCR.CC3 is cleared unconditionally by an exception, irrespective of whether or - not any changes were made to the target memory location during that exception. - - (2) The branch from step (5) back to step (1) may have to happen more than once until the store - manages to take place. In theory, this loop could cycle forever because there are too many - interrupts coming in, but it's unlikely. - - -======= -EXAMPLE -======= - -Taking an example from include/asm-frv/atomic.h: - - static inline int atomic_add_return(int i, atomic_t *v) - { - unsigned long val; - - asm("0: \n" - -It starts by setting ICC3.Z to true for later use, and also transforming that into CC3 being in the -True state. - - " orcc gr0,gr0,gr0,icc3 \n" <-- (1) - " ckeq icc3,cc7 \n" <-- (1) - -Then it does the load. Note that the final phase of step (1) is done at the same time as the -load. The VLIW packing ensures they are done simultaneously. The ".p" on the load must not be -removed without swapping the order of these two instructions. - - " ld.p %M0,%1 \n" <-- (2) - " orcr cc7,cc7,cc3 \n" <-- (1) - -Then the proposed modification is generated. Note that the old value can be retained if required -(such as in test_and_set_bit()). - - " add%I2 %1,%2,%1 \n" <-- (3) - -Then it attempts to store the value back, contingent on no exception having cleared CC3 since it -was set to True. - - " cst.p %1,%M0 ,cc3,#1 \n" <-- (4a) - -It simultaneously records the success or failure of the store in ICC3.Z. - - " corcc gr29,gr29,gr0 ,cc3,#1 \n" <-- (4b) - -Such that the branch can then be taken if the operation was aborted. - - " beq icc3,#0,0b \n" <-- (5) - : "+U"(v->counter), "=&r"(val) - : "NPr"(i) - : "memory", "cc7", "cc3", "icc3" - ); - - return val; - } - - -============= -CONFIGURATION -============= - -The atomic ops implementation can be made inline or out-of-line by changing the -CONFIG_FRV_OUTOFLINE_ATOMIC_OPS configuration variable. Making it out-of-line has a number of -advantages: - - - The resulting kernel image may be smaller - - Debugging is easier as atomic ops can just be stepped over and they can be breakpointed - -Keeping it inline also has a number of advantages: - - - The resulting kernel may be Faster - - no out-of-line function calls need to be made - - the compiler doesn't have half its registers clobbered by making a call - -The out-of-line implementations live in arch/frv/lib/atomic-ops.S. diff --git a/Documentation/frv/booting.txt b/Documentation/frv/booting.txt deleted file mode 100644 index cd9dc1dfb144f..0000000000000 --- a/Documentation/frv/booting.txt +++ /dev/null @@ -1,182 +0,0 @@ - ========================= - BOOTING FR-V LINUX KERNEL - ========================= - -====================== -PROVIDING A FILESYSTEM -====================== - -First of all, a root filesystem must be made available. This can be done in -one of two ways: - - (1) NFS Export - - A filesystem should be constructed in a directory on an NFS server that - the target board can reach. This directory should then be NFS exported - such that the target board can read and write into it as root. - - (2) Flash Filesystem (JFFS2 Recommended) - - In this case, the image must be stored or built up on flash before it - can be used. A complete image can be built using the mkfs.jffs2 or - similar program and then downloaded and stored into flash by RedBoot. - - -======================== -LOADING THE KERNEL IMAGE -======================== - -The kernel will need to be loaded into RAM by RedBoot (or by some alternative -boot loader) before it can be run. The kernel image (arch/frv/boot/Image) may -be loaded in one of three ways: - - (1) Load from Flash - - This is the simplest. RedBoot can store an image in the flash (see the - RedBoot documentation) and then load it back into RAM. RedBoot keeps - track of the load address, entry point and size, so the command to do - this is simply: - - fis load linux - - The image is then ready to be executed. - - (2) Load by TFTP - - The following command will download a raw binary kernel image from the - default server (as negotiated by BOOTP) and store it into RAM: - - load -b 0x00100000 -r /tftpboot/image.bin - - The image is then ready to be executed. - - (3) Load by Y-Modem - - The following command will download a raw binary kernel image across the - serial port that RedBoot is currently using: - - load -m ymodem -b 0x00100000 -r zImage - - The serial client (such as minicom) must then be told to transmit the - program by Y-Modem. - - When finished, the image will then be ready to be executed. - - -================== -BOOTING THE KERNEL -================== - -Boot the image with the following RedBoot command: - - exec -c "" 0x00100000 - -For example: - - exec -c "console=ttySM0,115200 ip=:::::dhcp root=/dev/mtdblock2 rw" - -This will start the kernel running. Note that if the GDB-stub is compiled in, -then the kernel will immediately wait for GDB to connect over serial before -doing anything else. See the section on kernel debugging with GDB. - -The kernel command line tells the kernel where its console is and -how to find its root filesystem. This is made up of the following components, -separated by spaces: - - (*) console=ttyS[,[[[]]]] - - This specifies that the system console should output through on-chip - serial port (which can be "0" or "1"). - - is a standard baud rate between 1200 and 115200 (default 9600). - - is a parity setting of "N", "O", "E", "M" or "S" for None, Odd, - Even, Mark or Space. "None" is the default. - - is "7" or "8" for the number of bits per character. "8" is the - default. - - is "r" to use flow control (XCTS on serial port 2 only). The - default is to not use flow control. - - For example: - - console=ttyS0,115200 - - To use the first on-chip serial port at baud rate 115200, no parity, 8 - bits, and no flow control. - - (*) root= - - This specifies the device upon which the root filesystem resides. It - may be specified by major and minor number, device path, or even - partition uuid, if supported. For example: - - /dev/nfs NFS root filesystem - /dev/mtdblock3 Fourth RedBoot partition on the System Flash - PARTUUID=00112233-4455-6677-8899-AABBCCDDEEFF/PARTNROFF=1 - first partition after the partition with the given UUID - 253:0 Device with major 253 and minor 0 - - Authoritative information can be found in - "Documentation/admin-guide/kernel-parameters.rst". - - (*) rw - - Start with the root filesystem mounted Read/Write. - - The remaining components are all optional: - - (*) ip=:::::: - - Configure the network interface. If is "off" then should - specify the IP address for the network device . provide - the hostname for the device. - - If is "bootp" or "dhcp", then all of these parameters will be - discovered by consulting a BOOTP or DHCP server. - - For example, the following might be used: - - ip=192.168.73.12::::frv:eth0:off - - This sets the IP address on the VDK motherboard RTL8029 ethernet chipset - (eth0) to be 192.168.73.12, and sets the board's hostname to be "frv". - - (*) nfsroot=:[,v] - - This is mandatory if "root=/dev/nfs" is given as an option. It tells the - kernel the IP address of the NFS server providing its root filesystem, - and the pathname on that server of the filesystem. - - The NFS version to use can also be specified. v2 and v3 are supported by - Linux. - - For example: - - nfsroot=192.168.73.1:/nfsroot-frv - - (*) profile=1 - - Turns on the kernel profiler (accessible through /proc/profile). - - (*) console=gdb0 - - This can be used as an alternative to the "console=ttyS..." listed - above. I tells the kernel to pass the console output to GDB if the - gdbstub is compiled in to the kernel. - - If this is used, then the gdbstub passes the text to GDB, which then - simply dumps it to its standard output. - - (*) mem=M - - Normally the kernel will work out how much SDRAM it has by reading the - SDRAM controller registers. That can be overridden with this - option. This allows the kernel to be told that it has megabytes of - memory available. - - (*) init= [ [ [ ...]]] - - This tells the kernel what program to run initially. By default this is - /sbin/init, but /sbin/sash or /bin/sh are common alternatives. diff --git a/Documentation/frv/clock.txt b/Documentation/frv/clock.txt deleted file mode 100644 index c72d350e177a4..0000000000000 --- a/Documentation/frv/clock.txt +++ /dev/null @@ -1,65 +0,0 @@ -Clock scaling -------------- - -The kernel supports scaling of CLCK.CMODE, CLCK.CM and CLKC.P0 clock -registers. If built with CONFIG_PM and CONFIG_SYSCTL options enabled, four -extra files will appear in the directory /proc/sys/pm/. Reading these files -will show: - - p0 -- current value of the P0 bit in CLKC register. - cm -- current value of the CM bits in CLKC register. - cmode -- current value of the CMODE bits in CLKC register. - -On all boards, the 'p0' file should also be writable, and either '1' or '0' -can be rewritten, to set or clear the CLKC_P0 bit respectively, hence -controlling whether the resource bus rate clock is halved. - -The 'cm' file should also be available on all boards. '0' can be written to it -to shift the board into High-Speed mode (normal), and '1' can be written to -shift the board into Medium-Speed mode. Selecting Low-Speed mode is not -supported by this interface, even though some CPUs do support it. - -On the boards with FR405 CPU (i.e. CB60 and CB70), the 'cmode' file is also -writable, allowing the CPU core speed (and other clock speeds) to be -controlled from userspace. - - -Determining current and possible settings ------------------------------------------ - -The current state and the available masks can be found in /proc/cpuinfo. For -example, on the CB70: - - # cat /proc/cpuinfo - CPU-Series: fr400 - CPU-Core: fr405, gr0-31, BE, CCCR - CPU: mb93405 - MMU: Prot - FP-Media: fr0-31, Media - System: mb93091-cb70, mb93090-mb00 - PM-Controls: cmode=0xd31f, cm=0x3, p0=0x3, suspend=0x9 - PM-Status: cmode=3, cm=0, p0=0 - Clock-In: 50.00 MHz - Clock-Core: 300.00 MHz - Clock-SDRAM: 100.00 MHz - Clock-CBus: 100.00 MHz - Clock-Res: 50.00 MHz - Clock-Ext: 50.00 MHz - Clock-DSU: 25.00 MHz - BogoMips: 300.00 - -And on the PDK, the PM lines look like the following: - - PM-Controls: cm=0x3, p0=0x3, suspend=0x9 - PM-Status: cmode=9, cm=0, p0=0 - -The PM-Controls line, if present, will indicate which /proc/sys/pm files can -be set to what values. The specification values are bitmasks; so, for example, -"suspend=0x9" indicates that 0 and 3 can be written validly to -/proc/sys/pm/suspend. - -The PM-Controls line will only be present if CONFIG_PM is configured to Y. - -The PM-Status line indicates which clock controls are set to which value. If -the file can be read, then the suspend value must be 0, and so that's not -included. diff --git a/Documentation/frv/configuring.txt b/Documentation/frv/configuring.txt deleted file mode 100644 index 36e76a2336fa9..0000000000000 --- a/Documentation/frv/configuring.txt +++ /dev/null @@ -1,125 +0,0 @@ - ======================================= - FUJITSU FR-V LINUX KERNEL CONFIGURATION - ======================================= - -===================== -CONFIGURATION OPTIONS -===================== - -The most important setting is in the "MMU support options" tab (the first -presented in the configuration tools available): - - (*) "Kernel Type" - - This options allows selection of normal, MMU-requiring linux, and uClinux - (which doesn't require an MMU and doesn't have inter-process protection). - -There are a number of settings in the "Processor type and features" section of -the kernel configuration that need to be considered. - - (*) "CPU" - - The register and instruction sets at the core of the processor. This can - only be set to "FR40x/45x/55x" at the moment - but this permits usage of - the kernel with MB93091 CB10, CB11, CB30, CB41, CB60, CB70 and CB451 - CPU boards, and with the MB93093 PDK board. - - (*) "System" - - This option allows a choice of basic system. This governs the peripherals - that are expected to be available. - - (*) "Motherboard" - - This specifies the type of motherboard being used, and the peripherals - upon it. Currently only "MB93090-MB00" can be set here. - - (*) "Default cache-write mode" - - This controls the initial data cache write management mode. By default - Write-Through is selected, but Write-Back (Copy-Back) can also be - selected. This can be changed dynamically once the kernel is running (see - features.txt). - -There are some architecture specific configuration options in the "General -Setup" section of the kernel configuration too: - - (*) "Reserve memory uncached for (PCI) DMA" - - This requests that a uClinux kernel set aside some memory in an uncached - window for the use as consistent DMA memory (mainly for PCI). At least a - megabyte will be allocated in this way, possibly more. Any memory so - reserved will not be available for normal allocations. - - (*) "Kernel support for ELF-FDPIC binaries" - - This enables the binary-format driver for the new FDPIC ELF binaries that - this platform normally uses. These binaries are totally relocatable - - their separate sections can relocated independently, allowing them to be - shared on uClinux where possible. This should normally be enabled. - - (*) "Kernel image protection" - - This makes the protection register governing access to the core kernel - image prohibit access by userspace programs. This option is available on - uClinux only. - -There are also a number of settings in the "Kernel Hacking" section of the -kernel configuration especially for debugging a kernel on this -architecture. See the "gdbstub.txt" file for information about those. - - -====================== -DEFAULT CONFIGURATIONS -====================== - -The kernel sources include a number of example default configurations: - - (*) defconfig-mb93091 - - Default configuration for the MB93091-VDK with both CPU board and - MB93090-MB00 motherboard running uClinux. - - - (*) defconfig-mb93091-fb - - Default configuration for the MB93091-VDK with CPU board, - MB93090-MB00 motherboard, and DAV board running uClinux. - Includes framebuffer driver. - - - (*) defconfig-mb93093 - - Default configuration for the MB93093-PDK board running uClinux. - - - (*) defconfig-cb70-standalone - - Default configuration for the MB93091-VDK with only CB70 CPU board - running uClinux. This will use the CB70's DM9000 for network access. - - - (*) defconfig-mmu - - Default configuration for the MB93091-VDK with both CB451 CPU board and - MB93090-MB00 motherboard running MMU linux. - - (*) defconfig-mmu-audio - - Default configuration for the MB93091-VDK with CB451 CPU board, DAV - board, and MB93090-MB00 motherboard running MMU linux. Includes - audio driver. - - (*) defconfig-mmu-fb - - Default configuration for the MB93091-VDK with CB451 CPU board, DAV - board, and MB93090-MB00 motherboard running MMU linux. Includes - framebuffer driver. - - (*) defconfig-mmu-standalone - - Default configuration for the MB93091-VDK with only CB451 CPU board - running MMU linux. - - - diff --git a/Documentation/frv/features.txt b/Documentation/frv/features.txt deleted file mode 100644 index fa20c0e72833d..0000000000000 --- a/Documentation/frv/features.txt +++ /dev/null @@ -1,310 +0,0 @@ - =========================== - FUJITSU FR-V LINUX FEATURES - =========================== - -This kernel port has a number of features of which the user should be aware: - - (*) Linux and uClinux - - The FR-V architecture port supports both normal MMU linux and uClinux out - of the same sources. - - - (*) CPU support - - Support for the FR401, FR403, FR405, FR451 and FR555 CPUs should work with - the same uClinux kernel configuration. - - In normal (MMU) Linux mode, only the FR451 CPU will work as that is the - only one with a suitably featured CPU. - - The kernel is written and compiled with the assumption that only the - bottom 32 GR registers and no FR registers will be used by the kernel - itself, however all extra userspace registers will be saved on context - switch. Note that since most CPUs can't support lazy switching, no attempt - is made to do lazy register saving where that would be possible (FR555 - only currently). - - - (*) Board support - - The board on which the kernel will run can be configured on the "Processor - type and features" configuration tab. - - Set the System to "MB93093-PDK" to boot from the MB93093 (FR403) PDK. - - Set the System to "MB93091-VDK" to boot from the CB11, CB30, CB41, CB60, - CB70 or CB451 VDK boards. Set the Motherboard setting to "MB93090-MB00" to - boot with the standard ATA90590B VDK motherboard, and set it to "None" to - boot without any motherboard. - - - (*) Binary Formats - - The only userspace binary format supported is FDPIC ELF. Normal ELF, FLAT - and AOUT binaries are not supported for this architecture. - - FDPIC ELF supports shared library and program interpreter facilities. - - - (*) Scheduler Speed - - The kernel scheduler runs at 100Hz irrespective of the clock speed on this - architecture. This value is set in asm/param.h (see the HZ macro defined - there). - - - (*) Normal (MMU) Linux Memory Layout. - - See mmu-layout.txt in this directory for a description of the normal linux - memory layout - - See include/asm-frv/mem-layout.h for constants pertaining to the memory - layout. - - See include/asm-frv/mb-regs.h for the constants pertaining to the I/O bus - controller configuration. - - - (*) uClinux Memory Layout - - The memory layout used by the uClinux kernel is as follows: - - 0x00000000 - 0x00000FFF Null pointer catch page - 0x20000000 - 0x200FFFFF CS2# [PDK] FPGA - 0xC0000000 - 0xCFFFFFFF SDRAM - 0xC0000000 Base of Linux kernel image - 0xE0000000 - 0xEFFFFFFF CS2# [VDK] SLBUS/PCI window - 0xF0000000 - 0xF0FFFFFF CS5# MB93493 CSC area (DAV daughter board) - 0xF1000000 - 0xF1FFFFFF CS7# [CB70/CB451] CPU-card PCMCIA port space - 0xFC000000 - 0xFC0FFFFF CS1# [VDK] MB86943 config space - 0xFC100000 - 0xFC1FFFFF CS6# [CB70/CB451] CPU-card DM9000 NIC space - 0xFC100000 - 0xFC1FFFFF CS6# [PDK] AX88796 NIC space - 0xFC200000 - 0xFC2FFFFF CS3# MB93493 CSR area (DAV daughter board) - 0xFD000000 - 0xFDFFFFFF CS4# [CB70/CB451] CPU-card extra flash space - 0xFE000000 - 0xFEFFFFFF Internal CPU peripherals - 0xFF000000 - 0xFF1FFFFF CS0# Flash 1 - 0xFF200000 - 0xFF3FFFFF CS0# Flash 2 - 0xFFC00000 - 0xFFC0001F CS0# [VDK] FPGA - - The kernel reads the size of the SDRAM from the memory bus controller - registers by default. - - The kernel initialisation code (1) adjusts the SDRAM base addresses to - move the SDRAM to desired address, (2) moves the kernel image down to the - bottom of SDRAM, (3) adjusts the bus controller registers to move I/O - windows, and (4) rearranges the protection registers to protect all of - this. - - The reasons for doing this are: (1) the page at address 0 should be - inaccessible so that NULL pointer errors can be caught; and (2) the bottom - three quarters are left unoccupied so that an FR-V CPU with an MMU can use - it for virtual userspace mappings. - - See include/asm-frv/mem-layout.h for constants pertaining to the memory - layout. - - See include/asm-frv/mb-regs.h for the constants pertaining to the I/O bus - controller configuration. - - - (*) uClinux Memory Protection - - A DAMPR register is used to cover the entire region used for I/O - (0xE0000000 - 0xFFFFFFFF). This permits the kernel to make uncached - accesses to this region. Userspace is not permitted to access it. - - The DAMPR/IAMPR protection registers not in use for any other purpose are - tiled over the top of the SDRAM such that: - - (1) The core kernel image is covered by as small a tile as possible - granting only the kernel access to the underlying data, whilst - making sure no SDRAM is actually made unavailable by this approach. - - (2) All other tiles are arranged to permit userspace access to the rest - of the SDRAM. - - Barring point (1), there is nothing to protect kernel data against - userspace damage - but this is uClinux. - - - (*) Exceptions and Fixups - - Since the FR40x and FR55x CPUs that do not have full MMUs generate - imprecise data error exceptions, there are currently no automatic fixup - services available in uClinux. This includes misaligned memory access - fixups. - - Userspace EFAULT errors can be trapped by issuing a MEMBAR instruction and - forcing the fault to happen there. - - On the FR451, however, data exceptions are mostly precise, and so - exception fixup handling is implemented as normal. - - - (*) Userspace Breakpoints - - The ptrace() system call supports the following userspace debugging - features: - - (1) Hardware assisted single step. - - (2) Breakpoint via the FR-V "BREAK" instruction. - - (3) Breakpoint via the FR-V "TIRA GR0, #1" instruction. - - (4) Syscall entry/exit trap. - - Each of the above generates a SIGTRAP. - - - (*) On-Chip Serial Ports - - The FR-V on-chip serial ports are made available as ttyS0 and ttyS1. Note - that if the GDB stub is compiled in, ttyS1 will not actually be available - as it will be being used for the GDB stub. - - These ports can be made by: - - mknod /dev/ttyS0 c 4 64 - mknod /dev/ttyS1 c 4 65 - - - (*) Maskable Interrupts - - Level 15 (Non-maskable) interrupts are dealt with by the GDB stub if - present, and cause a panic if not. If the GDB stub is present, ttyS1's - interrupts are rated at level 15. - - All other interrupts are distributed over the set of available priorities - so that no IRQs are shared where possible. The arch interrupt handling - routines attempt to disentangle the various sources available through the - CPU's own multiplexor, and those on off-CPU peripherals. - - - (*) Accessing PCI Devices - - Where PCI is available, care must be taken when dealing with drivers that - access PCI devices. PCI devices present their data in little-endian form, - but the CPU sees it in big-endian form. The macros in asm/io.h try to get - this right, but may not under all circumstances... - - - (*) Ax88796 Ethernet Driver - - The MB93093 PDK board has an Ax88796 ethernet chipset (an NE2000 clone). A - driver has been written to deal specifically with this. The driver - provides MII services for the card. - - The driver can be configured by running make xconfig, and going to: - - (*) Network device support - - turn on "Network device support" - (*) Ethernet (10 or 100Mbit) - - turn on "Ethernet (10 or 100Mbit)" - - turn on "AX88796 NE2000 compatible chipset" - - The driver can be found in: - - drivers/net/ax88796.c - include/asm/ax88796.h - - - (*) WorkRAM Driver - - This driver provides a character device that permits access to the WorkRAM - that can be found on the FR451 CPU. Each page is accessible through a - separate minor number, thereby permitting each page to have its own - filesystem permissions set on the device file. - - The device files should be: - - mknod /dev/frv/workram0 c 240 0 - mknod /dev/frv/workram1 c 240 1 - mknod /dev/frv/workram2 c 240 2 - ... - - The driver will not permit the opening of any device file that does not - correspond to at least a partial page of WorkRAM. So the first device file - is the only one available on the FR451. If any other CPU is detected, none - of the devices will be openable. - - The devices can be accessed with read, write and llseek, and can also be - mmapped. If they're mmapped, they will only map at the appropriate - 0x7e8nnnnn address on linux and at the 0xfe8nnnnn address on uClinux. If - MAP_FIXED is not specified, the appropriate address will be chosen anyway. - - The mappings must be MAP_SHARED not MAP_PRIVATE, and must not be - PROT_EXEC. They must also start at file offset 0, and must not be longer - than one page in size. - - This driver can be configured by running make xconfig, and going to: - - (*) Character devices - - turn on "Fujitsu FR-V CPU WorkRAM support" - - - (*) Dynamic data cache write mode changing - - It is possible to view and to change the data cache's write mode through - the /proc/sys/frv/cache-mode file while the kernel is running. There are - two modes available: - - NAME MEANING - ===== ========================================== - wthru Data cache is in Write-Through mode - wback Data cache is in Write-Back/Copy-Back mode - - To read the cache mode: - - # cat /proc/sys/frv/cache-mode - wthru - - To change the cache mode: - - # echo wback >/proc/sys/frv/cache-mode - # cat /proc/sys/frv/cache-mode - wback - - - (*) MMU Context IDs and Pinning - - On MMU Linux the CPU supports the concept of a context ID in its MMU to - make it more efficient (TLB entries are labelled with a context ID to link - them to specific tasks). - - Normally once a context ID is allocated, it will remain affixed to a task - or CLONE_VM'd group of tasks for as long as it exists. However, since the - kernel is capable of supporting more tasks than there are possible ID - numbers, the kernel will pass context IDs from one task to another if - there are insufficient available. - - The context ID currently in use by a task can be viewed in /proc: - - # grep CXNR /proc/1/status - CXNR: 1 - - Note that kernel threads do not have a userspace context, and so will not - show a CXNR entry in that file. - - Under some circumstances, however, it is desirable to pin a context ID on - a process such that the kernel won't pass it on. This can be done by - writing the process ID of the target process to a special file: - - # echo 17 >/proc/sys/frv/pin-cxnr - - Reading from the file will then show the context ID pinned. - - # cat /proc/sys/frv/pin-cxnr - 4 - - The context ID will remain pinned as long as any process is using that - context, i.e.: when the all the subscribing processes have exited or - exec'd; or when an unpinning request happens: - - # echo 0 >/proc/sys/frv/pin-cxnr - - When there isn't a pinned context, the file shows -1: - - # cat /proc/sys/frv/pin-cxnr - -1 diff --git a/Documentation/frv/gdbinit b/Documentation/frv/gdbinit deleted file mode 100644 index 51517b6f307fc..0000000000000 --- a/Documentation/frv/gdbinit +++ /dev/null @@ -1,102 +0,0 @@ -set remotebreak 1 - -define _amr - -printf "AMRx DAMR IAMR \n" -printf "==== ===================== =====================\n" -printf "amr0 : L:%08lx P:%08lx : L:%08lx P:%08lx\n",__debug_mmu.damr[0x0].L,__debug_mmu.damr[0x0].P,__debug_mmu.iamr[0x0].L,__debug_mmu.iamr[0x0].P -printf "amr1 : L:%08lx P:%08lx : L:%08lx P:%08lx\n",__debug_mmu.damr[0x1].L,__debug_mmu.damr[0x1].P,__debug_mmu.iamr[0x1].L,__debug_mmu.iamr[0x1].P -printf "amr2 : L:%08lx P:%08lx : L:%08lx P:%08lx\n",__debug_mmu.damr[0x2].L,__debug_mmu.damr[0x2].P,__debug_mmu.iamr[0x2].L,__debug_mmu.iamr[0x2].P -printf "amr3 : L:%08lx P:%08lx : L:%08lx P:%08lx\n",__debug_mmu.damr[0x3].L,__debug_mmu.damr[0x3].P,__debug_mmu.iamr[0x3].L,__debug_mmu.iamr[0x3].P -printf "amr4 : L:%08lx P:%08lx : L:%08lx P:%08lx\n",__debug_mmu.damr[0x4].L,__debug_mmu.damr[0x4].P,__debug_mmu.iamr[0x4].L,__debug_mmu.iamr[0x4].P -printf "amr5 : L:%08lx P:%08lx : L:%08lx P:%08lx\n",__debug_mmu.damr[0x5].L,__debug_mmu.damr[0x5].P,__debug_mmu.iamr[0x5].L,__debug_mmu.iamr[0x5].P -printf "amr6 : L:%08lx P:%08lx : L:%08lx P:%08lx\n",__debug_mmu.damr[0x6].L,__debug_mmu.damr[0x6].P,__debug_mmu.iamr[0x6].L,__debug_mmu.iamr[0x6].P -printf "amr7 : L:%08lx P:%08lx : L:%08lx P:%08lx\n",__debug_mmu.damr[0x7].L,__debug_mmu.damr[0x7].P,__debug_mmu.iamr[0x7].L,__debug_mmu.iamr[0x7].P - -printf "amr8 : L:%08lx P:%08lx\n",__debug_mmu.damr[0x8].L,__debug_mmu.damr[0x8].P -printf "amr9 : L:%08lx P:%08lx\n",__debug_mmu.damr[0x9].L,__debug_mmu.damr[0x9].P -printf "amr10: L:%08lx P:%08lx\n",__debug_mmu.damr[0xa].L,__debug_mmu.damr[0xa].P -printf "amr11: L:%08lx P:%08lx\n",__debug_mmu.damr[0xb].L,__debug_mmu.damr[0xb].P - -end - - -define _tlb -printf "tlb[0x00]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x0].L,__debug_mmu.tlb[0x0].P,__debug_mmu.tlb[0x40+0x0].L,__debug_mmu.tlb[0x40+0x0].P -printf "tlb[0x01]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x1].L,__debug_mmu.tlb[0x1].P,__debug_mmu.tlb[0x40+0x1].L,__debug_mmu.tlb[0x40+0x1].P -printf "tlb[0x02]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x2].L,__debug_mmu.tlb[0x2].P,__debug_mmu.tlb[0x40+0x2].L,__debug_mmu.tlb[0x40+0x2].P -printf "tlb[0x03]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x3].L,__debug_mmu.tlb[0x3].P,__debug_mmu.tlb[0x40+0x3].L,__debug_mmu.tlb[0x40+0x3].P -printf "tlb[0x04]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x4].L,__debug_mmu.tlb[0x4].P,__debug_mmu.tlb[0x40+0x4].L,__debug_mmu.tlb[0x40+0x4].P -printf "tlb[0x05]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x5].L,__debug_mmu.tlb[0x5].P,__debug_mmu.tlb[0x40+0x5].L,__debug_mmu.tlb[0x40+0x5].P -printf "tlb[0x06]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x6].L,__debug_mmu.tlb[0x6].P,__debug_mmu.tlb[0x40+0x6].L,__debug_mmu.tlb[0x40+0x6].P -printf "tlb[0x07]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x7].L,__debug_mmu.tlb[0x7].P,__debug_mmu.tlb[0x40+0x7].L,__debug_mmu.tlb[0x40+0x7].P -printf "tlb[0x08]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x8].L,__debug_mmu.tlb[0x8].P,__debug_mmu.tlb[0x40+0x8].L,__debug_mmu.tlb[0x40+0x8].P -printf "tlb[0x09]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x9].L,__debug_mmu.tlb[0x9].P,__debug_mmu.tlb[0x40+0x9].L,__debug_mmu.tlb[0x40+0x9].P -printf "tlb[0x0a]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0xa].L,__debug_mmu.tlb[0xa].P,__debug_mmu.tlb[0x40+0xa].L,__debug_mmu.tlb[0x40+0xa].P -printf "tlb[0x0b]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0xb].L,__debug_mmu.tlb[0xb].P,__debug_mmu.tlb[0x40+0xb].L,__debug_mmu.tlb[0x40+0xb].P -printf "tlb[0x0c]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0xc].L,__debug_mmu.tlb[0xc].P,__debug_mmu.tlb[0x40+0xc].L,__debug_mmu.tlb[0x40+0xc].P -printf "tlb[0x0d]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0xd].L,__debug_mmu.tlb[0xd].P,__debug_mmu.tlb[0x40+0xd].L,__debug_mmu.tlb[0x40+0xd].P -printf "tlb[0x0e]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0xe].L,__debug_mmu.tlb[0xe].P,__debug_mmu.tlb[0x40+0xe].L,__debug_mmu.tlb[0x40+0xe].P -printf "tlb[0x0f]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0xf].L,__debug_mmu.tlb[0xf].P,__debug_mmu.tlb[0x40+0xf].L,__debug_mmu.tlb[0x40+0xf].P -printf "tlb[0x10]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x10].L,__debug_mmu.tlb[0x10].P,__debug_mmu.tlb[0x40+0x10].L,__debug_mmu.tlb[0x40+0x10].P -printf "tlb[0x11]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x11].L,__debug_mmu.tlb[0x11].P,__debug_mmu.tlb[0x40+0x11].L,__debug_mmu.tlb[0x40+0x11].P -printf "tlb[0x12]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x12].L,__debug_mmu.tlb[0x12].P,__debug_mmu.tlb[0x40+0x12].L,__debug_mmu.tlb[0x40+0x12].P -printf "tlb[0x13]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x13].L,__debug_mmu.tlb[0x13].P,__debug_mmu.tlb[0x40+0x13].L,__debug_mmu.tlb[0x40+0x13].P -printf "tlb[0x14]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x14].L,__debug_mmu.tlb[0x14].P,__debug_mmu.tlb[0x40+0x14].L,__debug_mmu.tlb[0x40+0x14].P -printf "tlb[0x15]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x15].L,__debug_mmu.tlb[0x15].P,__debug_mmu.tlb[0x40+0x15].L,__debug_mmu.tlb[0x40+0x15].P -printf "tlb[0x16]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x16].L,__debug_mmu.tlb[0x16].P,__debug_mmu.tlb[0x40+0x16].L,__debug_mmu.tlb[0x40+0x16].P -printf "tlb[0x17]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x17].L,__debug_mmu.tlb[0x17].P,__debug_mmu.tlb[0x40+0x17].L,__debug_mmu.tlb[0x40+0x17].P -printf "tlb[0x18]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x18].L,__debug_mmu.tlb[0x18].P,__debug_mmu.tlb[0x40+0x18].L,__debug_mmu.tlb[0x40+0x18].P -printf "tlb[0x19]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x19].L,__debug_mmu.tlb[0x19].P,__debug_mmu.tlb[0x40+0x19].L,__debug_mmu.tlb[0x40+0x19].P -printf "tlb[0x1a]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x1a].L,__debug_mmu.tlb[0x1a].P,__debug_mmu.tlb[0x40+0x1a].L,__debug_mmu.tlb[0x40+0x1a].P -printf "tlb[0x1b]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x1b].L,__debug_mmu.tlb[0x1b].P,__debug_mmu.tlb[0x40+0x1b].L,__debug_mmu.tlb[0x40+0x1b].P -printf "tlb[0x1c]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x1c].L,__debug_mmu.tlb[0x1c].P,__debug_mmu.tlb[0x40+0x1c].L,__debug_mmu.tlb[0x40+0x1c].P -printf "tlb[0x1d]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x1d].L,__debug_mmu.tlb[0x1d].P,__debug_mmu.tlb[0x40+0x1d].L,__debug_mmu.tlb[0x40+0x1d].P -printf "tlb[0x1e]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x1e].L,__debug_mmu.tlb[0x1e].P,__debug_mmu.tlb[0x40+0x1e].L,__debug_mmu.tlb[0x40+0x1e].P -printf "tlb[0x1f]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x1f].L,__debug_mmu.tlb[0x1f].P,__debug_mmu.tlb[0x40+0x1f].L,__debug_mmu.tlb[0x40+0x1f].P -printf "tlb[0x20]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x20].L,__debug_mmu.tlb[0x20].P,__debug_mmu.tlb[0x40+0x20].L,__debug_mmu.tlb[0x40+0x20].P -printf "tlb[0x21]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x21].L,__debug_mmu.tlb[0x21].P,__debug_mmu.tlb[0x40+0x21].L,__debug_mmu.tlb[0x40+0x21].P -printf "tlb[0x22]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x22].L,__debug_mmu.tlb[0x22].P,__debug_mmu.tlb[0x40+0x22].L,__debug_mmu.tlb[0x40+0x22].P -printf "tlb[0x23]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x23].L,__debug_mmu.tlb[0x23].P,__debug_mmu.tlb[0x40+0x23].L,__debug_mmu.tlb[0x40+0x23].P -printf "tlb[0x24]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x24].L,__debug_mmu.tlb[0x24].P,__debug_mmu.tlb[0x40+0x24].L,__debug_mmu.tlb[0x40+0x24].P -printf "tlb[0x25]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x25].L,__debug_mmu.tlb[0x25].P,__debug_mmu.tlb[0x40+0x25].L,__debug_mmu.tlb[0x40+0x25].P -printf "tlb[0x26]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x26].L,__debug_mmu.tlb[0x26].P,__debug_mmu.tlb[0x40+0x26].L,__debug_mmu.tlb[0x40+0x26].P -printf "tlb[0x27]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x27].L,__debug_mmu.tlb[0x27].P,__debug_mmu.tlb[0x40+0x27].L,__debug_mmu.tlb[0x40+0x27].P -printf "tlb[0x28]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x28].L,__debug_mmu.tlb[0x28].P,__debug_mmu.tlb[0x40+0x28].L,__debug_mmu.tlb[0x40+0x28].P -printf "tlb[0x29]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x29].L,__debug_mmu.tlb[0x29].P,__debug_mmu.tlb[0x40+0x29].L,__debug_mmu.tlb[0x40+0x29].P -printf "tlb[0x2a]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x2a].L,__debug_mmu.tlb[0x2a].P,__debug_mmu.tlb[0x40+0x2a].L,__debug_mmu.tlb[0x40+0x2a].P -printf "tlb[0x2b]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x2b].L,__debug_mmu.tlb[0x2b].P,__debug_mmu.tlb[0x40+0x2b].L,__debug_mmu.tlb[0x40+0x2b].P -printf "tlb[0x2c]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x2c].L,__debug_mmu.tlb[0x2c].P,__debug_mmu.tlb[0x40+0x2c].L,__debug_mmu.tlb[0x40+0x2c].P -printf "tlb[0x2d]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x2d].L,__debug_mmu.tlb[0x2d].P,__debug_mmu.tlb[0x40+0x2d].L,__debug_mmu.tlb[0x40+0x2d].P -printf "tlb[0x2e]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x2e].L,__debug_mmu.tlb[0x2e].P,__debug_mmu.tlb[0x40+0x2e].L,__debug_mmu.tlb[0x40+0x2e].P -printf "tlb[0x2f]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x2f].L,__debug_mmu.tlb[0x2f].P,__debug_mmu.tlb[0x40+0x2f].L,__debug_mmu.tlb[0x40+0x2f].P -printf "tlb[0x30]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x30].L,__debug_mmu.tlb[0x30].P,__debug_mmu.tlb[0x40+0x30].L,__debug_mmu.tlb[0x40+0x30].P -printf "tlb[0x31]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x31].L,__debug_mmu.tlb[0x31].P,__debug_mmu.tlb[0x40+0x31].L,__debug_mmu.tlb[0x40+0x31].P -printf "tlb[0x32]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x32].L,__debug_mmu.tlb[0x32].P,__debug_mmu.tlb[0x40+0x32].L,__debug_mmu.tlb[0x40+0x32].P -printf "tlb[0x33]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x33].L,__debug_mmu.tlb[0x33].P,__debug_mmu.tlb[0x40+0x33].L,__debug_mmu.tlb[0x40+0x33].P -printf "tlb[0x34]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x34].L,__debug_mmu.tlb[0x34].P,__debug_mmu.tlb[0x40+0x34].L,__debug_mmu.tlb[0x40+0x34].P -printf "tlb[0x35]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x35].L,__debug_mmu.tlb[0x35].P,__debug_mmu.tlb[0x40+0x35].L,__debug_mmu.tlb[0x40+0x35].P -printf "tlb[0x36]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x36].L,__debug_mmu.tlb[0x36].P,__debug_mmu.tlb[0x40+0x36].L,__debug_mmu.tlb[0x40+0x36].P -printf "tlb[0x37]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x37].L,__debug_mmu.tlb[0x37].P,__debug_mmu.tlb[0x40+0x37].L,__debug_mmu.tlb[0x40+0x37].P -printf "tlb[0x38]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x38].L,__debug_mmu.tlb[0x38].P,__debug_mmu.tlb[0x40+0x38].L,__debug_mmu.tlb[0x40+0x38].P -printf "tlb[0x39]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x39].L,__debug_mmu.tlb[0x39].P,__debug_mmu.tlb[0x40+0x39].L,__debug_mmu.tlb[0x40+0x39].P -printf "tlb[0x3a]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x3a].L,__debug_mmu.tlb[0x3a].P,__debug_mmu.tlb[0x40+0x3a].L,__debug_mmu.tlb[0x40+0x3a].P -printf "tlb[0x3b]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x3b].L,__debug_mmu.tlb[0x3b].P,__debug_mmu.tlb[0x40+0x3b].L,__debug_mmu.tlb[0x40+0x3b].P -printf "tlb[0x3c]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x3c].L,__debug_mmu.tlb[0x3c].P,__debug_mmu.tlb[0x40+0x3c].L,__debug_mmu.tlb[0x40+0x3c].P -printf "tlb[0x3d]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x3d].L,__debug_mmu.tlb[0x3d].P,__debug_mmu.tlb[0x40+0x3d].L,__debug_mmu.tlb[0x40+0x3d].P -printf "tlb[0x3e]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x3e].L,__debug_mmu.tlb[0x3e].P,__debug_mmu.tlb[0x40+0x3e].L,__debug_mmu.tlb[0x40+0x3e].P -printf "tlb[0x3f]: %08lx %08lx %08lx %08lx\n",__debug_mmu.tlb[0x3f].L,__debug_mmu.tlb[0x3f].P,__debug_mmu.tlb[0x40+0x3f].L,__debug_mmu.tlb[0x40+0x3f].P -end - - -define _pgd -p (pgd_t[0x40])*(pgd_t*)(__debug_mmu.damr[0x3].L) -end - -define _ptd_i -p (pte_t[0x1000])*(pte_t*)(__debug_mmu.damr[0x4].L) -end - -define _ptd_d -p (pte_t[0x1000])*(pte_t*)(__debug_mmu.damr[0x5].L) -end diff --git a/Documentation/frv/gdbstub.txt b/Documentation/frv/gdbstub.txt deleted file mode 100644 index b92bfd902a4e4..0000000000000 --- a/Documentation/frv/gdbstub.txt +++ /dev/null @@ -1,130 +0,0 @@ - ==================== - DEBUGGING FR-V LINUX - ==================== - - -The kernel contains a GDB stub that talks GDB remote protocol across a serial -port. This permits GDB to single step through the kernel, set breakpoints and -trap exceptions that happen in kernel space and interrupt execution. It also -permits the NMI interrupt button or serial port events to jump the kernel into -the debugger. - -On the CPUs that have on-chip UARTs (FR400, FR403, FR405, FR555), the -GDB stub hijacks a serial port for its own purposes, and makes it -generate level 15 interrupts (NMI). The kernel proper cannot see the serial -port in question under these conditions. - -On the MB93091-VDK CPU boards, the GDB stub uses UART1, which would otherwise -be /dev/ttyS1. On the MB93093-PDK, the GDB stub uses UART0. Therefore, on the -PDK there is no externally accessible serial port and the serial port to -which the touch screen is attached becomes /dev/ttyS0. - -Note that the GDB stub runs entirely within CPU debug mode, and so should not -incur any exceptions or interrupts whilst it is active. In particular, note -that the clock will lose time since it is implemented in software. - - -================== -KERNEL PREPARATION -================== - -Firstly, a debuggable kernel must be built. To do this, unpack the kernel tree -and copy the configuration that you wish to use to .config. Then reconfigure -the following things on the "Kernel Hacking" tab: - - (*) "Include debugging information" - - Set this to "Y". This causes all C and Assembly files to be compiled - to include debugging information. - - (*) "In-kernel GDB stub" - - Set this to "Y". This causes the GDB stub to be compiled into the - kernel. - - (*) "Immediate activation" - - Set this to "Y" if you want the GDB stub to activate as soon as possible - and wait for GDB to connect. This allows you to start tracing right from - the beginning of start_kernel() in init/main.c. - - (*) "Console through GDB stub" - - Set this to "Y" if you wish to be able to use "console=gdb0" on the - command line. That tells the kernel to pass system console messages to - GDB (which then prints them on its standard output). This is useful when - debugging the serial drivers that'd otherwise be used to pass console - messages to the outside world. - -Then build as usual, download to the board and execute. Note that if -"Immediate activation" was selected, then the kernel will wait for GDB to -attach. If not, then the kernel will boot immediately and GDB will have to -interrupt it or wait for an exception to occur before doing anything with -the kernel. - - -========================= -KERNEL DEBUGGING WITH GDB -========================= - -Set the serial port on the computer that's going to run GDB to the appropriate -baud rate. Assuming the board's debug port is connected to ttyS0/COM1 on the -computer doing the debugging: - - stty -F /dev/ttyS0 115200 - -Then start GDB in the base of the kernel tree: - - frv-uclinux-gdb linux [uClinux] - -Or: - - frv-uclinux-gdb vmlinux [MMU linux] - -When the prompt appears: - - GNU gdb frv-031024 - Copyright 2003 Free Software Foundation, Inc. - GDB is free software, covered by the GNU General Public License, and you are - welcome to change it and/or distribute copies of it under certain conditions. - Type "show copying" to see the conditions. - There is absolutely no warranty for GDB. Type "show warranty" for details. - This GDB was configured as "--host=i686-pc-linux-gnu --target=frv-uclinux"... - (gdb) - -Attach to the board like this: - - (gdb) target remote /dev/ttyS0 - Remote debugging using /dev/ttyS0 - start_kernel () at init/main.c:395 - (gdb) - -This should show the appropriate lines from the source too. The kernel can -then be debugged almost as if it's any other program. - - -=============================== -INTERRUPTING THE RUNNING KERNEL -=============================== - -The kernel can be interrupted whilst it is running, causing a jump back to the -GDB stub and the debugger: - - (*) Pressing Ctrl-C in GDB. This will cause GDB to try and interrupt the - kernel by sending an RS232 BREAK over the serial line to the GDB - stub. This will (mostly) immediately interrupt the kernel and return it - to the debugger. - - (*) Pressing the NMI button on the board will also cause a jump into the - debugger. - - (*) Setting a software breakpoint. This sets a break instruction at the - desired location which the GDB stub then traps the exception for. - - (*) Setting a hardware breakpoint. The GDB stub is capable of using the IBAR - and DBAR registers to assist debugging. - -Furthermore, the GDB stub will intercept a number of exceptions automatically -if they are caused by kernel execution. It will also intercept BUG() macro -invocation. - diff --git a/Documentation/frv/kernel-ABI.txt b/Documentation/frv/kernel-ABI.txt deleted file mode 100644 index aaa1cec86f0bb..0000000000000 --- a/Documentation/frv/kernel-ABI.txt +++ /dev/null @@ -1,262 +0,0 @@ - ================================= - INTERNAL KERNEL ABI FOR FR-V ARCH - ================================= - -The internal FRV kernel ABI is not quite the same as the userspace ABI. A -number of the registers are used for special purposed, and the ABI is not -consistent between modules vs core, and MMU vs no-MMU. - -This partly stems from the fact that FRV CPUs do not have a separate -supervisor stack pointer, and most of them do not have any scratch -registers, thus requiring at least one general purpose register to be -clobbered in such an event. Also, within the kernel core, it is possible to -simply jump or call directly between functions using a relative offset. -This cannot be extended to modules for the displacement is likely to be too -far. Thus in modules the address of a function to call must be calculated -in a register and then used, requiring two extra instructions. - -This document has the following sections: - - (*) System call register ABI - (*) CPU operating modes - (*) Internal kernel-mode register ABI - (*) Internal debug-mode register ABI - (*) Virtual interrupt handling - - -======================== -SYSTEM CALL REGISTER ABI -======================== - -When a system call is made, the following registers are effective: - - REGISTERS CALL RETURN - =============== ======================= ======================= - GR7 System call number Preserved - GR8 Syscall arg #1 Return value - GR9-GR13 Syscall arg #2-6 Preserved - - -=================== -CPU OPERATING MODES -=================== - -The FR-V CPU has three basic operating modes. In order of increasing -capability: - - (1) User mode. - - Basic userspace running mode. - - (2) Kernel mode. - - Normal kernel mode. There are many additional control registers - available that may be accessed in this mode, in addition to all the - stuff available to user mode. This has two submodes: - - (a) Exceptions enabled (PSR.T == 1). - - Exceptions will invoke the appropriate normal kernel mode - handler. On entry to the handler, the PSR.T bit will be cleared. - - (b) Exceptions disabled (PSR.T == 0). - - No exceptions or interrupts may happen. Any mandatory exceptions - will cause the CPU to halt unless the CPU is told to jump into - debug mode instead. - - (3) Debug mode. - - No exceptions may happen in this mode. Memory protection and - management exceptions will be flagged for later consideration, but - the exception handler won't be invoked. Debugging traps such as - hardware breakpoints and watchpoints will be ignored. This mode is - entered only by debugging events obtained from the other two modes. - - All kernel mode registers may be accessed, plus a few extra debugging - specific registers. - - -================================= -INTERNAL KERNEL-MODE REGISTER ABI -================================= - -There are a number of permanent register assignments that are set up by -entry.S in the exception prologue. Note that there is a complete set of -exception prologues for each of user->kernel transition and kernel->kernel -transition. There are also user->debug and kernel->debug mode transition -prologues. - - - REGISTER FLAVOUR USE - =============== ======= ============================================== - GR1 Supervisor stack pointer - GR15 Current thread info pointer - GR16 GP-Rel base register for small data - GR28 Current exception frame pointer (__frame) - GR29 Current task pointer (current) - GR30 Destroyed by kernel mode entry - GR31 NOMMU Destroyed by debug mode entry - GR31 MMU Destroyed by TLB miss kernel mode entry - CCR.ICC2 Virtual interrupt disablement tracking - CCCR.CC3 Cleared by exception prologue - (atomic op emulation) - SCR0 MMU See mmu-layout.txt. - SCR1 MMU See mmu-layout.txt. - SCR2 MMU Save for EAR0 (destroyed by icache insns - in debug mode) - SCR3 MMU Save for GR31 during debug exceptions - DAMR/IAMR NOMMU Fixed memory protection layout. - DAMR/IAMR MMU See mmu-layout.txt. - - -Certain registers are also used or modified across function calls: - - REGISTER CALL RETURN - =============== =============================== ====================== - GR0 Fixed Zero - - GR2 Function call frame pointer - GR3 Special Preserved - GR3-GR7 - Clobbered - GR8 Function call arg #1 Return value - (or clobbered) - GR9 Function call arg #2 Return value MSW - (or clobbered) - GR10-GR13 Function call arg #3-#6 Clobbered - GR14 - Clobbered - GR15-GR16 Special Preserved - GR17-GR27 - Preserved - GR28-GR31 Special Only accessed - explicitly - LR Return address after CALL Clobbered - CCR/CCCR - Mostly Clobbered - - -================================ -INTERNAL DEBUG-MODE REGISTER ABI -================================ - -This is the same as the kernel-mode register ABI for functions calls. The -difference is that in debug-mode there's a different stack and a different -exception frame. Almost all the global registers from kernel-mode -(including the stack pointer) may be changed. - - REGISTER FLAVOUR USE - =============== ======= ============================================== - GR1 Debug stack pointer - GR16 GP-Rel base register for small data - GR31 Current debug exception frame pointer - (__debug_frame) - SCR3 MMU Saved value of GR31 - - -Note that debug mode is able to interfere with the kernel's emulated atomic -ops, so it must be exceedingly careful not to do any that would interact -with the main kernel in this regard. Hence the debug mode code (gdbstub) is -almost completely self-contained. The only external code used is the -sprintf family of functions. - -Furthermore, break.S is so complicated because single-step mode does not -switch off on entry to an exception. That means unless manually disabled, -single-stepping will blithely go on stepping into things like interrupts. -See gdbstub.txt for more information. - - -========================== -VIRTUAL INTERRUPT HANDLING -========================== - -Because accesses to the PSR is so slow, and to disable interrupts we have -to access it twice (once to read and once to write), we don't actually -disable interrupts at all if we don't have to. What we do instead is use -the ICC2 condition code flags to note virtual disablement, such that if we -then do take an interrupt, we note the flag, really disable interrupts, set -another flag and resume execution at the point the interrupt happened. -Setting condition flags as a side effect of an arithmetic or logical -instruction is really fast. This use of the ICC2 only occurs within the -kernel - it does not affect userspace. - -The flags we use are: - - (*) CCR.ICC2.Z [Zero flag] - - Set to virtually disable interrupts, clear when interrupts are - virtually enabled. Can be modified by logical instructions without - affecting the Carry flag. - - (*) CCR.ICC2.C [Carry flag] - - Clear to indicate hardware interrupts are really disabled, set otherwise. - - -What happens is this: - - (1) Normal kernel-mode operation. - - ICC2.Z is 0, ICC2.C is 1. - - (2) An interrupt occurs. The exception prologue examines ICC2.Z and - determines that nothing needs doing. This is done simply with an - unlikely BEQ instruction. - - (3) The interrupts are disabled (local_irq_disable) - - ICC2.Z is set to 1. - - (4) If interrupts were then re-enabled (local_irq_enable): - - ICC2.Z would be set to 0. - - A TIHI #2 instruction (trap #2 if condition HI - Z==0 && C==0) would - be used to trap if interrupts were now virtually enabled, but - physically disabled - which they're not, so the trap isn't taken. The - kernel would then be back to state (1). - - (5) An interrupt occurs. The exception prologue examines ICC2.Z and - determines that the interrupt shouldn't actually have happened. It - jumps aside, and there disabled interrupts by setting PSR.PIL to 14 - and then it clears ICC2.C. - - (6) If interrupts were then saved and disabled again (local_irq_save): - - ICC2.Z would be shifted into the save variable and masked off - (giving a 1). - - ICC2.Z would then be set to 1 (thus unchanged), and ICC2.C would be - unaffected (ie: 0). - - (7) If interrupts were then restored from state (6) (local_irq_restore): - - ICC2.Z would be set to indicate the result of XOR'ing the saved - value (ie: 1) with 1, which gives a result of 0 - thus leaving - ICC2.Z set. - - ICC2.C would remain unaffected (ie: 0). - - A TIHI #2 instruction would be used to again assay the current state, - but this would do nothing as Z==1. - - (8) If interrupts were then enabled (local_irq_enable): - - ICC2.Z would be cleared. ICC2.C would be left unaffected. Both - flags would now be 0. - - A TIHI #2 instruction again issued to assay the current state would - then trap as both Z==0 [interrupts virtually enabled] and C==0 - [interrupts really disabled] would then be true. - - (9) The trap #2 handler would simply enable hardware interrupts - (set PSR.PIL to 0), set ICC2.C to 1 and return. - -(10) Immediately upon returning, the pending interrupt would be taken. - -(11) The interrupt handler would take the path of actually processing the - interrupt (ICC2.Z is clear, BEQ fails as per step (2)). - -(12) The interrupt handler would then set ICC2.C to 1 since hardware - interrupts are definitely enabled - or else the kernel wouldn't be here. - -(13) On return from the interrupt handler, things would be back to state (1). - -This trap (#2) is only available in kernel mode. In user mode it will -result in SIGILL. diff --git a/Documentation/frv/mmu-layout.txt b/Documentation/frv/mmu-layout.txt deleted file mode 100644 index db10250df6be6..0000000000000 --- a/Documentation/frv/mmu-layout.txt +++ /dev/null @@ -1,306 +0,0 @@ - ================================= - FR451 MMU LINUX MEMORY MANAGEMENT - ================================= - -============ -MMU HARDWARE -============ - -FR451 MMU Linux puts the MMU into EDAT mode whilst running. This means that it uses both the SAT -registers and the DAT TLB to perform address translation. - -There are 8 IAMLR/IAMPR register pairs and 16 DAMLR/DAMPR register pairs for SAT mode. - -In DAT mode, there is also a TLB organised in cache format as 64 lines x 2 ways. Each line spans a -16KB range of addresses, but can match a larger region. - - -=========================== -MEMORY MANAGEMENT REGISTERS -=========================== - -Certain control registers are used by the kernel memory management routines: - - REGISTERS USAGE - ====================== ================================================== - IAMR0, DAMR0 Kernel image and data mappings - IAMR1, DAMR1 First-chance TLB lookup mapping - DAMR2 Page attachment for cache flush by page - DAMR3 Current PGD mapping - SCR0, DAMR4 Instruction TLB PGE/PTD cache - SCR1, DAMR5 Data TLB PGE/PTD cache - DAMR6-10 kmap_atomic() mappings - DAMR11 I/O mapping - CXNR mm_struct context ID - TTBR Page directory (PGD) pointer (physical address) - - -===================== -GENERAL MEMORY LAYOUT -===================== - -The physical memory layout is as follows: - - PHYSICAL ADDRESS CONTROLLER DEVICE - =================== ============== ======================================= - 00000000 - BFFFFFFF SDRAM SDRAM area - E0000000 - EFFFFFFF L-BUS CS2# VDK SLBUS/PCI window - F0000000 - F0FFFFFF L-BUS CS5# MB93493 CSC area (DAV daughter board) - F1000000 - F1FFFFFF L-BUS CS7# (CB70 CPU-card PCMCIA port I/O space) - FC000000 - FC0FFFFF L-BUS CS1# VDK MB86943 config space - FC100000 - FC1FFFFF L-BUS CS6# DM9000 NIC I/O space - FC200000 - FC2FFFFF L-BUS CS3# MB93493 CSR area (DAV daughter board) - FD000000 - FDFFFFFF L-BUS CS4# (CB70 CPU-card extra flash space) - FE000000 - FEFFFFFF Internal CPU peripherals - FF000000 - FF1FFFFF L-BUS CS0# Flash 1 - FF200000 - FF3FFFFF L-BUS CS0# Flash 2 - FFC00000 - FFC0001F L-BUS CS0# FPGA - -The virtual memory layout is: - - VIRTUAL ADDRESS PHYSICAL TRANSLATOR FLAGS SIZE OCCUPATION - ================= ======== ============== ======= ======= =================================== - 00004000-BFFFFFFF various TLB,xAMR1 D-N-??V 3GB Userspace - C0000000-CFFFFFFF 00000000 xAMPR0 -L-S--V 256MB Kernel image and data - D0000000-D7FFFFFF various TLB,xAMR1 D-NS??V 128MB vmalloc area - D8000000-DBFFFFFF various TLB,xAMR1 D-NS??V 64MB kmap() area - DC000000-DCFFFFFF various TLB 1MB Secondary kmap_atomic() frame - DD000000-DD27FFFF various DAMR 160KB Primary kmap_atomic() frame - DD040000 DAMR2/IAMR2 -L-S--V page Page cache flush attachment point - DD080000 DAMR3 -L-SC-V page Page Directory (PGD) - DD0C0000 DAMR4 -L-SC-V page Cached insn TLB Page Table lookup - DD100000 DAMR5 -L-SC-V page Cached data TLB Page Table lookup - DD140000 DAMR6 -L-S--V page kmap_atomic(KM_BOUNCE_READ) - DD180000 DAMR7 -L-S--V page kmap_atomic(KM_SKB_SUNRPC_DATA) - DD1C0000 DAMR8 -L-S--V page kmap_atomic(KM_SKB_DATA_SOFTIRQ) - DD200000 DAMR9 -L-S--V page kmap_atomic(KM_USER0) - DD240000 DAMR10 -L-S--V page kmap_atomic(KM_USER1) - E0000000-FFFFFFFF E0000000 DAMR11 -L-SC-V 512MB I/O region - -IAMPR1 and DAMPR1 are used as an extension to the TLB. - - -==================== -KMAP AND KMAP_ATOMIC -==================== - -To access pages in the page cache (which may not be directly accessible if highmem is available), -the kernel calls kmap(), does the access and then calls kunmap(); or it calls kmap_atomic(), does -the access and then calls kunmap_atomic(). - -kmap() creates an attachment between an arbitrary inaccessible page and a range of virtual -addresses by installing a PTE in a special page table. The kernel can then access this page as it -wills. When it's finished, the kernel calls kunmap() to clear the PTE. - -kmap_atomic() does something slightly different. In the interests of speed, it chooses one of two -strategies: - - (1) If possible, kmap_atomic() attaches the requested page to one of DAMPR5 through DAMPR10 - register pairs; and the matching kunmap_atomic() clears the DAMPR. This makes high memory - support really fast as there's no need to flush the TLB or modify the page tables. The DAMLR - registers being used for this are preset during boot and don't change over the lifetime of the - process. There's a direct mapping between the first few kmap_atomic() types, DAMR number and - virtual address slot. - - However, there are more kmap_atomic() types defined than there are DAMR registers available, - so we fall back to: - - (2) kmap_atomic() uses a slot in the secondary frame (determined by the type parameter), and then - locks an entry in the TLB to translate that slot to the specified page. The number of slots is - obviously limited, and their positions are controlled such that each slot is matched by a - different line in the TLB. kunmap() ejects the entry from the TLB. - -Note that the first three kmap atomic types are really just declared as placeholders. The DAMPR -registers involved are actually modified directly. - -Also note that kmap() itself may sleep, kmap_atomic() may never sleep and both always succeed; -furthermore, a driver using kmap() may sleep before calling kunmap(), but may not sleep before -calling kunmap_atomic() if it had previously called kmap_atomic(). - - -=============================== -USING MORE THAN 256MB OF MEMORY -=============================== - -The kernel cannot access more than 256MB of memory directly. The physical layout, however, permits -up to 3GB of SDRAM (possibly 3.25GB) to be made available. By using CONFIG_HIGHMEM, the kernel can -allow userspace (by way of page tables) and itself (by way of kmap) to deal with the memory -allocation. - -External devices can, of course, still DMA to and from all of the SDRAM, even if the kernel can't -see it directly. The kernel translates page references into real addresses for communicating to the -devices. - - -=================== -PAGE TABLE TOPOLOGY -=================== - -The page tables are arranged in 2-layer format. There is a middle layer (PMD) that would be used in -3-layer format tables but that is folded into the top layer (PGD) and so consumes no extra memory -or processing power. - - +------+ PGD PMD - | TTBR |--->+-------------------+ - +------+ | | : STE | - | PGE0 | PME0 : STE | - | | : STE | - +-------------------+ Page Table - | | : STE -------------->+--------+ +0x0000 - | PGE1 | PME0 : STE -----------+ | PTE0 | - | | : STE -------+ | +--------+ - +-------------------+ | | | PTE63 | - | | : STE | | +-->+--------+ +0x0100 - | PGE2 | PME0 : STE | | | PTE64 | - | | : STE | | +--------+ - +-------------------+ | | PTE127 | - | | : STE | +------>+--------+ +0x0200 - | PGE3 | PME0 : STE | | PTE128 | - | | : STE | +--------+ - +-------------------+ | PTE191 | - +--------+ +0x0300 - -Each Page Directory (PGD) is 16KB (page size) in size and is divided into 64 entries (PGEs). Each -PGE contains one Page Mid Directory (PMD). - -Each PMD is 256 bytes in size and contains a single entry (PME). Each PME holds 64 FR451 MMU -segment table entries of 4 bytes apiece. Each PME "points to" a page table. In practice, each STE -points to a subset of the page table, the first to PT+0x0000, the second to PT+0x0100, the third to -PT+0x200, and so on. - -Each PGE and PME covers 64MB of the total virtual address space. - -Each Page Table (PTD) is 16KB (page size) in size, and is divided into 4096 entries (PTEs). Each -entry can point to one 16KB page. In practice, each Linux page table is subdivided into 64 FR451 -MMU page tables. But they are all grouped together to make management easier, in particular rmap -support is then trivial. - -Grouping page tables in this fashion makes PGE caching in SCR0/SCR1 more efficient because the -coverage of the cached item is greater. - -Page tables for the vmalloc area are allocated at boot time and shared between all mm_structs. - - -================= -USER SPACE LAYOUT -================= - -For MMU capable Linux, the regions userspace code are allowed to access are kept entirely separate -from those dedicated to the kernel: - - VIRTUAL ADDRESS SIZE PURPOSE - ================= ===== =================================== - 00000000-00003fff 4KB NULL pointer access trap - 00004000-01ffffff ~32MB lower mmap space (grows up) - 02000000-021fffff 2MB Stack space (grows down from top) - 02200000-nnnnnnnn Executable mapping - nnnnnnnn- brk space (grows up) - -bfffffff upper mmap space (grows down) - -This is so arranged so as to make best use of the 16KB page tables and the way in which PGEs/PMEs -are cached by the TLB handler. The lower mmap space is filled first, and then the upper mmap space -is filled. - - -=============================== -GDB-STUB MMU DEBUGGING SERVICES -=============================== - -The gdb-stub included in this kernel provides a number of services to aid in the debugging of MMU -related kernel services: - - (*) Every time the kernel stops, certain state information is dumped into __debug_mmu. This - variable is defined in arch/frv/kernel/gdb-stub.c. Note that the gdbinit file in this - directory has some useful macros for dealing with this. - - (*) __debug_mmu.tlb[] - - This receives the current TLB contents. This can be viewed with the _tlb GDB macro: - - (gdb) _tlb - tlb[0x00]: 01000005 00718203 01000002 00718203 - tlb[0x01]: 01004002 006d4201 01004005 006d4203 - tlb[0x02]: 01008002 006d0201 01008006 00004200 - tlb[0x03]: 0100c006 007f4202 0100c002 0064c202 - tlb[0x04]: 01110005 00774201 01110002 00774201 - tlb[0x05]: 01114005 00770201 01114002 00770201 - tlb[0x06]: 01118002 0076c201 01118005 0076c201 - ... - tlb[0x3d]: 010f4002 00790200 001f4002 0054ca02 - tlb[0x3e]: 010f8005 0078c201 010f8002 0078c201 - tlb[0x3f]: 001fc002 0056ca01 001fc005 00538a01 - - (*) __debug_mmu.iamr[] - (*) __debug_mmu.damr[] - - These receive the current IAMR and DAMR contents. These can be viewed with the _amr - GDB macro: - - (gdb) _amr - AMRx DAMR IAMR - ==== ===================== ===================== - amr0 : L:c0000000 P:00000cb9 : L:c0000000 P:000004b9 - amr1 : L:01070005 P:006f9203 : L:0102c005 P:006a1201 - amr2 : L:d8d00000 P:00000000 : L:d8d00000 P:00000000 - amr3 : L:d8d04000 P:00534c0d : L:00000000 P:00000000 - amr4 : L:d8d08000 P:00554c0d : L:00000000 P:00000000 - amr5 : L:d8d0c000 P:00554c0d : L:00000000 P:00000000 - amr6 : L:d8d10000 P:00000000 : L:00000000 P:00000000 - amr7 : L:d8d14000 P:00000000 : L:00000000 P:00000000 - amr8 : L:d8d18000 P:00000000 - amr9 : L:d8d1c000 P:00000000 - amr10: L:d8d20000 P:00000000 - amr11: L:e0000000 P:e0000ccd - - (*) The current task's page directory is bound to DAMR3. - - This can be viewed with the _pgd GDB macro: - - (gdb) _pgd - $3 = {{pge = {{ste = {0x554001, 0x554101, 0x554201, 0x554301, 0x554401, - 0x554501, 0x554601, 0x554701, 0x554801, 0x554901, 0x554a01, - 0x554b01, 0x554c01, 0x554d01, 0x554e01, 0x554f01, 0x555001, - 0x555101, 0x555201, 0x555301, 0x555401, 0x555501, 0x555601, - 0x555701, 0x555801, 0x555901, 0x555a01, 0x555b01, 0x555c01, - 0x555d01, 0x555e01, 0x555f01, 0x556001, 0x556101, 0x556201, - 0x556301, 0x556401, 0x556501, 0x556601, 0x556701, 0x556801, - 0x556901, 0x556a01, 0x556b01, 0x556c01, 0x556d01, 0x556e01, - 0x556f01, 0x557001, 0x557101, 0x557201, 0x557301, 0x557401, - 0x557501, 0x557601, 0x557701, 0x557801, 0x557901, 0x557a01, - 0x557b01, 0x557c01, 0x557d01, 0x557e01, 0x557f01}}}}, {pge = {{ - ste = {0x0 }}}} , {pge = {{ste = { - 0x248001, 0x248101, 0x248201, 0x248301, 0x248401, 0x248501, - 0x248601, 0x248701, 0x248801, 0x248901, 0x248a01, 0x248b01, - 0x248c01, 0x248d01, 0x248e01, 0x248f01, 0x249001, 0x249101, - 0x249201, 0x249301, 0x249401, 0x249501, 0x249601, 0x249701, - 0x249801, 0x249901, 0x249a01, 0x249b01, 0x249c01, 0x249d01, - 0x249e01, 0x249f01, 0x24a001, 0x24a101, 0x24a201, 0x24a301, - 0x24a401, 0x24a501, 0x24a601, 0x24a701, 0x24a801, 0x24a901, - 0x24aa01, 0x24ab01, 0x24ac01, 0x24ad01, 0x24ae01, 0x24af01, - 0x24b001, 0x24b101, 0x24b201, 0x24b301, 0x24b401, 0x24b501, - 0x24b601, 0x24b701, 0x24b801, 0x24b901, 0x24ba01, 0x24bb01, - 0x24bc01, 0x24bd01, 0x24be01, 0x24bf01}}}}, {pge = {{ste = { - 0x0 }}}} } - - (*) The PTD last used by the instruction TLB miss handler is attached to DAMR4. - (*) The PTD last used by the data TLB miss handler is attached to DAMR5. - - These can be viewed with the _ptd_i and _ptd_d GDB macros: - - (gdb) _ptd_d - $5 = {{pte = 0x0} , {pte = 0x539b01}, { - pte = 0x0} , {pte = 0x719303}, {pte = 0x6d5303}, { - pte = 0x0}, {pte = 0x0}, {pte = 0x0}, {pte = 0x0}, {pte = 0x0}, { - pte = 0x0}, {pte = 0x0}, {pte = 0x0}, {pte = 0x0}, {pte = 0x6a1303}, { - pte = 0x0} , {pte = 0x709303}, {pte = 0x0}, {pte = 0x0}, - {pte = 0x6fd303}, {pte = 0x6f9303}, {pte = 0x6f5303}, {pte = 0x0}, { - pte = 0x6ed303}, {pte = 0x531b01}, {pte = 0x50db01}, { - pte = 0x0} , {pte = 0x5303}, {pte = 0x7f5303}, { - pte = 0x509b01}, {pte = 0x505b01}, {pte = 0x7c9303}, {pte = 0x7b9303}, { - pte = 0x7b5303}, {pte = 0x7b1303}, {pte = 0x7ad303}, {pte = 0x0}, { - pte = 0x0}, {pte = 0x7a1303}, {pte = 0x0}, {pte = 0x795303}, {pte = 0x0}, { - pte = 0x78d303}, {pte = 0x0}, {pte = 0x0}, {pte = 0x0}, {pte = 0x0}, { - pte = 0x0}, {pte = 0x775303}, {pte = 0x771303}, {pte = 0x76d303}, { - pte = 0x0}, {pte = 0x765303}, {pte = 0x7c5303}, {pte = 0x501b01}, { - pte = 0x4f1b01}, {pte = 0x4edb01}, {pte = 0x0}, {pte = 0x4f9b01}, { - pte = 0x4fdb01}, {pte = 0x0} } diff --git a/MAINTAINERS b/MAINTAINERS index 69123be5bb64b..3655d284af209 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -5799,10 +5799,6 @@ F: fs/crypto/ F: include/linux/fscrypt*.h F: Documentation/filesystems/fscrypt.rst -FUJITSU FR-V (FRV) PORT -S: Orphan -F: arch/frv/ - FUJITSU LAPTOP EXTRAS M: Jonathan Woithe L: platform-driver-x86@vger.kernel.org diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig deleted file mode 100644 index af369b05fed57..0000000000000 --- a/arch/frv/Kconfig +++ /dev/null @@ -1,386 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -config FRV - bool - default y - select HAVE_IDE - select HAVE_ARCH_TRACEHOOK - select HAVE_PERF_EVENTS - select HAVE_UID16 - select VIRT_TO_BUS - select GENERIC_IRQ_SHOW - select HAVE_DEBUG_BUGVERBOSE - select ARCH_HAVE_NMI_SAFE_CMPXCHG - select GENERIC_CPU_DEVICES - select ARCH_HAS_DEVMEM_IS_ALLOWED - select ARCH_WANT_IPC_PARSE_VERSION - select OLD_SIGSUSPEND3 - select OLD_SIGACTION - select HAVE_DEBUG_STACKOVERFLOW - select ARCH_NO_COHERENT_DMA_MMAP - -config CPU_BIG_ENDIAN - def_bool y - -config ZONE_DMA - bool - default y - -config RWSEM_GENERIC_SPINLOCK - bool - default y - -config RWSEM_XCHGADD_ALGORITHM - bool - -config GENERIC_HWEIGHT - bool - default y - -config GENERIC_CALIBRATE_DELAY - bool - default n - -config TIME_LOW_RES - bool - default y - -config QUICKLIST - bool - default y - -config ARCH_HAS_ILOG2_U32 - bool - default y - -config ARCH_HAS_ILOG2_U64 - bool - default y - -config HZ - int - default 1000 - -source "init/Kconfig" - -source "kernel/Kconfig.freezer" - - -menu "Fujitsu FR-V system setup" - -config MMU - bool "MMU support" - help - This options switches on and off support for the FR-V MMU - (effectively switching between vmlinux and uClinux). Not all FR-V - CPUs support this. Currently only the FR451 has a sufficiently - featured MMU. - -config FRV_OUTOFLINE_ATOMIC_OPS - bool "Out-of-line the FRV atomic operations" - default n - help - Setting this option causes the FR-V atomic operations to be mostly - implemented out-of-line. - - See Documentation/frv/atomic-ops.txt for more information. - -config HIGHMEM - bool "High memory support" - depends on MMU - default y - help - If you wish to use more than 256MB of memory with your MMU based - system, you will need to select this option. The kernel can only see - the memory between 0xC0000000 and 0xD0000000 directly... everything - else must be kmapped. - - The arch is, however, capable of supporting up to 3GB of SDRAM. - -config HIGHPTE - bool "Allocate page tables in highmem" - depends on HIGHMEM - default y - help - The VM uses one page of memory for each page table. For systems - with a lot of RAM, this can be wasteful of precious low memory. - Setting this option will put user-space page tables in high memory. - -source "mm/Kconfig" - -choice - prompt "uClinux kernel load address" - depends on !MMU - default UCPAGE_OFFSET_C0000000 - help - This option sets the base address for the uClinux kernel. The kernel - will rearrange the SDRAM layout to start at this address, and move - itself to start there. It must be greater than 0, and it must be - sufficiently less than 0xE0000000 that the SDRAM does not intersect - the I/O region. - - The base address must also be aligned such that the SDRAM controller - can decode it. For instance, a 512MB SDRAM bank must be 512MB aligned. - -config UCPAGE_OFFSET_20000000 - bool "0x20000000" - -config UCPAGE_OFFSET_40000000 - bool "0x40000000" - -config UCPAGE_OFFSET_60000000 - bool "0x60000000" - -config UCPAGE_OFFSET_80000000 - bool "0x80000000" - -config UCPAGE_OFFSET_A0000000 - bool "0xA0000000" - -config UCPAGE_OFFSET_C0000000 - bool "0xC0000000 (Recommended)" - -endchoice - -config PAGE_OFFSET - hex - default 0x20000000 if UCPAGE_OFFSET_20000000 - default 0x40000000 if UCPAGE_OFFSET_40000000 - default 0x60000000 if UCPAGE_OFFSET_60000000 - default 0x80000000 if UCPAGE_OFFSET_80000000 - default 0xA0000000 if UCPAGE_OFFSET_A0000000 - default 0xC0000000 - -config PROTECT_KERNEL - bool "Protect core kernel against userspace" - depends on !MMU - default y - help - Selecting this option causes the uClinux kernel to change the - permittivity of DAMPR register covering the core kernel image to - prevent userspace accessing the underlying memory directly. - -choice - prompt "CPU Caching mode" - default FRV_DEFL_CACHE_WBACK - help - This option determines the default caching mode for the kernel. - - Write-Back caching mode involves the all reads and writes causing - the affected cacheline to be read into the cache first before being - operated upon. Memory is not then updated by a write until the cache - is filled and a cacheline needs to be displaced from the cache to - make room. Only at that point is it written back. - - Write-Behind caching is similar to Write-Back caching, except that a - write won't fetch a cacheline into the cache if there isn't already - one there; it will write directly to memory instead. - - Write-Through caching only fetches cachelines from memory on a - read. Writes always get written directly to memory. If the affected - cacheline is also in cache, it will be updated too. - - The final option is to turn of caching entirely. - - Note that not all CPUs support Write-Behind caching. If the CPU on - which the kernel is running doesn't, it'll fall back to Write-Back - caching. - -config FRV_DEFL_CACHE_WBACK - bool "Write-Back" - -config FRV_DEFL_CACHE_WBEHIND - bool "Write-Behind" - -config FRV_DEFL_CACHE_WTHRU - bool "Write-Through" - -config FRV_DEFL_CACHE_DISABLED - bool "Disabled" - -endchoice - -menu "CPU core support" - -config CPU_FR401 - bool "Include FR401 core support" - depends on !MMU - default y - help - This enables support for the FR401, FR401A and FR403 CPUs - -config CPU_FR405 - bool "Include FR405 core support" - depends on !MMU - default y - help - This enables support for the FR405 CPU - -config CPU_FR451 - bool "Include FR451 core support" - default y - help - This enables support for the FR451 CPU - -config CPU_FR451_COMPILE - bool "Specifically compile for FR451 core" - depends on CPU_FR451 && !CPU_FR401 && !CPU_FR405 && !CPU_FR551 - default y - help - This causes appropriate flags to be passed to the compiler to - optimise for the FR451 CPU - -config CPU_FR551 - bool "Include FR551 core support" - depends on !MMU - default y - help - This enables support for the FR555 CPU - -config CPU_FR551_COMPILE - bool "Specifically compile for FR551 core" - depends on CPU_FR551 && !CPU_FR401 && !CPU_FR405 && !CPU_FR451 - default y - help - This causes appropriate flags to be passed to the compiler to - optimise for the FR555 CPU - -config FRV_L1_CACHE_SHIFT - int - default "5" if CPU_FR401 || CPU_FR405 || CPU_FR451 - default "6" if CPU_FR551 - -endmenu - -choice - prompt "System support" - default MB93091_VDK - -config MB93091_VDK - bool "MB93091 CPU board with or without motherboard" - -config MB93093_PDK - bool "MB93093 PDK unit" - -endchoice - -if MB93091_VDK -choice - prompt "Motherboard support" - default MB93090_MB00 - -config MB93090_MB00 - bool "Use the MB93090-MB00 motherboard" - help - Select this option if the MB93091 CPU board is going to be used with - a MB93090-MB00 VDK motherboard - -config MB93091_NO_MB - bool "Use standalone" - help - Select this option if the MB93091 CPU board is going to be used - without a motherboard - -endchoice -endif - -config FUJITSU_MB93493 - bool "MB93493 Multimedia chip" - help - Select this option if the MB93493 multimedia chip is going to be - used. - -choice - prompt "GP-Relative data support" - default GPREL_DATA_8 - help - This option controls what data, if any, should be placed in the GP - relative data sections. Using this means that the compiler can - generate accesses to the data using GR16-relative addressing which - is faster than absolute instructions and saves space (2 instructions - per access). - - However, the GPREL region is limited in size because the immediate - value used in the load and store instructions is limited to a 12-bit - signed number. - - So if the linker starts complaining that accesses to GPREL data are - out of range, try changing this option from the default. - - Note that modules will always be compiled with this feature disabled - as the module data will not be in range of the GP base address. - -config GPREL_DATA_8 - bool "Put data objects of up to 8 bytes into GP-REL" - -config GPREL_DATA_4 - bool "Put data objects of up to 4 bytes into GP-REL" - -config GPREL_DATA_NONE - bool "Don't use GP-REL" - -endchoice - -config FRV_ONCPU_SERIAL - bool "Use on-CPU serial ports" - select SERIAL_8250 - default y - -config PCI - bool "Use PCI" - depends on MB93090_MB00 - default y - select GENERIC_PCI_IOMAP - help - Some FR-V systems (such as the MB93090-MB00 VDK) have PCI - onboard. If you have one of these boards and you wish to use the PCI - facilities, say Y here. - -config RESERVE_DMA_COHERENT - bool "Reserve DMA coherent memory" - depends on PCI && !MMU - default y - help - Many PCI drivers require access to uncached memory for DMA device - communications (such as is done with some Ethernet buffer rings). If - a fully featured MMU is available, this can be done through page - table settings, but if not, a region has to be set aside and marked - with a special DAMPR register. - - Setting this option causes uClinux to set aside a portion of the - available memory for use in this manner. The memory will then be - unavailable for normal kernel use. - -source "drivers/pci/Kconfig" - -source "drivers/pcmcia/Kconfig" - -menu "Power management options" - -config ARCH_SUSPEND_POSSIBLE - def_bool y - -source kernel/power/Kconfig -endmenu - -endmenu - - -menu "Executable formats" - -source "fs/Kconfig.binfmt" - -endmenu - -source "net/Kconfig" - -source "drivers/Kconfig" - -source "fs/Kconfig" - -source "arch/frv/Kconfig.debug" - -source "security/Kconfig" - -source "crypto/Kconfig" - -source "lib/Kconfig" diff --git a/arch/frv/Kconfig.debug b/arch/frv/Kconfig.debug deleted file mode 100644 index ecab6d8a79ed8..0000000000000 --- a/arch/frv/Kconfig.debug +++ /dev/null @@ -1,49 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -menu "Kernel hacking" - -source "lib/Kconfig.debug" - -config GDBSTUB - bool "Remote GDB kernel debugging" - depends on DEBUG_KERNEL - select DEBUG_INFO - select FRAME_POINTER - help - If you say Y here, it will be possible to remotely debug the kernel - using gdb. This enlarges your kernel ELF image disk size by several - megabytes and requires a machine with more than 16 MB, better 32 MB - RAM to avoid excessive linking time. This is only useful for kernel - hackers. If unsure, say N. - -choice - prompt "GDB stub port" - default GDBSTUB_UART1 - depends on GDBSTUB - help - Select the on-CPU port used for GDB-stub - -config GDBSTUB_UART0 - bool "/dev/ttyS0" - -config GDBSTUB_UART1 - bool "/dev/ttyS1" - -endchoice - -config GDBSTUB_IMMEDIATE - bool "Break into GDB stub immediately" - depends on GDBSTUB - help - If you say Y here, GDB stub will break into the program as soon as - possible, leaving the program counter at the beginning of - start_kernel() in init/main.c. - -config GDB_CONSOLE - bool "Console output to GDB" - depends on GDBSTUB - help - If you are using GDB for remote debugging over a serial port and - would like kernel messages to be formatted into GDB $O packets so - that GDB prints them as program output, say 'Y'. - -endmenu diff --git a/arch/frv/Makefile b/arch/frv/Makefile deleted file mode 100644 index 2a8fb730d1caa..0000000000000 --- a/arch/frv/Makefile +++ /dev/null @@ -1,90 +0,0 @@ -# -# frv/Makefile -# -# This file is included by the global makefile so that you can add your own -# architecture-specific flags and dependencies. Remember to do have actions -# for "archclean" and "archdep" for cleaning up and making dependencies for -# this architecture -# -# This file is subject to 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) 2003, 2004 Red Hat Inc. -# - Written by David Howells -# - Derived from arch/m68knommu/Makefile, -# Copyright (c) 1999,2001 D. Jeff Dionne , -# Rt-Control Inc. / Lineo, Inc. -# -# Copyright (C) 1998,1999 D. Jeff Dionne , -# Kenneth Albanowski , -# -# Based on arch/m68k/Makefile: -# Copyright (C) 1994 by Hamish Macdonald -# - -ifdef CONFIG_MMU -UTS_SYSNAME = -DUTS_SYSNAME=\"Linux\" -else -UTS_SYSNAME = -DUTS_SYSNAME=\"uClinux\" -endif - -KBUILD_AFLAGS_MODULE += -G0 -mlong-calls -KBUILD_CFLAGS_MODULE += -G0 -mlong-calls - -ifdef CONFIG_GPREL_DATA_8 -KBUILD_CFLAGS += -G8 -else -ifdef CONFIG_GPREL_DATA_4 -KBUILD_CFLAGS += -G4 -else -ifdef CONFIG_GPREL_DATA_NONE -KBUILD_CFLAGS += -G0 -endif -endif -endif - -#LDFLAGS_vmlinux := -Map linkmap.txt - -ifdef CONFIG_GC_SECTIONS -KBUILD_CFLAGS += -ffunction-sections -fdata-sections -endif - -ifndef CONFIG_FRAME_POINTER -KBUILD_CFLAGS += -mno-linked-fp -endif - -ifdef CONFIG_CPU_FR451_COMPILE -KBUILD_CFLAGS += -mcpu=fr450 -KBUILD_AFLAGS += -mcpu=fr450 -else -ifdef CONFIG_CPU_FR551_COMPILE -KBUILD_CFLAGS += -mcpu=fr550 -KBUILD_AFLAGS += -mcpu=fr550 -else -KBUILD_CFLAGS += -mcpu=fr400 -KBUILD_AFLAGS += -mcpu=fr400 -endif -endif - -# pretend the kernel is going to run on an FR400 with no media-fp unit -# - reserve CC3 for use with atomic ops -# - all the extra registers are dealt with only at context switch time -KBUILD_CFLAGS += -mno-fdpic -mgpr-32 -msoft-float -mno-media -KBUILD_CFLAGS += -ffixed-fcc3 -ffixed-cc3 -ffixed-gr15 -ffixed-icc2 -KBUILD_AFLAGS += -mno-fdpic - -head-y := arch/frv/kernel/head.o - -core-y += arch/frv/kernel/ arch/frv/mm/ -libs-y += arch/frv/lib/ - -core-$(CONFIG_MB93090_MB00) += arch/frv/mb93090-mb00/ - -all: Image - -Image: vmlinux - $(Q)$(MAKE) $(build)=arch/frv/boot $@ - -archclean: - $(Q)$(MAKE) $(clean)=arch/frv/boot diff --git a/arch/frv/boot/Makefile b/arch/frv/boot/Makefile deleted file mode 100644 index 636d5bbcd53f3..0000000000000 --- a/arch/frv/boot/Makefile +++ /dev/null @@ -1,76 +0,0 @@ -# -# arch/arm/boot/Makefile -# -# This file is subject to 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) 1995-2000 Russell King -# - -targets := Image zImage bootpImage - -SYSTEM =$(LINUX) - -ZTEXTADDR = 0x02080000 -PARAMS_PHYS = 0x0207c000 -INITRD_PHYS = 0x02180000 -INITRD_VIRT = 0x02180000 - -OBJCOPYFLAGS :=-O binary -R .note -R .note.gnu.build-id -R .comment - -# -# If you don't define ZRELADDR above, -# then it defaults to ZTEXTADDR -# -ifeq ($(ZRELADDR),) -ZRELADDR = $(ZTEXTADDR) -endif - -export SYSTEM ZTEXTADDR ZBSSADDR ZRELADDR INITRD_PHYS INITRD_VIRT PARAMS_PHYS - -Image: $(obj)/Image - -targets: $(obj)/Image - -$(obj)/Image: vmlinux FORCE - $(OBJCOPY) $(OBJCOPYFLAGS) -S vmlinux $@ - -#$(obj)/Image: $(CONFIGURE) $(SYSTEM) -# $(OBJCOPY) $(OBJCOPYFLAGS) -g -S $(SYSTEM) $@ - -bzImage: zImage - -zImage: $(CONFIGURE) compressed/$(LINUX) - $(OBJCOPY) $(OBJCOPYFLAGS) -S compressed/$(LINUX) $@ - -bootpImage: bootp/bootp - $(OBJCOPY) $(OBJCOPYFLAGS) -S bootp/bootp $@ - -compressed/$(LINUX): $(LINUX) dep - @$(MAKE) -C compressed $(LINUX) - -bootp/bootp: zImage initrd - @$(MAKE) -C bootp bootp - -initrd: - @test "$(INITRD_VIRT)" != "" || (echo This architecture does not support INITRD; exit -1) - @test "$(INITRD)" != "" || (echo You must specify INITRD; exit -1) - -# -# installation -# -install: $(CONFIGURE) Image - sh ./install.sh $(KERNELRELEASE) Image System.map "$(INSTALL_PATH)" - -zinstall: $(CONFIGURE) zImage - sh ./install.sh $(KERNELRELEASE) zImage System.map "$(INSTALL_PATH)" - -# -# miscellany -# -mrproper clean: -# @$(MAKE) -C compressed clean -# @$(MAKE) -C bootp clean - -dep: diff --git a/arch/frv/defconfig b/arch/frv/defconfig deleted file mode 100644 index b1b792610fdf4..0000000000000 --- a/arch/frv/defconfig +++ /dev/null @@ -1,39 +0,0 @@ -CONFIG_EXPERIMENTAL=y -CONFIG_SYSVIPC=y -CONFIG_POSIX_MQUEUE=y -CONFIG_LOG_BUF_SHIFT=14 -# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set -CONFIG_EXPERT=y -# CONFIG_HOTPLUG is not set -CONFIG_MMU=y -CONFIG_FRV_OUTOFLINE_ATOMIC_OPS=y -CONFIG_FRV_DEFL_CACHE_WTHRU=y -CONFIG_GPREL_DATA_4=y -CONFIG_NET=y -CONFIG_PACKET=y -CONFIG_UNIX=y -CONFIG_INET=y -CONFIG_IP_PNP=y -# CONFIG_IPV6 is not set -# CONFIG_STANDALONE is not set -# CONFIG_PREVENT_FIRMWARE_BUILD is not set -CONFIG_NETDEVICES=y -CONFIG_NET_ETHERNET=y -CONFIG_MII=y -CONFIG_NET_PCI=y -CONFIG_NE2K_PCI=y -# CONFIG_INPUT is not set -# CONFIG_SERIO is not set -# CONFIG_VT is not set -CONFIG_SERIAL_8250_CONSOLE=y -CONFIG_SERIAL_8250_NR_UARTS=1 -CONFIG_SERIAL_8250_RUNTIME_UARTS=1 -CONFIG_SERIAL_8250_EXTENDED=y -CONFIG_SERIAL_8250_SHARE_IRQ=y -# CONFIG_LEGACY_PTYS is not set -CONFIG_TMPFS=y -CONFIG_NFS_FS=y -CONFIG_ROOT_NFS=y -CONFIG_DEBUG_KERNEL=y -# CONFIG_DEBUG_BUGVERBOSE is not set -CONFIG_DEBUG_STACKOVERFLOW=y diff --git a/arch/frv/include/asm/Kbuild b/arch/frv/include/asm/Kbuild deleted file mode 100644 index b16b9c48ea09b..0000000000000 --- a/arch/frv/include/asm/Kbuild +++ /dev/null @@ -1,12 +0,0 @@ - -generic-y += device.h -generic-y += exec.h -generic-y += extable.h -generic-y += fb.h -generic-y += irq_work.h -generic-y += mcs_spinlock.h -generic-y += mm-arch-hooks.h -generic-y += preempt.h -generic-y += trace_clock.h -generic-y += word-at-a-time.h -generic-y += kprobes.h diff --git a/arch/frv/include/asm/asm-offsets.h b/arch/frv/include/asm/asm-offsets.h deleted file mode 100644 index d370ee36a182b..0000000000000 --- a/arch/frv/include/asm/asm-offsets.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/arch/frv/include/asm/atomic.h b/arch/frv/include/asm/atomic.h deleted file mode 100644 index e93c9494503ac..0000000000000 --- a/arch/frv/include/asm/atomic.h +++ /dev/null @@ -1,224 +0,0 @@ -/* atomic.h: atomic operation emulation for FR-V - * - * For an explanation of how atomic ops work in this arch, see: - * Documentation/frv/atomic-ops.txt - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ -#ifndef _ASM_ATOMIC_H -#define _ASM_ATOMIC_H - -#include -#include -#include - -#ifdef CONFIG_SMP -#error not SMP safe -#endif - -#include - -/* - * Atomic operations that C can't guarantee us. Useful for - * resource counting etc.. - * - * We do not have SMP systems, so we don't have to deal with that. - */ - -#define ATOMIC_INIT(i) { (i) } -#define atomic_read(v) READ_ONCE((v)->counter) -#define atomic_set(v, i) WRITE_ONCE(((v)->counter), (i)) - -static inline int atomic_inc_return(atomic_t *v) -{ - return __atomic_add_return(1, &v->counter); -} - -static inline int atomic_dec_return(atomic_t *v) -{ - return __atomic_sub_return(1, &v->counter); -} - -static inline int atomic_add_return(int i, atomic_t *v) -{ - return __atomic_add_return(i, &v->counter); -} - -static inline int atomic_sub_return(int i, atomic_t *v) -{ - return __atomic_sub_return(i, &v->counter); -} - -static inline int atomic_add_negative(int i, atomic_t *v) -{ - return atomic_add_return(i, v) < 0; -} - -static inline void atomic_inc(atomic_t *v) -{ - atomic_inc_return(v); -} - -static inline void atomic_dec(atomic_t *v) -{ - atomic_dec_return(v); -} - -#define atomic_sub_and_test(i,v) (atomic_sub_return((i), (v)) == 0) -#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0) -#define atomic_inc_and_test(v) (atomic_add_return(1, (v)) == 0) - -/* - * 64-bit atomic ops - */ -typedef struct { - long long counter; -} atomic64_t; - -#define ATOMIC64_INIT(i) { (i) } - -static inline long long atomic64_read(const atomic64_t *v) -{ - long long counter; - - asm("ldd%I1 %M1,%0" - : "=e"(counter) - : "m"(v->counter)); - - return counter; -} - -static inline void atomic64_set(atomic64_t *v, long long i) -{ - asm volatile("std%I0 %1,%M0" - : "=m"(v->counter) - : "e"(i)); -} - -static inline long long atomic64_inc_return(atomic64_t *v) -{ - return __atomic64_add_return(1, &v->counter); -} - -static inline long long atomic64_dec_return(atomic64_t *v) -{ - return __atomic64_sub_return(1, &v->counter); -} - -static inline long long atomic64_add_return(long long i, atomic64_t *v) -{ - return __atomic64_add_return(i, &v->counter); -} - -static inline long long atomic64_sub_return(long long i, atomic64_t *v) -{ - return __atomic64_sub_return(i, &v->counter); -} - -static inline long long atomic64_add_negative(long long i, atomic64_t *v) -{ - return atomic64_add_return(i, v) < 0; -} - -static inline void atomic64_inc(atomic64_t *v) -{ - atomic64_inc_return(v); -} - -static inline void atomic64_dec(atomic64_t *v) -{ - atomic64_dec_return(v); -} - -#define atomic64_sub_and_test(i,v) (atomic64_sub_return((i), (v)) == 0) -#define atomic64_dec_and_test(v) (atomic64_dec_return((v)) == 0) -#define atomic64_inc_and_test(v) (atomic64_inc_return((v)) == 0) -#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0) - -#define atomic_cmpxchg(v, old, new) (cmpxchg(&(v)->counter, old, new)) -#define atomic_xchg(v, new) (xchg(&(v)->counter, new)) -#define atomic64_cmpxchg(v, old, new) (__cmpxchg_64(old, new, &(v)->counter)) -#define atomic64_xchg(v, new) (__xchg_64(new, &(v)->counter)) - -static __inline__ int __atomic_add_unless(atomic_t *v, int a, int u) -{ - int c, old; - c = atomic_read(v); - for (;;) { - if (unlikely(c == (u))) - break; - old = atomic_cmpxchg((v), c, c + (a)); - if (likely(old == c)) - break; - c = old; - } - return c; -} - -static inline int atomic64_add_unless(atomic64_t *v, long long i, long long u) -{ - long long c, old; - - c = atomic64_read(v); - for (;;) { - if (unlikely(c == u)) - break; - old = atomic64_cmpxchg(v, c, c + i); - if (likely(old == c)) - break; - c = old; - } - return c != u; -} - -static inline long long atomic64_dec_if_positive(atomic64_t *v) -{ - long long c, old, dec; - - c = atomic64_read(v); - for (;;) { - dec = c - 1; - if (unlikely(dec < 0)) - break; - old = atomic64_cmpxchg((v), c, dec); - if (likely(old == c)) - break; - c = old; - } - return dec; -} - -#define ATOMIC_OP(op) \ -static inline int atomic_fetch_##op(int i, atomic_t *v) \ -{ \ - return __atomic32_fetch_##op(i, &v->counter); \ -} \ -static inline void atomic_##op(int i, atomic_t *v) \ -{ \ - (void)__atomic32_fetch_##op(i, &v->counter); \ -} \ - \ -static inline long long atomic64_fetch_##op(long long i, atomic64_t *v) \ -{ \ - return __atomic64_fetch_##op(i, &v->counter); \ -} \ -static inline void atomic64_##op(long long i, atomic64_t *v) \ -{ \ - (void)__atomic64_fetch_##op(i, &v->counter); \ -} - -ATOMIC_OP(or) -ATOMIC_OP(and) -ATOMIC_OP(xor) -ATOMIC_OP(add) -ATOMIC_OP(sub) - -#undef ATOMIC_OP - -#endif /* _ASM_ATOMIC_H */ diff --git a/arch/frv/include/asm/atomic_defs.h b/arch/frv/include/asm/atomic_defs.h deleted file mode 100644 index ce3b8a4efc127..0000000000000 --- a/arch/frv/include/asm/atomic_defs.h +++ /dev/null @@ -1,175 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ - -#include - -#ifdef __ATOMIC_LIB__ - -#ifdef CONFIG_FRV_OUTOFLINE_ATOMIC_OPS - -#define ATOMIC_QUALS -#define ATOMIC_EXPORT(x) EXPORT_SYMBOL(x) - -#else /* !OUTOFLINE && LIB */ - -#define ATOMIC_OP_RETURN(op) -#define ATOMIC_FETCH_OP(op) - -#endif /* OUTOFLINE */ - -#else /* !__ATOMIC_LIB__ */ - -#define ATOMIC_EXPORT(x) - -#ifdef CONFIG_FRV_OUTOFLINE_ATOMIC_OPS - -#define ATOMIC_OP_RETURN(op) \ -extern int __atomic_##op##_return(int i, int *v); \ -extern long long __atomic64_##op##_return(long long i, long long *v); - -#define ATOMIC_FETCH_OP(op) \ -extern int __atomic32_fetch_##op(int i, int *v); \ -extern long long __atomic64_fetch_##op(long long i, long long *v); - -#else /* !OUTOFLINE && !LIB */ - -#define ATOMIC_QUALS static inline - -#endif /* OUTOFLINE */ -#endif /* __ATOMIC_LIB__ */ - - -/* - * Note on the 64 bit inline asm variants... - * - * CSTD is a conditional instruction and needs a constrained memory reference. - * Normally 'U' provides the correct constraints for conditional instructions - * and this is used for the 32 bit version, however 'U' does not appear to work - * for 64 bit values (gcc-4.9) - * - * The exact constraint is that conditional instructions cannot deal with an - * immediate displacement in the memory reference, so what we do is we read the - * address through a volatile cast into a local variable in order to insure we - * _have_ to compute the correct address without displacement. This allows us - * to use the regular 'm' for the memory address. - * - * Furthermore, the %Ln operand, which prints the low word register (r+1), - * really only works for registers, this means we cannot allow immediate values - * for the 64 bit versions -- like we do for the 32 bit ones. - * - */ - -#ifndef ATOMIC_OP_RETURN -#define ATOMIC_OP_RETURN(op) \ -ATOMIC_QUALS int __atomic_##op##_return(int i, int *v) \ -{ \ - int val; \ - \ - asm volatile( \ - "0: \n" \ - " orcc gr0,gr0,gr0,icc3 \n" \ - " ckeq icc3,cc7 \n" \ - " ld.p %M0,%1 \n" \ - " orcr cc7,cc7,cc3 \n" \ - " "#op"%I2 %1,%2,%1 \n" \ - " cst.p %1,%M0 ,cc3,#1 \n" \ - " corcc gr29,gr29,gr0 ,cc3,#1 \n" \ - " beq icc3,#0,0b \n" \ - : "+U"(*v), "=&r"(val) \ - : "NPr"(i) \ - : "memory", "cc7", "cc3", "icc3" \ - ); \ - \ - return val; \ -} \ -ATOMIC_EXPORT(__atomic_##op##_return); \ - \ -ATOMIC_QUALS long long __atomic64_##op##_return(long long i, long long *v) \ -{ \ - long long *__v = READ_ONCE(v); \ - long long val; \ - \ - asm volatile( \ - "0: \n" \ - " orcc gr0,gr0,gr0,icc3 \n" \ - " ckeq icc3,cc7 \n" \ - " ldd.p %M0,%1 \n" \ - " orcr cc7,cc7,cc3 \n" \ - " "#op"cc %L1,%L2,%L1,icc0 \n" \ - " "#op"x %1,%2,%1,icc0 \n" \ - " cstd.p %1,%M0 ,cc3,#1 \n" \ - " corcc gr29,gr29,gr0 ,cc3,#1 \n" \ - " beq icc3,#0,0b \n" \ - : "+m"(*__v), "=&e"(val) \ - : "e"(i) \ - : "memory", "cc7", "cc3", "icc0", "icc3" \ - ); \ - \ - return val; \ -} \ -ATOMIC_EXPORT(__atomic64_##op##_return); -#endif - -#ifndef ATOMIC_FETCH_OP -#define ATOMIC_FETCH_OP(op) \ -ATOMIC_QUALS int __atomic32_fetch_##op(int i, int *v) \ -{ \ - int old, tmp; \ - \ - asm volatile( \ - "0: \n" \ - " orcc gr0,gr0,gr0,icc3 \n" \ - " ckeq icc3,cc7 \n" \ - " ld.p %M0,%1 \n" \ - " orcr cc7,cc7,cc3 \n" \ - " "#op"%I3 %1,%3,%2 \n" \ - " cst.p %2,%M0 ,cc3,#1 \n" \ - " corcc gr29,gr29,gr0 ,cc3,#1 \n" \ - " beq icc3,#0,0b \n" \ - : "+U"(*v), "=&r"(old), "=r"(tmp) \ - : "NPr"(i) \ - : "memory", "cc7", "cc3", "icc3" \ - ); \ - \ - return old; \ -} \ -ATOMIC_EXPORT(__atomic32_fetch_##op); \ - \ -ATOMIC_QUALS long long __atomic64_fetch_##op(long long i, long long *v) \ -{ \ - long long *__v = READ_ONCE(v); \ - long long old, tmp; \ - \ - asm volatile( \ - "0: \n" \ - " orcc gr0,gr0,gr0,icc3 \n" \ - " ckeq icc3,cc7 \n" \ - " ldd.p %M0,%1 \n" \ - " orcr cc7,cc7,cc3 \n" \ - " "#op" %L1,%L3,%L2 \n" \ - " "#op" %1,%3,%2 \n" \ - " cstd.p %2,%M0 ,cc3,#1 \n" \ - " corcc gr29,gr29,gr0 ,cc3,#1 \n" \ - " beq icc3,#0,0b \n" \ - : "+m"(*__v), "=&e"(old), "=e"(tmp) \ - : "e"(i) \ - : "memory", "cc7", "cc3", "icc3" \ - ); \ - \ - return old; \ -} \ -ATOMIC_EXPORT(__atomic64_fetch_##op); -#endif - -ATOMIC_FETCH_OP(or) -ATOMIC_FETCH_OP(and) -ATOMIC_FETCH_OP(xor) -ATOMIC_FETCH_OP(add) -ATOMIC_FETCH_OP(sub) - -ATOMIC_OP_RETURN(add) -ATOMIC_OP_RETURN(sub) - -#undef ATOMIC_FETCH_OP -#undef ATOMIC_OP_RETURN -#undef ATOMIC_QUALS -#undef ATOMIC_EXPORT diff --git a/arch/frv/include/asm/ax88796.h b/arch/frv/include/asm/ax88796.h deleted file mode 100644 index 637e980393c5f..0000000000000 --- a/arch/frv/include/asm/ax88796.h +++ /dev/null @@ -1,22 +0,0 @@ -/* ax88796.h: access points to the driver for the AX88796 NE2000 clone - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#ifndef _ASM_AX88796_H -#define _ASM_AX88796_H - -#include - -#define AX88796_IOADDR (__region_CS1 + 0x200) -#define AX88796_IRQ IRQ_CPU_EXTERNAL7 -#define AX88796_FULL_DUPLEX 0 /* force full duplex */ -#define AX88796_BUS_INFO "CS1#+0x200" /* bus info for ethtool */ - -#endif /* _ASM_AX88796_H */ diff --git a/arch/frv/include/asm/barrier.h b/arch/frv/include/asm/barrier.h deleted file mode 100644 index abbef470154cd..0000000000000 --- a/arch/frv/include/asm/barrier.h +++ /dev/null @@ -1,23 +0,0 @@ -/* FR-V CPU memory barrier definitions - * - * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#ifndef _ASM_BARRIER_H -#define _ASM_BARRIER_H - -#define nop() asm volatile ("nop"::) - -#define mb() asm volatile ("membar" : : :"memory") -#define rmb() asm volatile ("membar" : : :"memory") -#define wmb() asm volatile ("membar" : : :"memory") - -#include - -#endif /* _ASM_BARRIER_H */ diff --git a/arch/frv/include/asm/bitops.h b/arch/frv/include/asm/bitops.h deleted file mode 100644 index 0df8e95e37151..0000000000000 --- a/arch/frv/include/asm/bitops.h +++ /dev/null @@ -1,325 +0,0 @@ -/* bitops.h: bit operations for the Fujitsu FR-V CPUs - * - * For an explanation of how atomic ops work in this arch, see: - * Documentation/frv/atomic-ops.txt - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ -#ifndef _ASM_BITOPS_H -#define _ASM_BITOPS_H - -#include -#include - -#ifdef __KERNEL__ - -#ifndef _LINUX_BITOPS_H -#error only can be included directly -#endif - -#include - -#include - -static inline int test_and_clear_bit(unsigned long nr, volatile void *addr) -{ - unsigned int *ptr = (void *)addr; - unsigned int mask = 1UL << (nr & 31); - ptr += nr >> 5; - return (__atomic32_fetch_and(~mask, ptr) & mask) != 0; -} - -static inline int test_and_set_bit(unsigned long nr, volatile void *addr) -{ - unsigned int *ptr = (void *)addr; - unsigned int mask = 1UL << (nr & 31); - ptr += nr >> 5; - return (__atomic32_fetch_or(mask, ptr) & mask) != 0; -} - -static inline int test_and_change_bit(unsigned long nr, volatile void *addr) -{ - unsigned int *ptr = (void *)addr; - unsigned int mask = 1UL << (nr & 31); - ptr += nr >> 5; - return (__atomic32_fetch_xor(mask, ptr) & mask) != 0; -} - -static inline void clear_bit(unsigned long nr, volatile void *addr) -{ - test_and_clear_bit(nr, addr); -} - -static inline void set_bit(unsigned long nr, volatile void *addr) -{ - test_and_set_bit(nr, addr); -} - -static inline void change_bit(unsigned long nr, volatile void *addr) -{ - test_and_change_bit(nr, addr); -} - -static inline void __clear_bit(unsigned long nr, volatile void *addr) -{ - volatile unsigned long *a = addr; - int mask; - - a += nr >> 5; - mask = 1 << (nr & 31); - *a &= ~mask; -} - -static inline void __set_bit(unsigned long nr, volatile void *addr) -{ - volatile unsigned long *a = addr; - int mask; - - a += nr >> 5; - mask = 1 << (nr & 31); - *a |= mask; -} - -static inline void __change_bit(unsigned long nr, volatile void *addr) -{ - volatile unsigned long *a = addr; - int mask; - - a += nr >> 5; - mask = 1 << (nr & 31); - *a ^= mask; -} - -static inline int __test_and_clear_bit(unsigned long nr, volatile void *addr) -{ - volatile unsigned long *a = addr; - int mask, retval; - - a += nr >> 5; - mask = 1 << (nr & 31); - retval = (mask & *a) != 0; - *a &= ~mask; - return retval; -} - -static inline int __test_and_set_bit(unsigned long nr, volatile void *addr) -{ - volatile unsigned long *a = addr; - int mask, retval; - - a += nr >> 5; - mask = 1 << (nr & 31); - retval = (mask & *a) != 0; - *a |= mask; - return retval; -} - -static inline int __test_and_change_bit(unsigned long nr, volatile void *addr) -{ - volatile unsigned long *a = addr; - int mask, retval; - - a += nr >> 5; - mask = 1 << (nr & 31); - retval = (mask & *a) != 0; - *a ^= mask; - return retval; -} - -/* - * This routine doesn't need to be atomic. - */ -static inline int -__constant_test_bit(unsigned long nr, const volatile void *addr) -{ - return ((1UL << (nr & 31)) & (((const volatile unsigned int *) addr)[nr >> 5])) != 0; -} - -static inline int __test_bit(unsigned long nr, const volatile void *addr) -{ - int * a = (int *) addr; - int mask; - - a += nr >> 5; - mask = 1 << (nr & 0x1f); - return ((mask & *a) != 0); -} - -#define test_bit(nr,addr) \ -(__builtin_constant_p(nr) ? \ - __constant_test_bit((nr),(addr)) : \ - __test_bit((nr),(addr))) - -#include - -/** - * fls - find last bit set - * @x: the word to search - * - * This is defined the same way as ffs: - * - return 32..1 to indicate bit 31..0 most significant bit set - * - return 0 to indicate no bits set - */ -#define fls(x) \ -({ \ - int bit; \ - \ - asm(" subcc %1,gr0,gr0,icc0 \n" \ - " ckne icc0,cc4 \n" \ - " cscan.p %1,gr0,%0 ,cc4,#1 \n" \ - " csub %0,%0,%0 ,cc4,#0 \n" \ - " csub %2,%0,%0 ,cc4,#1 \n" \ - : "=&r"(bit) \ - : "r"(x), "r"(32) \ - : "icc0", "cc4" \ - ); \ - \ - bit; \ -}) - -/** - * fls64 - find last bit set in a 64-bit value - * @n: the value to search - * - * This is defined the same way as ffs: - * - return 64..1 to indicate bit 63..0 most significant bit set - * - return 0 to indicate no bits set - */ -static inline __attribute__((const)) -int fls64(u64 n) -{ - union { - u64 ll; - struct { u32 h, l; }; - } _; - int bit, x, y; - - _.ll = n; - - asm(" subcc.p %3,gr0,gr0,icc0 \n" - " subcc %4,gr0,gr0,icc1 \n" - " ckne icc0,cc4 \n" - " ckne icc1,cc5 \n" - " norcr cc4,cc5,cc6 \n" - " csub.p %0,%0,%0 ,cc6,1 \n" - " orcr cc5,cc4,cc4 \n" - " andcr cc4,cc5,cc4 \n" - " cscan.p %3,gr0,%0 ,cc4,0 \n" - " setlos #64,%1 \n" - " cscan.p %4,gr0,%0 ,cc4,1 \n" - " setlos #32,%2 \n" - " csub.p %1,%0,%0 ,cc4,0 \n" - " csub %2,%0,%0 ,cc4,1 \n" - : "=&r"(bit), "=r"(x), "=r"(y) - : "0r"(_.h), "r"(_.l) - : "icc0", "icc1", "cc4", "cc5", "cc6" - ); - return bit; - -} - -/** - * ffs - find first bit set - * @x: the word to search - * - * - return 32..1 to indicate bit 31..0 most least significant bit set - * - return 0 to indicate no bits set - */ -static inline __attribute__((const)) -int ffs(int x) -{ - /* Note: (x & -x) gives us a mask that is the least significant - * (rightmost) 1-bit of the value in x. - */ - return fls(x & -x); -} - -/** - * __ffs - find first bit set - * @x: the word to search - * - * - return 31..0 to indicate bit 31..0 most least significant bit set - * - if no bits are set in x, the result is undefined - */ -static inline __attribute__((const)) -int __ffs(unsigned long x) -{ - int bit; - asm("scan %1,gr0,%0" : "=r"(bit) : "r"(x & -x)); - return 31 - bit; -} - -/** - * __fls - find last (most-significant) set bit in a long word - * @word: the word to search - * - * Undefined if no set bit exists, so code should check against 0 first. - */ -static inline unsigned long __fls(unsigned long word) -{ - unsigned long bit; - asm("scan %1,gr0,%0" : "=r"(bit) : "r"(word)); - return bit; -} - -/* - * special slimline version of fls() for calculating ilog2_u32() - * - note: no protection against n == 0 - */ -#define ARCH_HAS_ILOG2_U32 -static inline __attribute__((const)) -int __ilog2_u32(u32 n) -{ - int bit; - asm("scan %1,gr0,%0" : "=r"(bit) : "r"(n)); - return 31 - bit; -} - -/* - * special slimline version of fls64() for calculating ilog2_u64() - * - note: no protection against n == 0 - */ -#define ARCH_HAS_ILOG2_U64 -static inline __attribute__((const)) -int __ilog2_u64(u64 n) -{ - union { - u64 ll; - struct { u32 h, l; }; - } _; - int bit, x, y; - - _.ll = n; - - asm(" subcc %3,gr0,gr0,icc0 \n" - " ckeq icc0,cc4 \n" - " cscan.p %3,gr0,%0 ,cc4,0 \n" - " setlos #63,%1 \n" - " cscan.p %4,gr0,%0 ,cc4,1 \n" - " setlos #31,%2 \n" - " csub.p %1,%0,%0 ,cc4,0 \n" - " csub %2,%0,%0 ,cc4,1 \n" - : "=&r"(bit), "=r"(x), "=r"(y) - : "0r"(_.h), "r"(_.l) - : "icc0", "cc4" - ); - return bit; -} - -#include -#include -#include - -#include - -#include - -#endif /* __KERNEL__ */ - -#endif /* _ASM_BITOPS_H */ diff --git a/arch/frv/include/asm/bug.h b/arch/frv/include/asm/bug.h deleted file mode 100644 index dd01bcf42ee6e..0000000000000 --- a/arch/frv/include/asm/bug.h +++ /dev/null @@ -1,56 +0,0 @@ -/* bug.h: FRV bug trapping - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ -#ifndef _ASM_BUG_H -#define _ASM_BUG_H - -#include - -#ifdef CONFIG_BUG -/* - * Tell the user there is some problem. - */ -extern asmlinkage void __debug_bug_trap(int signr); - -#ifdef CONFIG_NO_KERNEL_MSG -#define _debug_bug_printk() -#else -extern void __debug_bug_printk(const char *file, unsigned line); -#define _debug_bug_printk() __debug_bug_printk(__FILE__, __LINE__) -#endif - -#define _debug_bug_trap(signr) \ -do { \ - __debug_bug_trap(signr); \ - asm volatile("nop"); \ -} while(1) - -#define HAVE_ARCH_BUG -#define BUG() \ -do { \ - _debug_bug_printk(); \ - _debug_bug_trap(6 /*SIGABRT*/); \ -} while (0) - -#ifdef CONFIG_GDBSTUB -#define HAVE_ARCH_KGDB_RAISE -#define kgdb_raise(signr) do { _debug_bug_trap(signr); } while(0) - -#define HAVE_ARCH_KGDB_BAD_PAGE -#define kgdb_bad_page(page) do { kgdb_raise(SIGABRT); } while(0) -#endif - -#endif /* CONFIG_BUG */ - -#include - -extern void die_if_kernel(const char *, ...) __attribute__((format(printf, 1, 2))); - -#endif diff --git a/arch/frv/include/asm/bugs.h b/arch/frv/include/asm/bugs.h deleted file mode 100644 index f2382be2b46ce..0000000000000 --- a/arch/frv/include/asm/bugs.h +++ /dev/null @@ -1,14 +0,0 @@ -/* bugs.h: arch bug checking entry - * - * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -static inline void check_bugs(void) -{ -} diff --git a/arch/frv/include/asm/busctl-regs.h b/arch/frv/include/asm/busctl-regs.h deleted file mode 100644 index bb0ff4816e277..0000000000000 --- a/arch/frv/include/asm/busctl-regs.h +++ /dev/null @@ -1,41 +0,0 @@ -/* busctl-regs.h: FR400-series CPU bus controller registers - * - * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#ifndef _ASM_BUSCTL_REGS_H -#define _ASM_BUSCTL_REGS_H - -/* bus controller registers */ -#define __get_LGCR() ({ *(volatile unsigned long *)(0xfe000010); }) -#define __get_LMAICR() ({ *(volatile unsigned long *)(0xfe000030); }) -#define __get_LEMBR() ({ *(volatile unsigned long *)(0xfe000040); }) -#define __get_LEMAM() ({ *(volatile unsigned long *)(0xfe000048); }) -#define __get_LCR(R) ({ *(volatile unsigned long *)(0xfe000100 + 8*(R)); }) -#define __get_LSBR(R) ({ *(volatile unsigned long *)(0xfe000c00 + 8*(R)); }) -#define __get_LSAM(R) ({ *(volatile unsigned long *)(0xfe000d00 + 8*(R)); }) - -#define __set_LGCR(V) do { *(volatile unsigned long *)(0xfe000010) = (V); } while(0) -#define __set_LMAICR(V) do { *(volatile unsigned long *)(0xfe000030) = (V); } while(0) -#define __set_LEMBR(V) do { *(volatile unsigned long *)(0xfe000040) = (V); } while(0) -#define __set_LEMAM(V) do { *(volatile unsigned long *)(0xfe000048) = (V); } while(0) -#define __set_LCR(R,V) do { *(volatile unsigned long *)(0xfe000100 + 8*(R)) = (V); } while(0) -#define __set_LSBR(R,V) do { *(volatile unsigned long *)(0xfe000c00 + 8*(R)) = (V); } while(0) -#define __set_LSAM(R,V) do { *(volatile unsigned long *)(0xfe000d00 + 8*(R)) = (V); } while(0) - -/* FR401 SDRAM controller registers */ -#define __get_DBR(R) ({ *(volatile unsigned long *)(0xfe000e00 + 8*(R)); }) -#define __get_DAM(R) ({ *(volatile unsigned long *)(0xfe000f00 + 8*(R)); }) - -/* FR551 SDRAM controller registers */ -#define __get_DARS(R) ({ *(volatile unsigned long *)(0xfeff0100 + 8*(R)); }) -#define __get_DAMK(R) ({ *(volatile unsigned long *)(0xfeff0110 + 8*(R)); }) - - -#endif /* _ASM_BUSCTL_REGS_H */ diff --git a/arch/frv/include/asm/cache.h b/arch/frv/include/asm/cache.h deleted file mode 100644 index 2797163b8f4f1..0000000000000 --- a/arch/frv/include/asm/cache.h +++ /dev/null @@ -1,23 +0,0 @@ -/* cache.h: FRV cache definitions - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#ifndef __ASM_CACHE_H -#define __ASM_CACHE_H - - -/* bytes per L1 cache line */ -#define L1_CACHE_SHIFT (CONFIG_FRV_L1_CACHE_SHIFT) -#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) - -#define __cacheline_aligned __attribute__((aligned(L1_CACHE_BYTES))) -#define ____cacheline_aligned __attribute__((aligned(L1_CACHE_BYTES))) - -#endif diff --git a/arch/frv/include/asm/cacheflush.h b/arch/frv/include/asm/cacheflush.h deleted file mode 100644 index edbac54ae015f..0000000000000 --- a/arch/frv/include/asm/cacheflush.h +++ /dev/null @@ -1,105 +0,0 @@ -/* cacheflush.h: FRV cache flushing routines - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#ifndef _ASM_CACHEFLUSH_H -#define _ASM_CACHEFLUSH_H - -/* Keep includes the same across arches. */ -#include - -/* - * virtually-indexed cache management (our cache is physically indexed) - */ -#define flush_cache_all() do {} while(0) -#define flush_cache_mm(mm) do {} while(0) -#define flush_cache_dup_mm(mm) do {} while(0) -#define flush_cache_range(mm, start, end) do {} while(0) -#define flush_cache_page(vma, vmaddr, pfn) do {} while(0) -#define flush_cache_vmap(start, end) do {} while(0) -#define flush_cache_vunmap(start, end) do {} while(0) -#define flush_dcache_mmap_lock(mapping) do {} while(0) -#define flush_dcache_mmap_unlock(mapping) do {} while(0) - -/* - * physically-indexed cache management - * - see arch/frv/lib/cache.S - */ -extern void frv_dcache_writeback(unsigned long start, unsigned long size); -extern void frv_cache_invalidate(unsigned long start, unsigned long size); -extern void frv_icache_invalidate(unsigned long start, unsigned long size); -extern void frv_cache_wback_inv(unsigned long start, unsigned long size); - -static inline void __flush_cache_all(void) -{ - asm volatile(" dcef @(gr0,gr0),#1 \n" - " icei @(gr0,gr0),#1 \n" - " membar \n" - : : : "memory" - ); -} - -/* dcache/icache coherency... */ -#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1 -#ifdef CONFIG_MMU -extern void flush_dcache_page(struct page *page); -#else -static inline void flush_dcache_page(struct page *page) -{ - unsigned long addr = page_to_phys(page); - frv_dcache_writeback(addr, addr + PAGE_SIZE); -} -#endif - -static inline void flush_page_to_ram(struct page *page) -{ - flush_dcache_page(page); -} - -static inline void flush_icache(void) -{ - __flush_cache_all(); -} - -static inline void flush_icache_range(unsigned long start, unsigned long end) -{ - frv_cache_wback_inv(start, end); -} - -#ifdef CONFIG_MMU -extern void flush_icache_user_range(struct vm_area_struct *vma, struct page *page, - unsigned long start, unsigned long len); -#else -static inline void flush_icache_user_range(struct vm_area_struct *vma, struct page *page, - unsigned long start, unsigned long len) -{ - frv_cache_wback_inv(start, start + len); -} -#endif - -static inline void flush_icache_page(struct vm_area_struct *vma, struct page *page) -{ - flush_icache_user_range(vma, page, page_to_phys(page), PAGE_SIZE); -} - -/* - * permit ptrace to access another process's address space through the icache - * and the dcache - */ -#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_CACHEFLUSH_H */ diff --git a/arch/frv/include/asm/checksum.h b/arch/frv/include/asm/checksum.h deleted file mode 100644 index b77388c5901d6..0000000000000 --- a/arch/frv/include/asm/checksum.h +++ /dev/null @@ -1,180 +0,0 @@ -/* checksum.h: FRV checksumming - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#ifndef _ASM_CHECKSUM_H -#define _ASM_CHECKSUM_H - -#include - -/* - * 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 - */ -__wsum csum_partial(const void *buff, int len, __wsum sum); - -/* - * the same as csum_partial, but copies from src while it - * checksums - * - * here even more important to align src and dst on a 32-bit (or even - * better 64-bit) boundary - */ -__wsum csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum); - -/* - * the same as csum_partial_copy, but copies from user space. - * - * here even more important to align src and dst on a 32-bit (or even - * better 64-bit) boundary - */ -extern __wsum csum_partial_copy_from_user(const void __user *src, void *dst, - int len, __wsum sum, int *csum_err); - -/* - * This is a version of ip_compute_csum() optimized for IP headers, - * which always checksum on 4 octet boundaries. - * - */ -static inline -__sum16 ip_fast_csum(const void *iph, unsigned int ihl) -{ - unsigned int tmp, inc, sum = 0; - - asm(" addcc gr0,gr0,gr0,icc0\n" /* clear icc0.C */ - " subi %1,#4,%1 \n" - "0: \n" - " ldu.p @(%1,%3),%4 \n" - " subicc %2,#1,%2,icc1 \n" - " addxcc.p %4,%0,%0,icc0 \n" - " bhi icc1,#2,0b \n" - - /* fold the 33-bit result into 16-bits */ - " addxcc gr0,%0,%0,icc0 \n" - " srli %0,#16,%1 \n" - " sethi #0,%0 \n" - " add %1,%0,%0 \n" - " srli %0,#16,%1 \n" - " add %1,%0,%0 \n" - - : "=r" (sum), "=r" (iph), "=r" (ihl), "=r" (inc), "=&r"(tmp) - : "0" (sum), "1" (iph), "2" (ihl), "3" (4), - "m"(*(volatile struct { int _[100]; } *)iph) - : "icc0", "icc1", "memory" - ); - - return (__force __sum16)~sum; -} - -/* - * Fold a partial checksum - */ -static inline __sum16 csum_fold(__wsum sum) -{ - unsigned int tmp; - - asm(" srli %0,#16,%1 \n" - " sethi #0,%0 \n" - " add %1,%0,%0 \n" - " srli %0,#16,%1 \n" - " add %1,%0,%0 \n" - : "=r"(sum), "=&r"(tmp) - : "0"(sum) - ); - - return (__force __sum16)~sum; -} - -/* - * computes the checksum of the TCP/UDP pseudo-header - * returns a 16-bit checksum, already complemented - */ -static inline __wsum -csum_tcpudp_nofold(__be32 saddr, __be32 daddr, __u32 len, - __u8 proto, __wsum sum) -{ - asm(" addcc %1,%0,%0,icc0 \n" - " addxcc %2,%0,%0,icc0 \n" - " addxcc %3,%0,%0,icc0 \n" - " addxcc gr0,%0,%0,icc0 \n" - : "=r" (sum) - : "r" (daddr), "r" (saddr), "r" (len + proto), "0"(sum) - : "icc0" - ); - return sum; -} - -static inline __sum16 -csum_tcpudp_magic(__be32 saddr, __be32 daddr, __u32 len, - __u8 proto, __wsum sum) -{ - return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); -} - -/* - * this routine is used for miscellaneous IP-like checksums, mainly - * in icmp.c - */ -extern __sum16 ip_compute_csum(const void *buff, int len); - -#define _HAVE_ARCH_IPV6_CSUM -static inline __sum16 -csum_ipv6_magic(const struct in6_addr *saddr, const struct in6_addr *daddr, - __u32 len, __u8 proto, __wsum sum) -{ - unsigned long tmp, tmp2; - - asm(" addcc %2,%0,%0,icc0 \n" - - /* add up the source addr */ - " ldi @(%3,0),%1 \n" - " addxcc %1,%0,%0,icc0 \n" - " ldi @(%3,4),%2 \n" - " addxcc %2,%0,%0,icc0 \n" - " ldi @(%3,8),%1 \n" - " addxcc %1,%0,%0,icc0 \n" - " ldi @(%3,12),%2 \n" - " addxcc %2,%0,%0,icc0 \n" - - /* add up the dest addr */ - " ldi @(%4,0),%1 \n" - " addxcc %1,%0,%0,icc0 \n" - " ldi @(%4,4),%2 \n" - " addxcc %2,%0,%0,icc0 \n" - " ldi @(%4,8),%1 \n" - " addxcc %1,%0,%0,icc0 \n" - " ldi @(%4,12),%2 \n" - " addxcc %2,%0,%0,icc0 \n" - - /* fold the 33-bit result into 16-bits */ - " addxcc gr0,%0,%0,icc0 \n" - " srli %0,#16,%1 \n" - " sethi #0,%0 \n" - " add %1,%0,%0 \n" - " srli %0,#16,%1 \n" - " add %1,%0,%0 \n" - - : "=r" (sum), "=&r" (tmp), "=r" (tmp2) - : "r" (saddr), "r" (daddr), "0" (sum), "2" (len + proto) - : "icc0" - ); - - return (__force __sum16)~sum; -} - -#endif /* _ASM_CHECKSUM_H */ diff --git a/arch/frv/include/asm/cmpxchg.h b/arch/frv/include/asm/cmpxchg.h deleted file mode 100644 index ad1f11cfa92a3..0000000000000 --- a/arch/frv/include/asm/cmpxchg.h +++ /dev/null @@ -1,171 +0,0 @@ -/* xchg and cmpxchg operation emulation for FR-V - * - * For an explanation of how atomic ops work in this arch, see: - * Documentation/frv/atomic-ops.txt - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ -#ifndef _ASM_CMPXCHG_H -#define _ASM_CMPXCHG_H - -#include - -/*****************************************************************************/ -/* - * exchange value with memory - */ -extern uint64_t __xchg_64(uint64_t i, volatile void *v); - -#ifndef CONFIG_FRV_OUTOFLINE_ATOMIC_OPS - -#define xchg(ptr, x) \ -({ \ - __typeof__(ptr) __xg_ptr = (ptr); \ - __typeof__(*(ptr)) __xg_orig; \ - \ - switch (sizeof(__xg_orig)) { \ - case 4: \ - asm volatile( \ - "swap%I0 %M0,%1" \ - : "+m"(*__xg_ptr), "=r"(__xg_orig) \ - : "1"(x) \ - : "memory" \ - ); \ - break; \ - \ - default: \ - __xg_orig = (__typeof__(__xg_orig))0; \ - asm volatile("break"); \ - break; \ - } \ - \ - __xg_orig; \ -}) - -#else - -extern uint32_t __xchg_32(uint32_t i, volatile void *v); - -#define xchg(ptr, x) \ -({ \ - __typeof__(ptr) __xg_ptr = (ptr); \ - __typeof__(*(ptr)) __xg_orig; \ - \ - switch (sizeof(__xg_orig)) { \ - case 4: __xg_orig = (__typeof__(*(ptr))) __xchg_32((uint32_t) x, __xg_ptr); break; \ - default: \ - __xg_orig = (__typeof__(__xg_orig))0; \ - asm volatile("break"); \ - break; \ - } \ - __xg_orig; \ -}) - -#endif - -/*****************************************************************************/ -/* - * compare and conditionally exchange value with memory - * - if (*ptr == test) then orig = *ptr; *ptr = test; - * - if (*ptr != test) then orig = *ptr; - */ -extern uint64_t __cmpxchg_64(uint64_t test, uint64_t new, volatile uint64_t *v); -#define cmpxchg64(p, o, n) __cmpxchg_64((o), (n), (p)) - -#ifndef CONFIG_FRV_OUTOFLINE_ATOMIC_OPS - -#define cmpxchg(ptr, test, new) \ -({ \ - __typeof__(ptr) __xg_ptr = (ptr); \ - __typeof__(*(ptr)) __xg_orig, __xg_tmp; \ - __typeof__(*(ptr)) __xg_test = (test); \ - __typeof__(*(ptr)) __xg_new = (new); \ - \ - switch (sizeof(__xg_orig)) { \ - case 4: \ - asm volatile( \ - "0: \n" \ - " orcc gr0,gr0,gr0,icc3 \n" \ - " ckeq icc3,cc7 \n" \ - " ld.p %M0,%1 \n" \ - " orcr cc7,cc7,cc3 \n" \ - " sub%I4cc %1,%4,%2,icc0 \n" \ - " bne icc0,#0,1f \n" \ - " cst.p %3,%M0 ,cc3,#1 \n" \ - " corcc gr29,gr29,gr0 ,cc3,#1 \n" \ - " beq icc3,#0,0b \n" \ - "1: \n" \ - : "+U"(*__xg_ptr), "=&r"(__xg_orig), "=&r"(__xg_tmp) \ - : "r"(__xg_new), "NPr"(__xg_test) \ - : "memory", "cc7", "cc3", "icc3", "icc0" \ - ); \ - break; \ - \ - default: \ - __xg_orig = (__typeof__(__xg_orig))0; \ - asm volatile("break"); \ - break; \ - } \ - \ - __xg_orig; \ -}) - -#else - -extern uint32_t __cmpxchg_32(uint32_t *v, uint32_t test, uint32_t new); - -#define cmpxchg(ptr, test, new) \ -({ \ - __typeof__(ptr) __xg_ptr = (ptr); \ - __typeof__(*(ptr)) __xg_orig; \ - __typeof__(*(ptr)) __xg_test = (test); \ - __typeof__(*(ptr)) __xg_new = (new); \ - \ - switch (sizeof(__xg_orig)) { \ - case 4: __xg_orig = (__force __typeof__(*ptr)) \ - __cmpxchg_32((__force uint32_t *)__xg_ptr, \ - (__force uint32_t)__xg_test, \ - (__force uint32_t)__xg_new); break; \ - default: \ - __xg_orig = (__typeof__(__xg_orig))0; \ - asm volatile("break"); \ - break; \ - } \ - \ - __xg_orig; \ -}) - -#endif - -#include - -static inline unsigned long __cmpxchg_local(volatile void *ptr, - unsigned long old, - unsigned long new, int size) -{ - switch (size) { - case 4: - return cmpxchg((unsigned long *)ptr, old, new); - default: - return __cmpxchg_local_generic(ptr, old, new, size); - } - - return old; -} - -/* - * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make - * them available. - */ -#define cmpxchg_local(ptr, o, n) \ - ((__typeof__(*(ptr)))__cmpxchg_local((ptr), (unsigned long)(o), \ - (unsigned long)(n), sizeof(*(ptr)))) -#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n)) - -#endif /* _ASM_CMPXCHG_H */ diff --git a/arch/frv/include/asm/cpu-irqs.h b/arch/frv/include/asm/cpu-irqs.h deleted file mode 100644 index 478f3498fcfeb..0000000000000 --- a/arch/frv/include/asm/cpu-irqs.h +++ /dev/null @@ -1,81 +0,0 @@ -/* cpu-irqs.h: on-CPU peripheral irqs - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#ifndef _ASM_CPU_IRQS_H -#define _ASM_CPU_IRQS_H - -#ifndef __ASSEMBLY__ - -/* IRQ to level mappings */ -#define IRQ_GDBSTUB_LEVEL 15 -#define IRQ_UART_LEVEL 13 - -#ifdef CONFIG_GDBSTUB_UART0 -#define IRQ_UART0_LEVEL IRQ_GDBSTUB_LEVEL -#else -#define IRQ_UART0_LEVEL IRQ_UART_LEVEL -#endif - -#ifdef CONFIG_GDBSTUB_UART1 -#define IRQ_UART1_LEVEL IRQ_GDBSTUB_LEVEL -#else -#define IRQ_UART1_LEVEL IRQ_UART_LEVEL -#endif - -#define IRQ_DMA0_LEVEL 14 -#define IRQ_DMA1_LEVEL 14 -#define IRQ_DMA2_LEVEL 14 -#define IRQ_DMA3_LEVEL 14 -#define IRQ_DMA4_LEVEL 14 -#define IRQ_DMA5_LEVEL 14 -#define IRQ_DMA6_LEVEL 14 -#define IRQ_DMA7_LEVEL 14 - -#define IRQ_TIMER0_LEVEL 12 -#define IRQ_TIMER1_LEVEL 11 -#define IRQ_TIMER2_LEVEL 10 - -#define IRQ_XIRQ0_LEVEL 1 -#define IRQ_XIRQ1_LEVEL 2 -#define IRQ_XIRQ2_LEVEL 3 -#define IRQ_XIRQ3_LEVEL 4 -#define IRQ_XIRQ4_LEVEL 5 -#define IRQ_XIRQ5_LEVEL 6 -#define IRQ_XIRQ6_LEVEL 7 -#define IRQ_XIRQ7_LEVEL 8 - -/* IRQ IDs presented to drivers */ -#define IRQ_CPU__UNUSED IRQ_BASE_CPU -#define IRQ_CPU_UART0 (IRQ_BASE_CPU + IRQ_UART0_LEVEL) -#define IRQ_CPU_UART1 (IRQ_BASE_CPU + IRQ_UART1_LEVEL) -#define IRQ_CPU_TIMER0 (IRQ_BASE_CPU + IRQ_TIMER0_LEVEL) -#define IRQ_CPU_TIMER1 (IRQ_BASE_CPU + IRQ_TIMER1_LEVEL) -#define IRQ_CPU_TIMER2 (IRQ_BASE_CPU + IRQ_TIMER2_LEVEL) -#define IRQ_CPU_DMA0 (IRQ_BASE_CPU + IRQ_DMA0_LEVEL) -#define IRQ_CPU_DMA1 (IRQ_BASE_CPU + IRQ_DMA1_LEVEL) -#define IRQ_CPU_DMA2 (IRQ_BASE_CPU + IRQ_DMA2_LEVEL) -#define IRQ_CPU_DMA3 (IRQ_BASE_CPU + IRQ_DMA3_LEVEL) -#define IRQ_CPU_DMA4 (IRQ_BASE_CPU + IRQ_DMA4_LEVEL) -#define IRQ_CPU_DMA5 (IRQ_BASE_CPU + IRQ_DMA5_LEVEL) -#define IRQ_CPU_DMA6 (IRQ_BASE_CPU + IRQ_DMA6_LEVEL) -#define IRQ_CPU_DMA7 (IRQ_BASE_CPU + IRQ_DMA7_LEVEL) -#define IRQ_CPU_EXTERNAL0 (IRQ_BASE_CPU + IRQ_XIRQ0_LEVEL) -#define IRQ_CPU_EXTERNAL1 (IRQ_BASE_CPU + IRQ_XIRQ1_LEVEL) -#define IRQ_CPU_EXTERNAL2 (IRQ_BASE_CPU + IRQ_XIRQ2_LEVEL) -#define IRQ_CPU_EXTERNAL3 (IRQ_BASE_CPU + IRQ_XIRQ3_LEVEL) -#define IRQ_CPU_EXTERNAL4 (IRQ_BASE_CPU + IRQ_XIRQ4_LEVEL) -#define IRQ_CPU_EXTERNAL5 (IRQ_BASE_CPU + IRQ_XIRQ5_LEVEL) -#define IRQ_CPU_EXTERNAL6 (IRQ_BASE_CPU + IRQ_XIRQ6_LEVEL) -#define IRQ_CPU_EXTERNAL7 (IRQ_BASE_CPU + IRQ_XIRQ7_LEVEL) - -#endif /* !__ASSEMBLY__ */ - -#endif /* _ASM_CPU_IRQS_H */ diff --git a/arch/frv/include/asm/current.h b/arch/frv/include/asm/current.h deleted file mode 100644 index 86b027491b082..0000000000000 --- a/arch/frv/include/asm/current.h +++ /dev/null @@ -1,30 +0,0 @@ -/* current.h: FRV current task pointer - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#ifndef _ASM_CURRENT_H -#define _ASM_CURRENT_H - -#ifndef __ASSEMBLY__ - -/* - * dedicate GR29 to keeping the current task pointer - */ -register struct task_struct *current asm("gr29"); - -#define get_current() current - -#else - -#define CURRENT gr29 - -#endif - -#endif /* _ASM_CURRENT_H */ diff --git a/arch/frv/include/asm/delay.h b/arch/frv/include/asm/delay.h deleted file mode 100644 index 597b4ebf03b4b..0000000000000 --- a/arch/frv/include/asm/delay.h +++ /dev/null @@ -1,50 +0,0 @@ -/* delay.h: FRV delay code - * - * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#ifndef _ASM_DELAY_H -#define _ASM_DELAY_H - -#include -#include - -/* - * delay loop - runs at __core_clock_speed_HZ / 2 [there are 2 insns in the loop] - */ -extern unsigned long __delay_loops_MHz; - -static inline void __delay(unsigned long loops) -{ - asm volatile("1: subicc %0,#1,%0,icc0 \n" - " bnc icc0,#2,1b \n" - : "=r" (loops) - : "0" (loops) - : "icc0" - ); -} - -/* - * Use only for very small delays ( < 1 msec). Should probably use a - * lookup table, really, as the multiplications take much too long with - * short delays. This is a "reasonable" implementation, though (and the - * first constant multiplications gets optimized away if the delay is - * a constant) - */ - -extern unsigned long loops_per_jiffy; - -static inline void udelay(unsigned long usecs) -{ - __delay(usecs * __delay_loops_MHz); -} - -#define ndelay(n) udelay((n) * 5) - -#endif /* _ASM_DELAY_H */ diff --git a/arch/frv/include/asm/div64.h b/arch/frv/include/asm/div64.h deleted file mode 100644 index 6cd978cefb285..0000000000000 --- a/arch/frv/include/asm/div64.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/arch/frv/include/asm/dm9000.h b/arch/frv/include/asm/dm9000.h deleted file mode 100644 index f6f48fd9ec6e6..0000000000000 --- a/arch/frv/include/asm/dm9000.h +++ /dev/null @@ -1,37 +0,0 @@ -/* dm9000.h: Davicom DM9000 adapter configuration - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#ifndef _ASM_DM9000_H -#define _ASM_DM9000_H - -#include - -#define DM9000_ARCH_IOBASE (__region_CS6 + 0x300) -#define DM9000_ARCH_IRQ IRQ_CPU_EXTERNAL3 /* XIRQ #3 (shared with FPGA) */ -#undef DM9000_ARCH_IRQ_ACTLOW /* IRQ pin active high */ -#define DM9000_ARCH_BUS_INFO "CS6#+0x300" /* bus info for ethtool */ - -#undef __is_PCI_IO -#define __is_PCI_IO(addr) 0 /* not PCI */ - -#undef inl -#define inl(addr) \ -({ \ - unsigned long __ioaddr = (unsigned long) addr; \ - uint32_t x = readl(__ioaddr); \ - ((x & 0xff) << 24) | ((x & 0xff00) << 8) | ((x >> 8) & 0xff00) | ((x >> 24) & 0xff); \ -}) - -#undef insl -#define insl(a,b,l) __insl(a,b,l,0) /* don't byte-swap */ - - -#endif /* _ASM_DM9000_H */ diff --git a/arch/frv/include/asm/dma-mapping.h b/arch/frv/include/asm/dma-mapping.h deleted file mode 100644 index fd80e840a1e66..0000000000000 --- a/arch/frv/include/asm/dma-mapping.h +++ /dev/null @@ -1,18 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_DMA_MAPPING_H -#define _ASM_DMA_MAPPING_H - -#include -#include - -extern unsigned long __nongprelbss dma_coherent_mem_start; -extern unsigned long __nongprelbss dma_coherent_mem_end; - -extern const struct dma_map_ops frv_dma_ops; - -static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) -{ - return &frv_dma_ops; -} - -#endif /* _ASM_DMA_MAPPING_H */ diff --git a/arch/frv/include/asm/dma.h b/arch/frv/include/asm/dma.h deleted file mode 100644 index 683c47d48a5bf..0000000000000 --- a/arch/frv/include/asm/dma.h +++ /dev/null @@ -1,125 +0,0 @@ -/* dma.h: FRV DMA controller management - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#ifndef _ASM_DMA_H -#define _ASM_DMA_H - -//#define DMA_DEBUG 1 - -#include - -#undef MAX_DMA_CHANNELS /* don't use kernel/dma.c */ - -/* under 2.4 this is actually needed by the new bootmem allocator */ -#define MAX_DMA_ADDRESS PAGE_OFFSET - -/* - * FRV DMA controller management - */ -typedef irqreturn_t (*dma_irq_handler_t)(int dmachan, unsigned long cstr, void *data); - -extern void frv_dma_init(void); - -extern int frv_dma_open(const char *devname, - unsigned long dmamask, - int dmacap, - dma_irq_handler_t handler, - unsigned long irq_flags, - void *data); - -/* channels required */ -#define FRV_DMA_MASK_ANY ULONG_MAX /* any channel */ - -/* capabilities required */ -#define FRV_DMA_CAP_DREQ 0x01 /* DMA request pin */ -#define FRV_DMA_CAP_DACK 0x02 /* DMA ACK pin */ -#define FRV_DMA_CAP_DONE 0x04 /* DMA done pin */ - -extern void frv_dma_close(int dma); - -extern void frv_dma_config(int dma, unsigned long ccfr, unsigned long cctr, unsigned long apr); - -extern void frv_dma_start(int dma, - unsigned long sba, unsigned long dba, - unsigned long pix, unsigned long six, unsigned long bcl); - -extern void frv_dma_restart_circular(int dma, unsigned long six); - -extern void frv_dma_stop(int dma); - -extern int is_frv_dma_interrupting(int dma); - -extern void frv_dma_dump(int dma); - -extern void frv_dma_status_clear(int dma); - -#define FRV_DMA_NCHANS 8 -#define FRV_DMA_4CHANS 4 -#define FRV_DMA_8CHANS 8 - -#define DMAC_CCFRx 0x00 /* channel configuration reg */ -#define DMAC_CCFRx_CM_SHIFT 16 -#define DMAC_CCFRx_CM_DA 0x00000000 -#define DMAC_CCFRx_CM_SCA 0x00010000 -#define DMAC_CCFRx_CM_DCA 0x00020000 -#define DMAC_CCFRx_CM_2D 0x00030000 -#define DMAC_CCFRx_ATS_SHIFT 8 -#define DMAC_CCFRx_RS_INTERN 0x00000000 -#define DMAC_CCFRx_RS_EXTERN 0x00000001 -#define DMAC_CCFRx_RS_SHIFT 0 - -#define DMAC_CSTRx 0x08 /* channel status reg */ -#define DMAC_CSTRx_FS 0x0000003f -#define DMAC_CSTRx_NE 0x00000100 -#define DMAC_CSTRx_FED 0x00000200 -#define DMAC_CSTRx_WER 0x00000800 -#define DMAC_CSTRx_RER 0x00001000 -#define DMAC_CSTRx_CE 0x00002000 -#define DMAC_CSTRx_INT 0x00800000 -#define DMAC_CSTRx_BUSY 0x80000000 - -#define DMAC_CCTRx 0x10 /* channel control reg */ -#define DMAC_CCTRx_DSIZ_1 0x00000000 -#define DMAC_CCTRx_DSIZ_2 0x00000001 -#define DMAC_CCTRx_DSIZ_4 0x00000002 -#define DMAC_CCTRx_DSIZ_32 0x00000005 -#define DMAC_CCTRx_DAU_HOLD 0x00000000 -#define DMAC_CCTRx_DAU_INC 0x00000010 -#define DMAC_CCTRx_DAU_DEC 0x00000020 -#define DMAC_CCTRx_SSIZ_1 0x00000000 -#define DMAC_CCTRx_SSIZ_2 0x00000100 -#define DMAC_CCTRx_SSIZ_4 0x00000200 -#define DMAC_CCTRx_SSIZ_32 0x00000500 -#define DMAC_CCTRx_SAU_HOLD 0x00000000 -#define DMAC_CCTRx_SAU_INC 0x00001000 -#define DMAC_CCTRx_SAU_DEC 0x00002000 -#define DMAC_CCTRx_FC 0x08000000 -#define DMAC_CCTRx_ICE 0x10000000 -#define DMAC_CCTRx_IE 0x40000000 -#define DMAC_CCTRx_ACT 0x80000000 - -#define DMAC_SBAx 0x18 /* source base address reg */ -#define DMAC_DBAx 0x20 /* data base address reg */ -#define DMAC_PIXx 0x28 /* primary index reg */ -#define DMAC_SIXx 0x30 /* secondary index reg */ -#define DMAC_BCLx 0x38 /* byte count limit reg */ -#define DMAC_APRx 0x40 /* alternate pointer reg */ - -/* - * required for PCI + MODULES - */ -#ifdef CONFIG_PCI -extern int isa_dma_bridge_buggy; -#else -#define isa_dma_bridge_buggy (0) -#endif - -#endif /* _ASM_DMA_H */ diff --git a/arch/frv/include/asm/elf.h b/arch/frv/include/asm/elf.h deleted file mode 100644 index 2bac6446db41b..0000000000000 --- a/arch/frv/include/asm/elf.h +++ /dev/null @@ -1,140 +0,0 @@ -/* elf.h: FR-V ELF definitions - * - * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - Derived from include/asm-m68knommu/elf.h - * - * 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_ELF_H -#define __ASM_ELF_H - -#include -#include - -struct elf32_hdr; - -/* - * ELF header e_flags defines. - */ -#define EF_FRV_GPR_MASK 0x00000003 /* mask for # of gprs */ -#define EF_FRV_GPR32 0x00000001 /* Only uses GR on 32-register */ -#define EF_FRV_GPR64 0x00000002 /* Only uses GR on 64-register */ -#define EF_FRV_FPR_MASK 0x0000000c /* mask for # of fprs */ -#define EF_FRV_FPR32 0x00000004 /* Only uses FR on 32-register */ -#define EF_FRV_FPR64 0x00000008 /* Only uses FR on 64-register */ -#define EF_FRV_FPR_NONE 0x0000000C /* Uses software floating-point */ -#define EF_FRV_DWORD_MASK 0x00000030 /* mask for dword support */ -#define EF_FRV_DWORD_YES 0x00000010 /* Assumes stack aligned to 8-byte boundaries. */ -#define EF_FRV_DWORD_NO 0x00000020 /* Assumes stack aligned to 4-byte boundaries. */ -#define EF_FRV_DOUBLE 0x00000040 /* Uses double instructions. */ -#define EF_FRV_MEDIA 0x00000080 /* Uses media instructions. */ -#define EF_FRV_PIC 0x00000100 /* Uses position independent code. */ -#define EF_FRV_NON_PIC_RELOCS 0x00000200 /* Does not use position Independent code. */ -#define EF_FRV_MULADD 0x00000400 /* -mmuladd */ -#define EF_FRV_BIGPIC 0x00000800 /* -fPIC */ -#define EF_FRV_LIBPIC 0x00001000 /* -mlibrary-pic */ -#define EF_FRV_G0 0x00002000 /* -G 0, no small data ptr */ -#define EF_FRV_NOPACK 0x00004000 /* -mnopack */ -#define EF_FRV_FDPIC 0x00008000 /* -mfdpic */ -#define EF_FRV_CPU_MASK 0xff000000 /* specific cpu bits */ -#define EF_FRV_CPU_GENERIC 0x00000000 /* Set CPU type is FR-V */ -#define EF_FRV_CPU_FR500 0x01000000 /* Set CPU type is FR500 */ -#define EF_FRV_CPU_FR300 0x02000000 /* Set CPU type is FR300 */ -#define EF_FRV_CPU_SIMPLE 0x03000000 /* SIMPLE */ -#define EF_FRV_CPU_TOMCAT 0x04000000 /* Tomcat, FR500 prototype */ -#define EF_FRV_CPU_FR400 0x05000000 /* Set CPU type is FR400 */ -#define EF_FRV_CPU_FR550 0x06000000 /* Set CPU type is FR550 */ -#define EF_FRV_CPU_FR405 0x07000000 /* Set CPU type is FR405 */ -#define EF_FRV_CPU_FR450 0x08000000 /* Set CPU type is FR450 */ - -/* - * FR-V ELF relocation types - */ - - -/* - * ELF register definitions.. - */ -typedef unsigned long elf_greg_t; - -#define ELF_NGREG (sizeof(struct pt_regs) / sizeof(elf_greg_t)) -typedef elf_greg_t elf_gregset_t[ELF_NGREG]; - -typedef struct user_fpmedia_regs elf_fpregset_t; - -/* - * This is used to ensure we don't load something for the wrong architecture. - */ -extern int elf_check_arch(const struct elf32_hdr *hdr); - -#define elf_check_fdpic(x) ((x)->e_flags & EF_FRV_FDPIC && !((x)->e_flags & EF_FRV_NON_PIC_RELOCS)) -#define elf_check_const_displacement(x) ((x)->e_flags & EF_FRV_PIC) - -/* - * These are used to set parameters in the core dumps. - */ -#define ELF_CLASS ELFCLASS32 -#define ELF_DATA ELFDATA2MSB -#define ELF_ARCH EM_FRV - -#define ELF_PLAT_INIT(_r) \ -do { \ - __kernel_frame0_ptr->gr16 = 0; \ - __kernel_frame0_ptr->gr17 = 0; \ - __kernel_frame0_ptr->gr18 = 0; \ - __kernel_frame0_ptr->gr19 = 0; \ - __kernel_frame0_ptr->gr20 = 0; \ - __kernel_frame0_ptr->gr21 = 0; \ - __kernel_frame0_ptr->gr22 = 0; \ - __kernel_frame0_ptr->gr23 = 0; \ - __kernel_frame0_ptr->gr24 = 0; \ - __kernel_frame0_ptr->gr25 = 0; \ - __kernel_frame0_ptr->gr26 = 0; \ - __kernel_frame0_ptr->gr27 = 0; \ - __kernel_frame0_ptr->gr29 = 0; \ -} while(0) - -#define ELF_FDPIC_PLAT_INIT(_regs, _exec_map_addr, _interp_map_addr, _dynamic_addr) \ -do { \ - __kernel_frame0_ptr->gr16 = _exec_map_addr; \ - __kernel_frame0_ptr->gr17 = _interp_map_addr; \ - __kernel_frame0_ptr->gr18 = _dynamic_addr; \ - __kernel_frame0_ptr->gr19 = 0; \ - __kernel_frame0_ptr->gr20 = 0; \ - __kernel_frame0_ptr->gr21 = 0; \ - __kernel_frame0_ptr->gr22 = 0; \ - __kernel_frame0_ptr->gr23 = 0; \ - __kernel_frame0_ptr->gr24 = 0; \ - __kernel_frame0_ptr->gr25 = 0; \ - __kernel_frame0_ptr->gr26 = 0; \ - __kernel_frame0_ptr->gr27 = 0; \ - __kernel_frame0_ptr->gr29 = 0; \ -} while(0) - -#define CORE_DUMP_USE_REGSET -#define ELF_FDPIC_CORE_EFLAGS EF_FRV_FDPIC -#define ELF_EXEC_PAGESIZE 16384 - -/* This is the location that an ET_DYN program is loaded if exec'ed. Typical - use of this is to invoke "./ld.so someprog" to test out a new version of - the loader. We need to make sure that it is out of the way of the program - that it will "exec", and that there is sufficient room for the brk. */ - -#define ELF_ET_DYN_BASE 0x08000000UL - -/* This yields a mask that user programs can use to figure out what - instruction set this cpu supports. */ - -#define ELF_HWCAP (0) - -/* This yields a string that ld.so will use to load implementation - specific libraries for optimization. This is more specific in - intent than poking at uname or /proc/cpuinfo. */ - -#define ELF_PLATFORM (NULL) - -#endif diff --git a/arch/frv/include/asm/emergency-restart.h b/arch/frv/include/asm/emergency-restart.h deleted file mode 100644 index 108d8c48e42e8..0000000000000 --- a/arch/frv/include/asm/emergency-restart.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _ASM_EMERGENCY_RESTART_H -#define _ASM_EMERGENCY_RESTART_H - -#include - -#endif /* _ASM_EMERGENCY_RESTART_H */ diff --git a/arch/frv/include/asm/fpu.h b/arch/frv/include/asm/fpu.h deleted file mode 100644 index 2f0929333f911..0000000000000 --- a/arch/frv/include/asm/fpu.h +++ /dev/null @@ -1,12 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __ASM_FPU_H -#define __ASM_FPU_H - - -/* - * MAX floating point unit state size (FSAVE/FRESTORE) - */ - -#define kernel_fpu_end() do { asm volatile("bar":::"memory"); preempt_enable(); } while(0) - -#endif /* __ASM_FPU_H */ diff --git a/arch/frv/include/asm/ftrace.h b/arch/frv/include/asm/ftrace.h deleted file mode 100644 index 40a8c178f10d9..0000000000000 --- a/arch/frv/include/asm/ftrace.h +++ /dev/null @@ -1 +0,0 @@ -/* empty */ diff --git a/arch/frv/include/asm/futex.h b/arch/frv/include/asm/futex.h deleted file mode 100644 index dfcc3484231d4..0000000000000 --- a/arch/frv/include/asm/futex.h +++ /dev/null @@ -1,22 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_FUTEX_H -#define _ASM_FUTEX_H - -#ifdef __KERNEL__ - -#include -#include -#include - -extern int arch_futex_atomic_op_inuser(int op, int oparg, int *oval, - u32 __user *uaddr); - -static inline int -futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, - u32 oldval, u32 newval) -{ - return -ENOSYS; -} - -#endif -#endif diff --git a/arch/frv/include/asm/gdb-stub.h b/arch/frv/include/asm/gdb-stub.h deleted file mode 100644 index e6bedd0cd9a58..0000000000000 --- a/arch/frv/include/asm/gdb-stub.h +++ /dev/null @@ -1,146 +0,0 @@ -/* gdb-stub.h: FRV GDB stub - * - * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - Derived from asm-mips/gdb-stub.h (c) 1995 Andreas Busse - * - * 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_GDB_STUB_H -#define __ASM_GDB_STUB_H - -#undef GDBSTUB_DEBUG_IO -#undef GDBSTUB_DEBUG_PROTOCOL - -#include - -/* - * important register numbers in GDB protocol - * - GR0, GR1, GR2, GR3, GR4, GR5, GR6, GR7, - * - GR8, GR9, GR10, GR11, GR12, GR13, GR14, GR15, - * - GR16, GR17, GR18, GR19, GR20, GR21, GR22, GR23, - * - GR24, GR25, GR26, GR27, GR28, GR29, GR30, GR31, - * - GR32, GR33, GR34, GR35, GR36, GR37, GR38, GR39, - * - GR40, GR41, GR42, GR43, GR44, GR45, GR46, GR47, - * - GR48, GR49, GR50, GR51, GR52, GR53, GR54, GR55, - * - GR56, GR57, GR58, GR59, GR60, GR61, GR62, GR63, - * - FR0, FR1, FR2, FR3, FR4, FR5, FR6, FR7, - * - FR8, FR9, FR10, FR11, FR12, FR13, FR14, FR15, - * - FR16, FR17, FR18, FR19, FR20, FR21, FR22, FR23, - * - FR24, FR25, FR26, FR27, FR28, FR29, FR30, FR31, - * - FR32, FR33, FR34, FR35, FR36, FR37, FR38, FR39, - * - FR40, FR41, FR42, FR43, FR44, FR45, FR46, FR47, - * - FR48, FR49, FR50, FR51, FR52, FR53, FR54, FR55, - * - FR56, FR57, FR58, FR59, FR60, FR61, FR62, FR63, - * - PC, PSR, CCR, CCCR, - * - _X132, _X133, _X134 - * - TBR, BRR, DBAR0, DBAR1, DBAR2, DBAR3, - * - SCR0, SCR1, SCR2, SCR3, - * - LR, LCR, - * - IACC0H, IACC0L, - * - FSR0, - * - ACC0, ACC1, ACC2, ACC3, ACC4, ACC5, ACC6, ACC7, - * - ACCG0123, ACCG4567, - * - MSR0, MSR1, - * - GNER0, GNER1, - * - FNER0, FNER1, - */ -#define GDB_REG_GR(N) (N) -#define GDB_REG_FR(N) (64+(N)) -#define GDB_REG_PC 128 -#define GDB_REG_PSR 129 -#define GDB_REG_CCR 130 -#define GDB_REG_CCCR 131 -#define GDB_REG_TBR 135 -#define GDB_REG_BRR 136 -#define GDB_REG_DBAR(N) (137+(N)) -#define GDB_REG_SCR(N) (141+(N)) -#define GDB_REG_LR 145 -#define GDB_REG_LCR 146 -#define GDB_REG_FSR0 149 -#define GDB_REG_ACC(N) (150+(N)) -#define GDB_REG_ACCG(N) (158+(N)/4) -#define GDB_REG_MSR(N) (160+(N)) -#define GDB_REG_GNER(N) (162+(N)) -#define GDB_REG_FNER(N) (164+(N)) - -#define GDB_REG_SP GDB_REG_GR(1) -#define GDB_REG_FP GDB_REG_GR(2) - -#ifndef _LANGUAGE_ASSEMBLY - -/* - * Prototypes - */ -extern void show_registers_only(struct pt_regs *regs); - -extern void gdbstub_init(void); -extern void gdbstub(int type); -extern void gdbstub_exit(int status); - -extern void gdbstub_io_init(void); -extern void gdbstub_set_baud(unsigned baud); -extern int gdbstub_rx_char(unsigned char *_ch, int nonblock); -extern void gdbstub_tx_char(unsigned char ch); -extern void gdbstub_tx_flush(void); -extern void gdbstub_do_rx(void); - -extern asmlinkage void __debug_stub_init_break(void); -extern asmlinkage void __break_hijack_kernel_event(void); -extern asmlinkage void __break_hijack_kernel_event_breaks_here(void); - -extern asmlinkage void gdbstub_rx_handler(void); -extern asmlinkage void gdbstub_rx_irq(void); -extern asmlinkage void gdbstub_intercept(void); - -extern uint32_t __entry_usertrap_table[]; -extern uint32_t __entry_kerneltrap_table[]; - -extern volatile u8 gdbstub_rx_buffer[PAGE_SIZE]; -extern volatile u32 gdbstub_rx_inp; -extern volatile u32 gdbstub_rx_outp; -extern volatile u8 gdbstub_rx_overflow; -extern u8 gdbstub_rx_unget; - -extern void gdbstub_printk(const char *fmt, ...); -extern void debug_to_serial(const char *p, int n); -extern void console_set_baud(unsigned baud); - -#ifdef GDBSTUB_DEBUG_IO -#define gdbstub_io(FMT,...) gdbstub_printk(FMT, ##__VA_ARGS__) -#else -#define gdbstub_io(FMT,...) ({ 0; }) -#endif - -#ifdef GDBSTUB_DEBUG_PROTOCOL -#define gdbstub_proto(FMT,...) gdbstub_printk(FMT,##__VA_ARGS__) -#else -#define gdbstub_proto(FMT,...) ({ 0; }) -#endif - -/* - * we dedicate GR31 to keeping a pointer to the gdbstub exception frame - * - gr31 is destroyed on entry to the gdbstub if !MMU - * - gr31 is saved in scr3 on entry to the gdbstub if in !MMU - */ -register struct frv_frame0 *__debug_frame0 asm("gr31"); - -#define __debug_frame (&__debug_frame0->regs) -#define __debug_user_context (&__debug_frame0->uc) -#define __debug_regs (&__debug_frame0->debug) -#define __debug_reg(X) ((unsigned long *) ((unsigned long) &__debug_frame0 + (X))) - -struct frv_debug_status { - unsigned long bpsr; - unsigned long dcr; - unsigned long brr; - unsigned long nmar; -}; - -extern struct frv_debug_status __debug_status; - -#endif /* _LANGUAGE_ASSEMBLY */ -#endif /* __ASM_GDB_STUB_H */ diff --git a/arch/frv/include/asm/gpio-regs.h b/arch/frv/include/asm/gpio-regs.h deleted file mode 100644 index 9edf5d5d4d3fc..0000000000000 --- a/arch/frv/include/asm/gpio-regs.h +++ /dev/null @@ -1,116 +0,0 @@ -/* gpio-regs.h: on-chip general purpose I/O registers - * - * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#ifndef _ASM_GPIO_REGS -#define _ASM_GPIO_REGS - -#define __reg(ADDR) (*(volatile unsigned long *)(ADDR)) - -#define __get_PDR() ({ __reg(0xfeff0400); }) -#define __set_PDR(V) do { __reg(0xfeff0400) = (V); mb(); } while(0) - -#define __get_GPDR() ({ __reg(0xfeff0408); }) -#define __set_GPDR(V) do { __reg(0xfeff0408) = (V); mb(); } while(0) - -#define __get_SIR() ({ __reg(0xfeff0410); }) -#define __set_SIR(V) do { __reg(0xfeff0410) = (V); mb(); } while(0) - -#define __get_SOR() ({ __reg(0xfeff0418); }) -#define __set_SOR(V) do { __reg(0xfeff0418) = (V); mb(); } while(0) - -#define __set_PDSR(V) do { __reg(0xfeff0420) = (V); mb(); } while(0) - -#define __set_PDCR(V) do { __reg(0xfeff0428) = (V); mb(); } while(0) - -#define __get_RSTR() ({ __reg(0xfeff0500); }) -#define __set_RSTR(V) do { __reg(0xfeff0500) = (V); mb(); } while(0) - - - -/* PDR definitions */ -#define PDR_GPIO_DATA(X) (1 << (X)) - -/* GPDR definitions */ -#define GPDR_INPUT 0 -#define GPDR_OUTPUT 1 -#define GPDR_DREQ0_BIT 0x00001000 -#define GPDR_DREQ1_BIT 0x00008000 -#define GPDR_DREQ2_BIT 0x00040000 -#define GPDR_DREQ3_BIT 0x00080000 -#define GPDR_DREQ4_BIT 0x00004000 -#define GPDR_DREQ5_BIT 0x00020000 -#define GPDR_DREQ6_BIT 0x00100000 -#define GPDR_DREQ7_BIT 0x00200000 -#define GPDR_DACK0_BIT 0x00002000 -#define GPDR_DACK1_BIT 0x00010000 -#define GPDR_DACK2_BIT 0x00100000 -#define GPDR_DACK3_BIT 0x00200000 -#define GPDR_DONE0_BIT 0x00004000 -#define GPDR_DONE1_BIT 0x00020000 -#define GPDR_GPIO_DIR(X,D) ((D) << (X)) - -/* SIR definitions */ -#define SIR_GPIO_INPUT 0 -#define SIR_DREQ7_INPUT 0x00200000 -#define SIR_DREQ6_INPUT 0x00100000 -#define SIR_DREQ3_INPUT 0x00080000 -#define SIR_DREQ2_INPUT 0x00040000 -#define SIR_DREQ5_INPUT 0x00020000 -#define SIR_DREQ1_INPUT 0x00008000 -#define SIR_DREQ4_INPUT 0x00004000 -#define SIR_DREQ0_INPUT 0x00001000 -#define SIR_RXD1_INPUT 0x00000400 -#define SIR_CTS0_INPUT 0x00000100 -#define SIR_RXD0_INPUT 0x00000040 -#define SIR_GATE1_INPUT 0x00000020 -#define SIR_GATE0_INPUT 0x00000010 -#define SIR_IRQ3_INPUT 0x00000008 -#define SIR_IRQ2_INPUT 0x00000004 -#define SIR_IRQ1_INPUT 0x00000002 -#define SIR_IRQ0_INPUT 0x00000001 -#define SIR_DREQ_BITS (SIR_DREQ0_INPUT | SIR_DREQ1_INPUT | \ - SIR_DREQ2_INPUT | SIR_DREQ3_INPUT | \ - SIR_DREQ4_INPUT | SIR_DREQ5_INPUT | \ - SIR_DREQ6_INPUT | SIR_DREQ7_INPUT) - -/* SOR definitions */ -#define SOR_GPIO_OUTPUT 0 -#define SOR_DACK3_OUTPUT 0x00200000 -#define SOR_DACK2_OUTPUT 0x00100000 -#define SOR_DONE1_OUTPUT 0x00020000 -#define SOR_DACK1_OUTPUT 0x00010000 -#define SOR_DONE0_OUTPUT 0x00004000 -#define SOR_DACK0_OUTPUT 0x00002000 -#define SOR_TXD1_OUTPUT 0x00000800 -#define SOR_RTS0_OUTPUT 0x00000200 -#define SOR_TXD0_OUTPUT 0x00000080 -#define SOR_TOUT1_OUTPUT 0x00000020 -#define SOR_TOUT0_OUTPUT 0x00000010 -#define SOR_DONE_BITS (SOR_DONE0_OUTPUT | SOR_DONE1_OUTPUT) -#define SOR_DACK_BITS (SOR_DACK0_OUTPUT | SOR_DACK1_OUTPUT | \ - SOR_DACK2_OUTPUT | SOR_DACK3_OUTPUT) - -/* PDSR definitions */ -#define PDSR_UNCHANGED 0 -#define PDSR_SET_BIT(X) (1 << (X)) - -/* PDCR definitions */ -#define PDCR_UNCHANGED 0 -#define PDCR_CLEAR_BIT(X) (1 << (X)) - -/* RSTR definitions */ -/* Read Only */ -#define RSTR_POWERON 0x00000400 -#define RSTR_SOFTRESET_STATUS 0x00000100 -/* Write Only */ -#define RSTR_SOFTRESET 0x00000001 - -#endif /* _ASM_GPIO_REGS */ diff --git a/arch/frv/include/asm/hardirq.h b/arch/frv/include/asm/hardirq.h deleted file mode 100644 index c62833d6ebbb8..0000000000000 --- a/arch/frv/include/asm/hardirq.h +++ /dev/null @@ -1,26 +0,0 @@ -/* hardirq.h: FRV hardware IRQ management - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#ifndef __ASM_HARDIRQ_H -#define __ASM_HARDIRQ_H - -#include - -extern atomic_t irq_err_count; -static inline void ack_bad_irq(int irq) -{ - atomic_inc(&irq_err_count); -} -#define ack_bad_irq ack_bad_irq - -#include - -#endif diff --git a/arch/frv/include/asm/highmem.h b/arch/frv/include/asm/highmem.h deleted file mode 100644 index 1f58938703ab6..0000000000000 --- a/arch/frv/include/asm/highmem.h +++ /dev/null @@ -1,149 +0,0 @@ -/* highmem.h: virtual kernel memory mappings for high memory - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - Derived from include/asm-i386/highmem.h - * - * See Documentation/frv/mmu-layout.txt for more information. - * - * 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_HIGHMEM_H -#define _ASM_HIGHMEM_H - -#ifdef __KERNEL__ - -#include -#include -#include -#include -#include - -#define NR_TLB_LINES 64 /* number of lines in the TLB */ - -#ifndef __ASSEMBLY__ - -#include -#include -#include - -#ifdef CONFIG_DEBUG_HIGHMEM -#define HIGHMEM_DEBUG 1 -#else -#define HIGHMEM_DEBUG 0 -#endif - -/* declarations for highmem.c */ -extern unsigned long highstart_pfn, highend_pfn; - -#define kmap_prot PAGE_KERNEL -#define kmap_pte ______kmap_pte_in_TLB -extern pte_t *pkmap_page_table; - -#define flush_cache_kmaps() do { } while (0) - -/* - * Right now we initialize only a single pte table. It can be extended - * easily, subsequent pte tables have to be allocated in one physical - * chunk of RAM. - */ -#define LAST_PKMAP PTRS_PER_PTE -#define LAST_PKMAP_MASK (LAST_PKMAP - 1) -#define PKMAP_NR(virt) ((virt - PKMAP_BASE) >> PAGE_SHIFT) -#define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT)) - -extern void *kmap_high(struct page *page); -extern void kunmap_high(struct page *page); - -extern void *kmap(struct page *page); -extern void kunmap(struct page *page); - -#endif /* !__ASSEMBLY__ */ - -/* - * The use of kmap_atomic/kunmap_atomic is discouraged - kmap/kunmap - * gives a more generic (and caching) interface. But kmap_atomic can - * be used in IRQ contexts, so in some (very limited) cases we need - * it. - */ -#define KMAP_ATOMIC_CACHE_DAMR 8 - -#ifndef __ASSEMBLY__ - -#define __kmap_atomic_primary(cached, paddr, ampr) \ -({ \ - unsigned long damlr, dampr; \ - \ - dampr = paddr | xAMPRx_L | xAMPRx_M | xAMPRx_S | xAMPRx_SS_16Kb | xAMPRx_V; \ - \ - if (!cached) \ - asm volatile("movgs %0,dampr"#ampr :: "r"(dampr) : "memory"); \ - else \ - /* cache flush page attachment point */ \ - asm volatile("movgs %0,iampr"#ampr"\n" \ - "movgs %0,dampr"#ampr"\n" \ - :: "r"(dampr) : "memory" \ - ); \ - \ - asm("movsg damlr"#ampr",%0" : "=r"(damlr)); \ - \ - /*printk("DAMR"#ampr": PRIM sl=%d L=%08lx P=%08lx\n", type, damlr, dampr);*/ \ - \ - (void *) damlr; \ -}) - -#define __kmap_atomic_secondary(slot, paddr) \ -({ \ - unsigned long damlr = KMAP_ATOMIC_SECONDARY_FRAME + (slot) * PAGE_SIZE; \ - unsigned long dampr = paddr | xAMPRx_L | xAMPRx_M | xAMPRx_S | xAMPRx_SS_16Kb | xAMPRx_V; \ - \ - asm volatile("movgs %0,tplr \n" \ - "movgs %1,tppr \n" \ - "tlbpr %0,gr0,#2,#1" \ - : : "r"(damlr), "r"(dampr) : "memory"); \ - \ - /*printk("TLB: SECN sl=%d L=%08lx P=%08lx\n", slot, damlr, dampr);*/ \ - \ - (void *) damlr; \ -}) - -static inline void *kmap_atomic_primary(struct page *page) -{ - unsigned long paddr; - - pagefault_disable(); - paddr = page_to_phys(page); - - return __kmap_atomic_primary(1, paddr, 2); -} - -#define __kunmap_atomic_primary(cached, ampr) \ -do { \ - asm volatile("movgs gr0,dampr"#ampr"\n" ::: "memory"); \ - if (cached) \ - asm volatile("movgs gr0,iampr"#ampr"\n" ::: "memory"); \ -} while(0) - -#define __kunmap_atomic_secondary(slot, vaddr) \ -do { \ - asm volatile("tlbpr %0,gr0,#4,#1" : : "r"(vaddr) : "memory"); \ -} while(0) - -static inline void kunmap_atomic_primary(void *kvaddr) -{ - __kunmap_atomic_primary(1, 2); - pagefault_enable(); -} - -void *kmap_atomic(struct page *page); -void __kunmap_atomic(void *kvaddr); - -#endif /* !__ASSEMBLY__ */ - -#endif /* __KERNEL__ */ - -#endif /* _ASM_HIGHMEM_H */ diff --git a/arch/frv/include/asm/hw_irq.h b/arch/frv/include/asm/hw_irq.h deleted file mode 100644 index 522ad37923d8f..0000000000000 --- a/arch/frv/include/asm/hw_irq.h +++ /dev/null @@ -1,16 +0,0 @@ -/* hw_irq.h: FR-V specific h/w IRQ stuff - * - * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#ifndef _ASM_HW_IRQ_H -#define _ASM_HW_IRQ_H - - -#endif /* _ASM_HW_IRQ_H */ diff --git a/arch/frv/include/asm/io.h b/arch/frv/include/asm/io.h deleted file mode 100644 index 8062fc73fad02..0000000000000 --- a/arch/frv/include/asm/io.h +++ /dev/null @@ -1,414 +0,0 @@ -/* io.h: FRV I/O operations - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - * - * This gets interesting when talking to the PCI bus - the CPU is in big endian - * mode, the PCI bus is little endian and the hardware in the middle can do - * byte swapping - */ -#ifndef _ASM_IO_H -#define _ASM_IO_H - -#ifdef __KERNEL__ - -#define ARCH_HAS_IOREMAP_WT - -#include -#include -#include -#include -#include -#include - -/* - * swap functions are sometimes needed to interface little-endian hardware - */ - -static inline unsigned short _swapw(unsigned short v) -{ - return ((v << 8) | (v >> 8)); -} - -static inline unsigned long _swapl(unsigned long v) -{ - return ((v << 24) | ((v & 0xff00) << 8) | ((v & 0xff0000) >> 8) | (v >> 24)); -} - -//#define __iormb() asm volatile("membar") -//#define __iowmb() asm volatile("membar") - -static inline u8 __raw_readb(const volatile void __iomem *addr) -{ - return __builtin_read8((volatile void __iomem *)addr); -} - -static inline u16 __raw_readw(const volatile void __iomem *addr) -{ - return __builtin_read16((volatile void __iomem *)addr); -} - -static inline u32 __raw_readl(const volatile void __iomem *addr) -{ - return __builtin_read32((volatile void __iomem *)addr); -} - -#define __raw_writeb(datum, addr) __builtin_write8(addr, datum) -#define __raw_writew(datum, addr) __builtin_write16(addr, datum) -#define __raw_writel(datum, addr) __builtin_write32(addr, datum) - -static inline void io_outsb(unsigned int addr, const void *buf, int len) -{ - unsigned long __ioaddr = (unsigned long) addr; - const uint8_t *bp = buf; - - while (len--) - __builtin_write8((volatile void __iomem *) __ioaddr, *bp++); -} - -static inline void io_outsw(unsigned int addr, const void *buf, int len) -{ - unsigned long __ioaddr = (unsigned long) addr; - const uint16_t *bp = buf; - - while (len--) - __builtin_write16((volatile void __iomem *) __ioaddr, (*bp++)); -} - -extern void __outsl_ns(unsigned int addr, const void *buf, int len); -extern void __outsl_sw(unsigned int addr, const void *buf, int len); -static inline void __outsl(unsigned int addr, const void *buf, int len, int swap) -{ - unsigned long __ioaddr = (unsigned long) addr; - - if (!swap) - __outsl_ns(__ioaddr, buf, len); - else - __outsl_sw(__ioaddr, buf, len); -} - -static inline void io_insb(unsigned long addr, void *buf, int len) -{ - uint8_t *bp = buf; - - while (len--) - *bp++ = __builtin_read8((volatile void __iomem *) addr); -} - -static inline void io_insw(unsigned long addr, void *buf, int len) -{ - uint16_t *bp = buf; - - while (len--) - *bp++ = __builtin_read16((volatile void __iomem *) addr); -} - -extern void __insl_ns(unsigned long addr, void *buf, int len); -extern void __insl_sw(unsigned long addr, void *buf, int len); -static inline void __insl(unsigned long addr, void *buf, int len, int swap) -{ - if (!swap) - __insl_ns(addr, buf, len); - else - __insl_sw(addr, buf, len); -} - -#define mmiowb() mb() - -/* - * make the short names macros so specific devices - * can override them as required - */ - -static inline void memset_io(volatile void __iomem *addr, unsigned char val, int count) -{ - memset((void __force *) addr, val, count); -} - -static inline void memcpy_fromio(void *dst, const volatile void __iomem *src, int count) -{ - memcpy(dst, (void __force *) src, count); -} - -static inline void memcpy_toio(volatile void __iomem *dst, const void *src, int count) -{ - memcpy((void __force *) dst, src, count); -} - -static inline uint8_t inb(unsigned long addr) -{ - return __builtin_read8((void __iomem *)addr); -} - -static inline uint16_t inw(unsigned long addr) -{ - uint16_t ret = __builtin_read16((void __iomem *)addr); - - if (__is_PCI_IO(addr)) - ret = _swapw(ret); - - return ret; -} - -static inline uint32_t inl(unsigned long addr) -{ - uint32_t ret = __builtin_read32((void __iomem *)addr); - - if (__is_PCI_IO(addr)) - ret = _swapl(ret); - - return ret; -} - -static inline void outb(uint8_t datum, unsigned long addr) -{ - __builtin_write8((void __iomem *)addr, datum); -} - -static inline void outw(uint16_t datum, unsigned long addr) -{ - if (__is_PCI_IO(addr)) - datum = _swapw(datum); - __builtin_write16((void __iomem *)addr, datum); -} - -static inline void outl(uint32_t datum, unsigned long addr) -{ - if (__is_PCI_IO(addr)) - datum = _swapl(datum); - __builtin_write32((void __iomem *)addr, datum); -} - -#define inb_p(addr) inb(addr) -#define inw_p(addr) inw(addr) -#define inl_p(addr) inl(addr) -#define outb_p(x,addr) outb(x,addr) -#define outw_p(x,addr) outw(x,addr) -#define outl_p(x,addr) outl(x,addr) - -#define outsb(a,b,l) io_outsb(a,b,l) -#define outsw(a,b,l) io_outsw(a,b,l) -#define outsl(a,b,l) __outsl(a,b,l,0) - -#define insb(a,b,l) io_insb(a,b,l) -#define insw(a,b,l) io_insw(a,b,l) -#define insl(a,b,l) __insl(a,b,l,0) - -#define IO_SPACE_LIMIT 0xffffffff - -static inline uint8_t readb(const volatile void __iomem *addr) -{ - return __builtin_read8((__force void volatile __iomem *) addr); -} - -static inline uint16_t readw(const volatile void __iomem *addr) -{ - uint16_t ret = __builtin_read16((__force void volatile __iomem *)addr); - - if (__is_PCI_MEM(addr)) - ret = _swapw(ret); - return ret; -} - -static inline uint32_t readl(const volatile void __iomem *addr) -{ - uint32_t ret = __builtin_read32((__force void volatile __iomem *)addr); - - if (__is_PCI_MEM(addr)) - ret = _swapl(ret); - - return ret; -} - -#define readb_relaxed readb -#define readw_relaxed readw -#define readl_relaxed readl - -static inline void writeb(uint8_t datum, volatile void __iomem *addr) -{ - __builtin_write8(addr, datum); - if (__is_PCI_MEM(addr)) - __flush_PCI_writes(); -} - -static inline void writew(uint16_t datum, volatile void __iomem *addr) -{ - if (__is_PCI_MEM(addr)) - datum = _swapw(datum); - - __builtin_write16(addr, datum); - if (__is_PCI_MEM(addr)) - __flush_PCI_writes(); -} - -static inline void writel(uint32_t datum, volatile void __iomem *addr) -{ - if (__is_PCI_MEM(addr)) - datum = _swapl(datum); - - __builtin_write32(addr, datum); - if (__is_PCI_MEM(addr)) - __flush_PCI_writes(); -} - -#define writeb_relaxed writeb -#define writew_relaxed writew -#define writel_relaxed writel - -/* Values for nocacheflag and cmode */ -#define IOMAP_FULL_CACHING 0 -#define IOMAP_NOCACHE_SER 1 -#define IOMAP_NOCACHE_NONSER 2 -#define IOMAP_WRITETHROUGH 3 - -extern void __iomem *__ioremap(unsigned long physaddr, unsigned long size, int cacheflag); - -static inline void __iomem *ioremap(unsigned long physaddr, unsigned long size) -{ - return __ioremap(physaddr, size, IOMAP_NOCACHE_SER); -} - -static inline void __iomem *ioremap_nocache(unsigned long physaddr, unsigned long size) -{ - return __ioremap(physaddr, size, IOMAP_NOCACHE_SER); -} - -static inline void __iomem *ioremap_wt(unsigned long physaddr, unsigned long size) -{ - return __ioremap(physaddr, size, IOMAP_WRITETHROUGH); -} - -static inline void __iomem *ioremap_fullcache(unsigned long physaddr, unsigned long size) -{ - return __ioremap(physaddr, size, IOMAP_FULL_CACHING); -} - -#define ioremap_wc ioremap_nocache -#define ioremap_uc ioremap_nocache - -extern void iounmap(void volatile __iomem *addr); - -static inline void __iomem *ioport_map(unsigned long port, unsigned int nr) -{ - return (void __iomem *) port; -} - -static inline void ioport_unmap(void __iomem *p) -{ -} - -static inline void flush_write_buffers(void) -{ - __asm__ __volatile__ ("membar" : : :"memory"); -} - -/* - * do appropriate I/O accesses for token type - */ -static inline unsigned int ioread8(void __iomem *p) -{ - return __builtin_read8(p); -} - -static inline unsigned int ioread16(void __iomem *p) -{ - uint16_t ret = __builtin_read16(p); - if (__is_PCI_addr(p)) - ret = _swapw(ret); - return ret; -} - -static inline unsigned int ioread32(void __iomem *p) -{ - uint32_t ret = __builtin_read32(p); - if (__is_PCI_addr(p)) - ret = _swapl(ret); - return ret; -} - -static inline void iowrite8(u8 val, void __iomem *p) -{ - __builtin_write8(p, val); - if (__is_PCI_MEM(p)) - __flush_PCI_writes(); -} - -static inline void iowrite16(u16 val, void __iomem *p) -{ - if (__is_PCI_addr(p)) - val = _swapw(val); - __builtin_write16(p, val); - if (__is_PCI_MEM(p)) - __flush_PCI_writes(); -} - -static inline void iowrite32(u32 val, void __iomem *p) -{ - if (__is_PCI_addr(p)) - val = _swapl(val); - __builtin_write32(p, val); - if (__is_PCI_MEM(p)) - __flush_PCI_writes(); -} - -#define ioread16be(addr) be16_to_cpu(ioread16(addr)) -#define ioread32be(addr) be32_to_cpu(ioread32(addr)) -#define iowrite16be(v, addr) iowrite16(cpu_to_be16(v), (addr)) -#define iowrite32be(v, addr) iowrite32(cpu_to_be32(v), (addr)) - -static inline void ioread8_rep(void __iomem *p, void *dst, unsigned long count) -{ - io_insb((unsigned long) p, dst, count); -} - -static inline void ioread16_rep(void __iomem *p, void *dst, unsigned long count) -{ - io_insw((unsigned long) p, dst, count); -} - -static inline void ioread32_rep(void __iomem *p, void *dst, unsigned long count) -{ - __insl_ns((unsigned long) p, dst, count); -} - -static inline void iowrite8_rep(void __iomem *p, const void *src, unsigned long count) -{ - io_outsb((unsigned long) p, src, count); -} - -static inline void iowrite16_rep(void __iomem *p, const void *src, unsigned long count) -{ - io_outsw((unsigned long) p, src, count); -} - -static inline void iowrite32_rep(void __iomem *p, const void *src, unsigned long count) -{ - __outsl_ns((unsigned long) p, src, count); -} - -/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ -struct pci_dev; -static inline void pci_iounmap(struct pci_dev *dev, void __iomem *p) -{ -} - - -/* - * 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 - -#endif /* __KERNEL__ */ - -#endif /* _ASM_IO_H */ diff --git a/arch/frv/include/asm/irc-regs.h b/arch/frv/include/asm/irc-regs.h deleted file mode 100644 index afa30aeacc822..0000000000000 --- a/arch/frv/include/asm/irc-regs.h +++ /dev/null @@ -1,53 +0,0 @@ -/* irc-regs.h: on-chip interrupt controller registers - * - * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#ifndef _ASM_IRC_REGS -#define _ASM_IRC_REGS - -#define __reg(ADDR) (*(volatile unsigned long *)(ADDR)) - -#define __get_TM0() ({ __reg(0xfeff9800); }) -#define __get_TM1() ({ __reg(0xfeff9808); }) -#define __set_TM1(V) do { __reg(0xfeff9808) = (V); mb(); } while(0) - -#define __set_TM1x(XI,V) \ -do { \ - int shift = (XI) * 2 + 16; \ - unsigned long tm1 = __reg(0xfeff9808); \ - tm1 &= ~(0x3 << shift); \ - tm1 |= (V) << shift; \ - __reg(0xfeff9808) = tm1; \ - mb(); \ -} while(0) - -#define __get_RS(C) ({ (__reg(0xfeff9810) >> ((C)+16)) & 1; }) - -#define __clr_RC(C) do { __reg(0xfeff9818) = 1 << ((C)+16); mb(); } while(0) - -#define __get_MASK(C) ({ (__reg(0xfeff9820) >> ((C)+16)) & 1; }) -#define __set_MASK(C) do { __reg(0xfeff9820) |= 1 << ((C)+16); mb(); } while(0) -#define __clr_MASK(C) do { __reg(0xfeff9820) &= ~(1 << ((C)+16)); mb(); } while(0) - -#define __get_MASK_all() __get_MASK(0) -#define __set_MASK_all() __set_MASK(0) -#define __clr_MASK_all() __clr_MASK(0) - -#define __get_IRL() ({ (__reg(0xfeff9828) >> 16) & 0xf; }) -#define __clr_IRL() do { __reg(0xfeff9828) = 0x100000; mb(); } while(0) - -#define __get_IRR(N) ({ __reg(0xfeff9840 + (N) * 8); }) -#define __set_IRR(N,V) do { __reg(0xfeff9840 + (N) * 8) = (V); } while(0) - -#define __get_IITMR(N) ({ __reg(0xfeff9880 + (N) * 8); }) -#define __set_IITMR(N,V) do { __reg(0xfeff9880 + (N) * 8) = (V); } while(0) - - -#endif /* _ASM_IRC_REGS */ diff --git a/arch/frv/include/asm/irq.h b/arch/frv/include/asm/irq.h deleted file mode 100644 index 3a66ebd754bd0..0000000000000 --- a/arch/frv/include/asm/irq.h +++ /dev/null @@ -1,30 +0,0 @@ -/* irq.h: FRV IRQ definitions - * - * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#ifndef _ASM_IRQ_H_ -#define _ASM_IRQ_H_ - -#define NR_IRQS 48 -#define IRQ_BASE_CPU (0 * 16) -#define IRQ_BASE_FPGA (1 * 16) -#define IRQ_BASE_MB93493 (2 * 16) - -/* probe returns a 32-bit IRQ mask:-/ */ -#define MIN_PROBE_IRQ (NR_IRQS - 32) - -#ifndef __ASSEMBLY__ -static inline int irq_canonicalize(int irq) -{ - return irq; -} -#endif - -#endif /* _ASM_IRQ_H_ */ diff --git a/arch/frv/include/asm/irq_regs.h b/arch/frv/include/asm/irq_regs.h deleted file mode 100644 index d22e83289ad15..0000000000000 --- a/arch/frv/include/asm/irq_regs.h +++ /dev/null @@ -1,27 +0,0 @@ -/* FRV per-CPU frame pointer holder - * - * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#ifndef _ASM_IRQ_REGS_H -#define _ASM_IRQ_REGS_H - -/* - * Per-cpu current frame pointer - the location of the last exception frame on - * the stack - * - on FRV, GR28 is dedicated to keeping a pointer to the current exception - * frame - */ -#define ARCH_HAS_OWN_IRQ_REGS - -#ifndef __ASSEMBLY__ -#define get_irq_regs() (__frame) -#endif - -#endif /* _ASM_IRQ_REGS_H */ diff --git a/arch/frv/include/asm/irqflags.h b/arch/frv/include/asm/irqflags.h deleted file mode 100644 index 82f0b5363f423..0000000000000 --- a/arch/frv/include/asm/irqflags.h +++ /dev/null @@ -1,158 +0,0 @@ -/* FR-V interrupt handling - * - * Copyright (C) 2010 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - -#ifndef _ASM_IRQFLAGS_H -#define _ASM_IRQFLAGS_H - -/* - * interrupt flag manipulation - * - use virtual interrupt management since touching the PSR is slow - * - ICC2.Z: T if interrupts virtually disabled - * - ICC2.C: F if interrupts really disabled - * - if Z==1 upon interrupt: - * - C is set to 0 - * - interrupts are really disabled - * - entry.S returns immediately - * - uses TIHI (TRAP if Z==0 && C==0) #2 to really reenable interrupts - * - if taken, the trap: - * - sets ICC2.C - * - enables interrupts - */ -static inline void arch_local_irq_disable(void) -{ - /* set Z flag, but don't change the C flag */ - asm volatile(" andcc gr0,gr0,gr0,icc2 \n" - : - : - : "memory", "icc2" - ); -} - -static inline void arch_local_irq_enable(void) -{ - /* clear Z flag and then test the C flag */ - asm volatile(" oricc gr0,#1,gr0,icc2 \n" - " tihi icc2,gr0,#2 \n" - : - : - : "memory", "icc2" - ); -} - -static inline unsigned long arch_local_save_flags(void) -{ - unsigned long flags; - - asm volatile("movsg ccr,%0" - : "=r"(flags) - : - : "memory"); - - /* shift ICC2.Z to bit 0 */ - flags >>= 26; - - /* make flags 1 if interrupts disabled, 0 otherwise */ - return flags & 1UL; - -} - -static inline unsigned long arch_local_irq_save(void) -{ - unsigned long flags = arch_local_save_flags(); - arch_local_irq_disable(); - return flags; -} - -static inline void arch_local_irq_restore(unsigned long flags) -{ - /* load the Z flag by turning 1 if disabled into 0 if disabled - * and thus setting the Z flag but not the C flag */ - asm volatile(" xoricc %0,#1,gr0,icc2 \n" - /* then trap if Z=0 and C=0 */ - " tihi icc2,gr0,#2 \n" - : - : "r"(flags) - : "memory", "icc2" - ); - -} - -static inline bool arch_irqs_disabled_flags(unsigned long flags) -{ - return flags; -} - -static inline bool arch_irqs_disabled(void) -{ - return arch_irqs_disabled_flags(arch_local_save_flags()); -} - -/* - * real interrupt flag manipulation - */ -#define __arch_local_irq_disable() \ -do { \ - unsigned long psr; \ - asm volatile(" movsg psr,%0 \n" \ - " andi %0,%2,%0 \n" \ - " ori %0,%1,%0 \n" \ - " movgs %0,psr \n" \ - : "=r"(psr) \ - : "i" (PSR_PIL_14), "i" (~PSR_PIL) \ - : "memory"); \ -} while (0) - -#define __arch_local_irq_enable() \ -do { \ - unsigned long psr; \ - asm volatile(" movsg psr,%0 \n" \ - " andi %0,%1,%0 \n" \ - " movgs %0,psr \n" \ - : "=r"(psr) \ - : "i" (~PSR_PIL) \ - : "memory"); \ -} while (0) - -#define __arch_local_save_flags(flags) \ -do { \ - typecheck(unsigned long, flags); \ - asm("movsg psr,%0" \ - : "=r"(flags) \ - : \ - : "memory"); \ -} while (0) - -#define __arch_local_irq_save(flags) \ -do { \ - unsigned long npsr; \ - typecheck(unsigned long, flags); \ - asm volatile(" movsg psr,%0 \n" \ - " andi %0,%3,%1 \n" \ - " ori %1,%2,%1 \n" \ - " movgs %1,psr \n" \ - : "=r"(flags), "=r"(npsr) \ - : "i" (PSR_PIL_14), "i" (~PSR_PIL) \ - : "memory"); \ -} while (0) - -#define __arch_local_irq_restore(flags) \ -do { \ - typecheck(unsigned long, flags); \ - asm volatile(" movgs %0,psr \n" \ - : \ - : "r" (flags) \ - : "memory"); \ -} while (0) - -#define __arch_irqs_disabled() \ - ((__get_PSR() & PSR_PIL) >= PSR_PIL_14) - -#endif /* _ASM_IRQFLAGS_H */ diff --git a/arch/frv/include/asm/kdebug.h b/arch/frv/include/asm/kdebug.h deleted file mode 100644 index 6ece1b0376655..0000000000000 --- a/arch/frv/include/asm/kdebug.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/arch/frv/include/asm/kmap_types.h b/arch/frv/include/asm/kmap_types.h deleted file mode 100644 index 0849db1362d67..0000000000000 --- a/arch/frv/include/asm/kmap_types.h +++ /dev/null @@ -1,8 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ - -#ifndef _ASM_KMAP_TYPES_H -#define _ASM_KMAP_TYPES_H - -#define KM_TYPE_NR 17 - -#endif diff --git a/arch/frv/include/asm/linkage.h b/arch/frv/include/asm/linkage.h deleted file mode 100644 index 636c1bced7d4a..0000000000000 --- a/arch/frv/include/asm/linkage.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef __ASM_LINKAGE_H -#define __ASM_LINKAGE_H - -#define __ALIGN .align 4 -#define __ALIGN_STR ".align 4" - -#endif diff --git a/arch/frv/include/asm/local.h b/arch/frv/include/asm/local.h deleted file mode 100644 index 259ae7b041a78..0000000000000 --- a/arch/frv/include/asm/local.h +++ /dev/null @@ -1,7 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_LOCAL_H -#define _ASM_LOCAL_H - -#include - -#endif /* _ASM_LOCAL_H */ diff --git a/arch/frv/include/asm/local64.h b/arch/frv/include/asm/local64.h deleted file mode 100644 index 36c93b5cc239b..0000000000000 --- a/arch/frv/include/asm/local64.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/arch/frv/include/asm/math-emu.h b/arch/frv/include/asm/math-emu.h deleted file mode 100644 index 8af762dd61093..0000000000000 --- a/arch/frv/include/asm/math-emu.h +++ /dev/null @@ -1,302 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_MATH_EMU_H -#define _ASM_MATH_EMU_H - -#include -#include - -/* Status Register bits */ - -/* accrued exception bits */ -#define FPSR_AEXC_INEX 3 -#define FPSR_AEXC_DZ 4 -#define FPSR_AEXC_UNFL 5 -#define FPSR_AEXC_OVFL 6 -#define FPSR_AEXC_IOP 7 - -/* exception status bits */ -#define FPSR_EXC_INEX1 8 -#define FPSR_EXC_INEX2 9 -#define FPSR_EXC_DZ 10 -#define FPSR_EXC_UNFL 11 -#define FPSR_EXC_OVFL 12 -#define FPSR_EXC_OPERR 13 -#define FPSR_EXC_SNAN 14 -#define FPSR_EXC_BSUN 15 - -/* quotient byte, assumes big-endian, of course */ -#define FPSR_QUOTIENT(fpsr) (*((signed char *) &(fpsr) + 1)) - -/* condition code bits */ -#define FPSR_CC_NAN 24 -#define FPSR_CC_INF 25 -#define FPSR_CC_Z 26 -#define FPSR_CC_NEG 27 - - -/* Control register bits */ - -/* rounding mode */ -#define FPCR_ROUND_RN 0 /* round to nearest/even */ -#define FPCR_ROUND_RZ 1 /* round to zero */ -#define FPCR_ROUND_RM 2 /* minus infinity */ -#define FPCR_ROUND_RP 3 /* plus infinity */ - -/* rounding precision */ -#define FPCR_PRECISION_X 0 /* long double */ -#define FPCR_PRECISION_S 1 /* double */ -#define FPCR_PRECISION_D 2 /* float */ - - -/* Flags to select the debugging output */ -#define PDECODE 0 -#define PEXECUTE 1 -#define PCONV 2 -#define PNORM 3 -#define PREGISTER 4 -#define PINSTR 5 -#define PUNIMPL 6 -#define PMOVEM 7 - -#define PMDECODE (1< -#include - -union fp_mant64 { - unsigned long long m64; - unsigned long m32[2]; -}; - -union fp_mant128 { - unsigned long long m64[2]; - unsigned long m32[4]; -}; - -/* internal representation of extended fp numbers */ -struct fp_ext { - unsigned char lowmant; - unsigned char sign; - unsigned short exp; - union fp_mant64 mant; -}; - -/* C representation of FPU registers */ -/* NOTE: if you change this, you have to change the assembler offsets - below and the size in , too */ -struct fp_data { - struct fp_ext fpreg[8]; - unsigned int fpcr; - unsigned int fpsr; - unsigned int fpiar; - unsigned short prec; - unsigned short rnd; - struct fp_ext temp[2]; -}; - -#if FPU_EMU_DEBUG -extern unsigned int fp_debugprint; - -#define dprint(bit, fmt, args...) ({ \ - if (fp_debugprint & (1 << (bit))) \ - printk(fmt, ## args); \ -}) -#else -#define dprint(bit, fmt, args...) -#endif - -#define uprint(str) ({ \ - static int __count = 3; \ - \ - if (__count > 0) { \ - printk("You just hit an unimplemented " \ - "fpu instruction (%s)\n", str); \ - printk("Please report this to ....\n"); \ - __count--; \ - } \ -}) - -#define FPDATA ((struct fp_data *)current->thread.fp) - -#else /* __ASSEMBLY__ */ - -#define FPDATA %a2 - -/* offsets from the base register to the floating point data in the task struct */ -#define FPD_FPREG (TASK_THREAD+THREAD_FPREG+0) -#define FPD_FPCR (TASK_THREAD+THREAD_FPREG+96) -#define FPD_FPSR (TASK_THREAD+THREAD_FPREG+100) -#define FPD_FPIAR (TASK_THREAD+THREAD_FPREG+104) -#define FPD_PREC (TASK_THREAD+THREAD_FPREG+108) -#define FPD_RND (TASK_THREAD+THREAD_FPREG+110) -#define FPD_TEMPFP1 (TASK_THREAD+THREAD_FPREG+112) -#define FPD_TEMPFP2 (TASK_THREAD+THREAD_FPREG+124) -#define FPD_SIZEOF (TASK_THREAD+THREAD_FPREG+136) - -/* offsets on the stack to access saved registers, - * these are only used during instruction decoding - * where we always know how deep we're on the stack. - */ -#define FPS_DO (PT_D0) -#define FPS_D1 (PT_D1) -#define FPS_D2 (PT_D2) -#define FPS_A0 (PT_A0) -#define FPS_A1 (PT_A1) -#define FPS_A2 (PT_A2) -#define FPS_SR (PT_SR) -#define FPS_PC (PT_PC) -#define FPS_EA (PT_PC+6) -#define FPS_PC2 (PT_PC+10) - -.macro fp_get_fp_reg - lea (FPD_FPREG,FPDATA,%d0.w*4),%a0 - lea (%a0,%d0.w*8),%a0 -.endm - -/* Macros used to get/put the current program counter. - * 020/030 use a different stack frame then 040/060, for the - * 040/060 the return pc points already to the next location, - * so this only needs to be modified for jump instructions. - */ -.macro fp_get_pc dest - move.l (FPS_PC+4,%sp),\dest -.endm - -.macro fp_put_pc src,jump=0 - move.l \src,(FPS_PC+4,%sp) -.endm - -.macro fp_get_instr_data f,s,dest,label - getuser \f,%sp@(FPS_PC+4)@(0),\dest,\label,%sp@(FPS_PC+4) - addq.l #\s,%sp@(FPS_PC+4) -.endm - -.macro fp_get_instr_word dest,label,addr - fp_get_instr_data w,2,\dest,\label,\addr -.endm - -.macro fp_get_instr_long dest,label,addr - fp_get_instr_data l,4,\dest,\label,\addr -.endm - -/* These macros are used to read from/write to user space - * on error we jump to the fixup section, load the fault - * address into %a0 and jump to the exit. - * (derived from ) - */ -.macro getuser size,src,dest,label,addr -| printf ,"[\size<%08x]",1,\addr -.Lu1\@: moves\size \src,\dest - - .section .fixup,"ax" - .even -.Lu2\@: move.l \addr,%a0 - jra \label - .previous - - .section __ex_table,"a" - .align 4 - .long .Lu1\@,.Lu2\@ - .previous -.endm - -.macro putuser size,src,dest,label,addr -| printf ,"[\size>%08x]",1,\addr -.Lu1\@: moves\size \src,\dest -.Lu2\@: - - .section .fixup,"ax" - .even -.Lu3\@: move.l \addr,%a0 - jra \label - .previous - - .section __ex_table,"a" - .align 4 - .long .Lu1\@,.Lu3\@ - .long .Lu2\@,.Lu3\@ - .previous -.endm - - -.macro movestack nr,arg1,arg2,arg3,arg4,arg5 - .if \nr - movestack (\nr-1),\arg2,\arg3,\arg4,\arg5 - move.l \arg1,-(%sp) - .endif -.endm - -.macro printf bit=-1,string,nr=0,arg1,arg2,arg3,arg4,arg5 -#ifdef FPU_EMU_DEBUG - .data -.Lpdata\@: - .string "\string" - .previous - - movem.l %d0/%d1/%a0/%a1,-(%sp) - .if \bit+1 -#if 0 - moveq #\bit,%d0 - andw #7,%d0 - btst %d0,fp_debugprint+((31-\bit)/8) -#else - btst #\bit,fp_debugprint+((31-\bit)/8) -#endif - jeq .Lpskip\@ - .endif - movestack \nr,\arg1,\arg2,\arg3,\arg4,\arg5 - pea .Lpdata\@ - jsr printk - lea ((\nr+1)*4,%sp),%sp -.Lpskip\@: - movem.l (%sp)+,%d0/%d1/%a0/%a1 -#endif -.endm - -.macro printx bit,fp -#ifdef FPU_EMU_DEBUG - movem.l %d0/%a0,-(%sp) - lea \fp,%a0 -#if 0 - moveq #'+',%d0 - tst.w (%a0) - jeq .Lx1\@ - moveq #'-',%d0 -.Lx1\@: printf \bit," %c",1,%d0 - move.l (4,%a0),%d0 - bclr #31,%d0 - jne .Lx2\@ - printf \bit,"0." - jra .Lx3\@ -.Lx2\@: printf \bit,"1." -.Lx3\@: printf \bit,"%08x%08x",2,%d0,%a0@(8) - move.w (2,%a0),%d0 - ext.l %d0 - printf \bit,"E%04x",1,%d0 -#else - printf \bit," %08x%08x%08x",3,%a0@,%a0@(4),%a0@(8) -#endif - movem.l (%sp)+,%d0/%a0 -#endif -.endm - -.macro debug instr,args -#ifdef FPU_EMU_DEBUG - \instr \args -#endif -.endm - - -#endif /* __ASSEMBLY__ */ - -#endif /* _ASM_FRV_MATH_EMU_H */ - diff --git a/arch/frv/include/asm/mb-regs.h b/arch/frv/include/asm/mb-regs.h deleted file mode 100644 index 219e5f926f189..0000000000000 --- a/arch/frv/include/asm/mb-regs.h +++ /dev/null @@ -1,200 +0,0 @@ -/* mb-regs.h: motherboard registers - * - * Copyright (C) 2003, 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#ifndef _ASM_MB_REGS_H -#define _ASM_MB_REGS_H - -#include -#include -#include - -#ifndef __ASSEMBLY__ -/* gcc builtins, annotated */ - -unsigned long __builtin_read8(volatile void __iomem *); -unsigned long __builtin_read16(volatile void __iomem *); -unsigned long __builtin_read32(volatile void __iomem *); -void __builtin_write8(volatile void __iomem *, unsigned char); -void __builtin_write16(volatile void __iomem *, unsigned short); -void __builtin_write32(volatile void __iomem *, unsigned long); -#endif - -#define __region_IO KERNEL_IO_START /* the region from 0xe0000000 to 0xffffffff has suitable - * protection laid over the top for use in memory-mapped - * I/O - */ - -#define __region_CS0 0xff000000 /* Boot ROMs area */ - -#ifdef CONFIG_MB93091_VDK -/* - * VDK motherboard and CPU card specific stuff - */ - -#include - -#define IRQ_CPU_MB93493_0 IRQ_CPU_EXTERNAL0 -#define IRQ_CPU_MB93493_1 IRQ_CPU_EXTERNAL1 - -#define __region_CS2 0xe0000000 /* SLBUS/PCI I/O space */ -#define __region_CS2_M 0x0fffffff /* mask */ -#define __region_CS2_C 0x00000000 /* control */ -#define __region_CS5 0xf0000000 /* MB93493 CSC area (DAV daughter board) */ -#define __region_CS5_M 0x00ffffff -#define __region_CS5_C 0x00010000 -#define __region_CS7 0xf1000000 /* CB70 CPU-card PCMCIA port I/O space */ -#define __region_CS7_M 0x00ffffff -#define __region_CS7_C 0x00410701 -#define __region_CS1 0xfc000000 /* SLBUS/PCI bridge control registers */ -#define __region_CS1_M 0x000fffff -#define __region_CS1_C 0x00000000 -#define __region_CS6 0xfc100000 /* CB70 CPU-card DM9000 LAN I/O space */ -#define __region_CS6_M 0x000fffff -#define __region_CS6_C 0x00400707 -#define __region_CS3 0xfc200000 /* MB93493 CSR area (DAV daughter board) */ -#define __region_CS3_M 0x000fffff -#define __region_CS3_C 0xc8100000 -#define __region_CS4 0xfd000000 /* CB70 CPU-card extra flash space */ -#define __region_CS4_M 0x00ffffff -#define __region_CS4_C 0x00000f07 - -#define __region_PCI_IO (__region_CS2 + 0x04000000UL) -#define __region_PCI_MEM (__region_CS2 + 0x08000000UL) -#define __flush_PCI_writes() \ -do { \ - __builtin_write8((volatile void __iomem *) __region_PCI_MEM, 0); \ -} while(0) - -#define __is_PCI_IO(addr) \ - (((unsigned long)(addr) >> 24) - (__region_PCI_IO >> 24) < (0x04000000UL >> 24)) - -#define __is_PCI_MEM(addr) \ - ((unsigned long)(addr) - __region_PCI_MEM < 0x08000000UL) - -#define __is_PCI_addr(addr) \ - ((unsigned long)(addr) - __region_PCI_IO < 0x0c000000UL) - -#define __get_CLKSW() ({ *(volatile unsigned long *)(__region_CS2 + 0x0130000cUL) & 0xffUL; }) -#define __get_CLKIN() (__get_CLKSW() * 125U * 100000U / 24U) - -#ifndef __ASSEMBLY__ -extern int __nongprelbss mb93090_mb00_detected; -#endif - -#define __addr_LEDS() (__region_CS2 + 0x01200004UL) -#ifdef CONFIG_MB93090_MB00 -#define __set_LEDS(X) \ -do { \ - if (mb93090_mb00_detected) \ - __builtin_write32((void __iomem *) __addr_LEDS(), ~(X)); \ -} while (0) -#else -#define __set_LEDS(X) -#endif - -#define __addr_LCD() (__region_CS2 + 0x01200008UL) -#define __get_LCD(B) __builtin_read32((volatile void __iomem *) (B)) -#define __set_LCD(B,X) __builtin_write32((volatile void __iomem *) (B), (X)) - -#define LCD_D 0x000000ff /* LCD data bus */ -#define LCD_RW 0x00000100 /* LCD R/W signal */ -#define LCD_RS 0x00000200 /* LCD Register Select */ -#define LCD_E 0x00000400 /* LCD Start Enable Signal */ - -#define LCD_CMD_CLEAR (LCD_E|0x001) -#define LCD_CMD_HOME (LCD_E|0x002) -#define LCD_CMD_CURSOR_INC (LCD_E|0x004) -#define LCD_CMD_SCROLL_INC (LCD_E|0x005) -#define LCD_CMD_CURSOR_DEC (LCD_E|0x006) -#define LCD_CMD_SCROLL_DEC (LCD_E|0x007) -#define LCD_CMD_OFF (LCD_E|0x008) -#define LCD_CMD_ON(CRSR,BLINK) (LCD_E|0x00c|(CRSR<<1)|BLINK) -#define LCD_CMD_CURSOR_MOVE_L (LCD_E|0x010) -#define LCD_CMD_CURSOR_MOVE_R (LCD_E|0x014) -#define LCD_CMD_DISPLAY_SHIFT_L (LCD_E|0x018) -#define LCD_CMD_DISPLAY_SHIFT_R (LCD_E|0x01c) -#define LCD_CMD_FUNCSET(DL,N,F) (LCD_E|0x020|(DL<<4)|(N<<3)|(F<<2)) -#define LCD_CMD_SET_CG_ADDR(X) (LCD_E|0x040|X) -#define LCD_CMD_SET_DD_ADDR(X) (LCD_E|0x080|X) -#define LCD_CMD_READ_BUSY (LCD_E|LCD_RW) -#define LCD_DATA_WRITE(X) (LCD_E|LCD_RS|(X)) -#define LCD_DATA_READ (LCD_E|LCD_RS|LCD_RW) - -#else -/* - * PDK unit specific stuff - */ - -#include - -#define IRQ_CPU_MB93493_0 IRQ_CPU_EXTERNAL0 -#define IRQ_CPU_MB93493_1 IRQ_CPU_EXTERNAL1 - -#define __region_CS5 0xf0000000 /* MB93493 CSC area (DAV daughter board) */ -#define __region_CS5_M 0x00ffffff /* mask */ -#define __region_CS5_C 0x00010000 /* control */ -#define __region_CS2 0x20000000 /* FPGA registers */ -#define __region_CS2_M 0x000fffff -#define __region_CS2_C 0x00000000 -#define __region_CS1 0xfc100000 /* LAN registers */ -#define __region_CS1_M 0x000fffff -#define __region_CS1_C 0x00010404 -#define __region_CS3 0xfc200000 /* MB93493 CSR area (DAV daughter board) */ -#define __region_CS3_M 0x000fffff -#define __region_CS3_C 0xc8000000 -#define __region_CS4 0xfd000000 /* extra ROMs area */ -#define __region_CS4_M 0x00ffffff -#define __region_CS4_C 0x00000f07 - -#define __region_CS6 0xfe000000 /* not used - hide behind CPU resource I/O regs */ -#define __region_CS6_M 0x000fffff -#define __region_CS6_C 0x00000f07 -#define __region_CS7 0xfe000000 /* not used - hide behind CPU resource I/O regs */ -#define __region_CS7_M 0x000fffff -#define __region_CS7_C 0x00000f07 - -#define __is_PCI_IO(addr) 0 /* no PCI */ -#define __is_PCI_MEM(addr) 0 -#define __is_PCI_addr(addr) 0 -#define __region_PCI_IO 0 -#define __region_PCI_MEM 0 -#define __flush_PCI_writes() do { } while(0) - -#define __get_CLKSW() 0UL -#define __get_CLKIN() 66000000UL - -#define __addr_LEDS() (__region_CS2 + 0x00000023UL) -#define __set_LEDS(X) __builtin_write8((volatile void __iomem *) __addr_LEDS(), (X)) - -#define __addr_FPGATR() (__region_CS2 + 0x00000030UL) -#define __set_FPGATR(X) __builtin_write32((volatile void __iomem *) __addr_FPGATR(), (X)) -#define __get_FPGATR() __builtin_read32((volatile void __iomem *) __addr_FPGATR()) - -#define MB93093_FPGA_FPGATR_AUDIO_CLK 0x00000003 - -#define __set_FPGATR_AUDIO_CLK(V) \ - __set_FPGATR((__get_FPGATR() & ~MB93093_FPGA_FPGATR_AUDIO_CLK) | (V)) - -#define MB93093_FPGA_FPGATR_AUDIO_CLK_OFF 0x0 -#define MB93093_FPGA_FPGATR_AUDIO_CLK_11MHz 0x1 -#define MB93093_FPGA_FPGATR_AUDIO_CLK_12MHz 0x2 -#define MB93093_FPGA_FPGATR_AUDIO_CLK_02MHz 0x3 - -#define MB93093_FPGA_SWR_PUSHSWMASK (0x1F<<26) -#define MB93093_FPGA_SWR_PUSHSW4 (1<<29) - -#define __addr_FPGA_SWR ((volatile void __iomem *)(__region_CS2 + 0x28UL)) -#define __get_FPGA_PUSHSW1_5() (__builtin_read32(__addr_FPGA_SWR) & MB93093_FPGA_SWR_PUSHSWMASK) - - -#endif - -#endif /* _ASM_MB_REGS_H */ diff --git a/arch/frv/include/asm/mb86943a.h b/arch/frv/include/asm/mb86943a.h deleted file mode 100644 index e87ef924bfb48..0000000000000 --- a/arch/frv/include/asm/mb86943a.h +++ /dev/null @@ -1,42 +0,0 @@ -/* mb86943a.h: MB86943 SPARClite <-> PCI bridge registers - * - * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#ifndef _ASM_MB86943A_H -#define _ASM_MB86943A_H - -#include - -#define __reg_MB86943_sl_ctl *(volatile uint32_t *) (__region_CS1 + 0x00) - -#define MB86943_SL_CTL_BUS_WIDTH_64 0x00000001 -#define MB86943_SL_CTL_AS_HOST 0x00000002 -#define MB86943_SL_CTL_DRCT_MASTER_SWAP 0x00000004 -#define MB86943_SL_CTL_DRCT_SLAVE_SWAP 0x00000008 -#define MB86943_SL_CTL_PCI_CONFIG_SWAP 0x00000010 -#define MB86943_SL_CTL_ECS0_ENABLE 0x00000020 -#define MB86943_SL_CTL_ECS1_ENABLE 0x00000040 -#define MB86943_SL_CTL_ECS2_ENABLE 0x00000080 - -#define __reg_MB86943_ecs_ctl(N) *(volatile uint32_t *) (__region_CS1 + 0x08 + (0x08*(N))) -#define __reg_MB86943_ecs_range(N) *(volatile uint32_t *) (__region_CS1 + 0x20 + (0x10*(N))) -#define __reg_MB86943_ecs_base(N) *(volatile uint32_t *) (__region_CS1 + 0x28 + (0x10*(N))) - -#define __reg_MB86943_sl_pci_io_range *(volatile uint32_t *) (__region_CS1 + 0x50) -#define __reg_MB86943_sl_pci_io_base *(volatile uint32_t *) (__region_CS1 + 0x58) -#define __reg_MB86943_sl_pci_mem_range *(volatile uint32_t *) (__region_CS1 + 0x60) -#define __reg_MB86943_sl_pci_mem_base *(volatile uint32_t *) (__region_CS1 + 0x68) -#define __reg_MB86943_pci_sl_io_base *(volatile uint32_t *) (__region_CS1 + 0x70) -#define __reg_MB86943_pci_sl_mem_base *(volatile uint32_t *) (__region_CS1 + 0x78) - -#define __reg_MB86943_pci_arbiter *(volatile uint32_t *) (__region_CS2 + 0x01300014) -#define MB86943_PCIARB_EN 0x00000001 - -#endif /* _ASM_MB86943A_H */ diff --git a/arch/frv/include/asm/mb93091-fpga-irqs.h b/arch/frv/include/asm/mb93091-fpga-irqs.h deleted file mode 100644 index 19778c5ba9d65..0000000000000 --- a/arch/frv/include/asm/mb93091-fpga-irqs.h +++ /dev/null @@ -1,42 +0,0 @@ -/* mb93091-fpga-irqs.h: MB93091 CPU board FPGA IRQs - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#ifndef _ASM_MB93091_FPGA_IRQS_H -#define _ASM_MB93091_FPGA_IRQS_H - -#include - -#ifndef __ASSEMBLY__ - -/* IRQ IDs presented to drivers */ -enum { - IRQ_FPGA__UNUSED = IRQ_BASE_FPGA, - IRQ_FPGA_SYSINT_BUS_EXPANSION_1, - IRQ_FPGA_SL_BUS_EXPANSION_2, - IRQ_FPGA_PCI_INTD, - IRQ_FPGA_PCI_INTC, - IRQ_FPGA_PCI_INTB, - IRQ_FPGA_PCI_INTA, - IRQ_FPGA_SL_BUS_EXPANSION_7, - IRQ_FPGA_SYSINT_BUS_EXPANSION_8, - IRQ_FPGA_SL_BUS_EXPANSION_9, - IRQ_FPGA_MB86943_PCI_INTA, - IRQ_FPGA_MB86943_SLBUS_SIDE, - IRQ_FPGA_RTL8029_INTA, - IRQ_FPGA_SYSINT_BUS_EXPANSION_13, - IRQ_FPGA_SL_BUS_EXPANSION_14, - IRQ_FPGA_NMI, -}; - - -#endif /* !__ASSEMBLY__ */ - -#endif /* _ASM_MB93091_FPGA_IRQS_H */ diff --git a/arch/frv/include/asm/mb93093-fpga-irqs.h b/arch/frv/include/asm/mb93093-fpga-irqs.h deleted file mode 100644 index 590266b1a6d32..0000000000000 --- a/arch/frv/include/asm/mb93093-fpga-irqs.h +++ /dev/null @@ -1,29 +0,0 @@ -/* mb93093-fpga-irqs.h: MB93093 CPU board FPGA IRQs - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#ifndef _ASM_MB93093_FPGA_IRQS_H -#define _ASM_MB93093_FPGA_IRQS_H - -#include - -#ifndef __ASSEMBLY__ - -/* IRQ IDs presented to drivers */ -enum { - IRQ_FPGA_PUSH_BUTTON_SW1_5 = IRQ_BASE_FPGA + 8, - IRQ_FPGA_ROCKER_C_SW8 = IRQ_BASE_FPGA + 9, - IRQ_FPGA_ROCKER_C_SW9 = IRQ_BASE_FPGA + 10, -}; - - -#endif /* !__ASSEMBLY__ */ - -#endif /* _ASM_MB93093_FPGA_IRQS_H */ diff --git a/arch/frv/include/asm/mb93493-irqs.h b/arch/frv/include/asm/mb93493-irqs.h deleted file mode 100644 index 82c7aeddd3335..0000000000000 --- a/arch/frv/include/asm/mb93493-irqs.h +++ /dev/null @@ -1,50 +0,0 @@ -/* mb93493-irqs.h: MB93493 companion chip IRQs - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#ifndef _ASM_MB93493_IRQS_H -#define _ASM_MB93493_IRQS_H - -#include - -#ifndef __ASSEMBLY__ - -/* IRQ IDs presented to drivers */ -enum { - IRQ_MB93493_VDC = IRQ_BASE_MB93493 + 0, - IRQ_MB93493_VCC = IRQ_BASE_MB93493 + 1, - IRQ_MB93493_AUDIO_OUT = IRQ_BASE_MB93493 + 2, - IRQ_MB93493_I2C_0 = IRQ_BASE_MB93493 + 3, - IRQ_MB93493_I2C_1 = IRQ_BASE_MB93493 + 4, - IRQ_MB93493_USB = IRQ_BASE_MB93493 + 5, - IRQ_MB93493_LOCAL_BUS = IRQ_BASE_MB93493 + 7, - IRQ_MB93493_PCMCIA = IRQ_BASE_MB93493 + 8, - IRQ_MB93493_GPIO = IRQ_BASE_MB93493 + 9, - IRQ_MB93493_AUDIO_IN = IRQ_BASE_MB93493 + 10, -}; - -/* IRQ multiplexor mappings */ -#define ROUTE_VIA_IRQ0 0 /* route IRQ by way of CPU external IRQ 0 */ -#define ROUTE_VIA_IRQ1 1 /* route IRQ by way of CPU external IRQ 1 */ - -#define IRQ_MB93493_VDC_ROUTE ROUTE_VIA_IRQ0 -#define IRQ_MB93493_VCC_ROUTE ROUTE_VIA_IRQ1 -#define IRQ_MB93493_AUDIO_OUT_ROUTE ROUTE_VIA_IRQ1 -#define IRQ_MB93493_I2C_0_ROUTE ROUTE_VIA_IRQ1 -#define IRQ_MB93493_I2C_1_ROUTE ROUTE_VIA_IRQ1 -#define IRQ_MB93493_USB_ROUTE ROUTE_VIA_IRQ1 -#define IRQ_MB93493_LOCAL_BUS_ROUTE ROUTE_VIA_IRQ1 -#define IRQ_MB93493_PCMCIA_ROUTE ROUTE_VIA_IRQ1 -#define IRQ_MB93493_GPIO_ROUTE ROUTE_VIA_IRQ1 -#define IRQ_MB93493_AUDIO_IN_ROUTE ROUTE_VIA_IRQ1 - -#endif /* !__ASSEMBLY__ */ - -#endif /* _ASM_MB93493_IRQS_H */ diff --git a/arch/frv/include/asm/mb93493-regs.h b/arch/frv/include/asm/mb93493-regs.h deleted file mode 100644 index 8a1f6aac8cf1b..0000000000000 --- a/arch/frv/include/asm/mb93493-regs.h +++ /dev/null @@ -1,281 +0,0 @@ -/* mb93493-regs.h: MB93493 companion chip registers - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#ifndef _ASM_MB93493_REGS_H -#define _ASM_MB93493_REGS_H - -#include -#include - -#define __addr_MB93493(X) ((volatile unsigned long *)(__region_CS3 + (X))) -#define __get_MB93493(X) ({ *(volatile unsigned long *)(__region_CS3 + (X)); }) - -#define __set_MB93493(X,V) \ -do { \ - *(volatile unsigned long *)(__region_CS3 + (X)) = (V); mb(); \ -} while(0) - -#define __get_MB93493_STSR(X) __get_MB93493(0x3c0 + (X) * 4) -#define __set_MB93493_STSR(X,V) __set_MB93493(0x3c0 + (X) * 4, (V)) -#define MB93493_STSR_EN - -#define __addr_MB93493_IQSR(X) __addr_MB93493(0x3d0 + (X) * 4) -#define __get_MB93493_IQSR(X) __get_MB93493(0x3d0 + (X) * 4) -#define __set_MB93493_IQSR(X,V) __set_MB93493(0x3d0 + (X) * 4, (V)) - -#define __get_MB93493_DQSR(X) __get_MB93493(0x3e0 + (X) * 4) -#define __set_MB93493_DQSR(X,V) __set_MB93493(0x3e0 + (X) * 4, (V)) - -#define __get_MB93493_LBSER() __get_MB93493(0x3f0) -#define __set_MB93493_LBSER(V) __set_MB93493(0x3f0, (V)) - -#define MB93493_LBSER_VDC 0x00010000 -#define MB93493_LBSER_VCC 0x00020000 -#define MB93493_LBSER_AUDIO 0x00040000 -#define MB93493_LBSER_I2C_0 0x00080000 -#define MB93493_LBSER_I2C_1 0x00100000 -#define MB93493_LBSER_USB 0x00200000 -#define MB93493_LBSER_GPIO 0x00800000 -#define MB93493_LBSER_PCMCIA 0x01000000 - -#define __get_MB93493_LBSR() __get_MB93493(0x3fc) -#define __set_MB93493_LBSR(V) __set_MB93493(0x3fc, (V)) - -/* - * video display controller - */ -#define __get_MB93493_VDC(X) __get_MB93493(MB93493_VDC_##X) -#define __set_MB93493_VDC(X,V) __set_MB93493(MB93493_VDC_##X, (V)) - -#define MB93493_VDC_RCURSOR 0x140 /* cursor position */ -#define MB93493_VDC_RCT1 0x144 /* cursor colour 1 */ -#define MB93493_VDC_RCT2 0x148 /* cursor colour 2 */ -#define MB93493_VDC_RHDC 0x150 /* horizontal display period */ -#define MB93493_VDC_RH_MARGINS 0x154 /* horizontal margin sizes */ -#define MB93493_VDC_RVDC 0x158 /* vertical display period */ -#define MB93493_VDC_RV_MARGINS 0x15c /* vertical margin sizes */ -#define MB93493_VDC_RC 0x170 /* VDC control */ -#define MB93493_VDC_RCLOCK 0x174 /* clock divider, DMA req delay */ -#define MB93493_VDC_RBLACK 0x178 /* black insert sizes */ -#define MB93493_VDC_RS 0x17c /* VDC status */ - -#define __addr_MB93493_VDC_BCI(X) ({ (volatile unsigned long *)(__region_CS3 + 0x000 + (X)); }) -#define __addr_MB93493_VDC_TPO(X) (__region_CS3 + 0x1c0 + (X)) - -#define VDC_TPO_WIDTH 32 - -#define VDC_RC_DSR 0x00000080 /* VDC master reset */ - -#define VDC_RS_IT 0x00060000 /* interrupt indicators */ -#define VDC_RS_IT_UNDERFLOW 0x00040000 /* - underflow event */ -#define VDC_RS_IT_VSYNC 0x00020000 /* - VSYNC event */ -#define VDC_RS_DFI 0x00010000 /* current interlace field number */ -#define VDC_RS_DFI_TOP 0x00000000 /* - top field */ -#define VDC_RS_DFI_BOTTOM 0x00010000 /* - bottom field */ -#define VDC_RS_DCSR 0x00000010 /* cursor state */ -#define VDC_RS_DCM 0x00000003 /* display mode */ -#define VDC_RS_DCM_DISABLED 0x00000000 /* - display disabled */ -#define VDC_RS_DCM_STOPPED 0x00000001 /* - VDC stopped */ -#define VDC_RS_DCM_FREERUNNING 0x00000002 /* - VDC free-running */ -#define VDC_RS_DCM_TRANSFERRING 0x00000003 /* - data being transferred to VDC */ - -/* - * video capture controller - */ -#define __get_MB93493_VCC(X) __get_MB93493(MB93493_VCC_##X) -#define __set_MB93493_VCC(X,V) __set_MB93493(MB93493_VCC_##X, (V)) - -#define MB93493_VCC_RREDUCT 0x104 /* reduction rate */ -#define MB93493_VCC_RHY 0x108 /* horizontal brightness filter coefficients */ -#define MB93493_VCC_RHC 0x10c /* horizontal colour-difference filter coefficients */ -#define MB93493_VCC_RHSIZE 0x110 /* horizontal cycle sizes */ -#define MB93493_VCC_RHBC 0x114 /* horizontal back porch size */ -#define MB93493_VCC_RVCC 0x118 /* vertical capture period */ -#define MB93493_VCC_RVBC 0x11c /* vertical back porch period */ -#define MB93493_VCC_RV 0x120 /* vertical filter coefficients */ -#define MB93493_VCC_RDTS 0x128 /* DMA transfer size */ -#define MB93493_VCC_RDTS_4B 0x01000000 /* 4-byte transfer */ -#define MB93493_VCC_RDTS_32B 0x03000000 /* 32-byte transfer */ -#define MB93493_VCC_RDTS_SHIFT 24 -#define MB93493_VCC_RCC 0x130 /* VCC control */ -#define MB93493_VCC_RIS 0x134 /* VCC interrupt status */ - -#define __addr_MB93493_VCC_TPI(X) (__region_CS3 + 0x180 + (X)) - -#define VCC_RHSIZE_RHCC 0x000007ff -#define VCC_RHSIZE_RHCC_SHIFT 0 -#define VCC_RHSIZE_RHTCC 0x0fff0000 -#define VCC_RHSIZE_RHTCC_SHIFT 16 - -#define VCC_RVBC_RVBC 0x00003f00 -#define VCC_RVBC_RVBC_SHIFT 8 - -#define VCC_RREDUCT_RHR 0x07ff0000 -#define VCC_RREDUCT_RHR_SHIFT 16 -#define VCC_RREDUCT_RVR 0x000007ff -#define VCC_RREDUCT_RVR_SHIFT 0 - -#define VCC_RCC_CE 0x00000001 /* VCC enable */ -#define VCC_RCC_CS 0x00000002 /* request video capture start */ -#define VCC_RCC_CPF 0x0000000c /* pixel format */ -#define VCC_RCC_CPF_YCBCR_16 0x00000000 /* - YCbCr 4:2:2 16-bit format */ -#define VCC_RCC_CPF_RGB 0x00000004 /* - RGB 4:4:4 format */ -#define VCC_RCC_CPF_YCBCR_24 0x00000008 /* - YCbCr 4:2:2 24-bit format */ -#define VCC_RCC_CPF_BT656 0x0000000c /* - ITU R-BT.656 format */ -#define VCC_RCC_CPF_SHIFT 2 -#define VCC_RCC_CSR 0x00000080 /* request reset */ -#define VCC_RCC_HSIP 0x00000100 /* HSYNC polarity */ -#define VCC_RCC_HSIP_LOACT 0x00000000 /* - low active */ -#define VCC_RCC_HSIP_HIACT 0x00000100 /* - high active */ -#define VCC_RCC_VSIP 0x00000200 /* VSYNC polarity */ -#define VCC_RCC_VSIP_LOACT 0x00000000 /* - low active */ -#define VCC_RCC_VSIP_HIACT 0x00000200 /* - high active */ -#define VCC_RCC_CIE 0x00000800 /* interrupt enable */ -#define VCC_RCC_CFP 0x00001000 /* RGB pixel packing */ -#define VCC_RCC_CFP_4TO3 0x00000000 /* - pack 4 pixels into 3 words */ -#define VCC_RCC_CFP_1TO1 0x00001000 /* - pack 1 pixel into 1 words */ -#define VCC_RCC_CSM 0x00006000 /* interlace specification */ -#define VCC_RCC_CSM_ONEPASS 0x00002000 /* - non-interlaced */ -#define VCC_RCC_CSM_INTERLACE 0x00004000 /* - interlaced */ -#define VCC_RCC_CSM_SHIFT 13 -#define VCC_RCC_ES 0x00008000 /* capture start polarity */ -#define VCC_RCC_ES_NEG 0x00000000 /* - negative edge */ -#define VCC_RCC_ES_POS 0x00008000 /* - positive edge */ -#define VCC_RCC_IFI 0x00080000 /* inferlace field evaluation reverse */ -#define VCC_RCC_FDTS 0x00300000 /* interlace field start */ -#define VCC_RCC_FDTS_3_8 0x00000000 /* - 3/8 of horizontal entire cycle */ -#define VCC_RCC_FDTS_1_4 0x00100000 /* - 1/4 of horizontal entire cycle */ -#define VCC_RCC_FDTS_7_16 0x00200000 /* - 7/16 of horizontal entire cycle */ -#define VCC_RCC_FDTS_SHIFT 20 -#define VCC_RCC_MOV 0x00400000 /* test bit - always set to 1 */ -#define VCC_RCC_STP 0x00800000 /* request video capture stop */ -#define VCC_RCC_TO 0x01000000 /* input during top-field only */ - -#define VCC_RIS_VSYNC 0x01000000 /* VSYNC interrupt */ -#define VCC_RIS_OV 0x02000000 /* overflow interrupt */ -#define VCC_RIS_BOTTOM 0x08000000 /* interlace bottom field */ -#define VCC_RIS_STARTED 0x10000000 /* capture started */ - -/* - * I2C - */ -#define MB93493_I2C_BSR 0x340 /* bus status */ -#define MB93493_I2C_BCR 0x344 /* bus control */ -#define MB93493_I2C_CCR 0x348 /* clock control */ -#define MB93493_I2C_ADR 0x34c /* address */ -#define MB93493_I2C_DTR 0x350 /* data */ -#define MB93493_I2C_BC2R 0x35c /* bus control 2 */ - -#define __addr_MB93493_I2C(port,X) (__region_CS3 + MB93493_I2C_##X + ((port)*0x20)) -#define __get_MB93493_I2C(port,X) __get_MB93493(MB93493_I2C_##X + ((port)*0x20)) -#define __set_MB93493_I2C(port,X,V) __set_MB93493(MB93493_I2C_##X + ((port)*0x20), (V)) - -#define I2C_BSR_BB (1 << 7) - -/* - * audio controller (I2S) registers - */ -#define __get_MB93493_I2S(X) __get_MB93493(MB93493_I2S_##X) -#define __set_MB93493_I2S(X,V) __set_MB93493(MB93493_I2S_##X, (V)) - -#define MB93493_I2S_ALDR 0x300 /* L-channel data */ -#define MB93493_I2S_ARDR 0x304 /* R-channel data */ -#define MB93493_I2S_APDR 0x308 /* 16-bit packed data */ -#define MB93493_I2S_AISTR 0x310 /* status */ -#define MB93493_I2S_AICR 0x314 /* control */ - -#define __addr_MB93493_I2S_ALDR(X) (__region_CS3 + MB93493_I2S_ALDR + (X)) -#define __addr_MB93493_I2S_ARDR(X) (__region_CS3 + MB93493_I2S_ARDR + (X)) -#define __addr_MB93493_I2S_APDR(X) (__region_CS3 + MB93493_I2S_APDR + (X)) -#define __addr_MB93493_I2S_ADR(X) (__region_CS3 + 0x320 + (X)) - -#define I2S_AISTR_OTST 0x00000003 /* status of output data transfer */ -#define I2S_AISTR_OTR 0x00000010 /* output transfer request pending */ -#define I2S_AISTR_OUR 0x00000020 /* output FIFO underrun detected */ -#define I2S_AISTR_OOR 0x00000040 /* output FIFO overrun detected */ -#define I2S_AISTR_ODS 0x00000100 /* output DMA transfer size */ -#define I2S_AISTR_ODE 0x00000400 /* output DMA transfer request enable */ -#define I2S_AISTR_OTRIE 0x00001000 /* output transfer request interrupt enable */ -#define I2S_AISTR_OURIE 0x00002000 /* output FIFO underrun interrupt enable */ -#define I2S_AISTR_OORIE 0x00004000 /* output FIFO overrun interrupt enable */ -#define I2S_AISTR__OUT_MASK 0x00007570 -#define I2S_AISTR_ITST 0x00030000 /* status of input data transfer */ -#define I2S_AISTR_ITST_SHIFT 16 -#define I2S_AISTR_ITR 0x00100000 /* input transfer request pending */ -#define I2S_AISTR_IUR 0x00200000 /* input FIFO underrun detected */ -#define I2S_AISTR_IOR 0x00400000 /* input FIFO overrun detected */ -#define I2S_AISTR_IDS 0x01000000 /* input DMA transfer size */ -#define I2S_AISTR_IDE 0x04000000 /* input DMA transfer request enable */ -#define I2S_AISTR_ITRIE 0x10000000 /* input transfer request interrupt enable */ -#define I2S_AISTR_IURIE 0x20000000 /* input FIFO underrun interrupt enable */ -#define I2S_AISTR_IORIE 0x40000000 /* input FIFO overrun interrupt enable */ -#define I2S_AISTR__IN_MASK 0x75700000 - -#define I2S_AICR_MI 0x00000001 /* mono input requested */ -#define I2S_AICR_AMI 0x00000002 /* relation between LRCKI/FS1 and SDI */ -#define I2S_AICR_LRI 0x00000004 /* function of LRCKI pin */ -#define I2S_AICR_SDMI 0x00000070 /* format of input audio data */ -#define I2S_AICR_SDMI_SHIFT 4 -#define I2S_AICR_CLI 0x00000080 /* input FIFO clearing control */ -#define I2S_AICR_IM 0x00000300 /* input state control */ -#define I2S_AICR_IM_SHIFT 8 -#define I2S_AICR__IN_MASK 0x000003f7 -#define I2S_AICR_MO 0x00001000 /* mono output requested */ -#define I2S_AICR_AMO 0x00002000 /* relation between LRCKO/FS0 and SDO */ -#define I2S_AICR_AMO_SHIFT 13 -#define I2S_AICR_LRO 0x00004000 /* function of LRCKO pin */ -#define I2S_AICR_SDMO 0x00070000 /* format of output audio data */ -#define I2S_AICR_SDMO_SHIFT 16 -#define I2S_AICR_CLO 0x00080000 /* output FIFO clearing control */ -#define I2S_AICR_OM 0x00100000 /* output state control */ -#define I2S_AICR__OUT_MASK 0x001f7000 -#define I2S_AICR_DIV 0x03000000 /* frequency division rate */ -#define I2S_AICR_DIV_SHIFT 24 -#define I2S_AICR_FL 0x20000000 /* frame length */ -#define I2S_AICR_FS 0x40000000 /* frame sync method */ -#define I2S_AICR_ME 0x80000000 /* master enable */ - -/* - * PCMCIA - */ -#define __addr_MB93493_PCMCIA(X) ((volatile unsigned long *)(__region_CS5 + (X))) - -/* - * GPIO - */ -#define __get_MB93493_GPIO_PDR(X) __get_MB93493(0x380 + (X) * 0xc0) -#define __set_MB93493_GPIO_PDR(X,V) __set_MB93493(0x380 + (X) * 0xc0, (V)) - -#define __get_MB93493_GPIO_GPDR(X) __get_MB93493(0x384 + (X) * 0xc0) -#define __set_MB93493_GPIO_GPDR(X,V) __set_MB93493(0x384 + (X) * 0xc0, (V)) - -#define __get_MB93493_GPIO_SIR(X) __get_MB93493(0x388 + (X) * 0xc0) -#define __set_MB93493_GPIO_SIR(X,V) __set_MB93493(0x388 + (X) * 0xc0, (V)) - -#define __get_MB93493_GPIO_SOR(X) __get_MB93493(0x38c + (X) * 0xc0) -#define __set_MB93493_GPIO_SOR(X,V) __set_MB93493(0x38c + (X) * 0xc0, (V)) - -#define __get_MB93493_GPIO_PDSR(X) __get_MB93493(0x390 + (X) * 0xc0) -#define __set_MB93493_GPIO_PDSR(X,V) __set_MB93493(0x390 + (X) * 0xc0, (V)) - -#define __get_MB93493_GPIO_PDCR(X) __get_MB93493(0x394 + (X) * 0xc0) -#define __set_MB93493_GPIO_PDCR(X,V) __set_MB93493(0x394 + (X) * 0xc0, (V)) - -#define __get_MB93493_GPIO_INTST(X) __get_MB93493(0x398 + (X) * 0xc0) -#define __set_MB93493_GPIO_INTST(X,V) __set_MB93493(0x398 + (X) * 0xc0, (V)) - -#define __get_MB93493_GPIO_IEHL(X) __get_MB93493(0x39c + (X) * 0xc0) -#define __set_MB93493_GPIO_IEHL(X,V) __set_MB93493(0x39c + (X) * 0xc0, (V)) - -#define __get_MB93493_GPIO_IELH(X) __get_MB93493(0x3a0 + (X) * 0xc0) -#define __set_MB93493_GPIO_IELH(X,V) __set_MB93493(0x3a0 + (X) * 0xc0, (V)) - -#endif /* _ASM_MB93493_REGS_H */ diff --git a/arch/frv/include/asm/mem-layout.h b/arch/frv/include/asm/mem-layout.h deleted file mode 100644 index e9a0ec85a4028..0000000000000 --- a/arch/frv/include/asm/mem-layout.h +++ /dev/null @@ -1,86 +0,0 @@ -/* mem-layout.h: memory layout - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#ifndef _ASM_MEM_LAYOUT_H -#define _ASM_MEM_LAYOUT_H - -#ifndef __ASSEMBLY__ -#define __UL(X) ((unsigned long) (X)) -#else -#define __UL(X) (X) -#endif - -/* - * PAGE_SHIFT determines the page size - */ -#define PAGE_SHIFT 14 - -#ifndef __ASSEMBLY__ -#define PAGE_SIZE (1UL << PAGE_SHIFT) -#else -#define PAGE_SIZE (1 << PAGE_SHIFT) -#endif - -#define PAGE_MASK (~(PAGE_SIZE-1)) - -/* - * the slab must be aligned such that load- and store-double instructions don't - * fault if used - */ -#define ARCH_DMA_MINALIGN L1_CACHE_BYTES -#define ARCH_SLAB_MINALIGN L1_CACHE_BYTES - -/*****************************************************************************/ -/* - * virtual memory layout from kernel's point of view - */ -#define PAGE_OFFSET ((unsigned long) &__page_offset) - -#ifdef CONFIG_MMU - -/* see Documentation/frv/mmu-layout.txt */ -#define KERNEL_LOWMEM_START __UL(0xc0000000) -#define KERNEL_LOWMEM_END __UL(0xd0000000) -#define VMALLOC_START __UL(0xd0000000) -#define VMALLOC_END __UL(0xd8000000) -#define PKMAP_BASE __UL(0xd8000000) -#define PKMAP_END __UL(0xdc000000) -#define KMAP_ATOMIC_SECONDARY_FRAME __UL(0xdc000000) -#define KMAP_ATOMIC_PRIMARY_FRAME __UL(0xdd000000) - -#endif - -#define KERNEL_IO_START __UL(0xe0000000) - - -/*****************************************************************************/ -/* - * memory layout from userspace's point of view - */ -#define BRK_BASE __UL(2 * 1024 * 1024 + PAGE_SIZE) -#define STACK_TOP __UL(2 * 1024 * 1024) -#define STACK_TOP_MAX __UL(0xc0000000) - -/* userspace process size */ -#ifdef CONFIG_MMU -#define TASK_SIZE (PAGE_OFFSET) -#else -#define TASK_SIZE __UL(0xFFFFFFFFUL) -#endif - -/* base of area at which unspecified mmaps will start */ -#ifdef CONFIG_BINFMT_ELF_FDPIC -#define TASK_UNMAPPED_BASE __UL(16 * 1024 * 1024) -#else -#define TASK_UNMAPPED_BASE __UL(TASK_SIZE / 3) -#endif - -#endif /* _ASM_MEM_LAYOUT_H */ diff --git a/arch/frv/include/asm/mmu.h b/arch/frv/include/asm/mmu.h deleted file mode 100644 index 86ca0e86e7d25..0000000000000 --- a/arch/frv/include/asm/mmu.h +++ /dev/null @@ -1,41 +0,0 @@ -/* mmu.h: memory management context for FR-V with or without MMU support - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ -#ifndef _ASM_MMU_H -#define _ASM_MMU_H - -typedef struct { -#ifdef CONFIG_MMU - struct list_head id_link; /* link in list of context ID owners */ - unsigned short id; /* MMU context ID */ - unsigned short id_busy; /* true if ID is in CXNR */ - unsigned long itlb_cached_pge; /* [SCR0] PGE cached for insn TLB handler */ - unsigned long itlb_ptd_mapping; /* [DAMR4] PTD mapping for itlb cached PGE */ - unsigned long dtlb_cached_pge; /* [SCR1] PGE cached for data TLB handler */ - unsigned long dtlb_ptd_mapping; /* [DAMR5] PTD mapping for dtlb cached PGE */ - -#else - unsigned long end_brk; - -#endif - -#ifdef CONFIG_BINFMT_ELF_FDPIC - unsigned long exec_fdpic_loadmap; - unsigned long interp_fdpic_loadmap; -#endif - -} mm_context_t; - -#ifdef CONFIG_MMU -extern int __nongpreldata cxn_pinned; -extern int cxn_pin_by_pid(pid_t pid); -#endif - -#endif /* _ASM_MMU_H */ diff --git a/arch/frv/include/asm/mmu_context.h b/arch/frv/include/asm/mmu_context.h deleted file mode 100644 index c7daa395156a1..0000000000000 --- a/arch/frv/include/asm/mmu_context.h +++ /dev/null @@ -1,50 +0,0 @@ -/* mmu_context.h: MMU context management routines - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#ifndef _ASM_MMU_CONTEXT_H -#define _ASM_MMU_CONTEXT_H - -#include -#include -#include -#include - -static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) -{ -} - -#ifdef CONFIG_MMU -extern int init_new_context(struct task_struct *tsk, struct mm_struct *mm); -extern void change_mm_context(mm_context_t *old, mm_context_t *ctx, pgd_t *_pgd); -extern void destroy_context(struct mm_struct *mm); - -#else -#define init_new_context(tsk, mm) ({ 0; }) -#define change_mm_context(old, ctx, _pml4) do {} while(0) -#define destroy_context(mm) do {} while(0) -#endif - -#define switch_mm(prev, next, tsk) \ -do { \ - if (prev != next) \ - change_mm_context(&prev->context, &next->context, next->pgd); \ -} while(0) - -#define activate_mm(prev, next) \ -do { \ - change_mm_context(&prev->context, &next->context, next->pgd); \ -} while(0) - -#define deactivate_mm(tsk, mm) \ -do { \ -} while(0) - -#endif diff --git a/arch/frv/include/asm/module.h b/arch/frv/include/asm/module.h deleted file mode 100644 index a8848f09a217d..0000000000000 --- a/arch/frv/include/asm/module.h +++ /dev/null @@ -1,22 +0,0 @@ -/* module.h: FRV module stuff - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ -#ifndef _ASM_MODULE_H -#define _ASM_MODULE_H - -#include - -/* - * Include the architecture version. - */ -#define MODULE_ARCH_VERMAGIC __stringify(PROCESSOR_MODEL_NAME) " " - -#endif /* _ASM_MODULE_H */ - diff --git a/arch/frv/include/asm/page.h b/arch/frv/include/asm/page.h deleted file mode 100644 index 0f76a0d586f66..0000000000000 --- a/arch/frv/include/asm/page.h +++ /dev/null @@ -1,74 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_PAGE_H -#define _ASM_PAGE_H - -#include -#include -#include -#include - -#ifndef __ASSEMBLY__ - -#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 __pud(x) ((pud_t) { (x) } ) -#define __pgd(x) ((pgd_t) { (x) } ) -#define __pgprot(x) ((pgprot_t) { (x) } ) -#define PTE_MASK PAGE_MASK - -#define devmem_is_allowed(pfn) 1 - -#define __pa(vaddr) virt_to_phys((void *) (unsigned long) (vaddr)) -#define __va(paddr) phys_to_virt((unsigned long) (paddr)) - -#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) - -extern unsigned long max_low_pfn; -extern unsigned long min_low_pfn; -extern unsigned long max_pfn; - -#ifdef CONFIG_MMU -#define pfn_valid(pfn) ((pfn) < max_mapnr) -#else -#define ARCH_PFN_OFFSET (PAGE_OFFSET >> PAGE_SHIFT) -#define pfn_valid(pfn) ((pfn) >= min_low_pfn && (pfn) < max_low_pfn) - -#endif - -#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) -#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) - - -#define VM_DATA_DEFAULT_FLAGS \ - (VM_READ | VM_WRITE | \ - ((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \ - VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) - -#endif /* __ASSEMBLY__ */ - -#include -#include - -#endif /* _ASM_PAGE_H */ diff --git a/arch/frv/include/asm/pci.h b/arch/frv/include/asm/pci.h deleted file mode 100644 index 895af9d558bac..0000000000000 --- a/arch/frv/include/asm/pci.h +++ /dev/null @@ -1,40 +0,0 @@ -/* pci.h: FR-V specific PCI declarations - * - * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - Derived from include/asm-m68k/pci.h - * - * 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_FRV_PCI_H -#define _ASM_FRV_PCI_H - -#include -#include -#include - -#define pcibios_assign_all_busses() 0 - -#ifdef CONFIG_MMU -extern void *consistent_alloc(gfp_t gfp, size_t size, dma_addr_t *dma_handle); -extern void consistent_free(void *vaddr); -extern void consistent_sync(void *vaddr, size_t size, int direction); -extern void consistent_sync_page(struct page *page, unsigned long offset, - size_t size, int direction); -#endif - -/* Return the index of the PCI controller for device PDEV. */ -#define pci_controller_num(PDEV) (0) - -/* - * These are pretty much arbitrary with the CoMEM implementation. - * We have the whole address space to ourselves. - */ -#define PCIBIOS_MIN_IO 0x100 -#define PCIBIOS_MIN_MEM 0x00010000 - -#endif /* _ASM_FRV_PCI_H */ diff --git a/arch/frv/include/asm/percpu.h b/arch/frv/include/asm/percpu.h deleted file mode 100644 index 4209fe5fe0a23..0000000000000 --- a/arch/frv/include/asm/percpu.h +++ /dev/null @@ -1,7 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __ASM_PERCPU_H -#define __ASM_PERCPU_H - -#include - -#endif /* __ASM_PERCPU_H */ diff --git a/arch/frv/include/asm/perf_event.h b/arch/frv/include/asm/perf_event.h deleted file mode 100644 index c52ea5546b5b4..0000000000000 --- a/arch/frv/include/asm/perf_event.h +++ /dev/null @@ -1,15 +0,0 @@ -/* FRV performance event support - * - * Copyright (C) 2009 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - -#ifndef _ASM_PERF_EVENT_H -#define _ASM_PERF_EVENT_H - -#endif /* _ASM_PERF_EVENT_H */ diff --git a/arch/frv/include/asm/pgalloc.h b/arch/frv/include/asm/pgalloc.h deleted file mode 100644 index 416d19a632f22..0000000000000 --- a/arch/frv/include/asm/pgalloc.h +++ /dev/null @@ -1,69 +0,0 @@ -/* pgalloc.h: Page allocation routines for FRV - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - * - * Derived from: - * include/asm-m68knommu/pgalloc.h - * include/asm-i386/pgalloc.h - */ -#ifndef _ASM_PGALLOC_H -#define _ASM_PGALLOC_H - -#include -#include - -#ifdef CONFIG_MMU - -#define pmd_populate_kernel(mm, pmd, pte) __set_pmd(pmd, __pa(pte) | _PAGE_TABLE) -#define pmd_populate(MM, PMD, PAGE) \ -do { \ - __set_pmd((PMD), page_to_pfn(PAGE) << PAGE_SHIFT | _PAGE_TABLE); \ -} while(0) -#define pmd_pgtable(pmd) pmd_page(pmd) - -/* - * Allocate and free page tables. - */ - -extern pgd_t *pgd_alloc(struct mm_struct *); -extern void pgd_free(struct mm_struct *mm, pgd_t *); - -extern pte_t *pte_alloc_one_kernel(struct mm_struct *, unsigned long); - -extern pgtable_t pte_alloc_one(struct mm_struct *, unsigned long); - -static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) -{ - free_page((unsigned long)pte); -} - -static inline void pte_free(struct mm_struct *mm, pgtable_t pte) -{ - pgtable_page_dtor(pte); - __free_page(pte); -} - -#define __pte_free_tlb(tlb,pte,address) \ -do { \ - pgtable_page_dtor(pte); \ - tlb_remove_page((tlb),(pte)); \ -} while (0) - -/* - * allocating and freeing a pmd is trivial: the 1-entry pmd is - * inside the pgd, so has no extra memory associated with it. - * (In the PAE case we free the pmds as part of the pgd.) - */ -#define pmd_alloc_one(mm, addr) ({ BUG(); ((pmd_t *) 2); }) -#define pmd_free(mm, x) do { } while (0) -#define __pmd_free_tlb(tlb,x,a) do { } while (0) - -#endif /* CONFIG_MMU */ - -#endif /* _ASM_PGALLOC_H */ diff --git a/arch/frv/include/asm/pgtable.h b/arch/frv/include/asm/pgtable.h deleted file mode 100644 index ab6e7e961b545..0000000000000 --- a/arch/frv/include/asm/pgtable.h +++ /dev/null @@ -1,528 +0,0 @@ -/* pgtable.h: FR-V page table mangling - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - * - * Derived from: - * include/asm-m68knommu/pgtable.h - * include/asm-i386/pgtable.h - */ - -#ifndef _ASM_PGTABLE_H -#define _ASM_PGTABLE_H - -#include -#include -#include -#include - -#ifndef __ASSEMBLY__ -#include -#include -#include -#include -#include -struct vm_area_struct; -#endif - -#ifndef __ASSEMBLY__ -#if defined(CONFIG_HIGHPTE) -typedef unsigned long pte_addr_t; -#else -typedef pte_t *pte_addr_t; -#endif -#endif - -/*****************************************************************************/ -/* - * MMU-less operation case first - */ -#ifndef CONFIG_MMU - -#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 }) - -#define ZERO_PAGE(vaddr) ({ BUG(); NULL; }) - -#define swapper_pg_dir ((pgd_t *) NULL) - -#define pgtable_cache_init() do {} while (0) - -#include - -#else /* !CONFIG_MMU */ -/*****************************************************************************/ -/* - * then MMU operation - */ - -/* - * ZERO_PAGE is a global shared page that is always zero: used - * for zero-mapped memory areas etc.. - */ -#ifndef __ASSEMBLY__ -extern unsigned long empty_zero_page; -#define ZERO_PAGE(vaddr) virt_to_page(empty_zero_page) -#endif - -/* - * we use 2-level page tables, folding the PMD (mid-level table) into the PGE (top-level entry) - * [see Documentation/frv/mmu-layout.txt] - * - * Page Directory: - * - Size: 16KB - * - 64 PGEs per PGD - * - Each PGE holds 1 PUD and covers 64MB - * - * Page Upper Directory: - * - Size: 256B - * - 1 PUE per PUD - * - Each PUE holds 1 PMD and covers 64MB - * - * Page Mid-Level Directory - * - Size: 256B - * - 1 PME per PMD - * - Each PME holds 64 STEs, all of which point to separate chunks of the same Page Table - * - All STEs are instantiated at the same time - * - * Page Table - * - Size: 16KB - * - 4096 PTEs per PT - * - Each Linux PT is subdivided into 64 FR451 PT's, each of which holds 64 entries - * - * Pages - * - Size: 4KB - * - * total PTEs - * = 1 PML4E * 64 PGEs * 1 PUEs * 1 PMEs * 4096 PTEs - * = 1 PML4E * 64 PGEs * 64 STEs * 64 PTEs/FR451-PT - * = 262144 (or 256 * 1024) - */ -#define PGDIR_SHIFT 26 -#define PGDIR_SIZE (1UL << PGDIR_SHIFT) -#define PGDIR_MASK (~(PGDIR_SIZE - 1)) -#define PTRS_PER_PGD 64 - -#define __PAGETABLE_PUD_FOLDED -#define PUD_SHIFT 26 -#define PTRS_PER_PUD 1 -#define PUD_SIZE (1UL << PUD_SHIFT) -#define PUD_MASK (~(PUD_SIZE - 1)) -#define PUE_SIZE 256 - -#define __PAGETABLE_PMD_FOLDED -#define PMD_SHIFT 26 -#define PMD_SIZE (1UL << PMD_SHIFT) -#define PMD_MASK (~(PMD_SIZE - 1)) -#define PTRS_PER_PMD 1 -#define PME_SIZE 256 - -#define __frv_PT_SIZE 256 - -#define PTRS_PER_PTE 4096 - -#define USER_PGDS_IN_LAST_PML4 (TASK_SIZE / PGDIR_SIZE) -#define FIRST_USER_ADDRESS 0UL - -#define USER_PGD_PTRS (PAGE_OFFSET >> PGDIR_SHIFT) -#define KERNEL_PGD_PTRS (PTRS_PER_PGD - USER_PGD_PTRS) - -#define TWOLEVEL_PGDIR_SHIFT 26 -#define BOOT_USER_PGD_PTRS (__PAGE_OFFSET >> TWOLEVEL_PGDIR_SHIFT) -#define BOOT_KERNEL_PGD_PTRS (PTRS_PER_PGD - BOOT_USER_PGD_PTRS) - -#ifndef __ASSEMBLY__ - -extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; - -#define pte_ERROR(e) \ - printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, (e).pte) -#define pmd_ERROR(e) \ - printk("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, pmd_val(e)) -#define pud_ERROR(e) \ - printk("%s:%d: bad pud %08lx.\n", __FILE__, __LINE__, pmd_val(pud_val(e))) -#define pgd_ERROR(e) \ - printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pmd_val(pud_val(pgd_val(e)))) - -/* - * Certain architectures need to do special things when PTEs - * within a page table are directly modified. Thus, the following - * hook is made available. - */ -#define set_pte(pteptr, pteval) \ -do { \ - *(pteptr) = (pteval); \ - asm volatile("dcf %M0" :: "U"(*pteptr)); \ -} while(0) -#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval) - -/* - * pgd_offset() returns a (pgd_t *) - * pgd_index() is used get the offset into the pgd page's array of pgd_t's; - */ -#define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address)) - -/* - * a shortcut which implies the use of the kernel's pgd, instead - * of a process's - */ -#define pgd_offset_k(address) pgd_offset(&init_mm, address) - -/* - * The "pgd_xxx()" functions here are trivial for a folded two-level - * setup: the pud is never bad, and a pud always exists (as it's folded - * into the pgd entry) - */ -static inline int pgd_none(pgd_t pgd) { return 0; } -static inline int pgd_bad(pgd_t pgd) { return 0; } -static inline int pgd_present(pgd_t pgd) { return 1; } -static inline void pgd_clear(pgd_t *pgd) { } - -#define pgd_populate(mm, pgd, pud) do { } while (0) -/* - * (puds are folded into pgds so this doesn't get actually called, - * but the define is needed for a generic inline function.) - */ -#define set_pgd(pgdptr, pgdval) \ -do { \ - memcpy((pgdptr), &(pgdval), sizeof(pgd_t)); \ - asm volatile("dcf %M0" :: "U"(*(pgdptr))); \ -} while(0) - -static inline pud_t *pud_offset(pgd_t *pgd, unsigned long address) -{ - return (pud_t *) pgd; -} - -#define pgd_page(pgd) (pud_page((pud_t){ pgd })) -#define pgd_page_vaddr(pgd) (pud_page_vaddr((pud_t){ pgd })) - -/* - * allocating and freeing a pud is trivial: the 1-entry pud is - * inside the pgd, so has no extra memory associated with it. - */ -#define pud_alloc_one(mm, address) NULL -#define pud_free(mm, x) do { } while (0) -#define __pud_free_tlb(tlb, x, address) do { } while (0) - -/* - * The "pud_xxx()" functions here are trivial for a folded two-level - * setup: the pmd is never bad, and a pmd always exists (as it's folded - * into the pud entry) - */ -static inline int pud_none(pud_t pud) { return 0; } -static inline int pud_bad(pud_t pud) { return 0; } -static inline int pud_present(pud_t pud) { return 1; } -static inline void pud_clear(pud_t *pud) { } - -#define pud_populate(mm, pmd, pte) do { } while (0) - -/* - * (pmds are folded into puds so this doesn't get actually called, - * but the define is needed for a generic inline function.) - */ -#define set_pud(pudptr, pudval) set_pmd((pmd_t *)(pudptr), (pmd_t) { pudval }) - -#define pud_page(pud) (pmd_page((pmd_t){ pud })) -#define pud_page_vaddr(pud) (pmd_page_vaddr((pmd_t){ pud })) - -/* - * (pmds are folded into pgds so this doesn't get actually called, - * but the define is needed for a generic inline function.) - */ -extern void __set_pmd(pmd_t *pmdptr, unsigned long __pmd); - -#define set_pmd(pmdptr, pmdval) \ -do { \ - __set_pmd((pmdptr), (pmdval).ste[0]); \ -} while(0) - -#define __pmd_index(address) 0 - -static inline pmd_t *pmd_offset(pud_t *dir, unsigned long address) -{ - return (pmd_t *) dir + __pmd_index(address); -} - -#define pte_same(a, b) ((a).pte == (b).pte) -#define pte_page(x) (mem_map + ((unsigned long)(((x).pte >> PAGE_SHIFT)))) -#define pte_none(x) (!(x).pte) -#define pte_pfn(x) ((unsigned long)(((x).pte >> PAGE_SHIFT))) -#define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) -#define pfn_pmd(pfn, prot) __pmd(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) - -#define VMALLOC_VMADDR(x) ((unsigned long) (x)) - -#endif /* !__ASSEMBLY__ */ - -/* - * control flags in AMPR registers and TLB entries - */ -#define _PAGE_BIT_PRESENT xAMPRx_V_BIT -#define _PAGE_BIT_WP DAMPRx_WP_BIT -#define _PAGE_BIT_NOCACHE xAMPRx_C_BIT -#define _PAGE_BIT_SUPER xAMPRx_S_BIT -#define _PAGE_BIT_ACCESSED xAMPRx_RESERVED8_BIT -#define _PAGE_BIT_DIRTY xAMPRx_M_BIT -#define _PAGE_BIT_NOTGLOBAL xAMPRx_NG_BIT - -#define _PAGE_PRESENT xAMPRx_V -#define _PAGE_WP DAMPRx_WP -#define _PAGE_NOCACHE xAMPRx_C -#define _PAGE_SUPER xAMPRx_S -#define _PAGE_ACCESSED xAMPRx_RESERVED8 /* accessed if set */ -#define _PAGE_DIRTY xAMPRx_M -#define _PAGE_NOTGLOBAL xAMPRx_NG - -#define _PAGE_RESERVED_MASK (xAMPRx_RESERVED8 | xAMPRx_RESERVED13) - -#define _PAGE_PROTNONE 0x000 /* If not present */ - -#define _PAGE_CHG_MASK (PTE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY) - -#define __PGPROT_BASE \ - (_PAGE_PRESENT | xAMPRx_SS_16Kb | xAMPRx_D | _PAGE_NOTGLOBAL | _PAGE_ACCESSED) - -#define PAGE_NONE __pgprot(_PAGE_PROTNONE | _PAGE_ACCESSED) -#define PAGE_SHARED __pgprot(__PGPROT_BASE) -#define PAGE_COPY __pgprot(__PGPROT_BASE | _PAGE_WP) -#define PAGE_READONLY __pgprot(__PGPROT_BASE | _PAGE_WP) - -#define __PAGE_KERNEL (__PGPROT_BASE | _PAGE_SUPER | _PAGE_DIRTY) -#define __PAGE_KERNEL_NOCACHE (__PGPROT_BASE | _PAGE_SUPER | _PAGE_DIRTY | _PAGE_NOCACHE) -#define __PAGE_KERNEL_RO (__PGPROT_BASE | _PAGE_SUPER | _PAGE_DIRTY | _PAGE_WP) - -#define MAKE_GLOBAL(x) __pgprot((x) & ~_PAGE_NOTGLOBAL) - -#define PAGE_KERNEL MAKE_GLOBAL(__PAGE_KERNEL) -#define PAGE_KERNEL_RO MAKE_GLOBAL(__PAGE_KERNEL_RO) -#define PAGE_KERNEL_NOCACHE MAKE_GLOBAL(__PAGE_KERNEL_NOCACHE) - -#define _PAGE_TABLE (_PAGE_PRESENT | xAMPRx_SS_16Kb) - -#ifndef __ASSEMBLY__ - -/* - * The FR451 can do execute protection by virtue of having separate TLB miss handlers for - * instruction access and for data access. However, we don't have enough reserved bits to say - * "execute only", so we don't bother. If you can read it, you can execute it and vice versa. - */ -#define __P000 PAGE_NONE -#define __P001 PAGE_READONLY -#define __P010 PAGE_COPY -#define __P011 PAGE_COPY -#define __P100 PAGE_READONLY -#define __P101 PAGE_READONLY -#define __P110 PAGE_COPY -#define __P111 PAGE_COPY - -#define __S000 PAGE_NONE -#define __S001 PAGE_READONLY -#define __S010 PAGE_SHARED -#define __S011 PAGE_SHARED -#define __S100 PAGE_READONLY -#define __S101 PAGE_READONLY -#define __S110 PAGE_SHARED -#define __S111 PAGE_SHARED - -/* - * Define this to warn about kernel memory accesses that are - * done without a 'access_ok(VERIFY_WRITE,..)' - */ -#undef TEST_ACCESS_OK - -#define pte_present(x) (pte_val(x) & _PAGE_PRESENT) -#define pte_clear(mm,addr,xp) do { set_pte_at(mm, addr, xp, __pte(0)); } while (0) - -#define pmd_none(x) (!pmd_val(x)) -#define pmd_present(x) (pmd_val(x) & _PAGE_PRESENT) -#define pmd_bad(x) (pmd_val(x) & xAMPRx_SS) -#define pmd_clear(xp) do { __set_pmd(xp, 0); } while(0) - -#define pmd_page_vaddr(pmd) \ - ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) - -#ifndef CONFIG_DISCONTIGMEM -#define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)) -#endif - -#define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT)) - -/* - * The following only work if pte_present() is true. - * Undefined behaviour if not.. - */ -static inline int pte_dirty(pte_t pte) { return (pte).pte & _PAGE_DIRTY; } -static inline int pte_young(pte_t pte) { return (pte).pte & _PAGE_ACCESSED; } -static inline int pte_write(pte_t pte) { return !((pte).pte & _PAGE_WP); } -static inline int pte_special(pte_t pte) { return 0; } - -static inline pte_t pte_mkclean(pte_t pte) { (pte).pte &= ~_PAGE_DIRTY; return pte; } -static inline pte_t pte_mkold(pte_t pte) { (pte).pte &= ~_PAGE_ACCESSED; return pte; } -static inline pte_t pte_wrprotect(pte_t pte) { (pte).pte |= _PAGE_WP; return pte; } -static inline pte_t pte_mkdirty(pte_t pte) { (pte).pte |= _PAGE_DIRTY; return pte; } -static inline pte_t pte_mkyoung(pte_t pte) { (pte).pte |= _PAGE_ACCESSED; return pte; } -static inline pte_t pte_mkwrite(pte_t pte) { (pte).pte &= ~_PAGE_WP; return pte; } -static inline pte_t pte_mkspecial(pte_t pte) { return pte; } - -static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep) -{ - int i = test_and_clear_bit(_PAGE_BIT_ACCESSED, ptep); - asm volatile("dcf %M0" :: "U"(*ptep)); - return i; -} - -static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) -{ - unsigned long x = xchg(&ptep->pte, 0); - asm volatile("dcf %M0" :: "U"(*ptep)); - return __pte(x); -} - -static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep) -{ - set_bit(_PAGE_BIT_WP, ptep); - asm volatile("dcf %M0" :: "U"(*ptep)); -} - -/* - * Macro to mark a page protection value as "uncacheable" - */ -#define pgprot_noncached(prot) (__pgprot(pgprot_val(prot) | _PAGE_NOCACHE)) - -/* - * Conversion functions: convert a page and protection to a page entry, - * and a page entry and page directory to the page they refer to. - */ - -#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot)) -#define mk_pte_huge(entry) ((entry).pte_low |= _PAGE_PRESENT | _PAGE_PSE) - -/* This takes a physical page address that is used by the remapping functions */ -#define mk_pte_phys(physpage, pgprot) pfn_pte((physpage) >> PAGE_SHIFT, pgprot) - -static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) -{ - pte.pte &= _PAGE_CHG_MASK; - pte.pte |= pgprot_val(newprot); - return pte; -} - -/* to find an entry in a page-table-directory. */ -#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1)) -#define pgd_index_k(addr) pgd_index(addr) - -/* Find an entry in the bottom-level page table.. */ -#define __pte_index(address) (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) - -/* - * the pte page can be thought of an array like this: pte_t[PTRS_PER_PTE] - * - * this macro returns the index of the entry in the pte page which would - * control the given virtual address - */ -#define pte_index(address) \ - (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) -#define pte_offset_kernel(dir, address) \ - ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address)) - -#if defined(CONFIG_HIGHPTE) -#define pte_offset_map(dir, address) \ - ((pte_t *)kmap_atomic(pmd_page(*(dir))) + pte_index(address)) -#define pte_unmap(pte) kunmap_atomic(pte) -#else -#define pte_offset_map(dir, address) \ - ((pte_t *)page_address(pmd_page(*(dir))) + pte_index(address)) -#define pte_unmap(pte) do { } while (0) -#endif - -/* - * Handle swap and file entries - * - the PTE is encoded in the following format: - * bit 0: Must be 0 (!_PAGE_PRESENT) - * bits 1-6: Swap type - * bits 7-31: Swap offset - */ -#define __swp_type(x) (((x).val >> 1) & 0x1f) -#define __swp_offset(x) ((x).val >> 7) -#define __swp_entry(type, offset) ((swp_entry_t) { ((type) << 1) | ((offset) << 7) }) -#define __pte_to_swp_entry(_pte) ((swp_entry_t) { (_pte).pte }) -#define __swp_entry_to_pte(x) ((pte_t) { (x).val }) - -/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */ -#define PageSkip(page) (0) -#define kern_addr_valid(addr) (1) - -#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG -#define __HAVE_ARCH_PTEP_GET_AND_CLEAR -#define __HAVE_ARCH_PTEP_SET_WRPROTECT -#define __HAVE_ARCH_PTE_SAME -#include - -/* - * preload information about a newly instantiated PTE into the SCR0/SCR1 PGE cache - */ -static inline void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t *ptep) -{ - struct mm_struct *mm; - unsigned long ampr; - - mm = current->mm; - if (mm) { - pgd_t *pge = pgd_offset(mm, address); - pud_t *pue = pud_offset(pge, address); - pmd_t *pme = pmd_offset(pue, address); - - ampr = pme->ste[0] & 0xffffff00; - ampr |= xAMPRx_L | xAMPRx_SS_16Kb | xAMPRx_S | xAMPRx_C | - xAMPRx_V; - } else { - address = ULONG_MAX; - ampr = 0; - } - - asm volatile("movgs %0,scr0\n" - "movgs %0,scr1\n" - "movgs %1,dampr4\n" - "movgs %1,dampr5\n" - : - : "r"(address), "r"(ampr) - ); -} - -#ifdef CONFIG_PROC_FS -extern char *proc_pid_status_frv_cxnr(struct mm_struct *mm, char *buffer); -#endif - -extern void __init pgtable_cache_init(void); - -#endif /* !__ASSEMBLY__ */ -#endif /* !CONFIG_MMU */ - -#ifndef __ASSEMBLY__ -extern void __init paging_init(void); -#endif /* !__ASSEMBLY__ */ -#define HAVE_ARCH_UNMAPPED_AREA - -#endif /* _ASM_PGTABLE_H */ diff --git a/arch/frv/include/asm/processor.h b/arch/frv/include/asm/processor.h deleted file mode 100644 index 021cce78b4010..0000000000000 --- a/arch/frv/include/asm/processor.h +++ /dev/null @@ -1,110 +0,0 @@ -/* processor.h: FRV processor definitions - * - * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#ifndef _ASM_PROCESSOR_H -#define _ASM_PROCESSOR_H - -#include - -#ifndef __ASSEMBLY__ -/* - * Default implementation of macro that returns current - * instruction pointer ("program counter"). - */ -#define current_text_addr() ({ __label__ _l; _l: &&_l;}) - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* Forward declaration, a strange C thing */ -struct task_struct; - -/* - * Bus types - */ -#define EISA_bus 0 - -struct thread_struct { - struct pt_regs *frame; /* [GR28] exception frame ptr for this thread */ - struct task_struct *curr; /* [GR29] current pointer for this thread */ - unsigned long sp; /* [GR1 ] kernel stack pointer */ - unsigned long fp; /* [GR2 ] kernel frame pointer */ - unsigned long lr; /* link register */ - unsigned long pc; /* program counter */ - unsigned long gr[12]; /* [GR16-GR27] */ - unsigned long sched_lr; /* LR from schedule() */ - - union { - struct pt_regs *frame0; /* top (user) stack frame */ - struct user_context *user; /* userspace context */ - }; -} __attribute__((aligned(8))); - -extern struct pt_regs *__kernel_frame0_ptr; -extern struct task_struct *__kernel_current_task; - -#endif - -#ifndef __ASSEMBLY__ -#define INIT_THREAD_FRAME0 \ - ((struct pt_regs *) \ - (sizeof(init_stack) + (unsigned long) init_stack - sizeof(struct user_context))) - -#define INIT_THREAD { \ - NULL, \ - (struct task_struct *) init_stack, \ - 0, 0, 0, 0, \ - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, \ - 0, \ - { INIT_THREAD_FRAME0 }, \ -} - -/* - * do necessary setup to start up a newly executed thread. - */ -#define start_thread(_regs, _pc, _usp) \ -do { \ - _regs->pc = (_pc); \ - _regs->psr &= ~PSR_S; \ - _regs->sp = (_usp); \ -} while(0) - -/* Free all resources held by a thread. */ -static inline void release_thread(struct task_struct *dead_task) -{ -} - -extern asmlinkage void save_user_regs(struct user_context *target); -extern asmlinkage void *restore_user_regs(const struct user_context *target, ...); - -unsigned long get_wchan(struct task_struct *p); - -#define KSTK_EIP(tsk) ((tsk)->thread.frame0->pc) -#define KSTK_ESP(tsk) ((tsk)->thread.frame0->sp) - -#define cpu_relax() barrier() - -/* data cache prefetch */ -#define ARCH_HAS_PREFETCH -static inline void prefetch(const void *x) -{ - asm volatile("dcpl %0,gr0,#0" : : "r"(x)); -} - -#endif /* __ASSEMBLY__ */ -#endif /* _ASM_PROCESSOR_H */ diff --git a/arch/frv/include/asm/ptrace.h b/arch/frv/include/asm/ptrace.h deleted file mode 100644 index 034f17934192d..0000000000000 --- a/arch/frv/include/asm/ptrace.h +++ /dev/null @@ -1,41 +0,0 @@ -/* ptrace.h: ptrace() relevant definitions - * - * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ -#ifndef _ASM_PTRACE_H -#define _ASM_PTRACE_H - -#include -#include - -#define in_syscall(regs) (((regs)->tbr & TBR_TT) == TBR_TT_TRAP0) -#ifndef __ASSEMBLY__ - -struct task_struct; - -/* - * we dedicate GR28 to keeping a pointer to the current exception frame - * - gr28 is destroyed on entry to the kernel from userspace - */ -register struct pt_regs *__frame asm("gr28"); - -#define user_mode(regs) (!((regs)->psr & PSR_S)) -#define instruction_pointer(regs) ((regs)->pc) -#define user_stack_pointer(regs) ((regs)->sp) -#define current_pt_regs() (__frame) - -extern unsigned long user_stack(const struct pt_regs *); -#define profile_pc(regs) ((regs)->pc) - -#define task_pt_regs(task) ((task)->thread.frame0) - -#define arch_has_single_step() (1) - -#endif /* !__ASSEMBLY__ */ -#endif /* _ASM_PTRACE_H */ diff --git a/arch/frv/include/asm/sections.h b/arch/frv/include/asm/sections.h deleted file mode 100644 index d03fb64e93e9c..0000000000000 --- a/arch/frv/include/asm/sections.h +++ /dev/null @@ -1,40 +0,0 @@ -/* sections.h: linkage layout variables - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#ifndef _ASM_SECTIONS_H -#define _ASM_SECTIONS_H - -#ifndef __ASSEMBLY__ - -#include -#include - -#ifdef __KERNEL__ - -/* - * we don't want to put variables in the GP-REL section if they're not used very much - that would - * be waste since GP-REL addressing is limited to GP16+/-2048 - */ -#define __nongpreldata __attribute__((section(".data"))) -#define __nongprelbss __attribute__((section(".bss"))) - -/* - * linker symbols - */ -extern const void __kernel_image_start, __kernel_image_end, __page_offset; - -extern unsigned long __nongprelbss memory_start; -extern unsigned long __nongprelbss memory_end; -extern unsigned long __nongprelbss rom_length; - -#endif -#endif -#endif /* _ASM_SECTIONS_H */ diff --git a/arch/frv/include/asm/segment.h b/arch/frv/include/asm/segment.h deleted file mode 100644 index 2305142d4cf87..0000000000000 --- a/arch/frv/include/asm/segment.h +++ /dev/null @@ -1,44 +0,0 @@ -/* segment.h: MMU segment settings - * - * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#ifndef _ASM_SEGMENT_H -#define _ASM_SEGMENT_H - - -#ifndef __ASSEMBLY__ - -typedef struct { - unsigned long seg; -} mm_segment_t; - -#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) }) - -#ifdef CONFIG_MMU -#define USER_DS MAKE_MM_SEG(TASK_SIZE - 1) -#define KERNEL_DS MAKE_MM_SEG(0xdfffffffUL) -#else -#define USER_DS MAKE_MM_SEG(memory_end) -#define KERNEL_DS MAKE_MM_SEG(0xe0000000UL) -#endif - -#define get_ds() (KERNEL_DS) -#define get_fs() (__current_thread_info->addr_limit) -#define segment_eq(a, b) ((a).seg == (b).seg) -#define get_addr_limit() (get_fs().seg) - -#define set_fs(_x) \ -do { \ - __current_thread_info->addr_limit = (_x); \ -} while(0) - - -#endif /* __ASSEMBLY__ */ -#endif /* _ASM_SEGMENT_H */ diff --git a/arch/frv/include/asm/serial-regs.h b/arch/frv/include/asm/serial-regs.h deleted file mode 100644 index e1286bda00eb3..0000000000000 --- a/arch/frv/include/asm/serial-regs.h +++ /dev/null @@ -1,44 +0,0 @@ -/* serial-regs.h: serial port registers - * - * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#ifndef _ASM_SERIAL_REGS_H -#define _ASM_SERIAL_REGS_H - -#include -#include - -#define SERIAL_ICLK 33333333 /* the target serial input clock */ -#define UART0_BASE 0xfeff9c00 -#define UART1_BASE 0xfeff9c40 - -#define __get_UART0(R) ({ __reg(UART0_BASE + (R) * 8) >> 24; }) -#define __get_UART1(R) ({ __reg(UART1_BASE + (R) * 8) >> 24; }) -#define __set_UART0(R,V) do { __reg(UART0_BASE + (R) * 8) = (V) << 24; } while(0) -#define __set_UART1(R,V) do { __reg(UART1_BASE + (R) * 8) = (V) << 24; } while(0) - -#define __get_UART0_LSR() ({ __get_UART0(UART_LSR); }) -#define __get_UART1_LSR() ({ __get_UART1(UART_LSR); }) - -#define __set_UART0_IER(V) __set_UART0(UART_IER,(V)) -#define __set_UART1_IER(V) __set_UART1(UART_IER,(V)) - -/* serial prescaler select register */ -#define __get_UCPSR() ({ *(volatile unsigned long *)(0xfeff9c90); }) -#define __set_UCPSR(V) do { *(volatile unsigned long *)(0xfeff9c90) = (V); } while(0) -#define UCPSR_SELECT0 0x07000000 -#define UCPSR_SELECT1 0x38000000 - -/* serial prescaler base value register */ -#define __get_UCPVR() ({ *(volatile unsigned long *)(0xfeff9c98); mb(); }) -#define __set_UCPVR(V) do { *(volatile unsigned long *)(0xfeff9c98) = (V) << 24; mb(); } while(0) - - -#endif /* _ASM_SERIAL_REGS_H */ diff --git a/arch/frv/include/asm/serial.h b/arch/frv/include/asm/serial.h deleted file mode 100644 index 614c6d76789a1..0000000000000 --- a/arch/frv/include/asm/serial.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * serial.h - * - * Copyright (C) 2003 Develer S.r.l. (http://www.develer.com/) - * Author: Bernardo Innocenti - * - * Based on linux/include/asm-i386/serial.h - */ -#include - -/* - * the base baud is derived from the clock speed and so is variable - */ -#define BASE_BAUD 0 diff --git a/arch/frv/include/asm/setup.h b/arch/frv/include/asm/setup.h deleted file mode 100644 index aa76f2eac09ac..0000000000000 --- a/arch/frv/include/asm/setup.h +++ /dev/null @@ -1,26 +0,0 @@ -/* setup.h: setup stuff - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ -#ifndef _ASM_SETUP_H -#define _ASM_SETUP_H - - -#include -#include - -#ifndef __ASSEMBLY__ - -#ifdef CONFIG_MMU -extern unsigned long __initdata num_mappedpages; -#endif - -#endif /* !__ASSEMBLY__ */ - -#endif /* _ASM_SETUP_H */ diff --git a/arch/frv/include/asm/shmparam.h b/arch/frv/include/asm/shmparam.h deleted file mode 100644 index 50ea51f26c46b..0000000000000 --- a/arch/frv/include/asm/shmparam.h +++ /dev/null @@ -1,8 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_SHMPARAM_H -#define _ASM_SHMPARAM_H - -#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */ - -#endif /* _ASM_SHMPARAM_H */ - diff --git a/arch/frv/include/asm/signal.h b/arch/frv/include/asm/signal.h deleted file mode 100644 index 796394113904a..0000000000000 --- a/arch/frv/include/asm/signal.h +++ /dev/null @@ -1,7 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_SIGNAL_H -#define _ASM_SIGNAL_H - -#include - -#endif /* _ASM_SIGNAL_H */ diff --git a/arch/frv/include/asm/smp.h b/arch/frv/include/asm/smp.h deleted file mode 100644 index 0d7fa409312d8..0000000000000 --- a/arch/frv/include/asm/smp.h +++ /dev/null @@ -1,10 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __ASM_SMP_H -#define __ASM_SMP_H - - -#ifdef CONFIG_SMP -#error SMP not supported -#endif - -#endif diff --git a/arch/frv/include/asm/spinlock.h b/arch/frv/include/asm/spinlock.h deleted file mode 100644 index fe385f45d1fd3..0000000000000 --- a/arch/frv/include/asm/spinlock.h +++ /dev/null @@ -1,17 +0,0 @@ -/* spinlock.h: spinlocks for FR-V - * - * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#ifndef _ASM_SPINLOCK_H -#define _ASM_SPINLOCK_H - -#error no spinlocks for FR-V yet - -#endif /* _ASM_SPINLOCK_H */ diff --git a/arch/frv/include/asm/spr-regs.h b/arch/frv/include/asm/spr-regs.h deleted file mode 100644 index d3883021f2364..0000000000000 --- a/arch/frv/include/asm/spr-regs.h +++ /dev/null @@ -1,416 +0,0 @@ -/* spr-regs.h: special-purpose registers on the FRV - * - * Copyright (C) 2003, 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#ifndef _ASM_SPR_REGS_H -#define _ASM_SPR_REGS_H - -/* - * PSR - Processor Status Register - */ -#define PSR_ET 0x00000001 /* enable interrupts/exceptions flag */ -#define PSR_PS 0x00000002 /* previous supervisor mode flag */ -#define PSR_S 0x00000004 /* supervisor mode flag */ -#define PSR_PIL 0x00000078 /* processor external interrupt level */ -#define PSR_PIL_0 0x00000000 /* - no interrupt in progress */ -#define PSR_PIL_13 0x00000068 /* - debugging only */ -#define PSR_PIL_14 0x00000070 /* - debugging in progress */ -#define PSR_PIL_15 0x00000078 /* - NMI in progress */ -#define PSR_EM 0x00000080 /* enable media operation */ -#define PSR_EF 0x00000100 /* enable FPU operation */ -#define PSR_BE 0x00001000 /* endianness mode */ -#define PSR_BE_LE 0x00000000 /* - little endian mode */ -#define PSR_BE_BE 0x00001000 /* - big endian mode */ -#define PSR_CM 0x00002000 /* conditional mode */ -#define PSR_NEM 0x00004000 /* non-excepting mode */ -#define PSR_ICE 0x00010000 /* in-circuit emulation mode */ -#define PSR_VERSION_SHIFT 24 /* CPU silicon ID */ -#define PSR_IMPLE_SHIFT 28 /* CPU core ID */ - -#define PSR_VERSION(psr) (((psr) >> PSR_VERSION_SHIFT) & 0xf) -#define PSR_IMPLE(psr) (((psr) >> PSR_IMPLE_SHIFT) & 0xf) - -#define PSR_IMPLE_FR401 0x2 -#define PSR_VERSION_FR401_MB93401 0x0 -#define PSR_VERSION_FR401_MB93401A 0x1 -#define PSR_VERSION_FR401_MB93403 0x2 - -#define PSR_IMPLE_FR405 0x4 -#define PSR_VERSION_FR405_MB93405 0x0 - -#define PSR_IMPLE_FR451 0x5 -#define PSR_VERSION_FR451_MB93451 0x0 - -#define PSR_IMPLE_FR501 0x1 -#define PSR_VERSION_FR501_MB93501 0x1 -#define PSR_VERSION_FR501_MB93501A 0x2 - -#define PSR_IMPLE_FR551 0x3 -#define PSR_VERSION_FR551_MB93555 0x1 - -#define __get_PSR() ({ unsigned long x; asm volatile("movsg psr,%0" : "=r"(x)); x; }) -#define __set_PSR(V) do { asm volatile("movgs %0,psr" : : "r"(V)); } while(0) - -/* - * TBR - Trap Base Register - */ -#define TBR_TT 0x00000ff0 -#define TBR_TT_INSTR_MMU_MISS (0x01 << 4) -#define TBR_TT_INSTR_ACC_ERROR (0x02 << 4) -#define TBR_TT_INSTR_ACC_EXCEP (0x03 << 4) -#define TBR_TT_PRIV_INSTR (0x06 << 4) -#define TBR_TT_ILLEGAL_INSTR (0x07 << 4) -#define TBR_TT_FP_EXCEPTION (0x0d << 4) -#define TBR_TT_MP_EXCEPTION (0x0e << 4) -#define TBR_TT_DATA_ACC_ERROR (0x11 << 4) -#define TBR_TT_DATA_MMU_MISS (0x12 << 4) -#define TBR_TT_DATA_ACC_EXCEP (0x13 << 4) -#define TBR_TT_DATA_STR_ERROR (0x14 << 4) -#define TBR_TT_DIVISION_EXCEP (0x17 << 4) -#define TBR_TT_COMMIT_EXCEP (0x19 << 4) -#define TBR_TT_INSTR_TLB_MISS (0x1a << 4) -#define TBR_TT_DATA_TLB_MISS (0x1b << 4) -#define TBR_TT_DATA_DAT_EXCEP (0x1d << 4) -#define TBR_TT_DECREMENT_TIMER (0x1f << 4) -#define TBR_TT_COMPOUND_EXCEP (0x20 << 4) -#define TBR_TT_INTERRUPT_1 (0x21 << 4) -#define TBR_TT_INTERRUPT_2 (0x22 << 4) -#define TBR_TT_INTERRUPT_3 (0x23 << 4) -#define TBR_TT_INTERRUPT_4 (0x24 << 4) -#define TBR_TT_INTERRUPT_5 (0x25 << 4) -#define TBR_TT_INTERRUPT_6 (0x26 << 4) -#define TBR_TT_INTERRUPT_7 (0x27 << 4) -#define TBR_TT_INTERRUPT_8 (0x28 << 4) -#define TBR_TT_INTERRUPT_9 (0x29 << 4) -#define TBR_TT_INTERRUPT_10 (0x2a << 4) -#define TBR_TT_INTERRUPT_11 (0x2b << 4) -#define TBR_TT_INTERRUPT_12 (0x2c << 4) -#define TBR_TT_INTERRUPT_13 (0x2d << 4) -#define TBR_TT_INTERRUPT_14 (0x2e << 4) -#define TBR_TT_INTERRUPT_15 (0x2f << 4) -#define TBR_TT_TRAP0 (0x80 << 4) -#define TBR_TT_TRAP1 (0x81 << 4) -#define TBR_TT_TRAP2 (0x82 << 4) -#define TBR_TT_TRAP3 (0x83 << 4) -#define TBR_TT_TRAP120 (0xf8 << 4) -#define TBR_TT_TRAP121 (0xf9 << 4) -#define TBR_TT_TRAP122 (0xfa << 4) -#define TBR_TT_TRAP123 (0xfb << 4) -#define TBR_TT_TRAP124 (0xfc << 4) -#define TBR_TT_TRAP125 (0xfd << 4) -#define TBR_TT_TRAP126 (0xfe << 4) -#define TBR_TT_BREAK (0xff << 4) - -#define TBR_TT_ATOMIC_CMPXCHG32 TBR_TT_TRAP120 -#define TBR_TT_ATOMIC_XCHG32 TBR_TT_TRAP121 -#define TBR_TT_ATOMIC_XOR TBR_TT_TRAP122 -#define TBR_TT_ATOMIC_OR TBR_TT_TRAP123 -#define TBR_TT_ATOMIC_AND TBR_TT_TRAP124 -#define TBR_TT_ATOMIC_SUB TBR_TT_TRAP125 -#define TBR_TT_ATOMIC_ADD TBR_TT_TRAP126 - -#define __get_TBR() ({ unsigned long x; asm volatile("movsg tbr,%0" : "=r"(x)); x; }) - -/* - * HSR0 - Hardware Status Register 0 - */ -#define HSR0_PDM 0x00000007 /* power down mode */ -#define HSR0_PDM_NORMAL 0x00000000 /* - normal mode */ -#define HSR0_PDM_CORE_SLEEP 0x00000001 /* - CPU core sleep mode */ -#define HSR0_PDM_BUS_SLEEP 0x00000003 /* - bus sleep mode */ -#define HSR0_PDM_PLL_RUN 0x00000005 /* - PLL run */ -#define HSR0_PDM_PLL_STOP 0x00000007 /* - PLL stop */ -#define HSR0_GRLE 0x00000040 /* GR lower register set enable */ -#define HSR0_GRHE 0x00000080 /* GR higher register set enable */ -#define HSR0_FRLE 0x00000100 /* FR lower register set enable */ -#define HSR0_FRHE 0x00000200 /* FR higher register set enable */ -#define HSR0_GRN 0x00000400 /* GR quantity */ -#define HSR0_GRN_64 0x00000000 /* - 64 GR registers */ -#define HSR0_GRN_32 0x00000400 /* - 32 GR registers */ -#define HSR0_FRN 0x00000800 /* FR quantity */ -#define HSR0_FRN_64 0x00000000 /* - 64 FR registers */ -#define HSR0_FRN_32 0x00000800 /* - 32 FR registers */ -#define HSR0_SA 0x00001000 /* start address (RAMBOOT#) */ -#define HSR0_ETMI 0x00008000 /* enable TIMERI (64-bit up timer) */ -#define HSR0_ETMD 0x00004000 /* enable TIMERD (32-bit down timer) */ -#define HSR0_PEDAT 0x00010000 /* previous DAT mode */ -#define HSR0_XEDAT 0x00020000 /* exception DAT mode */ -#define HSR0_EDAT 0x00080000 /* enable DAT mode */ -#define HSR0_RME 0x00400000 /* enable RAM mode */ -#define HSR0_EMEM 0x00800000 /* enable MMU_Miss mask */ -#define HSR0_EXMMU 0x01000000 /* enable extended MMU mode */ -#define HSR0_EDMMU 0x02000000 /* enable data MMU */ -#define HSR0_EIMMU 0x04000000 /* enable instruction MMU */ -#define HSR0_CBM 0x08000000 /* copy back mode */ -#define HSR0_CBM_WRITE_THRU 0x00000000 /* - write through */ -#define HSR0_CBM_COPY_BACK 0x08000000 /* - copy back */ -#define HSR0_NWA 0x10000000 /* no write allocate */ -#define HSR0_DCE 0x40000000 /* data cache enable */ -#define HSR0_ICE 0x80000000 /* instruction cache enable */ - -#define __get_HSR(R) ({ unsigned long x; asm volatile("movsg hsr"#R",%0" : "=r"(x)); x; }) -#define __set_HSR(R,V) do { asm volatile("movgs %0,hsr"#R : : "r"(V)); } while(0) - -/* - * CCR - Condition Codes Register - */ -#define CCR_FCC0 0x0000000f /* FP/Media condition 0 (fcc0 reg) */ -#define CCR_FCC1 0x000000f0 /* FP/Media condition 1 (fcc1 reg) */ -#define CCR_FCC2 0x00000f00 /* FP/Media condition 2 (fcc2 reg) */ -#define CCR_FCC3 0x0000f000 /* FP/Media condition 3 (fcc3 reg) */ -#define CCR_ICC0 0x000f0000 /* Integer condition 0 (icc0 reg) */ -#define CCR_ICC0_C 0x00010000 /* - Carry flag */ -#define CCR_ICC0_V 0x00020000 /* - Overflow flag */ -#define CCR_ICC0_Z 0x00040000 /* - Zero flag */ -#define CCR_ICC0_N 0x00080000 /* - Negative flag */ -#define CCR_ICC1 0x00f00000 /* Integer condition 1 (icc1 reg) */ -#define CCR_ICC2 0x0f000000 /* Integer condition 2 (icc2 reg) */ -#define CCR_ICC3 0xf0000000 /* Integer condition 3 (icc3 reg) */ - -/* - * CCCR - Condition Codes for Conditional Instructions Register - */ -#define CCCR_CC0 0x00000003 /* condition 0 (cc0 reg) */ -#define CCCR_CC0_FALSE 0x00000002 /* - condition is false */ -#define CCCR_CC0_TRUE 0x00000003 /* - condition is true */ -#define CCCR_CC1 0x0000000c /* condition 1 (cc1 reg) */ -#define CCCR_CC2 0x00000030 /* condition 2 (cc2 reg) */ -#define CCCR_CC3 0x000000c0 /* condition 3 (cc3 reg) */ -#define CCCR_CC4 0x00000300 /* condition 4 (cc4 reg) */ -#define CCCR_CC5 0x00000c00 /* condition 5 (cc5 reg) */ -#define CCCR_CC6 0x00003000 /* condition 6 (cc6 reg) */ -#define CCCR_CC7 0x0000c000 /* condition 7 (cc7 reg) */ - -/* - * ISR - Integer Status Register - */ -#define ISR_EMAM 0x00000001 /* memory misaligned access handling */ -#define ISR_EMAM_EXCEPTION 0x00000000 /* - generate exception */ -#define ISR_EMAM_FUDGE 0x00000001 /* - mask out invalid address bits */ -#define ISR_AEXC 0x00000004 /* accrued [overflow] exception */ -#define ISR_DTT 0x00000018 /* division type trap */ -#define ISR_DTT_IGNORE 0x00000000 /* - ignore division error */ -#define ISR_DTT_DIVBYZERO 0x00000008 /* - generate exception */ -#define ISR_DTT_OVERFLOW 0x00000010 /* - record overflow */ -#define ISR_EDE 0x00000020 /* enable division exception */ -#define ISR_PLI 0x20000000 /* pre-load instruction information */ -#define ISR_QI 0x80000000 /* quad data implementation information */ - -/* - * EPCR0 - Exception PC Register - */ -#define EPCR0_V 0x00000001 /* register content validity indicator */ -#define EPCR0_PC 0xfffffffc /* faulting instruction address */ - -/* - * ESR0/14/15 - Exception Status Register - */ -#define ESRx_VALID 0x00000001 /* register content validity indicator */ -#define ESRx_EC 0x0000003e /* exception type */ -#define ESRx_EC_DATA_STORE 0x00000000 /* - data_store_error */ -#define ESRx_EC_INSN_ACCESS 0x00000006 /* - instruction_access_error */ -#define ESRx_EC_PRIV_INSN 0x00000008 /* - privileged_instruction */ -#define ESRx_EC_ILL_INSN 0x0000000a /* - illegal_instruction */ -#define ESRx_EC_MP_EXCEP 0x0000001c /* - mp_exception */ -#define ESRx_EC_DATA_ACCESS 0x00000020 /* - data_access_error */ -#define ESRx_EC_DIVISION 0x00000026 /* - division_exception */ -#define ESRx_EC_ITLB_MISS 0x00000034 /* - instruction_access_TLB_miss */ -#define ESRx_EC_DTLB_MISS 0x00000036 /* - data_access_TLB_miss */ -#define ESRx_EC_DATA_ACCESS_DAT 0x0000003a /* - data_access_DAT_exception */ - -#define ESR0_IAEC 0x00000100 /* info for instruction-access-exception */ -#define ESR0_IAEC_RESV 0x00000000 /* - reserved */ -#define ESR0_IAEC_PROT_VIOL 0x00000100 /* - protection violation */ - -#define ESR0_ATXC 0x00f00000 /* address translation exception code */ -#define ESR0_ATXC_MMU_MISS 0x00000000 /* - MMU miss exception and more (?) */ -#define ESR0_ATXC_MULTI_DAT 0x00800000 /* - multiple DAT entry hit */ -#define ESR0_ATXC_MULTI_SAT 0x00900000 /* - multiple SAT entry hit */ -#define ESR0_ATXC_AMRTLB_MISS 0x00a00000 /* - MMU/TLB miss exception */ -#define ESR0_ATXC_PRIV_EXCEP 0x00c00000 /* - privilege protection fault */ -#define ESR0_ATXC_WP_EXCEP 0x00d00000 /* - write protection fault */ - -#define ESR0_EAV 0x00000800 /* true if EAR0 register valid */ -#define ESR15_EAV 0x00000800 /* true if EAR15 register valid */ - -/* - * ESFR1 - Exception Status Valid Flag Register - */ -#define ESFR1_ESR0 0x00000001 /* true if ESR0 is valid */ -#define ESFR1_ESR14 0x00004000 /* true if ESR14 is valid */ -#define ESFR1_ESR15 0x00008000 /* true if ESR15 is valid */ - -/* - * MSR - Media Status Register - */ -#define MSR0_AOVF 0x00000001 /* overflow exception accrued */ -#define MSRx_OVF 0x00000002 /* overflow exception detected */ -#define MSRx_SIE 0x0000003c /* last SIMD instruction exception detected */ -#define MSRx_SIE_NONE 0x00000000 /* - none detected */ -#define MSRx_SIE_FRkHI_ACCk 0x00000020 /* - exception at FRkHI or ACCk */ -#define MSRx_SIE_FRkLO_ACCk1 0x00000010 /* - exception at FRkLO or ACCk+1 */ -#define MSRx_SIE_FRk1HI_ACCk2 0x00000008 /* - exception at FRk+1HI or ACCk+2 */ -#define MSRx_SIE_FRk1LO_ACCk3 0x00000004 /* - exception at FRk+1LO or ACCk+3 */ -#define MSR0_MTT 0x00007000 /* type of last media trap detected */ -#define MSR0_MTT_NONE 0x00000000 /* - none detected */ -#define MSR0_MTT_OVERFLOW 0x00001000 /* - overflow detected */ -#define MSR0_HI 0x00c00000 /* hardware implementation */ -#define MSR0_HI_ROUNDING 0x00000000 /* - rounding mode */ -#define MSR0_HI_NONROUNDING 0x00c00000 /* - non-rounding mode */ -#define MSR0_EMCI 0x01000000 /* enable media custom instructions */ -#define MSR0_SRDAV 0x10000000 /* select rounding mode of MAVEH */ -#define MSR0_SRDAV_RDAV 0x00000000 /* - controlled by MSR.RDAV */ -#define MSR0_SRDAV_RD 0x10000000 /* - controlled by MSR.RD */ -#define MSR0_RDAV 0x20000000 /* rounding mode of MAVEH */ -#define MSR0_RDAV_NEAREST_MI 0x00000000 /* - round to nearest minus */ -#define MSR0_RDAV_NEAREST_PL 0x20000000 /* - round to nearest plus */ -#define MSR0_RD 0xc0000000 /* rounding mode */ -#define MSR0_RD_NEAREST 0x00000000 /* - nearest */ -#define MSR0_RD_ZERO 0x40000000 /* - zero */ -#define MSR0_RD_POS_INF 0x80000000 /* - positive infinity */ -#define MSR0_RD_NEG_INF 0xc0000000 /* - negative infinity */ - -/* - * IAMPR0-7 - Instruction Address Mapping Register - * DAMPR0-7 - Data Address Mapping Register - */ -#define xAMPRx_V 0x00000001 /* register content validity indicator */ -#define DAMPRx_WP 0x00000002 /* write protect */ -#define DAMPRx_WP_RW 0x00000000 /* - read/write */ -#define DAMPRx_WP_RO 0x00000002 /* - read-only */ -#define xAMPRx_C 0x00000004 /* cached/uncached */ -#define xAMPRx_C_CACHED 0x00000000 /* - cached */ -#define xAMPRx_C_UNCACHED 0x00000004 /* - uncached */ -#define xAMPRx_S 0x00000008 /* supervisor only */ -#define xAMPRx_S_USER 0x00000000 /* - userspace can access */ -#define xAMPRx_S_KERNEL 0x00000008 /* - kernel only */ -#define xAMPRx_SS 0x000000f0 /* segment size */ -#define xAMPRx_SS_16Kb 0x00000000 /* - 16 kilobytes */ -#define xAMPRx_SS_64Kb 0x00000010 /* - 64 kilobytes */ -#define xAMPRx_SS_256Kb 0x00000020 /* - 256 kilobytes */ -#define xAMPRx_SS_1Mb 0x00000030 /* - 1 megabyte */ -#define xAMPRx_SS_2Mb 0x00000040 /* - 2 megabytes */ -#define xAMPRx_SS_4Mb 0x00000050 /* - 4 megabytes */ -#define xAMPRx_SS_8Mb 0x00000060 /* - 8 megabytes */ -#define xAMPRx_SS_16Mb 0x00000070 /* - 16 megabytes */ -#define xAMPRx_SS_32Mb 0x00000080 /* - 32 megabytes */ -#define xAMPRx_SS_64Mb 0x00000090 /* - 64 megabytes */ -#define xAMPRx_SS_128Mb 0x000000a0 /* - 128 megabytes */ -#define xAMPRx_SS_256Mb 0x000000b0 /* - 256 megabytes */ -#define xAMPRx_SS_512Mb 0x000000c0 /* - 512 megabytes */ -#define xAMPRx_RESERVED8 0x00000100 /* reserved bit */ -#define xAMPRx_NG 0x00000200 /* non-global */ -#define xAMPRx_L 0x00000400 /* locked */ -#define xAMPRx_M 0x00000800 /* modified */ -#define xAMPRx_D 0x00001000 /* DAT entry */ -#define xAMPRx_RESERVED13 0x00002000 /* reserved bit */ -#define xAMPRx_PPFN 0xfff00000 /* physical page frame number */ - -#define xAMPRx_V_BIT 0 -#define DAMPRx_WP_BIT 1 -#define xAMPRx_C_BIT 2 -#define xAMPRx_S_BIT 3 -#define xAMPRx_RESERVED8_BIT 8 -#define xAMPRx_NG_BIT 9 -#define xAMPRx_L_BIT 10 -#define xAMPRx_M_BIT 11 -#define xAMPRx_D_BIT 12 -#define xAMPRx_RESERVED13_BIT 13 - -#define __get_IAMPR(R) ({ unsigned long x; asm volatile("movsg iampr"#R",%0" : "=r"(x)); x; }) -#define __get_DAMPR(R) ({ unsigned long x; asm volatile("movsg dampr"#R",%0" : "=r"(x)); x; }) - -#define __get_IAMLR(R) ({ unsigned long x; asm volatile("movsg iamlr"#R",%0" : "=r"(x)); x; }) -#define __get_DAMLR(R) ({ unsigned long x; asm volatile("movsg damlr"#R",%0" : "=r"(x)); x; }) - -#define __set_IAMPR(R,V) do { asm volatile("movgs %0,iampr"#R : : "r"(V)); } while(0) -#define __set_DAMPR(R,V) do { asm volatile("movgs %0,dampr"#R : : "r"(V)); } while(0) - -#define __set_IAMLR(R,V) do { asm volatile("movgs %0,iamlr"#R : : "r"(V)); } while(0) -#define __set_DAMLR(R,V) do { asm volatile("movgs %0,damlr"#R : : "r"(V)); } while(0) - -#define save_dampr(R, _dampr) \ -do { \ - asm volatile("movsg dampr"R",%0" : "=r"(_dampr)); \ -} while(0) - -#define restore_dampr(R, _dampr) \ -do { \ - asm volatile("movgs %0,dampr"R :: "r"(_dampr)); \ -} while(0) - -/* - * AMCR - Address Mapping Control Register - */ -#define AMCR_IAMRN 0x000000ff /* quantity of IAMPR registers */ -#define AMCR_DAMRN 0x0000ff00 /* quantity of DAMPR registers */ - -/* - * TTBR - Address Translation Table Base Register - */ -#define __get_TTBR() ({ unsigned long x; asm volatile("movsg ttbr,%0" : "=r"(x)); x; }) - -/* - * TPXR - TLB Probe Extend Register - */ -#define TPXR_E 0x00000001 -#define TPXR_LMAX_SHIFT 20 -#define TPXR_LMAX_SMASK 0xf -#define TPXR_WMAX_SHIFT 24 -#define TPXR_WMAX_SMASK 0xf -#define TPXR_WAY_SHIFT 28 -#define TPXR_WAY_SMASK 0xf - -/* - * DCR - Debug Control Register - */ -#define DCR_IBCE3 0x00000001 /* break on conditional insn pointed to by IBAR3 */ -#define DCR_IBE3 0x00000002 /* break on insn pointed to by IBAR3 */ -#define DCR_IBCE1 0x00000004 /* break on conditional insn pointed to by IBAR2 */ -#define DCR_IBE1 0x00000008 /* break on insn pointed to by IBAR2 */ -#define DCR_IBCE2 0x00000010 /* break on conditional insn pointed to by IBAR1 */ -#define DCR_IBE2 0x00000020 /* break on insn pointed to by IBAR1 */ -#define DCR_IBCE0 0x00000040 /* break on conditional insn pointed to by IBAR0 */ -#define DCR_IBE0 0x00000080 /* break on insn pointed to by IBAR0 */ - -#define DCR_DDBE1 0x00004000 /* use DBDR1x when checking DBAR1 */ -#define DCR_DWBE1 0x00008000 /* break on store to address in DBAR1/DBMR1x */ -#define DCR_DRBE1 0x00010000 /* break on load from address in DBAR1/DBMR1x */ -#define DCR_DDBE0 0x00020000 /* use DBDR0x when checking DBAR0 */ -#define DCR_DWBE0 0x00040000 /* break on store to address in DBAR0/DBMR0x */ -#define DCR_DRBE0 0x00080000 /* break on load from address in DBAR0/DBMR0x */ - -#define DCR_EIM 0x0c000000 /* external interrupt disable */ -#define DCR_IBM 0x10000000 /* instruction break disable */ -#define DCR_SE 0x20000000 /* single step enable */ -#define DCR_EBE 0x40000000 /* exception break enable */ - -/* - * BRR - Break Interrupt Request Register - */ -#define BRR_ST 0x00000001 /* single-step detected */ -#define BRR_SB 0x00000002 /* break instruction detected */ -#define BRR_BB 0x00000004 /* branch with hint detected */ -#define BRR_CBB 0x00000008 /* branch to LR detected */ -#define BRR_IBx 0x000000f0 /* hardware breakpoint detected */ -#define BRR_DBx 0x00000f00 /* hardware watchpoint detected */ -#define BRR_DBNEx 0x0000f000 /* ? */ -#define BRR_EBTT 0x00ff0000 /* trap type of exception break */ -#define BRR_TB 0x10000000 /* external break request detected */ -#define BRR_CB 0x20000000 /* ICE break command detected */ -#define BRR_EB 0x40000000 /* exception break detected */ - -/* - * BPSR - Break PSR Save Register - */ -#define BPSR_BET 0x00000001 /* former PSR.ET */ -#define BPSR_BS 0x00001000 /* former PSR.S */ - -#endif /* _ASM_SPR_REGS_H */ diff --git a/arch/frv/include/asm/string.h b/arch/frv/include/asm/string.h deleted file mode 100644 index 1f6c359904391..0000000000000 --- a/arch/frv/include/asm/string.h +++ /dev/null @@ -1,50 +0,0 @@ -/* string.h: FRV string handling - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#ifndef _ASM_STRING_H_ -#define _ASM_STRING_H_ - -#ifdef __KERNEL__ /* only set these up for kernel code */ - -#define __HAVE_ARCH_MEMSET 1 -#define __HAVE_ARCH_MEMCPY 1 - -extern void *memset(void *, int, __kernel_size_t); -extern void *memcpy(void *, const void *, __kernel_size_t); - -#else /* KERNEL */ - -/* - * let user libraries deal with these, - * IMHO the kernel has no place defining these functions for user apps - */ - -#define __HAVE_ARCH_STRCPY 1 -#define __HAVE_ARCH_STRNCPY 1 -#define __HAVE_ARCH_STRCAT 1 -#define __HAVE_ARCH_STRNCAT 1 -#define __HAVE_ARCH_STRCMP 1 -#define __HAVE_ARCH_STRNCMP 1 -#define __HAVE_ARCH_STRCHR 1 -#define __HAVE_ARCH_STRRCHR 1 -#define __HAVE_ARCH_STRSTR 1 -#define __HAVE_ARCH_STRLEN 1 -#define __HAVE_ARCH_STRNLEN 1 -#define __HAVE_ARCH_MEMSET 1 -#define __HAVE_ARCH_MEMCPY 1 -#define __HAVE_ARCH_MEMMOVE 1 -#define __HAVE_ARCH_MEMSCAN 1 -#define __HAVE_ARCH_MEMCMP 1 -#define __HAVE_ARCH_MEMCHR 1 -#define __HAVE_ARCH_STRTOK 1 - -#endif /* KERNEL */ -#endif /* _ASM_STRING_H_ */ diff --git a/arch/frv/include/asm/switch_to.h b/arch/frv/include/asm/switch_to.h deleted file mode 100644 index 2cf0f6a7fbb1d..0000000000000 --- a/arch/frv/include/asm/switch_to.h +++ /dev/null @@ -1,35 +0,0 @@ -/* FR-V CPU basic task switching - * - * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#ifndef _ASM_SWITCH_TO_H -#define _ASM_SWITCH_TO_H - -#include - -/* - * switch_to(prev, next) should switch from task `prev' to `next' - * `prev' will never be the same as `next'. - * The `mb' is to tell GCC not to cache `current' across this call. - */ -extern asmlinkage -struct task_struct *__switch_to(struct thread_struct *prev_thread, - struct thread_struct *next_thread, - struct task_struct *prev); - -#define switch_to(prev, next, last) \ -do { \ - (prev)->thread.sched_lr = \ - (unsigned long) __builtin_return_address(0); \ - (last) = __switch_to(&(prev)->thread, &(next)->thread, (prev)); \ - mb(); \ -} while(0) - -#endif /* _ASM_SWITCH_TO_H */ diff --git a/arch/frv/include/asm/syscall.h b/arch/frv/include/asm/syscall.h deleted file mode 100644 index 70689eb29b988..0000000000000 --- a/arch/frv/include/asm/syscall.h +++ /dev/null @@ -1,123 +0,0 @@ -/* syscall parameter access functions - * - * Copyright (C) 2009 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - -#ifndef _ASM_SYSCALL_H -#define _ASM_SYSCALL_H - -#include -#include - -/* - * Get the system call number or -1 - */ -static inline long syscall_get_nr(struct task_struct *task, - struct pt_regs *regs) -{ - return regs->syscallno; -} - -/* - * Restore the clobbered GR8 register - * (1st syscall arg was overwritten with syscall return or error) - */ -static inline void syscall_rollback(struct task_struct *task, - struct pt_regs *regs) -{ - regs->gr8 = regs->orig_gr8; -} - -/* - * See if the syscall return value is an error, returning it if it is and 0 if - * not - */ -static inline long syscall_get_error(struct task_struct *task, - struct pt_regs *regs) -{ - return IS_ERR_VALUE(regs->gr8) ? regs->gr8 : 0; -} - -/* - * Get the syscall return value - */ -static inline long syscall_get_return_value(struct task_struct *task, - struct pt_regs *regs) -{ - return regs->gr8; -} - -/* - * Set the syscall return value - */ -static inline void syscall_set_return_value(struct task_struct *task, - struct pt_regs *regs, - int error, long val) -{ - if (error) - regs->gr8 = -error; - else - regs->gr8 = val; -} - -/* - * Retrieve the system call arguments - */ -static inline void syscall_get_arguments(struct task_struct *task, - struct pt_regs *regs, - unsigned int i, unsigned int n, - unsigned long *args) -{ - /* - * Do this simply for now. If we need to start supporting - * fetching arguments from arbitrary indices, this will need some - * extra logic. Presently there are no in-tree users that depend - * on this behaviour. - */ - BUG_ON(i); - - /* Argument pattern is: GR8, GR9, GR10, GR11, GR12, GR13 */ - switch (n) { - case 6: args[5] = regs->gr13; - case 5: args[4] = regs->gr12; - case 4: args[3] = regs->gr11; - case 3: args[2] = regs->gr10; - case 2: args[1] = regs->gr9; - case 1: args[0] = regs->gr8; - break; - default: - BUG(); - } -} - -/* - * Alter the system call arguments - */ -static inline void syscall_set_arguments(struct task_struct *task, - struct pt_regs *regs, - unsigned int i, unsigned int n, - const unsigned long *args) -{ - /* Same note as above applies */ - BUG_ON(i); - - switch (n) { - case 6: regs->gr13 = args[5]; - case 5: regs->gr12 = args[4]; - case 4: regs->gr11 = args[3]; - case 3: regs->gr10 = args[2]; - case 2: regs->gr9 = args[1]; - case 1: regs->gr8 = args[0]; - break; - default: - BUG(); - } -} - -#endif /* _ASM_SYSCALL_H */ diff --git a/arch/frv/include/asm/termios.h b/arch/frv/include/asm/termios.h deleted file mode 100644 index 5a8c63554617c..0000000000000 --- a/arch/frv/include/asm/termios.h +++ /dev/null @@ -1,15 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_TERMIOS_H -#define _ASM_TERMIOS_H - -#include - -/* 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" -#include -#endif /* _ASM_TERMIOS_H */ diff --git a/arch/frv/include/asm/thread_info.h b/arch/frv/include/asm/thread_info.h deleted file mode 100644 index 0f950845fad9d..0000000000000 --- a/arch/frv/include/asm/thread_info.h +++ /dev/null @@ -1,116 +0,0 @@ -/* thread_info.h: description - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * Derived from include/asm-i386/thread_info.h - * - * 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_THREAD_INFO_H -#define _ASM_THREAD_INFO_H - -#ifdef __KERNEL__ - -#ifndef __ASSEMBLY__ -#include -#endif - -#define THREAD_SIZE 8192 - -/* - * 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 - */ -#ifndef __ASSEMBLY__ - -struct thread_info { - struct task_struct *task; /* main task structure */ - unsigned long flags; /* low level flags */ - unsigned long status; /* thread-synchronous flags */ - __u32 cpu; /* current CPU */ - int preempt_count; /* 0 => preemptable, <0 => BUG */ - - mm_segment_t addr_limit; /* thread address space: - * 0-0xBFFFFFFF for user-thead - * 0-0xFFFFFFFF for kernel-thread - */ - - __u8 supervisor_stack[0]; -}; - -#else /* !__ASSEMBLY__ */ - -#include - -#endif - -/* - * macros/functions for gaining access to the thread information structure - */ -#ifndef __ASSEMBLY__ - -#define INIT_THREAD_INFO(tsk) \ -{ \ - .task = &tsk, \ - .flags = 0, \ - .cpu = 0, \ - .preempt_count = INIT_PREEMPT_COUNT, \ - .addr_limit = KERNEL_DS, \ -} - -/* how to get the thread information struct from C */ -register struct thread_info *__current_thread_info asm("gr15"); - -#define current_thread_info() ({ __current_thread_info; }) - -#endif /* __ASSEMBLY__ */ - -/* - * 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 /* callback before returning to user */ -#define TIF_SIGPENDING 2 /* signal pending */ -#define TIF_NEED_RESCHED 3 /* rescheduling necessary */ -#define TIF_SINGLESTEP 4 /* restore singlestep on return to user mode */ -#define TIF_RESTORE_SIGMASK 5 /* restore signal mask in do_signal() */ -#define TIF_MEMDIE 7 /* is terminating due to OOM killer */ - -#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) - -/* work to do on interrupt/exception return */ -#define _TIF_WORK_MASK \ - (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING | _TIF_NEED_RESCHED | _TIF_SINGLESTEP) - -/* work to do on any return to u-space */ -#define _TIF_ALLWORK_MASK (_TIF_WORK_MASK | _TIF_SYSCALL_TRACE) - -#if _TIF_ALLWORK_MASK >= 0x2000 -#error "_TIF_ALLWORK_MASK won't fit in an ANDI now (see entry.S)" -#endif - -/* - * 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. - */ -#define TS_USEDFPM 0x0001 /* FPU/Media was used by this task this quantum (SMP) */ - -#endif /* __KERNEL__ */ - -#endif /* _ASM_THREAD_INFO_H */ diff --git a/arch/frv/include/asm/timer-regs.h b/arch/frv/include/asm/timer-regs.h deleted file mode 100644 index 6c5a871ce5e99..0000000000000 --- a/arch/frv/include/asm/timer-regs.h +++ /dev/null @@ -1,106 +0,0 @@ -/* timer-regs.h: hardware timer register definitions - * - * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#ifndef _ASM_TIMER_REGS_H -#define _ASM_TIMER_REGS_H - -#include - -extern unsigned long __nongprelbss __clkin_clock_speed_HZ; -extern unsigned long __nongprelbss __ext_bus_clock_speed_HZ; -extern unsigned long __nongprelbss __res_bus_clock_speed_HZ; -extern unsigned long __nongprelbss __sdram_clock_speed_HZ; -extern unsigned long __nongprelbss __core_bus_clock_speed_HZ; -extern unsigned long __nongprelbss __core_clock_speed_HZ; -extern unsigned long __nongprelbss __dsu_clock_speed_HZ; -extern unsigned long __nongprelbss __serial_clock_speed_HZ; - -#define __get_CLKC() ({ *(volatile unsigned long *)(0xfeff9a00); }) - -static inline void __set_CLKC(unsigned long v) -{ - int tmp; - - asm volatile(" st%I0.p %2,%M0 \n" - " setlos %3,%1 \n" - " membar \n" - "0: \n" - " subicc %1,#1,%1,icc0 \n" - " bnc icc0,#1,0b \n" - : "=m"(*(volatile unsigned long *) 0xfeff9a00), "=r"(tmp) - : "r"(v), "i"(256) - : "icc0"); -} - -#define __get_TCTR() ({ *(volatile unsigned long *)(0xfeff9418); }) -#define __get_TPRV() ({ *(volatile unsigned long *)(0xfeff9420); }) -#define __get_TPRCKSL() ({ *(volatile unsigned long *)(0xfeff9428); }) -#define __get_TCSR(T) ({ *(volatile unsigned long *)(0xfeff9400 + 8 * (T)); }) -#define __get_TxCKSL(T) ({ *(volatile unsigned long *)(0xfeff9430 + 8 * (T)); }) - -#define __get_TCSR_DATA(T) ({ __get_TCSR(T) >> 24; }) - -#define __set_TCTR(V) do { *(volatile unsigned long *)(0xfeff9418) = (V); mb(); } while(0) -#define __set_TPRV(V) do { *(volatile unsigned long *)(0xfeff9420) = (V) << 24; mb(); } while(0) -#define __set_TPRCKSL(V) do { *(volatile unsigned long *)(0xfeff9428) = (V); mb(); } while(0) -#define __set_TCSR(T,V) \ -do { *(volatile unsigned long *)(0xfeff9400 + 8 * (T)) = (V); mb(); } while(0) - -#define __set_TxCKSL(T,V) \ -do { *(volatile unsigned long *)(0xfeff9430 + 8 * (T)) = (V); mb(); } while(0) - -#define __set_TCSR_DATA(T,V) __set_TCSR(T, (V) << 24) -#define __set_TxCKSL_DATA(T,V) __set_TxCKSL(T, TxCKSL_EIGHT | __TxCKSL_SELECT((V))) - -/* clock control register */ -#define CLKC_CMODE 0x0f000000 -#define CLKC_SLPL 0x000f0000 -#define CLKC_P0 0x00000100 -#define CLKC_CM 0x00000003 - -#define CLKC_CMODE_s 24 - -/* timer control register - non-readback mode */ -#define TCTR_MODE_0 0x00000000 -#define TCTR_MODE_2 0x04000000 -#define TCTR_MODE_4 0x08000000 -#define TCTR_MODE_5 0x0a000000 -#define TCTR_RL_LATCH 0x00000000 -#define TCTR_RL_RW_LOW8 0x10000000 -#define TCTR_RL_RW_HIGH8 0x20000000 -#define TCTR_RL_RW_LH8 0x30000000 -#define TCTR_SC_CTR0 0x00000000 -#define TCTR_SC_CTR1 0x40000000 -#define TCTR_SC_CTR2 0x80000000 - -/* timer control register - readback mode */ -#define TCTR_CNT0 0x02000000 -#define TCTR_CNT1 0x04000000 -#define TCTR_CNT2 0x08000000 -#define TCTR_NSTATUS 0x10000000 -#define TCTR_NCOUNT 0x20000000 -#define TCTR_SC_READBACK 0xc0000000 - -/* timer control status registers - non-readback mode */ -#define TCSRx_DATA 0xff000000 - -/* timer control status registers - readback mode */ -#define TCSRx_OUTPUT 0x80000000 -#define TCSRx_NULLCOUNT 0x40000000 -#define TCSRx_RL 0x30000000 -#define TCSRx_MODE 0x07000000 - -/* timer clock select registers */ -#define TxCKSL_SELECT 0x0f000000 -#define __TxCKSL_SELECT(X) ((X) << 24) -#define TxCKSL_EIGHT 0xf0000000 - -#endif /* _ASM_TIMER_REGS_H */ diff --git a/arch/frv/include/asm/timex.h b/arch/frv/include/asm/timex.h deleted file mode 100644 index bf53166f27934..0000000000000 --- a/arch/frv/include/asm/timex.h +++ /dev/null @@ -1,27 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* timex.h: FR-V architecture timex specifications - */ -#ifndef _ASM_TIMEX_H -#define _ASM_TIMEX_H - -#define CLOCK_TICK_RATE 1193180 /* Underlying HZ */ -#define CLOCK_TICK_FACTOR 20 /* Factor of both 1000000 and CLOCK_TICK_RATE */ - -typedef unsigned long cycles_t; - -static inline cycles_t get_cycles(void) -{ - return 0; -} - -#define vxtime_lock() do {} while (0) -#define vxtime_unlock() do {} while (0) - -/* This attribute is used in include/linux/jiffies.h alongside with - * __cacheline_aligned_in_smp. It is assumed that __cacheline_aligned_in_smp - * for frv does not contain another section specification. - */ -#define __jiffy_arch_data __attribute__((__section__(".data"))) - -#endif - diff --git a/arch/frv/include/asm/tlb.h b/arch/frv/include/asm/tlb.h deleted file mode 100644 index d3e361ad725af..0000000000000 --- a/arch/frv/include/asm/tlb.h +++ /dev/null @@ -1,28 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_TLB_H -#define _ASM_TLB_H - -#include - -#ifdef CONFIG_MMU -extern void check_pgt_cache(void); -#else -#define check_pgt_cache() do {} while(0) -#endif - -/* - * we don't need any special per-pte or per-vma handling... - */ -#define tlb_start_vma(tlb, vma) do { } while (0) -#define tlb_end_vma(tlb, vma) do { } while (0) -#define __tlb_remove_tlb_entry(tlb, ptep, address) do { } while (0) - -/* - * .. because we flush the whole mm when it fills up - */ -#define tlb_flush(tlb) flush_tlb_mm((tlb)->mm) - -#include - -#endif /* _ASM_TLB_H */ - diff --git a/arch/frv/include/asm/tlbflush.h b/arch/frv/include/asm/tlbflush.h deleted file mode 100644 index 75879420f578e..0000000000000 --- a/arch/frv/include/asm/tlbflush.h +++ /dev/null @@ -1,73 +0,0 @@ -/* tlbflush.h: TLB flushing functions - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#ifndef _ASM_TLBFLUSH_H -#define _ASM_TLBFLUSH_H - -#include -#include - -#ifdef CONFIG_MMU - -#ifndef __ASSEMBLY__ -extern asmlinkage void __flush_tlb_all(void); -extern asmlinkage void __flush_tlb_mm(unsigned long contextid); -extern asmlinkage void __flush_tlb_page(unsigned long contextid, unsigned long start); -extern asmlinkage void __flush_tlb_range(unsigned long contextid, - unsigned long start, unsigned long end); -#endif /* !__ASSEMBLY__ */ - -#define flush_tlb_all() \ -do { \ - preempt_disable(); \ - __flush_tlb_all(); \ - preempt_enable(); \ -} while(0) - -#define flush_tlb_mm(mm) \ -do { \ - preempt_disable(); \ - __flush_tlb_mm((mm)->context.id); \ - preempt_enable(); \ -} while(0) - -#define flush_tlb_range(vma,start,end) \ -do { \ - preempt_disable(); \ - __flush_tlb_range((vma)->vm_mm->context.id, start, end); \ - preempt_enable(); \ -} while(0) - -#define flush_tlb_page(vma,addr) \ -do { \ - preempt_disable(); \ - __flush_tlb_page((vma)->vm_mm->context.id, addr); \ - preempt_enable(); \ -} while(0) - - -#define __flush_tlb_global() flush_tlb_all() -#define flush_tlb() flush_tlb_all() -#define flush_tlb_kernel_range(start, end) flush_tlb_all() - -#else - -#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_kernel_range(start, end) BUG() - -#endif - - -#endif /* _ASM_TLBFLUSH_H */ diff --git a/arch/frv/include/asm/topology.h b/arch/frv/include/asm/topology.h deleted file mode 100644 index 207603071f781..0000000000000 --- a/arch/frv/include/asm/topology.h +++ /dev/null @@ -1,13 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_TOPOLOGY_H -#define _ASM_TOPOLOGY_H - -#ifdef CONFIG_NUMA - -#error NUMA not supported yet - -#endif /* CONFIG_NUMA */ - -#include - -#endif /* _ASM_TOPOLOGY_H */ diff --git a/arch/frv/include/asm/types.h b/arch/frv/include/asm/types.h deleted file mode 100644 index 6bc63650d832e..0000000000000 --- a/arch/frv/include/asm/types.h +++ /dev/null @@ -1,22 +0,0 @@ -/* types.h: FRV types - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ -#ifndef _ASM_TYPES_H -#define _ASM_TYPES_H - -#include - -/* - * These aren't exported outside the kernel to avoid name space clashes - */ - -#define BITS_PER_LONG 32 - -#endif /* _ASM_TYPES_H */ diff --git a/arch/frv/include/asm/uaccess.h b/arch/frv/include/asm/uaccess.h deleted file mode 100644 index ff9562dc68250..0000000000000 --- a/arch/frv/include/asm/uaccess.h +++ /dev/null @@ -1,285 +0,0 @@ -/* uaccess.h: userspace accessor functions - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#ifndef _ASM_UACCESS_H -#define _ASM_UACCESS_H - -/* - * User space memory access functions - */ -#include -#include -#include -#include - -#define __ptr(x) ((unsigned long __force *)(x)) - -/* - * check that a range of addresses falls within the current address limit - */ -static inline int ___range_ok(unsigned long addr, unsigned long size) -{ -#ifdef CONFIG_MMU - int flag = -EFAULT, tmp; - - asm volatile ( - " addcc %3,%2,%1,icc0 \n" /* set C-flag if addr+size>4GB */ - " subcc.p %1,%4,gr0,icc1 \n" /* jump if addr+size>limit */ - " bc icc0,#0,0f \n" - " bhi icc1,#0,0f \n" - " setlos #0,%0 \n" /* mark okay */ - "0: \n" - : "=r"(flag), "=&r"(tmp) - : "r"(addr), "r"(size), "r"(get_addr_limit()), "0"(flag) - ); - - return flag; - -#else - - if (addr < memory_start || - addr > memory_end || - size > memory_end - memory_start || - addr + size > memory_end) - return -EFAULT; - - return 0; -#endif -} - -#define __range_ok(addr,size) ___range_ok((unsigned long) (addr), (unsigned long) (size)) - -#define access_ok(type,addr,size) (__range_ok((void __user *)(addr), (size)) == 0) -#define __access_ok(addr,size) (__range_ok((addr), (size)) == 0) - - -/* - * These are the main single-value transfer routines. They automatically - * use the right size if we just have the right pointer type. - */ -#define __put_user(x, ptr) \ -({ \ - int __pu_err = 0; \ - \ - typeof(*(ptr)) __pu_val = (x); \ - __chk_user_ptr(ptr); \ - \ - switch (sizeof (*(ptr))) { \ - case 1: \ - __put_user_asm(__pu_err, __pu_val, ptr, "b", "r"); \ - break; \ - case 2: \ - __put_user_asm(__pu_err, __pu_val, ptr, "h", "r"); \ - break; \ - case 4: \ - __put_user_asm(__pu_err, __pu_val, ptr, "", "r"); \ - break; \ - case 8: \ - __put_user_asm(__pu_err, __pu_val, ptr, "d", "e"); \ - break; \ - default: \ - __pu_err = __put_user_bad(); \ - break; \ - } \ - __pu_err; \ -}) - -#define put_user(x, ptr) \ -({ \ - typeof(*(ptr)) __user *_p = (ptr); \ - int _e; \ - \ - _e = __range_ok(_p, sizeof(*_p)); \ - if (_e == 0) \ - _e = __put_user((x), _p); \ - _e; \ -}) - -extern int __put_user_bad(void); - -/* - * Tell gcc we read from memory instead of writing: this is because - * we do not write to any memory gcc knows about, so there are no - * aliasing issues. - */ - -#ifdef CONFIG_MMU - -#define __put_user_asm(err,x,ptr,dsize,constraint) \ -do { \ - asm volatile("1: st"dsize"%I1 %2,%M1 \n" \ - "2: \n" \ - ".subsection 2 \n" \ - "3: setlos %3,%0 \n" \ - " bra 2b \n" \ - ".previous \n" \ - ".section __ex_table,\"a\" \n" \ - " .balign 8 \n" \ - " .long 1b,3b \n" \ - ".previous" \ - : "=r" (err) \ - : "m" (*__ptr(ptr)), constraint (x), "i"(-EFAULT), "0"(err) \ - : "memory"); \ -} while (0) - -#else - -#define __put_user_asm(err,x,ptr,bwl,con) \ -do { \ - asm(" st"bwl"%I0 %1,%M0 \n" \ - " membar \n" \ - : \ - : "m" (*__ptr(ptr)), con (x) \ - : "memory"); \ -} while (0) - -#endif - -/*****************************************************************************/ -/* - * - */ -#define __get_user(x, ptr) \ -({ \ - int __gu_err = 0; \ - __chk_user_ptr(ptr); \ - \ - switch (sizeof(*(ptr))) { \ - case 1: { \ - unsigned char __gu_val; \ - __get_user_asm(__gu_err, __gu_val, ptr, "ub", "=r"); \ - (x) = *(__force __typeof__(*(ptr)) *) &__gu_val; \ - break; \ - } \ - case 2: { \ - unsigned short __gu_val; \ - __get_user_asm(__gu_err, __gu_val, ptr, "uh", "=r"); \ - (x) = *(__force __typeof__(*(ptr)) *) &__gu_val; \ - break; \ - } \ - case 4: { \ - unsigned int __gu_val; \ - __get_user_asm(__gu_err, __gu_val, ptr, "", "=r"); \ - (x) = *(__force __typeof__(*(ptr)) *) &__gu_val; \ - break; \ - } \ - case 8: { \ - unsigned long long __gu_val; \ - __get_user_asm(__gu_err, __gu_val, ptr, "d", "=e"); \ - (x) = *(__force __typeof__(*(ptr)) *) &__gu_val; \ - break; \ - } \ - default: \ - __gu_err = __get_user_bad(); \ - break; \ - } \ - __gu_err; \ -}) - -#define get_user(x, ptr) \ -({ \ - const typeof(*(ptr)) __user *_p = (ptr);\ - int _e; \ - \ - _e = __range_ok(_p, sizeof(*_p)); \ - if (likely(_e == 0)) \ - _e = __get_user((x), _p); \ - else \ - (x) = (typeof(x)) 0; \ - _e; \ -}) - -extern int __get_user_bad(void); - -#ifdef CONFIG_MMU - -#define __get_user_asm(err,x,ptr,dtype,constraint) \ -do { \ - asm("1: ld"dtype"%I2 %M2,%1 \n" \ - "2: \n" \ - ".subsection 2 \n" \ - "3: setlos %3,%0 \n" \ - " setlos #0,%1 \n" \ - " bra 2b \n" \ - ".previous \n" \ - ".section __ex_table,\"a\" \n" \ - " .balign 8 \n" \ - " .long 1b,3b \n" \ - ".previous" \ - : "=r" (err), constraint (x) \ - : "m" (*__ptr(ptr)), "i"(-EFAULT), "0"(err) \ - ); \ -} while(0) - -#else - -#define __get_user_asm(err,x,ptr,bwl,con) \ - asm(" ld"bwl"%I1 %M1,%0 \n" \ - " membar \n" \ - : con(x) \ - : "m" (*__ptr(ptr))) - -#endif - -/*****************************************************************************/ -/* - * - */ - -#define ____force(x) (__force void *)(void __user *)(x) -#ifdef CONFIG_MMU -extern long __memset_user(void *dst, unsigned long count); -extern long __memcpy_user(void *dst, const void *src, unsigned long count); - -#define __clear_user(dst,count) __memset_user(____force(dst), (count)) - -#else - -#define __clear_user(dst,count) (memset(____force(dst), 0, (count)), 0) - -#endif - -static inline unsigned long -raw_copy_from_user(void *to, const void __user *from, unsigned long n) -{ -#ifdef CONFIG_MMU - return __memcpy_user(to, (__force const void *)from, n); -#else - memcpy(to, (__force const void *)from, n); - return 0; -#endif -} - -static inline unsigned long -raw_copy_to_user(void __user *to, const void *from, unsigned long n) -{ -#ifdef CONFIG_MMU - return __memcpy_user((__force void *)to, from, n); -#else - memcpy((__force void *)to, from, n); - return 0; -#endif -} -#define INLINE_COPY_TO_USER -#define INLINE_COPY_FROM_USER - -static inline unsigned long __must_check -clear_user(void __user *to, unsigned long n) -{ - if (likely(__access_ok(to, n))) - n = __clear_user(to, n); - return n; -} - -extern long strncpy_from_user(char *dst, const char __user *src, long count); -extern long strnlen_user(const char __user *src, long count); - -#endif /* _ASM_UACCESS_H */ diff --git a/arch/frv/include/asm/ucontext.h b/arch/frv/include/asm/ucontext.h deleted file mode 100644 index 0cc2d95dd209c..0000000000000 --- a/arch/frv/include/asm/ucontext.h +++ /dev/null @@ -1,13 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_UCONTEXT_H -#define _ASM_UCONTEXT_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 diff --git a/arch/frv/include/asm/unaligned.h b/arch/frv/include/asm/unaligned.h deleted file mode 100644 index 6c61c05b2e0cf..0000000000000 --- a/arch/frv/include/asm/unaligned.h +++ /dev/null @@ -1,22 +0,0 @@ -/* unaligned.h: unaligned access handler - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#ifndef _ASM_UNALIGNED_H -#define _ASM_UNALIGNED_H - -#include -#include -#include - -#define get_unaligned __get_unaligned_be -#define put_unaligned __put_unaligned_be - -#endif /* _ASM_UNALIGNED_H */ diff --git a/arch/frv/include/asm/unistd.h b/arch/frv/include/asm/unistd.h deleted file mode 100644 index b4b3f9b26b813..0000000000000 --- a/arch/frv/include/asm/unistd.h +++ /dev/null @@ -1,34 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_UNISTD_H_ -#define _ASM_UNISTD_H_ - -#include - - -#define NR_syscalls 338 - -/* #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_IPC -#define __ARCH_WANT_SYS_PAUSE -/* #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_FORK -#define __ARCH_WANT_SYS_VFORK -#define __ARCH_WANT_SYS_CLONE - -#endif /* _ASM_UNISTD_H_ */ diff --git a/arch/frv/include/asm/user.h b/arch/frv/include/asm/user.h deleted file mode 100644 index 82fa8fab64aea..0000000000000 --- a/arch/frv/include/asm/user.h +++ /dev/null @@ -1,80 +0,0 @@ -/* user.h: FR-V core file format stuff - * - * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ -#ifndef _ASM_USER_H -#define _ASM_USER_H - -#include -#include - -/* Core file format: The core file is written in such a way that gdb - * can understand it and provide useful information to the user (under - * linux we use the 'trad-core' bfd). There are quite a number of - * obstacles to being able to view the contents of the floating point - * registers, and until these are solved you will not be able to view - * the contents of them. Actually, you can read in the core file and - * look at the contents of the user struct to find out what the - * floating point registers contain. - * - * The actual file contents are as follows: - * UPAGE: - * 1 page consisting of a user struct that tells gdb what is present - * in the file. Directly after this is a copy of the task_struct, - * which is currently not used by gdb, but it may come in useful at - * some point. All of the registers are stored as part of the - * upage. The upage should always be only one page. - * - * DATA: - * The data area is stored. We use current->end_text to - * current->brk to pick up all of the user variables, plus any - * memory that may have been malloced. No attempt is made to - * determine if a page is demand-zero or if a page is totally - * unused, we just cover the entire range. All of the addresses are - * rounded in such a way that an integral number of pages is - * written. - * - * STACK: - * We need the stack information in order to get a meaningful - * backtrace. We need to write the data from (esp) to - * current->start_stack, so we round each of these off in order to - * be able to write an integer number of pages. The minimum core - * file size is 3 pages, or 12288 bytes. - */ - -/* When the kernel dumps core, it starts by dumping the user struct - - * this will be used by gdb to figure out where the data and stack segments - * are within the file, and what virtual addresses to use. - */ -struct user { - /* We start with the registers, to mimic the way that "memory" is returned - * from the ptrace(3,...) function. */ - struct user_context regs; - - /* The rest of this junk is to help gdb figure out what goes where */ - unsigned long u_tsize; /* Text segment size (pages). */ - unsigned long u_dsize; /* Data segment size (pages). */ - unsigned long u_ssize; /* Stack segment size (pages). */ - unsigned long start_code; /* Starting virtual address of text. */ - unsigned long start_stack; /* Starting virtual address of stack area. - * This is actually the bottom of the stack, - * the top of the stack is always found in the - * esp register. */ - long int signal; /* Signal that caused the core dump. */ - - unsigned long magic; /* To uniquely identify a core file */ - char u_comm[32]; /* User command that was responsible */ -}; - -#define NBPG PAGE_SIZE -#define UPAGES 1 -#define HOST_TEXT_START_ADDR (u.start_code) -#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG) - -#endif diff --git a/arch/frv/include/asm/vga.h b/arch/frv/include/asm/vga.h deleted file mode 100644 index a702c800a2294..0000000000000 --- a/arch/frv/include/asm/vga.h +++ /dev/null @@ -1,17 +0,0 @@ -/* vga.h: VGA register stuff - * - * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#ifndef _ASM_VGA_H -#define _ASM_VGA_H - - - -#endif /* _ASM_VGA_H */ diff --git a/arch/frv/include/asm/virtconvert.h b/arch/frv/include/asm/virtconvert.h deleted file mode 100644 index b26d70ab91119..0000000000000 --- a/arch/frv/include/asm/virtconvert.h +++ /dev/null @@ -1,41 +0,0 @@ -/* virtconvert.h: virtual/physical/page address conversion - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ -#ifndef _ASM_VIRTCONVERT_H -#define _ASM_VIRTCONVERT_H - -/* - * Macros used for converting between virtual and physical mappings. - */ - -#ifdef __KERNEL__ - -#include - -#ifdef CONFIG_MMU - -#define phys_to_virt(vaddr) ((void *) ((unsigned long)(vaddr) + PAGE_OFFSET)) -#define virt_to_phys(vaddr) ((unsigned long) (vaddr) - PAGE_OFFSET) - -#else - -#define phys_to_virt(vaddr) ((void *) (vaddr)) -#define virt_to_phys(vaddr) ((unsigned long) (vaddr)) - -#endif - -#define virt_to_bus virt_to_phys -#define bus_to_virt phys_to_virt - -#define __page_address(page) (PAGE_OFFSET + (((page) - mem_map) << PAGE_SHIFT)) -#define page_to_phys(page) virt_to_phys((void *)__page_address(page)) - -#endif -#endif diff --git a/arch/frv/include/asm/xor.h b/arch/frv/include/asm/xor.h deleted file mode 100644 index c82eb12a5b181..0000000000000 --- a/arch/frv/include/asm/xor.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/arch/frv/include/uapi/asm/Kbuild b/arch/frv/include/uapi/asm/Kbuild deleted file mode 100644 index 5354b0f84d41a..0000000000000 --- a/arch/frv/include/uapi/asm/Kbuild +++ /dev/null @@ -1,5 +0,0 @@ -# UAPI Header export list -include include/uapi/asm-generic/Kbuild.asm - -generic-y += siginfo.h -generic-y += bpf_perf_event.h diff --git a/arch/frv/include/uapi/asm/auxvec.h b/arch/frv/include/uapi/asm/auxvec.h deleted file mode 100644 index 07710778fa109..0000000000000 --- a/arch/frv/include/uapi/asm/auxvec.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef __FRV_AUXVEC_H -#define __FRV_AUXVEC_H - -#endif diff --git a/arch/frv/include/uapi/asm/bitsperlong.h b/arch/frv/include/uapi/asm/bitsperlong.h deleted file mode 100644 index 76da34b10f598..0000000000000 --- a/arch/frv/include/uapi/asm/bitsperlong.h +++ /dev/null @@ -1,2 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#include diff --git a/arch/frv/include/uapi/asm/byteorder.h b/arch/frv/include/uapi/asm/byteorder.h deleted file mode 100644 index a46f6472acdce..0000000000000 --- a/arch/frv/include/uapi/asm/byteorder.h +++ /dev/null @@ -1,7 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _ASM_BYTEORDER_H -#define _ASM_BYTEORDER_H - -#include - -#endif /* _ASM_BYTEORDER_H */ diff --git a/arch/frv/include/uapi/asm/errno.h b/arch/frv/include/uapi/asm/errno.h deleted file mode 100644 index c5b82f2f2970a..0000000000000 --- a/arch/frv/include/uapi/asm/errno.h +++ /dev/null @@ -1,8 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _ASM_ERRNO_H -#define _ASM_ERRNO_H - -#include - -#endif /* _ASM_ERRNO_H */ - diff --git a/arch/frv/include/uapi/asm/fcntl.h b/arch/frv/include/uapi/asm/fcntl.h deleted file mode 100644 index a77648c505d17..0000000000000 --- a/arch/frv/include/uapi/asm/fcntl.h +++ /dev/null @@ -1,2 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#include diff --git a/arch/frv/include/uapi/asm/ioctl.h b/arch/frv/include/uapi/asm/ioctl.h deleted file mode 100644 index b809c4566e5f8..0000000000000 --- a/arch/frv/include/uapi/asm/ioctl.h +++ /dev/null @@ -1,2 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#include diff --git a/arch/frv/include/uapi/asm/ioctls.h b/arch/frv/include/uapi/asm/ioctls.h deleted file mode 100644 index dd9f5eb9fedab..0000000000000 --- a/arch/frv/include/uapi/asm/ioctls.h +++ /dev/null @@ -1,11 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef __ASM_IOCTLS_H__ -#define __ASM_IOCTLS_H__ - -#define TIOCTTYGSTRUCT 0x5426 /* For debugging only */ -#define FIOQSIZE 0x545E - -#include - -#endif /* __ASM_IOCTLS_H__ */ - diff --git a/arch/frv/include/uapi/asm/ipcbuf.h b/arch/frv/include/uapi/asm/ipcbuf.h deleted file mode 100644 index 90d6445a14df8..0000000000000 --- a/arch/frv/include/uapi/asm/ipcbuf.h +++ /dev/null @@ -1,2 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#include diff --git a/arch/frv/include/uapi/asm/kvm_para.h b/arch/frv/include/uapi/asm/kvm_para.h deleted file mode 100644 index baacc4996d18e..0000000000000 --- a/arch/frv/include/uapi/asm/kvm_para.h +++ /dev/null @@ -1,2 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#include diff --git a/arch/frv/include/uapi/asm/mman.h b/arch/frv/include/uapi/asm/mman.h deleted file mode 100644 index 306fc0460b800..0000000000000 --- a/arch/frv/include/uapi/asm/mman.h +++ /dev/null @@ -1,2 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#include diff --git a/arch/frv/include/uapi/asm/msgbuf.h b/arch/frv/include/uapi/asm/msgbuf.h deleted file mode 100644 index 156c81bb46d71..0000000000000 --- a/arch/frv/include/uapi/asm/msgbuf.h +++ /dev/null @@ -1,33 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _ASM_MSGBUF_H -#define _ASM_MSGBUF_H - -/* - * The msqid64_ds structure for FR-V 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_MSGBUF_H */ - diff --git a/arch/frv/include/uapi/asm/param.h b/arch/frv/include/uapi/asm/param.h deleted file mode 100644 index d3e0168d8937e..0000000000000 --- a/arch/frv/include/uapi/asm/param.h +++ /dev/null @@ -1,9 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _ASM_PARAM_H -#define _ASM_PARAM_H - -#define EXEC_PAGESIZE 16384 - -#include - -#endif /* _ASM_PARAM_H */ diff --git a/arch/frv/include/uapi/asm/poll.h b/arch/frv/include/uapi/asm/poll.h deleted file mode 100644 index f55b45f475eca..0000000000000 --- a/arch/frv/include/uapi/asm/poll.h +++ /dev/null @@ -1,11 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _ASM_POLL_H -#define _ASM_POLL_H - -#define POLLWRNORM POLLOUT -#define POLLWRBAND 256 - -#include -#undef POLLREMOVE - -#endif diff --git a/arch/frv/include/uapi/asm/posix_types.h b/arch/frv/include/uapi/asm/posix_types.h deleted file mode 100644 index 2995777227b33..0000000000000 --- a/arch/frv/include/uapi/asm/posix_types.h +++ /dev/null @@ -1,27 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _ASM_POSIX_TYPES_H -#define _ASM_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 short __kernel_mode_t; -#define __kernel_mode_t __kernel_mode_t - -typedef unsigned short __kernel_ipc_pid_t; -#define __kernel_ipc_pid_t __kernel_ipc_pid_t - -typedef unsigned short __kernel_uid_t; -typedef unsigned short __kernel_gid_t; -#define __kernel_uid_t __kernel_uid_t - -typedef unsigned short __kernel_old_dev_t; -#define __kernel_old_dev_t __kernel_old_dev_t - -#include - -#endif - diff --git a/arch/frv/include/uapi/asm/ptrace.h b/arch/frv/include/uapi/asm/ptrace.h deleted file mode 100644 index f1d2f652d083d..0000000000000 --- a/arch/frv/include/uapi/asm/ptrace.h +++ /dev/null @@ -1,61 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ -/* ptrace.h: ptrace() relevant definitions - * - * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ -#ifndef _UAPI_ASM_PTRACE_H -#define _UAPI_ASM_PTRACE_H - -#include - - -#define PT_PSR 0 -#define PT_ISR 1 -#define PT_CCR 2 -#define PT_CCCR 3 -#define PT_LR 4 -#define PT_LCR 5 -#define PT_PC 6 - -#define PT__STATUS 7 /* exception status */ -#define PT_SYSCALLNO 8 /* syscall number or -1 */ -#define PT_ORIG_GR8 9 /* saved GR8 for signal handling */ -#define PT_GNER0 10 -#define PT_GNER1 11 -#define PT_IACC0H 12 -#define PT_IACC0L 13 - -#define PT_GR(j) ( 14 + (j)) /* GRj for 0<=j<=63 */ -#define PT_FR(j) ( 78 + (j)) /* FRj for 0<=j<=63 */ -#define PT_FNER(j) (142 + (j)) /* FNERj for 0<=j<=1 */ -#define PT_MSR(j) (144 + (j)) /* MSRj for 0<=j<=2 */ -#define PT_ACC(j) (146 + (j)) /* ACCj for 0<=j<=7 */ -#define PT_ACCG(jklm) (154 + (jklm)) /* ACCGjklm for 0<=jklm<=1 (reads four regs per slot) */ -#define PT_FSR(j) (156 + (j)) /* FSRj for 0<=j<=0 */ -#define PT__GPEND 78 -#define PT__END 157 - -#define PT_TBR PT_GR(0) -#define PT_SP PT_GR(1) -#define PT_FP PT_GR(2) -#define PT_PREV_FRAME PT_GR(28) /* previous exception frame pointer (old gr28 value) */ -#define PT_CURR_TASK PT_GR(29) /* current task */ - - -/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */ -#define PTRACE_GETREGS 12 -#define PTRACE_SETREGS 13 -#define PTRACE_GETFPREGS 14 -#define PTRACE_SETFPREGS 15 -#define PTRACE_GETFDPIC 31 /* get the ELF fdpic loadmap address */ - -#define PTRACE_GETFDPIC_EXEC 0 /* [addr] request the executable loadmap */ -#define PTRACE_GETFDPIC_INTERP 1 /* [addr] request the interpreter loadmap */ - -#endif /* _UAPI_ASM_PTRACE_H */ diff --git a/arch/frv/include/uapi/asm/registers.h b/arch/frv/include/uapi/asm/registers.h deleted file mode 100644 index 4caf09b6c193f..0000000000000 --- a/arch/frv/include/uapi/asm/registers.h +++ /dev/null @@ -1,233 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ -/* registers.h: register frame declarations - * - * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -/* - * notes: - * - * (1) that the members of all these structures are carefully aligned to permit - * usage of STD/STDF instructions - * - * (2) if you change these structures, you must change the code in - * arch/frvnommu/kernel/{break.S,entry.S,switch_to.S,gdb-stub.c} - * - * - * the kernel stack space block looks like this: - * - * +0x2000 +---------------------- - * | union { - * | struct frv_frame0 { - * | struct user_context { - * | struct user_int_regs - * | struct user_fpmedia_regs - * | } - * | struct frv_debug_regs - * | } - * | struct pt_regs [user exception] - * | } - * +---------------------- <-- __kernel_frame0_ptr (maybe GR28) - * | - * | kernel stack - * | - * |...................... - * | struct pt_regs [kernel exception] - * |...................... <-- __kernel_frame0_ptr (maybe GR28) - * | - * | kernel stack - * | - * |...................... <-- stack pointer (GR1) - * | - * | unused stack space - * | - * +---------------------- - * | struct thread_info - * +0x0000 +---------------------- <-- __current_thread_info (GR15); - * - * note that GR28 points to the current exception frame - */ - -#ifndef _ASM_REGISTERS_H -#define _ASM_REGISTERS_H - -#ifndef __ASSEMBLY__ -#define __OFFSET(X,N) ((X)+(N)*4) -#define __OFFSETC(X,N) xxxxxxxxxxxxxxxxxxxxxxxx -#else -#define __OFFSET(X,N) ((X)+(N)*4) -#define __OFFSETC(X,N) ((X)+(N)) -#endif - -/*****************************************************************************/ -/* - * Exception/Interrupt frame - * - held on kernel stack - * - 8-byte aligned on stack (old SP is saved in frame) - * - GR0 is fixed 0, so we don't save it - */ -#ifndef __ASSEMBLY__ - -struct pt_regs { - unsigned long psr; /* Processor Status Register */ - unsigned long isr; /* Integer Status Register */ - unsigned long ccr; /* Condition Code Register */ - unsigned long cccr; /* Condition Code for Conditional Insns Register */ - unsigned long lr; /* Link Register */ - unsigned long lcr; /* Loop Count Register */ - unsigned long pc; /* Program Counter Register */ - unsigned long __status; /* exception status */ - unsigned long syscallno; /* syscall number or -1 */ - unsigned long orig_gr8; /* original syscall arg #1 */ - unsigned long gner0; - unsigned long gner1; - unsigned long long iacc0; - unsigned long tbr; /* GR0 is fixed zero, so we use this for TBR */ - unsigned long sp; /* GR1: USP/KSP */ - unsigned long fp; /* GR2: FP */ - unsigned long gr3; - unsigned long gr4; - unsigned long gr5; - unsigned long gr6; - unsigned long gr7; /* syscall number */ - unsigned long gr8; /* 1st syscall param; syscall return */ - unsigned long gr9; /* 2nd syscall param */ - unsigned long gr10; /* 3rd syscall param */ - unsigned long gr11; /* 4th syscall param */ - unsigned long gr12; /* 5th syscall param */ - unsigned long gr13; /* 6th syscall param */ - unsigned long gr14; - unsigned long gr15; - unsigned long gr16; /* GP pointer */ - unsigned long gr17; /* small data */ - unsigned long gr18; /* PIC/PID */ - unsigned long gr19; - unsigned long gr20; - unsigned long gr21; - unsigned long gr22; - unsigned long gr23; - unsigned long gr24; - unsigned long gr25; - unsigned long gr26; - unsigned long gr27; - struct pt_regs *next_frame; /* GR28 - next exception frame */ - unsigned long gr29; /* GR29 - OS reserved */ - unsigned long gr30; /* GR30 - OS reserved */ - unsigned long gr31; /* GR31 - OS reserved */ -} __attribute__((aligned(8))); - -#endif - -#define REG__STATUS_STEP 0x00000001 /* - reenable single stepping on return */ -#define REG__STATUS_STEPPED 0x00000002 /* - single step caused exception */ -#define REG__STATUS_BROKE 0x00000004 /* - BREAK insn caused exception */ -#define REG__STATUS_SYSC_ENTRY 0x40000000 /* - T on syscall entry (ptrace.c only) */ -#define REG__STATUS_SYSC_EXIT 0x80000000 /* - T on syscall exit (ptrace.c only) */ - -#define REG_GR(R) __OFFSET(REG_GR0, (R)) - -#define REG_SP REG_GR(1) -#define REG_FP REG_GR(2) -#define REG_PREV_FRAME REG_GR(28) /* previous exception frame pointer (old gr28 value) */ -#define REG_CURR_TASK REG_GR(29) /* current task */ - -/*****************************************************************************/ -/* - * debugging registers - */ -#ifndef __ASSEMBLY__ - -struct frv_debug_regs -{ - unsigned long dcr; - unsigned long ibar[4] __attribute__((aligned(8))); - unsigned long dbar[4] __attribute__((aligned(8))); - unsigned long dbdr[4][4] __attribute__((aligned(8))); - unsigned long dbmr[4][4] __attribute__((aligned(8))); -} __attribute__((aligned(8))); - -#endif - -/*****************************************************************************/ -/* - * userspace registers - */ -#ifndef __ASSEMBLY__ - -struct user_int_regs -{ - /* integer registers - * - up to gr[31] mirror pt_regs - * - total size must be multiple of 8 bytes - */ - unsigned long psr; /* Processor Status Register */ - unsigned long isr; /* Integer Status Register */ - unsigned long ccr; /* Condition Code Register */ - unsigned long cccr; /* Condition Code for Conditional Insns Register */ - unsigned long lr; /* Link Register */ - unsigned long lcr; /* Loop Count Register */ - unsigned long pc; /* Program Counter Register */ - unsigned long __status; /* exception status */ - unsigned long syscallno; /* syscall number or -1 */ - unsigned long orig_gr8; /* original syscall arg #1 */ - unsigned long gner[2]; - unsigned long long iacc[1]; - - union { - unsigned long tbr; - unsigned long gr[64]; - }; -}; - -struct user_fpmedia_regs -{ - /* FP/Media registers */ - unsigned long fr[64]; - unsigned long fner[2]; - unsigned long msr[2]; - unsigned long acc[8]; - unsigned char accg[8]; - unsigned long fsr[1]; -}; - -struct user_context -{ - struct user_int_regs i; - struct user_fpmedia_regs f; - - /* we provide a context extension so that we can save the regs for CPUs that - * implement many more of Fujitsu's lavish register spec - */ - void *extension; -} __attribute__((aligned(8))); - -struct frv_frame0 { - union { - struct pt_regs regs; - struct user_context uc; - }; - - struct frv_debug_regs debug; - -} __attribute__((aligned(32))); - -#endif - -#define __INT_GR(R) __OFFSET(__INT_GR0, (R)) - -#define __FPMEDIA_FR(R) __OFFSET(__FPMEDIA_FR0, (R)) -#define __FPMEDIA_FNER(R) __OFFSET(__FPMEDIA_FNER0, (R)) -#define __FPMEDIA_MSR(R) __OFFSET(__FPMEDIA_MSR0, (R)) -#define __FPMEDIA_ACC(R) __OFFSET(__FPMEDIA_ACC0, (R)) -#define __FPMEDIA_ACCG(R) __OFFSETC(__FPMEDIA_ACCG0, (R)) -#define __FPMEDIA_FSR(R) __OFFSET(__FPMEDIA_FSR0, (R)) - -#define __THREAD_GR(R) __OFFSET(__THREAD_GR16, (R) - 16) - -#endif /* _ASM_REGISTERS_H */ diff --git a/arch/frv/include/uapi/asm/resource.h b/arch/frv/include/uapi/asm/resource.h deleted file mode 100644 index 2100305f9b3e0..0000000000000 --- a/arch/frv/include/uapi/asm/resource.h +++ /dev/null @@ -1,8 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _ASM_RESOURCE_H -#define _ASM_RESOURCE_H - -#include - -#endif /* _ASM_RESOURCE_H */ - diff --git a/arch/frv/include/uapi/asm/sembuf.h b/arch/frv/include/uapi/asm/sembuf.h deleted file mode 100644 index d5477f95832b1..0000000000000 --- a/arch/frv/include/uapi/asm/sembuf.h +++ /dev/null @@ -1,27 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _ASM_SEMBUF_H -#define _ASM_SEMBUF_H - -/* - * The semid64_ds structure for FR-V 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_SEMBUF_H */ - diff --git a/arch/frv/include/uapi/asm/setup.h b/arch/frv/include/uapi/asm/setup.h deleted file mode 100644 index f54957047900b..0000000000000 --- a/arch/frv/include/uapi/asm/setup.h +++ /dev/null @@ -1,19 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ -/* setup.h: setup stuff - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#ifndef _UAPI_ASM_SETUP_H -#define _UAPI_ASM_SETUP_H - -#define COMMAND_LINE_SIZE 512 - - -#endif /* _UAPI_ASM_SETUP_H */ diff --git a/arch/frv/include/uapi/asm/shmbuf.h b/arch/frv/include/uapi/asm/shmbuf.h deleted file mode 100644 index 1de8f892e4127..0000000000000 --- a/arch/frv/include/uapi/asm/shmbuf.h +++ /dev/null @@ -1,44 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _ASM_SHMBUF_H -#define _ASM_SHMBUF_H - -/* - * The shmid64_ds structure for FR-V 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_SHMBUF_H */ - diff --git a/arch/frv/include/uapi/asm/sigcontext.h b/arch/frv/include/uapi/asm/sigcontext.h deleted file mode 100644 index 8fbb0b00afdd8..0000000000000 --- a/arch/frv/include/uapi/asm/sigcontext.h +++ /dev/null @@ -1,27 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ -/* sigcontext.h: FRV signal context - * - * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ -#ifndef _ASM_SIGCONTEXT_H -#define _ASM_SIGCONTEXT_H - -#include - -/* - * Signal context structure - contains all info to do with the state - * before the signal handler was invoked. Note: only add new entries - * to the end of the structure. - */ -struct sigcontext { - struct user_context sc_context; - unsigned long sc_oldmask; /* old sigmask */ -} __attribute__((aligned(8))); - -#endif diff --git a/arch/frv/include/uapi/asm/signal.h b/arch/frv/include/uapi/asm/signal.h deleted file mode 100644 index 603bb796cf468..0000000000000 --- a/arch/frv/include/uapi/asm/signal.h +++ /dev/null @@ -1,37 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _UAPI_ASM_SIGNAL_H -#define _UAPI_ASM_SIGNAL_H - -#include - -#ifndef __KERNEL__ -/* Here we must cater to libcs that poke about in kernel headers. */ - -#define NSIG 32 -typedef unsigned long sigset_t; - -#endif /* !__KERNEL__ */ - -#define SA_RESTORER 0x04000000 /* to get struct sigaction correct */ - -#include - -#ifndef __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__ */ - -#endif /* _UAPI_ASM_SIGNAL_H */ diff --git a/arch/frv/include/uapi/asm/socket.h b/arch/frv/include/uapi/asm/socket.h deleted file mode 100644 index 9168e78fa32ae..0000000000000 --- a/arch/frv/include/uapi/asm/socket.h +++ /dev/null @@ -1,109 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _ASM_SOCKET_H -#define _ASM_SOCKET_H - -#include - -/* For setsockopt(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 -#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_GET_FILTER SO_ATTACH_FILTER - -#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 - -#define SO_TIMESTAMPING 37 -#define SCM_TIMESTAMPING SO_TIMESTAMPING - -#define SO_PROTOCOL 38 -#define SO_DOMAIN 39 - -#define SO_RXQ_OVFL 40 - -#define SO_WIFI_STATUS 41 -#define SCM_WIFI_STATUS SO_WIFI_STATUS -#define SO_PEEK_OFF 42 - -/* Instruct lower device to use last 4-bytes of skb data as FCS */ -#define SO_NOFCS 43 - -#define SO_LOCK_FILTER 44 - -#define SO_SELECT_ERR_QUEUE 45 - -#define SO_BUSY_POLL 46 - -#define SO_MAX_PACING_RATE 47 - -#define SO_BPF_EXTENSIONS 48 - -#define SO_INCOMING_CPU 49 - -#define SO_ATTACH_BPF 50 -#define SO_DETACH_BPF SO_DETACH_FILTER - -#define SO_ATTACH_REUSEPORT_CBPF 51 -#define SO_ATTACH_REUSEPORT_EBPF 52 - -#define SO_CNX_ADVICE 53 - -#define SCM_TIMESTAMPING_OPT_STATS 54 - -#define SO_MEMINFO 55 - -#define SO_INCOMING_NAPI_ID 56 - -#define SO_COOKIE 57 - -#define SCM_TIMESTAMPING_PKTINFO 58 - -#define SO_PEERGROUPS 59 - -#define SO_ZEROCOPY 60 - -#endif /* _ASM_SOCKET_H */ - diff --git a/arch/frv/include/uapi/asm/sockios.h b/arch/frv/include/uapi/asm/sockios.h deleted file mode 100644 index 2f62caf1ce845..0000000000000 --- a/arch/frv/include/uapi/asm/sockios.h +++ /dev/null @@ -1,15 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _ASM_SOCKIOS__ -#define _ASM_SOCKIOS__ - -/* 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_SOCKIOS__ */ - diff --git a/arch/frv/include/uapi/asm/stat.h b/arch/frv/include/uapi/asm/stat.h deleted file mode 100644 index 0ff9fab915a49..0000000000000 --- a/arch/frv/include/uapi/asm/stat.h +++ /dev/null @@ -1,101 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _ASM_STAT_H -#define _ASM_STAT_H - -struct __old_kernel_stat { - unsigned short st_dev; - unsigned short st_ino; - unsigned short st_mode; - unsigned short st_nlink; - unsigned short st_uid; - unsigned short st_gid; - unsigned short st_rdev; - unsigned long st_size; - unsigned long st_atime; - unsigned long st_mtime; - unsigned long st_ctime; -}; - -/* This matches struct stat in uClibc/glibc. */ -struct stat { - unsigned char __pad1[6]; - unsigned short st_dev; - - unsigned long __pad2; - unsigned long st_ino; - - unsigned short __pad3; - unsigned short st_mode; - unsigned short __pad4; - unsigned short st_nlink; - - unsigned short __pad5; - unsigned short st_uid; - unsigned short __pad6; - unsigned short st_gid; - - unsigned char __pad7[6]; - unsigned short st_rdev; - - unsigned long __pad8; - unsigned long st_size; - - unsigned long __pad9; /* align 64-bit st_blocks to 2-word */ - unsigned long st_blksize; - - unsigned long __pad10; /* future possible st_blocks high bits */ - unsigned long st_blocks; /* Number 512-byte blocks allocated. */ - - unsigned long __unused1; - unsigned long st_atime; - - unsigned long __unused2; - unsigned long st_mtime; - - unsigned long __unused3; - unsigned long st_ctime; - - unsigned long long __unused4; -}; - -/* This matches struct stat64 in uClibc/glibc. The layout is exactly - the same as that of struct stat above, with 64-bit types taking up - space that was formerly used by padding. stat syscalls are still - different from stat64, though, in that the former tests for - overflow. */ -struct stat64 { - unsigned char __pad1[6]; - unsigned short st_dev; - - unsigned long long st_ino; - - unsigned int st_mode; - unsigned int st_nlink; - - unsigned long st_uid; - unsigned long st_gid; - - unsigned char __pad2[6]; - unsigned short st_rdev; - - long long st_size; - - unsigned long __pad3; /* align 64-bit st_blocks to 2-word */ - unsigned long st_blksize; - - unsigned long __pad4; /* future possible st_blocks high bits */ - unsigned long st_blocks; /* Number 512-byte blocks allocated. */ - - unsigned long st_atime_nsec; - unsigned long st_atime; - - unsigned int st_mtime_nsec; - unsigned long st_mtime; - - unsigned long st_ctime_nsec; - unsigned long st_ctime; - - unsigned long long __unused4; -}; - -#endif /* _ASM_STAT_H */ diff --git a/arch/frv/include/uapi/asm/statfs.h b/arch/frv/include/uapi/asm/statfs.h deleted file mode 100644 index 2a378cbff07f9..0000000000000 --- a/arch/frv/include/uapi/asm/statfs.h +++ /dev/null @@ -1,8 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _ASM_STATFS_H -#define _ASM_STATFS_H - -#include - -#endif /* _ASM_STATFS_H */ - diff --git a/arch/frv/include/uapi/asm/swab.h b/arch/frv/include/uapi/asm/swab.h deleted file mode 100644 index c78257d172e51..0000000000000 --- a/arch/frv/include/uapi/asm/swab.h +++ /dev/null @@ -1,11 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _ASM_SWAB_H -#define _ASM_SWAB_H - -#include - -#if defined(__GNUC__) && !defined(__STRICT_ANSI__) || defined(__KERNEL__) -# define __SWAB_64_THRU_32__ -#endif - -#endif /* _ASM_SWAB_H */ diff --git a/arch/frv/include/uapi/asm/termbits.h b/arch/frv/include/uapi/asm/termbits.h deleted file mode 100644 index b1dcd8d0ff78a..0000000000000 --- a/arch/frv/include/uapi/asm/termbits.h +++ /dev/null @@ -1,204 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _ASM_TERMBITS_H__ -#define _ASM_TERMBITS_H__ - -#include - -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 termios2 { - 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 */ -}; - -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 BOTHER 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 */ -#define CTVB 004000000000 /* VisioBraille Terminal flow control */ -#define CMSPAR 010000000000 /* mark or space (stick) parity */ -#define CRTSCTS 020000000000 /* flow control */ - -#define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */ - -/* c_lflag bits */ -#define ISIG 0000001 -#define ICANON 0000002 -#define XCASE 0000004 -#define ECHO 0000010 -#define ECHOE 0000020 -#define ECHOK 0000040 -#define ECHONL 0000100 -#define NOFLSH 0000200 -#define TOSTOP 0000400 -#define ECHOCTL 0001000 -#define ECHOPRT 0002000 -#define ECHOKE 0004000 -#define FLUSHO 0010000 -#define PENDIN 0040000 -#define IEXTEN 0100000 -#define EXTPROC 0200000 - - -/* 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_TERMBITS_H__ */ - diff --git a/arch/frv/include/uapi/asm/termios.h b/arch/frv/include/uapi/asm/termios.h deleted file mode 100644 index ae35bedae6a2e..0000000000000 --- a/arch/frv/include/uapi/asm/termios.h +++ /dev/null @@ -1,47 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _UAPI_ASM_TERMIOS_H -#define _UAPI_ASM_TERMIOS_H - -#include -#include - -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 */ -}; - - -/* 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 - -#define TIOCM_MODEM_BITS TIOCM_OUT2 /* IRDA support */ - -/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ - - -#endif /* _UAPI_ASM_TERMIOS_H */ diff --git a/arch/frv/include/uapi/asm/types.h b/arch/frv/include/uapi/asm/types.h deleted file mode 100644 index db74ad9ba6c07..0000000000000 --- a/arch/frv/include/uapi/asm/types.h +++ /dev/null @@ -1,12 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */ -/* types.h: FRV types - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ -#include diff --git a/arch/frv/include/uapi/asm/unistd.h b/arch/frv/include/uapi/asm/unistd.h deleted file mode 100644 index 4b46acaf832b3..0000000000000 --- a/arch/frv/include/uapi/asm/unistd.h +++ /dev/null @@ -1,349 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _UAPI_ASM_UNISTD_H_ -#define _UAPI_ASM_UNISTD_H_ - -/* - * This file contains the system call numbers. - */ - -#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 */ obsolete -#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 /* obsolete - not implemented */ -#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 */ obsolete -#define __NR_statfs 99 -#define __NR_fstatfs 100 -// #define __NR_ioperm /* 101 */ not supported -#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 */ obsolete -// #define __NR_iopl /* 110 */ not supported -#define __NR_vhangup 111 -// #define __NR_idle /* 112 */ Obsolete -// #define __NR_vm86old /* 113 */ not supported -#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 */ not supported -#define __NR_cacheflush 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 */ not supported -#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_getdents64 220 -#define __NR_fcntl64 221 -#define __NR_security 223 /* syscall for security modules */ -#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 - -#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_timerfd_settime 325 -#define __NR_timerfd_gettime 326 -#define __NR_signalfd4 327 -#define __NR_eventfd2 328 -#define __NR_epoll_create1 329 -#define __NR_dup3 330 -#define __NR_pipe2 331 -#define __NR_inotify_init1 332 -#define __NR_preadv 333 -#define __NR_pwritev 334 -#define __NR_rt_tgsigqueueinfo 335 -#define __NR_perf_event_open 336 -#define __NR_setns 337 - -#endif /* _UAPI_ASM_UNISTD_H_ */ diff --git a/arch/frv/kernel/.gitignore b/arch/frv/kernel/.gitignore deleted file mode 100644 index c5f676c3c224b..0000000000000 --- a/arch/frv/kernel/.gitignore +++ /dev/null @@ -1 +0,0 @@ -vmlinux.lds diff --git a/arch/frv/kernel/Makefile b/arch/frv/kernel/Makefile deleted file mode 100644 index 216ddf30c3c10..0000000000000 --- a/arch/frv/kernel/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# -# Makefile for the linux kernel. -# - -heads-y := head-uc-fr401.o head-uc-fr451.o head-uc-fr555.o -heads-$(CONFIG_MMU) := head-mmu-fr451.o - -extra-y:= head.o vmlinux.lds - -obj-y := $(heads-y) entry.o entry-table.o break.o switch_to.o \ - process.o traps.o ptrace.o signal.o dma.o \ - sys_frv.o time.o setup.o frv_ksyms.o \ - debug-stub.o irq.o sleep.o uaccess.o - -obj-$(CONFIG_GDBSTUB) += gdb-stub.o gdb-io.o - -obj-$(CONFIG_MB93091_VDK) += irq-mb93091.o -obj-$(CONFIG_PM) += pm.o cmode.o -obj-$(CONFIG_MB93093_PDK) += pm-mb93093.o -obj-$(CONFIG_FUJITSU_MB93493) += irq-mb93493.o -obj-$(CONFIG_SYSCTL) += sysctl.o -obj-$(CONFIG_FUTEX) += futex.o -obj-$(CONFIG_MODULES) += module.o diff --git a/arch/frv/kernel/asm-offsets.c b/arch/frv/kernel/asm-offsets.c deleted file mode 100644 index 0a468e9b51add..0000000000000 --- a/arch/frv/kernel/asm-offsets.c +++ /dev/null @@ -1,96 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * Generate definitions needed by assembly language modules. - * This code generates raw asm output which is post-processed - * to extract and format the required data. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define DEF_PTREG(sym, reg) OFFSET(sym, pt_regs, reg) -#define DEF_IREG(sym, reg) OFFSET(sym, user_context, reg) -#define DEF_FREG(sym, reg) OFFSET(sym, user_context, reg) -#define DEF_0REG(sym, reg) OFFSET(sym, frv_frame0, reg) - -void foo(void) -{ - /* offsets into the thread_info structure */ - OFFSET(TI_TASK, thread_info, task); - OFFSET(TI_FLAGS, thread_info, flags); - OFFSET(TI_STATUS, thread_info, status); - OFFSET(TI_CPU, thread_info, cpu); - OFFSET(TI_PREEMPT_COUNT, thread_info, preempt_count); - OFFSET(TI_ADDR_LIMIT, thread_info, addr_limit); - BLANK(); - - /* offsets into register file storage */ - DEF_PTREG(REG_PSR, psr); - DEF_PTREG(REG_ISR, isr); - DEF_PTREG(REG_CCR, ccr); - DEF_PTREG(REG_CCCR, cccr); - DEF_PTREG(REG_LR, lr); - DEF_PTREG(REG_LCR, lcr); - DEF_PTREG(REG_PC, pc); - DEF_PTREG(REG__STATUS, __status); - DEF_PTREG(REG_SYSCALLNO, syscallno); - DEF_PTREG(REG_ORIG_GR8, orig_gr8); - DEF_PTREG(REG_GNER0, gner0); - DEF_PTREG(REG_GNER1, gner1); - DEF_PTREG(REG_IACC0, iacc0); - DEF_PTREG(REG_TBR, tbr); - DEF_PTREG(REG_GR0, tbr); - DEFINE(REG__END, sizeof(struct pt_regs)); - BLANK(); - - DEF_0REG(REG_DCR, debug.dcr); - DEF_0REG(REG_IBAR0, debug.ibar[0]); - DEF_0REG(REG_DBAR0, debug.dbar[0]); - DEF_0REG(REG_DBDR00, debug.dbdr[0][0]); - DEF_0REG(REG_DBMR00, debug.dbmr[0][0]); - BLANK(); - - DEF_IREG(__INT_GR0, i.gr[0]); - DEF_FREG(__USER_FPMEDIA, f); - DEF_FREG(__FPMEDIA_FR0, f.fr[0]); - DEF_FREG(__FPMEDIA_FNER0, f.fner[0]); - DEF_FREG(__FPMEDIA_MSR0, f.msr[0]); - DEF_FREG(__FPMEDIA_ACC0, f.acc[0]); - DEF_FREG(__FPMEDIA_ACCG0, f.accg[0]); - DEF_FREG(__FPMEDIA_FSR0, f.fsr[0]); - BLANK(); - - DEFINE(NR_PT_REGS, sizeof(struct pt_regs) / 4); - DEFINE(NR_USER_INT_REGS, sizeof(struct user_int_regs) / 4); - DEFINE(NR_USER_FPMEDIA_REGS, sizeof(struct user_fpmedia_regs) / 4); - DEFINE(NR_USER_CONTEXT, sizeof(struct user_context) / 4); - DEFINE(FRV_FRAME0_SIZE, sizeof(struct frv_frame0)); - BLANK(); - - /* offsets into thread_struct */ - OFFSET(__THREAD_FRAME, thread_struct, frame); - OFFSET(__THREAD_CURR, thread_struct, curr); - OFFSET(__THREAD_SP, thread_struct, sp); - OFFSET(__THREAD_FP, thread_struct, fp); - OFFSET(__THREAD_LR, thread_struct, lr); - OFFSET(__THREAD_PC, thread_struct, pc); - OFFSET(__THREAD_GR16, thread_struct, gr[0]); - OFFSET(__THREAD_SCHED_LR, thread_struct, sched_lr); - OFFSET(__THREAD_FRAME0, thread_struct, frame0); - OFFSET(__THREAD_USER, thread_struct, user); - BLANK(); - - /* offsets into frv_debug_status */ - OFFSET(DEBUG_BPSR, frv_debug_status, bpsr); - OFFSET(DEBUG_DCR, frv_debug_status, dcr); - OFFSET(DEBUG_BRR, frv_debug_status, brr); - OFFSET(DEBUG_NMAR, frv_debug_status, nmar); - BLANK(); -} diff --git a/arch/frv/kernel/break.S b/arch/frv/kernel/break.S deleted file mode 100644 index cbb6958a31471..0000000000000 --- a/arch/frv/kernel/break.S +++ /dev/null @@ -1,792 +0,0 @@ -/* break.S: Break interrupt handling (kept separate from entry.S) - * - * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#include -#include -#include -#include -#include -#include - -#include - -# -# the break handler has its own stack -# - .section .bss..stack - .globl __break_user_context - .balign THREAD_SIZE -__break_stack: - .space THREAD_SIZE - FRV_FRAME0_SIZE -__break_frame_0: - .space FRV_FRAME0_SIZE - -# -# miscellaneous variables -# - .section .bss -#ifdef CONFIG_MMU - .globl __break_tlb_miss_real_return_info -__break_tlb_miss_real_return_info: - .balign 8 - .space 2*4 /* saved PCSR, PSR for TLB-miss handler fixup */ -#endif - -__break_trace_through_exceptions: - .space 4 - -#define CS2_ECS1 0xe1200000 -#define CS2_USERLED 0x4 - -.macro LEDS val,reg -# sethi.p %hi(CS2_ECS1+CS2_USERLED),gr30 -# setlo %lo(CS2_ECS1+CS2_USERLED),gr30 -# setlos #~\val,\reg -# st \reg,@(gr30,gr0) -# setlos #0x5555,\reg -# sethi.p %hi(0xffc00100),gr30 -# setlo %lo(0xffc00100),gr30 -# sth \reg,@(gr30,gr0) -# membar -.endm - -############################################################################### -# -# entry point for Break Exceptions/Interrupts -# -############################################################################### - .section .text..break - .balign 4 - .globl __entry_break -__entry_break: -#ifdef CONFIG_MMU - movgs gr31,scr3 -#endif - LEDS 0x1001,gr31 - - sethi.p %hi(__break_frame_0),gr31 - setlo %lo(__break_frame_0),gr31 - - stdi gr2,@(gr31,#REG_GR(2)) - movsg ccr,gr3 - sti gr3,@(gr31,#REG_CCR) - - # catch the return from a TLB-miss handler that had single-step disabled - # traps will be enabled, so we have to do this now -#ifdef CONFIG_MMU - movsg bpcsr,gr3 - sethi.p %hi(__break_tlb_miss_return_breaks_here),gr2 - setlo %lo(__break_tlb_miss_return_breaks_here),gr2 - subcc gr2,gr3,gr0,icc0 - beq icc0,#2,__break_return_singlestep_tlbmiss -#endif - - # determine whether we have stepped through into an exception - # - we need to take special action to suspend h/w single stepping if we've done - # that, so that the gdbstub doesn't get bogged down endlessly stepping through - # external interrupt handling - movsg bpsr,gr3 - andicc gr3,#BPSR_BET,gr0,icc0 - bne icc0,#2,__break_maybe_userspace /* jump if PSR.ET was 1 */ - - LEDS 0x1003,gr2 - - movsg brr,gr3 - andicc gr3,#BRR_ST,gr0,icc0 - andicc.p gr3,#BRR_SB,gr0,icc1 - bne icc0,#2,__break_step /* jump if single-step caused break */ - beq icc1,#2,__break_continue /* jump if BREAK didn't cause break */ - - LEDS 0x1007,gr2 - - # handle special breaks - movsg bpcsr,gr3 - - sethi.p %hi(__entry_return_singlestep_breaks_here),gr2 - setlo %lo(__entry_return_singlestep_breaks_here),gr2 - subcc gr2,gr3,gr0,icc0 - beq icc0,#2,__break_return_singlestep - - bra __break_continue - - -############################################################################### -# -# handle BREAK instruction in kernel-mode exception epilogue -# -############################################################################### -__break_return_singlestep: - LEDS 0x100f,gr2 - - # special break insn requests single-stepping to be turned back on - # HERE RETT - # PSR.ET 0 0 - # PSR.PS old PSR.S ? - # PSR.S 1 1 - # BPSR.ET 0 1 (can't have caused orig excep otherwise) - # BPSR.BS 1 old PSR.S - movsg dcr,gr2 - sethi.p %hi(DCR_SE),gr3 - setlo %lo(DCR_SE),gr3 - or gr2,gr3,gr2 - movgs gr2,dcr - - movsg psr,gr2 - andi gr2,#PSR_PS,gr2 - slli gr2,#11,gr2 /* PSR.PS -> BPSR.BS */ - ori gr2,#BPSR_BET,gr2 /* 1 -> BPSR.BET */ - movgs gr2,bpsr - - # return to the invoker of the original kernel exception - movsg pcsr,gr2 - movgs gr2,bpcsr - - LEDS 0x101f,gr2 - - ldi @(gr31,#REG_CCR),gr3 - movgs gr3,ccr - lddi.p @(gr31,#REG_GR(2)),gr2 - xor gr31,gr31,gr31 - movgs gr0,brr -#ifdef CONFIG_MMU - movsg scr3,gr31 -#endif - rett #1 - -############################################################################### -# -# handle BREAK instruction in TLB-miss handler return path -# -############################################################################### -#ifdef CONFIG_MMU -__break_return_singlestep_tlbmiss: - LEDS 0x1100,gr2 - - sethi.p %hi(__break_tlb_miss_real_return_info),gr3 - setlo %lo(__break_tlb_miss_real_return_info),gr3 - lddi @(gr3,#0),gr2 - movgs gr2,pcsr - movgs gr3,psr - - bra __break_return_singlestep -#endif - - -############################################################################### -# -# handle single stepping into an exception prologue from kernel mode -# - we try and catch it whilst it is still in the main vector table -# - if we catch it there, we have to jump to the fixup handler -# - there is a fixup table that has a pointer for every 16b slot in the trap -# table -# -############################################################################### -__break_step: - LEDS 0x2003,gr2 - - # external interrupts seem to escape from the trap table before single - # step catches up with them - movsg bpcsr,gr2 - sethi.p %hi(__entry_kernel_external_interrupt),gr3 - setlo %lo(__entry_kernel_external_interrupt),gr3 - subcc.p gr2,gr3,gr0,icc0 - sethi %hi(__entry_uspace_external_interrupt),gr3 - setlo.p %lo(__entry_uspace_external_interrupt),gr3 - beq icc0,#2,__break_step_kernel_external_interrupt - subcc.p gr2,gr3,gr0,icc0 - sethi %hi(__entry_kernel_external_interrupt_virtually_disabled),gr3 - setlo.p %lo(__entry_kernel_external_interrupt_virtually_disabled),gr3 - beq icc0,#2,__break_step_uspace_external_interrupt - subcc.p gr2,gr3,gr0,icc0 - sethi %hi(__entry_kernel_external_interrupt_virtual_reenable),gr3 - setlo.p %lo(__entry_kernel_external_interrupt_virtual_reenable),gr3 - beq icc0,#2,__break_step_kernel_external_interrupt_virtually_disabled - subcc gr2,gr3,gr0,icc0 - beq icc0,#2,__break_step_kernel_external_interrupt_virtual_reenable - - LEDS 0x2007,gr2 - - # the two main vector tables are adjacent on one 8Kb slab - movsg bpcsr,gr2 - setlos #0xffffe000,gr3 - and gr2,gr3,gr2 - sethi.p %hi(__trap_tables),gr3 - setlo %lo(__trap_tables),gr3 - subcc gr2,gr3,gr0,icc0 - bne icc0,#2,__break_continue - - LEDS 0x200f,gr2 - - # skip workaround if so requested by GDB - sethi.p %hi(__break_trace_through_exceptions),gr3 - setlo %lo(__break_trace_through_exceptions),gr3 - ld @(gr3,gr0),gr3 - subcc gr3,gr0,gr0,icc0 - bne icc0,#0,__break_continue - - LEDS 0x201f,gr2 - - # access the fixup table - there's a 1:1 mapping between the slots in the trap tables and - # the slots in the trap fixup tables allowing us to simply divide the offset into the - # former by 4 to access the latter - sethi.p %hi(__trap_tables),gr3 - setlo %lo(__trap_tables),gr3 - movsg bpcsr,gr2 - sub gr2,gr3,gr2 - srli.p gr2,#2,gr2 - - sethi %hi(__trap_fixup_tables),gr3 - setlo.p %lo(__trap_fixup_tables),gr3 - andi gr2,#~3,gr2 - ld @(gr2,gr3),gr2 - jmpil @(gr2,#0) - -# step through an internal exception from kernel mode - .globl __break_step_kernel_softprog_interrupt -__break_step_kernel_softprog_interrupt: - sethi.p %hi(__entry_kernel_softprog_interrupt_reentry),gr3 - setlo %lo(__entry_kernel_softprog_interrupt_reentry),gr3 - bra __break_return_as_kernel_prologue - -# step through an external interrupt from kernel mode - .globl __break_step_kernel_external_interrupt -__break_step_kernel_external_interrupt: - # deal with virtual interrupt disablement - beq icc2,#0,__break_step_kernel_external_interrupt_virtually_disabled - - sethi.p %hi(__entry_kernel_external_interrupt_reentry),gr3 - setlo %lo(__entry_kernel_external_interrupt_reentry),gr3 - -__break_return_as_kernel_prologue: - LEDS 0x203f,gr2 - - movgs gr3,bpcsr - - # do the bit we had to skip -#ifdef CONFIG_MMU - movsg ear0,gr2 /* EAR0 can get clobbered by gdb-stub (ICI/ICEI) */ - movgs gr2,scr2 -#endif - - or.p sp,gr0,gr2 /* set up the stack pointer */ - subi sp,#REG__END,sp - sti.p gr2,@(sp,#REG_SP) - - setlos #REG__STATUS_STEP,gr2 - sti gr2,@(sp,#REG__STATUS) /* record single step status */ - - # cancel single-stepping mode - movsg dcr,gr2 - sethi.p %hi(~DCR_SE),gr3 - setlo %lo(~DCR_SE),gr3 - and gr2,gr3,gr2 - movgs gr2,dcr - - LEDS 0x207f,gr2 - - ldi @(gr31,#REG_CCR),gr3 - movgs gr3,ccr - lddi.p @(gr31,#REG_GR(2)),gr2 - xor gr31,gr31,gr31 - movgs gr0,brr -#ifdef CONFIG_MMU - movsg scr3,gr31 -#endif - rett #1 - -# we single-stepped into an interrupt handler whilst interrupts were merely virtually disabled -# need to really disable interrupts, set flag, fix up and return -__break_step_kernel_external_interrupt_virtually_disabled: - movsg psr,gr2 - andi gr2,#~PSR_PIL,gr2 - ori gr2,#PSR_PIL_14,gr2 /* debugging interrupts only */ - movgs gr2,psr - - ldi @(gr31,#REG_CCR),gr3 - movgs gr3,ccr - subcc.p gr0,gr0,gr0,icc2 /* leave Z set, clear C */ - - # exceptions must've been enabled and we must've been in supervisor mode - setlos BPSR_BET|BPSR_BS,gr3 - movgs gr3,bpsr - - # return to where the interrupt happened - movsg pcsr,gr2 - movgs gr2,bpcsr - - lddi.p @(gr31,#REG_GR(2)),gr2 - - xor gr31,gr31,gr31 - movgs gr0,brr -#ifdef CONFIG_MMU - movsg scr3,gr31 -#endif - rett #1 - -# we stepped through into the virtual interrupt reenablement trap -# -# we also want to single step anyway, but after fixing up so that we get an event on the -# instruction after the broken-into exception returns - .globl __break_step_kernel_external_interrupt_virtual_reenable -__break_step_kernel_external_interrupt_virtual_reenable: - movsg psr,gr2 - andi gr2,#~PSR_PIL,gr2 - movgs gr2,psr - - ldi @(gr31,#REG_CCR),gr3 - movgs gr3,ccr - subicc gr0,#1,gr0,icc2 /* clear Z, set C */ - - # save the adjusted ICC2 - movsg ccr,gr3 - sti gr3,@(gr31,#REG_CCR) - - # exceptions must've been enabled and we must've been in supervisor mode - setlos BPSR_BET|BPSR_BS,gr3 - movgs gr3,bpsr - - # return to where the trap happened - movsg pcsr,gr2 - movgs gr2,bpcsr - - # and then process the single step - bra __break_continue - -# step through an internal exception from uspace mode - .globl __break_step_uspace_softprog_interrupt -__break_step_uspace_softprog_interrupt: - sethi.p %hi(__entry_uspace_softprog_interrupt_reentry),gr3 - setlo %lo(__entry_uspace_softprog_interrupt_reentry),gr3 - bra __break_return_as_uspace_prologue - -# step through an external interrupt from kernel mode - .globl __break_step_uspace_external_interrupt -__break_step_uspace_external_interrupt: - sethi.p %hi(__entry_uspace_external_interrupt_reentry),gr3 - setlo %lo(__entry_uspace_external_interrupt_reentry),gr3 - -__break_return_as_uspace_prologue: - LEDS 0x20ff,gr2 - - movgs gr3,bpcsr - - # do the bit we had to skip - sethi.p %hi(__kernel_frame0_ptr),gr28 - setlo %lo(__kernel_frame0_ptr),gr28 - ldi.p @(gr28,#0),gr28 - - setlos #REG__STATUS_STEP,gr2 - sti gr2,@(gr28,#REG__STATUS) /* record single step status */ - - # cancel single-stepping mode - movsg dcr,gr2 - sethi.p %hi(~DCR_SE),gr3 - setlo %lo(~DCR_SE),gr3 - and gr2,gr3,gr2 - movgs gr2,dcr - - LEDS 0x20fe,gr2 - - ldi @(gr31,#REG_CCR),gr3 - movgs gr3,ccr - lddi.p @(gr31,#REG_GR(2)),gr2 - xor gr31,gr31,gr31 - movgs gr0,brr -#ifdef CONFIG_MMU - movsg scr3,gr31 -#endif - rett #1 - -#ifdef CONFIG_MMU -# step through an ITLB-miss handler from user mode - .globl __break_user_insn_tlb_miss -__break_user_insn_tlb_miss: - # we'll want to try the trap stub again - sethi.p %hi(__trap_user_insn_tlb_miss),gr2 - setlo %lo(__trap_user_insn_tlb_miss),gr2 - movgs gr2,bpcsr - -__break_tlb_miss_common: - LEDS 0x2101,gr2 - - # cancel single-stepping mode - movsg dcr,gr2 - sethi.p %hi(~DCR_SE),gr3 - setlo %lo(~DCR_SE),gr3 - and gr2,gr3,gr2 - movgs gr2,dcr - - # we'll swap the real return address for one with a BREAK insn so that we can re-enable - # single stepping on return - movsg pcsr,gr2 - sethi.p %hi(__break_tlb_miss_real_return_info),gr3 - setlo %lo(__break_tlb_miss_real_return_info),gr3 - sti gr2,@(gr3,#0) - - sethi.p %hi(__break_tlb_miss_return_break),gr2 - setlo %lo(__break_tlb_miss_return_break),gr2 - movgs gr2,pcsr - - # we also have to fudge PSR because the return BREAK is in kernel space and we want - # to get a BREAK fault not an access violation should the return be to userspace - movsg psr,gr2 - sti.p gr2,@(gr3,#4) - ori gr2,#PSR_PS,gr2 - movgs gr2,psr - - LEDS 0x2102,gr2 - - ldi @(gr31,#REG_CCR),gr3 - movgs gr3,ccr - lddi @(gr31,#REG_GR(2)),gr2 - movsg scr3,gr31 - movgs gr0,brr - rett #1 - -# step through a DTLB-miss handler from user mode - .globl __break_user_data_tlb_miss -__break_user_data_tlb_miss: - # we'll want to try the trap stub again - sethi.p %hi(__trap_user_data_tlb_miss),gr2 - setlo %lo(__trap_user_data_tlb_miss),gr2 - movgs gr2,bpcsr - bra __break_tlb_miss_common - -# step through an ITLB-miss handler from kernel mode - .globl __break_kernel_insn_tlb_miss -__break_kernel_insn_tlb_miss: - # we'll want to try the trap stub again - sethi.p %hi(__trap_kernel_insn_tlb_miss),gr2 - setlo %lo(__trap_kernel_insn_tlb_miss),gr2 - movgs gr2,bpcsr - bra __break_tlb_miss_common - -# step through a DTLB-miss handler from kernel mode - .globl __break_kernel_data_tlb_miss -__break_kernel_data_tlb_miss: - # we'll want to try the trap stub again - sethi.p %hi(__trap_kernel_data_tlb_miss),gr2 - setlo %lo(__trap_kernel_data_tlb_miss),gr2 - movgs gr2,bpcsr - bra __break_tlb_miss_common -#endif - -############################################################################### -# -# handle debug events originating with userspace -# -############################################################################### -__break_maybe_userspace: - LEDS 0x3003,gr2 - - setlos #BPSR_BS,gr2 - andcc gr3,gr2,gr0,icc0 - bne icc0,#0,__break_continue /* skip if PSR.S was 1 */ - - movsg brr,gr2 - andicc gr2,#BRR_ST|BRR_SB,gr0,icc0 - beq icc0,#0,__break_continue /* jump if not BREAK or single-step */ - - LEDS 0x3007,gr2 - - # do the first part of the exception prologue here - sethi.p %hi(__kernel_frame0_ptr),gr28 - setlo %lo(__kernel_frame0_ptr),gr28 - ldi @(gr28,#0),gr28 - andi gr28,#~7,gr28 - - # set up the kernel stack pointer - sti sp ,@(gr28,#REG_SP) - ori gr28,0,sp - sti gr0 ,@(gr28,#REG_GR(28)) - - stdi gr20,@(gr28,#REG_GR(20)) - stdi gr22,@(gr28,#REG_GR(22)) - - movsg tbr,gr20 - movsg bpcsr,gr21 - movsg psr,gr22 - - # determine the exception type and cancel single-stepping mode - or gr0,gr0,gr23 - - movsg dcr,gr2 - sethi.p %hi(DCR_SE),gr3 - setlo %lo(DCR_SE),gr3 - andcc gr2,gr3,gr0,icc0 - beq icc0,#0,__break_no_user_sstep /* must have been a BREAK insn */ - - not gr3,gr3 - and gr2,gr3,gr2 - movgs gr2,dcr - ori gr23,#REG__STATUS_STEP,gr23 - -__break_no_user_sstep: - LEDS 0x300f,gr2 - - movsg brr,gr2 - andi gr2,#BRR_ST|BRR_SB,gr2 - slli gr2,#1,gr2 - or gr23,gr2,gr23 - sti.p gr23,@(gr28,#REG__STATUS) /* record single step status */ - - # adjust the value acquired from TBR - this indicates the exception - setlos #~TBR_TT,gr2 - and.p gr20,gr2,gr20 - setlos #TBR_TT_BREAK,gr2 - or.p gr20,gr2,gr20 - - # fudge PSR.PS and BPSR.BS to return to kernel mode through the trap - # table as trap 126 - andi gr22,#~PSR_PS,gr22 /* PSR.PS should be 0 */ - movgs gr22,psr - - setlos #BPSR_BS,gr2 /* BPSR.BS should be 1 and BPSR.BET 0 */ - movgs gr2,bpsr - - # return through remainder of the exception prologue - # - need to load gr23 with return handler address - sethi.p %hi(__entry_return_from_user_exception),gr23 - setlo %lo(__entry_return_from_user_exception),gr23 - sethi.p %hi(__entry_common),gr3 - setlo %lo(__entry_common),gr3 - movgs gr3,bpcsr - - LEDS 0x301f,gr2 - - ldi @(gr31,#REG_CCR),gr3 - movgs gr3,ccr - lddi.p @(gr31,#REG_GR(2)),gr2 - xor gr31,gr31,gr31 - movgs gr0,brr -#ifdef CONFIG_MMU - movsg scr3,gr31 -#endif - rett #1 - -############################################################################### -# -# resume normal debug-mode entry -# -############################################################################### -__break_continue: - LEDS 0x4003,gr2 - - # set up the kernel stack pointer - sti sp,@(gr31,#REG_SP) - - sethi.p %hi(__break_frame_0),sp - setlo %lo(__break_frame_0),sp - - # finish building the exception frame - stdi gr4 ,@(gr31,#REG_GR(4)) - stdi gr6 ,@(gr31,#REG_GR(6)) - stdi gr8 ,@(gr31,#REG_GR(8)) - stdi gr10,@(gr31,#REG_GR(10)) - stdi gr12,@(gr31,#REG_GR(12)) - stdi gr14,@(gr31,#REG_GR(14)) - stdi gr16,@(gr31,#REG_GR(16)) - stdi gr18,@(gr31,#REG_GR(18)) - stdi gr20,@(gr31,#REG_GR(20)) - stdi gr22,@(gr31,#REG_GR(22)) - stdi gr24,@(gr31,#REG_GR(24)) - stdi gr26,@(gr31,#REG_GR(26)) - sti gr0 ,@(gr31,#REG_GR(28)) /* NULL frame pointer */ - sti gr29,@(gr31,#REG_GR(29)) - sti gr30,@(gr31,#REG_GR(30)) - sti gr8 ,@(gr31,#REG_ORIG_GR8) - -#ifdef CONFIG_MMU - movsg scr3,gr19 - sti gr19,@(gr31,#REG_GR(31)) -#endif - - movsg bpsr ,gr19 - movsg tbr ,gr20 - movsg bpcsr,gr21 - movsg psr ,gr22 - movsg isr ,gr23 - movsg cccr ,gr25 - movsg lr ,gr26 - movsg lcr ,gr27 - - andi.p gr22,#~(PSR_S|PSR_ET),gr5 /* rebuild PSR */ - andi gr19,#PSR_ET,gr4 - or.p gr4,gr5,gr5 - srli gr19,#10,gr4 - andi gr4,#PSR_S,gr4 - or.p gr4,gr5,gr5 - - setlos #-1,gr6 - sti gr20,@(gr31,#REG_TBR) - sti gr21,@(gr31,#REG_PC) - sti gr5 ,@(gr31,#REG_PSR) - sti gr23,@(gr31,#REG_ISR) - sti gr25,@(gr31,#REG_CCCR) - stdi gr26,@(gr31,#REG_LR) - sti gr6 ,@(gr31,#REG_SYSCALLNO) - - # store CPU-specific regs - movsg iacc0h,gr4 - movsg iacc0l,gr5 - stdi gr4,@(gr31,#REG_IACC0) - - movsg gner0,gr4 - movsg gner1,gr5 - stdi gr4,@(gr31,#REG_GNER0) - - # build the debug register frame - movsg brr,gr4 - movgs gr0,brr - movsg nmar,gr5 - movsg dcr,gr6 - - sethi.p %hi(__debug_status),gr7 - setlo %lo(__debug_status),gr7 - - stdi gr4 ,@(gr7,#DEBUG_BRR) - sti gr19,@(gr7,#DEBUG_BPSR) - sti.p gr6 ,@(gr7,#DEBUG_DCR) - - # trap exceptions during break handling and disable h/w breakpoints/watchpoints - sethi %hi(DCR_EBE),gr5 - setlo.p %lo(DCR_EBE),gr5 - sethi %hi(__entry_breaktrap_table),gr4 - setlo %lo(__entry_breaktrap_table),gr4 - movgs gr5,dcr - movgs gr4,tbr - - # set up kernel global registers - sethi.p %hi(__kernel_current_task),gr5 - setlo %lo(__kernel_current_task),gr5 - ld @(gr5,gr0),gr29 - ldi.p @(gr29,#4),gr15 ; __current_thread_info = current->thread_info - - sethi %hi(_gp),gr16 - setlo.p %lo(_gp),gr16 - - # make sure we (the kernel) get div-zero and misalignment exceptions - setlos #ISR_EDE|ISR_DTT_DIVBYZERO|ISR_EMAM_EXCEPTION,gr5 - movgs gr5,isr - - # enter the GDB stub - LEDS 0x4007,gr2 - - or.p gr0,gr0,fp - call debug_stub - - LEDS 0x403f,gr2 - - # return from break - lddi @(gr31,#REG_IACC0),gr4 - movgs gr4,iacc0h - movgs gr5,iacc0l - - lddi @(gr31,#REG_GNER0),gr4 - movgs gr4,gner0 - movgs gr5,gner1 - - lddi @(gr31,#REG_LR) ,gr26 - lddi @(gr31,#REG_CCR) ,gr24 - lddi @(gr31,#REG_PSR) ,gr22 - ldi @(gr31,#REG_PC) ,gr21 - ldi @(gr31,#REG_TBR) ,gr20 - - sethi.p %hi(__debug_status),gr6 - setlo %lo(__debug_status),gr6 - ldi.p @(gr6,#DEBUG_DCR) ,gr6 - - andi gr22,#PSR_S,gr19 /* rebuild BPSR */ - andi.p gr22,#PSR_ET,gr5 - slli gr19,#10,gr19 - or gr5,gr19,gr19 - - movgs gr6 ,dcr - movgs gr19,bpsr - movgs gr20,tbr - movgs gr21,bpcsr - movgs gr23,isr - movgs gr24,ccr - movgs gr25,cccr - movgs gr26,lr - movgs gr27,lcr - - LEDS 0x407f,gr2 - -#ifdef CONFIG_MMU - ldi @(gr31,#REG_GR(31)),gr2 - movgs gr2,scr3 -#endif - - ldi @(gr31,#REG_GR(30)),gr30 - ldi @(gr31,#REG_GR(29)),gr29 - lddi @(gr31,#REG_GR(26)),gr26 - lddi @(gr31,#REG_GR(24)),gr24 - lddi @(gr31,#REG_GR(22)),gr22 - lddi @(gr31,#REG_GR(20)),gr20 - lddi @(gr31,#REG_GR(18)),gr18 - lddi @(gr31,#REG_GR(16)),gr16 - lddi @(gr31,#REG_GR(14)),gr14 - lddi @(gr31,#REG_GR(12)),gr12 - lddi @(gr31,#REG_GR(10)),gr10 - lddi @(gr31,#REG_GR(8)) ,gr8 - lddi @(gr31,#REG_GR(6)) ,gr6 - lddi @(gr31,#REG_GR(4)) ,gr4 - lddi @(gr31,#REG_GR(2)) ,gr2 - ldi.p @(gr31,#REG_SP) ,sp - - xor gr31,gr31,gr31 - movgs gr0,brr -#ifdef CONFIG_MMU - movsg scr3,gr31 -#endif - rett #1 - -################################################################################################### -# -# GDB stub "system calls" -# -################################################################################################### - -#ifdef CONFIG_GDBSTUB - # void gdbstub_console_write(struct console *con, const char *p, unsigned n) - .globl gdbstub_console_write -gdbstub_console_write: - break - bralr -#endif - - # GDB stub BUG() trap - # GR8 is the proposed signal number - .globl __debug_bug_trap -__debug_bug_trap: - break - bralr - - # transfer kernel exeception to GDB for handling - .globl __break_hijack_kernel_event -__break_hijack_kernel_event: - break - .globl __break_hijack_kernel_event_breaks_here -__break_hijack_kernel_event_breaks_here: - nop - -#ifdef CONFIG_MMU - # handle a return from TLB-miss that requires single-step reactivation - .globl __break_tlb_miss_return_break -__break_tlb_miss_return_break: - break -__break_tlb_miss_return_breaks_here: - nop -#endif - - # guard the first .text label in the next file from confusion - nop diff --git a/arch/frv/kernel/cmode.S b/arch/frv/kernel/cmode.S deleted file mode 100644 index 53deeb5d7e87d..0000000000000 --- a/arch/frv/kernel/cmode.S +++ /dev/null @@ -1,189 +0,0 @@ -/* cmode.S: clock mode management - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Woodhouse (dwmw2@infradead.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. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#define __addr_MASK 0xfeff9820 /* interrupt controller mask */ - -#define __addr_SDRAMC 0xfe000400 /* SDRAM controller regs */ -#define SDRAMC_DSTS 0x28 /* SDRAM status */ -#define SDRAMC_DSTS_SSI 0x00000001 /* indicates that the SDRAM is in self-refresh mode */ -#define SDRAMC_DRCN 0x30 /* SDRAM refresh control */ -#define SDRAMC_DRCN_SR 0x00000001 /* transition SDRAM into self-refresh mode */ -#define __addr_CLKC 0xfeff9a00 -#define CLKC_SWCMODE 0x00000008 -#define __addr_LEDS 0xe1200004 - -.macro li v r - sethi.p %hi(\v),\r - setlo %lo(\v),\r -.endm - - .text - .balign 4 - - -############################################################################### -# -# Change CMODE -# - void frv_change_cmode(int cmode) -# -############################################################################### - .globl frv_change_cmode - .type frv_change_cmode,@function - -.macro LEDS v -#ifdef DEBUG_CMODE - setlos #~\v,gr10 - sti gr10,@(gr11,#0) - membar -#endif -.endm - -frv_change_cmode: - movsg lr,gr9 -#ifdef DEBUG_CMODE - li __addr_LEDS,gr11 -#endif - dcef @(gr0,gr0),#1 - - # Shift argument left by 24 bits to fit in SWCMODE register later. - slli gr8,#24,gr8 - - # (1) Set '0' in the PSR.ET bit, and prohibit interrupts. - movsg psr,gr14 - andi gr14,#~PSR_ET,gr3 - movgs gr3,psr - -#if 0 // Fujitsu recommend to skip this and will update docs. - # (2) Set '0' to all bits of the MASK register of the interrupt - # controller, and mask interrupts. - li __addr_MASK,gr12 - ldi @(gr12,#0),gr13 - li 0xffff0000,gr4 - sti gr4,@(gr12,#0) -#endif - - # (3) Stop the transfer function of DMAC. Stop all the bus masters - # to access SDRAM and the internal resources. - - # (already done by caller) - - # (4) Preload a series of following instructions to the instruction - # cache. - li #__cmode_icache_lock_start,gr3 - li #__cmode_icache_lock_end,gr4 - -1: icpl gr3,gr0,#1 - addi gr3,#L1_CACHE_BYTES,gr3 - cmp gr4,gr3,icc0 - bhi icc0,#0,1b - - # Set up addresses in regs for later steps. - setlos SDRAMC_DRCN_SR,gr3 - li __addr_SDRAMC,gr4 - li __addr_CLKC,gr5 - ldi @(gr5,#0),gr6 - li #0x80000000,gr7 - or gr6,gr7,gr6 - - bra __cmode_icache_lock_start - - .balign L1_CACHE_BYTES -__cmode_icache_lock_start: - - # (5) Flush the content of all caches by the DCEF instruction. - dcef @(gr0,gr0),#1 - - # (6) Execute loading the dummy for SDRAM. - ldi @(gr9,#0),gr0 - - # (7) Set '1' to the DRCN.SR bit, and change SDRAM to the - # self-refresh mode. Execute the dummy load to all memory - # devices set to cacheable on the external bus side in parallel - # with this. - sti gr3,@(gr4,#SDRAMC_DRCN) - - # (8) Execute memory barrier instruction (MEMBAR). - membar - - # (9) Read the DSTS register repeatedly until '1' stands in the - # DSTS.SSI field. -1: ldi @(gr4,#SDRAMC_DSTS),gr3 - andicc gr3,#SDRAMC_DSTS_SSI,gr3,icc0 - beq icc0,#0,1b - - # (10) Execute memory barrier instruction (MEMBAR). - membar - -#if 1 - # (11) Set the value of CMODE that you want to change to - # SWCMODE.SWCM[3:0]. - sti gr8,@(gr5,#CLKC_SWCMODE) - - # (12) Set '1' to the CLKC.SWEN bit. In that case, do not change - # fields other than SWEN of the CLKC register. - sti gr6,@(gr5,#0) -#endif - # (13) Execute the instruction just after the memory barrier - # instruction that executes the self-loop 256 times. (Meanwhile, - # the CMODE switch is done.) - membar - setlos #256,gr7 -2: subicc gr7,#1,gr7,icc0 - bne icc0,#2,2b - - LEDS 0x36 - - # (14) Release the self-refresh of SDRAM. - sti gr0,@(gr4,#SDRAMC_DRCN) - - # Wait for it... -3: ldi @(gr4,#SDRAMC_DSTS),gr3 - andicc gr3,#SDRAMC_DSTS_SSI,gr3,icc0 - bne icc0,#2,3b - -#if 0 - li 0x0100000,gr10 -4: subicc gr10,#1,gr10,icc0 - - bne icc0,#0,4b -#endif - -__cmode_icache_lock_end: - - li #__cmode_icache_lock_start,gr3 - li #__cmode_icache_lock_end,gr4 - -4: icul gr3 - addi gr3,#L1_CACHE_BYTES,gr3 - cmp gr4,gr3,icc0 - bhi icc0,#0,4b - -#if 0 // Fujitsu recommend to skip this and will update docs. - # (15) Release the interrupt mask setting of the MASK register of - # the interrupt controller if necessary. - sti gr13,@(gr12,#0) -#endif - # (16) Set 1' in the PSR.ET bit, and permit interrupt. - movgs gr14,psr - - bralr - - .size frv_change_cmode, .-frv_change_cmode diff --git a/arch/frv/kernel/debug-stub.c b/arch/frv/kernel/debug-stub.c deleted file mode 100644 index a0228f717ef2b..0000000000000 --- a/arch/frv/kernel/debug-stub.c +++ /dev/null @@ -1,258 +0,0 @@ -/* debug-stub.c: debug-mode stub - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include "gdb-io.h" - -/* CPU board CON5 */ -#define __UART0(X) (*(volatile uint8_t *)(UART0_BASE + (UART_##X))) - -#define LSR_WAIT_FOR0(STATE) \ -do { \ -} while (!(__UART0(LSR) & UART_LSR_##STATE)) - -#define FLOWCTL_QUERY0(LINE) ({ __UART0(MSR) & UART_MSR_##LINE; }) -#define FLOWCTL_CLEAR0(LINE) do { __UART0(MCR) &= ~UART_MCR_##LINE; } while (0) -#define FLOWCTL_SET0(LINE) do { __UART0(MCR) |= UART_MCR_##LINE; } while (0) - -#define FLOWCTL_WAIT_FOR0(LINE) \ -do { \ - gdbstub_do_rx(); \ -} while(!FLOWCTL_QUERY(LINE)) - -struct frv_debug_status __debug_status; - -static void __init debug_stub_init(void); - -/*****************************************************************************/ -/* - * debug mode handler stub - * - we come here with the CPU in debug mode and with exceptions disabled - * - handle debugging services for userspace - */ -asmlinkage void debug_stub(void) -{ - unsigned long hsr0; - int type = 0; - - static u8 inited = 0; - if (!inited) { - debug_stub_init(); - type = -1; - inited = 1; - } - - hsr0 = __get_HSR(0); - if (hsr0 & HSR0_ETMD) - __set_HSR(0, hsr0 & ~HSR0_ETMD); - - /* disable single stepping */ - __debug_status.dcr &= ~DCR_SE; - - /* kernel mode can propose an exception be handled in debug mode by jumping to a special - * location */ - if (__debug_frame->pc == (unsigned long) __break_hijack_kernel_event_breaks_here) { - /* replace the debug frame with the kernel frame and discard - * the top kernel context */ - *__debug_frame = *__frame; - __frame = __debug_frame->next_frame; - __debug_status.brr = (__debug_frame->tbr & TBR_TT) << 12; - __debug_status.brr |= BRR_EB; - } - - if (__debug_frame->pc == (unsigned long) __debug_bug_trap + 4) { - __debug_frame->pc = __debug_frame->lr; - type = __debug_frame->gr8; - } - -#ifdef CONFIG_GDBSTUB - gdbstub(type); -#endif - - if (hsr0 & HSR0_ETMD) - __set_HSR(0, __get_HSR(0) | HSR0_ETMD); - -} /* end debug_stub() */ - -/*****************************************************************************/ -/* - * debug stub initialisation - */ -static void __init debug_stub_init(void) -{ - __set_IRR(6, 0xff000000); /* map ERRs to NMI */ - __set_IITMR(1, 0x20000000); /* ERR0/1, UART0/1 IRQ detect levels */ - - asm volatile(" movgs gr0,ibar0 \n" - " movgs gr0,ibar1 \n" - " movgs gr0,ibar2 \n" - " movgs gr0,ibar3 \n" - " movgs gr0,dbar0 \n" - " movgs gr0,dbmr00 \n" - " movgs gr0,dbmr01 \n" - " movgs gr0,dbdr00 \n" - " movgs gr0,dbdr01 \n" - " movgs gr0,dbar1 \n" - " movgs gr0,dbmr10 \n" - " movgs gr0,dbmr11 \n" - " movgs gr0,dbdr10 \n" - " movgs gr0,dbdr11 \n" - ); - - /* deal with debugging stub initialisation and initial pause */ - if (__debug_frame->pc == (unsigned long) __debug_stub_init_break) - __debug_frame->pc = (unsigned long) start_kernel; - - /* enable the debug events we want to trap */ - __debug_status.dcr = DCR_EBE; - -#ifdef CONFIG_GDBSTUB - gdbstub_init(); -#endif - - __clr_MASK_all(); - __clr_MASK(15); - __clr_RC(15); - -} /* end debug_stub_init() */ - -/*****************************************************************************/ -/* - * kernel "exit" trap for gdb stub - */ -void debug_stub_exit(int status) -{ - -#ifdef CONFIG_GDBSTUB - gdbstub_exit(status); -#endif - -} /* end debug_stub_exit() */ - -/*****************************************************************************/ -/* - * send string to serial port - */ -void debug_to_serial(const char *p, int n) -{ - char ch; - - for (; n > 0; n--) { - ch = *p++; - FLOWCTL_SET0(DTR); - LSR_WAIT_FOR0(THRE); - // FLOWCTL_WAIT_FOR(CTS); - - if (ch == 0x0a) { - __UART0(TX) = 0x0d; - mb(); - LSR_WAIT_FOR0(THRE); - // FLOWCTL_WAIT_FOR(CTS); - } - __UART0(TX) = ch; - mb(); - - FLOWCTL_CLEAR0(DTR); - } - -} /* end debug_to_serial() */ - -/*****************************************************************************/ -/* - * send string to serial port - */ -void debug_to_serial2(const char *fmt, ...) -{ - va_list va; - char buf[64]; - int n; - - va_start(va, fmt); - n = vsprintf(buf, fmt, va); - va_end(va); - - debug_to_serial(buf, n); - -} /* end debug_to_serial2() */ - -/*****************************************************************************/ -/* - * set up the ttyS0 serial port baud rate timers - */ -void __init console_set_baud(unsigned baud) -{ - unsigned value, high, low; - u8 lcr; - - /* work out the divisor to give us the nearest higher baud rate */ - value = __serial_clock_speed_HZ / 16 / baud; - - /* determine the baud rate range */ - high = __serial_clock_speed_HZ / 16 / value; - low = __serial_clock_speed_HZ / 16 / (value + 1); - - /* pick the nearest bound */ - if (low + (high - low) / 2 > baud) - value++; - - lcr = __UART0(LCR); - __UART0(LCR) |= UART_LCR_DLAB; - mb(); - __UART0(DLL) = value & 0xff; - __UART0(DLM) = (value >> 8) & 0xff; - mb(); - __UART0(LCR) = lcr; - mb(); - -} /* end console_set_baud() */ - -/*****************************************************************************/ -/* - * - */ -int __init console_get_baud(void) -{ - unsigned value; - u8 lcr; - - lcr = __UART0(LCR); - __UART0(LCR) |= UART_LCR_DLAB; - mb(); - value = __UART0(DLM) << 8; - value |= __UART0(DLL); - __UART0(LCR) = lcr; - mb(); - - return value; -} /* end console_get_baud() */ - -/*****************************************************************************/ -/* - * display BUG() info - */ -#ifndef CONFIG_NO_KERNEL_MSG -void __debug_bug_printk(const char *file, unsigned line) -{ - printk("kernel BUG at %s:%d!\n", file, line); - -} /* end __debug_bug_printk() */ -#endif diff --git a/arch/frv/kernel/dma.c b/arch/frv/kernel/dma.c deleted file mode 100644 index 370dc9fa0b119..0000000000000 --- a/arch/frv/kernel/dma.c +++ /dev/null @@ -1,463 +0,0 @@ -/* dma.c: DMA controller management on FR401 and the like - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -struct frv_dma_channel { - uint8_t flags; -#define FRV_DMA_FLAGS_RESERVED 0x01 -#define FRV_DMA_FLAGS_INUSE 0x02 -#define FRV_DMA_FLAGS_PAUSED 0x04 - uint8_t cap; /* capabilities available */ - int irq; /* completion IRQ */ - uint32_t dreqbit; - uint32_t dackbit; - uint32_t donebit; - const unsigned long ioaddr; /* DMA controller regs addr */ - const char *devname; - dma_irq_handler_t handler; - void *data; -}; - - -#define __get_DMAC(IO,X) ({ *(volatile unsigned long *)((IO) + DMAC_##X##x); }) - -#define __set_DMAC(IO,X,V) \ -do { \ - *(volatile unsigned long *)((IO) + DMAC_##X##x) = (V); \ - mb(); \ -} while(0) - -#define ___set_DMAC(IO,X,V) \ -do { \ - *(volatile unsigned long *)((IO) + DMAC_##X##x) = (V); \ -} while(0) - - -static struct frv_dma_channel frv_dma_channels[FRV_DMA_NCHANS] = { - [0] = { - .cap = FRV_DMA_CAP_DREQ | FRV_DMA_CAP_DACK | FRV_DMA_CAP_DONE, - .irq = IRQ_CPU_DMA0, - .dreqbit = SIR_DREQ0_INPUT, - .dackbit = SOR_DACK0_OUTPUT, - .donebit = SOR_DONE0_OUTPUT, - .ioaddr = 0xfe000900, - }, - [1] = { - .cap = FRV_DMA_CAP_DREQ | FRV_DMA_CAP_DACK | FRV_DMA_CAP_DONE, - .irq = IRQ_CPU_DMA1, - .dreqbit = SIR_DREQ1_INPUT, - .dackbit = SOR_DACK1_OUTPUT, - .donebit = SOR_DONE1_OUTPUT, - .ioaddr = 0xfe000980, - }, - [2] = { - .cap = FRV_DMA_CAP_DREQ | FRV_DMA_CAP_DACK, - .irq = IRQ_CPU_DMA2, - .dreqbit = SIR_DREQ2_INPUT, - .dackbit = SOR_DACK2_OUTPUT, - .ioaddr = 0xfe000a00, - }, - [3] = { - .cap = FRV_DMA_CAP_DREQ | FRV_DMA_CAP_DACK, - .irq = IRQ_CPU_DMA3, - .dreqbit = SIR_DREQ3_INPUT, - .dackbit = SOR_DACK3_OUTPUT, - .ioaddr = 0xfe000a80, - }, - [4] = { - .cap = FRV_DMA_CAP_DREQ, - .irq = IRQ_CPU_DMA4, - .dreqbit = SIR_DREQ4_INPUT, - .ioaddr = 0xfe001000, - }, - [5] = { - .cap = FRV_DMA_CAP_DREQ, - .irq = IRQ_CPU_DMA5, - .dreqbit = SIR_DREQ5_INPUT, - .ioaddr = 0xfe001080, - }, - [6] = { - .cap = FRV_DMA_CAP_DREQ, - .irq = IRQ_CPU_DMA6, - .dreqbit = SIR_DREQ6_INPUT, - .ioaddr = 0xfe001100, - }, - [7] = { - .cap = FRV_DMA_CAP_DREQ, - .irq = IRQ_CPU_DMA7, - .dreqbit = SIR_DREQ7_INPUT, - .ioaddr = 0xfe001180, - }, -}; - -static DEFINE_RWLOCK(frv_dma_channels_lock); - -unsigned int frv_dma_inprogress; - -#define frv_clear_dma_inprogress(channel) \ - (void)__atomic32_fetch_and(~(1 << (channel)), &frv_dma_inprogress); - -#define frv_set_dma_inprogress(channel) \ - (void)__atomic32_fetch_or(1 << (channel), &frv_dma_inprogress); - -/*****************************************************************************/ -/* - * DMA irq handler - determine channel involved, grab status and call real handler - */ -static irqreturn_t dma_irq_handler(int irq, void *_channel) -{ - struct frv_dma_channel *channel = _channel; - - frv_clear_dma_inprogress(channel - frv_dma_channels); - return channel->handler(channel - frv_dma_channels, - __get_DMAC(channel->ioaddr, CSTR), - channel->data); - -} /* end dma_irq_handler() */ - -/*****************************************************************************/ -/* - * Determine which DMA controllers are present on this CPU - */ -void __init frv_dma_init(void) -{ - unsigned long psr = __get_PSR(); - int num_dma, i; - - /* First, determine how many DMA channels are available */ - switch (PSR_IMPLE(psr)) { - case PSR_IMPLE_FR405: - case PSR_IMPLE_FR451: - case PSR_IMPLE_FR501: - case PSR_IMPLE_FR551: - num_dma = FRV_DMA_8CHANS; - break; - - case PSR_IMPLE_FR401: - default: - num_dma = FRV_DMA_4CHANS; - break; - } - - /* Now mark all of the non-existent channels as reserved */ - for(i = num_dma; i < FRV_DMA_NCHANS; i++) - frv_dma_channels[i].flags = FRV_DMA_FLAGS_RESERVED; - -} /* end frv_dma_init() */ - -/*****************************************************************************/ -/* - * allocate a DMA controller channel and the IRQ associated with it - */ -int frv_dma_open(const char *devname, - unsigned long dmamask, - int dmacap, - dma_irq_handler_t handler, - unsigned long irq_flags, - void *data) -{ - struct frv_dma_channel *channel; - int dma, ret; - uint32_t val; - - write_lock(&frv_dma_channels_lock); - - ret = -ENOSPC; - - for (dma = FRV_DMA_NCHANS - 1; dma >= 0; dma--) { - channel = &frv_dma_channels[dma]; - - if (!test_bit(dma, &dmamask)) - continue; - - if ((channel->cap & dmacap) != dmacap) - continue; - - if (!frv_dma_channels[dma].flags) - goto found; - } - - goto out; - - found: - ret = request_irq(channel->irq, dma_irq_handler, irq_flags, devname, channel); - if (ret < 0) - goto out; - - /* okay, we've allocated all the resources */ - channel = &frv_dma_channels[dma]; - - channel->flags |= FRV_DMA_FLAGS_INUSE; - channel->devname = devname; - channel->handler = handler; - channel->data = data; - - /* Now make sure we are set up for DMA and not GPIO */ - /* SIR bit must be set for DMA to work */ - __set_SIR(channel->dreqbit | __get_SIR()); - /* SOR bits depend on what the caller requests */ - val = __get_SOR(); - if(dmacap & FRV_DMA_CAP_DACK) - val |= channel->dackbit; - else - val &= ~channel->dackbit; - if(dmacap & FRV_DMA_CAP_DONE) - val |= channel->donebit; - else - val &= ~channel->donebit; - __set_SOR(val); - - ret = dma; - out: - write_unlock(&frv_dma_channels_lock); - return ret; -} /* end frv_dma_open() */ - -EXPORT_SYMBOL(frv_dma_open); - -/*****************************************************************************/ -/* - * close a DMA channel and its associated interrupt - */ -void frv_dma_close(int dma) -{ - struct frv_dma_channel *channel = &frv_dma_channels[dma]; - unsigned long flags; - - write_lock_irqsave(&frv_dma_channels_lock, flags); - - free_irq(channel->irq, channel); - frv_dma_stop(dma); - - channel->flags &= ~FRV_DMA_FLAGS_INUSE; - - write_unlock_irqrestore(&frv_dma_channels_lock, flags); -} /* end frv_dma_close() */ - -EXPORT_SYMBOL(frv_dma_close); - -/*****************************************************************************/ -/* - * set static configuration on a DMA channel - */ -void frv_dma_config(int dma, unsigned long ccfr, unsigned long cctr, unsigned long apr) -{ - unsigned long ioaddr = frv_dma_channels[dma].ioaddr; - - ___set_DMAC(ioaddr, CCFR, ccfr); - ___set_DMAC(ioaddr, CCTR, cctr); - ___set_DMAC(ioaddr, APR, apr); - mb(); - -} /* end frv_dma_config() */ - -EXPORT_SYMBOL(frv_dma_config); - -/*****************************************************************************/ -/* - * start a DMA channel - */ -void frv_dma_start(int dma, - unsigned long sba, unsigned long dba, - unsigned long pix, unsigned long six, unsigned long bcl) -{ - unsigned long ioaddr = frv_dma_channels[dma].ioaddr; - - ___set_DMAC(ioaddr, SBA, sba); - ___set_DMAC(ioaddr, DBA, dba); - ___set_DMAC(ioaddr, PIX, pix); - ___set_DMAC(ioaddr, SIX, six); - ___set_DMAC(ioaddr, BCL, bcl); - ___set_DMAC(ioaddr, CSTR, 0); - mb(); - - __set_DMAC(ioaddr, CCTR, __get_DMAC(ioaddr, CCTR) | DMAC_CCTRx_ACT); - frv_set_dma_inprogress(dma); - -} /* end frv_dma_start() */ - -EXPORT_SYMBOL(frv_dma_start); - -/*****************************************************************************/ -/* - * restart a DMA channel that's been stopped in circular addressing mode by comparison-end - */ -void frv_dma_restart_circular(int dma, unsigned long six) -{ - unsigned long ioaddr = frv_dma_channels[dma].ioaddr; - - ___set_DMAC(ioaddr, SIX, six); - ___set_DMAC(ioaddr, CSTR, __get_DMAC(ioaddr, CSTR) & ~DMAC_CSTRx_CE); - mb(); - - __set_DMAC(ioaddr, CCTR, __get_DMAC(ioaddr, CCTR) | DMAC_CCTRx_ACT); - frv_set_dma_inprogress(dma); - -} /* end frv_dma_restart_circular() */ - -EXPORT_SYMBOL(frv_dma_restart_circular); - -/*****************************************************************************/ -/* - * stop a DMA channel - */ -void frv_dma_stop(int dma) -{ - unsigned long ioaddr = frv_dma_channels[dma].ioaddr; - uint32_t cctr; - - ___set_DMAC(ioaddr, CSTR, 0); - cctr = __get_DMAC(ioaddr, CCTR); - cctr &= ~(DMAC_CCTRx_IE | DMAC_CCTRx_ACT); - cctr |= DMAC_CCTRx_FC; /* fifo clear */ - __set_DMAC(ioaddr, CCTR, cctr); - __set_DMAC(ioaddr, BCL, 0); - frv_clear_dma_inprogress(dma); -} /* end frv_dma_stop() */ - -EXPORT_SYMBOL(frv_dma_stop); - -/*****************************************************************************/ -/* - * test interrupt status of DMA channel - */ -int is_frv_dma_interrupting(int dma) -{ - unsigned long ioaddr = frv_dma_channels[dma].ioaddr; - - return __get_DMAC(ioaddr, CSTR) & (1 << 23); - -} /* end is_frv_dma_interrupting() */ - -EXPORT_SYMBOL(is_frv_dma_interrupting); - -/*****************************************************************************/ -/* - * dump data about a DMA channel - */ -void frv_dma_dump(int dma) -{ - unsigned long ioaddr = frv_dma_channels[dma].ioaddr; - unsigned long cstr, pix, six, bcl; - - cstr = __get_DMAC(ioaddr, CSTR); - pix = __get_DMAC(ioaddr, PIX); - six = __get_DMAC(ioaddr, SIX); - bcl = __get_DMAC(ioaddr, BCL); - - printk("DMA[%d] cstr=%lx pix=%lx six=%lx bcl=%lx\n", dma, cstr, pix, six, bcl); - -} /* end frv_dma_dump() */ - -EXPORT_SYMBOL(frv_dma_dump); - -/*****************************************************************************/ -/* - * pause all DMA controllers - * - called by clock mangling routines - * - caller must be holding interrupts disabled - */ -void frv_dma_pause_all(void) -{ - struct frv_dma_channel *channel; - unsigned long ioaddr; - unsigned long cstr, cctr; - int dma; - - write_lock(&frv_dma_channels_lock); - - for (dma = FRV_DMA_NCHANS - 1; dma >= 0; dma--) { - channel = &frv_dma_channels[dma]; - - if (!(channel->flags & FRV_DMA_FLAGS_INUSE)) - continue; - - ioaddr = channel->ioaddr; - cctr = __get_DMAC(ioaddr, CCTR); - if (cctr & DMAC_CCTRx_ACT) { - cctr &= ~DMAC_CCTRx_ACT; - __set_DMAC(ioaddr, CCTR, cctr); - - do { - cstr = __get_DMAC(ioaddr, CSTR); - } while (cstr & DMAC_CSTRx_BUSY); - - if (cstr & DMAC_CSTRx_FED) - channel->flags |= FRV_DMA_FLAGS_PAUSED; - frv_clear_dma_inprogress(dma); - } - } - -} /* end frv_dma_pause_all() */ - -EXPORT_SYMBOL(frv_dma_pause_all); - -/*****************************************************************************/ -/* - * resume paused DMA controllers - * - called by clock mangling routines - * - caller must be holding interrupts disabled - */ -void frv_dma_resume_all(void) -{ - struct frv_dma_channel *channel; - unsigned long ioaddr; - unsigned long cstr, cctr; - int dma; - - for (dma = FRV_DMA_NCHANS - 1; dma >= 0; dma--) { - channel = &frv_dma_channels[dma]; - - if (!(channel->flags & FRV_DMA_FLAGS_PAUSED)) - continue; - - ioaddr = channel->ioaddr; - cstr = __get_DMAC(ioaddr, CSTR); - cstr &= ~(DMAC_CSTRx_FED | DMAC_CSTRx_INT); - __set_DMAC(ioaddr, CSTR, cstr); - - cctr = __get_DMAC(ioaddr, CCTR); - cctr |= DMAC_CCTRx_ACT; - __set_DMAC(ioaddr, CCTR, cctr); - - channel->flags &= ~FRV_DMA_FLAGS_PAUSED; - frv_set_dma_inprogress(dma); - } - - write_unlock(&frv_dma_channels_lock); - -} /* end frv_dma_resume_all() */ - -EXPORT_SYMBOL(frv_dma_resume_all); - -/*****************************************************************************/ -/* - * dma status clear - */ -void frv_dma_status_clear(int dma) -{ - unsigned long ioaddr = frv_dma_channels[dma].ioaddr; - uint32_t cctr; - ___set_DMAC(ioaddr, CSTR, 0); - - cctr = __get_DMAC(ioaddr, CCTR); -} /* end frv_dma_status_clear() */ - -EXPORT_SYMBOL(frv_dma_status_clear); diff --git a/arch/frv/kernel/entry-table.S b/arch/frv/kernel/entry-table.S deleted file mode 100644 index 06c5ae191e597..0000000000000 --- a/arch/frv/kernel/entry-table.S +++ /dev/null @@ -1,329 +0,0 @@ -/* entry-table.S: main trap vector tables and exception jump table - * - * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - * - */ - -#include -#include -#include - -############################################################################### -# -# Declare the main trap and vector tables -# -# There are six tables: -# -# (1) The trap table for debug mode -# (2) The trap table for kernel mode -# (3) The trap table for user mode -# -# The CPU jumps to an appropriate slot in the appropriate table to perform -# exception processing. We have three different tables for the three -# different CPU modes because there is no hardware differentiation between -# stack pointers for these three modes, and so we have to invent one when -# crossing mode boundaries. -# -# (4) The exception handler vector table -# -# The user and kernel trap tables use the same prologue for normal -# exception processing. The prologue then jumps to the handler in this -# table, as indexed by the exception ID from the TBR. -# -# (5) The fixup table for kernel-trap single-step -# (6) The fixup table for user-trap single-step -# -# Due to the way single-stepping works on this CPU (single-step is not -# disabled when crossing exception boundaries, only when in debug mode), -# we have to catch the single-step event in break.S and jump to the fixup -# routine pointed to by this table. -# -# The linker script places the user mode and kernel mode trap tables on to -# the same 8Kb page, so that break.S can be more efficient when performing -# single-step bypass management -# -############################################################################### - - # trap table for entry from debug mode - .section .trap.break,"ax" - .balign 256*16 - .globl __entry_breaktrap_table -__entry_breaktrap_table: - - # trap table for entry from user mode - .section .trap.user,"ax" - .balign 256*16 - .globl __entry_usertrap_table -__entry_usertrap_table: - - # trap table for entry from kernel mode - .section .trap.kernel,"ax" - .balign 256*16 - .globl __entry_kerneltrap_table -__entry_kerneltrap_table: - - # exception handler jump table - .section .trap.vector,"ax" - .balign 256*4 - .globl __entry_vector_table -__entry_vector_table: - - # trap fixup table for single-stepping in user mode - .section .trap.fixup.user,"a" - .balign 256*4 - .globl __break_usertrap_fixup_table -__break_usertrap_fixup_table: - - # trap fixup table for single-stepping in user mode - .section .trap.fixup.kernel,"a" - .balign 256*4 - .globl __break_kerneltrap_fixup_table -__break_kerneltrap_fixup_table: - - # handler declaration for a software or program interrupt -.macro VECTOR_SOFTPROG tbr_tt, vec - .section .trap.user - .org \tbr_tt - bra __entry_uspace_softprog_interrupt - .section .trap.fixup.user - .org \tbr_tt >> 2 - .long __break_step_uspace_softprog_interrupt - .section .trap.kernel - .org \tbr_tt - bra __entry_kernel_softprog_interrupt - .section .trap.fixup.kernel - .org \tbr_tt >> 2 - .long __break_step_kernel_softprog_interrupt - .section .trap.vector - .org \tbr_tt >> 2 - .long \vec -.endm - - # handler declaration for a maskable external interrupt -.macro VECTOR_IRQ tbr_tt, vec - .section .trap.user - .org \tbr_tt - bra __entry_uspace_external_interrupt - .section .trap.fixup.user - .org \tbr_tt >> 2 - .long __break_step_uspace_external_interrupt - .section .trap.kernel - .org \tbr_tt - # deal with virtual interrupt disablement - beq icc2,#0,__entry_kernel_external_interrupt_virtually_disabled - bra __entry_kernel_external_interrupt - .section .trap.fixup.kernel - .org \tbr_tt >> 2 - .long __break_step_kernel_external_interrupt - .section .trap.vector - .org \tbr_tt >> 2 - .long \vec -.endm - - # handler declaration for an NMI external interrupt -.macro VECTOR_NMI tbr_tt, vec - .section .trap.user - .org \tbr_tt - break - break - break - break - .section .trap.kernel - .org \tbr_tt - break - break - break - break - .section .trap.vector - .org \tbr_tt >> 2 - .long \vec -.endm - - # handler declaration for an MMU only software or program interrupt -.macro VECTOR_SP_MMU tbr_tt, vec -#ifdef CONFIG_MMU - VECTOR_SOFTPROG \tbr_tt, \vec -#else - VECTOR_NMI \tbr_tt, 0 -#endif -.endm - - -############################################################################### -# -# specification of the vectors -# - note: each macro inserts code into multiple sections -# -############################################################################### - VECTOR_SP_MMU TBR_TT_INSTR_MMU_MISS, __entry_insn_mmu_miss - VECTOR_SOFTPROG TBR_TT_INSTR_ACC_ERROR, __entry_insn_access_error - VECTOR_SOFTPROG TBR_TT_INSTR_ACC_EXCEP, __entry_insn_access_exception - VECTOR_SOFTPROG TBR_TT_PRIV_INSTR, __entry_privileged_instruction - VECTOR_SOFTPROG TBR_TT_ILLEGAL_INSTR, __entry_illegal_instruction - VECTOR_SOFTPROG TBR_TT_FP_EXCEPTION, __entry_media_exception - VECTOR_SOFTPROG TBR_TT_MP_EXCEPTION, __entry_media_exception - VECTOR_SOFTPROG TBR_TT_DATA_ACC_ERROR, __entry_data_access_error - VECTOR_SP_MMU TBR_TT_DATA_MMU_MISS, __entry_data_mmu_miss - VECTOR_SOFTPROG TBR_TT_DATA_ACC_EXCEP, __entry_data_access_exception - VECTOR_SOFTPROG TBR_TT_DATA_STR_ERROR, __entry_data_store_error - VECTOR_SOFTPROG TBR_TT_DIVISION_EXCEP, __entry_division_exception - -#ifdef CONFIG_MMU - .section .trap.user - .org TBR_TT_INSTR_TLB_MISS - .globl __trap_user_insn_tlb_miss -__trap_user_insn_tlb_miss: - movsg ear0,gr28 /* faulting address */ - movsg scr0,gr31 /* get mapped PTD coverage start address */ - xor.p gr28,gr31,gr31 /* compare addresses */ - bra __entry_user_insn_tlb_miss - - .org TBR_TT_DATA_TLB_MISS - .globl __trap_user_data_tlb_miss -__trap_user_data_tlb_miss: - movsg ear0,gr28 /* faulting address */ - movsg scr1,gr31 /* get mapped PTD coverage start address */ - xor.p gr28,gr31,gr31 /* compare addresses */ - bra __entry_user_data_tlb_miss - - .section .trap.kernel - .org TBR_TT_INSTR_TLB_MISS - .globl __trap_kernel_insn_tlb_miss -__trap_kernel_insn_tlb_miss: - movsg ear0,gr29 /* faulting address */ - movsg scr0,gr31 /* get mapped PTD coverage start address */ - xor.p gr29,gr31,gr31 /* compare addresses */ - bra __entry_kernel_insn_tlb_miss - - .org TBR_TT_DATA_TLB_MISS - .globl __trap_kernel_data_tlb_miss -__trap_kernel_data_tlb_miss: - movsg ear0,gr29 /* faulting address */ - movsg scr1,gr31 /* get mapped PTD coverage start address */ - xor.p gr29,gr31,gr31 /* compare addresses */ - bra __entry_kernel_data_tlb_miss - - .section .trap.fixup.user - .org TBR_TT_INSTR_TLB_MISS >> 2 - .globl __trap_fixup_user_insn_tlb_miss -__trap_fixup_user_insn_tlb_miss: - .long __break_user_insn_tlb_miss - .org TBR_TT_DATA_TLB_MISS >> 2 - .globl __trap_fixup_user_data_tlb_miss -__trap_fixup_user_data_tlb_miss: - .long __break_user_data_tlb_miss - - .section .trap.fixup.kernel - .org TBR_TT_INSTR_TLB_MISS >> 2 - .globl __trap_fixup_kernel_insn_tlb_miss -__trap_fixup_kernel_insn_tlb_miss: - .long __break_kernel_insn_tlb_miss - .org TBR_TT_DATA_TLB_MISS >> 2 - .globl __trap_fixup_kernel_data_tlb_miss -__trap_fixup_kernel_data_tlb_miss: - .long __break_kernel_data_tlb_miss - - .section .trap.vector - .org TBR_TT_INSTR_TLB_MISS >> 2 - .long __entry_insn_mmu_fault - .org TBR_TT_DATA_TLB_MISS >> 2 - .long __entry_data_mmu_fault -#endif - - VECTOR_SP_MMU TBR_TT_DATA_DAT_EXCEP, __entry_data_dat_fault - VECTOR_NMI TBR_TT_DECREMENT_TIMER, __entry_do_NMI - VECTOR_SOFTPROG TBR_TT_COMPOUND_EXCEP, __entry_compound_exception - VECTOR_IRQ TBR_TT_INTERRUPT_1, __entry_do_IRQ - VECTOR_IRQ TBR_TT_INTERRUPT_2, __entry_do_IRQ - VECTOR_IRQ TBR_TT_INTERRUPT_3, __entry_do_IRQ - VECTOR_IRQ TBR_TT_INTERRUPT_4, __entry_do_IRQ - VECTOR_IRQ TBR_TT_INTERRUPT_5, __entry_do_IRQ - VECTOR_IRQ TBR_TT_INTERRUPT_6, __entry_do_IRQ - VECTOR_IRQ TBR_TT_INTERRUPT_7, __entry_do_IRQ - VECTOR_IRQ TBR_TT_INTERRUPT_8, __entry_do_IRQ - VECTOR_IRQ TBR_TT_INTERRUPT_9, __entry_do_IRQ - VECTOR_IRQ TBR_TT_INTERRUPT_10, __entry_do_IRQ - VECTOR_IRQ TBR_TT_INTERRUPT_11, __entry_do_IRQ - VECTOR_IRQ TBR_TT_INTERRUPT_12, __entry_do_IRQ - VECTOR_IRQ TBR_TT_INTERRUPT_13, __entry_do_IRQ - VECTOR_IRQ TBR_TT_INTERRUPT_14, __entry_do_IRQ - VECTOR_NMI TBR_TT_INTERRUPT_15, __entry_do_NMI - - # miscellaneous user mode entry points - .section .trap.user - .org TBR_TT_TRAP0 - .rept 127 - bra __entry_uspace_softprog_interrupt - .long 0,0,0 - .endr - .org TBR_TT_BREAK - bra __entry_break - .long 0,0,0 - - .section .trap.fixup.user - .org TBR_TT_TRAP0 >> 2 - .rept 127 - .long __break_step_uspace_softprog_interrupt - .endr - .org TBR_TT_BREAK >> 2 - .long 0 - - # miscellaneous kernel mode entry points - .section .trap.kernel - .org TBR_TT_TRAP0 - bra __entry_kernel_softprog_interrupt - .org TBR_TT_TRAP1 - bra __entry_kernel_softprog_interrupt - - # trap #2 in kernel - reenable interrupts - .org TBR_TT_TRAP2 - bra __entry_kernel_external_interrupt_virtual_reenable - - # miscellaneous kernel traps - .org TBR_TT_TRAP3 - .rept 124 - bra __entry_kernel_softprog_interrupt - .long 0,0,0 - .endr - .org TBR_TT_BREAK - bra __entry_break - .long 0,0,0 - - .section .trap.fixup.kernel - .org TBR_TT_TRAP0 >> 2 - .long __break_step_kernel_softprog_interrupt - .long __break_step_kernel_softprog_interrupt - .long __break_step_kernel_external_interrupt_virtual_reenable - .rept 124 - .long __break_step_kernel_softprog_interrupt - .endr - .org TBR_TT_BREAK >> 2 - .long 0 - - # miscellaneous debug mode entry points - .section .trap.break - .org TBR_TT_BREAK - movsg bpcsr,gr30 - jmpl @(gr30,gr0) - - # miscellaneous vectors - .section .trap.vector - .org TBR_TT_TRAP0 >> 2 - .long system_call - .rept 119 - .long __entry_unsupported_trap - .endr - - # userspace atomic op emulation, traps 120-126 - .rept 7 - .long __entry_atomic_op - .endr - - .org TBR_TT_BREAK >> 2 - .long __entry_debug_exception diff --git a/arch/frv/kernel/entry.S b/arch/frv/kernel/entry.S deleted file mode 100644 index dfcd263c05176..0000000000000 --- a/arch/frv/kernel/entry.S +++ /dev/null @@ -1,1519 +0,0 @@ -/* entry.S: FR-V entry - * - * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - * - * - * Entry to the kernel is "interesting": - * (1) There are no stack pointers, not even for the kernel - * (2) General Registers should not be clobbered - * (3) There are no kernel-only data registers - * (4) Since all addressing modes are wrt to a General Register, no global - * variables can be reached - * - * We deal with this by declaring that we shall kill GR28 on entering the - * kernel from userspace - * - * However, since break interrupts can interrupt the CPU even when PSR.ET==0, - * they can't rely on GR28 to be anything useful, and so need to clobber a - * separate register (GR31). Break interrupts are managed in break.S - * - * GR29 _is_ saved, and holds the current task pointer globally - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#define nr_syscalls ((syscall_table_size)/4) - - .section .text..entry - .balign 4 - -.macro LEDS val -# sethi.p %hi(0xe1200004),gr30 -# setlo %lo(0xe1200004),gr30 -# setlos #~\val,gr31 -# st gr31,@(gr30,gr0) -# sethi.p %hi(0xffc00100),gr30 -# setlo %lo(0xffc00100),gr30 -# sth gr0,@(gr30,gr0) -# membar -.endm - -.macro LEDS32 -# not gr31,gr31 -# sethi.p %hi(0xe1200004),gr30 -# setlo %lo(0xe1200004),gr30 -# st.p gr31,@(gr30,gr0) -# srli gr31,#16,gr31 -# sethi.p %hi(0xffc00100),gr30 -# setlo %lo(0xffc00100),gr30 -# sth gr31,@(gr30,gr0) -# membar -.endm - -############################################################################### -# -# entry point for External interrupts received whilst executing userspace code -# -############################################################################### - .globl __entry_uspace_external_interrupt - .type __entry_uspace_external_interrupt,@function -__entry_uspace_external_interrupt: - LEDS 0x6200 - sethi.p %hi(__kernel_frame0_ptr),gr28 - setlo %lo(__kernel_frame0_ptr),gr28 - ldi @(gr28,#0),gr28 - - # handle h/w single-step through exceptions - sti gr0,@(gr28,#REG__STATUS) - - .globl __entry_uspace_external_interrupt_reentry -__entry_uspace_external_interrupt_reentry: - LEDS 0x6201 - - setlos #REG__END,gr30 - dcpl gr28,gr30,#0 - - # finish building the exception frame - sti sp, @(gr28,#REG_SP) - stdi gr2, @(gr28,#REG_GR(2)) - stdi gr4, @(gr28,#REG_GR(4)) - stdi gr6, @(gr28,#REG_GR(6)) - stdi gr8, @(gr28,#REG_GR(8)) - stdi gr10,@(gr28,#REG_GR(10)) - stdi gr12,@(gr28,#REG_GR(12)) - stdi gr14,@(gr28,#REG_GR(14)) - stdi gr16,@(gr28,#REG_GR(16)) - stdi gr18,@(gr28,#REG_GR(18)) - stdi gr20,@(gr28,#REG_GR(20)) - stdi gr22,@(gr28,#REG_GR(22)) - stdi gr24,@(gr28,#REG_GR(24)) - stdi gr26,@(gr28,#REG_GR(26)) - sti gr0, @(gr28,#REG_GR(28)) - sti gr29,@(gr28,#REG_GR(29)) - stdi.p gr30,@(gr28,#REG_GR(30)) - - # set up the kernel stack pointer - ori gr28,0,sp - - movsg tbr ,gr20 - movsg psr ,gr22 - movsg pcsr,gr21 - movsg isr ,gr23 - movsg ccr ,gr24 - movsg cccr,gr25 - movsg lr ,gr26 - movsg lcr ,gr27 - - setlos.p #-1,gr4 - andi gr22,#PSR_PS,gr5 /* try to rebuild original PSR value */ - andi.p gr22,#~(PSR_PS|PSR_S),gr6 - slli gr5,#1,gr5 - or gr6,gr5,gr5 - andi gr5,#~PSR_ET,gr5 - - sti gr20,@(gr28,#REG_TBR) - sti gr21,@(gr28,#REG_PC) - sti gr5 ,@(gr28,#REG_PSR) - sti gr23,@(gr28,#REG_ISR) - stdi gr24,@(gr28,#REG_CCR) - stdi gr26,@(gr28,#REG_LR) - sti gr4 ,@(gr28,#REG_SYSCALLNO) - - movsg iacc0h,gr4 - movsg iacc0l,gr5 - stdi gr4,@(gr28,#REG_IACC0) - - movsg gner0,gr4 - movsg gner1,gr5 - stdi.p gr4,@(gr28,#REG_GNER0) - - # interrupts start off fully disabled in the interrupt handler - subcc gr0,gr0,gr0,icc2 /* set Z and clear C */ - - # set up kernel global registers - sethi.p %hi(__kernel_current_task),gr5 - setlo %lo(__kernel_current_task),gr5 - sethi.p %hi(_gp),gr16 - setlo %lo(_gp),gr16 - ldi @(gr5,#0),gr29 - ldi.p @(gr29,#4),gr15 ; __current_thread_info = current->thread_info - - # make sure we (the kernel) get div-zero and misalignment exceptions - setlos #ISR_EDE|ISR_DTT_DIVBYZERO|ISR_EMAM_EXCEPTION,gr5 - movgs gr5,isr - - # switch to the kernel trap table - sethi.p %hi(__entry_kerneltrap_table),gr6 - setlo %lo(__entry_kerneltrap_table),gr6 - movgs gr6,tbr - - # set the return address - sethi.p %hi(__entry_return_from_user_interrupt),gr4 - setlo %lo(__entry_return_from_user_interrupt),gr4 - movgs gr4,lr - - # raise the minimum interrupt priority to 15 (NMI only) and enable exceptions - movsg psr,gr4 - - ori gr4,#PSR_PIL_14,gr4 - movgs gr4,psr - ori gr4,#PSR_PIL_14|PSR_ET,gr4 - movgs gr4,psr - - LEDS 0x6202 - bra do_IRQ - - .size __entry_uspace_external_interrupt,.-__entry_uspace_external_interrupt - -############################################################################### -# -# entry point for External interrupts received whilst executing kernel code -# - on arriving here, the following registers should already be set up: -# GR15 - current thread_info struct pointer -# GR16 - kernel GP-REL pointer -# GR29 - current task struct pointer -# TBR - kernel trap vector table -# ISR - kernel's preferred integer controls -# -############################################################################### - .globl __entry_kernel_external_interrupt - .type __entry_kernel_external_interrupt,@function -__entry_kernel_external_interrupt: - LEDS 0x6210 -// sub sp,gr15,gr31 -// LEDS32 - - # set up the stack pointer - or.p sp,gr0,gr30 - subi sp,#REG__END,sp - sti gr30,@(sp,#REG_SP) - - # handle h/w single-step through exceptions - sti gr0,@(sp,#REG__STATUS) - - .globl __entry_kernel_external_interrupt_reentry -__entry_kernel_external_interrupt_reentry: - LEDS 0x6211 - - # set up the exception frame - setlos #REG__END,gr30 - dcpl sp,gr30,#0 - - sti.p gr28,@(sp,#REG_GR(28)) - ori sp,0,gr28 - - # finish building the exception frame - stdi gr2,@(gr28,#REG_GR(2)) - stdi gr4,@(gr28,#REG_GR(4)) - stdi gr6,@(gr28,#REG_GR(6)) - stdi gr8,@(gr28,#REG_GR(8)) - stdi gr10,@(gr28,#REG_GR(10)) - stdi gr12,@(gr28,#REG_GR(12)) - stdi gr14,@(gr28,#REG_GR(14)) - stdi gr16,@(gr28,#REG_GR(16)) - stdi gr18,@(gr28,#REG_GR(18)) - stdi gr20,@(gr28,#REG_GR(20)) - stdi gr22,@(gr28,#REG_GR(22)) - stdi gr24,@(gr28,#REG_GR(24)) - stdi gr26,@(gr28,#REG_GR(26)) - sti gr29,@(gr28,#REG_GR(29)) - stdi.p gr30,@(gr28,#REG_GR(30)) - - # note virtual interrupts will be fully enabled upon return - subicc gr0,#1,gr0,icc2 /* clear Z, set C */ - - movsg tbr ,gr20 - movsg psr ,gr22 - movsg pcsr,gr21 - movsg isr ,gr23 - movsg ccr ,gr24 - movsg cccr,gr25 - movsg lr ,gr26 - movsg lcr ,gr27 - - setlos.p #-1,gr4 - andi gr22,#PSR_PS,gr5 /* try to rebuild original PSR value */ - andi.p gr22,#~(PSR_PS|PSR_S),gr6 - slli gr5,#1,gr5 - or gr6,gr5,gr5 - andi.p gr5,#~PSR_ET,gr5 - - # set CCCR.CC3 to Undefined to abort atomic-modify completion inside the kernel - # - for an explanation of how it works, see: Documentation/frv/atomic-ops.txt - andi gr25,#~0xc0,gr25 - - sti gr20,@(gr28,#REG_TBR) - sti gr21,@(gr28,#REG_PC) - sti gr5 ,@(gr28,#REG_PSR) - sti gr23,@(gr28,#REG_ISR) - stdi gr24,@(gr28,#REG_CCR) - stdi gr26,@(gr28,#REG_LR) - sti gr4 ,@(gr28,#REG_SYSCALLNO) - - movsg iacc0h,gr4 - movsg iacc0l,gr5 - stdi gr4,@(gr28,#REG_IACC0) - - movsg gner0,gr4 - movsg gner1,gr5 - stdi.p gr4,@(gr28,#REG_GNER0) - - # interrupts start off fully disabled in the interrupt handler - subcc gr0,gr0,gr0,icc2 /* set Z and clear C */ - - # set the return address - sethi.p %hi(__entry_return_from_kernel_interrupt),gr4 - setlo %lo(__entry_return_from_kernel_interrupt),gr4 - movgs gr4,lr - - # clear power-saving mode flags - movsg hsr0,gr4 - andi gr4,#~HSR0_PDM,gr4 - movgs gr4,hsr0 - - # raise the minimum interrupt priority to 15 (NMI only) and enable exceptions - movsg psr,gr4 - ori gr4,#PSR_PIL_14,gr4 - movgs gr4,psr - ori gr4,#PSR_ET,gr4 - movgs gr4,psr - - LEDS 0x6212 - bra do_IRQ - - .size __entry_kernel_external_interrupt,.-__entry_kernel_external_interrupt - -############################################################################### -# -# deal with interrupts that were actually virtually disabled -# - we need to really disable them, flag the fact and return immediately -# - if you change this, you must alter break.S also -# -############################################################################### - .balign L1_CACHE_BYTES - .globl __entry_kernel_external_interrupt_virtually_disabled - .type __entry_kernel_external_interrupt_virtually_disabled,@function -__entry_kernel_external_interrupt_virtually_disabled: - movsg psr,gr30 - andi gr30,#~PSR_PIL,gr30 - ori gr30,#PSR_PIL_14,gr30 ; debugging interrupts only - movgs gr30,psr - subcc gr0,gr0,gr0,icc2 ; leave Z set, clear C - rett #0 - - .size __entry_kernel_external_interrupt_virtually_disabled,.-__entry_kernel_external_interrupt_virtually_disabled - -############################################################################### -# -# deal with re-enablement of interrupts that were pending when virtually re-enabled -# - set ICC2.C, re-enable the real interrupts and return -# - we can clear ICC2.Z because we shouldn't be here if it's not 0 [due to TIHI] -# - if you change this, you must alter break.S also -# -############################################################################### - .balign L1_CACHE_BYTES - .globl __entry_kernel_external_interrupt_virtual_reenable - .type __entry_kernel_external_interrupt_virtual_reenable,@function -__entry_kernel_external_interrupt_virtual_reenable: - movsg psr,gr30 - andi gr30,#~PSR_PIL,gr30 ; re-enable interrupts - movgs gr30,psr - subicc gr0,#1,gr0,icc2 ; clear Z, set C - rett #0 - - .size __entry_kernel_external_interrupt_virtual_reenable,.-__entry_kernel_external_interrupt_virtual_reenable - -############################################################################### -# -# entry point for Software and Progam interrupts generated whilst executing userspace code -# -############################################################################### - .globl __entry_uspace_softprog_interrupt - .type __entry_uspace_softprog_interrupt,@function - .globl __entry_uspace_handle_mmu_fault -__entry_uspace_softprog_interrupt: - LEDS 0x6000 -#ifdef CONFIG_MMU - movsg ear0,gr28 -__entry_uspace_handle_mmu_fault: - movgs gr28,scr2 -#endif - sethi.p %hi(__kernel_frame0_ptr),gr28 - setlo %lo(__kernel_frame0_ptr),gr28 - ldi @(gr28,#0),gr28 - - # handle h/w single-step through exceptions - sti gr0,@(gr28,#REG__STATUS) - - .globl __entry_uspace_softprog_interrupt_reentry -__entry_uspace_softprog_interrupt_reentry: - LEDS 0x6001 - - setlos #REG__END,gr30 - dcpl gr28,gr30,#0 - - # set up the kernel stack pointer - sti.p sp,@(gr28,#REG_SP) - ori gr28,0,sp - sti gr0,@(gr28,#REG_GR(28)) - - stdi gr20,@(gr28,#REG_GR(20)) - stdi gr22,@(gr28,#REG_GR(22)) - - movsg tbr,gr20 - movsg pcsr,gr21 - movsg psr,gr22 - - sethi.p %hi(__entry_return_from_user_exception),gr23 - setlo %lo(__entry_return_from_user_exception),gr23 - - bra __entry_common - - .size __entry_uspace_softprog_interrupt,.-__entry_uspace_softprog_interrupt - - # single-stepping was disabled on entry to a TLB handler that then faulted -#ifdef CONFIG_MMU - .globl __entry_uspace_handle_mmu_fault_sstep -__entry_uspace_handle_mmu_fault_sstep: - movgs gr28,scr2 - sethi.p %hi(__kernel_frame0_ptr),gr28 - setlo %lo(__kernel_frame0_ptr),gr28 - ldi @(gr28,#0),gr28 - - # flag single-step re-enablement - sti gr0,@(gr28,#REG__STATUS) - bra __entry_uspace_softprog_interrupt_reentry -#endif - - -############################################################################### -# -# entry point for Software and Progam interrupts generated whilst executing kernel code -# -############################################################################### - .globl __entry_kernel_softprog_interrupt - .type __entry_kernel_softprog_interrupt,@function -__entry_kernel_softprog_interrupt: - LEDS 0x6004 - -#ifdef CONFIG_MMU - movsg ear0,gr30 - movgs gr30,scr2 -#endif - - .globl __entry_kernel_handle_mmu_fault -__entry_kernel_handle_mmu_fault: - # set up the stack pointer - subi sp,#REG__END,sp - sti sp,@(sp,#REG_SP) - sti sp,@(sp,#REG_SP-4) - andi sp,#~7,sp - - # handle h/w single-step through exceptions - sti gr0,@(sp,#REG__STATUS) - - .globl __entry_kernel_softprog_interrupt_reentry -__entry_kernel_softprog_interrupt_reentry: - LEDS 0x6005 - - setlos #REG__END,gr30 - dcpl sp,gr30,#0 - - # set up the exception frame - sti.p gr28,@(sp,#REG_GR(28)) - ori sp,0,gr28 - - stdi gr20,@(gr28,#REG_GR(20)) - stdi gr22,@(gr28,#REG_GR(22)) - - ldi @(sp,#REG_SP),gr22 /* reconstruct the old SP */ - addi gr22,#REG__END,gr22 - sti gr22,@(sp,#REG_SP) - - # set CCCR.CC3 to Undefined to abort atomic-modify completion inside the kernel - # - for an explanation of how it works, see: Documentation/frv/atomic-ops.txt - movsg cccr,gr20 - andi gr20,#~0xc0,gr20 - movgs gr20,cccr - - movsg tbr,gr20 - movsg pcsr,gr21 - movsg psr,gr22 - - sethi.p %hi(__entry_return_from_kernel_exception),gr23 - setlo %lo(__entry_return_from_kernel_exception),gr23 - bra __entry_common - - .size __entry_kernel_softprog_interrupt,.-__entry_kernel_softprog_interrupt - - # single-stepping was disabled on entry to a TLB handler that then faulted -#ifdef CONFIG_MMU - .globl __entry_kernel_handle_mmu_fault_sstep -__entry_kernel_handle_mmu_fault_sstep: - # set up the stack pointer - subi sp,#REG__END,sp - sti sp,@(sp,#REG_SP) - sti sp,@(sp,#REG_SP-4) - andi sp,#~7,sp - - # flag single-step re-enablement - sethi #REG__STATUS_STEP,gr30 - sti gr30,@(sp,#REG__STATUS) - bra __entry_kernel_softprog_interrupt_reentry -#endif - - -############################################################################### -# -# the rest of the kernel entry point code -# - on arriving here, the following registers should be set up: -# GR1 - kernel stack pointer -# GR7 - syscall number (trap 0 only) -# GR8-13 - syscall args (trap 0 only) -# GR20 - saved TBR -# GR21 - saved PC -# GR22 - saved PSR -# GR23 - return handler address -# GR28 - exception frame on stack -# SCR2 - saved EAR0 where applicable (clobbered by ICI & ICEF insns on FR451) -# PSR - PSR.S 1, PSR.ET 0 -# -############################################################################### - .globl __entry_common - .type __entry_common,@function -__entry_common: - LEDS 0x6008 - - # finish building the exception frame - stdi gr2,@(gr28,#REG_GR(2)) - stdi gr4,@(gr28,#REG_GR(4)) - stdi gr6,@(gr28,#REG_GR(6)) - stdi gr8,@(gr28,#REG_GR(8)) - stdi gr10,@(gr28,#REG_GR(10)) - stdi gr12,@(gr28,#REG_GR(12)) - stdi gr14,@(gr28,#REG_GR(14)) - stdi gr16,@(gr28,#REG_GR(16)) - stdi gr18,@(gr28,#REG_GR(18)) - stdi gr24,@(gr28,#REG_GR(24)) - stdi gr26,@(gr28,#REG_GR(26)) - sti gr29,@(gr28,#REG_GR(29)) - stdi gr30,@(gr28,#REG_GR(30)) - - movsg lcr ,gr27 - movsg lr ,gr26 - movgs gr23,lr - movsg cccr,gr25 - movsg ccr ,gr24 - movsg isr ,gr23 - - setlos.p #-1,gr4 - andi gr22,#PSR_PS,gr5 /* try to rebuild original PSR value */ - andi.p gr22,#~(PSR_PS|PSR_S),gr6 - slli gr5,#1,gr5 - or gr6,gr5,gr5 - andi gr5,#~PSR_ET,gr5 - - sti gr20,@(gr28,#REG_TBR) - sti gr21,@(gr28,#REG_PC) - sti gr5 ,@(gr28,#REG_PSR) - sti gr23,@(gr28,#REG_ISR) - stdi gr24,@(gr28,#REG_CCR) - stdi gr26,@(gr28,#REG_LR) - sti gr4 ,@(gr28,#REG_SYSCALLNO) - - movsg iacc0h,gr4 - movsg iacc0l,gr5 - stdi gr4,@(gr28,#REG_IACC0) - - movsg gner0,gr4 - movsg gner1,gr5 - stdi.p gr4,@(gr28,#REG_GNER0) - - # set up virtual interrupt disablement - subicc gr0,#1,gr0,icc2 /* clear Z flag, set C flag */ - - # set up kernel global registers - sethi.p %hi(__kernel_current_task),gr5 - setlo %lo(__kernel_current_task),gr5 - sethi.p %hi(_gp),gr16 - setlo %lo(_gp),gr16 - ldi @(gr5,#0),gr29 - ldi @(gr29,#4),gr15 ; __current_thread_info = current->thread_info - - # switch to the kernel trap table - sethi.p %hi(__entry_kerneltrap_table),gr6 - setlo %lo(__entry_kerneltrap_table),gr6 - movgs gr6,tbr - - # make sure we (the kernel) get div-zero and misalignment exceptions - setlos #ISR_EDE|ISR_DTT_DIVBYZERO|ISR_EMAM_EXCEPTION,gr5 - movgs gr5,isr - - # clear power-saving mode flags - movsg hsr0,gr4 - andi gr4,#~HSR0_PDM,gr4 - movgs gr4,hsr0 - - # multiplex again using old TBR as a guide - setlos.p #TBR_TT,gr3 - sethi %hi(__entry_vector_table),gr6 - and.p gr20,gr3,gr5 - setlo %lo(__entry_vector_table),gr6 - srli gr5,#2,gr5 - ld @(gr5,gr6),gr5 - - LEDS 0x6009 - jmpl @(gr5,gr0) - - - .size __entry_common,.-__entry_common - -############################################################################### -# -# handle instruction MMU fault -# -############################################################################### -#ifdef CONFIG_MMU - .globl __entry_insn_mmu_fault -__entry_insn_mmu_fault: - LEDS 0x6010 - setlos #0,gr8 - movsg esr0,gr9 - movsg scr2,gr10 - - # now that we've accessed the exception regs, we can enable exceptions - movsg psr,gr4 - ori gr4,#PSR_ET,gr4 - movgs gr4,psr - - sethi.p %hi(do_page_fault),gr5 - setlo %lo(do_page_fault),gr5 - jmpl @(gr5,gr0) ; call do_page_fault(0,esr0,ear0) -#endif - - -############################################################################### -# -# handle instruction access error -# -############################################################################### - .globl __entry_insn_access_error -__entry_insn_access_error: - LEDS 0x6011 - sethi.p %hi(insn_access_error),gr5 - setlo %lo(insn_access_error),gr5 - movsg esfr1,gr8 - movsg epcr0,gr9 - movsg esr0,gr10 - - # now that we've accessed the exception regs, we can enable exceptions - movsg psr,gr4 - ori gr4,#PSR_ET,gr4 - movgs gr4,psr - jmpl @(gr5,gr0) ; call insn_access_error(esfr1,epcr0,esr0) - -############################################################################### -# -# handle various instructions of dubious legality -# -############################################################################### - .globl __entry_unsupported_trap - .globl __entry_illegal_instruction - .globl __entry_privileged_instruction - .globl __entry_debug_exception -__entry_unsupported_trap: - subi gr21,#4,gr21 - sti gr21,@(gr28,#REG_PC) -__entry_illegal_instruction: -__entry_privileged_instruction: -__entry_debug_exception: - LEDS 0x6012 - sethi.p %hi(illegal_instruction),gr5 - setlo %lo(illegal_instruction),gr5 - movsg esfr1,gr8 - movsg epcr0,gr9 - movsg esr0,gr10 - - # now that we've accessed the exception regs, we can enable exceptions - movsg psr,gr4 - ori gr4,#PSR_ET,gr4 - movgs gr4,psr - jmpl @(gr5,gr0) ; call ill_insn(esfr1,epcr0,esr0) - -############################################################################### -# -# handle atomic operation emulation for userspace -# -############################################################################### - .globl __entry_atomic_op -__entry_atomic_op: - LEDS 0x6012 - sethi.p %hi(atomic_operation),gr5 - setlo %lo(atomic_operation),gr5 - movsg esfr1,gr8 - movsg epcr0,gr9 - movsg esr0,gr10 - - # now that we've accessed the exception regs, we can enable exceptions - movsg psr,gr4 - ori gr4,#PSR_ET,gr4 - movgs gr4,psr - jmpl @(gr5,gr0) ; call atomic_operation(esfr1,epcr0,esr0) - -############################################################################### -# -# handle media exception -# -############################################################################### - .globl __entry_media_exception -__entry_media_exception: - LEDS 0x6013 - sethi.p %hi(media_exception),gr5 - setlo %lo(media_exception),gr5 - movsg msr0,gr8 - movsg msr1,gr9 - - # now that we've accessed the exception regs, we can enable exceptions - movsg psr,gr4 - ori gr4,#PSR_ET,gr4 - movgs gr4,psr - jmpl @(gr5,gr0) ; call media_excep(msr0,msr1) - -############################################################################### -# -# handle data MMU fault -# handle data DAT fault (write-protect exception) -# -############################################################################### -#ifdef CONFIG_MMU - .globl __entry_data_mmu_fault -__entry_data_mmu_fault: - .globl __entry_data_dat_fault -__entry_data_dat_fault: - LEDS 0x6014 - setlos #1,gr8 - movsg esr0,gr9 - movsg scr2,gr10 ; saved EAR0 - - # now that we've accessed the exception regs, we can enable exceptions - movsg psr,gr4 - ori gr4,#PSR_ET,gr4 - movgs gr4,psr - - sethi.p %hi(do_page_fault),gr5 - setlo %lo(do_page_fault),gr5 - jmpl @(gr5,gr0) ; call do_page_fault(1,esr0,ear0) -#endif - -############################################################################### -# -# handle data and instruction access exceptions -# -############################################################################### - .globl __entry_insn_access_exception - .globl __entry_data_access_exception -__entry_insn_access_exception: -__entry_data_access_exception: - LEDS 0x6016 - sethi.p %hi(memory_access_exception),gr5 - setlo %lo(memory_access_exception),gr5 - movsg esr0,gr8 - movsg scr2,gr9 ; saved EAR0 - movsg epcr0,gr10 - - # now that we've accessed the exception regs, we can enable exceptions - movsg psr,gr4 - ori gr4,#PSR_ET,gr4 - movgs gr4,psr - jmpl @(gr5,gr0) ; call memory_access_error(esr0,ear0,epcr0) - -############################################################################### -# -# handle data access error -# -############################################################################### - .globl __entry_data_access_error -__entry_data_access_error: - LEDS 0x6016 - sethi.p %hi(data_access_error),gr5 - setlo %lo(data_access_error),gr5 - movsg esfr1,gr8 - movsg esr15,gr9 - movsg ear15,gr10 - - # now that we've accessed the exception regs, we can enable exceptions - movsg psr,gr4 - ori gr4,#PSR_ET,gr4 - movgs gr4,psr - jmpl @(gr5,gr0) ; call data_access_error(esfr1,esr15,ear15) - -############################################################################### -# -# handle data store error -# -############################################################################### - .globl __entry_data_store_error -__entry_data_store_error: - LEDS 0x6017 - sethi.p %hi(data_store_error),gr5 - setlo %lo(data_store_error),gr5 - movsg esfr1,gr8 - movsg esr14,gr9 - - # now that we've accessed the exception regs, we can enable exceptions - movsg psr,gr4 - ori gr4,#PSR_ET,gr4 - movgs gr4,psr - jmpl @(gr5,gr0) ; call data_store_error(esfr1,esr14) - -############################################################################### -# -# handle division exception -# -############################################################################### - .globl __entry_division_exception -__entry_division_exception: - LEDS 0x6018 - sethi.p %hi(division_exception),gr5 - setlo %lo(division_exception),gr5 - movsg esfr1,gr8 - movsg esr0,gr9 - movsg isr,gr10 - - # now that we've accessed the exception regs, we can enable exceptions - movsg psr,gr4 - ori gr4,#PSR_ET,gr4 - movgs gr4,psr - jmpl @(gr5,gr0) ; call div_excep(esfr1,esr0,isr) - -############################################################################### -# -# handle compound exception -# -############################################################################### - .globl __entry_compound_exception -__entry_compound_exception: - LEDS 0x6019 - sethi.p %hi(compound_exception),gr5 - setlo %lo(compound_exception),gr5 - movsg esfr1,gr8 - movsg esr0,gr9 - movsg esr14,gr10 - movsg esr15,gr11 - movsg msr0,gr12 - movsg msr1,gr13 - - # now that we've accessed the exception regs, we can enable exceptions - movsg psr,gr4 - ori gr4,#PSR_ET,gr4 - movgs gr4,psr - jmpl @(gr5,gr0) ; call comp_excep(esfr1,esr0,esr14,esr15,msr0,msr1) - -############################################################################### -# -# handle interrupts and NMIs -# -############################################################################### - .globl __entry_do_IRQ -__entry_do_IRQ: - LEDS 0x6020 - - # we can enable exceptions - movsg psr,gr4 - ori gr4,#PSR_ET,gr4 - movgs gr4,psr - bra do_IRQ - - .globl __entry_do_NMI -__entry_do_NMI: - LEDS 0x6021 - - # we can enable exceptions - movsg psr,gr4 - ori gr4,#PSR_ET,gr4 - movgs gr4,psr - bra do_NMI - -############################################################################### -# -# the return path for a newly forked child process -# - __switch_to() saved the old current pointer in GR8 for us -# -############################################################################### - .globl ret_from_fork -ret_from_fork: - LEDS 0x6100 - call schedule_tail - - # fork & co. return 0 to child - setlos.p #0,gr8 - bra __syscall_exit - - .globl ret_from_kernel_thread -ret_from_kernel_thread: - lddi.p @(gr28,#REG_GR(8)),gr20 - call schedule_tail - calll.p @(gr21,gr0) - or gr20,gr20,gr8 - bra __syscall_exit - -################################################################################################### -# -# Return to user mode is not as complex as all this looks, -# but we want the default path for a system call return to -# go as quickly as possible which is why some of this is -# less clear than it otherwise should be. -# -################################################################################################### - .balign L1_CACHE_BYTES - .globl system_call -system_call: - LEDS 0x6101 - movsg psr,gr4 ; enable exceptions - ori gr4,#PSR_ET,gr4 - movgs gr4,psr - - sti gr7,@(gr28,#REG_SYSCALLNO) - sti.p gr8,@(gr28,#REG_ORIG_GR8) - - subicc gr7,#nr_syscalls,gr0,icc0 - bnc icc0,#0,__syscall_badsys - - ldi @(gr15,#TI_FLAGS),gr4 - andicc gr4,#_TIF_SYSCALL_TRACE,gr0,icc0 - bne icc0,#0,__syscall_trace_entry - -__syscall_call: - slli.p gr7,#2,gr7 - sethi %hi(sys_call_table),gr5 - setlo %lo(sys_call_table),gr5 - ld @(gr5,gr7),gr4 - calll @(gr4,gr0) - - -############################################################################### -# -# return to interrupted process -# -############################################################################### -__syscall_exit: - LEDS 0x6300 - - # keep current PSR in GR23 - movsg psr,gr23 - - ldi @(gr28,#REG_PSR),gr22 - - sti.p gr8,@(gr28,#REG_GR(8)) ; save return value - - # rebuild saved psr - execve will change it for init/main.c - srli gr22,#1,gr5 - andi.p gr22,#~PSR_PS,gr22 - andi gr5,#PSR_PS,gr5 - or gr5,gr22,gr22 - ori.p gr22,#PSR_S,gr22 - - # make sure we don't miss an interrupt setting need_resched or sigpending between - # sampling and the RETT - ori gr23,#PSR_PIL_14,gr23 - movgs gr23,psr - - ldi @(gr15,#TI_FLAGS),gr4 - andicc gr4,#_TIF_ALLWORK_MASK,gr0,icc0 - bne icc0,#0,__syscall_exit_work - - # restore all registers and return -__entry_return_direct: - LEDS 0x6301 - - andi gr22,#~PSR_ET,gr22 - movgs gr22,psr - - ldi @(gr28,#REG_ISR),gr23 - lddi @(gr28,#REG_CCR),gr24 - lddi @(gr28,#REG_LR) ,gr26 - ldi @(gr28,#REG_PC) ,gr21 - ldi @(gr28,#REG_TBR),gr20 - - movgs gr20,tbr - movgs gr21,pcsr - movgs gr23,isr - movgs gr24,ccr - movgs gr25,cccr - movgs gr26,lr - movgs gr27,lcr - - lddi @(gr28,#REG_GNER0),gr4 - movgs gr4,gner0 - movgs gr5,gner1 - - lddi @(gr28,#REG_IACC0),gr4 - movgs gr4,iacc0h - movgs gr5,iacc0l - - lddi @(gr28,#REG_GR(4)) ,gr4 - lddi @(gr28,#REG_GR(6)) ,gr6 - lddi @(gr28,#REG_GR(8)) ,gr8 - lddi @(gr28,#REG_GR(10)),gr10 - lddi @(gr28,#REG_GR(12)),gr12 - lddi @(gr28,#REG_GR(14)),gr14 - lddi @(gr28,#REG_GR(16)),gr16 - lddi @(gr28,#REG_GR(18)),gr18 - lddi @(gr28,#REG_GR(20)),gr20 - lddi @(gr28,#REG_GR(22)),gr22 - lddi @(gr28,#REG_GR(24)),gr24 - lddi @(gr28,#REG_GR(26)),gr26 - ldi @(gr28,#REG_GR(29)),gr29 - lddi @(gr28,#REG_GR(30)),gr30 - - # check to see if a debugging return is required - LEDS 0x67f0 - movsg ccr,gr2 - ldi @(gr28,#REG__STATUS),gr3 - andicc gr3,#REG__STATUS_STEP,gr0,icc0 - bne icc0,#0,__entry_return_singlestep - movgs gr2,ccr - - ldi @(gr28,#REG_SP) ,sp - lddi @(gr28,#REG_GR(2)) ,gr2 - ldi @(gr28,#REG_GR(28)),gr28 - - LEDS 0x67fe -// movsg pcsr,gr31 -// LEDS32 - -#if 0 - # store the current frame in the workram on the FR451 - movgs gr28,scr2 - sethi.p %hi(0xfe800000),gr28 - setlo %lo(0xfe800000),gr28 - - stdi gr2,@(gr28,#REG_GR(2)) - stdi gr4,@(gr28,#REG_GR(4)) - stdi gr6,@(gr28,#REG_GR(6)) - stdi gr8,@(gr28,#REG_GR(8)) - stdi gr10,@(gr28,#REG_GR(10)) - stdi gr12,@(gr28,#REG_GR(12)) - stdi gr14,@(gr28,#REG_GR(14)) - stdi gr16,@(gr28,#REG_GR(16)) - stdi gr18,@(gr28,#REG_GR(18)) - stdi gr24,@(gr28,#REG_GR(24)) - stdi gr26,@(gr28,#REG_GR(26)) - sti gr29,@(gr28,#REG_GR(29)) - stdi gr30,@(gr28,#REG_GR(30)) - - movsg tbr ,gr30 - sti gr30,@(gr28,#REG_TBR) - movsg pcsr,gr30 - sti gr30,@(gr28,#REG_PC) - movsg psr ,gr30 - sti gr30,@(gr28,#REG_PSR) - movsg isr ,gr30 - sti gr30,@(gr28,#REG_ISR) - movsg ccr ,gr30 - movsg cccr,gr31 - stdi gr30,@(gr28,#REG_CCR) - movsg lr ,gr30 - movsg lcr ,gr31 - stdi gr30,@(gr28,#REG_LR) - sti gr0 ,@(gr28,#REG_SYSCALLNO) - movsg scr2,gr28 -#endif - - rett #0 - - # return via break.S -__entry_return_singlestep: - movgs gr2,ccr - lddi @(gr28,#REG_GR(2)) ,gr2 - ldi @(gr28,#REG_SP) ,sp - ldi @(gr28,#REG_GR(28)),gr28 - LEDS 0x67ff - break - .globl __entry_return_singlestep_breaks_here -__entry_return_singlestep_breaks_here: - nop - - -############################################################################### -# -# return to a process interrupted in kernel space -# - we need to consider preemption if that is enabled -# -############################################################################### - .balign L1_CACHE_BYTES -__entry_return_from_kernel_exception: - LEDS 0x6302 - movsg psr,gr23 - ori gr23,#PSR_PIL_14,gr23 - movgs gr23,psr - bra __entry_return_direct - - .balign L1_CACHE_BYTES -__entry_return_from_kernel_interrupt: - LEDS 0x6303 - movsg psr,gr23 - ori gr23,#PSR_PIL_14,gr23 - movgs gr23,psr - -#ifdef CONFIG_PREEMPT - ldi @(gr15,#TI_PRE_COUNT),gr5 - subicc gr5,#0,gr0,icc0 - beq icc0,#0,__entry_return_direct - - subcc gr0,gr0,gr0,icc2 /* set Z and clear C */ - call preempt_schedule_irq -#endif - bra __entry_return_direct - - -############################################################################### -# -# perform work that needs to be done immediately before resumption -# -############################################################################### - .globl __entry_return_from_user_exception - .balign L1_CACHE_BYTES -__entry_return_from_user_exception: - LEDS 0x6501 - -__entry_resume_userspace: - # make sure we don't miss an interrupt setting need_resched or sigpending between - # sampling and the RETT - movsg psr,gr23 - ori gr23,#PSR_PIL_14,gr23 - movgs gr23,psr - -__entry_return_from_user_interrupt: - LEDS 0x6402 - ldi @(gr15,#TI_FLAGS),gr4 - andicc gr4,#_TIF_WORK_MASK,gr0,icc0 - beq icc0,#1,__entry_return_direct - -__entry_work_pending: - LEDS 0x6404 - andicc gr4,#_TIF_NEED_RESCHED,gr0,icc0 - beq icc0,#1,__entry_work_notifysig - -__entry_work_resched: - LEDS 0x6408 - movsg psr,gr23 - andi gr23,#~PSR_PIL,gr23 - movgs gr23,psr - call schedule - movsg psr,gr23 - ori gr23,#PSR_PIL_14,gr23 - movgs gr23,psr - - LEDS 0x6401 - ldi @(gr15,#TI_FLAGS),gr4 - andicc gr4,#_TIF_WORK_MASK,gr0,icc0 - beq icc0,#1,__entry_return_direct - andicc gr4,#_TIF_NEED_RESCHED,gr0,icc0 - bne icc0,#1,__entry_work_resched - -__entry_work_notifysig: - LEDS 0x6410 - ori.p gr4,#0,gr8 - call do_notify_resume - bra __entry_resume_userspace - - # perform syscall entry tracing -__syscall_trace_entry: - LEDS 0x6320 - call syscall_trace_entry - - lddi.p @(gr28,#REG_GR(8)) ,gr8 - ori gr8,#0,gr7 ; syscall_trace_entry() returned new syscallno - lddi @(gr28,#REG_GR(10)),gr10 - lddi.p @(gr28,#REG_GR(12)),gr12 - - subicc gr7,#nr_syscalls,gr0,icc0 - bnc icc0,#0,__syscall_badsys - bra __syscall_call - - # perform syscall exit tracing -__syscall_exit_work: - LEDS 0x6340 - andicc gr22,#PSR_PS,gr0,icc1 ; don't handle on return to kernel mode - andicc.p gr4,#_TIF_SYSCALL_TRACE,gr0,icc0 - bne icc1,#0,__entry_return_direct - beq icc0,#1,__entry_work_pending - - movsg psr,gr23 - andi gr23,#~PSR_PIL,gr23 ; could let syscall_trace_exit() call schedule() - movgs gr23,psr - - call syscall_trace_exit - bra __entry_resume_userspace - -__syscall_badsys: - LEDS 0x6380 - setlos #-ENOSYS,gr8 - sti gr8,@(gr28,#REG_GR(8)) ; save return value - bra __entry_resume_userspace - - -############################################################################### -# -# syscall vector table -# -############################################################################### - .section .rodata -ALIGN - .globl sys_call_table -sys_call_table: - .long sys_restart_syscall /* 0 - old "setup()" system call, used for restarting */ - .long sys_exit - .long sys_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 - .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_stat - .long sys_lseek - .long sys_getpid /* 20 */ - .long sys_mount - .long sys_oldumount - .long sys_setuid16 - .long sys_getuid16 - .long sys_ni_syscall // sys_stime /* 25 */ - .long sys_ptrace - .long sys_alarm - .long sys_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_ni_syscall // 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 /* old old uname syscall */ - .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_ni_syscall // sys_sgetmask - .long sys_ni_syscall // sys_ssetmask - .long sys_setreuid16 /* 70 */ - .long sys_setregid16 - .long sys_sigsuspend - .long sys_ni_syscall // sys_sigpending - .long sys_sethostname - .long sys_setrlimit /* 75 */ - .long sys_ni_syscall // sys_old_getrlimit - .long sys_getrusage - .long sys_gettimeofday - .long sys_settimeofday - .long sys_getgroups16 /* 80 */ - .long sys_setgroups16 - .long sys_ni_syscall /* old_select slot */ - .long sys_symlink - .long sys_lstat - .long sys_readlink /* 85 */ - .long sys_uselib - .long sys_swapon - .long sys_reboot - .long sys_ni_syscall // old_readdir - .long sys_ni_syscall /* 90 */ /* old_mmap slot */ - .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 for i386 */ - .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 /* obsolete olduname( syscall */ - .long sys_ni_syscall /* iopl for i386 */ /* 110 */ - .long sys_vhangup - .long sys_ni_syscall /* obsolete idle( syscall */ - .long sys_ni_syscall /* vm86old for i386 */ - .long sys_wait4 - .long sys_swapoff /* 115 */ - .long sys_sysinfo - .long sys_ipc - .long sys_fsync - .long sys_sigreturn - .long sys_clone /* 120 */ - .long sys_setdomainname - .long sys_newuname - .long sys_ni_syscall /* old "cacheflush" */ - .long sys_adjtimex - .long sys_mprotect /* 125 */ - .long sys_sigprocmask - .long sys_ni_syscall /* old "create_module" */ - .long sys_init_module - .long sys_delete_module - .long sys_ni_syscall /* 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 /* for afs_syscall */ - .long sys_setfsuid16 - .long sys_setfsgid16 - .long sys_llseek /* 140 */ - .long sys_getdents - .long sys_select - .long sys_flock - .long sys_msync - .long sys_readv /* 145 */ - .long sys_writev - .long sys_getsid - .long sys_fdatasync - .long sys_sysctl - .long sys_mlock /* 150 */ - .long sys_munlock - .long sys_mlockall - .long 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_mremap - .long sys_setresuid16 - .long sys_getresuid16 /* 165 */ - .long sys_ni_syscall /* for vm86 */ - .long sys_ni_syscall /* Old sys_query_module */ - .long sys_poll - .long sys_ni_syscall /* Old nfsservctl */ - .long sys_setresgid16 /* 170 */ - .long sys_getresgid16 - .long sys_prctl - .long sys_rt_sigreturn - .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 - .long sys_pread64 /* 180 */ - .long sys_pwrite64 - .long sys_chown16 - .long sys_getcwd - .long sys_capget - .long sys_capset /* 185 */ - .long sys_sigaltstack - .long sys_sendfile - .long sys_ni_syscall /* streams1 */ - .long sys_ni_syscall /* streams2 */ - .long sys_vfork /* 190 */ - .long sys_getrlimit - .long sys_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_mincore - .long sys_madvise - .long sys_getdents64 /* 220 */ - .long sys_fcntl64 - .long sys_ni_syscall /* reserved for TUX */ - .long sys_ni_syscall /* Reserved for Security */ - .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 //sys_set_thread_area - .long sys_ni_syscall //sys_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_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_ni_syscall /* reserved for kexec */ - .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_migrate_pages - .long sys_openat /* 295 */ - .long sys_mkdirat - .long sys_mknodat - .long sys_fchownat - .long sys_futimesat - .long sys_fstatat64 /* 300 */ - .long sys_unlinkat - .long sys_renameat - .long sys_linkat - .long sys_symlinkat - .long sys_readlinkat /* 305 */ - .long sys_fchmodat - .long sys_faccessat - .long sys_pselect6 - .long sys_ppoll - .long sys_unshare /* 310 */ - .long sys_set_robust_list - .long sys_get_robust_list - .long sys_splice - .long sys_sync_file_range - .long sys_tee /* 315 */ - .long 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_timerfd_settime /* 325 */ - .long sys_timerfd_gettime - .long sys_signalfd4 - .long sys_eventfd2 - .long sys_epoll_create1 - .long sys_dup3 /* 330 */ - .long sys_pipe2 - .long sys_inotify_init1 - .long sys_preadv - .long sys_pwritev - .long sys_rt_tgsigqueueinfo /* 335 */ - .long sys_perf_event_open - .long sys_setns - -syscall_table_size = (. - sys_call_table) diff --git a/arch/frv/kernel/frv_ksyms.c b/arch/frv/kernel/frv_ksyms.c deleted file mode 100644 index 6ea430d58149b..0000000000000 --- a/arch/frv/kernel/frv_ksyms.c +++ /dev/null @@ -1,109 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -extern long __memcpy_user(void *dst, const void *src, size_t count); -extern long __memset_user(void *dst, const void *src, size_t count); - -/* platform dependent support */ - -EXPORT_SYMBOL(__ioremap); -EXPORT_SYMBOL(iounmap); - -EXPORT_SYMBOL(ip_fast_csum); - -#if 0 -EXPORT_SYMBOL(local_irq_count); -EXPORT_SYMBOL(local_bh_count); -#endif - -EXPORT_SYMBOL(__res_bus_clock_speed_HZ); -EXPORT_SYMBOL(__page_offset); -EXPORT_SYMBOL(__memcpy_user); -EXPORT_SYMBOL(__memset_user); -EXPORT_SYMBOL(frv_dcache_writeback); -EXPORT_SYMBOL(frv_cache_invalidate); -EXPORT_SYMBOL(frv_icache_invalidate); -EXPORT_SYMBOL(frv_cache_wback_inv); - -#ifndef CONFIG_MMU -EXPORT_SYMBOL(memory_start); -EXPORT_SYMBOL(memory_end); -#endif - -EXPORT_SYMBOL(__debug_bug_trap); - -/* The following are special because they're not called - explicitly (the C compiler generates them). Fortunately, - their interface isn't gonna change any time soon now, so - it's OK to leave it out of version control. */ -EXPORT_SYMBOL(memcpy); -EXPORT_SYMBOL(memset); - -EXPORT_SYMBOL(__outsl_ns); -EXPORT_SYMBOL(__insl_ns); - -#ifdef CONFIG_FRV_OUTOFLINE_ATOMIC_OPS -EXPORT_SYMBOL(__xchg_32); -EXPORT_SYMBOL(__cmpxchg_32); -#endif -EXPORT_SYMBOL(atomic64_add_return); -EXPORT_SYMBOL(atomic64_sub_return); -EXPORT_SYMBOL(__xchg_64); -EXPORT_SYMBOL(__cmpxchg_64); - -EXPORT_SYMBOL(__debug_bug_printk); -EXPORT_SYMBOL(__delay_loops_MHz); - -/* - * 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 __gcc_bcmp(void); -extern void __ashldi3(void); -extern void __ashrdi3(void); -extern void __cmpdi2(void); -extern void __divdi3(void); -extern void __lshrdi3(void); -extern void __moddi3(void); -extern void __muldi3(void); -extern void __mulll(void); -extern void __umulll(void); -extern void __negdi2(void); -extern void __ucmpdi2(void); -extern void __udivdi3(void); -extern void __udivmoddi4(void); -extern void __umoddi3(void); - - /* gcc lib functions */ -//EXPORT_SYMBOL(__gcc_bcmp); -EXPORT_SYMBOL(__ashldi3); -EXPORT_SYMBOL(__ashrdi3); -//EXPORT_SYMBOL(__cmpdi2); -//EXPORT_SYMBOL(__divdi3); -EXPORT_SYMBOL(__lshrdi3); -//EXPORT_SYMBOL(__moddi3); -EXPORT_SYMBOL(__muldi3); -EXPORT_SYMBOL(__mulll); -EXPORT_SYMBOL(__umulll); -EXPORT_SYMBOL(__negdi2); -EXPORT_SYMBOL(__ucmpdi2); -//EXPORT_SYMBOL(__udivdi3); -//EXPORT_SYMBOL(__udivmoddi4); -//EXPORT_SYMBOL(__umoddi3); diff --git a/arch/frv/kernel/futex.c b/arch/frv/kernel/futex.c deleted file mode 100644 index 37f7b2bf7f730..0000000000000 --- a/arch/frv/kernel/futex.c +++ /dev/null @@ -1,223 +0,0 @@ -/* futex.c: futex operations - * - * Copyright (C) 2005 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#include -#include -#include -#include - -/* - * the various futex operations; MMU fault checking is ignored under no-MMU - * conditions - */ -static inline int atomic_futex_op_xchg_set(int oparg, u32 __user *uaddr, int *_oldval) -{ - int oldval, ret; - - asm("0: \n" - " orcc gr0,gr0,gr0,icc3 \n" /* set ICC3.Z */ - " ckeq icc3,cc7 \n" - "1: ld.p %M0,%1 \n" /* LD.P/ORCR must be atomic */ - " orcr cc7,cc7,cc3 \n" /* set CC3 to true */ - "2: cst.p %3,%M0 ,cc3,#1 \n" - " corcc gr29,gr29,gr0 ,cc3,#1 \n" /* clear ICC3.Z if store happens */ - " beq icc3,#0,0b \n" - " setlos 0,%2 \n" - "3: \n" - ".subsection 2 \n" - "4: setlos %5,%2 \n" - " bra 3b \n" - ".previous \n" - ".section __ex_table,\"a\" \n" - " .balign 8 \n" - " .long 1b,4b \n" - " .long 2b,4b \n" - ".previous" - : "+U"(*uaddr), "=&r"(oldval), "=&r"(ret), "=r"(oparg) - : "3"(oparg), "i"(-EFAULT) - : "memory", "cc7", "cc3", "icc3" - ); - - *_oldval = oldval; - return ret; -} - -static inline int atomic_futex_op_xchg_add(int oparg, u32 __user *uaddr, int *_oldval) -{ - int oldval, ret; - - asm("0: \n" - " orcc gr0,gr0,gr0,icc3 \n" /* set ICC3.Z */ - " ckeq icc3,cc7 \n" - "1: ld.p %M0,%1 \n" /* LD.P/ORCR must be atomic */ - " orcr cc7,cc7,cc3 \n" /* set CC3 to true */ - " add %1,%3,%3 \n" - "2: cst.p %3,%M0 ,cc3,#1 \n" - " corcc gr29,gr29,gr0 ,cc3,#1 \n" /* clear ICC3.Z if store happens */ - " beq icc3,#0,0b \n" - " setlos 0,%2 \n" - "3: \n" - ".subsection 2 \n" - "4: setlos %5,%2 \n" - " bra 3b \n" - ".previous \n" - ".section __ex_table,\"a\" \n" - " .balign 8 \n" - " .long 1b,4b \n" - " .long 2b,4b \n" - ".previous" - : "+U"(*uaddr), "=&r"(oldval), "=&r"(ret), "=r"(oparg) - : "3"(oparg), "i"(-EFAULT) - : "memory", "cc7", "cc3", "icc3" - ); - - *_oldval = oldval; - return ret; -} - -static inline int atomic_futex_op_xchg_or(int oparg, u32 __user *uaddr, int *_oldval) -{ - int oldval, ret; - - asm("0: \n" - " orcc gr0,gr0,gr0,icc3 \n" /* set ICC3.Z */ - " ckeq icc3,cc7 \n" - "1: ld.p %M0,%1 \n" /* LD.P/ORCR must be atomic */ - " orcr cc7,cc7,cc3 \n" /* set CC3 to true */ - " or %1,%3,%3 \n" - "2: cst.p %3,%M0 ,cc3,#1 \n" - " corcc gr29,gr29,gr0 ,cc3,#1 \n" /* clear ICC3.Z if store happens */ - " beq icc3,#0,0b \n" - " setlos 0,%2 \n" - "3: \n" - ".subsection 2 \n" - "4: setlos %5,%2 \n" - " bra 3b \n" - ".previous \n" - ".section __ex_table,\"a\" \n" - " .balign 8 \n" - " .long 1b,4b \n" - " .long 2b,4b \n" - ".previous" - : "+U"(*uaddr), "=&r"(oldval), "=&r"(ret), "=r"(oparg) - : "3"(oparg), "i"(-EFAULT) - : "memory", "cc7", "cc3", "icc3" - ); - - *_oldval = oldval; - return ret; -} - -static inline int atomic_futex_op_xchg_and(int oparg, u32 __user *uaddr, int *_oldval) -{ - int oldval, ret; - - asm("0: \n" - " orcc gr0,gr0,gr0,icc3 \n" /* set ICC3.Z */ - " ckeq icc3,cc7 \n" - "1: ld.p %M0,%1 \n" /* LD.P/ORCR must be atomic */ - " orcr cc7,cc7,cc3 \n" /* set CC3 to true */ - " and %1,%3,%3 \n" - "2: cst.p %3,%M0 ,cc3,#1 \n" - " corcc gr29,gr29,gr0 ,cc3,#1 \n" /* clear ICC3.Z if store happens */ - " beq icc3,#0,0b \n" - " setlos 0,%2 \n" - "3: \n" - ".subsection 2 \n" - "4: setlos %5,%2 \n" - " bra 3b \n" - ".previous \n" - ".section __ex_table,\"a\" \n" - " .balign 8 \n" - " .long 1b,4b \n" - " .long 2b,4b \n" - ".previous" - : "+U"(*uaddr), "=&r"(oldval), "=&r"(ret), "=r"(oparg) - : "3"(oparg), "i"(-EFAULT) - : "memory", "cc7", "cc3", "icc3" - ); - - *_oldval = oldval; - return ret; -} - -static inline int atomic_futex_op_xchg_xor(int oparg, u32 __user *uaddr, int *_oldval) -{ - int oldval, ret; - - asm("0: \n" - " orcc gr0,gr0,gr0,icc3 \n" /* set ICC3.Z */ - " ckeq icc3,cc7 \n" - "1: ld.p %M0,%1 \n" /* LD.P/ORCR must be atomic */ - " orcr cc7,cc7,cc3 \n" /* set CC3 to true */ - " xor %1,%3,%3 \n" - "2: cst.p %3,%M0 ,cc3,#1 \n" - " corcc gr29,gr29,gr0 ,cc3,#1 \n" /* clear ICC3.Z if store happens */ - " beq icc3,#0,0b \n" - " setlos 0,%2 \n" - "3: \n" - ".subsection 2 \n" - "4: setlos %5,%2 \n" - " bra 3b \n" - ".previous \n" - ".section __ex_table,\"a\" \n" - " .balign 8 \n" - " .long 1b,4b \n" - " .long 2b,4b \n" - ".previous" - : "+U"(*uaddr), "=&r"(oldval), "=&r"(ret), "=r"(oparg) - : "3"(oparg), "i"(-EFAULT) - : "memory", "cc7", "cc3", "icc3" - ); - - *_oldval = oldval; - return ret; -} - -/*****************************************************************************/ -/* - * do the futex operations - */ -int arch_futex_atomic_op_inuser(int op, int oparg, int *oval, u32 __user *uaddr) -{ - int oldval = 0, ret; - - pagefault_disable(); - - switch (op) { - case FUTEX_OP_SET: - ret = atomic_futex_op_xchg_set(oparg, uaddr, &oldval); - break; - case FUTEX_OP_ADD: - ret = atomic_futex_op_xchg_add(oparg, uaddr, &oldval); - break; - case FUTEX_OP_OR: - ret = atomic_futex_op_xchg_or(oparg, uaddr, &oldval); - break; - case FUTEX_OP_ANDN: - ret = atomic_futex_op_xchg_and(~oparg, uaddr, &oldval); - break; - case FUTEX_OP_XOR: - ret = atomic_futex_op_xchg_xor(oparg, uaddr, &oldval); - break; - default: - ret = -ENOSYS; - break; - } - - pagefault_enable(); - - if (!ret) - *oval = oldval; - - return ret; - -} /* end arch_futex_atomic_op_inuser() */ diff --git a/arch/frv/kernel/gdb-io.c b/arch/frv/kernel/gdb-io.c deleted file mode 100644 index 0707d35079bae..0000000000000 --- a/arch/frv/kernel/gdb-io.c +++ /dev/null @@ -1,215 +0,0 @@ -/* gdb-io.c: FR403 GDB stub I/O - * - * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include "gdb-io.h" - -#ifdef CONFIG_GDBSTUB_UART0 -#define __UART(X) (*(volatile uint8_t *)(UART0_BASE + (UART_##X))) -#define __UART_IRR_NMI 0xff0f0000 -#else /* CONFIG_GDBSTUB_UART1 */ -#define __UART(X) (*(volatile uint8_t *)(UART1_BASE + (UART_##X))) -#define __UART_IRR_NMI 0xfff00000 -#endif - -#define LSR_WAIT_FOR(STATE) \ -do { \ - gdbstub_do_rx(); \ -} while (!(__UART(LSR) & UART_LSR_##STATE)) - -#define FLOWCTL_QUERY(LINE) ({ __UART(MSR) & UART_MSR_##LINE; }) -#define FLOWCTL_CLEAR(LINE) do { __UART(MCR) &= ~UART_MCR_##LINE; mb(); } while (0) -#define FLOWCTL_SET(LINE) do { __UART(MCR) |= UART_MCR_##LINE; mb(); } while (0) - -#define FLOWCTL_WAIT_FOR(LINE) \ -do { \ - gdbstub_do_rx(); \ -} while(!FLOWCTL_QUERY(LINE)) - -/*****************************************************************************/ -/* - * initialise the GDB stub - * - called with PSR.ET==0, so can't incur external interrupts - */ -void gdbstub_io_init(void) -{ - /* set up the serial port */ - __UART(LCR) = UART_LCR_WLEN8; /* 1N8 */ - __UART(FCR) = - UART_FCR_ENABLE_FIFO | - UART_FCR_CLEAR_RCVR | - UART_FCR_CLEAR_XMIT | - UART_FCR_TRIGGER_1; - - FLOWCTL_CLEAR(DTR); - FLOWCTL_SET(RTS); - -// gdbstub_set_baud(115200); - - /* we want to get serial receive interrupts */ - __UART(IER) = UART_IER_RDI | UART_IER_RLSI; - mb(); - - __set_IRR(6, __UART_IRR_NMI); /* map ERRs and UARTx to NMI */ - -} /* end gdbstub_io_init() */ - -/*****************************************************************************/ -/* - * set up the GDB stub serial port baud rate timers - */ -void gdbstub_set_baud(unsigned baud) -{ - unsigned value, high, low; - u8 lcr; - - /* work out the divisor to give us the nearest higher baud rate */ - value = __serial_clock_speed_HZ / 16 / baud; - - /* determine the baud rate range */ - high = __serial_clock_speed_HZ / 16 / value; - low = __serial_clock_speed_HZ / 16 / (value + 1); - - /* pick the nearest bound */ - if (low + (high - low) / 2 > baud) - value++; - - lcr = __UART(LCR); - __UART(LCR) |= UART_LCR_DLAB; - mb(); - __UART(DLL) = value & 0xff; - __UART(DLM) = (value >> 8) & 0xff; - mb(); - __UART(LCR) = lcr; - mb(); - -} /* end gdbstub_set_baud() */ - -/*****************************************************************************/ -/* - * receive characters into the receive FIFO - */ -void gdbstub_do_rx(void) -{ - unsigned ix, nix; - - ix = gdbstub_rx_inp; - - while (__UART(LSR) & UART_LSR_DR) { - nix = (ix + 2) & 0xfff; - if (nix == gdbstub_rx_outp) - break; - - gdbstub_rx_buffer[ix++] = __UART(LSR); - gdbstub_rx_buffer[ix++] = __UART(RX); - ix = nix; - } - - gdbstub_rx_inp = ix; - - __clr_RC(15); - __clr_IRL(); - -} /* end gdbstub_do_rx() */ - -/*****************************************************************************/ -/* - * wait for a character to come from the debugger - */ -int gdbstub_rx_char(unsigned char *_ch, int nonblock) -{ - unsigned ix; - u8 ch, st; - - *_ch = 0xff; - - if (gdbstub_rx_unget) { - *_ch = gdbstub_rx_unget; - gdbstub_rx_unget = 0; - return 0; - } - - try_again: - gdbstub_do_rx(); - - /* pull chars out of the buffer */ - ix = gdbstub_rx_outp; - if (ix == gdbstub_rx_inp) { - if (nonblock) - return -EAGAIN; - //watchdog_alert_counter = 0; - goto try_again; - } - - st = gdbstub_rx_buffer[ix++]; - ch = gdbstub_rx_buffer[ix++]; - gdbstub_rx_outp = ix & 0x00000fff; - - if (st & UART_LSR_BI) { - gdbstub_proto("### GDB Rx Break Detected ###\n"); - return -EINTR; - } - else if (st & (UART_LSR_FE|UART_LSR_OE|UART_LSR_PE)) { - gdbstub_io("### GDB Rx Error (st=%02x) ###\n",st); - return -EIO; - } - else { - gdbstub_io("### GDB Rx %02x (st=%02x) ###\n",ch,st); - *_ch = ch & 0x7f; - return 0; - } - -} /* end gdbstub_rx_char() */ - -/*****************************************************************************/ -/* - * send a character to the debugger - */ -void gdbstub_tx_char(unsigned char ch) -{ - FLOWCTL_SET(DTR); - LSR_WAIT_FOR(THRE); -// FLOWCTL_WAIT_FOR(CTS); - - if (ch == 0x0a) { - __UART(TX) = 0x0d; - mb(); - LSR_WAIT_FOR(THRE); -// FLOWCTL_WAIT_FOR(CTS); - } - __UART(TX) = ch; - mb(); - - FLOWCTL_CLEAR(DTR); -} /* end gdbstub_tx_char() */ - -/*****************************************************************************/ -/* - * send a character to the debugger - */ -void gdbstub_tx_flush(void) -{ - LSR_WAIT_FOR(TEMT); - LSR_WAIT_FOR(THRE); - FLOWCTL_CLEAR(DTR); -} /* end gdbstub_tx_flush() */ diff --git a/arch/frv/kernel/gdb-io.h b/arch/frv/kernel/gdb-io.h deleted file mode 100644 index 138714bacc40d..0000000000000 --- a/arch/frv/kernel/gdb-io.h +++ /dev/null @@ -1,55 +0,0 @@ -/* gdb-io.h: FR403 GDB I/O port defs - * - * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#ifndef _GDB_IO_H -#define _GDB_IO_H - -#include - -#undef UART_RX -#undef UART_TX -#undef UART_DLL -#undef UART_DLM -#undef UART_IER -#undef UART_IIR -#undef UART_FCR -#undef UART_LCR -#undef UART_MCR -#undef UART_LSR -#undef UART_MSR -#undef UART_SCR - -#define UART_RX 0*8 /* In: Receive buffer (DLAB=0) */ -#define UART_TX 0*8 /* Out: Transmit buffer (DLAB=0) */ -#define UART_DLL 0*8 /* Out: Divisor Latch Low (DLAB=1) */ -#define UART_DLM 1*8 /* Out: Divisor Latch High (DLAB=1) */ -#define UART_IER 1*8 /* Out: Interrupt Enable Register */ -#define UART_IIR 2*8 /* In: Interrupt ID Register */ -#define UART_FCR 2*8 /* Out: FIFO Control Register */ -#define UART_LCR 3*8 /* Out: Line Control Register */ -#define UART_MCR 4*8 /* Out: Modem Control Register */ -#define UART_LSR 5*8 /* In: Line Status Register */ -#define UART_MSR 6*8 /* In: Modem Status Register */ -#define UART_SCR 7*8 /* I/O: Scratch Register */ - -#define UART_LCR_DLAB 0x80 /* Divisor latch access bit */ -#define UART_LCR_SBC 0x40 /* Set break control */ -#define UART_LCR_SPAR 0x20 /* Stick parity (?) */ -#define UART_LCR_EPAR 0x10 /* Even parity select */ -#define UART_LCR_PARITY 0x08 /* Parity Enable */ -#define UART_LCR_STOP 0x04 /* Stop bits: 0=1 stop bit, 1= 2 stop bits */ -#define UART_LCR_WLEN5 0x00 /* Wordlength: 5 bits */ -#define UART_LCR_WLEN6 0x01 /* Wordlength: 6 bits */ -#define UART_LCR_WLEN7 0x02 /* Wordlength: 7 bits */ -#define UART_LCR_WLEN8 0x03 /* Wordlength: 8 bits */ - - -#endif /* _GDB_IO_H */ diff --git a/arch/frv/kernel/gdb-stub.c b/arch/frv/kernel/gdb-stub.c deleted file mode 100644 index bbe78b0bffecd..0000000000000 --- a/arch/frv/kernel/gdb-stub.c +++ /dev/null @@ -1,2149 +0,0 @@ -/* gdb-stub.c: FRV GDB stub - * - * Copyright (C) 2003,4 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - Derived from Linux/MIPS version, Copyright (C) 1995 Andreas Busse - * - * 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. - */ - -/* - * To enable debugger support, two things need to happen. One, a - * call to set_debug_traps() is necessary in order to allow any breakpoints - * or error conditions to be properly intercepted and reported to gdb. - * Two, a breakpoint needs to be generated to begin communication. This - * is most easily accomplished by a call to breakpoint(). Breakpoint() - * simulates a breakpoint by executing a BREAK instruction. - * - * - * The following gdb commands are supported: - * - * command function Return value - * - * g return the value of the CPU registers hex data or ENN - * G set the value of the CPU registers OK or ENN - * - * mAA..AA,LLLL Read LLLL bytes at address AA..AA hex data or ENN - * MAA..AA,LLLL: Write LLLL bytes at address AA.AA OK or ENN - * - * c Resume at current address SNN ( signal NN) - * cAA..AA Continue at address AA..AA SNN - * - * s Step one instruction SNN - * sAA..AA Step one instruction from AA..AA SNN - * - * k kill - * - * ? What was the last sigval ? SNN (signal NN) - * - * bBB..BB Set baud rate to BB..BB OK or BNN, then sets - * baud rate - * - * All commands and responses are sent with a packet which includes a - * checksum. A packet consists of - * - * $#. - * - * where - * :: - * :: < two hex digits computed as modulo 256 sum of > - * - * When a packet is received, it is first acknowledged with either '+' or '-'. - * '+' indicates a successful transfer. '-' indicates a failed transfer. - * - * Example: - * - * Host: Reply: - * $m0,10#2a +$00010203040506070809101112131415#42 - * - * - * ============== - * MORE EXAMPLES: - * ============== - * - * For reference -- the following are the steps that one - * company took (RidgeRun Inc) to get remote gdb debugging - * going. In this scenario the host machine was a PC and the - * target platform was a Galileo EVB64120A MIPS evaluation - * board. - * - * Step 1: - * First download gdb-5.0.tar.gz from the internet. - * and then build/install the package. - * - * Example: - * $ tar zxf gdb-5.0.tar.gz - * $ cd gdb-5.0 - * $ ./configure --target=frv-elf-gdb - * $ make - * $ frv-elf-gdb - * - * Step 2: - * Configure linux for remote debugging and build it. - * - * Example: - * $ cd ~/linux - * $ make menuconfig - * $ make vmlinux - * - * Step 3: - * Download the kernel to the remote target and start - * the kernel running. It will promptly halt and wait - * for the host gdb session to connect. It does this - * since the "Kernel Hacking" option has defined - * CONFIG_REMOTE_DEBUG which in turn enables your calls - * to: - * set_debug_traps(); - * breakpoint(); - * - * Step 4: - * Start the gdb session on the host. - * - * Example: - * $ frv-elf-gdb vmlinux - * (gdb) set remotebaud 115200 - * (gdb) target remote /dev/ttyS1 - * ...at this point you are connected to - * the remote target and can use gdb - * in the normal fasion. Setting - * breakpoints, single stepping, - * printing variables, etc. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#define LEDS(x) do { /* *(u32*)0xe1200004 = ~(x); mb(); */ } while(0) - -#undef GDBSTUB_DEBUG_PROTOCOL - -extern void debug_to_serial(const char *p, int n); -extern void gdbstub_console_write(struct console *co, const char *p, unsigned n); - -extern volatile uint32_t __break_error_detect[3]; /* ESFR1, ESR15, EAR15 */ - -struct __debug_amr { - unsigned long L, P; -} __attribute__((aligned(8))); - -struct __debug_mmu { - struct { - unsigned long hsr0, pcsr, esr0, ear0, epcr0; -#ifdef CONFIG_MMU - unsigned long tplr, tppr, tpxr, cxnr; -#endif - } regs; - - struct __debug_amr iamr[16]; - struct __debug_amr damr[16]; - -#ifdef CONFIG_MMU - struct __debug_amr tlb[64*2]; -#endif -}; - -static struct __debug_mmu __debug_mmu; - -/* - * BUFMAX defines the maximum number of characters in inbound/outbound buffers - * at least NUMREGBYTES*2 are needed for register packets - */ -#define BUFMAX 2048 - -#define BREAK_INSN 0x801000c0 /* use "break" as bkpt */ - -static const char gdbstub_banner[] = "Linux/FR-V GDB Stub (c) RedHat 2003\n"; - -volatile u8 gdbstub_rx_buffer[PAGE_SIZE] __attribute__((aligned(PAGE_SIZE))); -volatile u32 gdbstub_rx_inp = 0; -volatile u32 gdbstub_rx_outp = 0; -volatile u8 gdbstub_rx_overflow = 0; -u8 gdbstub_rx_unget = 0; - -/* set with GDB whilst running to permit step through exceptions */ -extern volatile u32 __attribute__((section(".bss"))) gdbstub_trace_through_exceptions; - -static char input_buffer[BUFMAX]; -static char output_buffer[BUFMAX]; - -static const char *regnames[] = { - "PSR ", "ISR ", "CCR ", "CCCR", - "LR ", "LCR ", "PC ", "_stt", - "sys ", "GR8*", "GNE0", "GNE1", - "IACH", "IACL", - "TBR ", "SP ", "FP ", "GR3 ", - "GR4 ", "GR5 ", "GR6 ", "GR7 ", - "GR8 ", "GR9 ", "GR10", "GR11", - "GR12", "GR13", "GR14", "GR15", - "GR16", "GR17", "GR18", "GR19", - "GR20", "GR21", "GR22", "GR23", - "GR24", "GR25", "GR26", "GR27", - "EFRM", "CURR", "GR30", "BFRM" -}; - -struct gdbstub_bkpt { - unsigned long addr; /* address of breakpoint */ - unsigned len; /* size of breakpoint */ - uint32_t originsns[7]; /* original instructions */ -}; - -static struct gdbstub_bkpt gdbstub_bkpts[256]; - -/* - * local prototypes - */ - -static void gdbstub_recv_packet(char *buffer); -static int gdbstub_send_packet(char *buffer); -static int gdbstub_compute_signal(unsigned long tbr); -static int hex(unsigned char ch); -static int hexToInt(char **ptr, unsigned long *intValue); -static unsigned char *mem2hex(const void *mem, char *buf, int count, int may_fault); -static char *hex2mem(const char *buf, void *_mem, int count); - -/* - * Convert ch from a hex digit to an int - */ -static int hex(unsigned char ch) -{ - if (ch >= 'a' && ch <= 'f') - return ch-'a'+10; - if (ch >= '0' && ch <= '9') - return ch-'0'; - if (ch >= 'A' && ch <= 'F') - return ch-'A'+10; - return -1; -} - -void gdbstub_printk(const char *fmt, ...) -{ - static char buf[1024]; - va_list args; - int len; - - /* Emit the output into the temporary buffer */ - va_start(args, fmt); - len = vsnprintf(buf, sizeof(buf), fmt, args); - va_end(args); - debug_to_serial(buf, len); -} - -static inline char *gdbstub_strcpy(char *dst, const char *src) -{ - int loop = 0; - while ((dst[loop] = src[loop])) - loop++; - return dst; -} - -static void gdbstub_purge_cache(void) -{ - asm volatile(" dcef @(gr0,gr0),#1 \n" - " icei @(gr0,gr0),#1 \n" - " membar \n" - " bar \n" - ); -} - -/*****************************************************************************/ -/* - * scan for the sequence $# - */ -static void gdbstub_recv_packet(char *buffer) -{ - unsigned char checksum; - unsigned char xmitcsum; - unsigned char ch; - int count, i, ret, error; - - for (;;) { - /* wait around for the start character, ignore all other characters */ - do { - gdbstub_rx_char(&ch, 0); - } while (ch != '$'); - - checksum = 0; - xmitcsum = -1; - count = 0; - error = 0; - - /* now, read until a # or end of buffer is found */ - while (count < BUFMAX) { - ret = gdbstub_rx_char(&ch, 0); - if (ret < 0) - error = ret; - - if (ch == '#') - break; - checksum += ch; - buffer[count] = ch; - count++; - } - - if (error == -EIO) { - gdbstub_proto("### GDB Rx Error - Skipping packet ###\n"); - gdbstub_proto("### GDB Tx NAK\n"); - gdbstub_tx_char('-'); - continue; - } - - if (count >= BUFMAX || error) - continue; - - buffer[count] = 0; - - /* read the checksum */ - ret = gdbstub_rx_char(&ch, 0); - if (ret < 0) - error = ret; - xmitcsum = hex(ch) << 4; - - ret = gdbstub_rx_char(&ch, 0); - if (ret < 0) - error = ret; - xmitcsum |= hex(ch); - - if (error) { - if (error == -EIO) - gdbstub_proto("### GDB Rx Error - Skipping packet\n"); - gdbstub_proto("### GDB Tx NAK\n"); - gdbstub_tx_char('-'); - continue; - } - - /* check the checksum */ - if (checksum != xmitcsum) { - gdbstub_proto("### GDB Tx NAK\n"); - gdbstub_tx_char('-'); /* failed checksum */ - continue; - } - - gdbstub_proto("### GDB Rx '$%s#%02x' ###\n", buffer, checksum); - gdbstub_proto("### GDB Tx ACK\n"); - gdbstub_tx_char('+'); /* successful transfer */ - - /* if a sequence char is present, reply the sequence ID */ - if (buffer[2] == ':') { - gdbstub_tx_char(buffer[0]); - gdbstub_tx_char(buffer[1]); - - /* remove sequence chars from buffer */ - count = 0; - while (buffer[count]) count++; - for (i=3; i <= count; i++) - buffer[i - 3] = buffer[i]; - } - - break; - } -} /* end gdbstub_recv_packet() */ - -/*****************************************************************************/ -/* - * send the packet in buffer. - * - return 0 if successfully ACK'd - * - return 1 if abandoned due to new incoming packet - */ -static int gdbstub_send_packet(char *buffer) -{ - unsigned char checksum; - int count; - unsigned char ch; - - /* $# */ - gdbstub_proto("### GDB Tx '%s' ###\n", buffer); - - do { - gdbstub_tx_char('$'); - checksum = 0; - count = 0; - - while ((ch = buffer[count]) != 0) { - gdbstub_tx_char(ch); - checksum += ch; - count += 1; - } - - gdbstub_tx_char('#'); - gdbstub_tx_char(hex_asc_hi(checksum)); - gdbstub_tx_char(hex_asc_lo(checksum)); - - } while (gdbstub_rx_char(&ch,0), -#ifdef GDBSTUB_DEBUG_PROTOCOL - ch=='-' && (gdbstub_proto("### GDB Rx NAK\n"),0), - ch!='-' && ch!='+' && (gdbstub_proto("### GDB Rx ??? %02x\n",ch),0), -#endif - ch!='+' && ch!='$'); - - if (ch=='+') { - gdbstub_proto("### GDB Rx ACK\n"); - return 0; - } - - gdbstub_proto("### GDB Tx Abandoned\n"); - gdbstub_rx_unget = ch; - return 1; -} /* end gdbstub_send_packet() */ - -/* - * While we find nice hex chars, build an int. - * Return number of chars processed. - */ -static int hexToInt(char **ptr, unsigned long *_value) -{ - int count = 0, ch; - - *_value = 0; - while (**ptr) { - ch = hex(**ptr); - if (ch < 0) - break; - - *_value = (*_value << 4) | ((uint8_t) ch & 0xf); - count++; - - (*ptr)++; - } - - return count; -} - -/*****************************************************************************/ -/* - * probe an address to see whether it maps to anything - */ -static inline int gdbstub_addr_probe(const void *vaddr) -{ -#ifdef CONFIG_MMU - unsigned long paddr; - - asm("lrad %1,%0,#1,#0,#0" : "=r"(paddr) : "r"(vaddr)); - if (!(paddr & xAMPRx_V)) - return 0; -#endif - - return 1; -} /* end gdbstub_addr_probe() */ - -#ifdef CONFIG_MMU -static unsigned long __saved_dampr, __saved_damlr; - -static inline unsigned long gdbstub_virt_to_pte(unsigned long vaddr) -{ - pgd_t *pgd; - pud_t *pud; - pmd_t *pmd; - pte_t *pte; - unsigned long val, dampr5; - - pgd = (pgd_t *) __get_DAMLR(3) + pgd_index(vaddr); - pud = pud_offset(pgd, vaddr); - pmd = pmd_offset(pud, vaddr); - - if (pmd_bad(*pmd) || !pmd_present(*pmd)) - return 0; - - /* make sure dampr5 maps to the correct pmd */ - dampr5 = __get_DAMPR(5); - val = pmd_val(*pmd); - __set_DAMPR(5, val | xAMPRx_L | xAMPRx_SS_16Kb | xAMPRx_S | xAMPRx_C | xAMPRx_V); - - /* now its safe to access pmd */ - pte = (pte_t *)__get_DAMLR(5) + __pte_index(vaddr); - if (pte_present(*pte)) - val = pte_val(*pte); - else - val = 0; - - /* restore original dampr5 */ - __set_DAMPR(5, dampr5); - - return val; -} -#endif - -static inline int gdbstub_addr_map(const void *vaddr) -{ -#ifdef CONFIG_MMU - unsigned long pte; - - __saved_dampr = __get_DAMPR(2); - __saved_damlr = __get_DAMLR(2); -#endif - if (gdbstub_addr_probe(vaddr)) - return 1; -#ifdef CONFIG_MMU - pte = gdbstub_virt_to_pte((unsigned long) vaddr); - if (pte) { - __set_DAMPR(2, pte); - __set_DAMLR(2, (unsigned long) vaddr & PAGE_MASK); - return 1; - } -#endif - return 0; -} - -static inline void gdbstub_addr_unmap(void) -{ -#ifdef CONFIG_MMU - __set_DAMPR(2, __saved_dampr); - __set_DAMLR(2, __saved_damlr); -#endif -} - -/* - * access potentially dodgy memory through a potentially dodgy pointer - */ -static inline int gdbstub_read_dword(const void *addr, uint32_t *_res) -{ - unsigned long brr; - uint32_t res; - - if (!gdbstub_addr_map(addr)) - return 0; - - asm volatile(" movgs gr0,brr \n" - " ld%I2 %M2,%0 \n" - " movsg brr,%1 \n" - : "=r"(res), "=r"(brr) - : "m"(*(uint32_t *) addr)); - *_res = res; - gdbstub_addr_unmap(); - return likely(!brr); -} - -static inline int gdbstub_write_dword(void *addr, uint32_t val) -{ - unsigned long brr; - - if (!gdbstub_addr_map(addr)) - return 0; - - asm volatile(" movgs gr0,brr \n" - " st%I2 %1,%M2 \n" - " movsg brr,%0 \n" - : "=r"(brr) - : "r"(val), "m"(*(uint32_t *) addr)); - gdbstub_addr_unmap(); - return likely(!brr); -} - -static inline int gdbstub_read_word(const void *addr, uint16_t *_res) -{ - unsigned long brr; - uint16_t res; - - if (!gdbstub_addr_map(addr)) - return 0; - - asm volatile(" movgs gr0,brr \n" - " lduh%I2 %M2,%0 \n" - " movsg brr,%1 \n" - : "=r"(res), "=r"(brr) - : "m"(*(uint16_t *) addr)); - *_res = res; - gdbstub_addr_unmap(); - return likely(!brr); -} - -static inline int gdbstub_write_word(void *addr, uint16_t val) -{ - unsigned long brr; - - if (!gdbstub_addr_map(addr)) - return 0; - - asm volatile(" movgs gr0,brr \n" - " sth%I2 %1,%M2 \n" - " movsg brr,%0 \n" - : "=r"(brr) - : "r"(val), "m"(*(uint16_t *) addr)); - gdbstub_addr_unmap(); - return likely(!brr); -} - -static inline int gdbstub_read_byte(const void *addr, uint8_t *_res) -{ - unsigned long brr; - uint8_t res; - - if (!gdbstub_addr_map(addr)) - return 0; - - asm volatile(" movgs gr0,brr \n" - " ldub%I2 %M2,%0 \n" - " movsg brr,%1 \n" - : "=r"(res), "=r"(brr) - : "m"(*(uint8_t *) addr)); - *_res = res; - gdbstub_addr_unmap(); - return likely(!brr); -} - -static inline int gdbstub_write_byte(void *addr, uint8_t val) -{ - unsigned long brr; - - if (!gdbstub_addr_map(addr)) - return 0; - - asm volatile(" movgs gr0,brr \n" - " stb%I2 %1,%M2 \n" - " movsg brr,%0 \n" - : "=r"(brr) - : "r"(val), "m"(*(uint8_t *) addr)); - gdbstub_addr_unmap(); - return likely(!brr); -} - -static void __gdbstub_console_write(struct console *co, const char *p, unsigned n) -{ - char outbuf[26]; - int qty; - - outbuf[0] = 'O'; - - while (n > 0) { - qty = 1; - - while (n > 0 && qty < 20) { - mem2hex(p, outbuf + qty, 2, 0); - qty += 2; - if (*p == 0x0a) { - outbuf[qty++] = '0'; - outbuf[qty++] = 'd'; - } - p++; - n--; - } - - outbuf[qty] = 0; - gdbstub_send_packet(outbuf); - } -} - -#if 0 -void debug_to_serial(const char *p, int n) -{ - gdbstub_console_write(NULL,p,n); -} -#endif - -#ifdef CONFIG_GDB_CONSOLE - -static struct console gdbstub_console = { - .name = "gdb", - .write = gdbstub_console_write, /* in break.S */ - .flags = CON_PRINTBUFFER, - .index = -1, -}; - -#endif - -/*****************************************************************************/ -/* - * Convert the memory pointed to by mem into hex, placing result in buf. - * - if successful, return a pointer to the last char put in buf (NUL) - * - in case of mem fault, return NULL - * may_fault is non-zero if we are reading from arbitrary memory, but is currently - * not used. - */ -static unsigned char *mem2hex(const void *_mem, char *buf, int count, int may_fault) -{ - const uint8_t *mem = _mem; - uint8_t ch[4] __attribute__((aligned(4))); - - if ((uint32_t)mem&1 && count>=1) { - if (!gdbstub_read_byte(mem,ch)) - return NULL; - buf = hex_byte_pack(buf, ch[0]); - mem++; - count--; - } - - if ((uint32_t)mem&3 && count>=2) { - if (!gdbstub_read_word(mem,(uint16_t *)ch)) - return NULL; - buf = hex_byte_pack(buf, ch[0]); - buf = hex_byte_pack(buf, ch[1]); - mem += 2; - count -= 2; - } - - while (count>=4) { - if (!gdbstub_read_dword(mem,(uint32_t *)ch)) - return NULL; - buf = hex_byte_pack(buf, ch[0]); - buf = hex_byte_pack(buf, ch[1]); - buf = hex_byte_pack(buf, ch[2]); - buf = hex_byte_pack(buf, ch[3]); - mem += 4; - count -= 4; - } - - if (count>=2) { - if (!gdbstub_read_word(mem,(uint16_t *)ch)) - return NULL; - buf = hex_byte_pack(buf, ch[0]); - buf = hex_byte_pack(buf, ch[1]); - mem += 2; - count -= 2; - } - - if (count>=1) { - if (!gdbstub_read_byte(mem,ch)) - return NULL; - buf = hex_byte_pack(buf, ch[0]); - } - - *buf = 0; - - return buf; -} /* end mem2hex() */ - -/*****************************************************************************/ -/* - * convert the hex array pointed to by buf into binary to be placed in mem - * return a pointer to the character AFTER the last byte of buffer consumed - */ -static char *hex2mem(const char *buf, void *_mem, int count) -{ - uint8_t *mem = _mem; - union { - uint32_t l; - uint16_t w; - uint8_t b[4]; - } ch; - - if ((u32)mem&1 && count>=1) { - ch.b[0] = hex(*buf++) << 4; - ch.b[0] |= hex(*buf++); - if (!gdbstub_write_byte(mem,ch.b[0])) - return NULL; - mem++; - count--; - } - - if ((u32)mem&3 && count>=2) { - ch.b[0] = hex(*buf++) << 4; - ch.b[0] |= hex(*buf++); - ch.b[1] = hex(*buf++) << 4; - ch.b[1] |= hex(*buf++); - if (!gdbstub_write_word(mem,ch.w)) - return NULL; - mem += 2; - count -= 2; - } - - while (count>=4) { - ch.b[0] = hex(*buf++) << 4; - ch.b[0] |= hex(*buf++); - ch.b[1] = hex(*buf++) << 4; - ch.b[1] |= hex(*buf++); - ch.b[2] = hex(*buf++) << 4; - ch.b[2] |= hex(*buf++); - ch.b[3] = hex(*buf++) << 4; - ch.b[3] |= hex(*buf++); - if (!gdbstub_write_dword(mem,ch.l)) - return NULL; - mem += 4; - count -= 4; - } - - if (count>=2) { - ch.b[0] = hex(*buf++) << 4; - ch.b[0] |= hex(*buf++); - ch.b[1] = hex(*buf++) << 4; - ch.b[1] |= hex(*buf++); - if (!gdbstub_write_word(mem,ch.w)) - return NULL; - mem += 2; - count -= 2; - } - - if (count>=1) { - ch.b[0] = hex(*buf++) << 4; - ch.b[0] |= hex(*buf++); - if (!gdbstub_write_byte(mem,ch.b[0])) - return NULL; - } - - return (char *) buf; -} /* end hex2mem() */ - -/*****************************************************************************/ -/* - * This table contains the mapping between FRV TBR.TT exception codes, - * and signals, which are primarily what GDB understands. It also - * indicates which hardware traps we need to commandeer when - * initializing the stub. - */ -static const struct brr_to_sig_map { - unsigned long brr_mask; /* BRR bitmask */ - unsigned long tbr_tt; /* TBR.TT code (in BRR.EBTT) */ - unsigned int signo; /* Signal that we map this into */ -} brr_to_sig_map[] = { - { BRR_EB, TBR_TT_INSTR_ACC_ERROR, SIGSEGV }, - { BRR_EB, TBR_TT_ILLEGAL_INSTR, SIGILL }, - { BRR_EB, TBR_TT_PRIV_INSTR, SIGILL }, - { BRR_EB, TBR_TT_MP_EXCEPTION, SIGFPE }, - { BRR_EB, TBR_TT_DATA_ACC_ERROR, SIGSEGV }, - { BRR_EB, TBR_TT_DATA_STR_ERROR, SIGSEGV }, - { BRR_EB, TBR_TT_DIVISION_EXCEP, SIGFPE }, - { BRR_EB, TBR_TT_COMPOUND_EXCEP, SIGSEGV }, - { BRR_EB, TBR_TT_INTERRUPT_13, SIGALRM }, /* watchdog */ - { BRR_EB, TBR_TT_INTERRUPT_14, SIGINT }, /* GDB serial */ - { BRR_EB, TBR_TT_INTERRUPT_15, SIGQUIT }, /* NMI */ - { BRR_CB, 0, SIGUSR1 }, - { BRR_TB, 0, SIGUSR2 }, - { BRR_DBNEx, 0, SIGTRAP }, - { BRR_DBx, 0, SIGTRAP }, /* h/w watchpoint */ - { BRR_IBx, 0, SIGTRAP }, /* h/w breakpoint */ - { BRR_CBB, 0, SIGTRAP }, - { BRR_SB, 0, SIGTRAP }, - { BRR_ST, 0, SIGTRAP }, /* single step */ - { 0, 0, SIGHUP } /* default */ -}; - -/*****************************************************************************/ -/* - * convert the FRV BRR register contents into a UNIX signal number - */ -static inline int gdbstub_compute_signal(unsigned long brr) -{ - const struct brr_to_sig_map *map; - unsigned long tbr = (brr & BRR_EBTT) >> 12; - - for (map = brr_to_sig_map; map->brr_mask; map++) - if (map->brr_mask & brr) - if (!map->tbr_tt || map->tbr_tt == tbr) - break; - - return map->signo; -} /* end gdbstub_compute_signal() */ - -/*****************************************************************************/ -/* - * set a software breakpoint or a hardware breakpoint or watchpoint - */ -static int gdbstub_set_breakpoint(unsigned long type, unsigned long addr, unsigned long len) -{ - unsigned long tmp; - int bkpt, loop, xloop; - - union { - struct { - unsigned long mask0, mask1; - }; - uint8_t bytes[8]; - } dbmr; - - //gdbstub_printk("setbkpt(%ld,%08lx,%ld)\n", type, addr, len); - - switch (type) { - /* set software breakpoint */ - case 0: - if (addr & 3 || len > 7*4) - return -EINVAL; - - for (bkpt = 255; bkpt >= 0; bkpt--) - if (!gdbstub_bkpts[bkpt].addr) - break; - if (bkpt < 0) - return -ENOSPC; - - for (loop = 0; loop < len/4; loop++) - if (!gdbstub_read_dword(&((uint32_t *) addr)[loop], - &gdbstub_bkpts[bkpt].originsns[loop])) - return -EFAULT; - - for (loop = 0; loop < len/4; loop++) - if (!gdbstub_write_dword(&((uint32_t *) addr)[loop], - BREAK_INSN) - ) { - /* need to undo the changes if possible */ - for (xloop = 0; xloop < loop; xloop++) - gdbstub_write_dword(&((uint32_t *) addr)[xloop], - gdbstub_bkpts[bkpt].originsns[xloop]); - return -EFAULT; - } - - gdbstub_bkpts[bkpt].addr = addr; - gdbstub_bkpts[bkpt].len = len; - -#if 0 - gdbstub_printk("Set BKPT[%02x]: %08lx #%d {%04x, %04x} -> { %04x, %04x }\n", - bkpt, - gdbstub_bkpts[bkpt].addr, - gdbstub_bkpts[bkpt].len, - gdbstub_bkpts[bkpt].originsns[0], - gdbstub_bkpts[bkpt].originsns[1], - ((uint32_t *) addr)[0], - ((uint32_t *) addr)[1] - ); -#endif - return 0; - - /* set hardware breakpoint */ - case 1: - if (addr & 3 || len != 4) - return -EINVAL; - - if (!(__debug_regs->dcr & DCR_IBE0)) { - //gdbstub_printk("set h/w break 0: %08lx\n", addr); - __debug_regs->dcr |= DCR_IBE0; - __debug_regs->ibar[0] = addr; - asm volatile("movgs %0,ibar0" : : "r"(addr)); - return 0; - } - - if (!(__debug_regs->dcr & DCR_IBE1)) { - //gdbstub_printk("set h/w break 1: %08lx\n", addr); - __debug_regs->dcr |= DCR_IBE1; - __debug_regs->ibar[1] = addr; - asm volatile("movgs %0,ibar1" : : "r"(addr)); - return 0; - } - - if (!(__debug_regs->dcr & DCR_IBE2)) { - //gdbstub_printk("set h/w break 2: %08lx\n", addr); - __debug_regs->dcr |= DCR_IBE2; - __debug_regs->ibar[2] = addr; - asm volatile("movgs %0,ibar2" : : "r"(addr)); - return 0; - } - - if (!(__debug_regs->dcr & DCR_IBE3)) { - //gdbstub_printk("set h/w break 3: %08lx\n", addr); - __debug_regs->dcr |= DCR_IBE3; - __debug_regs->ibar[3] = addr; - asm volatile("movgs %0,ibar3" : : "r"(addr)); - return 0; - } - - return -ENOSPC; - - /* set data read/write/access watchpoint */ - case 2: - case 3: - case 4: - if ((addr & ~7) != ((addr + len - 1) & ~7)) - return -EINVAL; - - tmp = addr & 7; - - memset(dbmr.bytes, 0xff, sizeof(dbmr.bytes)); - for (loop = 0; loop < len; loop++) - dbmr.bytes[tmp + loop] = 0; - - addr &= ~7; - - if (!(__debug_regs->dcr & (DCR_DRBE0|DCR_DWBE0))) { - //gdbstub_printk("set h/w watchpoint 0 type %ld: %08lx\n", type, addr); - tmp = type==2 ? DCR_DWBE0 : type==3 ? DCR_DRBE0 : DCR_DRBE0|DCR_DWBE0; - - __debug_regs->dcr |= tmp; - __debug_regs->dbar[0] = addr; - __debug_regs->dbmr[0][0] = dbmr.mask0; - __debug_regs->dbmr[0][1] = dbmr.mask1; - __debug_regs->dbdr[0][0] = 0; - __debug_regs->dbdr[0][1] = 0; - - asm volatile(" movgs %0,dbar0 \n" - " movgs %1,dbmr00 \n" - " movgs %2,dbmr01 \n" - " movgs gr0,dbdr00 \n" - " movgs gr0,dbdr01 \n" - : : "r"(addr), "r"(dbmr.mask0), "r"(dbmr.mask1)); - return 0; - } - - if (!(__debug_regs->dcr & (DCR_DRBE1|DCR_DWBE1))) { - //gdbstub_printk("set h/w watchpoint 1 type %ld: %08lx\n", type, addr); - tmp = type==2 ? DCR_DWBE1 : type==3 ? DCR_DRBE1 : DCR_DRBE1|DCR_DWBE1; - - __debug_regs->dcr |= tmp; - __debug_regs->dbar[1] = addr; - __debug_regs->dbmr[1][0] = dbmr.mask0; - __debug_regs->dbmr[1][1] = dbmr.mask1; - __debug_regs->dbdr[1][0] = 0; - __debug_regs->dbdr[1][1] = 0; - - asm volatile(" movgs %0,dbar1 \n" - " movgs %1,dbmr10 \n" - " movgs %2,dbmr11 \n" - " movgs gr0,dbdr10 \n" - " movgs gr0,dbdr11 \n" - : : "r"(addr), "r"(dbmr.mask0), "r"(dbmr.mask1)); - return 0; - } - - return -ENOSPC; - - default: - return -EINVAL; - } - -} /* end gdbstub_set_breakpoint() */ - -/*****************************************************************************/ -/* - * clear a breakpoint or watchpoint - */ -int gdbstub_clear_breakpoint(unsigned long type, unsigned long addr, unsigned long len) -{ - unsigned long tmp; - int bkpt, loop; - - union { - struct { - unsigned long mask0, mask1; - }; - uint8_t bytes[8]; - } dbmr; - - //gdbstub_printk("clearbkpt(%ld,%08lx,%ld)\n", type, addr, len); - - switch (type) { - /* clear software breakpoint */ - case 0: - for (bkpt = 255; bkpt >= 0; bkpt--) - if (gdbstub_bkpts[bkpt].addr == addr && gdbstub_bkpts[bkpt].len == len) - break; - if (bkpt < 0) - return -ENOENT; - - gdbstub_bkpts[bkpt].addr = 0; - - for (loop = 0; loop < len/4; loop++) - if (!gdbstub_write_dword(&((uint32_t *) addr)[loop], - gdbstub_bkpts[bkpt].originsns[loop])) - return -EFAULT; - return 0; - - /* clear hardware breakpoint */ - case 1: - if (addr & 3 || len != 4) - return -EINVAL; - -#define __get_ibar(X) ({ unsigned long x; asm volatile("movsg ibar"#X",%0" : "=r"(x)); x; }) - - if (__debug_regs->dcr & DCR_IBE0 && __get_ibar(0) == addr) { - //gdbstub_printk("clear h/w break 0: %08lx\n", addr); - __debug_regs->dcr &= ~DCR_IBE0; - __debug_regs->ibar[0] = 0; - asm volatile("movgs gr0,ibar0"); - return 0; - } - - if (__debug_regs->dcr & DCR_IBE1 && __get_ibar(1) == addr) { - //gdbstub_printk("clear h/w break 1: %08lx\n", addr); - __debug_regs->dcr &= ~DCR_IBE1; - __debug_regs->ibar[1] = 0; - asm volatile("movgs gr0,ibar1"); - return 0; - } - - if (__debug_regs->dcr & DCR_IBE2 && __get_ibar(2) == addr) { - //gdbstub_printk("clear h/w break 2: %08lx\n", addr); - __debug_regs->dcr &= ~DCR_IBE2; - __debug_regs->ibar[2] = 0; - asm volatile("movgs gr0,ibar2"); - return 0; - } - - if (__debug_regs->dcr & DCR_IBE3 && __get_ibar(3) == addr) { - //gdbstub_printk("clear h/w break 3: %08lx\n", addr); - __debug_regs->dcr &= ~DCR_IBE3; - __debug_regs->ibar[3] = 0; - asm volatile("movgs gr0,ibar3"); - return 0; - } - - return -EINVAL; - - /* clear data read/write/access watchpoint */ - case 2: - case 3: - case 4: - if ((addr & ~7) != ((addr + len - 1) & ~7)) - return -EINVAL; - - tmp = addr & 7; - - memset(dbmr.bytes, 0xff, sizeof(dbmr.bytes)); - for (loop = 0; loop < len; loop++) - dbmr.bytes[tmp + loop] = 0; - - addr &= ~7; - -#define __get_dbar(X) ({ unsigned long x; asm volatile("movsg dbar"#X",%0" : "=r"(x)); x; }) -#define __get_dbmr0(X) ({ unsigned long x; asm volatile("movsg dbmr"#X"0,%0" : "=r"(x)); x; }) -#define __get_dbmr1(X) ({ unsigned long x; asm volatile("movsg dbmr"#X"1,%0" : "=r"(x)); x; }) - - /* consider DBAR 0 */ - tmp = type==2 ? DCR_DWBE0 : type==3 ? DCR_DRBE0 : DCR_DRBE0|DCR_DWBE0; - - if ((__debug_regs->dcr & (DCR_DRBE0|DCR_DWBE0)) != tmp || - __get_dbar(0) != addr || - __get_dbmr0(0) != dbmr.mask0 || - __get_dbmr1(0) != dbmr.mask1) - goto skip_dbar0; - - //gdbstub_printk("clear h/w watchpoint 0 type %ld: %08lx\n", type, addr); - __debug_regs->dcr &= ~(DCR_DRBE0|DCR_DWBE0); - __debug_regs->dbar[0] = 0; - __debug_regs->dbmr[0][0] = 0; - __debug_regs->dbmr[0][1] = 0; - __debug_regs->dbdr[0][0] = 0; - __debug_regs->dbdr[0][1] = 0; - - asm volatile(" movgs gr0,dbar0 \n" - " movgs gr0,dbmr00 \n" - " movgs gr0,dbmr01 \n" - " movgs gr0,dbdr00 \n" - " movgs gr0,dbdr01 \n"); - return 0; - - skip_dbar0: - /* consider DBAR 0 */ - tmp = type==2 ? DCR_DWBE1 : type==3 ? DCR_DRBE1 : DCR_DRBE1|DCR_DWBE1; - - if ((__debug_regs->dcr & (DCR_DRBE1|DCR_DWBE1)) != tmp || - __get_dbar(1) != addr || - __get_dbmr0(1) != dbmr.mask0 || - __get_dbmr1(1) != dbmr.mask1) - goto skip_dbar1; - - //gdbstub_printk("clear h/w watchpoint 1 type %ld: %08lx\n", type, addr); - __debug_regs->dcr &= ~(DCR_DRBE1|DCR_DWBE1); - __debug_regs->dbar[1] = 0; - __debug_regs->dbmr[1][0] = 0; - __debug_regs->dbmr[1][1] = 0; - __debug_regs->dbdr[1][0] = 0; - __debug_regs->dbdr[1][1] = 0; - - asm volatile(" movgs gr0,dbar1 \n" - " movgs gr0,dbmr10 \n" - " movgs gr0,dbmr11 \n" - " movgs gr0,dbdr10 \n" - " movgs gr0,dbdr11 \n"); - return 0; - - skip_dbar1: - return -ENOSPC; - - default: - return -EINVAL; - } -} /* end gdbstub_clear_breakpoint() */ - -/*****************************************************************************/ -/* - * check a for an internal software breakpoint, and wind the PC back if necessary - */ -static void gdbstub_check_breakpoint(void) -{ - unsigned long addr = __debug_frame->pc - 4; - int bkpt; - - for (bkpt = 255; bkpt >= 0; bkpt--) - if (gdbstub_bkpts[bkpt].addr == addr) - break; - if (bkpt >= 0) - __debug_frame->pc = addr; - - //gdbstub_printk("alter pc [%d] %08lx\n", bkpt, __debug_frame->pc); - -} /* end gdbstub_check_breakpoint() */ - -/*****************************************************************************/ -/* - * - */ -static void __maybe_unused gdbstub_show_regs(void) -{ - unsigned long *reg; - int loop; - - gdbstub_printk("\n"); - - gdbstub_printk("Frame: @%p [%s]\n", - __debug_frame, - __debug_frame->psr & PSR_S ? "kernel" : "user"); - - reg = (unsigned long *) __debug_frame; - for (loop = 0; loop < NR_PT_REGS; loop++) { - printk("%s %08lx", regnames[loop + 0], reg[loop + 0]); - - if (loop == NR_PT_REGS - 1 || loop % 5 == 4) - printk("\n"); - else - printk(" | "); - } - - gdbstub_printk("Process %s (pid: %d)\n", current->comm, current->pid); -} /* end gdbstub_show_regs() */ - -/*****************************************************************************/ -/* - * dump debugging regs - */ -static void __maybe_unused gdbstub_dump_debugregs(void) -{ - gdbstub_printk("DCR %08lx ", __debug_status.dcr); - gdbstub_printk("BRR %08lx\n", __debug_status.brr); - - gdbstub_printk("IBAR0 %08lx ", __get_ibar(0)); - gdbstub_printk("IBAR1 %08lx ", __get_ibar(1)); - gdbstub_printk("IBAR2 %08lx ", __get_ibar(2)); - gdbstub_printk("IBAR3 %08lx\n", __get_ibar(3)); - - gdbstub_printk("DBAR0 %08lx ", __get_dbar(0)); - gdbstub_printk("DBMR00 %08lx ", __get_dbmr0(0)); - gdbstub_printk("DBMR01 %08lx\n", __get_dbmr1(0)); - - gdbstub_printk("DBAR1 %08lx ", __get_dbar(1)); - gdbstub_printk("DBMR10 %08lx ", __get_dbmr0(1)); - gdbstub_printk("DBMR11 %08lx\n", __get_dbmr1(1)); - - gdbstub_printk("\n"); -} /* end gdbstub_dump_debugregs() */ - -/*****************************************************************************/ -/* - * dump the MMU state into a structure so that it can be accessed with GDB - */ -void gdbstub_get_mmu_state(void) -{ - asm volatile("movsg hsr0,%0" : "=r"(__debug_mmu.regs.hsr0)); - asm volatile("movsg pcsr,%0" : "=r"(__debug_mmu.regs.pcsr)); - asm volatile("movsg esr0,%0" : "=r"(__debug_mmu.regs.esr0)); - asm volatile("movsg ear0,%0" : "=r"(__debug_mmu.regs.ear0)); - asm volatile("movsg epcr0,%0" : "=r"(__debug_mmu.regs.epcr0)); - - /* read the protection / SAT registers */ - __debug_mmu.iamr[0].L = __get_IAMLR(0); - __debug_mmu.iamr[0].P = __get_IAMPR(0); - __debug_mmu.iamr[1].L = __get_IAMLR(1); - __debug_mmu.iamr[1].P = __get_IAMPR(1); - __debug_mmu.iamr[2].L = __get_IAMLR(2); - __debug_mmu.iamr[2].P = __get_IAMPR(2); - __debug_mmu.iamr[3].L = __get_IAMLR(3); - __debug_mmu.iamr[3].P = __get_IAMPR(3); - __debug_mmu.iamr[4].L = __get_IAMLR(4); - __debug_mmu.iamr[4].P = __get_IAMPR(4); - __debug_mmu.iamr[5].L = __get_IAMLR(5); - __debug_mmu.iamr[5].P = __get_IAMPR(5); - __debug_mmu.iamr[6].L = __get_IAMLR(6); - __debug_mmu.iamr[6].P = __get_IAMPR(6); - __debug_mmu.iamr[7].L = __get_IAMLR(7); - __debug_mmu.iamr[7].P = __get_IAMPR(7); - __debug_mmu.iamr[8].L = __get_IAMLR(8); - __debug_mmu.iamr[8].P = __get_IAMPR(8); - __debug_mmu.iamr[9].L = __get_IAMLR(9); - __debug_mmu.iamr[9].P = __get_IAMPR(9); - __debug_mmu.iamr[10].L = __get_IAMLR(10); - __debug_mmu.iamr[10].P = __get_IAMPR(10); - __debug_mmu.iamr[11].L = __get_IAMLR(11); - __debug_mmu.iamr[11].P = __get_IAMPR(11); - __debug_mmu.iamr[12].L = __get_IAMLR(12); - __debug_mmu.iamr[12].P = __get_IAMPR(12); - __debug_mmu.iamr[13].L = __get_IAMLR(13); - __debug_mmu.iamr[13].P = __get_IAMPR(13); - __debug_mmu.iamr[14].L = __get_IAMLR(14); - __debug_mmu.iamr[14].P = __get_IAMPR(14); - __debug_mmu.iamr[15].L = __get_IAMLR(15); - __debug_mmu.iamr[15].P = __get_IAMPR(15); - - __debug_mmu.damr[0].L = __get_DAMLR(0); - __debug_mmu.damr[0].P = __get_DAMPR(0); - __debug_mmu.damr[1].L = __get_DAMLR(1); - __debug_mmu.damr[1].P = __get_DAMPR(1); - __debug_mmu.damr[2].L = __get_DAMLR(2); - __debug_mmu.damr[2].P = __get_DAMPR(2); - __debug_mmu.damr[3].L = __get_DAMLR(3); - __debug_mmu.damr[3].P = __get_DAMPR(3); - __debug_mmu.damr[4].L = __get_DAMLR(4); - __debug_mmu.damr[4].P = __get_DAMPR(4); - __debug_mmu.damr[5].L = __get_DAMLR(5); - __debug_mmu.damr[5].P = __get_DAMPR(5); - __debug_mmu.damr[6].L = __get_DAMLR(6); - __debug_mmu.damr[6].P = __get_DAMPR(6); - __debug_mmu.damr[7].L = __get_DAMLR(7); - __debug_mmu.damr[7].P = __get_DAMPR(7); - __debug_mmu.damr[8].L = __get_DAMLR(8); - __debug_mmu.damr[8].P = __get_DAMPR(8); - __debug_mmu.damr[9].L = __get_DAMLR(9); - __debug_mmu.damr[9].P = __get_DAMPR(9); - __debug_mmu.damr[10].L = __get_DAMLR(10); - __debug_mmu.damr[10].P = __get_DAMPR(10); - __debug_mmu.damr[11].L = __get_DAMLR(11); - __debug_mmu.damr[11].P = __get_DAMPR(11); - __debug_mmu.damr[12].L = __get_DAMLR(12); - __debug_mmu.damr[12].P = __get_DAMPR(12); - __debug_mmu.damr[13].L = __get_DAMLR(13); - __debug_mmu.damr[13].P = __get_DAMPR(13); - __debug_mmu.damr[14].L = __get_DAMLR(14); - __debug_mmu.damr[14].P = __get_DAMPR(14); - __debug_mmu.damr[15].L = __get_DAMLR(15); - __debug_mmu.damr[15].P = __get_DAMPR(15); - -#ifdef CONFIG_MMU - do { - /* read the DAT entries from the TLB */ - struct __debug_amr *p; - int loop; - - asm volatile("movsg tplr,%0" : "=r"(__debug_mmu.regs.tplr)); - asm volatile("movsg tppr,%0" : "=r"(__debug_mmu.regs.tppr)); - asm volatile("movsg tpxr,%0" : "=r"(__debug_mmu.regs.tpxr)); - asm volatile("movsg cxnr,%0" : "=r"(__debug_mmu.regs.cxnr)); - - p = __debug_mmu.tlb; - - /* way 0 */ - asm volatile("movgs %0,tpxr" :: "r"(0 << TPXR_WAY_SHIFT)); - for (loop = 0; loop < 64; loop++) { - asm volatile("tlbpr %0,gr0,#1,#0" :: "r"(loop << PAGE_SHIFT)); - asm volatile("movsg tplr,%0" : "=r"(p->L)); - asm volatile("movsg tppr,%0" : "=r"(p->P)); - p++; - } - - /* way 1 */ - asm volatile("movgs %0,tpxr" :: "r"(1 << TPXR_WAY_SHIFT)); - for (loop = 0; loop < 64; loop++) { - asm volatile("tlbpr %0,gr0,#1,#0" :: "r"(loop << PAGE_SHIFT)); - asm volatile("movsg tplr,%0" : "=r"(p->L)); - asm volatile("movsg tppr,%0" : "=r"(p->P)); - p++; - } - - asm volatile("movgs %0,tplr" :: "r"(__debug_mmu.regs.tplr)); - asm volatile("movgs %0,tppr" :: "r"(__debug_mmu.regs.tppr)); - asm volatile("movgs %0,tpxr" :: "r"(__debug_mmu.regs.tpxr)); - } while(0); -#endif - -} /* end gdbstub_get_mmu_state() */ - -/* - * handle general query commands of the form 'qXXXXX' - */ -static void gdbstub_handle_query(void) -{ - if (strcmp(input_buffer, "qAttached") == 0) { - /* return current thread ID */ - sprintf(output_buffer, "1"); - return; - } - - if (strcmp(input_buffer, "qC") == 0) { - /* return current thread ID */ - sprintf(output_buffer, "QC 0"); - return; - } - - if (strcmp(input_buffer, "qOffsets") == 0) { - /* return relocation offset of text and data segments */ - sprintf(output_buffer, "Text=0;Data=0;Bss=0"); - return; - } - - if (strcmp(input_buffer, "qSymbol::") == 0) { - sprintf(output_buffer, "OK"); - return; - } - - if (strcmp(input_buffer, "qSupported") == 0) { - /* query of supported features */ - sprintf(output_buffer, "PacketSize=%u;ReverseContinue-;ReverseStep-", - sizeof(input_buffer)); - return; - } - - gdbstub_strcpy(output_buffer,"E01"); -} - -/*****************************************************************************/ -/* - * handle event interception and GDB remote protocol processing - * - on entry: - * PSR.ET==0, PSR.S==1 and the CPU is in debug mode - * __debug_frame points to the saved registers - * __frame points to the kernel mode exception frame, if it was in kernel - * mode when the break happened - */ -void gdbstub(int sigval) -{ - unsigned long addr, length, loop, dbar, temp, temp2, temp3; - uint32_t zero; - char *ptr; - int flush_cache = 0; - - LEDS(0x5000); - - if (sigval < 0) { -#ifndef CONFIG_GDBSTUB_IMMEDIATE - /* return immediately if GDB immediate activation option not set */ - return; -#else - sigval = SIGINT; -#endif - } - - save_user_regs(&__debug_frame0->uc); - -#if 0 - gdbstub_printk("--> gdbstub() %08x %p %08x %08x\n", - __debug_frame->pc, - __debug_frame, - __debug_regs->brr, - __debug_regs->bpsr); -// gdbstub_show_regs(); -#endif - - LEDS(0x5001); - - /* if we were interrupted by input on the serial gdbstub serial port, - * restore the context prior to the interrupt so that we return to that - * directly - */ - temp = (unsigned long) __entry_kerneltrap_table; - temp2 = (unsigned long) __entry_usertrap_table; - temp3 = __debug_frame->pc & ~15; - - if (temp3 == temp + TBR_TT_INTERRUPT_15 || - temp3 == temp2 + TBR_TT_INTERRUPT_15 - ) { - asm volatile("movsg pcsr,%0" : "=r"(__debug_frame->pc)); - __debug_frame->psr |= PSR_ET; - __debug_frame->psr &= ~PSR_S; - if (__debug_frame->psr & PSR_PS) - __debug_frame->psr |= PSR_S; - __debug_status.brr = (__debug_frame->tbr & TBR_TT) << 12; - __debug_status.brr |= BRR_EB; - sigval = SIGINT; - } - - /* handle the decrement timer going off (FR451 only) */ - if (temp3 == temp + TBR_TT_DECREMENT_TIMER || - temp3 == temp2 + TBR_TT_DECREMENT_TIMER - ) { - asm volatile("movgs %0,timerd" :: "r"(10000000)); - asm volatile("movsg pcsr,%0" : "=r"(__debug_frame->pc)); - __debug_frame->psr |= PSR_ET; - __debug_frame->psr &= ~PSR_S; - if (__debug_frame->psr & PSR_PS) - __debug_frame->psr |= PSR_S; - __debug_status.brr = (__debug_frame->tbr & TBR_TT) << 12; - __debug_status.brr |= BRR_EB; - sigval = SIGXCPU; - } - - LEDS(0x5002); - - /* after a BREAK insn, the PC lands on the far side of it */ - if (__debug_status.brr & BRR_SB) - gdbstub_check_breakpoint(); - - LEDS(0x5003); - - /* handle attempts to write console data via GDB "O" commands */ - if (__debug_frame->pc == (unsigned long) gdbstub_console_write + 4) { - __gdbstub_console_write((struct console *) __debug_frame->gr8, - (const char *) __debug_frame->gr9, - (unsigned) __debug_frame->gr10); - goto done; - } - - if (gdbstub_rx_unget) { - sigval = SIGINT; - goto packet_waiting; - } - - if (!sigval) - sigval = gdbstub_compute_signal(__debug_status.brr); - - LEDS(0x5004); - - /* send a message to the debugger's user saying what happened if it may - * not be clear cut (we can't map exceptions onto signals properly) - */ - if (sigval != SIGINT && sigval != SIGTRAP && sigval != SIGILL) { - static const char title[] = "Break "; - static const char crlf[] = "\r\n"; - unsigned long brr = __debug_status.brr; - char hx; - - ptr = output_buffer; - *ptr++ = 'O'; - ptr = mem2hex(title, ptr, sizeof(title) - 1,0); - - hx = hex_asc_hi(brr >> 24); - ptr = hex_byte_pack(ptr, hx); - hx = hex_asc_lo(brr >> 24); - ptr = hex_byte_pack(ptr, hx); - hx = hex_asc_hi(brr >> 16); - ptr = hex_byte_pack(ptr, hx); - hx = hex_asc_lo(brr >> 16); - ptr = hex_byte_pack(ptr, hx); - hx = hex_asc_hi(brr >> 8); - ptr = hex_byte_pack(ptr, hx); - hx = hex_asc_lo(brr >> 8); - ptr = hex_byte_pack(ptr, hx); - hx = hex_asc_hi(brr); - ptr = hex_byte_pack(ptr, hx); - hx = hex_asc_lo(brr); - ptr = hex_byte_pack(ptr, hx); - - ptr = mem2hex(crlf, ptr, sizeof(crlf) - 1, 0); - *ptr = 0; - gdbstub_send_packet(output_buffer); /* send it off... */ - } - - LEDS(0x5005); - - /* tell the debugger that an exception has occurred */ - ptr = output_buffer; - - /* Send trap type (converted to signal) */ - *ptr++ = 'T'; - ptr = hex_byte_pack(ptr, sigval); - - /* Send Error PC */ - ptr = hex_byte_pack(ptr, GDB_REG_PC); - *ptr++ = ':'; - ptr = mem2hex(&__debug_frame->pc, ptr, 4, 0); - *ptr++ = ';'; - - /* - * Send frame pointer - */ - ptr = hex_byte_pack(ptr, GDB_REG_FP); - *ptr++ = ':'; - ptr = mem2hex(&__debug_frame->fp, ptr, 4, 0); - *ptr++ = ';'; - - /* - * Send stack pointer - */ - ptr = hex_byte_pack(ptr, GDB_REG_SP); - *ptr++ = ':'; - ptr = mem2hex(&__debug_frame->sp, ptr, 4, 0); - *ptr++ = ';'; - - *ptr++ = 0; - gdbstub_send_packet(output_buffer); /* send it off... */ - - LEDS(0x5006); - - packet_waiting: - gdbstub_get_mmu_state(); - - /* wait for input from remote GDB */ - while (1) { - output_buffer[0] = 0; - - LEDS(0x5007); - gdbstub_recv_packet(input_buffer); - LEDS(0x5600 | input_buffer[0]); - - switch (input_buffer[0]) { - /* request repeat of last signal number */ - case '?': - output_buffer[0] = 'S'; - output_buffer[1] = hex_asc_hi(sigval); - output_buffer[2] = hex_asc_lo(sigval); - output_buffer[3] = 0; - break; - - case 'd': - /* toggle debug flag */ - break; - - /* return the value of the CPU registers - * - GR0, GR1, GR2, GR3, GR4, GR5, GR6, GR7, - * - GR8, GR9, GR10, GR11, GR12, GR13, GR14, GR15, - * - GR16, GR17, GR18, GR19, GR20, GR21, GR22, GR23, - * - GR24, GR25, GR26, GR27, GR28, GR29, GR30, GR31, - * - GR32, GR33, GR34, GR35, GR36, GR37, GR38, GR39, - * - GR40, GR41, GR42, GR43, GR44, GR45, GR46, GR47, - * - GR48, GR49, GR50, GR51, GR52, GR53, GR54, GR55, - * - GR56, GR57, GR58, GR59, GR60, GR61, GR62, GR63, - * - FP0, FP1, FP2, FP3, FP4, FP5, FP6, FP7, - * - FP8, FP9, FP10, FP11, FP12, FP13, FP14, FP15, - * - FP16, FP17, FP18, FP19, FP20, FP21, FP22, FP23, - * - FP24, FP25, FP26, FP27, FP28, FP29, FP30, FP31, - * - FP32, FP33, FP34, FP35, FP36, FP37, FP38, FP39, - * - FP40, FP41, FP42, FP43, FP44, FP45, FP46, FP47, - * - FP48, FP49, FP50, FP51, FP52, FP53, FP54, FP55, - * - FP56, FP57, FP58, FP59, FP60, FP61, FP62, FP63, - * - PC, PSR, CCR, CCCR, - * - _X132, _X133, _X134 - * - TBR, BRR, DBAR0, DBAR1, DBAR2, DBAR3, - * - _X141, _X142, _X143, _X144, - * - LR, LCR - */ - case 'g': - zero = 0; - ptr = output_buffer; - - /* deal with GR0, GR1-GR27, GR28-GR31, GR32-GR63 */ - ptr = mem2hex(&zero, ptr, 4, 0); - - for (loop = 1; loop <= 27; loop++) - ptr = mem2hex(&__debug_user_context->i.gr[loop], ptr, 4, 0); - temp = (unsigned long) __frame; - ptr = mem2hex(&temp, ptr, 4, 0); - ptr = mem2hex(&__debug_user_context->i.gr[29], ptr, 4, 0); - ptr = mem2hex(&__debug_user_context->i.gr[30], ptr, 4, 0); -#ifdef CONFIG_MMU - ptr = mem2hex(&__debug_user_context->i.gr[31], ptr, 4, 0); -#else - temp = (unsigned long) __debug_frame; - ptr = mem2hex(&temp, ptr, 4, 0); -#endif - - for (loop = 32; loop <= 63; loop++) - ptr = mem2hex(&__debug_user_context->i.gr[loop], ptr, 4, 0); - - /* deal with FR0-FR63 */ - for (loop = 0; loop <= 63; loop++) - ptr = mem2hex(&__debug_user_context->f.fr[loop], ptr, 4, 0); - - /* deal with special registers */ - ptr = mem2hex(&__debug_frame->pc, ptr, 4, 0); - ptr = mem2hex(&__debug_frame->psr, ptr, 4, 0); - ptr = mem2hex(&__debug_frame->ccr, ptr, 4, 0); - ptr = mem2hex(&__debug_frame->cccr, ptr, 4, 0); - ptr = mem2hex(&zero, ptr, 4, 0); - ptr = mem2hex(&zero, ptr, 4, 0); - ptr = mem2hex(&zero, ptr, 4, 0); - ptr = mem2hex(&__debug_frame->tbr, ptr, 4, 0); - ptr = mem2hex(&__debug_status.brr , ptr, 4, 0); - - asm volatile("movsg dbar0,%0" : "=r"(dbar)); - ptr = mem2hex(&dbar, ptr, 4, 0); - asm volatile("movsg dbar1,%0" : "=r"(dbar)); - ptr = mem2hex(&dbar, ptr, 4, 0); - asm volatile("movsg dbar2,%0" : "=r"(dbar)); - ptr = mem2hex(&dbar, ptr, 4, 0); - asm volatile("movsg dbar3,%0" : "=r"(dbar)); - ptr = mem2hex(&dbar, ptr, 4, 0); - - asm volatile("movsg scr0,%0" : "=r"(dbar)); - ptr = mem2hex(&dbar, ptr, 4, 0); - asm volatile("movsg scr1,%0" : "=r"(dbar)); - ptr = mem2hex(&dbar, ptr, 4, 0); - asm volatile("movsg scr2,%0" : "=r"(dbar)); - ptr = mem2hex(&dbar, ptr, 4, 0); - asm volatile("movsg scr3,%0" : "=r"(dbar)); - ptr = mem2hex(&dbar, ptr, 4, 0); - - ptr = mem2hex(&__debug_frame->lr, ptr, 4, 0); - ptr = mem2hex(&__debug_frame->lcr, ptr, 4, 0); - - ptr = mem2hex(&__debug_frame->iacc0, ptr, 8, 0); - - ptr = mem2hex(&__debug_user_context->f.fsr[0], ptr, 4, 0); - - for (loop = 0; loop <= 7; loop++) - ptr = mem2hex(&__debug_user_context->f.acc[loop], ptr, 4, 0); - - ptr = mem2hex(&__debug_user_context->f.accg, ptr, 8, 0); - - for (loop = 0; loop <= 1; loop++) - ptr = mem2hex(&__debug_user_context->f.msr[loop], ptr, 4, 0); - - ptr = mem2hex(&__debug_frame->gner0, ptr, 4, 0); - ptr = mem2hex(&__debug_frame->gner1, ptr, 4, 0); - - ptr = mem2hex(&__debug_user_context->f.fner[0], ptr, 4, 0); - ptr = mem2hex(&__debug_user_context->f.fner[1], ptr, 4, 0); - - break; - - /* set the values of the CPU registers */ - case 'G': - ptr = &input_buffer[1]; - - /* deal with GR0, GR1-GR27, GR28-GR31, GR32-GR63 */ - ptr = hex2mem(ptr, &temp, 4); - - for (loop = 1; loop <= 27; loop++) - ptr = hex2mem(ptr, &__debug_user_context->i.gr[loop], 4); - - ptr = hex2mem(ptr, &temp, 4); - __frame = (struct pt_regs *) temp; - ptr = hex2mem(ptr, &__debug_frame->gr29, 4); - ptr = hex2mem(ptr, &__debug_frame->gr30, 4); -#ifdef CONFIG_MMU - ptr = hex2mem(ptr, &__debug_frame->gr31, 4); -#else - ptr = hex2mem(ptr, &temp, 4); -#endif - - for (loop = 32; loop <= 63; loop++) - ptr = hex2mem(ptr, &__debug_user_context->i.gr[loop], 4); - - /* deal with FR0-FR63 */ - for (loop = 0; loop <= 63; loop++) - ptr = mem2hex(&__debug_user_context->f.fr[loop], ptr, 4, 0); - - /* deal with special registers */ - ptr = hex2mem(ptr, &__debug_frame->pc, 4); - ptr = hex2mem(ptr, &__debug_frame->psr, 4); - ptr = hex2mem(ptr, &__debug_frame->ccr, 4); - ptr = hex2mem(ptr, &__debug_frame->cccr,4); - - for (loop = 132; loop <= 140; loop++) - ptr = hex2mem(ptr, &temp, 4); - - ptr = hex2mem(ptr, &temp, 4); - asm volatile("movgs %0,scr0" :: "r"(temp)); - ptr = hex2mem(ptr, &temp, 4); - asm volatile("movgs %0,scr1" :: "r"(temp)); - ptr = hex2mem(ptr, &temp, 4); - asm volatile("movgs %0,scr2" :: "r"(temp)); - ptr = hex2mem(ptr, &temp, 4); - asm volatile("movgs %0,scr3" :: "r"(temp)); - - ptr = hex2mem(ptr, &__debug_frame->lr, 4); - ptr = hex2mem(ptr, &__debug_frame->lcr, 4); - - ptr = hex2mem(ptr, &__debug_frame->iacc0, 8); - - ptr = hex2mem(ptr, &__debug_user_context->f.fsr[0], 4); - - for (loop = 0; loop <= 7; loop++) - ptr = hex2mem(ptr, &__debug_user_context->f.acc[loop], 4); - - ptr = hex2mem(ptr, &__debug_user_context->f.accg, 8); - - for (loop = 0; loop <= 1; loop++) - ptr = hex2mem(ptr, &__debug_user_context->f.msr[loop], 4); - - ptr = hex2mem(ptr, &__debug_frame->gner0, 4); - ptr = hex2mem(ptr, &__debug_frame->gner1, 4); - - ptr = hex2mem(ptr, &__debug_user_context->f.fner[0], 4); - ptr = hex2mem(ptr, &__debug_user_context->f.fner[1], 4); - - gdbstub_strcpy(output_buffer,"OK"); - break; - - /* mAA..AA,LLLL Read LLLL bytes at address AA..AA */ - case 'm': - ptr = &input_buffer[1]; - - if (hexToInt(&ptr, &addr) && - *ptr++ == ',' && - hexToInt(&ptr, &length) - ) { - if (mem2hex((char *)addr, output_buffer, length, 1)) - break; - gdbstub_strcpy (output_buffer, "E03"); - } - else { - gdbstub_strcpy(output_buffer,"E01"); - } - break; - - /* MAA..AA,LLLL: Write LLLL bytes at address AA.AA return OK */ - case 'M': - ptr = &input_buffer[1]; - - if (hexToInt(&ptr, &addr) && - *ptr++ == ',' && - hexToInt(&ptr, &length) && - *ptr++ == ':' - ) { - if (hex2mem(ptr, (char *)addr, length)) { - gdbstub_strcpy(output_buffer, "OK"); - } - else { - gdbstub_strcpy(output_buffer, "E03"); - } - } - else - gdbstub_strcpy(output_buffer, "E02"); - - flush_cache = 1; - break; - - /* pNN: Read value of reg N and return it */ - case 'p': - /* return no value, indicating that we don't support - * this command and that gdb should use 'g' instead */ - break; - - /* PNN,=RRRRRRRR: Write value R to reg N return OK */ - case 'P': - ptr = &input_buffer[1]; - - if (!hexToInt(&ptr, &addr) || - *ptr++ != '=' || - !hexToInt(&ptr, &temp) - ) { - gdbstub_strcpy(output_buffer, "E01"); - break; - } - - temp2 = 1; - switch (addr) { - case GDB_REG_GR(0): - break; - case GDB_REG_GR(1) ... GDB_REG_GR(63): - __debug_user_context->i.gr[addr - GDB_REG_GR(0)] = temp; - break; - case GDB_REG_FR(0) ... GDB_REG_FR(63): - __debug_user_context->f.fr[addr - GDB_REG_FR(0)] = temp; - break; - case GDB_REG_PC: - __debug_user_context->i.pc = temp; - break; - case GDB_REG_PSR: - __debug_user_context->i.psr = temp; - break; - case GDB_REG_CCR: - __debug_user_context->i.ccr = temp; - break; - case GDB_REG_CCCR: - __debug_user_context->i.cccr = temp; - break; - case GDB_REG_BRR: - __debug_status.brr = temp; - break; - case GDB_REG_LR: - __debug_user_context->i.lr = temp; - break; - case GDB_REG_LCR: - __debug_user_context->i.lcr = temp; - break; - case GDB_REG_FSR0: - __debug_user_context->f.fsr[0] = temp; - break; - case GDB_REG_ACC(0) ... GDB_REG_ACC(7): - __debug_user_context->f.acc[addr - GDB_REG_ACC(0)] = temp; - break; - case GDB_REG_ACCG(0): - *(uint32_t *) &__debug_user_context->f.accg[0] = temp; - break; - case GDB_REG_ACCG(4): - *(uint32_t *) &__debug_user_context->f.accg[4] = temp; - break; - case GDB_REG_MSR(0) ... GDB_REG_MSR(1): - __debug_user_context->f.msr[addr - GDB_REG_MSR(0)] = temp; - break; - case GDB_REG_GNER(0) ... GDB_REG_GNER(1): - __debug_user_context->i.gner[addr - GDB_REG_GNER(0)] = temp; - break; - case GDB_REG_FNER(0) ... GDB_REG_FNER(1): - __debug_user_context->f.fner[addr - GDB_REG_FNER(0)] = temp; - break; - default: - temp2 = 0; - break; - } - - if (temp2) { - gdbstub_strcpy(output_buffer, "OK"); - } - else { - gdbstub_strcpy(output_buffer, "E02"); - } - break; - - /* cAA..AA Continue at address AA..AA(optional) */ - case 'c': - /* try to read optional parameter, pc unchanged if no parm */ - ptr = &input_buffer[1]; - if (hexToInt(&ptr, &addr)) - __debug_frame->pc = addr; - goto done; - - /* kill the program */ - case 'k' : - goto done; /* just continue */ - - /* detach */ - case 'D': - gdbstub_strcpy(output_buffer, "OK"); - break; - - /* reset the whole machine (FIXME: system dependent) */ - case 'r': - break; - - - /* step to next instruction */ - case 's': - __debug_regs->dcr |= DCR_SE; - __debug_status.dcr |= DCR_SE; - goto done; - - /* extended command */ - case 'v': - if (strcmp(input_buffer, "vCont?") == 0) { - output_buffer[0] = 0; - break; - } - goto unsupported_cmd; - - /* set baud rate (bBB) */ - case 'b': - ptr = &input_buffer[1]; - if (!hexToInt(&ptr, &temp)) { - gdbstub_strcpy(output_buffer,"B01"); - break; - } - - if (temp) { - /* ack before changing speed */ - gdbstub_send_packet("OK"); - gdbstub_set_baud(temp); - } - break; - - /* set breakpoint */ - case 'Z': - ptr = &input_buffer[1]; - - if (!hexToInt(&ptr,&temp) || *ptr++ != ',' || - !hexToInt(&ptr,&addr) || *ptr++ != ',' || - !hexToInt(&ptr,&length) - ) { - gdbstub_strcpy(output_buffer,"E01"); - break; - } - - if (temp >= 5) { - gdbstub_strcpy(output_buffer,"E03"); - break; - } - - if (gdbstub_set_breakpoint(temp, addr, length) < 0) { - gdbstub_strcpy(output_buffer,"E03"); - break; - } - - if (temp == 0) - flush_cache = 1; /* soft bkpt by modified memory */ - - gdbstub_strcpy(output_buffer,"OK"); - break; - - /* clear breakpoint */ - case 'z': - ptr = &input_buffer[1]; - - if (!hexToInt(&ptr,&temp) || *ptr++ != ',' || - !hexToInt(&ptr,&addr) || *ptr++ != ',' || - !hexToInt(&ptr,&length) - ) { - gdbstub_strcpy(output_buffer,"E01"); - break; - } - - if (temp >= 5) { - gdbstub_strcpy(output_buffer,"E03"); - break; - } - - if (gdbstub_clear_breakpoint(temp, addr, length) < 0) { - gdbstub_strcpy(output_buffer,"E03"); - break; - } - - if (temp == 0) - flush_cache = 1; /* soft bkpt by modified memory */ - - gdbstub_strcpy(output_buffer,"OK"); - break; - - /* Thread-setting packet */ - case 'H': - gdbstub_strcpy(output_buffer, "OK"); - break; - - case 'q': - gdbstub_handle_query(); - break; - - default: - unsupported_cmd: - gdbstub_proto("### GDB Unsupported Cmd '%s'\n",input_buffer); - gdbstub_strcpy(output_buffer,"E01"); - break; - } - - /* reply to the request */ - LEDS(0x5009); - gdbstub_send_packet(output_buffer); - } - - done: - restore_user_regs(&__debug_frame0->uc); - - //gdbstub_dump_debugregs(); - //gdbstub_printk("<-- gdbstub() %08x\n", __debug_frame->pc); - - /* need to flush the instruction cache before resuming, as we may have - * deposited a breakpoint, and the icache probably has no way of - * knowing that a data ref to some location may have changed something - * that is in the instruction cache. NB: We flush both caches, just to - * be sure... - */ - - /* note: flushing the icache will clobber EAR0 on the FR451 */ - if (flush_cache) - gdbstub_purge_cache(); - - LEDS(0x5666); - -} /* end gdbstub() */ - -/*****************************************************************************/ -/* - * initialise the GDB stub - */ -void __init gdbstub_init(void) -{ -#ifdef CONFIG_GDBSTUB_IMMEDIATE - unsigned char ch; - int ret; -#endif - - gdbstub_printk("%s", gdbstub_banner); - - gdbstub_io_init(); - - /* try to talk to GDB (or anyone insane enough to want to type GDB protocol by hand) */ - gdbstub_proto("### GDB Tx ACK\n"); - gdbstub_tx_char('+'); /* 'hello world' */ - -#ifdef CONFIG_GDBSTUB_IMMEDIATE - gdbstub_printk("GDB Stub waiting for packet\n"); - - /* - * In case GDB is started before us, ack any packets - * (presumably "$?#xx") sitting there. - */ - do { gdbstub_rx_char(&ch, 0); } while (ch != '$'); - do { gdbstub_rx_char(&ch, 0); } while (ch != '#'); - do { ret = gdbstub_rx_char(&ch, 0); } while (ret != 0); /* eat first csum byte */ - do { ret = gdbstub_rx_char(&ch, 0); } while (ret != 0); /* eat second csum byte */ - - gdbstub_proto("### GDB Tx NAK\n"); - gdbstub_tx_char('-'); /* nak it */ - -#else - gdbstub_printk("GDB Stub set\n"); -#endif - -#if 0 - /* send banner */ - ptr = output_buffer; - *ptr++ = 'O'; - ptr = mem2hex(gdbstub_banner, ptr, sizeof(gdbstub_banner) - 1, 0); - gdbstub_send_packet(output_buffer); -#endif -#if defined(CONFIG_GDB_CONSOLE) && defined(CONFIG_GDBSTUB_IMMEDIATE) - register_console(&gdbstub_console); -#endif - -} /* end gdbstub_init() */ - -/*****************************************************************************/ -/* - * register the console at a more appropriate time - */ -#if defined (CONFIG_GDB_CONSOLE) && !defined(CONFIG_GDBSTUB_IMMEDIATE) -static int __init gdbstub_postinit(void) -{ - printk("registering console\n"); - register_console(&gdbstub_console); - return 0; -} /* end gdbstub_postinit() */ - -__initcall(gdbstub_postinit); -#endif - -/*****************************************************************************/ -/* - * send an exit message to GDB - */ -void gdbstub_exit(int status) -{ - unsigned char checksum; - int count; - unsigned char ch; - - sprintf(output_buffer,"W%02x",status&0xff); - - gdbstub_tx_char('$'); - checksum = 0; - count = 0; - - while ((ch = output_buffer[count]) != 0) { - gdbstub_tx_char(ch); - checksum += ch; - count += 1; - } - - gdbstub_tx_char('#'); - gdbstub_tx_char(hex_asc_hi(checksum)); - gdbstub_tx_char(hex_asc_lo(checksum)); - - /* make sure the output is flushed, or else RedBoot might clobber it */ - gdbstub_tx_char('-'); - gdbstub_tx_flush(); - -} /* end gdbstub_exit() */ - -/*****************************************************************************/ -/* - * GDB wants to call malloc() and free() to allocate memory for calling kernel - * functions directly from its command line - */ -static void *malloc(size_t size) __maybe_unused; -static void *malloc(size_t size) -{ - return kmalloc(size, GFP_ATOMIC); -} - -static void free(void *p) __maybe_unused; -static void free(void *p) -{ - kfree(p); -} - -static uint32_t ___get_HSR0(void) __maybe_unused; -static uint32_t ___get_HSR0(void) -{ - return __get_HSR(0); -} - -static uint32_t ___set_HSR0(uint32_t x) __maybe_unused; -static uint32_t ___set_HSR0(uint32_t x) -{ - __set_HSR(0, x); - return __get_HSR(0); -} diff --git a/arch/frv/kernel/head-mmu-fr451.S b/arch/frv/kernel/head-mmu-fr451.S deleted file mode 100644 index 98f87d586e598..0000000000000 --- a/arch/frv/kernel/head-mmu-fr451.S +++ /dev/null @@ -1,374 +0,0 @@ -/* head-mmu-fr451.S: FR451 mmu-linux specific bits of initialisation - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include "head.inc" - - -#define __400_DBR0 0xfe000e00 -#define __400_DBR1 0xfe000e08 -#define __400_DBR2 0xfe000e10 -#define __400_DBR3 0xfe000e18 -#define __400_DAM0 0xfe000f00 -#define __400_DAM1 0xfe000f08 -#define __400_DAM2 0xfe000f10 -#define __400_DAM3 0xfe000f18 -#define __400_LGCR 0xfe000010 -#define __400_LCR 0xfe000100 -#define __400_LSBR 0xfe000c00 - - __INIT - .balign 4 - -############################################################################### -# -# describe the position and layout of the SDRAM controller registers -# -# ENTRY: EXIT: -# GR5 - cacheline size -# GR11 - displacement of 2nd SDRAM addr reg from GR14 -# GR12 - displacement of 3rd SDRAM addr reg from GR14 -# GR13 - displacement of 4th SDRAM addr reg from GR14 -# GR14 - address of 1st SDRAM addr reg -# GR15 - amount to shift address by to match SDRAM addr reg -# GR26 &__head_reference [saved] -# GR30 LED address [saved] -# CC0 - T if DBR0 is present -# CC1 - T if DBR1 is present -# CC2 - T if DBR2 is present -# CC3 - T if DBR3 is present -# -############################################################################### - .globl __head_fr451_describe_sdram -__head_fr451_describe_sdram: - sethi.p %hi(__400_DBR0),gr14 - setlo %lo(__400_DBR0),gr14 - setlos.p #__400_DBR1-__400_DBR0,gr11 - setlos #__400_DBR2-__400_DBR0,gr12 - setlos.p #__400_DBR3-__400_DBR0,gr13 - setlos #32,gr5 ; cacheline size - setlos.p #0,gr15 ; amount to shift addr reg by - setlos #0x00ff,gr4 - movgs gr4,cccr ; extant DARS/DAMK regs - bralr - -############################################################################### -# -# rearrange the bus controller registers -# -# ENTRY: EXIT: -# GR26 &__head_reference [saved] -# GR30 LED address revised LED address -# -############################################################################### - .globl __head_fr451_set_busctl -__head_fr451_set_busctl: - sethi.p %hi(__400_LGCR),gr4 - setlo %lo(__400_LGCR),gr4 - sethi.p %hi(__400_LSBR),gr10 - setlo %lo(__400_LSBR),gr10 - sethi.p %hi(__400_LCR),gr11 - setlo %lo(__400_LCR),gr11 - - # set the bus controller - ldi @(gr4,#0),gr5 - ori gr5,#0xff,gr5 ; make sure all chip-selects are enabled - sti gr5,@(gr4,#0) - - sethi.p %hi(__region_CS1),gr4 - setlo %lo(__region_CS1),gr4 - sethi.p %hi(__region_CS1_M),gr5 - setlo %lo(__region_CS1_M),gr5 - sethi.p %hi(__region_CS1_C),gr6 - setlo %lo(__region_CS1_C),gr6 - sti gr4,@(gr10,#1*0x08) - sti gr5,@(gr10,#1*0x08+0x100) - sti gr6,@(gr11,#1*0x08) - sethi.p %hi(__region_CS2),gr4 - setlo %lo(__region_CS2),gr4 - sethi.p %hi(__region_CS2_M),gr5 - setlo %lo(__region_CS2_M),gr5 - sethi.p %hi(__region_CS2_C),gr6 - setlo %lo(__region_CS2_C),gr6 - sti gr4,@(gr10,#2*0x08) - sti gr5,@(gr10,#2*0x08+0x100) - sti gr6,@(gr11,#2*0x08) - sethi.p %hi(__region_CS3),gr4 - setlo %lo(__region_CS3),gr4 - sethi.p %hi(__region_CS3_M),gr5 - setlo %lo(__region_CS3_M),gr5 - sethi.p %hi(__region_CS3_C),gr6 - setlo %lo(__region_CS3_C),gr6 - sti gr4,@(gr10,#3*0x08) - sti gr5,@(gr10,#3*0x08+0x100) - sti gr6,@(gr11,#3*0x08) - sethi.p %hi(__region_CS4),gr4 - setlo %lo(__region_CS4),gr4 - sethi.p %hi(__region_CS4_M),gr5 - setlo %lo(__region_CS4_M),gr5 - sethi.p %hi(__region_CS4_C),gr6 - setlo %lo(__region_CS4_C),gr6 - sti gr4,@(gr10,#4*0x08) - sti gr5,@(gr10,#4*0x08+0x100) - sti gr6,@(gr11,#4*0x08) - sethi.p %hi(__region_CS5),gr4 - setlo %lo(__region_CS5),gr4 - sethi.p %hi(__region_CS5_M),gr5 - setlo %lo(__region_CS5_M),gr5 - sethi.p %hi(__region_CS5_C),gr6 - setlo %lo(__region_CS5_C),gr6 - sti gr4,@(gr10,#5*0x08) - sti gr5,@(gr10,#5*0x08+0x100) - sti gr6,@(gr11,#5*0x08) - sethi.p %hi(__region_CS6),gr4 - setlo %lo(__region_CS6),gr4 - sethi.p %hi(__region_CS6_M),gr5 - setlo %lo(__region_CS6_M),gr5 - sethi.p %hi(__region_CS6_C),gr6 - setlo %lo(__region_CS6_C),gr6 - sti gr4,@(gr10,#6*0x08) - sti gr5,@(gr10,#6*0x08+0x100) - sti gr6,@(gr11,#6*0x08) - sethi.p %hi(__region_CS7),gr4 - setlo %lo(__region_CS7),gr4 - sethi.p %hi(__region_CS7_M),gr5 - setlo %lo(__region_CS7_M),gr5 - sethi.p %hi(__region_CS7_C),gr6 - setlo %lo(__region_CS7_C),gr6 - sti gr4,@(gr10,#7*0x08) - sti gr5,@(gr10,#7*0x08+0x100) - sti gr6,@(gr11,#7*0x08) - membar - bar - - # adjust LED bank address -#ifdef CONFIG_MB93091_VDK - sethi.p %hi(__region_CS2 + 0x01200004),gr30 - setlo %lo(__region_CS2 + 0x01200004),gr30 -#endif - bralr - -############################################################################### -# -# determine the total SDRAM size -# -# ENTRY: EXIT: -# GR25 - SDRAM size -# GR26 &__head_reference [saved] -# GR30 LED address [saved] -# -############################################################################### - .globl __head_fr451_survey_sdram -__head_fr451_survey_sdram: - sethi.p %hi(__400_DAM0),gr11 - setlo %lo(__400_DAM0),gr11 - sethi.p %hi(__400_DBR0),gr12 - setlo %lo(__400_DBR0),gr12 - - sethi.p %hi(0xfe000000),gr17 ; unused SDRAM DBR value - setlo %lo(0xfe000000),gr17 - setlos #0,gr25 - - ldi @(gr12,#0x00),gr4 ; DAR0 - subcc gr4,gr17,gr0,icc0 - beq icc0,#0,__head_no_DCS0 - ldi @(gr11,#0x00),gr6 ; DAM0: bits 31:20 match addr 31:20 - add gr25,gr6,gr25 - addi gr25,#1,gr25 -__head_no_DCS0: - - ldi @(gr12,#0x08),gr4 ; DAR1 - subcc gr4,gr17,gr0,icc0 - beq icc0,#0,__head_no_DCS1 - ldi @(gr11,#0x08),gr6 ; DAM1: bits 31:20 match addr 31:20 - add gr25,gr6,gr25 - addi gr25,#1,gr25 -__head_no_DCS1: - - ldi @(gr12,#0x10),gr4 ; DAR2 - subcc gr4,gr17,gr0,icc0 - beq icc0,#0,__head_no_DCS2 - ldi @(gr11,#0x10),gr6 ; DAM2: bits 31:20 match addr 31:20 - add gr25,gr6,gr25 - addi gr25,#1,gr25 -__head_no_DCS2: - - ldi @(gr12,#0x18),gr4 ; DAR3 - subcc gr4,gr17,gr0,icc0 - beq icc0,#0,__head_no_DCS3 - ldi @(gr11,#0x18),gr6 ; DAM3: bits 31:20 match addr 31:20 - add gr25,gr6,gr25 - addi gr25,#1,gr25 -__head_no_DCS3: - bralr - -############################################################################### -# -# set the protection map with the I/DAMPR registers -# -# ENTRY: EXIT: -# GR25 SDRAM size [saved] -# GR26 &__head_reference [saved] -# GR30 LED address [saved] -# -# -# Using this map: -# REGISTERS ADDRESS RANGE VIEW -# =============== ====================== =============================== -# IAMPR0/DAMPR0 0xC0000000-0xCFFFFFFF Cached kernel RAM Window -# DAMPR11 0xE0000000-0xFFFFFFFF Uncached I/O -# -############################################################################### - .globl __head_fr451_set_protection -__head_fr451_set_protection: - movsg lr,gr27 - - # set the I/O region protection registers for FR451 in MMU mode -#define PGPROT_IO xAMPRx_L|xAMPRx_M|xAMPRx_S_KERNEL|xAMPRx_C|xAMPRx_V - - sethi.p %hi(__region_IO),gr5 - setlo %lo(__region_IO),gr5 - setlos #PGPROT_IO|xAMPRx_SS_512Mb,gr4 - or gr4,gr5,gr4 - movgs gr5,damlr11 ; General I/O tile - movgs gr4,dampr11 - - # need to open a window onto at least part of the RAM for the kernel's use - sethi.p %hi(__sdram_base),gr8 - setlo %lo(__sdram_base),gr8 ; physical address - sethi.p %hi(__page_offset),gr9 - setlo %lo(__page_offset),gr9 ; virtual address - - setlos #xAMPRx_L|xAMPRx_M|xAMPRx_SS_256Mb|xAMPRx_S_KERNEL|xAMPRx_V,gr11 - or gr8,gr11,gr8 - - movgs gr9,iamlr0 ; mapped from real address 0 - movgs gr8,iampr0 ; cached kernel memory at 0xC0000000 - movgs gr9,damlr0 - movgs gr8,dampr0 - - # set a temporary mapping for the kernel running at address 0 until we've turned on the MMU - sethi.p %hi(__sdram_base),gr9 - setlo %lo(__sdram_base),gr9 ; virtual address - - and.p gr4,gr11,gr4 - and gr5,gr11,gr5 - or.p gr4,gr11,gr4 - or gr5,gr11,gr5 - - movgs gr9,iamlr1 ; mapped from real address 0 - movgs gr8,iampr1 ; cached kernel memory at 0x00000000 - movgs gr9,damlr1 - movgs gr8,dampr1 - - # we use DAMR2-10 for kmap_atomic(), cache flush and TLB management - # since the DAMLR regs are not going to change, we can set them now - # also set up IAMLR2 to the same as DAMLR5 - sethi.p %hi(KMAP_ATOMIC_PRIMARY_FRAME),gr4 - setlo %lo(KMAP_ATOMIC_PRIMARY_FRAME),gr4 - sethi.p %hi(PAGE_SIZE),gr5 - setlo %lo(PAGE_SIZE),gr5 - - movgs gr4,damlr2 - movgs gr4,iamlr2 - add gr4,gr5,gr4 - movgs gr4,damlr3 - add gr4,gr5,gr4 - movgs gr4,damlr4 - add gr4,gr5,gr4 - movgs gr4,damlr5 - add gr4,gr5,gr4 - movgs gr4,damlr6 - add gr4,gr5,gr4 - movgs gr4,damlr7 - add gr4,gr5,gr4 - movgs gr4,damlr8 - add gr4,gr5,gr4 - movgs gr4,damlr9 - add gr4,gr5,gr4 - movgs gr4,damlr10 - - movgs gr0,dampr2 - movgs gr0,dampr4 - movgs gr0,dampr5 - movgs gr0,dampr6 - movgs gr0,dampr7 - movgs gr0,dampr8 - movgs gr0,dampr9 - movgs gr0,dampr10 - - movgs gr0,iamlr3 - movgs gr0,iamlr4 - movgs gr0,iamlr5 - movgs gr0,iamlr6 - movgs gr0,iamlr7 - - movgs gr0,iampr2 - movgs gr0,iampr3 - movgs gr0,iampr4 - movgs gr0,iampr5 - movgs gr0,iampr6 - movgs gr0,iampr7 - - # start in TLB context 0 with the swapper's page tables - movgs gr0,cxnr - - sethi.p %hi(swapper_pg_dir),gr4 - setlo %lo(swapper_pg_dir),gr4 - sethi.p %hi(__page_offset),gr5 - setlo %lo(__page_offset),gr5 - sub gr4,gr5,gr4 - movgs gr4,ttbr - setlos #xAMPRx_L|xAMPRx_M|xAMPRx_SS_16Kb|xAMPRx_S|xAMPRx_C|xAMPRx_V,gr5 - or gr4,gr5,gr4 - movgs gr4,dampr3 - - # the FR451 also has an extra trap base register - movsg tbr,gr4 - movgs gr4,btbr - - LEDS 0x3300 - jmpl @(gr27,gr0) - -############################################################################### -# -# finish setting up the protection registers -# -############################################################################### - .globl __head_fr451_finalise_protection -__head_fr451_finalise_protection: - # turn on the timers as appropriate - movgs gr0,timerh - movgs gr0,timerl - movgs gr0,timerd - movsg hsr0,gr4 - sethi.p %hi(HSR0_ETMI),gr5 - setlo %lo(HSR0_ETMI),gr5 - or gr4,gr5,gr4 - movgs gr4,hsr0 - - # clear the TLB entry cache - movgs gr0,iamlr1 - movgs gr0,iampr1 - movgs gr0,damlr1 - movgs gr0,dampr1 - - # clear the PGE cache - sethi.p %hi(__flush_tlb_all),gr4 - setlo %lo(__flush_tlb_all),gr4 - jmpl @(gr4,gr0) diff --git a/arch/frv/kernel/head-uc-fr401.S b/arch/frv/kernel/head-uc-fr401.S deleted file mode 100644 index 438643cfa38e8..0000000000000 --- a/arch/frv/kernel/head-uc-fr401.S +++ /dev/null @@ -1,311 +0,0 @@ -/* head-uc-fr401.S: FR401/3/5 uc-linux specific bits of initialisation - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "head.inc" - - -#define __400_DBR0 0xfe000e00 -#define __400_DBR1 0xfe000e08 -#define __400_DBR2 0xfe000e10 /* not on FR401 */ -#define __400_DBR3 0xfe000e18 /* not on FR401 */ -#define __400_DAM0 0xfe000f00 -#define __400_DAM1 0xfe000f08 -#define __400_DAM2 0xfe000f10 /* not on FR401 */ -#define __400_DAM3 0xfe000f18 /* not on FR401 */ -#define __400_LGCR 0xfe000010 -#define __400_LCR 0xfe000100 -#define __400_LSBR 0xfe000c00 - - __INIT - .balign 4 - -############################################################################### -# -# describe the position and layout of the SDRAM controller registers -# -# ENTRY: EXIT: -# GR5 - cacheline size -# GR11 - displacement of 2nd SDRAM addr reg from GR14 -# GR12 - displacement of 3rd SDRAM addr reg from GR14 -# GR13 - displacement of 4th SDRAM addr reg from GR14 -# GR14 - address of 1st SDRAM addr reg -# GR15 - amount to shift address by to match SDRAM addr reg -# GR26 &__head_reference [saved] -# GR30 LED address [saved] -# CC0 - T if DBR0 is present -# CC1 - T if DBR1 is present -# CC2 - T if DBR2 is present (not FR401/FR401A) -# CC3 - T if DBR3 is present (not FR401/FR401A) -# -############################################################################### - .globl __head_fr401_describe_sdram -__head_fr401_describe_sdram: - sethi.p %hi(__400_DBR0),gr14 - setlo %lo(__400_DBR0),gr14 - setlos.p #__400_DBR1-__400_DBR0,gr11 - setlos #__400_DBR2-__400_DBR0,gr12 - setlos.p #__400_DBR3-__400_DBR0,gr13 - setlos #32,gr5 ; cacheline size - setlos.p #0,gr15 ; amount to shift addr reg by - - # specify which DBR regs are present - setlos #0x00ff,gr4 - movgs gr4,cccr - movsg psr,gr3 ; check for FR401/FR401A - srli gr3,#25,gr3 - subicc gr3,#0x20>>1,gr0,icc0 - bnelr icc0,#1 - setlos #0x000f,gr4 - movgs gr4,cccr - bralr - -############################################################################### -# -# rearrange the bus controller registers -# -# ENTRY: EXIT: -# GR26 &__head_reference [saved] -# GR30 LED address revised LED address -# -############################################################################### - .globl __head_fr401_set_busctl -__head_fr401_set_busctl: - sethi.p %hi(__400_LGCR),gr4 - setlo %lo(__400_LGCR),gr4 - sethi.p %hi(__400_LSBR),gr10 - setlo %lo(__400_LSBR),gr10 - sethi.p %hi(__400_LCR),gr11 - setlo %lo(__400_LCR),gr11 - - # set the bus controller - ldi @(gr4,#0),gr5 - ori gr5,#0xff,gr5 ; make sure all chip-selects are enabled - sti gr5,@(gr4,#0) - - sethi.p %hi(__region_CS1),gr4 - setlo %lo(__region_CS1),gr4 - sethi.p %hi(__region_CS1_M),gr5 - setlo %lo(__region_CS1_M),gr5 - sethi.p %hi(__region_CS1_C),gr6 - setlo %lo(__region_CS1_C),gr6 - sti gr4,@(gr10,#1*0x08) - sti gr5,@(gr10,#1*0x08+0x100) - sti gr6,@(gr11,#1*0x08) - sethi.p %hi(__region_CS2),gr4 - setlo %lo(__region_CS2),gr4 - sethi.p %hi(__region_CS2_M),gr5 - setlo %lo(__region_CS2_M),gr5 - sethi.p %hi(__region_CS2_C),gr6 - setlo %lo(__region_CS2_C),gr6 - sti gr4,@(gr10,#2*0x08) - sti gr5,@(gr10,#2*0x08+0x100) - sti gr6,@(gr11,#2*0x08) - sethi.p %hi(__region_CS3),gr4 - setlo %lo(__region_CS3),gr4 - sethi.p %hi(__region_CS3_M),gr5 - setlo %lo(__region_CS3_M),gr5 - sethi.p %hi(__region_CS3_C),gr6 - setlo %lo(__region_CS3_C),gr6 - sti gr4,@(gr10,#3*0x08) - sti gr5,@(gr10,#3*0x08+0x100) - sti gr6,@(gr11,#3*0x08) - sethi.p %hi(__region_CS4),gr4 - setlo %lo(__region_CS4),gr4 - sethi.p %hi(__region_CS4_M),gr5 - setlo %lo(__region_CS4_M),gr5 - sethi.p %hi(__region_CS4_C),gr6 - setlo %lo(__region_CS4_C),gr6 - sti gr4,@(gr10,#4*0x08) - sti gr5,@(gr10,#4*0x08+0x100) - sti gr6,@(gr11,#4*0x08) - sethi.p %hi(__region_CS5),gr4 - setlo %lo(__region_CS5),gr4 - sethi.p %hi(__region_CS5_M),gr5 - setlo %lo(__region_CS5_M),gr5 - sethi.p %hi(__region_CS5_C),gr6 - setlo %lo(__region_CS5_C),gr6 - sti gr4,@(gr10,#5*0x08) - sti gr5,@(gr10,#5*0x08+0x100) - sti gr6,@(gr11,#5*0x08) - sethi.p %hi(__region_CS6),gr4 - setlo %lo(__region_CS6),gr4 - sethi.p %hi(__region_CS6_M),gr5 - setlo %lo(__region_CS6_M),gr5 - sethi.p %hi(__region_CS6_C),gr6 - setlo %lo(__region_CS6_C),gr6 - sti gr4,@(gr10,#6*0x08) - sti gr5,@(gr10,#6*0x08+0x100) - sti gr6,@(gr11,#6*0x08) - sethi.p %hi(__region_CS7),gr4 - setlo %lo(__region_CS7),gr4 - sethi.p %hi(__region_CS7_M),gr5 - setlo %lo(__region_CS7_M),gr5 - sethi.p %hi(__region_CS7_C),gr6 - setlo %lo(__region_CS7_C),gr6 - sti gr4,@(gr10,#7*0x08) - sti gr5,@(gr10,#7*0x08+0x100) - sti gr6,@(gr11,#7*0x08) - membar - bar - - # adjust LED bank address - sethi.p %hi(LED_ADDR - 0x20000000 +__region_CS2),gr30 - setlo %lo(LED_ADDR - 0x20000000 +__region_CS2),gr30 - bralr - -############################################################################### -# -# determine the total SDRAM size -# -# ENTRY: EXIT: -# GR25 - SDRAM size -# GR26 &__head_reference [saved] -# GR30 LED address [saved] -# -############################################################################### - .globl __head_fr401_survey_sdram -__head_fr401_survey_sdram: - sethi.p %hi(__400_DAM0),gr11 - setlo %lo(__400_DAM0),gr11 - sethi.p %hi(__400_DBR0),gr12 - setlo %lo(__400_DBR0),gr12 - - sethi.p %hi(0xfe000000),gr17 ; unused SDRAM DBR value - setlo %lo(0xfe000000),gr17 - setlos #0,gr25 - - ldi @(gr12,#0x00),gr4 ; DAR0 - subcc gr4,gr17,gr0,icc0 - beq icc0,#0,__head_no_DCS0 - ldi @(gr11,#0x00),gr6 ; DAM0: bits 31:20 match addr 31:20 - add gr25,gr6,gr25 - addi gr25,#1,gr25 -__head_no_DCS0: - - ldi @(gr12,#0x08),gr4 ; DAR1 - subcc gr4,gr17,gr0,icc0 - beq icc0,#0,__head_no_DCS1 - ldi @(gr11,#0x08),gr6 ; DAM1: bits 31:20 match addr 31:20 - add gr25,gr6,gr25 - addi gr25,#1,gr25 -__head_no_DCS1: - - # FR401/FR401A does not have DCS2/3 - movsg psr,gr3 - srli gr3,#25,gr3 - subicc gr3,#0x20>>1,gr0,icc0 - beq icc0,#0,__head_no_DCS3 - - ldi @(gr12,#0x10),gr4 ; DAR2 - subcc gr4,gr17,gr0,icc0 - beq icc0,#0,__head_no_DCS2 - ldi @(gr11,#0x10),gr6 ; DAM2: bits 31:20 match addr 31:20 - add gr25,gr6,gr25 - addi gr25,#1,gr25 -__head_no_DCS2: - - ldi @(gr12,#0x18),gr4 ; DAR3 - subcc gr4,gr17,gr0,icc0 - beq icc0,#0,__head_no_DCS3 - ldi @(gr11,#0x18),gr6 ; DAM3: bits 31:20 match addr 31:20 - add gr25,gr6,gr25 - addi gr25,#1,gr25 -__head_no_DCS3: - bralr - -############################################################################### -# -# set the protection map with the I/DAMPR registers -# -# ENTRY: EXIT: -# GR25 SDRAM size [saved] -# GR26 &__head_reference [saved] -# GR30 LED address [saved] -# -############################################################################### - .globl __head_fr401_set_protection -__head_fr401_set_protection: - movsg lr,gr27 - - # set the I/O region protection registers for FR401/3/5 - sethi.p %hi(__region_IO),gr5 - setlo %lo(__region_IO),gr5 - ori gr5,#xAMPRx_SS_512Mb|xAMPRx_S_KERNEL|xAMPRx_C|xAMPRx_V,gr5 - movgs gr0,iampr7 - movgs gr5,dampr7 ; General I/O tile - - # need to tile the remaining IAMPR/DAMPR registers to cover as much of the RAM as possible - # - start with the highest numbered registers - sethi.p %hi(__kernel_image_end),gr8 - setlo %lo(__kernel_image_end),gr8 - sethi.p %hi(32768),gr4 ; allow for a maximal allocator bitmap - setlo %lo(32768),gr4 - add gr8,gr4,gr8 - sethi.p %hi(1024*2048-1),gr4 ; round up to nearest 2MiB - setlo %lo(1024*2048-1),gr4 - add.p gr8,gr4,gr8 - not gr4,gr4 - and gr8,gr4,gr8 - - sethi.p %hi(__page_offset),gr9 - setlo %lo(__page_offset),gr9 - add gr9,gr25,gr9 - - # GR8 = base of uncovered RAM - # GR9 = top of uncovered RAM - -#ifdef CONFIG_MB93093_PDK - sethi.p %hi(__region_CS2),gr4 - setlo %lo(__region_CS2),gr4 - ori gr4,#xAMPRx_SS_1Mb|xAMPRx_S_KERNEL|xAMPRx_C|xAMPRx_V,gr4 - movgs gr4,dampr6 - movgs gr0,iampr6 -#else - call __head_split_region - movgs gr4,iampr6 - movgs gr5,dampr6 -#endif - call __head_split_region - movgs gr4,iampr5 - movgs gr5,dampr5 - call __head_split_region - movgs gr4,iampr4 - movgs gr5,dampr4 - call __head_split_region - movgs gr4,iampr3 - movgs gr5,dampr3 - call __head_split_region - movgs gr4,iampr2 - movgs gr5,dampr2 - call __head_split_region - movgs gr4,iampr1 - movgs gr5,dampr1 - - # cover kernel core image with kernel-only segment - sethi.p %hi(__page_offset),gr8 - setlo %lo(__page_offset),gr8 - call __head_split_region - -#ifdef CONFIG_PROTECT_KERNEL - ori.p gr4,#xAMPRx_S_KERNEL,gr4 - ori gr5,#xAMPRx_S_KERNEL,gr5 -#endif - - movgs gr4,iampr0 - movgs gr5,dampr0 - jmpl @(gr27,gr0) diff --git a/arch/frv/kernel/head-uc-fr451.S b/arch/frv/kernel/head-uc-fr451.S deleted file mode 100644 index b2a76c4a17862..0000000000000 --- a/arch/frv/kernel/head-uc-fr451.S +++ /dev/null @@ -1,174 +0,0 @@ -/* head-uc-fr451.S: FR451 uc-linux specific bits of initialisation - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "head.inc" - - -#define __400_DBR0 0xfe000e00 -#define __400_DBR1 0xfe000e08 -#define __400_DBR2 0xfe000e10 -#define __400_DBR3 0xfe000e18 -#define __400_DAM0 0xfe000f00 -#define __400_DAM1 0xfe000f08 -#define __400_DAM2 0xfe000f10 -#define __400_DAM3 0xfe000f18 -#define __400_LGCR 0xfe000010 -#define __400_LCR 0xfe000100 -#define __400_LSBR 0xfe000c00 - - __INIT - .balign 4 - -############################################################################### -# -# set the protection map with the I/DAMPR registers -# -# ENTRY: EXIT: -# GR25 SDRAM size [saved] -# GR26 &__head_reference [saved] -# GR30 LED address [saved] -# -############################################################################### - .globl __head_fr451_set_protection -__head_fr451_set_protection: - movsg lr,gr27 - - movgs gr0,dampr10 - movgs gr0,damlr10 - movgs gr0,dampr9 - movgs gr0,damlr9 - movgs gr0,dampr8 - movgs gr0,damlr8 - - # set the I/O region protection registers for FR401/3/5 - sethi.p %hi(__region_IO),gr5 - setlo %lo(__region_IO),gr5 - sethi.p %hi(0x1fffffff),gr7 - setlo %lo(0x1fffffff),gr7 - ori gr5,#xAMPRx_SS_512Mb|xAMPRx_S_KERNEL|xAMPRx_C|xAMPRx_V,gr5 - movgs gr5,dampr11 ; General I/O tile - movgs gr7,damlr11 - - # need to tile the remaining IAMPR/DAMPR registers to cover as much of the RAM as possible - # - start with the highest numbered registers - sethi.p %hi(__kernel_image_end),gr8 - setlo %lo(__kernel_image_end),gr8 - sethi.p %hi(32768),gr4 ; allow for a maximal allocator bitmap - setlo %lo(32768),gr4 - add gr8,gr4,gr8 - sethi.p %hi(1024*2048-1),gr4 ; round up to nearest 2MiB - setlo %lo(1024*2048-1),gr4 - add.p gr8,gr4,gr8 - not gr4,gr4 - and gr8,gr4,gr8 - - sethi.p %hi(__page_offset),gr9 - setlo %lo(__page_offset),gr9 - add gr9,gr25,gr9 - - sethi.p %hi(0xffffc000),gr11 - setlo %lo(0xffffc000),gr11 - - # GR8 = base of uncovered RAM - # GR9 = top of uncovered RAM - # GR11 = xAMLR mask - LEDS 0x3317 - call __head_split_region - movgs gr4,iampr7 - movgs gr6,iamlr7 - movgs gr5,dampr7 - movgs gr7,damlr7 - - LEDS 0x3316 - call __head_split_region - movgs gr4,iampr6 - movgs gr6,iamlr6 - movgs gr5,dampr6 - movgs gr7,damlr6 - - LEDS 0x3315 - call __head_split_region - movgs gr4,iampr5 - movgs gr6,iamlr5 - movgs gr5,dampr5 - movgs gr7,damlr5 - - LEDS 0x3314 - call __head_split_region - movgs gr4,iampr4 - movgs gr6,iamlr4 - movgs gr5,dampr4 - movgs gr7,damlr4 - - LEDS 0x3313 - call __head_split_region - movgs gr4,iampr3 - movgs gr6,iamlr3 - movgs gr5,dampr3 - movgs gr7,damlr3 - - LEDS 0x3312 - call __head_split_region - movgs gr4,iampr2 - movgs gr6,iamlr2 - movgs gr5,dampr2 - movgs gr7,damlr2 - - LEDS 0x3311 - call __head_split_region - movgs gr4,iampr1 - movgs gr6,iamlr1 - movgs gr5,dampr1 - movgs gr7,damlr1 - - # cover kernel core image with kernel-only segment - LEDS 0x3310 - sethi.p %hi(__page_offset),gr8 - setlo %lo(__page_offset),gr8 - call __head_split_region - -#ifdef CONFIG_PROTECT_KERNEL - ori.p gr4,#xAMPRx_S_KERNEL,gr4 - ori gr5,#xAMPRx_S_KERNEL,gr5 -#endif - - movgs gr4,iampr0 - movgs gr6,iamlr0 - movgs gr5,dampr0 - movgs gr7,damlr0 - - # start in TLB context 0 with no page tables - movgs gr0,cxnr - movgs gr0,ttbr - - # the FR451 also has an extra trap base register - movsg tbr,gr4 - movgs gr4,btbr - - # turn on the timers as appropriate - movgs gr0,timerh - movgs gr0,timerl - movgs gr0,timerd - movsg hsr0,gr4 - sethi.p %hi(HSR0_ETMI),gr5 - setlo %lo(HSR0_ETMI),gr5 - or gr4,gr5,gr4 - movgs gr4,hsr0 - - LEDS 0x3300 - jmpl @(gr27,gr0) diff --git a/arch/frv/kernel/head-uc-fr555.S b/arch/frv/kernel/head-uc-fr555.S deleted file mode 100644 index 5497aaf34f77b..0000000000000 --- a/arch/frv/kernel/head-uc-fr555.S +++ /dev/null @@ -1,347 +0,0 @@ -/* head-uc-fr555.S: FR555 uc-linux specific bits of initialisation - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#include -#include -#include -#include -#include -#include -#include -#include "head.inc" - - -#define __551_DARS0 0xfeff0100 -#define __551_DARS1 0xfeff0104 -#define __551_DARS2 0xfeff0108 -#define __551_DARS3 0xfeff010c -#define __551_DAMK0 0xfeff0110 -#define __551_DAMK1 0xfeff0114 -#define __551_DAMK2 0xfeff0118 -#define __551_DAMK3 0xfeff011c -#define __551_LCR 0xfeff1100 -#define __551_LSBR 0xfeff1c00 - - __INIT - .balign 4 - -############################################################################### -# -# describe the position and layout of the SDRAM controller registers -# -# ENTRY: EXIT: -# GR5 - cacheline size -# GR11 - displacement of 2nd SDRAM addr reg from GR14 -# GR12 - displacement of 3rd SDRAM addr reg from GR14 -# GR13 - displacement of 4th SDRAM addr reg from GR14 -# GR14 - address of 1st SDRAM addr reg -# GR15 - amount to shift address by to match SDRAM addr reg -# GR26 &__head_reference [saved] -# GR30 LED address [saved] -# CC0 - T if DARS0 is present -# CC1 - T if DARS1 is present -# CC2 - T if DARS2 is present -# CC3 - T if DARS3 is present -# -############################################################################### - .globl __head_fr555_describe_sdram -__head_fr555_describe_sdram: - sethi.p %hi(__551_DARS0),gr14 - setlo %lo(__551_DARS0),gr14 - setlos.p #__551_DARS1-__551_DARS0,gr11 - setlos #__551_DARS2-__551_DARS0,gr12 - setlos.p #__551_DARS3-__551_DARS0,gr13 - setlos #64,gr5 ; cacheline size - setlos #20,gr15 ; amount to shift addr by - setlos #0x00ff,gr4 - movgs gr4,cccr ; extant DARS/DAMK regs - bralr - -############################################################################### -# -# rearrange the bus controller registers -# -# ENTRY: EXIT: -# GR26 &__head_reference [saved] -# GR30 LED address revised LED address -# -############################################################################### - .globl __head_fr555_set_busctl -__head_fr555_set_busctl: - LEDS 0x100f - sethi.p %hi(__551_LSBR),gr10 - setlo %lo(__551_LSBR),gr10 - sethi.p %hi(__551_LCR),gr11 - setlo %lo(__551_LCR),gr11 - - # set the bus controller - sethi.p %hi(__region_CS1),gr4 - setlo %lo(__region_CS1),gr4 - sethi.p %hi(__region_CS1_M),gr5 - setlo %lo(__region_CS1_M),gr5 - sethi.p %hi(__region_CS1_C),gr6 - setlo %lo(__region_CS1_C),gr6 - sti gr4,@(gr10,#1*0x08) - sti gr5,@(gr10,#1*0x08+0x100) - sti gr6,@(gr11,#1*0x08) - sethi.p %hi(__region_CS2),gr4 - setlo %lo(__region_CS2),gr4 - sethi.p %hi(__region_CS2_M),gr5 - setlo %lo(__region_CS2_M),gr5 - sethi.p %hi(__region_CS2_C),gr6 - setlo %lo(__region_CS2_C),gr6 - sti gr4,@(gr10,#2*0x08) - sti gr5,@(gr10,#2*0x08+0x100) - sti gr6,@(gr11,#2*0x08) - sethi.p %hi(__region_CS3),gr4 - setlo %lo(__region_CS3),gr4 - sethi.p %hi(__region_CS3_M),gr5 - setlo %lo(__region_CS3_M),gr5 - sethi.p %hi(__region_CS3_C),gr6 - setlo %lo(__region_CS3_C),gr6 - sti gr4,@(gr10,#3*0x08) - sti gr5,@(gr10,#3*0x08+0x100) - sti gr6,@(gr11,#3*0x08) - sethi.p %hi(__region_CS4),gr4 - setlo %lo(__region_CS4),gr4 - sethi.p %hi(__region_CS4_M),gr5 - setlo %lo(__region_CS4_M),gr5 - sethi.p %hi(__region_CS4_C),gr6 - setlo %lo(__region_CS4_C),gr6 - sti gr4,@(gr10,#4*0x08) - sti gr5,@(gr10,#4*0x08+0x100) - sti gr6,@(gr11,#4*0x08) - sethi.p %hi(__region_CS5),gr4 - setlo %lo(__region_CS5),gr4 - sethi.p %hi(__region_CS5_M),gr5 - setlo %lo(__region_CS5_M),gr5 - sethi.p %hi(__region_CS5_C),gr6 - setlo %lo(__region_CS5_C),gr6 - sti gr4,@(gr10,#5*0x08) - sti gr5,@(gr10,#5*0x08+0x100) - sti gr6,@(gr11,#5*0x08) - sethi.p %hi(__region_CS6),gr4 - setlo %lo(__region_CS6),gr4 - sethi.p %hi(__region_CS6_M),gr5 - setlo %lo(__region_CS6_M),gr5 - sethi.p %hi(__region_CS6_C),gr6 - setlo %lo(__region_CS6_C),gr6 - sti gr4,@(gr10,#6*0x08) - sti gr5,@(gr10,#6*0x08+0x100) - sti gr6,@(gr11,#6*0x08) - sethi.p %hi(__region_CS7),gr4 - setlo %lo(__region_CS7),gr4 - sethi.p %hi(__region_CS7_M),gr5 - setlo %lo(__region_CS7_M),gr5 - sethi.p %hi(__region_CS7_C),gr6 - setlo %lo(__region_CS7_C),gr6 - sti gr4,@(gr10,#7*0x08) - sti gr5,@(gr10,#7*0x08+0x100) - sti gr6,@(gr11,#7*0x08) - membar - bar - - # adjust LED bank address -#ifdef CONFIG_MB93091_VDK - sethi.p %hi(LED_ADDR - 0x20000000 +__region_CS2),gr30 - setlo %lo(LED_ADDR - 0x20000000 +__region_CS2),gr30 -#endif - bralr - -############################################################################### -# -# determine the total SDRAM size -# -# ENTRY: EXIT: -# GR25 - SDRAM size -# GR26 &__head_reference [saved] -# GR30 LED address [saved] -# -############################################################################### - .globl __head_fr555_survey_sdram -__head_fr555_survey_sdram: - sethi.p %hi(__551_DAMK0),gr11 - setlo %lo(__551_DAMK0),gr11 - sethi.p %hi(__551_DARS0),gr12 - setlo %lo(__551_DARS0),gr12 - - sethi.p %hi(0xfff),gr17 ; unused SDRAM AMK value - setlo %lo(0xfff),gr17 - setlos #0,gr25 - - ldi @(gr11,#0x00),gr6 ; DAMK0: bits 11:0 match addr 11:0 - subcc gr6,gr17,gr0,icc0 - beq icc0,#0,__head_no_DCS0 - ldi @(gr12,#0x00),gr4 ; DARS0 - add gr25,gr6,gr25 - addi gr25,#1,gr25 -__head_no_DCS0: - - ldi @(gr11,#0x04),gr6 ; DAMK1: bits 11:0 match addr 11:0 - subcc gr6,gr17,gr0,icc0 - beq icc0,#0,__head_no_DCS1 - ldi @(gr12,#0x04),gr4 ; DARS1 - add gr25,gr6,gr25 - addi gr25,#1,gr25 -__head_no_DCS1: - - ldi @(gr11,#0x8),gr6 ; DAMK2: bits 11:0 match addr 11:0 - subcc gr6,gr17,gr0,icc0 - beq icc0,#0,__head_no_DCS2 - ldi @(gr12,#0x8),gr4 ; DARS2 - add gr25,gr6,gr25 - addi gr25,#1,gr25 -__head_no_DCS2: - - ldi @(gr11,#0xc),gr6 ; DAMK3: bits 11:0 match addr 11:0 - subcc gr6,gr17,gr0,icc0 - beq icc0,#0,__head_no_DCS3 - ldi @(gr12,#0xc),gr4 ; DARS3 - add gr25,gr6,gr25 - addi gr25,#1,gr25 -__head_no_DCS3: - - slli gr25,#20,gr25 ; shift [11:0] -> [31:20] - bralr - -############################################################################### -# -# set the protection map with the I/DAMPR registers -# -# ENTRY: EXIT: -# GR25 SDRAM size saved -# GR30 LED address saved -# -############################################################################### - .globl __head_fr555_set_protection -__head_fr555_set_protection: - movsg lr,gr27 - - sethi.p %hi(0xfff00000),gr11 - setlo %lo(0xfff00000),gr11 - - # set the I/O region protection registers for FR555 - sethi.p %hi(__region_IO),gr7 - setlo %lo(__region_IO),gr7 - ori gr7,#xAMPRx_SS_512Mb|xAMPRx_S_KERNEL|xAMPRx_C|xAMPRx_V,gr5 - movgs gr0,iampr15 - movgs gr0,iamlr15 - movgs gr5,dampr15 - movgs gr7,damlr15 - - # need to tile the remaining IAMPR/DAMPR registers to cover as much of the RAM as possible - # - start with the highest numbered registers - sethi.p %hi(__kernel_image_end),gr8 - setlo %lo(__kernel_image_end),gr8 - sethi.p %hi(32768),gr4 ; allow for a maximal allocator bitmap - setlo %lo(32768),gr4 - add gr8,gr4,gr8 - sethi.p %hi(1024*2048-1),gr4 ; round up to nearest 2MiB - setlo %lo(1024*2048-1),gr4 - add.p gr8,gr4,gr8 - not gr4,gr4 - and gr8,gr4,gr8 - - sethi.p %hi(__page_offset),gr9 - setlo %lo(__page_offset),gr9 - add gr9,gr25,gr9 - - # GR8 = base of uncovered RAM - # GR9 = top of uncovered RAM - # GR11 - mask for DAMLR/IAMLR regs - # - call __head_split_region - movgs gr4,iampr14 - movgs gr6,iamlr14 - movgs gr5,dampr14 - movgs gr7,damlr14 - call __head_split_region - movgs gr4,iampr13 - movgs gr6,iamlr13 - movgs gr5,dampr13 - movgs gr7,damlr13 - call __head_split_region - movgs gr4,iampr12 - movgs gr6,iamlr12 - movgs gr5,dampr12 - movgs gr7,damlr12 - call __head_split_region - movgs gr4,iampr11 - movgs gr6,iamlr11 - movgs gr5,dampr11 - movgs gr7,damlr11 - call __head_split_region - movgs gr4,iampr10 - movgs gr6,iamlr10 - movgs gr5,dampr10 - movgs gr7,damlr10 - call __head_split_region - movgs gr4,iampr9 - movgs gr6,iamlr9 - movgs gr5,dampr9 - movgs gr7,damlr9 - call __head_split_region - movgs gr4,iampr8 - movgs gr6,iamlr8 - movgs gr5,dampr8 - movgs gr7,damlr8 - - call __head_split_region - movgs gr4,iampr7 - movgs gr6,iamlr7 - movgs gr5,dampr7 - movgs gr7,damlr7 - call __head_split_region - movgs gr4,iampr6 - movgs gr6,iamlr6 - movgs gr5,dampr6 - movgs gr7,damlr6 - call __head_split_region - movgs gr4,iampr5 - movgs gr6,iamlr5 - movgs gr5,dampr5 - movgs gr7,damlr5 - call __head_split_region - movgs gr4,iampr4 - movgs gr6,iamlr4 - movgs gr5,dampr4 - movgs gr7,damlr4 - call __head_split_region - movgs gr4,iampr3 - movgs gr6,iamlr3 - movgs gr5,dampr3 - movgs gr7,damlr3 - call __head_split_region - movgs gr4,iampr2 - movgs gr6,iamlr2 - movgs gr5,dampr2 - movgs gr7,damlr2 - call __head_split_region - movgs gr4,iampr1 - movgs gr6,iamlr1 - movgs gr5,dampr1 - movgs gr7,damlr1 - - # cover kernel core image with kernel-only segment - sethi.p %hi(__page_offset),gr8 - setlo %lo(__page_offset),gr8 - call __head_split_region - -#ifdef CONFIG_PROTECT_KERNEL - ori.p gr4,#xAMPRx_S_KERNEL,gr4 - ori gr5,#xAMPRx_S_KERNEL,gr5 -#endif - - movgs gr4,iampr0 - movgs gr6,iamlr0 - movgs gr5,dampr0 - movgs gr7,damlr0 - jmpl @(gr27,gr0) diff --git a/arch/frv/kernel/head.S b/arch/frv/kernel/head.S deleted file mode 100644 index a7d0bea9c0361..0000000000000 --- a/arch/frv/kernel/head.S +++ /dev/null @@ -1,638 +0,0 @@ -/* head.S: kernel entry point for FR-V kernel - * - * Copyright (C) 2003, 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "head.inc" - -############################################################################### -# -# void _boot(unsigned long magic, char *command_line) __attribute__((noreturn)) -# -# - if magic is 0xdead1eaf, then command_line is assumed to point to the kernel -# command line string -# -############################################################################### - __HEAD - .balign 4 - - .globl _boot, __head_reference - .type _boot,@function -_boot: -__head_reference: - sethi.p %hi(LED_ADDR),gr30 - setlo %lo(LED_ADDR),gr30 - - LEDS 0x0000 - - # calculate reference address for PC-relative stuff - call 0f -0: movsg lr,gr26 - addi gr26,#__head_reference-0b,gr26 - - # invalidate and disable both of the caches and turn off the memory access checking - dcef @(gr0,gr0),1 - bar - - sethi.p %hi(~(HSR0_ICE|HSR0_DCE|HSR0_CBM|HSR0_EIMMU|HSR0_EDMMU)),gr4 - setlo %lo(~(HSR0_ICE|HSR0_DCE|HSR0_CBM|HSR0_EIMMU|HSR0_EDMMU)),gr4 - movsg hsr0,gr5 - and gr4,gr5,gr5 - movgs gr5,hsr0 - movsg hsr0,gr5 - - LEDS 0x0001 - - icei @(gr0,gr0),1 - dcei @(gr0,gr0),1 - bar - - # turn the instruction cache back on - sethi.p %hi(HSR0_ICE),gr4 - setlo %lo(HSR0_ICE),gr4 - movsg hsr0,gr5 - or gr4,gr5,gr5 - movgs gr5,hsr0 - movsg hsr0,gr5 - - bar - - LEDS 0x0002 - - # retrieve the parameters (including command line) before we overwrite them - sethi.p %hi(0xdead1eaf),gr7 - setlo %lo(0xdead1eaf),gr7 - subcc gr7,gr8,gr0,icc0 - bne icc0,#0,__head_no_parameters - - sethi.p %hi(redboot_command_line-1),gr6 - setlo %lo(redboot_command_line-1),gr6 - sethi.p %hi(__head_reference),gr4 - setlo %lo(__head_reference),gr4 - sub gr6,gr4,gr6 - add.p gr6,gr26,gr6 - subi gr9,#1,gr9 - setlos.p #511,gr4 - setlos #1,gr5 - -__head_copy_cmdline: - ldubu.p @(gr9,gr5),gr16 - subicc gr4,#1,gr4,icc0 - stbu.p gr16,@(gr6,gr5) - subicc gr16,#0,gr0,icc1 - bls icc0,#0,__head_end_cmdline - bne icc1,#1,__head_copy_cmdline -__head_end_cmdline: - stbu gr0,@(gr6,gr5) -__head_no_parameters: - -############################################################################### -# -# we need to relocate the SDRAM to 0x00000000 (linux) or 0xC0000000 (uClinux) -# - note that we're going to have to run entirely out of the icache whilst -# fiddling with the SDRAM controller registers -# -############################################################################### -#ifdef CONFIG_MMU - call __head_fr451_describe_sdram - -#else - movsg psr,gr5 - srli gr5,#28,gr5 - subicc gr5,#3,gr0,icc0 - beq icc0,#0,__head_fr551_sdram - - call __head_fr401_describe_sdram - bra __head_do_sdram - -__head_fr551_sdram: - call __head_fr555_describe_sdram - LEDS 0x000d - -__head_do_sdram: -#endif - - # preload the registers with invalid values in case any DBR/DARS are marked not present - sethi.p %hi(0xfe000000),gr17 ; unused SDRAM DBR value - setlo %lo(0xfe000000),gr17 - or.p gr17,gr0,gr20 - or gr17,gr0,gr21 - or.p gr17,gr0,gr22 - or gr17,gr0,gr23 - - # consult the SDRAM controller CS address registers - cld @(gr14,gr0 ),gr20, cc0,#1 ; DBR0 / DARS0 - cld @(gr14,gr11),gr21, cc1,#1 ; DBR1 / DARS1 - cld @(gr14,gr12),gr22, cc2,#1 ; DBR2 / DARS2 - cld.p @(gr14,gr13),gr23, cc3,#1 ; DBR3 / DARS3 - - sll gr20,gr15,gr20 ; shift values up for FR551 - sll gr21,gr15,gr21 - sll gr22,gr15,gr22 - sll gr23,gr15,gr23 - - LEDS 0x0003 - - # assume the lowest valid CS line to be the SDRAM base and get its address - subcc gr20,gr17,gr0,icc0 - subcc.p gr21,gr17,gr0,icc1 - subcc gr22,gr17,gr0,icc2 - subcc.p gr23,gr17,gr0,icc3 - ckne icc0,cc4 ; T if DBR0 != 0xfe000000 - ckne icc1,cc5 - ckne icc2,cc6 - ckne icc3,cc7 - cor gr23,gr0,gr24, cc7,#1 ; GR24 = SDRAM base - cor gr22,gr0,gr24, cc6,#1 - cor gr21,gr0,gr24, cc5,#1 - cor gr20,gr0,gr24, cc4,#1 - - # calculate the displacement required to get the SDRAM into the right place in memory - sethi.p %hi(__sdram_base),gr16 - setlo %lo(__sdram_base),gr16 - sub gr16,gr24,gr16 ; delta = __sdram_base - DBRx - - # calculate the new values to go in the controller regs - cadd.p gr20,gr16,gr20, cc4,#1 ; DCS#0 (new) = DCS#0 (old) + delta - cadd gr21,gr16,gr21, cc5,#1 - cadd.p gr22,gr16,gr22, cc6,#1 - cadd gr23,gr16,gr23, cc7,#1 - - srl gr20,gr15,gr20 ; shift values down for FR551 - srl gr21,gr15,gr21 - srl gr22,gr15,gr22 - srl gr23,gr15,gr23 - - # work out the address at which the reg updater resides and lock it into icache - # also work out the address the updater will jump to when finished - sethi.p %hi(__head_move_sdram-__head_reference),gr18 - setlo %lo(__head_move_sdram-__head_reference),gr18 - sethi.p %hi(__head_sdram_moved-__head_reference),gr19 - setlo %lo(__head_sdram_moved-__head_reference),gr19 - add.p gr18,gr26,gr18 - add gr19,gr26,gr19 - add.p gr19,gr16,gr19 ; moved = addr + (__sdram_base - DBRx) - add gr18,gr5,gr4 ; two cachelines probably required - - icpl gr18,gr0,#1 ; load and lock the cachelines - icpl gr4,gr0,#1 - LEDS 0x0004 - membar - bar - jmpl @(gr18,gr0) - - .balign L1_CACHE_BYTES -__head_move_sdram: - cst gr20,@(gr14,gr0 ), cc4,#1 - cst gr21,@(gr14,gr11), cc5,#1 - cst gr22,@(gr14,gr12), cc6,#1 - cst gr23,@(gr14,gr13), cc7,#1 - cld @(gr14,gr0 ),gr20, cc4,#1 - cld @(gr14,gr11),gr21, cc5,#1 - cld @(gr14,gr12),gr22, cc4,#1 - cld @(gr14,gr13),gr23, cc7,#1 - bar - membar - jmpl @(gr19,gr0) - - .balign L1_CACHE_BYTES -__head_sdram_moved: - icul gr18 - add gr18,gr5,gr4 - icul gr4 - icei @(gr0,gr0),1 - dcei @(gr0,gr0),1 - - LEDS 0x0005 - - # recalculate reference address - call 0f -0: movsg lr,gr26 - addi gr26,#__head_reference-0b,gr26 - - -############################################################################### -# -# move the kernel image down to the bottom of the SDRAM -# -############################################################################### - sethi.p %hi(__kernel_image_size_no_bss+15),gr4 - setlo %lo(__kernel_image_size_no_bss+15),gr4 - srli.p gr4,#4,gr4 ; count - or gr26,gr26,gr16 ; source - - sethi.p %hi(__sdram_base),gr17 ; destination - setlo %lo(__sdram_base),gr17 - - setlos #8,gr5 - sub.p gr16,gr5,gr16 ; adjust src for LDDU - sub gr17,gr5,gr17 ; adjust dst for LDDU - - sethi.p %hi(__head_move_kernel-__head_reference),gr18 - setlo %lo(__head_move_kernel-__head_reference),gr18 - sethi.p %hi(__head_kernel_moved-__head_reference+__sdram_base),gr19 - setlo %lo(__head_kernel_moved-__head_reference+__sdram_base),gr19 - add gr18,gr26,gr18 - icpl gr18,gr0,#1 - jmpl @(gr18,gr0) - - .balign 32 -__head_move_kernel: - lddu @(gr16,gr5),gr10 - lddu @(gr16,gr5),gr12 - stdu.p gr10,@(gr17,gr5) - subicc gr4,#1,gr4,icc0 - stdu.p gr12,@(gr17,gr5) - bhi icc0,#0,__head_move_kernel - jmpl @(gr19,gr0) - - .balign 32 -__head_kernel_moved: - icul gr18 - icei @(gr0,gr0),1 - dcei @(gr0,gr0),1 - - LEDS 0x0006 - - # recalculate reference address - call 0f -0: movsg lr,gr26 - addi gr26,#__head_reference-0b,gr26 - - -############################################################################### -# -# rearrange the iomem map and set the protection registers -# -############################################################################### - -#ifdef CONFIG_MMU - LEDS 0x3301 - call __head_fr451_set_busctl - LEDS 0x3303 - call __head_fr451_survey_sdram - LEDS 0x3305 - call __head_fr451_set_protection - -#else - movsg psr,gr5 - srli gr5,#PSR_IMPLE_SHIFT,gr5 - subicc gr5,#PSR_IMPLE_FR551,gr0,icc0 - beq icc0,#0,__head_fr555_memmap - subicc gr5,#PSR_IMPLE_FR451,gr0,icc0 - beq icc0,#0,__head_fr451_memmap - - LEDS 0x3101 - call __head_fr401_set_busctl - LEDS 0x3103 - call __head_fr401_survey_sdram - LEDS 0x3105 - call __head_fr401_set_protection - bra __head_done_memmap - -__head_fr451_memmap: - LEDS 0x3301 - call __head_fr401_set_busctl - LEDS 0x3303 - call __head_fr401_survey_sdram - LEDS 0x3305 - call __head_fr451_set_protection - bra __head_done_memmap - -__head_fr555_memmap: - LEDS 0x3501 - call __head_fr555_set_busctl - LEDS 0x3503 - call __head_fr555_survey_sdram - LEDS 0x3505 - call __head_fr555_set_protection - -__head_done_memmap: -#endif - LEDS 0x0007 - -############################################################################### -# -# turn the data cache and MMU on -# - for the FR451 this'll mean that the window through which the kernel is -# viewed will change -# -############################################################################### - -#ifdef CONFIG_MMU -#define MMUMODE HSR0_EIMMU|HSR0_EDMMU|HSR0_EXMMU|HSR0_EDAT|HSR0_XEDAT -#else -#define MMUMODE HSR0_EIMMU|HSR0_EDMMU -#endif - - movsg hsr0,gr5 - - sethi.p %hi(MMUMODE),gr4 - setlo %lo(MMUMODE),gr4 - or gr4,gr5,gr5 - -#if defined(CONFIG_FRV_DEFL_CACHE_WTHRU) - sethi.p %hi(HSR0_DCE|HSR0_CBM_WRITE_THRU),gr4 - setlo %lo(HSR0_DCE|HSR0_CBM_WRITE_THRU),gr4 -#elif defined(CONFIG_FRV_DEFL_CACHE_WBACK) - sethi.p %hi(HSR0_DCE|HSR0_CBM_COPY_BACK),gr4 - setlo %lo(HSR0_DCE|HSR0_CBM_COPY_BACK),gr4 -#elif defined(CONFIG_FRV_DEFL_CACHE_WBEHIND) - sethi.p %hi(HSR0_DCE|HSR0_CBM_COPY_BACK),gr4 - setlo %lo(HSR0_DCE|HSR0_CBM_COPY_BACK),gr4 - - movsg psr,gr6 - srli gr6,#24,gr6 - cmpi gr6,#0x50,icc0 // FR451 - beq icc0,#0,0f - cmpi gr6,#0x40,icc0 // FR405 - bne icc0,#0,1f -0: - # turn off write-allocate - sethi.p %hi(HSR0_NWA),gr6 - setlo %lo(HSR0_NWA),gr6 - or gr4,gr6,gr4 -1: - -#else -#error No default cache configuration set -#endif - - or gr4,gr5,gr5 - movgs gr5,hsr0 - bar - - LEDS 0x0008 - - sethi.p %hi(__head_mmu_enabled),gr19 - setlo %lo(__head_mmu_enabled),gr19 - jmpl @(gr19,gr0) - -__head_mmu_enabled: - icei @(gr0,gr0),#1 - dcei @(gr0,gr0),#1 - - LEDS 0x0009 - -#ifdef CONFIG_MMU - call __head_fr451_finalise_protection -#endif - - LEDS 0x000a - -############################################################################### -# -# set up the runtime environment -# -############################################################################### - - # clear the BSS area - sethi.p %hi(__bss_start),gr4 - setlo %lo(__bss_start),gr4 - sethi.p %hi(_end),gr5 - setlo %lo(_end),gr5 - or.p gr0,gr0,gr18 - or gr0,gr0,gr19 - -0: - stdi gr18,@(gr4,#0) - stdi gr18,@(gr4,#8) - stdi gr18,@(gr4,#16) - stdi.p gr18,@(gr4,#24) - addi gr4,#24,gr4 - subcc gr5,gr4,gr0,icc0 - bhi icc0,#2,0b - - LEDS 0x000b - - # save the SDRAM details - sethi.p %hi(__sdram_old_base),gr4 - setlo %lo(__sdram_old_base),gr4 - st gr24,@(gr4,gr0) - - sethi.p %hi(__sdram_base),gr5 - setlo %lo(__sdram_base),gr5 - sethi.p %hi(memory_start),gr4 - setlo %lo(memory_start),gr4 - st gr5,@(gr4,gr0) - - add gr25,gr5,gr25 - sethi.p %hi(memory_end),gr4 - setlo %lo(memory_end),gr4 - st gr25,@(gr4,gr0) - - # point the TBR at the kernel trap table - sethi.p %hi(__entry_kerneltrap_table),gr4 - setlo %lo(__entry_kerneltrap_table),gr4 - movgs gr4,tbr - - # set up the exception frame for init - sethi.p %hi(__kernel_frame0_ptr),gr28 - setlo %lo(__kernel_frame0_ptr),gr28 - sethi.p %hi(_gp),gr16 - setlo %lo(_gp),gr16 - sethi.p %hi(__entry_usertrap_table),gr4 - setlo %lo(__entry_usertrap_table),gr4 - - lddi @(gr28,#0),gr28 ; load __frame & current - ldi.p @(gr29,#4),gr15 ; set current_thread - - or gr0,gr0,fp - or gr28,gr0,sp - - sti.p gr4,@(gr28,REG_TBR) - setlos #ISR_EDE|ISR_DTT_DIVBYZERO|ISR_EMAM_EXCEPTION,gr5 - movgs gr5,isr - - # turn on and off various CPU services - movsg psr,gr22 - sethi.p %hi(#PSR_EM|PSR_EF|PSR_CM|PSR_NEM),gr4 - setlo %lo(#PSR_EM|PSR_EF|PSR_CM|PSR_NEM),gr4 - or gr22,gr4,gr22 - movgs gr22,psr - - andi gr22,#~(PSR_PIL|PSR_PS|PSR_S),gr22 - ori gr22,#PSR_ET,gr22 - sti gr22,@(gr28,REG_PSR) - - -############################################################################### -# -# set up the registers and jump into the kernel -# -############################################################################### - - LEDS 0x000c - - sethi.p #0xe5e5,gr3 - setlo #0xe5e5,gr3 - or.p gr3,gr0,gr4 - or gr3,gr0,gr5 - or.p gr3,gr0,gr6 - or gr3,gr0,gr7 - or.p gr3,gr0,gr8 - or gr3,gr0,gr9 - or.p gr3,gr0,gr10 - or gr3,gr0,gr11 - or.p gr3,gr0,gr12 - or gr3,gr0,gr13 - or.p gr3,gr0,gr14 - or gr3,gr0,gr17 - or.p gr3,gr0,gr18 - or gr3,gr0,gr19 - or.p gr3,gr0,gr20 - or gr3,gr0,gr21 - or.p gr3,gr0,gr23 - or gr3,gr0,gr24 - or.p gr3,gr0,gr25 - or gr3,gr0,gr26 - or.p gr3,gr0,gr27 -# or gr3,gr0,gr30 - or gr3,gr0,gr31 - movgs gr0,lr - movgs gr0,lcr - movgs gr0,ccr - movgs gr0,cccr - - # initialise the virtual interrupt handling - subcc gr0,gr0,gr0,icc2 /* set Z, clear C */ - -#ifdef CONFIG_MMU - movgs gr3,scr2 - movgs gr3,scr3 -#endif - - LEDS 0x0fff - - # invoke the debugging stub if present - # - arch/frv/kernel/debug-stub.c will shift control directly to init/main.c - # (it will not return here) - break - .globl __debug_stub_init_break -__debug_stub_init_break: - - # however, if you need to use an ICE, and don't care about using any userspace - # debugging tools (such as the ptrace syscall), you can just step over the break - # above and get to the kernel this way - # look at arch/frv/kernel/debug-stub.c: debug_stub_init() to see what you've missed - call start_kernel - - .globl __head_end -__head_end: - .size _boot, .-_boot - - # provide a point for GDB to place a break - .section .text..start,"ax" - .globl _start - .balign 4 -_start: - call _boot - - .previous -############################################################################### -# -# split a tile off of the region defined by GR8-GR9 -# -# ENTRY: EXIT: -# GR4 - IAMPR value representing tile -# GR5 - DAMPR value representing tile -# GR6 - IAMLR value representing tile -# GR7 - DAMLR value representing tile -# GR8 region base pointer [saved] -# GR9 region top pointer updated to exclude new tile -# GR11 xAMLR mask [saved] -# GR25 SDRAM size [saved] -# GR30 LED address [saved] -# -# - GR8 and GR9 should be rounded up/down to the nearest megabyte before calling -# -############################################################################### - .globl __head_split_region - .type __head_split_region,@function -__head_split_region: - subcc.p gr9,gr8,gr4,icc0 - setlos #31,gr5 - scan.p gr4,gr0,gr6 - beq icc0,#0,__head_region_empty - sub.p gr5,gr6,gr6 ; bit number of highest set bit (1MB=>20) - setlos #1,gr4 - sll.p gr4,gr6,gr4 ; size of region (1 << bitno) - subi gr6,#17,gr6 ; 1MB => 0x03 - slli.p gr6,#4,gr6 ; 1MB => 0x30 - sub gr9,gr4,gr9 ; move uncovered top down - - or gr9,gr6,gr4 - ori gr4,#xAMPRx_S_USER|xAMPRx_C_CACHED|xAMPRx_V,gr4 - or.p gr4,gr0,gr5 - - and gr4,gr11,gr6 - and.p gr5,gr11,gr7 - bralr - -__head_region_empty: - or.p gr0,gr0,gr4 - or gr0,gr0,gr5 - or.p gr0,gr0,gr6 - or gr0,gr0,gr7 - bralr - .size __head_split_region, .-__head_split_region - -############################################################################### -# -# write the 32-bit hex number in GR8 to ttyS0 -# -############################################################################### -#if 0 - .globl __head_write_to_ttyS0 - .type __head_write_to_ttyS0,@function -__head_write_to_ttyS0: - sethi.p %hi(0xfeff9c00),gr31 - setlo %lo(0xfeff9c00),gr31 - setlos #8,gr20 - -0: ldubi @(gr31,#5*8),gr21 - andi gr21,#0x60,gr21 - subicc gr21,#0x60,gr21,icc0 - bne icc0,#0,0b - -1: srli gr8,#28,gr21 - slli gr8,#4,gr8 - - addi gr21,#'0',gr21 - subicc gr21,#'9',gr0,icc0 - bls icc0,#2,2f - addi gr21,#'A'-'0'-10,gr21 -2: - stbi gr21,@(gr31,#0*8) - subicc gr20,#1,gr20,icc0 - bhi icc0,#2,1b - - setlos #'\r',gr21 - stbi gr21,@(gr31,#0*8) - - setlos #'\n',gr21 - stbi gr21,@(gr31,#0*8) - -3: ldubi @(gr31,#5*8),gr21 - andi gr21,#0x60,gr21 - subicc gr21,#0x60,gr21,icc0 - bne icc0,#0,3b - bralr - - .size __head_write_to_ttyS0, .-__head_write_to_ttyS0 -#endif diff --git a/arch/frv/kernel/head.inc b/arch/frv/kernel/head.inc deleted file mode 100644 index bff66628b99af..0000000000000 --- a/arch/frv/kernel/head.inc +++ /dev/null @@ -1,50 +0,0 @@ -/* head.inc: head common definitions -*- asm -*- - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - - -#if defined(CONFIG_MB93090_MB00) -#define LED_ADDR (0x21200000+4) - -.macro LEDS val - sethi.p %hi(0xFFC00030),gr3 - setlo %lo(0xFFC00030),gr3 - lduh @(gr3,gr0),gr3 - andicc gr3,#0x100,gr0,icc0 - bne icc0,0,999f - - setlos #~\val,gr3 - st gr3,@(gr30,gr0) - membar - dcf @(gr30,gr0) - 999: -.endm - -#elif defined(CONFIG_MB93093_PDK) -#define LED_ADDR (0x20000023) - -.macro LEDS val - setlos #\val,gr3 - stb gr3,@(gr30,gr0) - membar -.endm - -#else -#define LED_ADDR 0 - -.macro LEDS val -.endm -#endif - -#ifdef CONFIG_MMU -__sdram_base = 0x00000000 /* base address to which SDRAM relocated */ -#else -__sdram_base = __page_offset /* base address to which SDRAM relocated */ -#endif diff --git a/arch/frv/kernel/irq-mb93091.c b/arch/frv/kernel/irq-mb93091.c deleted file mode 100644 index 091b2839be902..0000000000000 --- a/arch/frv/kernel/irq-mb93091.c +++ /dev/null @@ -1,157 +0,0 @@ -/* irq-mb93091.c: MB93091 FPGA interrupt handling - * - * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#define __reg16(ADDR) (*(volatile unsigned short *)(ADDR)) - -#define __get_IMR() ({ __reg16(0xffc00004); }) -#define __set_IMR(M) do { __reg16(0xffc00004) = (M); wmb(); } while(0) -#define __get_IFR() ({ __reg16(0xffc0000c); }) -#define __clr_IFR(M) do { __reg16(0xffc0000c) = ~(M); wmb(); } while(0) - - -/* - * on-motherboard FPGA PIC operations - */ -static void frv_fpga_mask(struct irq_data *d) -{ - uint16_t imr = __get_IMR(); - - imr |= 1 << (d->irq - IRQ_BASE_FPGA); - - __set_IMR(imr); -} - -static void frv_fpga_ack(struct irq_data *d) -{ - __clr_IFR(1 << (d->irq - IRQ_BASE_FPGA)); -} - -static void frv_fpga_mask_ack(struct irq_data *d) -{ - uint16_t imr = __get_IMR(); - - imr |= 1 << (d->irq - IRQ_BASE_FPGA); - __set_IMR(imr); - - __clr_IFR(1 << (d->irq - IRQ_BASE_FPGA)); -} - -static void frv_fpga_unmask(struct irq_data *d) -{ - uint16_t imr = __get_IMR(); - - imr &= ~(1 << (d->irq - IRQ_BASE_FPGA)); - - __set_IMR(imr); -} - -static struct irq_chip frv_fpga_pic = { - .name = "mb93091", - .irq_ack = frv_fpga_ack, - .irq_mask = frv_fpga_mask, - .irq_mask_ack = frv_fpga_mask_ack, - .irq_unmask = frv_fpga_unmask, -}; - -/* - * FPGA PIC interrupt handler - */ -static irqreturn_t fpga_interrupt(int irq, void *_mask) -{ - uint16_t imr, mask = (unsigned long) _mask; - - imr = __get_IMR(); - mask = mask & ~imr & __get_IFR(); - - /* poll all the triggered IRQs */ - while (mask) { - int irq; - - asm("scan %1,gr0,%0" : "=r"(irq) : "r"(mask)); - irq = 31 - irq; - mask &= ~(1 << irq); - - generic_handle_irq(IRQ_BASE_FPGA + irq); - } - - return IRQ_HANDLED; -} - -/* - * define an interrupt action for each FPGA PIC output - * - use dev_id to indicate the FPGA PIC input to output mappings - */ -static struct irqaction fpga_irq[4] = { - [0] = { - .handler = fpga_interrupt, - .flags = IRQF_SHARED, - .name = "fpga.0", - .dev_id = (void *) 0x0028UL, - }, - [1] = { - .handler = fpga_interrupt, - .flags = IRQF_SHARED, - .name = "fpga.1", - .dev_id = (void *) 0x0050UL, - }, - [2] = { - .handler = fpga_interrupt, - .flags = IRQF_SHARED, - .name = "fpga.2", - .dev_id = (void *) 0x1c00UL, - }, - [3] = { - .handler = fpga_interrupt, - .flags = IRQF_SHARED, - .name = "fpga.3", - .dev_id = (void *) 0x6386UL, - } -}; - -/* - * initialise the motherboard FPGA's PIC - */ -void __init fpga_init(void) -{ - int irq; - - /* all PIC inputs are all set to be low-level driven, apart from the - * NMI button (15) which is fixed at falling-edge - */ - __set_IMR(0x7ffe); - __clr_IFR(0x0000); - - for (irq = IRQ_BASE_FPGA + 1; irq <= IRQ_BASE_FPGA + 14; irq++) - irq_set_chip_and_handler(irq, &frv_fpga_pic, handle_level_irq); - - irq_set_chip_and_handler(IRQ_FPGA_NMI, &frv_fpga_pic, handle_edge_irq); - - /* the FPGA drives the first four external IRQ inputs on the CPU PIC */ - setup_irq(IRQ_CPU_EXTERNAL0, &fpga_irq[0]); - setup_irq(IRQ_CPU_EXTERNAL1, &fpga_irq[1]); - setup_irq(IRQ_CPU_EXTERNAL2, &fpga_irq[2]); - setup_irq(IRQ_CPU_EXTERNAL3, &fpga_irq[3]); -} diff --git a/arch/frv/kernel/irq-mb93093.c b/arch/frv/kernel/irq-mb93093.c deleted file mode 100644 index 1f3015cf80f54..0000000000000 --- a/arch/frv/kernel/irq-mb93093.c +++ /dev/null @@ -1,129 +0,0 @@ -/* irq-mb93093.c: MB93093 FPGA interrupt handling - * - * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#define __reg16(ADDR) (*(volatile unsigned short *)(__region_CS2 + (ADDR))) - -#define __get_IMR() ({ __reg16(0x0a); }) -#define __set_IMR(M) do { __reg16(0x0a) = (M); wmb(); } while(0) -#define __get_IFR() ({ __reg16(0x02); }) -#define __clr_IFR(M) do { __reg16(0x02) = ~(M); wmb(); } while(0) - -/* - * off-CPU FPGA PIC operations - */ -static void frv_fpga_mask(struct irq_data *d) -{ - uint16_t imr = __get_IMR(); - - imr |= 1 << (d->irq - IRQ_BASE_FPGA); - __set_IMR(imr); -} - -static void frv_fpga_ack(struct irq_data *d) -{ - __clr_IFR(1 << (d->irq - IRQ_BASE_FPGA)); -} - -static void frv_fpga_mask_ack(struct irq_data *d) -{ - uint16_t imr = __get_IMR(); - - imr |= 1 << (d->irq - IRQ_BASE_FPGA); - __set_IMR(imr); - - __clr_IFR(1 << (d->irq - IRQ_BASE_FPGA)); -} - -static void frv_fpga_unmask(struct irq_data *d) -{ - uint16_t imr = __get_IMR(); - - imr &= ~(1 << (d->irq - IRQ_BASE_FPGA)); - - __set_IMR(imr); -} - -static struct irq_chip frv_fpga_pic = { - .name = "mb93093", - .irq_ack = frv_fpga_ack, - .irq_mask = frv_fpga_mask, - .irq_mask_ack = frv_fpga_mask_ack, - .irq_unmask = frv_fpga_unmask, -}; - -/* - * FPGA PIC interrupt handler - */ -static irqreturn_t fpga_interrupt(int irq, void *_mask) -{ - uint16_t imr, mask = (unsigned long) _mask; - - imr = __get_IMR(); - mask = mask & ~imr & __get_IFR(); - - /* poll all the triggered IRQs */ - while (mask) { - int irq; - - asm("scan %1,gr0,%0" : "=r"(irq) : "r"(mask)); - irq = 31 - irq; - mask &= ~(1 << irq); - - generic_handle_irq(IRQ_BASE_FPGA + irq); - } - - return IRQ_HANDLED; -} - -/* - * define an interrupt action for each FPGA PIC output - * - use dev_id to indicate the FPGA PIC input to output mappings - */ -static struct irqaction fpga_irq[1] = { - [0] = { - .handler = fpga_interrupt, - .name = "fpga.0", - .dev_id = (void *) 0x0700UL, - } -}; - -/* - * initialise the motherboard FPGA's PIC - */ -void __init fpga_init(void) -{ - int irq; - - /* all PIC inputs are all set to be edge triggered */ - __set_IMR(0x0700); - __clr_IFR(0x0000); - - for (irq = IRQ_BASE_FPGA + 8; irq <= IRQ_BASE_FPGA + 10; irq++) - irq_set_chip_and_handler(irq, &frv_fpga_pic, handle_edge_irq); - - /* the FPGA drives external IRQ input #2 on the CPU PIC */ - setup_irq(IRQ_CPU_EXTERNAL2, &fpga_irq[0]); -} diff --git a/arch/frv/kernel/irq-mb93493.c b/arch/frv/kernel/irq-mb93493.c deleted file mode 100644 index 8ca5aa4ff5958..0000000000000 --- a/arch/frv/kernel/irq-mb93493.c +++ /dev/null @@ -1,147 +0,0 @@ -/* irq-mb93493.c: MB93493 companion chip interrupt handler - * - * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#define IRQ_ROUTE_ONE(X) (X##_ROUTE << (X - IRQ_BASE_MB93493)) - -#define IRQ_ROUTING \ - (IRQ_ROUTE_ONE(IRQ_MB93493_VDC) | \ - IRQ_ROUTE_ONE(IRQ_MB93493_VCC) | \ - IRQ_ROUTE_ONE(IRQ_MB93493_AUDIO_OUT) | \ - IRQ_ROUTE_ONE(IRQ_MB93493_I2C_0) | \ - IRQ_ROUTE_ONE(IRQ_MB93493_I2C_1) | \ - IRQ_ROUTE_ONE(IRQ_MB93493_USB) | \ - IRQ_ROUTE_ONE(IRQ_MB93493_LOCAL_BUS) | \ - IRQ_ROUTE_ONE(IRQ_MB93493_PCMCIA) | \ - IRQ_ROUTE_ONE(IRQ_MB93493_GPIO) | \ - IRQ_ROUTE_ONE(IRQ_MB93493_AUDIO_IN)) - -/* - * daughter board PIC operations - * - there is no way to ACK interrupts in the MB93493 chip - */ -static void frv_mb93493_mask(struct irq_data *d) -{ - uint32_t iqsr; - volatile void *piqsr; - - if (IRQ_ROUTING & (1 << (d->irq - IRQ_BASE_MB93493))) - piqsr = __addr_MB93493_IQSR(1); - else - piqsr = __addr_MB93493_IQSR(0); - - iqsr = readl(piqsr); - iqsr &= ~(1 << (d->irq - IRQ_BASE_MB93493 + 16)); - writel(iqsr, piqsr); -} - -static void frv_mb93493_ack(struct irq_data *d) -{ -} - -static void frv_mb93493_unmask(struct irq_data *d) -{ - uint32_t iqsr; - volatile void *piqsr; - - if (IRQ_ROUTING & (1 << (d->irq - IRQ_BASE_MB93493))) - piqsr = __addr_MB93493_IQSR(1); - else - piqsr = __addr_MB93493_IQSR(0); - - iqsr = readl(piqsr); - iqsr |= 1 << (d->irq - IRQ_BASE_MB93493 + 16); - writel(iqsr, piqsr); -} - -static struct irq_chip frv_mb93493_pic = { - .name = "mb93093", - .irq_ack = frv_mb93493_ack, - .irq_mask = frv_mb93493_mask, - .irq_mask_ack = frv_mb93493_mask, - .irq_unmask = frv_mb93493_unmask, -}; - -/* - * MB93493 PIC interrupt handler - */ -static irqreturn_t mb93493_interrupt(int irq, void *_piqsr) -{ - volatile void *piqsr = _piqsr; - uint32_t iqsr; - - iqsr = readl(piqsr); - iqsr = iqsr & (iqsr >> 16) & 0xffff; - - /* poll all the triggered IRQs */ - while (iqsr) { - int irq; - - asm("scan %1,gr0,%0" : "=r"(irq) : "r"(iqsr)); - irq = 31 - irq; - iqsr &= ~(1 << irq); - - generic_handle_irq(IRQ_BASE_MB93493 + irq); - } - - return IRQ_HANDLED; -} - -/* - * define an interrupt action for each MB93493 PIC output - * - use dev_id to indicate the MB93493 PIC input to output mappings - */ -static struct irqaction mb93493_irq[2] = { - [0] = { - .handler = mb93493_interrupt, - .flags = IRQF_SHARED, - .name = "mb93493.0", - .dev_id = (void *) __addr_MB93493_IQSR(0), - }, - [1] = { - .handler = mb93493_interrupt, - .flags = IRQF_SHARED, - .name = "mb93493.1", - .dev_id = (void *) __addr_MB93493_IQSR(1), - } -}; - -/* - * initialise the motherboard MB93493's PIC - */ -void __init mb93493_init(void) -{ - int irq; - - for (irq = IRQ_BASE_MB93493 + 0; irq <= IRQ_BASE_MB93493 + 10; irq++) - irq_set_chip_and_handler(irq, &frv_mb93493_pic, - handle_edge_irq); - - /* the MB93493 drives external IRQ inputs on the CPU PIC */ - setup_irq(IRQ_CPU_MB93493_0, &mb93493_irq[0]); - setup_irq(IRQ_CPU_MB93493_1, &mb93493_irq[1]); -} diff --git a/arch/frv/kernel/irq.c b/arch/frv/kernel/irq.c deleted file mode 100644 index 93513e4ccd2bd..0000000000000 --- a/arch/frv/kernel/irq.c +++ /dev/null @@ -1,159 +0,0 @@ -/* irq.c: FRV IRQ handling - * - * Copyright (C) 2003, 2004, 2006 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define set_IRR(N,A,B,C,D) __set_IRR(N, (A << 28) | (B << 24) | (C << 20) | (D << 16)) - -extern void __init fpga_init(void); -#ifdef CONFIG_FUJITSU_MB93493 -extern void __init mb93493_init(void); -#endif - -#define __reg16(ADDR) (*(volatile unsigned short *)(ADDR)) - -atomic_t irq_err_count; - -int arch_show_interrupts(struct seq_file *p, int prec) -{ - seq_printf(p, "%*s: ", prec, "ERR"); - seq_printf(p, "%10u\n", atomic_read(&irq_err_count)); - return 0; -} - -/* - * on-CPU PIC operations - */ -static void frv_cpupic_ack(struct irq_data *d) -{ - __clr_RC(d->irq); - __clr_IRL(); -} - -static void frv_cpupic_mask(struct irq_data *d) -{ - __set_MASK(d->irq); -} - -static void frv_cpupic_mask_ack(struct irq_data *d) -{ - __set_MASK(d->irq); - __clr_RC(d->irq); - __clr_IRL(); -} - -static void frv_cpupic_unmask(struct irq_data *d) -{ - __clr_MASK(d->irq); -} - -static struct irq_chip frv_cpu_pic = { - .name = "cpu", - .irq_ack = frv_cpupic_ack, - .irq_mask = frv_cpupic_mask, - .irq_mask_ack = frv_cpupic_mask_ack, - .irq_unmask = frv_cpupic_unmask, -}; - -/* - * handles all normal device IRQs - * - registers are referred to by the __frame variable (GR28) - * - IRQ distribution is complicated in this arch because of the many PICs, the - * way they work and the way they cascade - */ -asmlinkage void do_IRQ(void) -{ - irq_enter(); - generic_handle_irq(__get_IRL()); - irq_exit(); -} - -/* - * handles all NMIs when not co-opted by the debugger - * - registers are referred to by the __frame variable (GR28) - */ -asmlinkage void do_NMI(void) -{ -} - -/* - * initialise the interrupt system - */ -void __init init_IRQ(void) -{ - int level; - - for (level = 1; level <= 14; level++) - irq_set_chip_and_handler(level, &frv_cpu_pic, - handle_level_irq); - - irq_set_handler(IRQ_CPU_TIMER0, handle_edge_irq); - - /* set the trigger levels for internal interrupt sources - * - timers all falling-edge - * - ERR0 is rising-edge - * - all others are high-level - */ - __set_IITMR(0, 0x003f0000); /* DMA0-3, TIMER0-2 */ - __set_IITMR(1, 0x20000000); /* ERR0-1, UART0-1, DMA4-7 */ - - /* route internal interrupts */ - set_IRR(4, IRQ_DMA3_LEVEL, IRQ_DMA2_LEVEL, IRQ_DMA1_LEVEL, - IRQ_DMA0_LEVEL); - set_IRR(5, 0, IRQ_TIMER2_LEVEL, IRQ_TIMER1_LEVEL, IRQ_TIMER0_LEVEL); - set_IRR(6, IRQ_GDBSTUB_LEVEL, IRQ_GDBSTUB_LEVEL, - IRQ_UART1_LEVEL, IRQ_UART0_LEVEL); - set_IRR(7, IRQ_DMA7_LEVEL, IRQ_DMA6_LEVEL, IRQ_DMA5_LEVEL, - IRQ_DMA4_LEVEL); - - /* route external interrupts */ - set_IRR(2, IRQ_XIRQ7_LEVEL, IRQ_XIRQ6_LEVEL, IRQ_XIRQ5_LEVEL, - IRQ_XIRQ4_LEVEL); - set_IRR(3, IRQ_XIRQ3_LEVEL, IRQ_XIRQ2_LEVEL, IRQ_XIRQ1_LEVEL, - IRQ_XIRQ0_LEVEL); - -#if defined(CONFIG_MB93091_VDK) - __set_TM1(0x55550000); /* XIRQ7-0 all active low */ -#elif defined(CONFIG_MB93093_PDK) - __set_TM1(0x15550000); /* XIRQ7 active high, 6-0 all active low */ -#else -#error dont know external IRQ trigger levels for this setup -#endif - - fpga_init(); -#ifdef CONFIG_FUJITSU_MB93493 - mb93493_init(); -#endif -} diff --git a/arch/frv/kernel/local.h b/arch/frv/kernel/local.h deleted file mode 100644 index 76606d13b1aad..0000000000000 --- a/arch/frv/kernel/local.h +++ /dev/null @@ -1,59 +0,0 @@ -/* local.h: local definitions - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#ifndef _FRV_LOCAL_H -#define _FRV_LOCAL_H - -#include - -#ifndef __ASSEMBLY__ - -/* dma.c */ -extern unsigned long frv_dma_inprogress; - -extern void frv_dma_pause_all(void); -extern void frv_dma_resume_all(void); - -/* sleep.S */ -extern asmlinkage void frv_cpu_suspend(unsigned long); -extern asmlinkage void frv_cpu_core_sleep(void); - -/* setup.c */ -extern unsigned long __nongprelbss pdm_suspend_mode; -extern void determine_clocks(int verbose); -extern int __nongprelbss clock_p0_current; -extern int __nongprelbss clock_cm_current; -extern int __nongprelbss clock_cmode_current; - -#ifdef CONFIG_PM -extern int __nongprelbss clock_cmodes_permitted; -extern unsigned long __nongprelbss clock_bits_settable; -#define CLOCK_BIT_CM 0x0000000f -#define CLOCK_BIT_CM_H 0x00000001 /* CLKC.CM can be set to 0 */ -#define CLOCK_BIT_CM_M 0x00000002 /* CLKC.CM can be set to 1 */ -#define CLOCK_BIT_CM_L 0x00000004 /* CLKC.CM can be set to 2 */ -#define CLOCK_BIT_P0 0x00000010 /* CLKC.P0 can be changed */ -#define CLOCK_BIT_CMODE 0x00000020 /* CLKC.CMODE can be changed */ - -extern void (*__power_switch_wake_setup)(void); -extern int (*__power_switch_wake_check)(void); -extern void (*__power_switch_wake_cleanup)(void); -#endif - -/* time.c */ -extern void time_divisor_init(void); - -/* cmode.S */ -extern asmlinkage void frv_change_cmode(int); - - -#endif /* __ASSEMBLY__ */ -#endif /* _FRV_LOCAL_H */ diff --git a/arch/frv/kernel/local64.h b/arch/frv/kernel/local64.h deleted file mode 100644 index 36c93b5cc239b..0000000000000 --- a/arch/frv/kernel/local64.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/arch/frv/kernel/module.c b/arch/frv/kernel/module.c deleted file mode 100644 index 9d9835f1fe2b2..0000000000000 --- a/arch/frv/kernel/module.c +++ /dev/null @@ -1,27 +0,0 @@ -/* module.c: FRV specific module loading bits - * - * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - Derived from arch/i386/kernel/module.c, Copyright (C) 2001 Rusty Russell. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ -#include -#include -#include -#include -#include -#include - -#if 0 -#define DEBUGP printk -#else -#define DEBUGP(fmt...) -#endif - -/* TODO: At least one of apply_relocate or apply_relocate_add must be - * implemented in order to get working module support. - */ diff --git a/arch/frv/kernel/pm-mb93093.c b/arch/frv/kernel/pm-mb93093.c deleted file mode 100644 index 8358e34a3fad7..0000000000000 --- a/arch/frv/kernel/pm-mb93093.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * FR-V MB93093 Power Management Routines - * - * Copyright (c) 2004 Red Hat, Inc. - * - * Written by: msalter@redhat.com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "local.h" - -static unsigned long imask; -/* - * Setup interrupt masks, etc to enable wakeup by power switch - */ -static void mb93093_power_switch_setup(void) -{ - /* mask all but FPGA interrupt sources. */ - imask = *(volatile unsigned long *)0xfeff9820; - *(volatile unsigned long *)0xfeff9820 = ~(1 << (IRQ_XIRQ2_LEVEL + 16)) & 0xfffe0000; -} - -/* - * Cleanup interrupt masks, etc after wakeup by power switch - */ -static void mb93093_power_switch_cleanup(void) -{ - *(volatile unsigned long *)0xfeff9820 = imask; -} - -/* - * Return non-zero if wakeup irq was caused by power switch - */ -static int mb93093_power_switch_check(void) -{ - return 1; -} - -/* - * Initialize power interface - */ -static int __init mb93093_pm_init(void) -{ - __power_switch_wake_setup = mb93093_power_switch_setup; - __power_switch_wake_check = mb93093_power_switch_check; - __power_switch_wake_cleanup = mb93093_power_switch_cleanup; - return 0; -} - -__initcall(mb93093_pm_init); - diff --git a/arch/frv/kernel/pm.c b/arch/frv/kernel/pm.c deleted file mode 100644 index 051ccecbf7f1d..0000000000000 --- a/arch/frv/kernel/pm.c +++ /dev/null @@ -1,352 +0,0 @@ -/* - * FR-V Power Management Routines - * - * Copyright (c) 2004 Red Hat, Inc. - * - * Based on SA1100 version: - * Copyright (c) 2001 Cliff Brake - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "local.h" - -/* - * Debug macros - */ -#define DEBUG - -int pm_do_suspend(void) -{ - local_irq_disable(); - - __set_LEDS(0xb1); - - /* go zzz */ - frv_cpu_suspend(pdm_suspend_mode); - - __set_LEDS(0xb2); - - local_irq_enable(); - - return 0; -} - -static unsigned long __irq_mask; - -/* - * Setup interrupt masks, etc to enable wakeup by power switch - */ -static void __default_power_switch_setup(void) -{ - /* default is to mask all interrupt sources. */ - __irq_mask = *(unsigned long *)0xfeff9820; - *(unsigned long *)0xfeff9820 = 0xfffe0000; -} - -/* - * Cleanup interrupt masks, etc after wakeup by power switch - */ -static void __default_power_switch_cleanup(void) -{ - *(unsigned long *)0xfeff9820 = __irq_mask; -} - -/* - * Return non-zero if wakeup irq was caused by power switch - */ -static int __default_power_switch_check(void) -{ - return 1; -} - -void (*__power_switch_wake_setup)(void) = __default_power_switch_setup; -int (*__power_switch_wake_check)(void) = __default_power_switch_check; -void (*__power_switch_wake_cleanup)(void) = __default_power_switch_cleanup; - -int pm_do_bus_sleep(void) -{ - local_irq_disable(); - - /* - * Here is where we need some platform-dependent setup - * of the interrupt state so that appropriate wakeup - * sources are allowed and all others are masked. - */ - __power_switch_wake_setup(); - - __set_LEDS(0xa1); - - /* go zzz - * - * This is in a loop in case power switch shares an irq with other - * devices. The wake_check() tells us if we need to finish waking - * or go back to sleep. - */ - do { - frv_cpu_suspend(HSR0_PDM_BUS_SLEEP); - } while (__power_switch_wake_check && !__power_switch_wake_check()); - - __set_LEDS(0xa2); - - /* - * Here is where we need some platform-dependent restore - * of the interrupt state prior to being called. - */ - __power_switch_wake_cleanup(); - - local_irq_enable(); - - return 0; -} - -unsigned long sleep_phys_sp(void *sp) -{ - return virt_to_phys(sp); -} - -#ifdef CONFIG_SYSCTL -/* - * Use a temporary sysctl number. Horrid, but will be cleaned up in 2.6 - * when all the PM interfaces exist nicely. - */ -#define CTL_PM_SUSPEND 1 -#define CTL_PM_CMODE 2 -#define CTL_PM_P0 4 -#define CTL_PM_CM 5 - -static int user_atoi(char __user *ubuf, size_t len) -{ - char buf[16]; - unsigned long ret; - - if (len > 15) - return -EINVAL; - - if (copy_from_user(buf, ubuf, len)) - return -EFAULT; - - buf[len] = 0; - ret = simple_strtoul(buf, NULL, 0); - if (ret > INT_MAX) - return -ERANGE; - return ret; -} - -/* - * Send us to sleep. - */ -static int sysctl_pm_do_suspend(struct ctl_table *ctl, int write, - void __user *buffer, size_t *lenp, loff_t *fpos) -{ - int mode; - - if (*lenp <= 0) - return -EIO; - - mode = user_atoi(buffer, *lenp); - switch (mode) { - case 1: - return pm_do_suspend(); - - case 5: - return pm_do_bus_sleep(); - - default: - return -EINVAL; - } -} - -static int try_set_cmode(int new_cmode) -{ - if (new_cmode > 15) - return -EINVAL; - if (!(clock_cmodes_permitted & (1< 1) - return -EINVAL; - - local_irq_save(flags); - __set_PSR(flags & ~PSR_ET); - - frv_dma_pause_all(); - - clkc = __get_CLKC(); - if (new_p0) - clkc |= CLKC_P0; - else - clkc &= ~CLKC_P0; - __set_CLKC(clkc); - - determine_clocks(0); - time_divisor_init(); - -#ifdef DEBUG - determine_clocks(1); -#endif - frv_dma_resume_all(); - local_irq_restore(flags); - return 0; -} - -static int try_set_cm(int new_cm) -{ - unsigned long flags, clkc; - - if (new_cm < 0 || new_cm > 1) - return -EINVAL; - - local_irq_save(flags); - __set_PSR(flags & ~PSR_ET); - - frv_dma_pause_all(); - - clkc = __get_CLKC(); - clkc &= ~CLKC_CM; - clkc |= new_cm; - __set_CLKC(clkc); - - determine_clocks(0); - time_divisor_init(); - -#if 1 //def DEBUG - determine_clocks(1); -#endif - - frv_dma_resume_all(); - local_irq_restore(flags); - return 0; -} - -static int p0_procctl(struct ctl_table *ctl, int write, - void __user *buffer, size_t *lenp, loff_t *fpos) -{ - int new_p0; - - if (!write) - return proc_dointvec(ctl, write, buffer, lenp, fpos); - - new_p0 = user_atoi(buffer, *lenp); - - return try_set_p0(new_p0)?:*lenp; -} - -static int cm_procctl(struct ctl_table *ctl, int write, - void __user *buffer, size_t *lenp, loff_t *fpos) -{ - int new_cm; - - if (!write) - return proc_dointvec(ctl, write, buffer, lenp, fpos); - - new_cm = user_atoi(buffer, *lenp); - - return try_set_cm(new_cm)?:*lenp; -} - -static struct ctl_table pm_table[] = -{ - { - .procname = "suspend", - .data = NULL, - .maxlen = 0, - .mode = 0200, - .proc_handler = sysctl_pm_do_suspend, - }, - { - .procname = "cmode", - .data = &clock_cmode_current, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = cmode_procctl, - }, - { - .procname = "p0", - .data = &clock_p0_current, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = p0_procctl, - }, - { - .procname = "cm", - .data = &clock_cm_current, - .maxlen = sizeof(int), - .mode = 0644, - .proc_handler = cm_procctl, - }, - { } -}; - -static struct ctl_table pm_dir_table[] = -{ - { - .procname = "pm", - .mode = 0555, - .child = pm_table, - }, - { } -}; - -/* - * Initialize power interface - */ -static int __init pm_init(void) -{ - register_sysctl_table(pm_dir_table); - return 0; -} - -__initcall(pm_init); - -#endif diff --git a/arch/frv/kernel/process.c b/arch/frv/kernel/process.c deleted file mode 100644 index a957b374e3a66..0000000000000 --- a/arch/frv/kernel/process.c +++ /dev/null @@ -1,275 +0,0 @@ -/* process.c: FRV specific parts of process handling - * - * Copyright (C) 2003-5 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - Derived from arch/m68k/kernel/process.c - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include "local.h" - -asmlinkage void ret_from_fork(void); -asmlinkage void ret_from_kernel_thread(void); - -#include - -void (*pm_power_off)(void); -EXPORT_SYMBOL(pm_power_off); - -static void core_sleep_idle(void) -{ -#ifdef LED_DEBUG_SLEEP - /* Show that we're sleeping... */ - __set_LEDS(0x55aa); -#endif - frv_cpu_core_sleep(); -#ifdef LED_DEBUG_SLEEP - /* ... and that we woke up */ - __set_LEDS(0); -#endif - mb(); -} - -void arch_cpu_idle(void) -{ - if (!frv_dma_inprogress) - core_sleep_idle(); - else - local_irq_enable(); -} - -void machine_restart(char * __unused) -{ - unsigned long reset_addr; -#ifdef CONFIG_GDBSTUB - gdbstub_exit(0); -#endif - - if (PSR_IMPLE(__get_PSR()) == PSR_IMPLE_FR551) - reset_addr = 0xfefff500; - else - reset_addr = 0xfeff0500; - - /* Software reset. */ - asm volatile(" dcef @(gr0,gr0),1 ! membar !" - " sti %1,@(%0,0) !" - " nop ! nop ! nop ! nop ! nop ! " - " nop ! nop ! nop ! nop ! nop ! " - " nop ! nop ! nop ! nop ! nop ! " - " nop ! nop ! nop ! nop ! nop ! " - : : "r" (reset_addr), "r" (1) ); - - for (;;) - ; -} - -void machine_halt(void) -{ -#ifdef CONFIG_GDBSTUB - gdbstub_exit(0); -#endif - - for (;;); -} - -void machine_power_off(void) -{ -#ifdef CONFIG_GDBSTUB - gdbstub_exit(0); -#endif - - for (;;); -} - -void flush_thread(void) -{ - /* nothing */ -} - -inline unsigned long user_stack(const struct pt_regs *regs) -{ - while (regs->next_frame) - regs = regs->next_frame; - return user_mode(regs) ? regs->sp : 0; -} - -/* - * set up the kernel stack and exception frames for a new process - */ -int copy_thread(unsigned long clone_flags, - unsigned long usp, unsigned long arg, - struct task_struct *p) -{ - struct pt_regs *childregs; - - childregs = (struct pt_regs *) - (task_stack_page(p) + THREAD_SIZE - FRV_FRAME0_SIZE); - - /* set up the userspace frame (the only place that the USP is stored) */ - *childregs = *current_pt_regs(); - - p->thread.frame = childregs; - p->thread.curr = p; - p->thread.sp = (unsigned long) childregs; - p->thread.fp = 0; - p->thread.lr = 0; - p->thread.frame0 = childregs; - - if (unlikely(p->flags & PF_KTHREAD)) { - childregs->gr9 = usp; /* function */ - childregs->gr8 = arg; - p->thread.pc = (unsigned long) ret_from_kernel_thread; - save_user_regs(p->thread.user); - return 0; - } - if (usp) - childregs->sp = usp; - childregs->next_frame = NULL; - - p->thread.pc = (unsigned long) ret_from_fork; - - /* the new TLS pointer is passed in as arg #5 to sys_clone() */ - if (clone_flags & CLONE_SETTLS) - childregs->gr29 = childregs->gr12; - - save_user_regs(p->thread.user); - - return 0; -} /* end copy_thread() */ - -unsigned long get_wchan(struct task_struct *p) -{ - struct pt_regs *regs0; - unsigned long fp, pc; - unsigned long stack_limit; - int count = 0; - if (!p || p == current || p->state == TASK_RUNNING) - return 0; - - stack_limit = (unsigned long) (p + 1); - fp = p->thread.fp; - regs0 = p->thread.frame0; - - do { - if (fp < stack_limit || fp >= (unsigned long) regs0 || fp & 3) - return 0; - - pc = ((unsigned long *) fp)[2]; - - /* FIXME: This depends on the order of these functions. */ - if (!in_sched_functions(pc)) - return pc; - - fp = *(unsigned long *) fp; - } while (count++ < 16); - - return 0; -} - -int elf_check_arch(const struct elf32_hdr *hdr) -{ - unsigned long hsr0 = __get_HSR(0); - unsigned long psr = __get_PSR(); - - if (hdr->e_machine != EM_FRV) - return 0; - - switch (hdr->e_flags & EF_FRV_GPR_MASK) { - case EF_FRV_GPR64: - if ((hsr0 & HSR0_GRN) == HSR0_GRN_32) - return 0; - case EF_FRV_GPR32: - case 0: - break; - default: - return 0; - } - - switch (hdr->e_flags & EF_FRV_FPR_MASK) { - case EF_FRV_FPR64: - if ((hsr0 & HSR0_FRN) == HSR0_FRN_32) - return 0; - case EF_FRV_FPR32: - case EF_FRV_FPR_NONE: - case 0: - break; - default: - return 0; - } - - if ((hdr->e_flags & EF_FRV_MULADD) == EF_FRV_MULADD) - if (PSR_IMPLE(psr) != PSR_IMPLE_FR405 && - PSR_IMPLE(psr) != PSR_IMPLE_FR451) - return 0; - - switch (hdr->e_flags & EF_FRV_CPU_MASK) { - case EF_FRV_CPU_GENERIC: - break; - case EF_FRV_CPU_FR300: - case EF_FRV_CPU_SIMPLE: - case EF_FRV_CPU_TOMCAT: - default: - return 0; - case EF_FRV_CPU_FR400: - if (PSR_IMPLE(psr) != PSR_IMPLE_FR401 && - PSR_IMPLE(psr) != PSR_IMPLE_FR405 && - PSR_IMPLE(psr) != PSR_IMPLE_FR451 && - PSR_IMPLE(psr) != PSR_IMPLE_FR551) - return 0; - break; - case EF_FRV_CPU_FR450: - if (PSR_IMPLE(psr) != PSR_IMPLE_FR451) - return 0; - break; - case EF_FRV_CPU_FR500: - if (PSR_IMPLE(psr) != PSR_IMPLE_FR501) - return 0; - break; - case EF_FRV_CPU_FR550: - if (PSR_IMPLE(psr) != PSR_IMPLE_FR551) - return 0; - break; - } - - return 1; -} - -int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpregs) -{ - memcpy(fpregs, - ¤t->thread.user->f, - sizeof(current->thread.user->f)); - return 1; -} diff --git a/arch/frv/kernel/ptrace.c b/arch/frv/kernel/ptrace.c deleted file mode 100644 index 49768401ce0fe..0000000000000 --- a/arch/frv/kernel/ptrace.c +++ /dev/null @@ -1,377 +0,0 @@ -/* ptrace.c: FRV specific parts of process tracing - * - * Copyright (C) 2003-5 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - Derived from arch/m68k/kernel/ptrace.c - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -/* - * does not yet catch signals sent when the child dies. - * in exit.c or in signal.c. - */ - -/* - * retrieve the contents of FRV userspace general registers - */ -static int genregs_get(struct task_struct *target, - const struct user_regset *regset, - unsigned int pos, unsigned int count, - void *kbuf, void __user *ubuf) -{ - const struct user_int_regs *iregs = &target->thread.user->i; - int ret; - - ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, - iregs, 0, sizeof(*iregs)); - if (ret < 0) - return ret; - - return user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf, - sizeof(*iregs), -1); -} - -/* - * update the contents of the FRV userspace general registers - */ -static int genregs_set(struct task_struct *target, - const struct user_regset *regset, - unsigned int pos, unsigned int count, - const void *kbuf, const void __user *ubuf) -{ - struct user_int_regs *iregs = &target->thread.user->i; - unsigned int offs_gr0, offs_gr1; - int ret; - - /* not allowed to set PSR or __status */ - if (pos < offsetof(struct user_int_regs, psr) + sizeof(long) && - pos + count > offsetof(struct user_int_regs, psr)) - return -EIO; - - if (pos < offsetof(struct user_int_regs, __status) + sizeof(long) && - pos + count > offsetof(struct user_int_regs, __status)) - return -EIO; - - /* set the control regs */ - offs_gr0 = offsetof(struct user_int_regs, gr[0]); - offs_gr1 = offsetof(struct user_int_regs, gr[1]); - ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, - iregs, 0, offs_gr0); - if (ret < 0) - return ret; - - /* skip GR0/TBR */ - ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf, - offs_gr0, offs_gr1); - if (ret < 0) - return ret; - - /* set the general regs */ - ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, - &iregs->gr[1], offs_gr1, sizeof(*iregs)); - if (ret < 0) - return ret; - - return user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf, - sizeof(*iregs), -1); -} - -/* - * retrieve the contents of FRV userspace FP/Media registers - */ -static int fpmregs_get(struct task_struct *target, - const struct user_regset *regset, - unsigned int pos, unsigned int count, - void *kbuf, void __user *ubuf) -{ - const struct user_fpmedia_regs *fpregs = &target->thread.user->f; - int ret; - - ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, - fpregs, 0, sizeof(*fpregs)); - if (ret < 0) - return ret; - - return user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf, - sizeof(*fpregs), -1); -} - -/* - * update the contents of the FRV userspace FP/Media registers - */ -static int fpmregs_set(struct task_struct *target, - const struct user_regset *regset, - unsigned int pos, unsigned int count, - const void *kbuf, const void __user *ubuf) -{ - struct user_fpmedia_regs *fpregs = &target->thread.user->f; - int ret; - - ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, - fpregs, 0, sizeof(*fpregs)); - if (ret < 0) - return ret; - - return user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf, - sizeof(*fpregs), -1); -} - -/* - * determine if the FP/Media registers have actually been used - */ -static int fpmregs_active(struct task_struct *target, - const struct user_regset *regset) -{ - return tsk_used_math(target) ? regset->n : 0; -} - -/* - * Define the register sets available on the FRV under Linux - */ -enum frv_regset { - REGSET_GENERAL, - REGSET_FPMEDIA, -}; - -static const struct user_regset frv_regsets[] = { - /* - * General register format is: - * PSR, ISR, CCR, CCCR, LR, LCR, PC, (STATUS), SYSCALLNO, ORIG_G8 - * GNER0-1, IACC0, TBR, GR1-63 - */ - [REGSET_GENERAL] = { - .core_note_type = NT_PRSTATUS, - .n = ELF_NGREG, - .size = sizeof(long), - .align = sizeof(long), - .get = genregs_get, - .set = genregs_set, - }, - /* - * FPU/Media register format is: - * FR0-63, FNER0-1, MSR0-1, ACC0-7, ACCG0-8, FSR - */ - [REGSET_FPMEDIA] = { - .core_note_type = NT_PRFPREG, - .n = sizeof(struct user_fpmedia_regs) / sizeof(long), - .size = sizeof(long), - .align = sizeof(long), - .get = fpmregs_get, - .set = fpmregs_set, - .active = fpmregs_active, - }, -}; - -static const struct user_regset_view user_frv_native_view = { - .name = "frv", - .e_machine = EM_FRV, - .regsets = frv_regsets, - .n = ARRAY_SIZE(frv_regsets), -}; - -const struct user_regset_view *task_user_regset_view(struct task_struct *task) -{ - return &user_frv_native_view; -} - -/* - * Get contents of register REGNO in task TASK. - */ -static inline long get_reg(struct task_struct *task, int regno) -{ - struct user_context *user = task->thread.user; - - if (regno < 0 || regno >= PT__END) - return 0; - - return ((unsigned long *) user)[regno]; -} - -/* - * Write contents of register REGNO in task TASK. - */ -static inline int put_reg(struct task_struct *task, int regno, - unsigned long data) -{ - struct user_context *user = task->thread.user; - - if (regno < 0 || regno >= PT__END) - return -EIO; - - switch (regno) { - case PT_GR(0): - return 0; - case PT_PSR: - case PT__STATUS: - return -EIO; - default: - ((unsigned long *) user)[regno] = data; - return 0; - } -} - -/* - * Called by kernel/ptrace.c when detaching.. - * - * Control h/w single stepping - */ -void user_enable_single_step(struct task_struct *child) -{ - child->thread.frame0->__status |= REG__STATUS_STEP; -} - -void user_disable_single_step(struct task_struct *child) -{ - child->thread.frame0->__status &= ~REG__STATUS_STEP; -} - -void ptrace_disable(struct task_struct *child) -{ - user_disable_single_step(child); -} - -long arch_ptrace(struct task_struct *child, long request, - unsigned long addr, unsigned long data) -{ - unsigned long tmp; - int ret; - int regno = addr >> 2; - unsigned long __user *datap = (unsigned long __user *) data; - - switch (request) { - /* read the word at location addr in the USER area. */ - case PTRACE_PEEKUSR: { - tmp = 0; - ret = -EIO; - if (addr & 3) - break; - - ret = 0; - switch (regno) { - case 0 ... PT__END - 1: - tmp = get_reg(child, regno); - break; - - case PT__END + 0: - tmp = child->mm->end_code - child->mm->start_code; - break; - - case PT__END + 1: - tmp = child->mm->end_data - child->mm->start_data; - break; - - case PT__END + 2: - tmp = child->mm->start_stack - child->mm->start_brk; - break; - - case PT__END + 3: - tmp = child->mm->start_code; - break; - - case PT__END + 4: - tmp = child->mm->start_stack; - break; - - default: - ret = -EIO; - break; - } - - if (ret == 0) - ret = put_user(tmp, datap); - break; - } - - case PTRACE_POKEUSR: /* write the word at location addr in the USER area */ - ret = -EIO; - if (addr & 3) - break; - - switch (regno) { - case 0 ... PT__END - 1: - ret = put_reg(child, regno, data); - break; - } - break; - - case PTRACE_GETREGS: /* Get all integer regs from the child. */ - return copy_regset_to_user(child, &user_frv_native_view, - REGSET_GENERAL, - 0, sizeof(child->thread.user->i), - datap); - - case PTRACE_SETREGS: /* Set all integer regs in the child. */ - return copy_regset_from_user(child, &user_frv_native_view, - REGSET_GENERAL, - 0, sizeof(child->thread.user->i), - datap); - - case PTRACE_GETFPREGS: /* Get the child FP/Media state. */ - return copy_regset_to_user(child, &user_frv_native_view, - REGSET_FPMEDIA, - 0, sizeof(child->thread.user->f), - datap); - - case PTRACE_SETFPREGS: /* Set the child FP/Media state. */ - return copy_regset_from_user(child, &user_frv_native_view, - REGSET_FPMEDIA, - 0, sizeof(child->thread.user->f), - datap); - - default: - ret = ptrace_request(child, request, addr, data); - break; - } - return ret; -} - -/* - * handle tracing of system call entry - * - return the revised system call number or ULONG_MAX to cause ENOSYS - */ -asmlinkage unsigned long syscall_trace_entry(void) -{ - __frame->__status |= REG__STATUS_SYSC_ENTRY; - if (tracehook_report_syscall_entry(__frame)) { - /* tracing decided this syscall should not happen, so - * We'll return a bogus call number to get an ENOSYS - * error, but leave the original number in - * __frame->syscallno - */ - return ULONG_MAX; - } - - return __frame->syscallno; -} - -/* - * handle tracing of system call exit - */ -asmlinkage void syscall_trace_exit(void) -{ - __frame->__status |= REG__STATUS_SYSC_EXIT; - tracehook_report_syscall_exit(__frame, 0); -} diff --git a/arch/frv/kernel/setup.c b/arch/frv/kernel/setup.c deleted file mode 100644 index 9f4a9a607dbe6..0000000000000 --- a/arch/frv/kernel/setup.c +++ /dev/null @@ -1,1178 +0,0 @@ -/* setup.c: FRV specific setup - * - * Copyright (C) 2003-5 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - Derived from arch/m68k/kernel/setup.c - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef CONFIG_BLK_DEV_INITRD -#include -#endif - -#include "local.h" - -#ifdef CONFIG_MB93090_MB00 -static void __init mb93090_display(void); -#endif -#ifdef CONFIG_MMU -static void __init setup_linux_memory(void); -#else -static void __init setup_uclinux_memory(void); -#endif - -#ifdef CONFIG_MB93090_MB00 -static char __initdata mb93090_banner[] = "FJ/RH FR-V Linux"; -static char __initdata mb93090_version[] = UTS_RELEASE; - -int __nongprelbss mb93090_mb00_detected; -#endif - -const char __frv_unknown_system[] = "unknown"; -const char __frv_mb93091_cb10[] = "mb93091-cb10"; -const char __frv_mb93091_cb11[] = "mb93091-cb11"; -const char __frv_mb93091_cb30[] = "mb93091-cb30"; -const char __frv_mb93091_cb41[] = "mb93091-cb41"; -const char __frv_mb93091_cb60[] = "mb93091-cb60"; -const char __frv_mb93091_cb70[] = "mb93091-cb70"; -const char __frv_mb93091_cb451[] = "mb93091-cb451"; -const char __frv_mb93090_mb00[] = "mb93090-mb00"; - -const char __frv_mb93493[] = "mb93493"; - -const char __frv_mb93093[] = "mb93093"; - -static const char *__nongprelbss cpu_series; -static const char *__nongprelbss cpu_core; -static const char *__nongprelbss cpu_silicon; -static const char *__nongprelbss cpu_mmu; -static const char *__nongprelbss cpu_system; -static const char *__nongprelbss cpu_board1; -static const char *__nongprelbss cpu_board2; - -static unsigned long __nongprelbss cpu_psr_all; -static unsigned long __nongprelbss cpu_hsr0_all; - -unsigned long __nongprelbss pdm_suspend_mode; - -unsigned long __nongprelbss rom_length; -unsigned long __nongprelbss memory_start; -unsigned long __nongprelbss memory_end; - -unsigned long __nongprelbss dma_coherent_mem_start; -unsigned long __nongprelbss dma_coherent_mem_end; - -unsigned long __initdata __sdram_old_base; -unsigned long __initdata num_mappedpages; - -char __initdata command_line[COMMAND_LINE_SIZE]; -char __initdata redboot_command_line[COMMAND_LINE_SIZE]; - -#ifdef CONFIG_PM -#define __pminit -#define __pminitdata -#define __pminitconst -#else -#define __pminit __init -#define __pminitdata __initdata -#define __pminitconst __initconst -#endif - -struct clock_cmode { - uint8_t xbus, sdram, corebus, core, dsu; -}; - -#define _frac(N,D) ((N)<<4 | (D)) -#define _x0_16 _frac(1,6) -#define _x0_25 _frac(1,4) -#define _x0_33 _frac(1,3) -#define _x0_375 _frac(3,8) -#define _x0_5 _frac(1,2) -#define _x0_66 _frac(2,3) -#define _x0_75 _frac(3,4) -#define _x1 _frac(1,1) -#define _x1_5 _frac(3,2) -#define _x2 _frac(2,1) -#define _x3 _frac(3,1) -#define _x4 _frac(4,1) -#define _x4_5 _frac(9,2) -#define _x6 _frac(6,1) -#define _x8 _frac(8,1) -#define _x9 _frac(9,1) - -int __nongprelbss clock_p0_current; -int __nongprelbss clock_cm_current; -int __nongprelbss clock_cmode_current; -#ifdef CONFIG_PM -int __nongprelbss clock_cmodes_permitted; -unsigned long __nongprelbss clock_bits_settable; -#endif - -static struct clock_cmode __pminitdata undef_clock_cmode = { _x1, _x1, _x1, _x1, _x1 }; - -static struct clock_cmode __pminitdata clock_cmodes_fr401_fr403[16] = { - [4] = { _x1, _x1, _x2, _x2, _x0_25 }, - [5] = { _x1, _x2, _x4, _x4, _x0_5 }, - [8] = { _x1, _x1, _x1, _x2, _x0_25 }, - [9] = { _x1, _x2, _x2, _x4, _x0_5 }, - [11] = { _x1, _x4, _x4, _x8, _x1 }, - [12] = { _x1, _x1, _x2, _x4, _x0_5 }, - [13] = { _x1, _x2, _x4, _x8, _x1 }, -}; - -static struct clock_cmode __pminitdata clock_cmodes_fr405[16] = { - [0] = { _x1, _x1, _x1, _x1, _x0_5 }, - [1] = { _x1, _x1, _x1, _x3, _x0_25 }, - [2] = { _x1, _x1, _x2, _x6, _x0_5 }, - [3] = { _x1, _x2, _x2, _x6, _x0_5 }, - [4] = { _x1, _x1, _x2, _x2, _x0_16 }, - [8] = { _x1, _x1, _x1, _x2, _x0_16 }, - [9] = { _x1, _x2, _x2, _x4, _x0_33 }, - [12] = { _x1, _x1, _x2, _x4, _x0_33 }, - [14] = { _x1, _x3, _x3, _x9, _x0_75 }, - [15] = { _x1, _x1_5, _x1_5, _x4_5, _x0_375 }, - -#define CLOCK_CMODES_PERMITTED_FR405 0xd31f -}; - -static struct clock_cmode __pminitdata clock_cmodes_fr555[16] = { - [0] = { _x1, _x2, _x2, _x4, _x0_33 }, - [1] = { _x1, _x3, _x3, _x6, _x0_5 }, - [2] = { _x1, _x2, _x4, _x8, _x0_66 }, - [3] = { _x1, _x1_5, _x3, _x6, _x0_5 }, - [4] = { _x1, _x3, _x3, _x9, _x0_75 }, - [5] = { _x1, _x2, _x2, _x6, _x0_5 }, - [6] = { _x1, _x1_5, _x1_5, _x4_5, _x0_375 }, -}; - -static const struct clock_cmode __pminitconst *clock_cmodes; -static int __pminitdata clock_doubled; - -static struct uart_port __pminitdata __frv_uart0 = { - .uartclk = 0, - .membase = (char *) UART0_BASE, - .irq = IRQ_CPU_UART0, - .regshift = 3, - .iotype = UPIO_MEM, - .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, -}; - -static struct uart_port __pminitdata __frv_uart1 = { - .uartclk = 0, - .membase = (char *) UART1_BASE, - .irq = IRQ_CPU_UART1, - .regshift = 3, - .iotype = UPIO_MEM, - .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, -}; - -#if 0 -static void __init printk_xampr(unsigned long ampr, unsigned long amlr, char i_d, int n) -{ - unsigned long phys, virt, cxn, size; - -#ifdef CONFIG_MMU - virt = amlr & 0xffffc000; - cxn = amlr & 0x3fff; -#else - virt = ampr & 0xffffc000; - cxn = 0; -#endif - phys = ampr & xAMPRx_PPFN; - size = 1 << (((ampr & xAMPRx_SS) >> 4) + 17); - - printk("%cAMPR%d: va %08lx-%08lx [pa %08lx] %c%c%c%c [cxn:%04lx]\n", - i_d, n, - virt, virt + size - 1, - phys, - ampr & xAMPRx_S ? 'S' : '-', - ampr & xAMPRx_C ? 'C' : '-', - ampr & DAMPRx_WP ? 'W' : '-', - ampr & xAMPRx_V ? 'V' : '-', - cxn - ); -} -#endif - -/*****************************************************************************/ -/* - * dump the memory map - */ -static void __init dump_memory_map(void) -{ - -#if 0 - /* dump the protection map */ - printk_xampr(__get_IAMPR(0), __get_IAMLR(0), 'I', 0); - printk_xampr(__get_IAMPR(1), __get_IAMLR(1), 'I', 1); - printk_xampr(__get_IAMPR(2), __get_IAMLR(2), 'I', 2); - printk_xampr(__get_IAMPR(3), __get_IAMLR(3), 'I', 3); - printk_xampr(__get_IAMPR(4), __get_IAMLR(4), 'I', 4); - printk_xampr(__get_IAMPR(5), __get_IAMLR(5), 'I', 5); - printk_xampr(__get_IAMPR(6), __get_IAMLR(6), 'I', 6); - printk_xampr(__get_IAMPR(7), __get_IAMLR(7), 'I', 7); - printk_xampr(__get_IAMPR(8), __get_IAMLR(8), 'I', 8); - printk_xampr(__get_IAMPR(9), __get_IAMLR(9), 'i', 9); - printk_xampr(__get_IAMPR(10), __get_IAMLR(10), 'I', 10); - printk_xampr(__get_IAMPR(11), __get_IAMLR(11), 'I', 11); - printk_xampr(__get_IAMPR(12), __get_IAMLR(12), 'I', 12); - printk_xampr(__get_IAMPR(13), __get_IAMLR(13), 'I', 13); - printk_xampr(__get_IAMPR(14), __get_IAMLR(14), 'I', 14); - printk_xampr(__get_IAMPR(15), __get_IAMLR(15), 'I', 15); - - printk_xampr(__get_DAMPR(0), __get_DAMLR(0), 'D', 0); - printk_xampr(__get_DAMPR(1), __get_DAMLR(1), 'D', 1); - printk_xampr(__get_DAMPR(2), __get_DAMLR(2), 'D', 2); - printk_xampr(__get_DAMPR(3), __get_DAMLR(3), 'D', 3); - printk_xampr(__get_DAMPR(4), __get_DAMLR(4), 'D', 4); - printk_xampr(__get_DAMPR(5), __get_DAMLR(5), 'D', 5); - printk_xampr(__get_DAMPR(6), __get_DAMLR(6), 'D', 6); - printk_xampr(__get_DAMPR(7), __get_DAMLR(7), 'D', 7); - printk_xampr(__get_DAMPR(8), __get_DAMLR(8), 'D', 8); - printk_xampr(__get_DAMPR(9), __get_DAMLR(9), 'D', 9); - printk_xampr(__get_DAMPR(10), __get_DAMLR(10), 'D', 10); - printk_xampr(__get_DAMPR(11), __get_DAMLR(11), 'D', 11); - printk_xampr(__get_DAMPR(12), __get_DAMLR(12), 'D', 12); - printk_xampr(__get_DAMPR(13), __get_DAMLR(13), 'D', 13); - printk_xampr(__get_DAMPR(14), __get_DAMLR(14), 'D', 14); - printk_xampr(__get_DAMPR(15), __get_DAMLR(15), 'D', 15); -#endif - -#if 0 - /* dump the bus controller registers */ - printk("LGCR: %08lx\n", __get_LGCR()); - printk("Master: %08lx-%08lx CR=%08lx\n", - __get_LEMBR(), __get_LEMBR() + __get_LEMAM(), - __get_LMAICR()); - - int loop; - for (loop = 1; loop <= 7; loop++) { - unsigned long lcr = __get_LCR(loop), lsbr = __get_LSBR(loop); - printk("CS#%d: %08lx-%08lx %c%c%c%c%c%c%c%c%c\n", - loop, - lsbr, lsbr + __get_LSAM(loop), - lcr & 0x80000000 ? 'r' : '-', - lcr & 0x40000000 ? 'w' : '-', - lcr & 0x08000000 ? 'b' : '-', - lcr & 0x04000000 ? 'B' : '-', - lcr & 0x02000000 ? 'C' : '-', - lcr & 0x01000000 ? 'D' : '-', - lcr & 0x00800000 ? 'W' : '-', - lcr & 0x00400000 ? 'R' : '-', - (lcr & 0x00030000) == 0x00000000 ? '4' : - (lcr & 0x00030000) == 0x00010000 ? '2' : - (lcr & 0x00030000) == 0x00020000 ? '1' : - '-' - ); - } -#endif - -#if 0 - printk("\n"); -#endif -} /* end dump_memory_map() */ - -/*****************************************************************************/ -/* - * attempt to detect a VDK motherboard and DAV daughter board on an MB93091 system - */ -#ifdef CONFIG_MB93091_VDK -static void __init detect_mb93091(void) -{ -#ifdef CONFIG_MB93090_MB00 - /* Detect CB70 without motherboard */ - if (!(cpu_system == __frv_mb93091_cb70 && ((*(unsigned short *)0xffc00030) & 0x100))) { - cpu_board1 = __frv_mb93090_mb00; - mb93090_mb00_detected = 1; - } -#endif - -#ifdef CONFIG_FUJITSU_MB93493 - cpu_board2 = __frv_mb93493; -#endif - -} /* end detect_mb93091() */ -#endif - -/*****************************************************************************/ -/* - * determine the CPU type and set appropriate parameters - * - * Family Series CPU Core Silicon Imple Vers - * ---------------------------------------------------------- - * FR-V --+-> FR400 --+-> FR401 --+-> MB93401 02 00 [1] - * | | | - * | | +-> MB93401/A 02 01 - * | | | - * | | +-> MB93403 02 02 - * | | - * | +-> FR405 ----> MB93405 04 00 - * | - * +-> FR450 ----> FR451 ----> MB93451 05 00 - * | - * +-> FR500 ----> FR501 --+-> MB93501 01 01 [2] - * | | - * | +-> MB93501/A 01 02 - * | - * +-> FR550 --+-> FR551 ----> MB93555 03 01 - * - * [1] The MB93401 is an obsolete CPU replaced by the MB93401A - * [2] The MB93501 is an obsolete CPU replaced by the MB93501A - * - * Imple is PSR(Processor Status Register)[31:28]. - * Vers is PSR(Processor Status Register)[27:24]. - * - * A "Silicon" consists of CPU core and some on-chip peripherals. - */ -static void __init determine_cpu(void) -{ - unsigned long hsr0 = __get_HSR(0); - unsigned long psr = __get_PSR(); - - /* work out what selectable services the CPU supports */ - __set_PSR(psr | PSR_EM | PSR_EF | PSR_CM | PSR_NEM); - cpu_psr_all = __get_PSR(); - __set_PSR(psr); - - __set_HSR(0, hsr0 | HSR0_GRLE | HSR0_GRHE | HSR0_FRLE | HSR0_FRHE); - cpu_hsr0_all = __get_HSR(0); - __set_HSR(0, hsr0); - - /* derive other service specs from the CPU type */ - cpu_series = "unknown"; - cpu_core = "unknown"; - cpu_silicon = "unknown"; - cpu_mmu = "Prot"; - cpu_system = __frv_unknown_system; - clock_cmodes = NULL; - clock_doubled = 0; -#ifdef CONFIG_PM - clock_bits_settable = CLOCK_BIT_CM_H | CLOCK_BIT_CM_M | CLOCK_BIT_P0; -#endif - - switch (PSR_IMPLE(psr)) { - case PSR_IMPLE_FR401: - cpu_series = "fr400"; - cpu_core = "fr401"; - pdm_suspend_mode = HSR0_PDM_PLL_RUN; - - switch (PSR_VERSION(psr)) { - case PSR_VERSION_FR401_MB93401: - cpu_silicon = "mb93401"; - cpu_system = __frv_mb93091_cb10; - clock_cmodes = clock_cmodes_fr401_fr403; - clock_doubled = 1; - break; - case PSR_VERSION_FR401_MB93401A: - cpu_silicon = "mb93401/A"; - cpu_system = __frv_mb93091_cb11; - clock_cmodes = clock_cmodes_fr401_fr403; - break; - case PSR_VERSION_FR401_MB93403: - cpu_silicon = "mb93403"; -#ifndef CONFIG_MB93093_PDK - cpu_system = __frv_mb93091_cb30; -#else - cpu_system = __frv_mb93093; -#endif - clock_cmodes = clock_cmodes_fr401_fr403; - break; - default: - break; - } - break; - - case PSR_IMPLE_FR405: - cpu_series = "fr400"; - cpu_core = "fr405"; - pdm_suspend_mode = HSR0_PDM_PLL_STOP; - - switch (PSR_VERSION(psr)) { - case PSR_VERSION_FR405_MB93405: - cpu_silicon = "mb93405"; - cpu_system = __frv_mb93091_cb60; - clock_cmodes = clock_cmodes_fr405; -#ifdef CONFIG_PM - clock_bits_settable |= CLOCK_BIT_CMODE; - clock_cmodes_permitted = CLOCK_CMODES_PERMITTED_FR405; -#endif - - /* the FPGA on the CB70 has extra registers - * - it has 0x0046 in the VDK_ID FPGA register at 0x1a0, which is - * how we tell the difference between it and a CB60 - */ - if (*(volatile unsigned short *) 0xffc001a0 == 0x0046) - cpu_system = __frv_mb93091_cb70; - break; - default: - break; - } - break; - - case PSR_IMPLE_FR451: - cpu_series = "fr450"; - cpu_core = "fr451"; - pdm_suspend_mode = HSR0_PDM_PLL_STOP; -#ifdef CONFIG_PM - clock_bits_settable |= CLOCK_BIT_CMODE; - clock_cmodes_permitted = CLOCK_CMODES_PERMITTED_FR405; -#endif - switch (PSR_VERSION(psr)) { - case PSR_VERSION_FR451_MB93451: - cpu_silicon = "mb93451"; - cpu_mmu = "Prot, SAT, xSAT, DAT"; - cpu_system = __frv_mb93091_cb451; - clock_cmodes = clock_cmodes_fr405; - break; - default: - break; - } - break; - - case PSR_IMPLE_FR501: - cpu_series = "fr500"; - cpu_core = "fr501"; - pdm_suspend_mode = HSR0_PDM_PLL_STOP; - - switch (PSR_VERSION(psr)) { - case PSR_VERSION_FR501_MB93501: cpu_silicon = "mb93501"; break; - case PSR_VERSION_FR501_MB93501A: cpu_silicon = "mb93501/A"; break; - default: - break; - } - break; - - case PSR_IMPLE_FR551: - cpu_series = "fr550"; - cpu_core = "fr551"; - pdm_suspend_mode = HSR0_PDM_PLL_RUN; - - switch (PSR_VERSION(psr)) { - case PSR_VERSION_FR551_MB93555: - cpu_silicon = "mb93555"; - cpu_mmu = "Prot, SAT"; - cpu_system = __frv_mb93091_cb41; - clock_cmodes = clock_cmodes_fr555; - clock_doubled = 1; - break; - default: - break; - } - break; - - default: - break; - } - - printk("- Series:%s CPU:%s Silicon:%s\n", - cpu_series, cpu_core, cpu_silicon); - -#ifdef CONFIG_MB93091_VDK - detect_mb93091(); -#endif - -#if defined(CONFIG_MB93093_PDK) && defined(CONFIG_FUJITSU_MB93493) - cpu_board2 = __frv_mb93493; -#endif - -} /* end determine_cpu() */ - -/*****************************************************************************/ -/* - * calculate the bus clock speed - */ -void __pminit determine_clocks(int verbose) -{ - const struct clock_cmode *mode, *tmode; - unsigned long clkc, psr, quot; - - clkc = __get_CLKC(); - psr = __get_PSR(); - - clock_p0_current = !!(clkc & CLKC_P0); - clock_cm_current = clkc & CLKC_CM; - clock_cmode_current = (clkc & CLKC_CMODE) >> CLKC_CMODE_s; - - if (verbose) - printk("psr=%08lx hsr0=%08lx clkc=%08lx\n", psr, __get_HSR(0), clkc); - - /* the CB70 has some alternative ways of setting the clock speed through switches accessed - * through the FPGA. */ - if (cpu_system == __frv_mb93091_cb70) { - unsigned short clkswr = *(volatile unsigned short *) 0xffc00104UL & 0x1fffUL; - - if (clkswr & 0x1000) - __clkin_clock_speed_HZ = 60000000UL; - else - __clkin_clock_speed_HZ = - ((clkswr >> 8) & 0xf) * 10000000 + - ((clkswr >> 4) & 0xf) * 1000000 + - ((clkswr ) & 0xf) * 100000; - } - /* the FR451 is currently fixed at 24MHz */ - else if (cpu_system == __frv_mb93091_cb451) { - //__clkin_clock_speed_HZ = 24000000UL; // CB451-FPGA - unsigned short clkswr = *(volatile unsigned short *) 0xffc00104UL & 0x1fffUL; - - if (clkswr & 0x1000) - __clkin_clock_speed_HZ = 60000000UL; - else - __clkin_clock_speed_HZ = - ((clkswr >> 8) & 0xf) * 10000000 + - ((clkswr >> 4) & 0xf) * 1000000 + - ((clkswr ) & 0xf) * 100000; - } - /* otherwise determine the clockspeed from VDK or other registers */ - else { - __clkin_clock_speed_HZ = __get_CLKIN(); - } - - /* look up the appropriate clock relationships table entry */ - mode = &undef_clock_cmode; - if (clock_cmodes) { - tmode = &clock_cmodes[(clkc & CLKC_CMODE) >> CLKC_CMODE_s]; - if (tmode->xbus) - mode = tmode; - } - -#define CLOCK(SRC,RATIO) ((SRC) * (((RATIO) >> 4) & 0x0f) / ((RATIO) & 0x0f)) - - if (clock_doubled) - __clkin_clock_speed_HZ <<= 1; - - __ext_bus_clock_speed_HZ = CLOCK(__clkin_clock_speed_HZ, mode->xbus); - __sdram_clock_speed_HZ = CLOCK(__clkin_clock_speed_HZ, mode->sdram); - __dsu_clock_speed_HZ = CLOCK(__clkin_clock_speed_HZ, mode->dsu); - - switch (clkc & CLKC_CM) { - case 0: /* High */ - __core_bus_clock_speed_HZ = CLOCK(__clkin_clock_speed_HZ, mode->corebus); - __core_clock_speed_HZ = CLOCK(__clkin_clock_speed_HZ, mode->core); - break; - case 1: /* Medium */ - __core_bus_clock_speed_HZ = CLOCK(__clkin_clock_speed_HZ, mode->sdram); - __core_clock_speed_HZ = CLOCK(__clkin_clock_speed_HZ, mode->sdram); - break; - case 2: /* Low; not supported */ - case 3: /* UNDEF */ - printk("Unsupported CLKC CM %ld\n", clkc & CLKC_CM); - panic("Bye"); - } - - __res_bus_clock_speed_HZ = __ext_bus_clock_speed_HZ; - if (clkc & CLKC_P0) - __res_bus_clock_speed_HZ >>= 1; - - if (verbose) { - printk("CLKIN: %lu.%3.3luMHz\n", - __clkin_clock_speed_HZ / 1000000, - (__clkin_clock_speed_HZ / 1000) % 1000); - - printk("CLKS:" - " ext=%luMHz res=%luMHz sdram=%luMHz cbus=%luMHz core=%luMHz dsu=%luMHz\n", - __ext_bus_clock_speed_HZ / 1000000, - __res_bus_clock_speed_HZ / 1000000, - __sdram_clock_speed_HZ / 1000000, - __core_bus_clock_speed_HZ / 1000000, - __core_clock_speed_HZ / 1000000, - __dsu_clock_speed_HZ / 1000000 - ); - } - - /* calculate the number of __delay() loop iterations per sec (2 insn loop) */ - __delay_loops_MHz = __core_clock_speed_HZ / (1000000 * 2); - - /* set the serial prescaler */ - __serial_clock_speed_HZ = __res_bus_clock_speed_HZ; - quot = 1; - while (__serial_clock_speed_HZ / quot / 16 / 65536 > 3000) - quot += 1; - - /* double the divisor if P0 is clear, so that if/when P0 is set, it's still achievable - * - we have to be careful - dividing too much can mean we can't get 115200 baud - */ - if (__serial_clock_speed_HZ > 32000000 && !(clkc & CLKC_P0)) - quot <<= 1; - - __serial_clock_speed_HZ /= quot; - __frv_uart0.uartclk = __serial_clock_speed_HZ; - __frv_uart1.uartclk = __serial_clock_speed_HZ; - - if (verbose) - printk(" uart=%luMHz\n", __serial_clock_speed_HZ / 1000000 * quot); - - while (!(__get_UART0_LSR() & UART_LSR_TEMT)) - continue; - - while (!(__get_UART1_LSR() & UART_LSR_TEMT)) - continue; - - __set_UCPVR(quot); - __set_UCPSR(0); -} /* end determine_clocks() */ - -/*****************************************************************************/ -/* - * reserve some DMA consistent memory - */ -#ifdef CONFIG_RESERVE_DMA_COHERENT -static void __init reserve_dma_coherent(void) -{ - unsigned long ampr; - - /* find the first non-kernel memory tile and steal it */ -#define __steal_AMPR(r) \ - if (__get_DAMPR(r) & xAMPRx_V) { \ - ampr = __get_DAMPR(r); \ - __set_DAMPR(r, ampr | xAMPRx_S | xAMPRx_C); \ - __set_IAMPR(r, 0); \ - goto found; \ - } - - __steal_AMPR(1); - __steal_AMPR(2); - __steal_AMPR(3); - __steal_AMPR(4); - __steal_AMPR(5); - __steal_AMPR(6); - - if (PSR_IMPLE(__get_PSR()) == PSR_IMPLE_FR551) { - __steal_AMPR(7); - __steal_AMPR(8); - __steal_AMPR(9); - __steal_AMPR(10); - __steal_AMPR(11); - __steal_AMPR(12); - __steal_AMPR(13); - __steal_AMPR(14); - } - - /* unable to grant any DMA consistent memory */ - printk("No DMA consistent memory reserved\n"); - return; - - found: - dma_coherent_mem_start = ampr & xAMPRx_PPFN; - ampr &= xAMPRx_SS; - ampr >>= 4; - ampr = 1 << (ampr - 3 + 20); - dma_coherent_mem_end = dma_coherent_mem_start + ampr; - - printk("DMA consistent memory reserved %lx-%lx\n", - dma_coherent_mem_start, dma_coherent_mem_end); - -} /* end reserve_dma_coherent() */ -#endif - -/*****************************************************************************/ -/* - * calibrate the delay loop - */ -void calibrate_delay(void) -{ - loops_per_jiffy = __delay_loops_MHz * (1000000 / HZ); - - printk("Calibrating delay loop... %lu.%02lu BogoMIPS\n", - loops_per_jiffy / (500000 / HZ), - (loops_per_jiffy / (5000 / HZ)) % 100); - -} /* end calibrate_delay() */ - -/*****************************************************************************/ -/* - * look through the command line for some things we need to know immediately - */ -static void __init parse_cmdline_early(char *cmdline) -{ - if (!cmdline) - return; - - while (*cmdline) { - if (*cmdline == ' ') - cmdline++; - - /* "mem=XXX[kKmM]" sets SDRAM size to , overriding the value we worked - * out from the SDRAM controller mask register - */ - if (!strncmp(cmdline, "mem=", 4)) { - unsigned long long mem_size; - - mem_size = memparse(cmdline + 4, &cmdline); - memory_end = memory_start + mem_size; - } - - while (*cmdline && *cmdline != ' ') - cmdline++; - } - -} /* end parse_cmdline_early() */ - -/*****************************************************************************/ -/* - * - */ -void __init setup_arch(char **cmdline_p) -{ -#ifdef CONFIG_MMU - printk("Linux FR-V port done by Red Hat Inc \n"); -#else - printk("uClinux FR-V port done by Red Hat Inc \n"); -#endif - - memcpy(boot_command_line, redboot_command_line, COMMAND_LINE_SIZE); - - determine_cpu(); - determine_clocks(1); - - /* For printk-directly-beats-on-serial-hardware hack */ - console_set_baud(115200); -#ifdef CONFIG_GDBSTUB - gdbstub_set_baud(115200); -#endif - -#ifdef CONFIG_RESERVE_DMA_COHERENT - reserve_dma_coherent(); -#endif - dump_memory_map(); - -#ifdef CONFIG_MB93090_MB00 - if (mb93090_mb00_detected) - mb93090_display(); -#endif - - /* register those serial ports that are available */ -#ifdef CONFIG_FRV_ONCPU_SERIAL -#ifndef CONFIG_GDBSTUB_UART0 - __reg(UART0_BASE + UART_IER * 8) = 0; - early_serial_setup(&__frv_uart0); -#endif -#ifndef CONFIG_GDBSTUB_UART1 - __reg(UART1_BASE + UART_IER * 8) = 0; - early_serial_setup(&__frv_uart1); -#endif -#endif - - /* deal with the command line - RedBoot may have passed one to the kernel */ - memcpy(command_line, boot_command_line, sizeof(command_line)); - *cmdline_p = &command_line[0]; - parse_cmdline_early(command_line); - - /* set up the memory description - * - by now the stack is part of the init task */ - printk("Memory %08lx-%08lx\n", memory_start, memory_end); - - BUG_ON(memory_start == memory_end); - - init_mm.start_code = (unsigned long) _stext; - init_mm.end_code = (unsigned long) _etext; - init_mm.end_data = (unsigned long) _edata; -#if 0 /* DAVIDM - don't set brk just incase someone decides to use it */ - init_mm.brk = (unsigned long) &_end; -#else - init_mm.brk = (unsigned long) 0; -#endif - -#ifdef DEBUG - printk("KERNEL -> TEXT=0x%p-0x%p DATA=0x%p-0x%p BSS=0x%p-0x%p\n", - _stext, _etext, _sdata, _edata, __bss_start, __bss_stop); -#endif - -#ifdef CONFIG_VT -#if defined(CONFIG_VGA_CONSOLE) - conswitchp = &vga_con; -#elif defined(CONFIG_DUMMY_CONSOLE) - conswitchp = &dummy_con; -#endif -#endif - -#ifdef CONFIG_MMU - setup_linux_memory(); -#else - setup_uclinux_memory(); -#endif - - /* get kmalloc into gear */ - paging_init(); - - /* init DMA */ - frv_dma_init(); -#ifdef DEBUG - printk("Done setup_arch\n"); -#endif - - /* start the decrement timer running */ -// asm volatile("movgs %0,timerd" :: "r"(10000000)); -// __set_HSR(0, __get_HSR(0) | HSR0_ETMD); - -} /* end setup_arch() */ - -#if 0 -/*****************************************************************************/ -/* - * - */ -static int setup_arch_serial(void) -{ - /* register those serial ports that are available */ -#ifndef CONFIG_GDBSTUB_UART0 - early_serial_setup(&__frv_uart0); -#endif -#ifndef CONFIG_GDBSTUB_UART1 - early_serial_setup(&__frv_uart1); -#endif - - return 0; -} /* end setup_arch_serial() */ - -late_initcall(setup_arch_serial); -#endif - -/*****************************************************************************/ -/* - * set up the memory map for normal MMU linux - */ -#ifdef CONFIG_MMU -static void __init setup_linux_memory(void) -{ - unsigned long bootmap_size, low_top_pfn, kstart, kend, high_mem; - unsigned long physpages; - - kstart = (unsigned long) &__kernel_image_start - PAGE_OFFSET; - kend = (unsigned long) &__kernel_image_end - PAGE_OFFSET; - - kstart = kstart & PAGE_MASK; - kend = (kend + PAGE_SIZE - 1) & PAGE_MASK; - - /* give all the memory to the bootmap allocator, tell it to put the - * boot mem_map immediately following the kernel image - */ - bootmap_size = init_bootmem_node(NODE_DATA(0), - kend >> PAGE_SHIFT, /* map addr */ - memory_start >> PAGE_SHIFT, /* start of RAM */ - memory_end >> PAGE_SHIFT /* end of RAM */ - ); - - /* pass the memory that the kernel can immediately use over to the bootmem allocator */ - max_mapnr = physpages = (memory_end - memory_start) >> PAGE_SHIFT; - low_top_pfn = (KERNEL_LOWMEM_END - KERNEL_LOWMEM_START) >> PAGE_SHIFT; - high_mem = 0; - - if (physpages > low_top_pfn) { -#ifdef CONFIG_HIGHMEM - high_mem = physpages - low_top_pfn; -#else - max_mapnr = physpages = low_top_pfn; -#endif - } - else { - low_top_pfn = physpages; - } - - min_low_pfn = memory_start >> PAGE_SHIFT; - max_low_pfn = low_top_pfn; - max_pfn = memory_end >> PAGE_SHIFT; - - num_mappedpages = low_top_pfn; - - printk(KERN_NOTICE "%ldMB LOWMEM available.\n", low_top_pfn >> (20 - PAGE_SHIFT)); - - free_bootmem(memory_start, low_top_pfn << PAGE_SHIFT); - -#ifdef CONFIG_HIGHMEM - if (high_mem) - printk(KERN_NOTICE "%ldMB HIGHMEM available.\n", high_mem >> (20 - PAGE_SHIFT)); -#endif - - /* take back the memory occupied by the kernel image and the bootmem alloc map */ - reserve_bootmem(kstart, kend - kstart + bootmap_size, - BOOTMEM_DEFAULT); - - /* reserve the memory occupied by the initial ramdisk */ -#ifdef CONFIG_BLK_DEV_INITRD - if (LOADER_TYPE && INITRD_START) { - if (INITRD_START + INITRD_SIZE <= (low_top_pfn << PAGE_SHIFT)) { - reserve_bootmem(INITRD_START, INITRD_SIZE, - BOOTMEM_DEFAULT); - initrd_start = INITRD_START + PAGE_OFFSET; - initrd_end = initrd_start + INITRD_SIZE; - } - else { - printk(KERN_ERR - "initrd extends beyond end of memory (0x%08lx > 0x%08lx)\n" - "disabling initrd\n", - INITRD_START + INITRD_SIZE, - low_top_pfn << PAGE_SHIFT); - initrd_start = 0; - } - } -#endif - -} /* end setup_linux_memory() */ -#endif - -/*****************************************************************************/ -/* - * set up the memory map for uClinux - */ -#ifndef CONFIG_MMU -static void __init setup_uclinux_memory(void) -{ -#ifdef CONFIG_PROTECT_KERNEL - unsigned long dampr; -#endif - unsigned long kend; - int bootmap_size; - - kend = (unsigned long) &__kernel_image_end; - kend = (kend + PAGE_SIZE - 1) & PAGE_MASK; - - /* give all the memory to the bootmap allocator, tell it to put the - * boot mem_map immediately following the kernel image - */ - bootmap_size = init_bootmem_node(NODE_DATA(0), - kend >> PAGE_SHIFT, /* map addr */ - memory_start >> PAGE_SHIFT, /* start of RAM */ - memory_end >> PAGE_SHIFT /* end of RAM */ - ); - - /* free all the usable memory */ - free_bootmem(memory_start, memory_end - memory_start); - - high_memory = (void *) (memory_end & PAGE_MASK); - max_mapnr = ((unsigned long) high_memory - PAGE_OFFSET) >> PAGE_SHIFT; - - min_low_pfn = memory_start >> PAGE_SHIFT; - max_low_pfn = memory_end >> PAGE_SHIFT; - max_pfn = max_low_pfn; - - /* now take back the bits the core kernel is occupying */ -#ifndef CONFIG_PROTECT_KERNEL - reserve_bootmem(kend, bootmap_size, BOOTMEM_DEFAULT); - reserve_bootmem((unsigned long) &__kernel_image_start, - kend - (unsigned long) &__kernel_image_start, - BOOTMEM_DEFAULT); - -#else - dampr = __get_DAMPR(0); - dampr &= xAMPRx_SS; - dampr = (dampr >> 4) + 17; - dampr = 1 << dampr; - - reserve_bootmem(__get_DAMPR(0) & xAMPRx_PPFN, dampr, BOOTMEM_DEFAULT); -#endif - - /* reserve some memory to do uncached DMA through if requested */ -#ifdef CONFIG_RESERVE_DMA_COHERENT - if (dma_coherent_mem_start) - reserve_bootmem(dma_coherent_mem_start, - dma_coherent_mem_end - dma_coherent_mem_start, - BOOTMEM_DEFAULT); -#endif - -} /* end setup_uclinux_memory() */ -#endif - -/*****************************************************************************/ -/* - * get CPU information for use by procfs - */ -static int show_cpuinfo(struct seq_file *m, void *v) -{ - const char *gr, *fr, *fm, *fp, *cm, *nem, *ble; -#ifdef CONFIG_PM - const char *sep; -#endif - - gr = cpu_hsr0_all & HSR0_GRHE ? "gr0-63" : "gr0-31"; - fr = cpu_hsr0_all & HSR0_FRHE ? "fr0-63" : "fr0-31"; - fm = cpu_psr_all & PSR_EM ? ", Media" : ""; - fp = cpu_psr_all & PSR_EF ? ", FPU" : ""; - cm = cpu_psr_all & PSR_CM ? ", CCCR" : ""; - nem = cpu_psr_all & PSR_NEM ? ", NE" : ""; - ble = cpu_psr_all & PSR_BE ? "BE" : "LE"; - - seq_printf(m, - "CPU-Series:\t%s\n" - "CPU-Core:\t%s, %s, %s%s%s\n" - "CPU:\t\t%s\n" - "MMU:\t\t%s\n" - "FP-Media:\t%s%s%s\n" - "System:\t\t%s", - cpu_series, - cpu_core, gr, ble, cm, nem, - cpu_silicon, - cpu_mmu, - fr, fm, fp, - cpu_system); - - if (cpu_board1) - seq_printf(m, ", %s", cpu_board1); - - if (cpu_board2) - seq_printf(m, ", %s", cpu_board2); - - seq_printf(m, "\n"); - -#ifdef CONFIG_PM - seq_printf(m, "PM-Controls:"); - sep = "\t"; - - if (clock_bits_settable & CLOCK_BIT_CMODE) { - seq_printf(m, "%scmode=0x%04hx", sep, clock_cmodes_permitted); - sep = ", "; - } - - if (clock_bits_settable & CLOCK_BIT_CM) { - seq_printf(m, "%scm=0x%lx", sep, clock_bits_settable & CLOCK_BIT_CM); - sep = ", "; - } - - if (clock_bits_settable & CLOCK_BIT_P0) { - seq_printf(m, "%sp0=0x3", sep); - sep = ", "; - } - - seq_printf(m, "%ssuspend=0x22\n", sep); -#endif - - seq_printf(m, - "PM-Status:\tcmode=%d, cm=%d, p0=%d\n", - clock_cmode_current, clock_cm_current, clock_p0_current); - -#define print_clk(TAG, VAR) \ - seq_printf(m, "Clock-" TAG ":\t%lu.%2.2lu MHz\n", VAR / 1000000, (VAR / 10000) % 100) - - print_clk("In", __clkin_clock_speed_HZ); - print_clk("Core", __core_clock_speed_HZ); - print_clk("SDRAM", __sdram_clock_speed_HZ); - print_clk("CBus", __core_bus_clock_speed_HZ); - print_clk("Res", __res_bus_clock_speed_HZ); - print_clk("Ext", __ext_bus_clock_speed_HZ); - print_clk("DSU", __dsu_clock_speed_HZ); - - seq_printf(m, - "BogoMips:\t%lu.%02lu\n", - (loops_per_jiffy * HZ) / 500000, ((loops_per_jiffy * HZ) / 5000) % 100); - - return 0; -} /* end show_cpuinfo() */ - -static void *c_start(struct seq_file *m, loff_t *pos) -{ - return *pos < NR_CPUS ? (void *) 0x12345678 : 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) -{ -} - -const struct seq_operations cpuinfo_op = { - .start = c_start, - .next = c_next, - .stop = c_stop, - .show = show_cpuinfo, -}; - -void arch_gettod(int *year, int *mon, int *day, int *hour, - int *min, int *sec) -{ - *year = *mon = *day = *hour = *min = *sec = 0; -} - -/*****************************************************************************/ -/* - * - */ -#ifdef CONFIG_MB93090_MB00 -static void __init mb93090_sendlcdcmd(uint32_t cmd) -{ - unsigned long base = __addr_LCD(); - int loop; - - /* request reading of the busy flag */ - __set_LCD(base, LCD_CMD_READ_BUSY); - __set_LCD(base, LCD_CMD_READ_BUSY & ~LCD_E); - - /* wait for the busy flag to become clear */ - for (loop = 10000; loop > 0; loop--) - if (!(__get_LCD(base) & 0x80)) - break; - - /* send the command */ - __set_LCD(base, cmd); - __set_LCD(base, cmd & ~LCD_E); - -} /* end mb93090_sendlcdcmd() */ - -/*****************************************************************************/ -/* - * write to the MB93090 LEDs and LCD - */ -static void __init mb93090_display(void) -{ - const char *p; - - __set_LEDS(0); - - /* set up the LCD */ - mb93090_sendlcdcmd(LCD_CMD_CLEAR); - mb93090_sendlcdcmd(LCD_CMD_FUNCSET(1,1,0)); - mb93090_sendlcdcmd(LCD_CMD_ON(0,0)); - mb93090_sendlcdcmd(LCD_CMD_HOME); - - mb93090_sendlcdcmd(LCD_CMD_SET_DD_ADDR(0)); - for (p = mb93090_banner; *p; p++) - mb93090_sendlcdcmd(LCD_DATA_WRITE(*p)); - - mb93090_sendlcdcmd(LCD_CMD_SET_DD_ADDR(64)); - for (p = mb93090_version; *p; p++) - mb93090_sendlcdcmd(LCD_DATA_WRITE(*p)); - -} /* end mb93090_display() */ - -#endif // CONFIG_MB93090_MB00 diff --git a/arch/frv/kernel/signal.c b/arch/frv/kernel/signal.c deleted file mode 100644 index bf6e07a7a1b1c..0000000000000 --- a/arch/frv/kernel/signal.c +++ /dev/null @@ -1,426 +0,0 @@ -/* signal.c: FRV specific bits of signal handling - * - * Copyright (C) 2003-5 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - Derived from arch/m68k/kernel/signal.c - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define DEBUG_SIG 0 - -struct fdpic_func_descriptor { - unsigned long text; - unsigned long GOT; -}; - -/* - * Do a signal return; undo the signal stack. - */ - -struct sigframe -{ - __sigrestore_t pretcode; - int sig; - struct sigcontext sc; - unsigned long extramask[_NSIG_WORDS-1]; - uint32_t retcode[2]; -}; - -struct rt_sigframe -{ - __sigrestore_t pretcode; - int sig; - struct siginfo __user *pinfo; - void __user *puc; - struct siginfo info; - struct ucontext uc; - uint32_t retcode[2]; -}; - -static int restore_sigcontext(struct sigcontext __user *sc, int *_gr8) -{ - struct user_context *user = current->thread.user; - unsigned long tbr, psr; - - /* Always make any pending restarted system calls return -EINTR */ - current->restart_block.fn = do_no_restart_syscall; - - tbr = user->i.tbr; - psr = user->i.psr; - if (copy_from_user(user, &sc->sc_context, sizeof(sc->sc_context))) - goto badframe; - user->i.tbr = tbr; - user->i.psr = psr; - - restore_user_regs(user); - - user->i.syscallno = -1; /* disable syscall checks */ - - *_gr8 = user->i.gr[8]; - return 0; - - badframe: - return 1; -} - -asmlinkage int sys_sigreturn(void) -{ - struct sigframe __user *frame = (struct sigframe __user *) __frame->sp; - sigset_t set; - int gr8; - - if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) - goto badframe; - if (__get_user(set.sig[0], &frame->sc.sc_oldmask)) - goto badframe; - - if (_NSIG_WORDS > 1 && - __copy_from_user(&set.sig[1], &frame->extramask, sizeof(frame->extramask))) - goto badframe; - - set_current_blocked(&set); - - if (restore_sigcontext(&frame->sc, &gr8)) - goto badframe; - return gr8; - - badframe: - force_sig(SIGSEGV, current); - return 0; -} - -asmlinkage int sys_rt_sigreturn(void) -{ - struct rt_sigframe __user *frame = (struct rt_sigframe __user *) __frame->sp; - sigset_t set; - int gr8; - - if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) - goto badframe; - if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) - goto badframe; - - set_current_blocked(&set); - - if (restore_sigcontext(&frame->uc.uc_mcontext, &gr8)) - goto badframe; - - if (restore_altstack(&frame->uc.uc_stack)) - goto badframe; - - return gr8; - -badframe: - force_sig(SIGSEGV, current); - return 0; -} - -/* - * Set up a signal frame - */ -static int setup_sigcontext(struct sigcontext __user *sc, unsigned long mask) -{ - save_user_regs(current->thread.user); - - if (copy_to_user(&sc->sc_context, current->thread.user, sizeof(sc->sc_context)) != 0) - goto badframe; - - /* non-iBCS2 extensions.. */ - if (__put_user(mask, &sc->sc_oldmask) < 0) - goto badframe; - - return 0; - - badframe: - return 1; -} - -/*****************************************************************************/ -/* - * Determine which stack to use.. - */ -static inline void __user *get_sigframe(struct ksignal *ksig, - size_t frame_size) -{ - unsigned long sp = sigsp(__frame->sp, ksig); - - return (void __user *) ((sp - frame_size) & ~7UL); - -} /* end get_sigframe() */ - -/*****************************************************************************/ -/* - * - */ -static int setup_frame(struct ksignal *ksig, sigset_t *set) -{ - struct sigframe __user *frame; - int sig = ksig->sig; - - frame = get_sigframe(ksig, sizeof(*frame)); - - if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) - return -EFAULT; - - if (__put_user(sig, &frame->sig) < 0) - return -EFAULT; - - if (setup_sigcontext(&frame->sc, set->sig[0])) - return -EFAULT; - - if (_NSIG_WORDS > 1) { - if (__copy_to_user(frame->extramask, &set->sig[1], - sizeof(frame->extramask))) - return -EFAULT; - } - - /* Set up to return from userspace. If provided, use a stub - * already in userspace. */ - if (ksig->ka.sa.sa_flags & SA_RESTORER) { - if (__put_user(ksig->ka.sa.sa_restorer, &frame->pretcode) < 0) - return -EFAULT; - } - else { - /* Set up the following code on the stack: - * setlos #__NR_sigreturn,gr7 - * tira gr0,0 - */ - if (__put_user((__sigrestore_t)frame->retcode, &frame->pretcode) || - __put_user(0x8efc0000|__NR_sigreturn, &frame->retcode[0]) || - __put_user(0xc0700000, &frame->retcode[1])) - return -EFAULT; - - flush_icache_range((unsigned long) frame->retcode, - (unsigned long) (frame->retcode + 2)); - } - - /* Set up registers for the signal handler */ - if (current->personality & FDPIC_FUNCPTRS) { - struct fdpic_func_descriptor __user *funcptr = - (struct fdpic_func_descriptor __user *) ksig->ka.sa.sa_handler; - struct fdpic_func_descriptor desc; - if (copy_from_user(&desc, funcptr, sizeof(desc))) - return -EFAULT; - __frame->pc = desc.text; - __frame->gr15 = desc.GOT; - } else { - __frame->pc = (unsigned long) ksig->ka.sa.sa_handler; - __frame->gr15 = 0; - } - - __frame->sp = (unsigned long) frame; - __frame->lr = (unsigned long) &frame->retcode; - __frame->gr8 = sig; - -#if DEBUG_SIG - printk("SIG deliver %d (%s:%d): sp=%p pc=%lx ra=%p\n", - sig, current->comm, current->pid, frame, __frame->pc, - frame->pretcode); -#endif - - return 0; -} /* end setup_frame() */ - -/*****************************************************************************/ -/* - * - */ -static int setup_rt_frame(struct ksignal *ksig, sigset_t *set) -{ - struct rt_sigframe __user *frame; - int sig = ksig->sig; - - frame = get_sigframe(ksig, sizeof(*frame)); - - if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) - return -EFAULT; - - if (__put_user(sig, &frame->sig) || - __put_user(&frame->info, &frame->pinfo) || - __put_user(&frame->uc, &frame->puc)) - return -EFAULT; - - if (copy_siginfo_to_user(&frame->info, &ksig->info)) - return -EFAULT; - - /* Create the ucontext. */ - if (__put_user(0, &frame->uc.uc_flags) || - __put_user(NULL, &frame->uc.uc_link) || - __save_altstack(&frame->uc.uc_stack, __frame->sp)) - return -EFAULT; - - if (setup_sigcontext(&frame->uc.uc_mcontext, set->sig[0])) - return -EFAULT; - - if (__copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set))) - return -EFAULT; - - /* Set up to return from userspace. If provided, use a stub - * already in userspace. */ - if (ksig->ka.sa.sa_flags & SA_RESTORER) { - if (__put_user(ksig->ka.sa.sa_restorer, &frame->pretcode)) - return -EFAULT; - } - else { - /* Set up the following code on the stack: - * setlos #__NR_sigreturn,gr7 - * tira gr0,0 - */ - if (__put_user((__sigrestore_t)frame->retcode, &frame->pretcode) || - __put_user(0x8efc0000|__NR_rt_sigreturn, &frame->retcode[0]) || - __put_user(0xc0700000, &frame->retcode[1])) - return -EFAULT; - - flush_icache_range((unsigned long) frame->retcode, - (unsigned long) (frame->retcode + 2)); - } - - /* Set up registers for signal handler */ - if (current->personality & FDPIC_FUNCPTRS) { - struct fdpic_func_descriptor __user *funcptr = - (struct fdpic_func_descriptor __user *) ksig->ka.sa.sa_handler; - struct fdpic_func_descriptor desc; - if (copy_from_user(&desc, funcptr, sizeof(desc))) - return -EFAULT; - __frame->pc = desc.text; - __frame->gr15 = desc.GOT; - } else { - __frame->pc = (unsigned long) ksig->ka.sa.sa_handler; - __frame->gr15 = 0; - } - - __frame->sp = (unsigned long) frame; - __frame->lr = (unsigned long) &frame->retcode; - __frame->gr8 = sig; - __frame->gr9 = (unsigned long) &frame->info; - -#if DEBUG_SIG - printk("SIG deliver %d (%s:%d): sp=%p pc=%lx ra=%p\n", - sig, current->comm, current->pid, frame, __frame->pc, - frame->pretcode); -#endif - return 0; - -} /* end setup_rt_frame() */ - -/*****************************************************************************/ -/* - * OK, we're invoking a handler - */ -static void handle_signal(struct ksignal *ksig) -{ - sigset_t *oldset = sigmask_to_save(); - int ret; - - /* Are we from a system call? */ - if (__frame->syscallno != -1) { - /* If so, check system call restarting.. */ - switch (__frame->gr8) { - case -ERESTART_RESTARTBLOCK: - case -ERESTARTNOHAND: - __frame->gr8 = -EINTR; - break; - - case -ERESTARTSYS: - if (!(ksig->ka.sa.sa_flags & SA_RESTART)) { - __frame->gr8 = -EINTR; - break; - } - - /* fallthrough */ - case -ERESTARTNOINTR: - __frame->gr8 = __frame->orig_gr8; - __frame->pc -= 4; - } - __frame->syscallno = -1; - } - - /* Set up the stack frame */ - if (ksig->ka.sa.sa_flags & SA_SIGINFO) - ret = setup_rt_frame(ksig, oldset); - else - ret = setup_frame(ksig, oldset); - - signal_setup_done(ret, ksig, test_thread_flag(TIF_SINGLESTEP)); -} /* end handle_signal() */ - -/*****************************************************************************/ -/* - * 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. - */ -static void do_signal(void) -{ - struct ksignal ksig; - - if (get_signal(&ksig)) { - handle_signal(&ksig); - return; - } - - /* Did we come from a system call? */ - if (__frame->syscallno != -1) { - /* Restart the system call - no handlers present */ - switch (__frame->gr8) { - case -ERESTARTNOHAND: - case -ERESTARTSYS: - case -ERESTARTNOINTR: - __frame->gr8 = __frame->orig_gr8; - __frame->pc -= 4; - break; - - case -ERESTART_RESTARTBLOCK: - __frame->gr7 = __NR_restart_syscall; - __frame->pc -= 4; - break; - } - __frame->syscallno = -1; - } - - /* if there's no signal to deliver, we just put the saved sigmask - * back */ - restore_saved_sigmask(); -} /* end do_signal() */ - -/*****************************************************************************/ -/* - * notification of userspace execution resumption - * - triggered by the TIF_WORK_MASK flags - */ -asmlinkage void do_notify_resume(__u32 thread_info_flags) -{ - /* pending single-step? */ - if (thread_info_flags & _TIF_SINGLESTEP) - clear_thread_flag(TIF_SINGLESTEP); - - /* deal with pending signal delivery */ - if (thread_info_flags & _TIF_SIGPENDING) - do_signal(); - - /* deal with notification on about to resume userspace execution */ - if (thread_info_flags & _TIF_NOTIFY_RESUME) { - clear_thread_flag(TIF_NOTIFY_RESUME); - tracehook_notify_resume(__frame); - } - -} /* end do_notify_resume() */ diff --git a/arch/frv/kernel/sleep.S b/arch/frv/kernel/sleep.S deleted file mode 100644 index f67bf73cd2ccc..0000000000000 --- a/arch/frv/kernel/sleep.S +++ /dev/null @@ -1,373 +0,0 @@ -/* sleep.S: power saving mode entry - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Woodhouse (dwmw2@infradead.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. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define __addr_MASK 0xfeff9820 /* interrupt controller mask */ - -#define __addr_FR55X_DRCN 0xfeff0218 /* Address of DRCN register */ -#define FR55X_DSTS_OFFSET -4 /* Offset from DRCN to DSTS */ -#define FR55X_SDRAMC_DSTS_SSI 0x00000002 /* indicates that the SDRAM is in self-refresh mode */ - -#define __addr_FR4XX_DRCN 0xfe000430 /* Address of DRCN register */ -#define FR4XX_DSTS_OFFSET -8 /* Offset from DRCN to DSTS */ -#define FR4XX_SDRAMC_DSTS_SSI 0x00000001 /* indicates that the SDRAM is in self-refresh mode */ - -#define SDRAMC_DRCN_SR 0x00000001 /* transition SDRAM into self-refresh mode */ - - .section .bss - .balign 8 - .globl __sleep_save_area -__sleep_save_area: - .space 16 - - - .text - .balign 4 - -.macro li v r - sethi.p %hi(\v),\r - setlo %lo(\v),\r -.endm - -#ifdef CONFIG_PM -############################################################################### -# -# CPU suspension routine -# - void frv_cpu_suspend(unsigned long pdm_mode) -# -############################################################################### - .globl frv_cpu_suspend - .type frv_cpu_suspend,@function -frv_cpu_suspend: - - #---------------------------------------------------- - # save hsr0, psr, isr, and lr for resume code - #---------------------------------------------------- - li __sleep_save_area,gr11 - - movsg hsr0,gr4 - movsg psr,gr5 - movsg isr,gr6 - movsg lr,gr7 - stdi gr4,@(gr11,#0) - stdi gr6,@(gr11,#8) - - # store the return address from sleep in GR14, and its complement in GR13 as a check - li __ramboot_resume,gr14 -#ifdef CONFIG_MMU - # Resume via RAMBOOT# will turn MMU off, so bootloader needs a physical address. - sethi.p %hi(__page_offset),gr13 - setlo %lo(__page_offset),gr13 - sub gr14,gr13,gr14 -#endif - not gr14,gr13 - - #---------------------------------------------------- - # preload and lock into icache that code which may have to run - # when dram is in self-refresh state. - #---------------------------------------------------- - movsg hsr0, gr3 - li HSR0_ICE,gr4 - or gr3,gr4,gr3 - movgs gr3,hsr0 - or gr3,gr8,gr7 // add the sleep bits for later - - li #__icache_lock_start,gr3 - li #__icache_lock_end,gr4 -1: icpl gr3,gr0,#1 - addi gr3,#L1_CACHE_BYTES,gr3 - cmp gr4,gr3,icc0 - bhi icc0,#0,1b - - # disable exceptions - movsg psr,gr8 - andi.p gr8,#~PSR_PIL,gr8 - andi gr8,~PSR_ET,gr8 - movgs gr8,psr - ori gr8,#PSR_ET,gr8 - - srli gr8,#28,gr4 - subicc gr4,#3,gr0,icc0 - beq icc0,#0,1f - # FR4xx - li __addr_FR4XX_DRCN,gr4 - li FR4XX_SDRAMC_DSTS_SSI,gr5 - li FR4XX_DSTS_OFFSET,gr6 - bra __icache_lock_start -1: - # FR5xx - li __addr_FR55X_DRCN,gr4 - li FR55X_SDRAMC_DSTS_SSI,gr5 - li FR55X_DSTS_OFFSET,gr6 - bra __icache_lock_start - - .size frv_cpu_suspend, .-frv_cpu_suspend - -# -# the final part of the sleep sequence... -# - we want it to be be cacheline aligned so we can lock it into the icache easily -# On entry: gr7 holds desired hsr0 sleep value -# gr8 holds desired psr sleep value -# - .balign L1_CACHE_BYTES - .type __icache_lock_start,@function -__icache_lock_start: - - #---------------------------------------------------- - # put SDRAM in self-refresh mode - #---------------------------------------------------- - - # Flush all data in the cache using the DCEF instruction. - dcef @(gr0,gr0),#1 - - # Stop DMAC transfer - - # Execute dummy load from SDRAM - ldi @(gr11,#0),gr11 - - # put the SDRAM into self-refresh mode - ld @(gr4,gr0),gr11 - ori gr11,#SDRAMC_DRCN_SR,gr11 - st gr11,@(gr4,gr0) - membar - - # wait for SDRAM to reach self-refresh mode -1: ld @(gr4,gr6),gr11 - andcc gr11,gr5,gr11,icc0 - beq icc0,#0,1b - - # Set the GPIO register so that the IRQ[3:0] pins become valid, as required. - # Set the clock mode (CLKC register) as required. - # - At this time, also set the CLKC register P0 bit. - - # Set the HSR0 register PDM field. - movgs gr7,hsr0 - - # Execute NOP 32 times. - .rept 32 - nop - .endr - -#if 0 // Fujitsu recommend to skip this and will update docs. - # Release the interrupt mask setting of the MASK register of the - # interrupt controller if necessary. - sti gr10,@(gr9,#0) - membar -#endif - - # Set the PSR register ET bit to 1 to enable interrupts. - movgs gr8,psr - - ################################################### - # this is only reached if waking up via interrupt - ################################################### - - # Execute NOP 32 times. - .rept 32 - nop - .endr - - #---------------------------------------------------- - # wake SDRAM from self-refresh mode - #---------------------------------------------------- - ld @(gr4,gr0),gr11 - andi gr11,#~SDRAMC_DRCN_SR,gr11 - st gr11,@(gr4,gr0) - membar -2: - ld @(gr4,gr6),gr11 // Wait for it to come back... - andcc gr11,gr5,gr0,icc0 - bne icc0,0,2b - - # wait for the SDRAM to stabilise - li 0x0100000,gr3 -3: subicc gr3,#1,gr3,icc0 - bne icc0,#0,3b - - # now that DRAM is back, this is the end of the code which gets - # locked in icache. -__icache_lock_end: - .size __icache_lock_start, .-__icache_lock_start - - # Fall-through to the RAMBOOT# wakeup path - -############################################################################### -# -# resume from suspend re-entry point reached via RAMBOOT# and bootloader -# -############################################################################### -__ramboot_resume: - - #---------------------------------------------------- - # restore hsr0, psr, isr, and leave saved lr in gr7 - #---------------------------------------------------- - li __sleep_save_area,gr11 -#ifdef CONFIG_MMU - movsg hsr0,gr4 - sethi.p %hi(HSR0_EXMMU),gr3 - setlo %lo(HSR0_EXMMU),gr3 - andcc gr3,gr4,gr0,icc0 - bne icc0,#0,2f - - # need to use physical address - sethi.p %hi(__page_offset),gr3 - setlo %lo(__page_offset),gr3 - sub gr11,gr3,gr11 - - # flush all tlb entries - setlos #64,gr4 - setlos.p #PAGE_SIZE,gr5 - setlos #0,gr6 -1: - tlbpr gr6,gr0,#6,#0 - subicc.p gr4,#1,gr4,icc0 - add gr6,gr5,gr6 - bne icc0,#2,1b - - # need a temporary mapping for the current physical address we are - # using between time MMU is enabled and jump to virtual address is - # made. - sethi.p %hi(0x00000000),gr4 - setlo %lo(0x00000000),gr4 ; physical address - setlos #xAMPRx_L|xAMPRx_M|xAMPRx_SS_256Mb|xAMPRx_S_KERNEL|xAMPRx_V,gr5 - or gr4,gr5,gr5 - - movsg cxnr,gr13 - or gr4,gr13,gr4 - - movgs gr4,iamlr1 ; mapped from real address 0 - movgs gr5,iampr1 ; cached kernel memory at 0x00000000 -2: -#endif - - lddi @(gr11,#0),gr4 ; hsr0, psr - lddi @(gr11,#8),gr6 ; isr, lr - movgs gr4,hsr0 - bar - -#ifdef CONFIG_MMU - sethi.p %hi(1f),gr11 - setlo %lo(1f),gr11 - jmpl @(gr11,gr0) -1: - movgs gr0,iampr1 ; get rid of temporary mapping -#endif - movgs gr5,psr - movgs gr6,isr - - #---------------------------------------------------- - # unlock the icache which was locked before going to sleep - #---------------------------------------------------- - li __icache_lock_start,gr3 - li __icache_lock_end,gr4 -1: icul gr3 - addi gr3,#L1_CACHE_BYTES,gr3 - cmp gr4,gr3,icc0 - bhi icc0,#0,1b - - #---------------------------------------------------- - # back to business as usual - #---------------------------------------------------- - jmpl @(gr7,gr0) ; - -#endif /* CONFIG_PM */ - -############################################################################### -# -# CPU core sleep mode routine -# -############################################################################### - .globl frv_cpu_core_sleep - .type frv_cpu_core_sleep,@function -frv_cpu_core_sleep: - - # Preload into icache. - li #__core_sleep_icache_lock_start,gr3 - li #__core_sleep_icache_lock_end,gr4 - -1: icpl gr3,gr0,#1 - addi gr3,#L1_CACHE_BYTES,gr3 - cmp gr4,gr3,icc0 - bhi icc0,#0,1b - - bra __core_sleep_icache_lock_start - - .balign L1_CACHE_BYTES -__core_sleep_icache_lock_start: - - # (1) Set the PSR register ET bit to 0 to disable interrupts. - movsg psr,gr8 - andi.p gr8,#~(PSR_PIL),gr8 - andi gr8,#~(PSR_ET),gr4 - movgs gr4,psr - -#if 0 // Fujitsu recommend to skip this and will update docs. - # (2) Set '1' to all bits in the MASK register of the interrupt - # controller and mask interrupts. - sethi.p %hi(__addr_MASK),gr9 - setlo %lo(__addr_MASK),gr9 - sethi.p %hi(0xffff0000),gr4 - setlo %lo(0xffff0000),gr4 - ldi @(gr9,#0),gr10 - sti gr4,@(gr9,#0) -#endif - # (3) Flush all data in the cache using the DCEF instruction. - dcef @(gr0,gr0),#1 - - # (4) Execute the memory barrier instruction - membar - - # (5) Set the GPIO register so that the IRQ[3:0] pins become valid, as required. - # (6) Set the clock mode (CLKC register) as required. - # - At this time, also set the CLKC register P0 bit. - # (7) Set the HSR0 register PDM field to 001 . - movsg hsr0,gr4 - ori gr4,HSR0_PDM_CORE_SLEEP,gr4 - movgs gr4,hsr0 - - # (8) Execute NOP 32 times. - .rept 32 - nop - .endr - -#if 0 // Fujitsu recommend to skip this and will update docs. - # (9) Release the interrupt mask setting of the MASK register of the - # interrupt controller if necessary. - sti gr10,@(gr9,#0) - membar -#endif - - # (10) Set the PSR register ET bit to 1 to enable interrupts. - movgs gr8,psr - -__core_sleep_icache_lock_end: - - # Unlock from icache - li __core_sleep_icache_lock_start,gr3 - li __core_sleep_icache_lock_end,gr4 -1: icul gr3 - addi gr3,#L1_CACHE_BYTES,gr3 - cmp gr4,gr3,icc0 - bhi icc0,#0,1b - - bralr - - .size frv_cpu_core_sleep, .-frv_cpu_core_sleep diff --git a/arch/frv/kernel/switch_to.S b/arch/frv/kernel/switch_to.S deleted file mode 100644 index b06668670fcc5..0000000000000 --- a/arch/frv/kernel/switch_to.S +++ /dev/null @@ -1,489 +0,0 @@ -############################################################################### -# -# switch_to.S: context switch operation -# -# Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. -# Written by David Howells (dhowells@redhat.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. -# -############################################################################### - -#include -#include -#include -#include -#include - -.macro LEDS val - setlos #~\val,gr27 - st gr27,@(gr30,gr0) - membar - dcf @(gr30,gr0) -.endm - - .section .sdata - .balign 8 - - # address of frame 0 (userspace) on current kernel stack - .globl __kernel_frame0_ptr -__kernel_frame0_ptr: - .long init_thread_union + THREAD_SIZE - FRV_FRAME0_SIZE - - # address of current task - .globl __kernel_current_task -__kernel_current_task: - .long init_task - - .section .text - .balign 4 - -############################################################################### -# -# struct task_struct *__switch_to(struct thread_struct *prev_thread, -# struct thread_struct *next_thread, -# struct task_struct *prev) -# -############################################################################### - .globl __switch_to -__switch_to: - # save outgoing process's context - sethi.p %hi(__switch_back),gr13 - setlo %lo(__switch_back),gr13 - movsg lr,gr12 - - stdi gr28,@(gr8,#__THREAD_FRAME) - sti sp ,@(gr8,#__THREAD_SP) - sti fp ,@(gr8,#__THREAD_FP) - stdi gr12,@(gr8,#__THREAD_LR) - stdi gr16,@(gr8,#__THREAD_GR(16)) - stdi gr18,@(gr8,#__THREAD_GR(18)) - stdi gr20,@(gr8,#__THREAD_GR(20)) - stdi gr22,@(gr8,#__THREAD_GR(22)) - stdi gr24,@(gr8,#__THREAD_GR(24)) - stdi.p gr26,@(gr8,#__THREAD_GR(26)) - - or gr8,gr8,gr22 - ldi.p @(gr8,#__THREAD_USER),gr8 - call save_user_regs - or gr22,gr22,gr8 - - # retrieve the new context - sethi.p %hi(__kernel_frame0_ptr),gr6 - setlo %lo(__kernel_frame0_ptr),gr6 - movsg psr,gr4 - - lddi.p @(gr9,#__THREAD_FRAME),gr10 - or gr10,gr10,gr27 ; save prev for the return value - - ldi @(gr11,#4),gr19 ; get new_current->thread_info - - lddi @(gr9,#__THREAD_SP),gr12 - ldi @(gr9,#__THREAD_LR),gr14 - ldi @(gr9,#__THREAD_PC),gr18 - ldi.p @(gr9,#__THREAD_FRAME0),gr7 - - # actually switch kernel contexts with ordinary exceptions disabled - andi gr4,#~PSR_ET,gr5 - movgs gr5,psr - - or.p gr10,gr0,gr28 ; set __frame - or gr11,gr0,gr29 ; set __current - or.p gr12,gr0,sp - or gr13,gr0,fp - or gr19,gr0,gr15 ; set __current_thread_info - - sti gr7,@(gr6,#0) ; set __kernel_frame0_ptr - sti gr29,@(gr6,#4) ; set __kernel_current_task - - movgs gr14,lr - bar - - # jump to __switch_back or ret_from_fork as appropriate - # - move prev to GR8 - movgs gr4,psr - jmpl.p @(gr18,gr0) - or gr27,gr27,gr8 - -############################################################################### -# -# restore incoming process's context -# - on entry: -# - SP, FP, LR, GR15, GR28 and GR29 will have been set up appropriately -# - GR8 will point to the outgoing task_struct -# - GR9 will point to the incoming thread_struct -# -############################################################################### -__switch_back: - lddi @(gr9,#__THREAD_GR(16)),gr16 - lddi @(gr9,#__THREAD_GR(18)),gr18 - lddi @(gr9,#__THREAD_GR(20)),gr20 - lddi @(gr9,#__THREAD_GR(22)),gr22 - lddi @(gr9,#__THREAD_GR(24)),gr24 - lddi @(gr9,#__THREAD_GR(26)),gr26 - - # fall through into restore_user_regs() - ldi.p @(gr9,#__THREAD_USER),gr8 - or gr8,gr8,gr9 - -############################################################################### -# -# restore extra general regs and FP/Media regs -# - void *restore_user_regs(const struct user_context *target, void *retval) -# - on entry: -# - GR8 will point to the user context to swap in -# - GR9 will contain the value to be returned in GR8 (prev task on context switch) -# -############################################################################### - .globl restore_user_regs -restore_user_regs: - movsg hsr0,gr6 - ori gr6,#HSR0_GRHE|HSR0_FRLE|HSR0_FRHE,gr6 - movgs gr6,hsr0 - movsg hsr0,gr6 - - movsg psr,gr7 - ori gr7,#PSR_EF|PSR_EM,gr7 - movgs gr7,psr - movsg psr,gr7 - srli gr7,#24,gr7 - bar - - lddi @(gr8,#__FPMEDIA_MSR(0)),gr4 - - movgs gr4,msr0 - movgs gr5,msr1 - - lddfi @(gr8,#__FPMEDIA_ACC(0)),fr16 - lddfi @(gr8,#__FPMEDIA_ACC(2)),fr18 - ldbfi @(gr8,#__FPMEDIA_ACCG(0)),fr20 - ldbfi @(gr8,#__FPMEDIA_ACCG(1)),fr21 - ldbfi @(gr8,#__FPMEDIA_ACCG(2)),fr22 - ldbfi @(gr8,#__FPMEDIA_ACCG(3)),fr23 - - mwtacc fr16,acc0 - mwtacc fr17,acc1 - mwtacc fr18,acc2 - mwtacc fr19,acc3 - mwtaccg fr20,accg0 - mwtaccg fr21,accg1 - mwtaccg fr22,accg2 - mwtaccg fr23,accg3 - - # some CPUs have extra ACCx and ACCGx regs and maybe FSRx regs - subicc.p gr7,#0x50,gr0,icc0 - subicc gr7,#0x31,gr0,icc1 - beq icc0,#0,__restore_acc_fr451 - beq icc1,#0,__restore_acc_fr555 -__restore_acc_cont: - - # some CPU's have GR32-GR63 - setlos #HSR0_FRHE,gr4 - andcc gr6,gr4,gr0,icc0 - beq icc0,#1,__restore_skip_gr32_gr63 - - lddi @(gr8,#__INT_GR(32)),gr32 - lddi @(gr8,#__INT_GR(34)),gr34 - lddi @(gr8,#__INT_GR(36)),gr36 - lddi @(gr8,#__INT_GR(38)),gr38 - lddi @(gr8,#__INT_GR(40)),gr40 - lddi @(gr8,#__INT_GR(42)),gr42 - lddi @(gr8,#__INT_GR(44)),gr44 - lddi @(gr8,#__INT_GR(46)),gr46 - lddi @(gr8,#__INT_GR(48)),gr48 - lddi @(gr8,#__INT_GR(50)),gr50 - lddi @(gr8,#__INT_GR(52)),gr52 - lddi @(gr8,#__INT_GR(54)),gr54 - lddi @(gr8,#__INT_GR(56)),gr56 - lddi @(gr8,#__INT_GR(58)),gr58 - lddi @(gr8,#__INT_GR(60)),gr60 - lddi @(gr8,#__INT_GR(62)),gr62 -__restore_skip_gr32_gr63: - - # all CPU's have FR0-FR31 - lddfi @(gr8,#__FPMEDIA_FR( 0)),fr0 - lddfi @(gr8,#__FPMEDIA_FR( 2)),fr2 - lddfi @(gr8,#__FPMEDIA_FR( 4)),fr4 - lddfi @(gr8,#__FPMEDIA_FR( 6)),fr6 - lddfi @(gr8,#__FPMEDIA_FR( 8)),fr8 - lddfi @(gr8,#__FPMEDIA_FR(10)),fr10 - lddfi @(gr8,#__FPMEDIA_FR(12)),fr12 - lddfi @(gr8,#__FPMEDIA_FR(14)),fr14 - lddfi @(gr8,#__FPMEDIA_FR(16)),fr16 - lddfi @(gr8,#__FPMEDIA_FR(18)),fr18 - lddfi @(gr8,#__FPMEDIA_FR(20)),fr20 - lddfi @(gr8,#__FPMEDIA_FR(22)),fr22 - lddfi @(gr8,#__FPMEDIA_FR(24)),fr24 - lddfi @(gr8,#__FPMEDIA_FR(26)),fr26 - lddfi @(gr8,#__FPMEDIA_FR(28)),fr28 - lddfi.p @(gr8,#__FPMEDIA_FR(30)),fr30 - - # some CPU's have FR32-FR63 - setlos #HSR0_FRHE,gr4 - andcc gr6,gr4,gr0,icc0 - beq icc0,#1,__restore_skip_fr32_fr63 - - lddfi @(gr8,#__FPMEDIA_FR(32)),fr32 - lddfi @(gr8,#__FPMEDIA_FR(34)),fr34 - lddfi @(gr8,#__FPMEDIA_FR(36)),fr36 - lddfi @(gr8,#__FPMEDIA_FR(38)),fr38 - lddfi @(gr8,#__FPMEDIA_FR(40)),fr40 - lddfi @(gr8,#__FPMEDIA_FR(42)),fr42 - lddfi @(gr8,#__FPMEDIA_FR(44)),fr44 - lddfi @(gr8,#__FPMEDIA_FR(46)),fr46 - lddfi @(gr8,#__FPMEDIA_FR(48)),fr48 - lddfi @(gr8,#__FPMEDIA_FR(50)),fr50 - lddfi @(gr8,#__FPMEDIA_FR(52)),fr52 - lddfi @(gr8,#__FPMEDIA_FR(54)),fr54 - lddfi @(gr8,#__FPMEDIA_FR(56)),fr56 - lddfi @(gr8,#__FPMEDIA_FR(58)),fr58 - lddfi @(gr8,#__FPMEDIA_FR(60)),fr60 - lddfi @(gr8,#__FPMEDIA_FR(62)),fr62 -__restore_skip_fr32_fr63: - - lddi @(gr8,#__FPMEDIA_FNER(0)),gr4 - movsg fner0,gr4 - movsg fner1,gr5 - or.p gr9,gr9,gr8 - bralr - - # the FR451 also has ACC8-11/ACCG8-11 regs (but not 4-7...) -__restore_acc_fr451: - lddfi @(gr8,#__FPMEDIA_ACC(4)),fr16 - lddfi @(gr8,#__FPMEDIA_ACC(6)),fr18 - ldbfi @(gr8,#__FPMEDIA_ACCG(4)),fr20 - ldbfi @(gr8,#__FPMEDIA_ACCG(5)),fr21 - ldbfi @(gr8,#__FPMEDIA_ACCG(6)),fr22 - ldbfi @(gr8,#__FPMEDIA_ACCG(7)),fr23 - - mwtacc fr16,acc8 - mwtacc fr17,acc9 - mwtacc fr18,acc10 - mwtacc fr19,acc11 - mwtaccg fr20,accg8 - mwtaccg fr21,accg9 - mwtaccg fr22,accg10 - mwtaccg fr23,accg11 - bra __restore_acc_cont - - # the FR555 also has ACC4-7/ACCG4-7 regs and an FSR0 reg -__restore_acc_fr555: - lddfi @(gr8,#__FPMEDIA_ACC(4)),fr16 - lddfi @(gr8,#__FPMEDIA_ACC(6)),fr18 - ldbfi @(gr8,#__FPMEDIA_ACCG(4)),fr20 - ldbfi @(gr8,#__FPMEDIA_ACCG(5)),fr21 - ldbfi @(gr8,#__FPMEDIA_ACCG(6)),fr22 - ldbfi @(gr8,#__FPMEDIA_ACCG(7)),fr23 - - mnop.p - mwtacc fr16,acc4 - mnop.p - mwtacc fr17,acc5 - mnop.p - mwtacc fr18,acc6 - mnop.p - mwtacc fr19,acc7 - mnop.p - mwtaccg fr20,accg4 - mnop.p - mwtaccg fr21,accg5 - mnop.p - mwtaccg fr22,accg6 - mnop.p - mwtaccg fr23,accg7 - - ldi @(gr8,#__FPMEDIA_FSR(0)),gr4 - movgs gr4,fsr0 - - bra __restore_acc_cont - - -############################################################################### -# -# save extra general regs and FP/Media regs -# - void save_user_regs(struct user_context *target) -# -############################################################################### - .globl save_user_regs -save_user_regs: - movsg hsr0,gr6 - ori gr6,#HSR0_GRHE|HSR0_FRLE|HSR0_FRHE,gr6 - movgs gr6,hsr0 - movsg hsr0,gr6 - - movsg psr,gr7 - ori gr7,#PSR_EF|PSR_EM,gr7 - movgs gr7,psr - movsg psr,gr7 - srli gr7,#24,gr7 - bar - - movsg fner0,gr4 - movsg fner1,gr5 - stdi.p gr4,@(gr8,#__FPMEDIA_FNER(0)) - - # some CPU's have GR32-GR63 - setlos #HSR0_GRHE,gr4 - andcc gr6,gr4,gr0,icc0 - beq icc0,#1,__save_skip_gr32_gr63 - - stdi gr32,@(gr8,#__INT_GR(32)) - stdi gr34,@(gr8,#__INT_GR(34)) - stdi gr36,@(gr8,#__INT_GR(36)) - stdi gr38,@(gr8,#__INT_GR(38)) - stdi gr40,@(gr8,#__INT_GR(40)) - stdi gr42,@(gr8,#__INT_GR(42)) - stdi gr44,@(gr8,#__INT_GR(44)) - stdi gr46,@(gr8,#__INT_GR(46)) - stdi gr48,@(gr8,#__INT_GR(48)) - stdi gr50,@(gr8,#__INT_GR(50)) - stdi gr52,@(gr8,#__INT_GR(52)) - stdi gr54,@(gr8,#__INT_GR(54)) - stdi gr56,@(gr8,#__INT_GR(56)) - stdi gr58,@(gr8,#__INT_GR(58)) - stdi gr60,@(gr8,#__INT_GR(60)) - stdi gr62,@(gr8,#__INT_GR(62)) -__save_skip_gr32_gr63: - - # all CPU's have FR0-FR31 - stdfi fr0 ,@(gr8,#__FPMEDIA_FR( 0)) - stdfi fr2 ,@(gr8,#__FPMEDIA_FR( 2)) - stdfi fr4 ,@(gr8,#__FPMEDIA_FR( 4)) - stdfi fr6 ,@(gr8,#__FPMEDIA_FR( 6)) - stdfi fr8 ,@(gr8,#__FPMEDIA_FR( 8)) - stdfi fr10,@(gr8,#__FPMEDIA_FR(10)) - stdfi fr12,@(gr8,#__FPMEDIA_FR(12)) - stdfi fr14,@(gr8,#__FPMEDIA_FR(14)) - stdfi fr16,@(gr8,#__FPMEDIA_FR(16)) - stdfi fr18,@(gr8,#__FPMEDIA_FR(18)) - stdfi fr20,@(gr8,#__FPMEDIA_FR(20)) - stdfi fr22,@(gr8,#__FPMEDIA_FR(22)) - stdfi fr24,@(gr8,#__FPMEDIA_FR(24)) - stdfi fr26,@(gr8,#__FPMEDIA_FR(26)) - stdfi fr28,@(gr8,#__FPMEDIA_FR(28)) - stdfi.p fr30,@(gr8,#__FPMEDIA_FR(30)) - - # some CPU's have FR32-FR63 - setlos #HSR0_FRHE,gr4 - andcc gr6,gr4,gr0,icc0 - beq icc0,#1,__save_skip_fr32_fr63 - - stdfi fr32,@(gr8,#__FPMEDIA_FR(32)) - stdfi fr34,@(gr8,#__FPMEDIA_FR(34)) - stdfi fr36,@(gr8,#__FPMEDIA_FR(36)) - stdfi fr38,@(gr8,#__FPMEDIA_FR(38)) - stdfi fr40,@(gr8,#__FPMEDIA_FR(40)) - stdfi fr42,@(gr8,#__FPMEDIA_FR(42)) - stdfi fr44,@(gr8,#__FPMEDIA_FR(44)) - stdfi fr46,@(gr8,#__FPMEDIA_FR(46)) - stdfi fr48,@(gr8,#__FPMEDIA_FR(48)) - stdfi fr50,@(gr8,#__FPMEDIA_FR(50)) - stdfi fr52,@(gr8,#__FPMEDIA_FR(52)) - stdfi fr54,@(gr8,#__FPMEDIA_FR(54)) - stdfi fr56,@(gr8,#__FPMEDIA_FR(56)) - stdfi fr58,@(gr8,#__FPMEDIA_FR(58)) - stdfi fr60,@(gr8,#__FPMEDIA_FR(60)) - stdfi fr62,@(gr8,#__FPMEDIA_FR(62)) -__save_skip_fr32_fr63: - - mrdacc acc0 ,fr4 - mrdacc acc1 ,fr5 - - stdfi.p fr4 ,@(gr8,#__FPMEDIA_ACC(0)) - - mrdacc acc2 ,fr6 - mrdacc acc3 ,fr7 - - stdfi.p fr6 ,@(gr8,#__FPMEDIA_ACC(2)) - - mrdaccg accg0,fr4 - stbfi.p fr4 ,@(gr8,#__FPMEDIA_ACCG(0)) - - mrdaccg accg1,fr5 - stbfi.p fr5 ,@(gr8,#__FPMEDIA_ACCG(1)) - - mrdaccg accg2,fr6 - stbfi.p fr6 ,@(gr8,#__FPMEDIA_ACCG(2)) - - mrdaccg accg3,fr7 - stbfi fr7 ,@(gr8,#__FPMEDIA_ACCG(3)) - - movsg msr0 ,gr4 - movsg msr1 ,gr5 - - stdi gr4 ,@(gr8,#__FPMEDIA_MSR(0)) - - # some CPUs have extra ACCx and ACCGx regs and maybe FSRx regs - subicc.p gr7,#0x50,gr0,icc0 - subicc gr7,#0x31,gr0,icc1 - beq icc0,#0,__save_acc_fr451 - beq icc1,#0,__save_acc_fr555 -__save_acc_cont: - - lddfi @(gr8,#__FPMEDIA_FR(4)),fr4 - lddfi.p @(gr8,#__FPMEDIA_FR(6)),fr6 - bralr - - # the FR451 also has ACC8-11/ACCG8-11 regs (but not 4-7...) -__save_acc_fr451: - mrdacc acc8 ,fr4 - mrdacc acc9 ,fr5 - - stdfi.p fr4 ,@(gr8,#__FPMEDIA_ACC(4)) - - mrdacc acc10,fr6 - mrdacc acc11,fr7 - - stdfi.p fr6 ,@(gr8,#__FPMEDIA_ACC(6)) - - mrdaccg accg8,fr4 - stbfi.p fr4 ,@(gr8,#__FPMEDIA_ACCG(4)) - - mrdaccg accg9,fr5 - stbfi.p fr5 ,@(gr8,#__FPMEDIA_ACCG(5)) - - mrdaccg accg10,fr6 - stbfi.p fr6 ,@(gr8,#__FPMEDIA_ACCG(6)) - - mrdaccg accg11,fr7 - stbfi fr7 ,@(gr8,#__FPMEDIA_ACCG(7)) - bra __save_acc_cont - - # the FR555 also has ACC4-7/ACCG4-7 regs and an FSR0 reg -__save_acc_fr555: - mnop.p - mrdacc acc4 ,fr4 - mnop.p - mrdacc acc5 ,fr5 - - stdfi fr4 ,@(gr8,#__FPMEDIA_ACC(4)) - - mnop.p - mrdacc acc6 ,fr6 - mnop.p - mrdacc acc7 ,fr7 - - stdfi fr6 ,@(gr8,#__FPMEDIA_ACC(6)) - - mnop.p - mrdaccg accg4,fr4 - stbfi fr4 ,@(gr8,#__FPMEDIA_ACCG(4)) - - mnop.p - mrdaccg accg5,fr5 - stbfi fr5 ,@(gr8,#__FPMEDIA_ACCG(5)) - - mnop.p - mrdaccg accg6,fr6 - stbfi fr6 ,@(gr8,#__FPMEDIA_ACCG(6)) - - mnop.p - mrdaccg accg7,fr7 - stbfi fr7 ,@(gr8,#__FPMEDIA_ACCG(7)) - - movsg fsr0 ,gr4 - sti gr4 ,@(gr8,#__FPMEDIA_FSR(0)) - bra __save_acc_cont diff --git a/arch/frv/kernel/sys_frv.c b/arch/frv/kernel/sys_frv.c deleted file mode 100644 index f80cc8b9bd45a..0000000000000 --- a/arch/frv/kernel/sys_frv.c +++ /dev/null @@ -1,44 +0,0 @@ -/* sys_frv.c: FRV arch-specific syscall wrappers - * - * Copyright (C) 2003-5 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - Derived from arch/m68k/kernel/sys_m68k.c - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, - unsigned long prot, unsigned long flags, - unsigned long fd, unsigned long pgoff) -{ - /* As with sparc32, make sure the shift for mmap2 is constant - (12), no matter what PAGE_SIZE we have.... */ - - /* But unlike sparc32, don't just silently break if we're - trying to map something we can't */ - if (pgoff & ((1 << (PAGE_SHIFT - 12)) - 1)) - return -EINVAL; - - return sys_mmap_pgoff(addr, len, prot, flags, fd, - pgoff >> (PAGE_SHIFT - 12)); -} diff --git a/arch/frv/kernel/sysctl.c b/arch/frv/kernel/sysctl.c deleted file mode 100644 index b54a64971cf1d..0000000000000 --- a/arch/frv/kernel/sysctl.c +++ /dev/null @@ -1,221 +0,0 @@ -/* sysctl.c: implementation of /proc/sys files relating to FRV specifically - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#include -#include -#include -#include - -static const char frv_cache_wback[] = "wback"; -static const char frv_cache_wthru[] = "wthru"; - -static void frv_change_dcache_mode(unsigned long newmode) -{ - unsigned long flags, hsr0; - - local_irq_save(flags); - - hsr0 = __get_HSR(0); - hsr0 &= ~HSR0_DCE; - __set_HSR(0, hsr0); - - asm volatile(" dcef @(gr0,gr0),#1 \n" - " membar \n" - : : : "memory" - ); - - hsr0 = (hsr0 & ~HSR0_CBM) | newmode; - __set_HSR(0, hsr0); - hsr0 |= HSR0_DCE; - __set_HSR(0, hsr0); - - local_irq_restore(flags); - - //printk("HSR0 now %08lx\n", hsr0); -} - -/*****************************************************************************/ -/* - * handle requests to dynamically switch the write caching mode delivered by /proc - */ -static int procctl_frv_cachemode(struct ctl_table *table, int write, - void __user *buffer, size_t *lenp, - loff_t *ppos) -{ - unsigned long hsr0; - char buff[8]; - int len; - - len = *lenp; - - if (write) { - /* potential state change */ - if (len <= 1 || len > sizeof(buff) - 1) - return -EINVAL; - - if (copy_from_user(buff, buffer, len) != 0) - return -EFAULT; - - if (buff[len - 1] == '\n') - buff[len - 1] = '\0'; - else - buff[len] = '\0'; - - if (strcmp(buff, frv_cache_wback) == 0) { - /* switch dcache into write-back mode */ - frv_change_dcache_mode(HSR0_CBM_COPY_BACK); - return 0; - } - - if (strcmp(buff, frv_cache_wthru) == 0) { - /* switch dcache into write-through mode */ - frv_change_dcache_mode(HSR0_CBM_WRITE_THRU); - return 0; - } - - return -EINVAL; - } - - /* read the state */ - if (*ppos > 0) { - *lenp = 0; - return 0; - } - - hsr0 = __get_HSR(0); - switch (hsr0 & HSR0_CBM) { - case HSR0_CBM_WRITE_THRU: - memcpy(buff, frv_cache_wthru, sizeof(frv_cache_wthru) - 1); - buff[sizeof(frv_cache_wthru) - 1] = '\n'; - len = sizeof(frv_cache_wthru); - break; - default: - memcpy(buff, frv_cache_wback, sizeof(frv_cache_wback) - 1); - buff[sizeof(frv_cache_wback) - 1] = '\n'; - len = sizeof(frv_cache_wback); - break; - } - - if (len > *lenp) - len = *lenp; - - if (copy_to_user(buffer, buff, len) != 0) - return -EFAULT; - - *lenp = len; - *ppos = len; - return 0; - -} /* end procctl_frv_cachemode() */ - -/*****************************************************************************/ -/* - * permit the mm_struct the nominated process is using have its MMU context ID pinned - */ -#ifdef CONFIG_MMU -static int procctl_frv_pin_cxnr(struct ctl_table *table, int write, - void __user *buffer, size_t *lenp, - loff_t *ppos) -{ - pid_t pid; - char buff[16], *p; - int len; - - len = *lenp; - - if (write) { - /* potential state change */ - if (len <= 1 || len > sizeof(buff) - 1) - return -EINVAL; - - if (copy_from_user(buff, buffer, len) != 0) - return -EFAULT; - - if (buff[len - 1] == '\n') - buff[len - 1] = '\0'; - else - buff[len] = '\0'; - - pid = simple_strtoul(buff, &p, 10); - if (*p) - return -EINVAL; - - return cxn_pin_by_pid(pid); - } - - /* read the currently pinned CXN */ - if (*ppos > 0) { - *lenp = 0; - return 0; - } - - len = snprintf(buff, sizeof(buff), "%d\n", cxn_pinned); - if (len > *lenp) - len = *lenp; - - if (copy_to_user(buffer, buff, len) != 0) - return -EFAULT; - - *lenp = len; - *ppos = len; - return 0; - -} /* end procctl_frv_pin_cxnr() */ -#endif - -/* - * FR-V specific sysctls - */ -static struct ctl_table frv_table[] = -{ - { - .procname = "cache-mode", - .data = NULL, - .maxlen = 0, - .mode = 0644, - .proc_handler = procctl_frv_cachemode, - }, -#ifdef CONFIG_MMU - { - .procname = "pin-cxnr", - .data = NULL, - .maxlen = 0, - .mode = 0644, - .proc_handler = procctl_frv_pin_cxnr - }, -#endif - {} -}; - -/* - * Use a temporary sysctl number. Horrid, but will be cleaned up in 2.6 - * when all the PM interfaces exist nicely. - */ -static struct ctl_table frv_dir_table[] = -{ - { - .procname = "frv", - .mode = 0555, - .child = frv_table - }, - {} -}; - -/* - * Initialize power interface - */ -static int __init frv_sysctl_init(void) -{ - register_sysctl_table(frv_dir_table); - return 0; -} - -__initcall(frv_sysctl_init); diff --git a/arch/frv/kernel/time.c b/arch/frv/kernel/time.c deleted file mode 100644 index 332e00bf9d068..0000000000000 --- a/arch/frv/kernel/time.c +++ /dev/null @@ -1,122 +0,0 @@ -/* time.c: FRV arch-specific time handling - * - * Copyright (C) 2003-5 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - Derived from arch/m68k/kernel/time.c - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include - -#define TICK_SIZE (tick_nsec / 1000) - -unsigned long __nongprelbss __clkin_clock_speed_HZ; -unsigned long __nongprelbss __ext_bus_clock_speed_HZ; -unsigned long __nongprelbss __res_bus_clock_speed_HZ; -unsigned long __nongprelbss __sdram_clock_speed_HZ; -unsigned long __nongprelbss __core_bus_clock_speed_HZ; -unsigned long __nongprelbss __core_clock_speed_HZ; -unsigned long __nongprelbss __dsu_clock_speed_HZ; -unsigned long __nongprelbss __serial_clock_speed_HZ; -unsigned long __delay_loops_MHz; - -static irqreturn_t timer_interrupt(int irq, void *dummy); - -static struct irqaction timer_irq = { - .handler = timer_interrupt, - .name = "timer", -}; - -/* - * timer_interrupt() needs to keep up the real-time clock, - * as well as call the "xtime_update()" routine every clocktick - */ -static irqreturn_t timer_interrupt(int irq, void *dummy) -{ - profile_tick(CPU_PROFILING); - - xtime_update(1); - -#ifdef CONFIG_HEARTBEAT - static unsigned short n; - n++; - __set_LEDS(n); -#endif /* CONFIG_HEARTBEAT */ - - update_process_times(user_mode(get_irq_regs())); - - return IRQ_HANDLED; -} - -void time_divisor_init(void) -{ - unsigned short base, pre, prediv; - - /* set the scheduling timer going */ - pre = 1; - prediv = 4; - base = __res_bus_clock_speed_HZ / pre / HZ / (1 << prediv); - - __set_TPRV(pre); - __set_TxCKSL_DATA(0, prediv); - __set_TCTR(TCTR_SC_CTR0 | TCTR_RL_RW_LH8 | TCTR_MODE_2); - __set_TCSR_DATA(0, base & 0xff); - __set_TCSR_DATA(0, base >> 8); -} - - -void read_persistent_clock(struct timespec *ts) -{ - unsigned int year, mon, day, hour, min, sec; - - extern void arch_gettod(int *year, int *mon, int *day, int *hour, int *min, int *sec); - - /* FIX by dqg : Set to zero for platforms that don't have tod */ - /* without this time is undefined and can overflow time_t, causing */ - /* very strange errors */ - year = 1980; - mon = day = 1; - hour = min = sec = 0; - arch_gettod (&year, &mon, &day, &hour, &min, &sec); - - if ((year += 1900) < 1970) - year += 100; - ts->tv_sec = mktime(year, mon, day, hour, min, sec); - ts->tv_nsec = 0; -} - -void time_init(void) -{ - /* install scheduling interrupt handler */ - setup_irq(IRQ_CPU_TIMER0, &timer_irq); - - time_divisor_init(); -} - -/* - * Scheduler clock - returns current time in nanosec units. - */ -unsigned long long sched_clock(void) -{ - return jiffies_64 * (1000000000 / HZ); -} diff --git a/arch/frv/kernel/traps.c b/arch/frv/kernel/traps.c deleted file mode 100644 index fb08ebe0dab42..0000000000000 --- a/arch/frv/kernel/traps.c +++ /dev/null @@ -1,642 +0,0 @@ -/* traps.c: high-level exception handler for FR-V - * - * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -void show_backtrace(struct pt_regs *, unsigned long); - -extern asmlinkage void __break_hijack_kernel_event(void); - -/*****************************************************************************/ -/* - * instruction access error - */ -asmlinkage void insn_access_error(unsigned long esfr1, unsigned long epcr0, unsigned long esr0) -{ - siginfo_t info; - - die_if_kernel("-- Insn Access Error --\n" - "EPCR0 : %08lx\n" - "ESR0 : %08lx\n", - epcr0, esr0); - - info.si_signo = SIGSEGV; - info.si_code = SEGV_ACCERR; - info.si_errno = 0; - info.si_addr = (void __user *) ((epcr0 & EPCR0_V) ? (epcr0 & EPCR0_PC) : __frame->pc); - - force_sig_info(info.si_signo, &info, current); -} /* end insn_access_error() */ - -/*****************************************************************************/ -/* - * handler for: - * - illegal instruction - * - privileged instruction - * - unsupported trap - * - debug exceptions - */ -asmlinkage void illegal_instruction(unsigned long esfr1, unsigned long epcr0, unsigned long esr0) -{ - siginfo_t info; - - die_if_kernel("-- Illegal Instruction --\n" - "EPCR0 : %08lx\n" - "ESR0 : %08lx\n" - "ESFR1 : %08lx\n", - epcr0, esr0, esfr1); - - info.si_errno = 0; - info.si_addr = (void __user *) ((epcr0 & EPCR0_V) ? (epcr0 & EPCR0_PC) : __frame->pc); - - switch (__frame->tbr & TBR_TT) { - case TBR_TT_ILLEGAL_INSTR: - info.si_signo = SIGILL; - info.si_code = ILL_ILLOPC; - break; - case TBR_TT_PRIV_INSTR: - info.si_signo = SIGILL; - info.si_code = ILL_PRVOPC; - break; - case TBR_TT_TRAP2 ... TBR_TT_TRAP126: - info.si_signo = SIGILL; - info.si_code = ILL_ILLTRP; - break; - /* GDB uses "tira gr0, #1" as a breakpoint instruction. */ - case TBR_TT_TRAP1: - case TBR_TT_BREAK: - info.si_signo = SIGTRAP; - info.si_code = - (__frame->__status & REG__STATUS_STEPPED) ? TRAP_TRACE : TRAP_BRKPT; - break; - } - - force_sig_info(info.si_signo, &info, current); -} /* end illegal_instruction() */ - -/*****************************************************************************/ -/* - * handle atomic operations with errors - * - arguments in gr8, gr9, gr10 - * - original memory value placed in gr5 - * - replacement memory value placed in gr9 - */ -asmlinkage void atomic_operation(unsigned long esfr1, unsigned long epcr0, - unsigned long esr0) -{ - static DEFINE_SPINLOCK(atomic_op_lock); - unsigned long x, y, z; - unsigned long __user *p; - mm_segment_t oldfs; - siginfo_t info; - int ret; - - y = 0; - z = 0; - - oldfs = get_fs(); - if (!user_mode(__frame)) - set_fs(KERNEL_DS); - - switch (__frame->tbr & TBR_TT) { - /* TIRA gr0,#120 - * u32 __atomic_user_cmpxchg32(u32 *ptr, u32 test, u32 new) - */ - case TBR_TT_ATOMIC_CMPXCHG32: - p = (unsigned long __user *) __frame->gr8; - x = __frame->gr9; - y = __frame->gr10; - - for (;;) { - ret = get_user(z, p); - if (ret < 0) - goto error; - - if (z != x) - goto done; - - spin_lock_irq(&atomic_op_lock); - - if (__get_user(z, p) == 0) { - if (z != x) - goto done2; - - if (__put_user(y, p) == 0) - goto done2; - goto error2; - } - - spin_unlock_irq(&atomic_op_lock); - } - - /* TIRA gr0,#121 - * u32 __atomic_kernel_xchg32(void *v, u32 new) - */ - case TBR_TT_ATOMIC_XCHG32: - p = (unsigned long __user *) __frame->gr8; - y = __frame->gr9; - - for (;;) { - ret = get_user(z, p); - if (ret < 0) - goto error; - - spin_lock_irq(&atomic_op_lock); - - if (__get_user(z, p) == 0) { - if (__put_user(y, p) == 0) - goto done2; - goto error2; - } - - spin_unlock_irq(&atomic_op_lock); - } - - /* TIRA gr0,#122 - * ulong __atomic_kernel_XOR_return(ulong i, ulong *v) - */ - case TBR_TT_ATOMIC_XOR: - p = (unsigned long __user *) __frame->gr8; - x = __frame->gr9; - - for (;;) { - ret = get_user(z, p); - if (ret < 0) - goto error; - - spin_lock_irq(&atomic_op_lock); - - if (__get_user(z, p) == 0) { - y = x ^ z; - if (__put_user(y, p) == 0) - goto done2; - goto error2; - } - - spin_unlock_irq(&atomic_op_lock); - } - - /* TIRA gr0,#123 - * ulong __atomic_kernel_OR_return(ulong i, ulong *v) - */ - case TBR_TT_ATOMIC_OR: - p = (unsigned long __user *) __frame->gr8; - x = __frame->gr9; - - for (;;) { - ret = get_user(z, p); - if (ret < 0) - goto error; - - spin_lock_irq(&atomic_op_lock); - - if (__get_user(z, p) == 0) { - y = x ^ z; - if (__put_user(y, p) == 0) - goto done2; - goto error2; - } - - spin_unlock_irq(&atomic_op_lock); - } - - /* TIRA gr0,#124 - * ulong __atomic_kernel_AND_return(ulong i, ulong *v) - */ - case TBR_TT_ATOMIC_AND: - p = (unsigned long __user *) __frame->gr8; - x = __frame->gr9; - - for (;;) { - ret = get_user(z, p); - if (ret < 0) - goto error; - - spin_lock_irq(&atomic_op_lock); - - if (__get_user(z, p) == 0) { - y = x & z; - if (__put_user(y, p) == 0) - goto done2; - goto error2; - } - - spin_unlock_irq(&atomic_op_lock); - } - - /* TIRA gr0,#125 - * int __atomic_user_sub_return(atomic_t *v, int i) - */ - case TBR_TT_ATOMIC_SUB: - p = (unsigned long __user *) __frame->gr8; - x = __frame->gr9; - - for (;;) { - ret = get_user(z, p); - if (ret < 0) - goto error; - - spin_lock_irq(&atomic_op_lock); - - if (__get_user(z, p) == 0) { - y = z - x; - if (__put_user(y, p) == 0) - goto done2; - goto error2; - } - - spin_unlock_irq(&atomic_op_lock); - } - - /* TIRA gr0,#126 - * int __atomic_user_add_return(atomic_t *v, int i) - */ - case TBR_TT_ATOMIC_ADD: - p = (unsigned long __user *) __frame->gr8; - x = __frame->gr9; - - for (;;) { - ret = get_user(z, p); - if (ret < 0) - goto error; - - spin_lock_irq(&atomic_op_lock); - - if (__get_user(z, p) == 0) { - y = z + x; - if (__put_user(y, p) == 0) - goto done2; - goto error2; - } - - spin_unlock_irq(&atomic_op_lock); - } - - default: - BUG(); - } - -done2: - spin_unlock_irq(&atomic_op_lock); -done: - if (!user_mode(__frame)) - set_fs(oldfs); - __frame->gr5 = z; - __frame->gr9 = y; - return; - -error2: - spin_unlock_irq(&atomic_op_lock); -error: - if (!user_mode(__frame)) - set_fs(oldfs); - __frame->pc -= 4; - - die_if_kernel("-- Atomic Op Error --\n"); - - info.si_signo = SIGSEGV; - info.si_code = SEGV_ACCERR; - info.si_errno = 0; - info.si_addr = (void __user *) __frame->pc; - - force_sig_info(info.si_signo, &info, current); -} - -/*****************************************************************************/ -/* - * - */ -asmlinkage void media_exception(unsigned long msr0, unsigned long msr1) -{ - siginfo_t info; - - die_if_kernel("-- Media Exception --\n" - "MSR0 : %08lx\n" - "MSR1 : %08lx\n", - msr0, msr1); - - info.si_signo = SIGFPE; - info.si_code = FPE_MDAOVF; - info.si_errno = 0; - info.si_addr = (void __user *) __frame->pc; - - force_sig_info(info.si_signo, &info, current); -} /* end media_exception() */ - -/*****************************************************************************/ -/* - * instruction or data access exception - */ -asmlinkage void memory_access_exception(unsigned long esr0, - unsigned long ear0, - unsigned long epcr0) -{ - siginfo_t info; - -#ifdef CONFIG_MMU - if (fixup_exception(__frame)) - return; -#endif - - die_if_kernel("-- Memory Access Exception --\n" - "ESR0 : %08lx\n" - "EAR0 : %08lx\n" - "EPCR0 : %08lx\n", - esr0, ear0, epcr0); - - info.si_signo = SIGSEGV; - info.si_code = SEGV_ACCERR; - info.si_errno = 0; - info.si_addr = NULL; - - if ((esr0 & (ESRx_VALID | ESR0_EAV)) == (ESRx_VALID | ESR0_EAV)) - info.si_addr = (void __user *) ear0; - - force_sig_info(info.si_signo, &info, current); - -} /* end memory_access_exception() */ - -/*****************************************************************************/ -/* - * data access error - * - double-word data load from CPU control area (0xFExxxxxx) - * - read performed on inactive or self-refreshing SDRAM - * - error notification from slave device - * - misaligned address - * - access to out of bounds memory region - * - user mode accessing privileged memory region - * - write to R/O memory region - */ -asmlinkage void data_access_error(unsigned long esfr1, unsigned long esr15, unsigned long ear15) -{ - siginfo_t info; - - die_if_kernel("-- Data Access Error --\n" - "ESR15 : %08lx\n" - "EAR15 : %08lx\n", - esr15, ear15); - - info.si_signo = SIGSEGV; - info.si_code = SEGV_ACCERR; - info.si_errno = 0; - info.si_addr = (void __user *) - (((esr15 & (ESRx_VALID|ESR15_EAV)) == (ESRx_VALID|ESR15_EAV)) ? ear15 : 0); - - force_sig_info(info.si_signo, &info, current); -} /* end data_access_error() */ - -/*****************************************************************************/ -/* - * data store error - should only happen if accessing inactive or self-refreshing SDRAM - */ -asmlinkage void data_store_error(unsigned long esfr1, unsigned long esr15) -{ - die_if_kernel("-- Data Store Error --\n" - "ESR15 : %08lx\n", - esr15); - BUG(); -} /* end data_store_error() */ - -/*****************************************************************************/ -/* - * - */ -asmlinkage void division_exception(unsigned long esfr1, unsigned long esr0, unsigned long isr) -{ - siginfo_t info; - - die_if_kernel("-- Division Exception --\n" - "ESR0 : %08lx\n" - "ISR : %08lx\n", - esr0, isr); - - info.si_signo = SIGFPE; - info.si_code = FPE_INTDIV; - info.si_errno = 0; - info.si_addr = (void __user *) __frame->pc; - - force_sig_info(info.si_signo, &info, current); -} /* end division_exception() */ - -/*****************************************************************************/ -/* - * - */ -asmlinkage void compound_exception(unsigned long esfr1, - unsigned long esr0, unsigned long esr14, unsigned long esr15, - unsigned long msr0, unsigned long msr1) -{ - die_if_kernel("-- Compound Exception --\n" - "ESR0 : %08lx\n" - "ESR15 : %08lx\n" - "ESR15 : %08lx\n" - "MSR0 : %08lx\n" - "MSR1 : %08lx\n", - esr0, esr14, esr15, msr0, msr1); - BUG(); -} /* end compound_exception() */ - -void show_stack(struct task_struct *task, unsigned long *sp) -{ -} - -void show_trace_task(struct task_struct *tsk) -{ - printk("CONTEXT: stack=0x%lx frame=0x%p LR=0x%lx RET=0x%lx\n", - tsk->thread.sp, tsk->thread.frame, tsk->thread.lr, tsk->thread.sched_lr); -} - -static const char *regnames[] = { - "PSR ", "ISR ", "CCR ", "CCCR", - "LR ", "LCR ", "PC ", "_stt", - "sys ", "GR8*", "GNE0", "GNE1", - "IACH", "IACL", - "TBR ", "SP ", "FP ", "GR3 ", - "GR4 ", "GR5 ", "GR6 ", "GR7 ", - "GR8 ", "GR9 ", "GR10", "GR11", - "GR12", "GR13", "GR14", "GR15", - "GR16", "GR17", "GR18", "GR19", - "GR20", "GR21", "GR22", "GR23", - "GR24", "GR25", "GR26", "GR27", - "EFRM", "CURR", "GR30", "BFRM" -}; - -void show_regs(struct pt_regs *regs) -{ - unsigned long *reg; - int loop; - - printk("\n"); - show_regs_print_info(KERN_DEFAULT); - - printk("Frame: @%08lx [%s]\n", - (unsigned long) regs, - regs->psr & PSR_S ? "kernel" : "user"); - - reg = (unsigned long *) regs; - for (loop = 0; loop < NR_PT_REGS; loop++) { - printk("%s %08lx", regnames[loop + 0], reg[loop + 0]); - - if (loop == NR_PT_REGS - 1 || loop % 5 == 4) - printk("\n"); - else - printk(" | "); - } -} - -void die_if_kernel(const char *str, ...) -{ - char buffer[256]; - va_list va; - - if (user_mode(__frame)) - return; - - va_start(va, str); - vsnprintf(buffer, sizeof(buffer), str, va); - va_end(va); - - console_verbose(); - printk("\n===================================\n"); - printk("%s\n", buffer); - show_backtrace(__frame, 0); - - __break_hijack_kernel_event(); - do_exit(SIGSEGV); -} - -/*****************************************************************************/ -/* - * dump the contents of an exception frame - */ -static void show_backtrace_regs(struct pt_regs *frame) -{ - unsigned long *reg; - int loop; - - /* print the registers for this frame */ - printk("<-- %s Frame: @%p -->\n", - frame->psr & PSR_S ? "Kernel Mode" : "User Mode", - frame); - - reg = (unsigned long *) frame; - for (loop = 0; loop < NR_PT_REGS; loop++) { - printk("%s %08lx", regnames[loop + 0], reg[loop + 0]); - - if (loop == NR_PT_REGS - 1 || loop % 5 == 4) - printk("\n"); - else - printk(" | "); - } - - printk("--------\n"); -} /* end show_backtrace_regs() */ - -/*****************************************************************************/ -/* - * generate a backtrace of the kernel stack - */ -void show_backtrace(struct pt_regs *frame, unsigned long sp) -{ - struct pt_regs *frame0; - unsigned long tos = 0, stop = 0, base; - int format; - - base = ((((unsigned long) frame) + 8191) & ~8191) - sizeof(struct user_context); - frame0 = (struct pt_regs *) base; - - if (sp) { - tos = sp; - stop = (unsigned long) frame; - } - - printk("\nProcess %s (pid: %d)\n\n", current->comm, current->pid); - - for (;;) { - /* dump stack segment between frames */ - //printk("%08lx -> %08lx\n", tos, stop); - format = 0; - while (tos < stop) { - if (format == 0) - printk(" %04lx :", tos & 0xffff); - - printk(" %08lx", *(unsigned long *) tos); - - tos += 4; - format++; - if (format == 8) { - printk("\n"); - format = 0; - } - } - - if (format > 0) - printk("\n"); - - /* dump frame 0 outside of the loop */ - if (frame == frame0) - break; - - tos = frame->sp; - if (((unsigned long) frame) + sizeof(*frame) != tos) { - printk("-- TOS %08lx does not follow frame %p --\n", - tos, frame); - break; - } - - show_backtrace_regs(frame); - - /* dump the stack between this frame and the next */ - stop = (unsigned long) frame->next_frame; - if (stop != base && - (stop < tos || - stop > base || - (stop < base && stop + sizeof(*frame) > base) || - stop & 3)) { - printk("-- next_frame %08lx is invalid (range %08lx-%08lx) --\n", - stop, tos, base); - break; - } - - /* move to next frame */ - frame = frame->next_frame; - } - - /* we can always dump frame 0, even if the rest of the stack is corrupt */ - show_backtrace_regs(frame0); - -} /* end show_backtrace() */ - -/*****************************************************************************/ -/* - * initialise traps - */ -void __init trap_init (void) -{ -} /* end trap_init() */ diff --git a/arch/frv/kernel/uaccess.c b/arch/frv/kernel/uaccess.c deleted file mode 100644 index 8b360b4222a5c..0000000000000 --- a/arch/frv/kernel/uaccess.c +++ /dev/null @@ -1,100 +0,0 @@ -/* uaccess.c: userspace access functions - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#include -#include -#include - -/*****************************************************************************/ -/* - * copy a null terminated string from userspace - */ -long strncpy_from_user(char *dst, const char __user *src, long count) -{ - unsigned long max; - char *p, ch; - long err = -EFAULT; - - BUG_ON(count < 0); - - p = dst; - -#ifndef CONFIG_MMU - if ((unsigned long) src < memory_start) - goto error; -#endif - - if ((unsigned long) src >= get_addr_limit()) - goto error; - - max = get_addr_limit() - (unsigned long) src; - if ((unsigned long) count > max) { - memset(dst + max, 0, count - max); - count = max; - } - - err = 0; - for (; count > 0; count--, p++, src++) { - __get_user_asm(err, ch, src, "ub", "=r"); - if (err < 0) - goto error; - if (!ch) - break; - *p = ch; - } - - err = p - dst; /* return length excluding NUL */ - - error: - if (count > 0) - memset(p, 0, count); /* clear remainder of buffer [security] */ - - return err; - -} /* end strncpy_from_user() */ - -EXPORT_SYMBOL(strncpy_from_user); - -/*****************************************************************************/ -/* - * Return the size of a string (including the ending 0) - * - * Return 0 on exception, a value greater than N if too long - */ -long strnlen_user(const char __user *src, long count) -{ - const char __user *p; - long err = 0; - char ch; - - BUG_ON(count < 0); - -#ifndef CONFIG_MMU - if ((unsigned long) src < memory_start) - return 0; -#endif - - if ((unsigned long) src >= get_addr_limit()) - return 0; - - for (p = src; count > 0; count--, p++) { - __get_user_asm(err, ch, p, "ub", "=r"); - if (err < 0) - return 0; - if (!ch) - break; - } - - return p - src + 1; /* return length including NUL */ - -} /* end strnlen_user() */ - -EXPORT_SYMBOL(strnlen_user); diff --git a/arch/frv/kernel/vmlinux.lds.S b/arch/frv/kernel/vmlinux.lds.S deleted file mode 100644 index 42806c512758e..0000000000000 --- a/arch/frv/kernel/vmlinux.lds.S +++ /dev/null @@ -1,136 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* ld script to make FRV Linux kernel - * Written by Martin Mares ; - */ -OUTPUT_FORMAT("elf32-frv", "elf32-frv", "elf32-frv") -OUTPUT_ARCH(frv) -ENTRY(_start) - -#include -#include -#include -#include -#include - -jiffies = jiffies_64 + 4; - -__page_offset = CONFIG_PAGE_OFFSET; /* start of area covered by struct pages */ -__kernel_image_start = __page_offset; /* address at which kernel image resides */ - -SECTIONS -{ - . = __kernel_image_start; - - /* discardable initialisation code and data */ - . = ALIGN(PAGE_SIZE); /* Init code and data */ - __init_begin = .; - - _sinittext = .; - .init.text : { - HEAD_TEXT -#ifndef CONFIG_DEBUG_INFO - INIT_TEXT - EXIT_TEXT - EXIT_DATA - *(.exitcall.exit) -#endif - } - _einittext = .; - - INIT_DATA_SECTION(8) - PERCPU_SECTION(L1_CACHE_BYTES) - - . = ALIGN(PAGE_SIZE); - __init_end = .; - - .trap : { - /* trap table management - read entry-table.S before modifying */ - . = ALIGN(8192); - __trap_tables = .; - *(.trap.user) - *(.trap.kernel) - . = ALIGN(4096); - *(.trap.break) - } - - /* Text and read-only data */ - . = ALIGN(4); - _text = .; - _stext = .; - .text : { - *(.text..start) - *(.text..entry) - *(.text..break) - *(.text..tlbmiss) - TEXT_TEXT - SCHED_TEXT - CPUIDLE_TEXT - LOCK_TEXT -#ifdef CONFIG_DEBUG_INFO - INIT_TEXT - EXIT_TEXT - *(.exitcall.exit) -#endif - *(.fixup) - *(.gnu.warning) - *(.exitcall.exit) - } = 0x9090 - - _etext = .; /* End of text section */ - - RODATA - - .rodata : { - *(.trap.vector) - - /* this clause must not be modified - the ordering and adjacency are imperative */ - __trap_fixup_tables = .; - *(.trap.fixup.user .trap.fixup.kernel) - - } - - EXCEPTION_TABLE(8) - - _sdata = .; - .data : { /* Data */ - INIT_TASK_DATA(THREAD_SIZE) - CACHELINE_ALIGNED_DATA(L1_CACHE_BYTES) - DATA_DATA - *(.data.*) - EXIT_DATA - CONSTRUCTORS - } - - _edata = .; /* End of data section */ - - BUG_TABLE - - /* GP section */ - . = ALIGN(L1_CACHE_BYTES); - _gp = . + 2048; - PROVIDE (gp = _gp); - - .sdata : { *(.sdata .sdata.*) } - - /* BSS */ - . = ALIGN(L1_CACHE_BYTES); - __bss_start = .; - - .sbss : { *(.sbss .sbss.*) } - .bss : { *(.bss .bss.*) } - .bss..stack : { *(.bss) } - - __bss_stop = .; - _end = . ; - . = ALIGN(PAGE_SIZE); - __kernel_image_end = .; - - STABS_DEBUG - DWARF_DEBUG - - .comment 0 : { *(.comment) } - - DISCARDS -} - -__kernel_image_size_no_bss = __bss_start - __kernel_image_start; diff --git a/arch/frv/lib/Makefile b/arch/frv/lib/Makefile deleted file mode 100644 index 970e8b4f1a026..0000000000000 --- a/arch/frv/lib/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -# -# Makefile for FRV-specific library files.. -# - -lib-y := \ - __ashldi3.o __lshrdi3.o __muldi3.o __ashrdi3.o __negdi2.o __ucmpdi2.o \ - checksum.o memcpy.o memset.o atomic-ops.o atomic64-ops.o \ - outsl_ns.o outsl_sw.o insl_ns.o insl_sw.o cache.o atomic-lib.o diff --git a/arch/frv/lib/__ashldi3.S b/arch/frv/lib/__ashldi3.S deleted file mode 100644 index db5b6dc37a11a..0000000000000 --- a/arch/frv/lib/__ashldi3.S +++ /dev/null @@ -1,40 +0,0 @@ -/* __ashldi3.S: 64-bit arithmetic shift left - * - * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - - .text - .p2align 4 - -############################################################################### -# -# unsigned long long __ashldi3(unsigned long long value [GR8:GR9], unsigned by [GR10]) -# -############################################################################### - .globl __ashldi3 - .type __ashldi3,@function -__ashldi3: - andicc.p gr10,#63,gr10,icc0 - setlos #32,gr5 - andicc.p gr10,#32,gr0,icc1 - beqlr icc0,#0 - ckeq icc1,cc4 ; cc4 is true if 0> M - - # deal with a shift in the range 32<=N<=63 - csll gr9,gr10,gr8 ,cc4,#0 ; MSW = LSW << (N & 31 [implicit AND]) - cor.p gr0,gr0,gr9 ,cc4,#0 ; LSW = 0 - bralr - .size __ashldi3, .-__ashldi3 diff --git a/arch/frv/lib/__ashrdi3.S b/arch/frv/lib/__ashrdi3.S deleted file mode 100644 index 5742665bfd296..0000000000000 --- a/arch/frv/lib/__ashrdi3.S +++ /dev/null @@ -1,41 +0,0 @@ -/* __ashrdi3.S: 64-bit arithmetic shift right - * - * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - - .text - .p2align 4 - -############################################################################### -# -# signed long long __ashrdi3(signed long long value [GR8:GR9], unsigned by [GR10]) -# -############################################################################### - .globl __ashrdi3 - .type __ashrdi3,@function -__ashrdi3: - andicc.p gr10,#63,gr10,icc0 - setlos #32,gr5 - andicc.p gr10,#32,gr0,icc1 - beqlr icc0,#0 - setlos.p #31,gr6 - ckeq icc1,cc4 ; cc4 is true if 0>= N - csub gr5,gr10,gr5 ,cc4,#1 ; M = 32 - N - csll.p gr8,gr5,gr4 ,cc4,#1 - csra gr8,gr10,gr8 ,cc4,#1 ; MSW >>= N - cor.p gr4,gr9,gr9 ,cc4,#1 ; LSW |= MSW << M - - # deal with a shift in the range 32<=N<=63 - csra gr8,gr10,gr9 ,cc4,#0 ; LSW = MSW >> (N & 31 [implicit AND]) - csra.p gr8,gr6,gr8 ,cc4,#0 ; MSW >>= 31 - bralr - .size __ashrdi3, .-__ashrdi3 diff --git a/arch/frv/lib/__lshrdi3.S b/arch/frv/lib/__lshrdi3.S deleted file mode 100644 index 7b41f6304f043..0000000000000 --- a/arch/frv/lib/__lshrdi3.S +++ /dev/null @@ -1,40 +0,0 @@ -/* __lshrdi3.S: 64-bit logical shift right - * - * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - - .text - .p2align 4 - -############################################################################### -# -# unsigned long long __lshrdi3(unsigned long long value [GR8:GR9], unsigned by [GR10]) -# -############################################################################### - .globl __lshrdi3 - .type __lshrdi3,@function -__lshrdi3: - andicc.p gr10,#63,gr10,icc0 - setlos #32,gr5 - andicc.p gr10,#32,gr0,icc1 - beqlr icc0,#0 - ckeq icc1,cc4 ; cc4 is true if 0>= N - csub gr5,gr10,gr5 ,cc4,#1 ; M = 32 - N - csll.p gr8,gr5,gr4 ,cc4,#1 - csrl gr8,gr10,gr8 ,cc4,#1 ; MSW >>= N - cor.p gr4,gr9,gr9 ,cc4,#1 ; LSW |= MSW << M - - # deal with a shift in the range 32<=N<=63 - csrl gr8,gr10,gr9 ,cc4,#0 ; LSW = MSW >> (N & 31 [implicit AND]) - cor.p gr0,gr0,gr8 ,cc4,#0 ; MSW = 0 - bralr - .size __lshrdi3, .-__lshrdi3 diff --git a/arch/frv/lib/__muldi3.S b/arch/frv/lib/__muldi3.S deleted file mode 100644 index 2703d9b793611..0000000000000 --- a/arch/frv/lib/__muldi3.S +++ /dev/null @@ -1,32 +0,0 @@ -/* __muldi3.S: 64-bit multiply - * - * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - - .text - .p2align 4 - -############################################################################### -# -# unsigned long long __muldi3(unsigned long long x [GR8:GR9], -# unsigned long long y [GR10:GR11]) -# -############################################################################### - .globl __muldi3, __mulll, __umulll - .type __muldi3,@function -__muldi3: -__mulll: -__umulll: - umul gr8,gr11,gr4 ; GR4:GR5 = x.MSW * y.LSW - umul gr9,gr10,gr6 ; GR6:GR7 = x.LSW * y.MSW - umul.p gr9,gr11,gr8 ; GR8:GR9 = x.LSW * y.LSW - add gr5,gr7,gr5 - add.p gr8,gr5,gr8 ; GR8 += GR5 + GR7 - bralr - .size __muldi3, .-__muldi3 diff --git a/arch/frv/lib/__negdi2.S b/arch/frv/lib/__negdi2.S deleted file mode 100644 index d1747bf249974..0000000000000 --- a/arch/frv/lib/__negdi2.S +++ /dev/null @@ -1,28 +0,0 @@ -/* __negdi2.S: 64-bit negate - * - * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - - - .text - .p2align 4 - -############################################################################### -# -# unsigned long long __negdi2(unsigned long long value [GR8:GR9]) -# -############################################################################### - .globl __negdi2 - .type __negdi2,@function -__negdi2: - subcc gr0,gr9,gr9,icc0 - subx gr0,gr8,gr8,icc0 - bralr - .size __negdi2, .-__negdi2 - diff --git a/arch/frv/lib/__ucmpdi2.S b/arch/frv/lib/__ucmpdi2.S deleted file mode 100644 index d892f16ffaa92..0000000000000 --- a/arch/frv/lib/__ucmpdi2.S +++ /dev/null @@ -1,45 +0,0 @@ -/* __ucmpdi2.S: 64-bit unsigned compare - * - * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - - - .text - .p2align 4 - -############################################################################### -# -# int __ucmpdi2(unsigned long long a [GR8:GR9], -# unsigned long long b [GR10:GR11]) -# -# - returns 0, 1, or 2 as a <, =, > b respectively. -# -############################################################################### - .globl __ucmpdi2 - .type __ucmpdi2,@function -__ucmpdi2: - or.p gr8,gr0,gr4 - subcc gr8,gr10,gr0,icc0 - setlos.p #0,gr8 - bclr icc0,#2 ; a.msw < b.msw - - setlos.p #2,gr8 - bhilr icc0,#0 ; a.msw > b.msw - - subcc.p gr9,gr11,gr0,icc1 - setlos #0,gr8 - setlos.p #2,gr9 - setlos #1,gr7 - cknc icc1,cc6 - cor.p gr9,gr0,gr8, cc6,#1 - cckls icc1,cc4, cc6,#1 - andcr cc6,cc4,cc4 - cor gr7,gr0,gr8, cc4,#1 - bralr - .size __ucmpdi2, .-__ucmpdi2 diff --git a/arch/frv/lib/atomic-lib.c b/arch/frv/lib/atomic-lib.c deleted file mode 100644 index 3027576f7782b..0000000000000 --- a/arch/frv/lib/atomic-lib.c +++ /dev/null @@ -1,8 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 - -#include -#include - -#define __ATOMIC_LIB__ - -#include diff --git a/arch/frv/lib/atomic-ops.S b/arch/frv/lib/atomic-ops.S deleted file mode 100644 index b7439a960b5ba..0000000000000 --- a/arch/frv/lib/atomic-ops.S +++ /dev/null @@ -1,62 +0,0 @@ -/* atomic-ops.S: kernel atomic operations - * - * For an explanation of how atomic ops work in this arch, see: - * Documentation/frv/atomic-ops.txt - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#include - - .text - .balign 4 - -############################################################################### -# -# uint32_t __xchg_32(uint32_t i, uint32_t *v) -# -############################################################################### - .globl __xchg_32 - .type __xchg_32,@function -__xchg_32: - or.p gr8,gr8,gr10 -0: - orcc gr0,gr0,gr0,icc3 /* set ICC3.Z */ - ckeq icc3,cc7 - ld.p @(gr9,gr0),gr8 /* LD.P/ORCR must be atomic */ - orcr cc7,cc7,cc3 /* set CC3 to true */ - cst.p gr10,@(gr9,gr0) ,cc3,#1 - corcc gr29,gr29,gr0 ,cc3,#1 /* clear ICC3.Z if store happens */ - beq icc3,#0,0b - bralr - - .size __xchg_32, .-__xchg_32 - -############################################################################### -# -# uint32_t __cmpxchg_32(uint32_t *v, uint32_t test, uint32_t new) -# -############################################################################### - .globl __cmpxchg_32 - .type __cmpxchg_32,@function -__cmpxchg_32: - or.p gr8,gr8,gr11 -0: - orcc gr0,gr0,gr0,icc3 - ckeq icc3,cc7 - ld.p @(gr11,gr0),gr8 - orcr cc7,cc7,cc3 - subcc gr8,gr9,gr7,icc0 - bnelr icc0,#0 - cst.p gr10,@(gr11,gr0) ,cc3,#1 - corcc gr29,gr29,gr0 ,cc3,#1 - beq icc3,#0,0b - bralr - - .size __cmpxchg_32, .-__cmpxchg_32 diff --git a/arch/frv/lib/atomic64-ops.S b/arch/frv/lib/atomic64-ops.S deleted file mode 100644 index c4c472308a33a..0000000000000 --- a/arch/frv/lib/atomic64-ops.S +++ /dev/null @@ -1,68 +0,0 @@ -/* kernel atomic64 operations - * - * For an explanation of how atomic ops work in this arch, see: - * Documentation/frv/atomic-ops.txt - * - * Copyright (C) 2009 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#include - - .text - .balign 4 - - -############################################################################### -# -# uint64_t __xchg_64(uint64_t i, uint64_t *v) -# -############################################################################### - .globl __xchg_64 - .type __xchg_64,@function -__xchg_64: - or.p gr8,gr8,gr4 - or gr9,gr9,gr5 -0: - orcc gr0,gr0,gr0,icc3 /* set ICC3.Z */ - ckeq icc3,cc7 - ldd.p @(gr10,gr0),gr8 /* LDD.P/ORCR must be atomic */ - orcr cc7,cc7,cc3 /* set CC3 to true */ - cstd.p gr4,@(gr10,gr0) ,cc3,#1 - corcc gr29,gr29,gr0 ,cc3,#1 /* clear ICC3.Z if store happens */ - beq icc3,#0,0b - bralr - - .size __xchg_64, .-__xchg_64 - -############################################################################### -# -# uint64_t __cmpxchg_64(uint64_t test, uint64_t new, uint64_t *v) -# -############################################################################### - .globl __cmpxchg_64 - .type __cmpxchg_64,@function -__cmpxchg_64: - or.p gr8,gr8,gr4 - or gr9,gr9,gr5 -0: - orcc gr0,gr0,gr0,icc3 /* set ICC3.Z */ - ckeq icc3,cc7 - ldd.p @(gr12,gr0),gr8 /* LDD.P/ORCR must be atomic */ - orcr cc7,cc7,cc3 - subcc gr8,gr4,gr0,icc0 - subcc.p gr9,gr5,gr0,icc1 - bnelr icc0,#0 - bnelr icc1,#0 - cstd.p gr10,@(gr12,gr0) ,cc3,#1 - corcc gr29,gr29,gr0 ,cc3,#1 /* clear ICC3.Z if store happens */ - beq icc3,#0,0b - bralr - - .size __cmpxchg_64, .-__cmpxchg_64 - diff --git a/arch/frv/lib/cache.S b/arch/frv/lib/cache.S deleted file mode 100644 index 0c4fb204911b9..0000000000000 --- a/arch/frv/lib/cache.S +++ /dev/null @@ -1,98 +0,0 @@ -/* cache.S: cache management routines - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#include -#include - - .text - .p2align 4 - -############################################################################### -# -# Write back a range of dcache -# - void frv_dcache_writeback(unsigned long start [GR8], unsigned long size [GR9]) -# -############################################################################### - .globl frv_dcache_writeback - .type frv_dcache_writeback,@function -frv_dcache_writeback: - andi gr8,~(L1_CACHE_BYTES-1),gr8 - -2: dcf @(gr8,gr0) - addi gr8,#L1_CACHE_BYTES,gr8 - cmp gr9,gr8,icc0 - bhi icc0,#2,2b - - membar - bralr - .size frv_dcache_writeback, .-frv_dcache_writeback - -############################################################################## -# -# Invalidate a range of dcache and icache -# - void frv_cache_invalidate(unsigned long start [GR8], unsigned long end [GR9]); -# -############################################################################### - .globl frv_cache_invalidate - .type frv_cache_invalidate,@function -frv_cache_invalidate: - andi gr8,~(L1_CACHE_BYTES-1),gr8 - -2: dci @(gr8,gr0) - ici @(gr8,gr0) - addi gr8,#L1_CACHE_BYTES,gr8 - cmp gr9,gr8,icc0 - bhi icc0,#2,2b - - membar - bralr - .size frv_cache_invalidate, .-frv_cache_invalidate - -############################################################################## -# -# Invalidate a range of icache -# - void frv_icache_invalidate(unsigned long start [GR8], unsigned long end [GR9]); -# -############################################################################### - .globl frv_icache_invalidate - .type frv_icache_invalidate,@function -frv_icache_invalidate: - andi gr8,~(L1_CACHE_BYTES-1),gr8 - -2: ici @(gr8,gr0) - addi gr8,#L1_CACHE_BYTES,gr8 - cmp gr9,gr8,icc0 - bhi icc0,#2,2b - - membar - bralr - .size frv_icache_invalidate, .-frv_icache_invalidate - -############################################################################### -# -# Write back and invalidate a range of dcache and icache -# - void frv_cache_wback_inv(unsigned long start [GR8], unsigned long end [GR9]) -# -############################################################################### - .globl frv_cache_wback_inv - .type frv_cache_wback_inv,@function -frv_cache_wback_inv: - andi gr8,~(L1_CACHE_BYTES-1),gr8 - -2: dcf @(gr8,gr0) - ici @(gr8,gr0) - addi gr8,#L1_CACHE_BYTES,gr8 - cmp gr9,gr8,icc0 - bhi icc0,#2,2b - - membar - bralr - .size frv_cache_wback_inv, .-frv_cache_wback_inv diff --git a/arch/frv/lib/checksum.c b/arch/frv/lib/checksum.c deleted file mode 100644 index 44e16d59bc108..0000000000000 --- a/arch/frv/lib/checksum.c +++ /dev/null @@ -1,166 +0,0 @@ -/* - * 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, - * Arnt Gulbrandsen, - * Tom May, - * Andreas Schwab, - * 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 -#include - -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; -} - -/* - * 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 - */ -__wsum csum_partial(const void *buff, int len, __wsum sum) -{ - unsigned int result = do_csum(buff, len); - - /* add in old sum, and carry.. */ - result += (__force u32)sum; - if ((__force u32)sum > result) - result += 1; - return (__force __wsum)result; -} - -EXPORT_SYMBOL(csum_partial); - -/* - * this routine is used for miscellaneous IP-like checksums, mainly - * in icmp.c - */ -__sum16 ip_compute_csum(const void *buff, int len) -{ - return (__force __sum16)~do_csum(buff, len); -} - -EXPORT_SYMBOL(ip_compute_csum); - -/* - * copy from fs while checksumming, otherwise like csum_partial - */ -__wsum -csum_partial_copy_from_user(const void __user *src, void *dst, - int len, __wsum sum, int *csum_err) -{ - int rem; - - if (csum_err) - *csum_err = 0; - - rem = copy_from_user(dst, src, len); - if (rem != 0) { - if (csum_err) - *csum_err = -EFAULT; - memset(dst + len - rem, 0, rem); - len = rem; - } - - return csum_partial(dst, len, sum); -} - -EXPORT_SYMBOL(csum_partial_copy_from_user); - -/* - * copy from ds while checksumming, otherwise like csum_partial - */ -__wsum -csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum) -{ - memcpy(dst, src, len); - return csum_partial(dst, len, sum); -} - -EXPORT_SYMBOL(csum_partial_copy_nocheck); diff --git a/arch/frv/lib/insl_ns.S b/arch/frv/lib/insl_ns.S deleted file mode 100644 index d1658425a9f72..0000000000000 --- a/arch/frv/lib/insl_ns.S +++ /dev/null @@ -1,52 +0,0 @@ -/* insl_ns.S: input array of 4b words from device port without byte swapping - * - * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - - - .text - .p2align 4 - -############################################################################### -# -# void __insl_ns(unsigned int port, void *buf, int n) -# -############################################################################### - .globl __insl_ns - .type __insl_ns,@function -__insl_ns: - andicc.p gr9,#3,gr0,icc0 - setlos #4,gr4 - bne icc0,#0,__insl_ns_misaligned - subi gr9,#4,gr9 -0: - ldi.p @(gr8,#0),gr5 - subicc gr10,#1,gr10,icc0 - stu.p gr5,@(gr9,gr4) - bhi icc0,#2,0b - bralr - -__insl_ns_misaligned: - subi.p gr9,#1,gr9 - setlos #1,gr4 -0: - ldi @(gr8,#0),gr5 - - srli gr5,#24,gr6 - stbu.p gr6,@(gr9,gr4) - srli gr5,#16,gr6 - stbu.p gr6,@(gr9,gr4) - srli gr5,#8,gr6 - stbu.p gr6,@(gr9,gr4) - subicc gr10,#1,gr10,icc0 - stbu.p gr5,@(gr9,gr4) - bhi icc0,#2,0b - bralr - - .size __insl_ns, .-__insl_ns diff --git a/arch/frv/lib/insl_sw.S b/arch/frv/lib/insl_sw.S deleted file mode 100644 index 9b5aa95d069b2..0000000000000 --- a/arch/frv/lib/insl_sw.S +++ /dev/null @@ -1,40 +0,0 @@ -/* insl_sw.S: input array of 4b words from device port with byte swapping - * - * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - - - .text - .p2align 4 - -############################################################################### -# -# void __insl_sw(unsigned int port, void *buf, int n) -# -############################################################################### - .globl __insl_sw - .type __insl_sw,@function -__insl_sw: - subi.p gr9,#1,gr9 - setlos #1,gr4 -0: - ldi.p @(gr8,#0),gr5 ; get 0xAABBCCDD - subicc gr10,#1,gr10,icc0 - - stbu.p gr5,@(gr9,gr4) ; write 0xDD - srli gr5,#8,gr5 - stbu.p gr5,@(gr9,gr4) ; write 0xCC - srli gr5,#8,gr5 - stbu.p gr5,@(gr9,gr4) ; write 0xBB - srli gr5,#8,gr5 - stbu.p gr5,@(gr9,gr4) ; write 0xAA - bhi icc0,#2,0b - bralr - - .size __insl_sw, .-__insl_sw diff --git a/arch/frv/lib/memcpy.S b/arch/frv/lib/memcpy.S deleted file mode 100644 index 9c5965273428b..0000000000000 --- a/arch/frv/lib/memcpy.S +++ /dev/null @@ -1,135 +0,0 @@ -/* memcpy.S: optimised assembly memcpy - * - * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - - - .text - .p2align 4 - -############################################################################### -# -# void *memcpy(void *to, const char *from, size_t count) -# -# - NOTE: must not use any stack. exception detection performs function return -# to caller's fixup routine, aborting the remainder of the copy -# -############################################################################### - .globl memcpy,__memcpy_end - .type memcpy,@function -memcpy: - or.p gr8,gr9,gr4 - orcc gr10,gr0,gr0,icc3 - or.p gr10,gr4,gr4 - beqlr icc3,#0 - - # optimise based on best common alignment for to, from & count - andicc.p gr4,#0x0f,gr0,icc0 - setlos #8,gr11 - andicc.p gr4,#0x07,gr0,icc1 - beq icc0,#0,memcpy_16 - andicc.p gr4,#0x03,gr0,icc0 - beq icc1,#0,memcpy_8 - andicc.p gr4,#0x01,gr0,icc1 - beq icc0,#0,memcpy_4 - setlos.p #1,gr11 - beq icc1,#0,memcpy_2 - - # do byte by byte copy - sub.p gr8,gr11,gr3 - sub gr9,gr11,gr9 -0: ldubu.p @(gr9,gr11),gr4 - subicc gr10,#1,gr10,icc0 - stbu.p gr4,@(gr3,gr11) - bne icc0,#2,0b - bralr - - # do halfword by halfword copy -memcpy_2: - setlos #2,gr11 - sub.p gr8,gr11,gr3 - sub gr9,gr11,gr9 -0: lduhu.p @(gr9,gr11),gr4 - subicc gr10,#2,gr10,icc0 - sthu.p gr4,@(gr3,gr11) - bne icc0,#2,0b - bralr - - # do word by word copy -memcpy_4: - setlos #4,gr11 - sub.p gr8,gr11,gr3 - sub gr9,gr11,gr9 -0: ldu.p @(gr9,gr11),gr4 - subicc gr10,#4,gr10,icc0 - stu.p gr4,@(gr3,gr11) - bne icc0,#2,0b - bralr - - # do double-word by double-word copy -memcpy_8: - sub.p gr8,gr11,gr3 - sub gr9,gr11,gr9 -0: lddu.p @(gr9,gr11),gr4 - subicc gr10,#8,gr10,icc0 - stdu.p gr4,@(gr3,gr11) - bne icc0,#2,0b - bralr - - # do quad-word by quad-word copy -memcpy_16: - sub.p gr8,gr11,gr3 - sub gr9,gr11,gr9 -0: lddu @(gr9,gr11),gr4 - lddu.p @(gr9,gr11),gr6 - subicc gr10,#16,gr10,icc0 - stdu gr4,@(gr3,gr11) - stdu.p gr6,@(gr3,gr11) - bne icc0,#2,0b - bralr -__memcpy_end: - - .size memcpy, __memcpy_end-memcpy - -############################################################################### -# -# copy to/from userspace -# - return the number of bytes that could not be copied (0 on complete success) -# -# long __memcpy_user(void *dst, const void *src, size_t count) -# -############################################################################### - .globl __memcpy_user, __memcpy_user_error_lr, __memcpy_user_error_handler - .type __memcpy_user,@function -__memcpy_user: - movsg lr,gr7 - subi.p sp,#8,sp - add gr8,gr10,gr6 ; calculate expected end address - stdi gr6,@(sp,#0) - - # abuse memcpy to do the dirty work - call memcpy -__memcpy_user_error_lr: - ldi.p @(sp,#4),gr7 - setlos #0,gr8 - jmpl.p @(gr7,gr0) - addi sp,#8,sp - - # deal any exception generated by memcpy - # GR8 - memcpy's current dest address - # GR11 - memset's step value (index register for store insns) -__memcpy_user_error_handler: - lddi.p @(sp,#0),gr4 ; load GR4 with dst+count, GR5 with ret addr - add gr11,gr3,gr7 - sub.p gr4,gr7,gr8 - - addi sp,#8,sp - jmpl @(gr5,gr0) - - .size __memcpy_user, .-__memcpy_user diff --git a/arch/frv/lib/memset.S b/arch/frv/lib/memset.S deleted file mode 100644 index 55a35263cbe37..0000000000000 --- a/arch/frv/lib/memset.S +++ /dev/null @@ -1,182 +0,0 @@ -/* memset.S: optimised assembly memset - * - * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - - - .text - .p2align 4 - -############################################################################### -# -# void *memset(void *p, char ch, size_t count) -# -# - NOTE: must not use any stack. exception detection performs function return -# to caller's fixup routine, aborting the remainder of the set -# GR4, GR7, GR8, and GR11 must be managed -# -############################################################################### - .globl memset,__memset_end - .type memset,@function -memset: - orcc.p gr10,gr0,gr5,icc3 ; GR5 = count - andi gr9,#0xff,gr9 - or.p gr8,gr0,gr4 ; GR4 = address - beqlr icc3,#0 - - # conditionally write a byte to 2b-align the address - setlos.p #1,gr6 - andicc gr4,#1,gr0,icc0 - ckne icc0,cc7 - cstb.p gr9,@(gr4,gr0) ,cc7,#1 - csubcc gr5,gr6,gr5 ,cc7,#1 ; also set ICC3 - cadd.p gr4,gr6,gr4 ,cc7,#1 - beqlr icc3,#0 - - # conditionally write a word to 4b-align the address - andicc.p gr4,#2,gr0,icc0 - subicc gr5,#2,gr0,icc1 - setlos.p #2,gr6 - ckne icc0,cc7 - slli.p gr9,#8,gr12 ; need to double up the pattern - cknc icc1,cc5 - or.p gr9,gr12,gr12 - andcr cc7,cc5,cc7 - - csth.p gr12,@(gr4,gr0) ,cc7,#1 - csubcc gr5,gr6,gr5 ,cc7,#1 ; also set ICC3 - cadd.p gr4,gr6,gr4 ,cc7,#1 - beqlr icc3,#0 - - # conditionally write a dword to 8b-align the address - andicc.p gr4,#4,gr0,icc0 - subicc gr5,#4,gr0,icc1 - setlos.p #4,gr6 - ckne icc0,cc7 - slli.p gr12,#16,gr13 ; need to quadruple-up the pattern - cknc icc1,cc5 - or.p gr13,gr12,gr12 - andcr cc7,cc5,cc7 - - cst.p gr12,@(gr4,gr0) ,cc7,#1 - csubcc gr5,gr6,gr5 ,cc7,#1 ; also set ICC3 - cadd.p gr4,gr6,gr4 ,cc7,#1 - beqlr icc3,#0 - - or.p gr12,gr12,gr13 ; need to octuple-up the pattern - - # the address is now 8b-aligned - loop around writing 64b chunks - setlos #8,gr7 - subi.p gr4,#8,gr4 ; store with update index does weird stuff - setlos #64,gr6 - - subicc gr5,#64,gr0,icc0 -0: cknc icc0,cc7 - cstdu gr12,@(gr4,gr7) ,cc7,#1 - cstdu gr12,@(gr4,gr7) ,cc7,#1 - cstdu gr12,@(gr4,gr7) ,cc7,#1 - cstdu gr12,@(gr4,gr7) ,cc7,#1 - cstdu gr12,@(gr4,gr7) ,cc7,#1 - cstdu.p gr12,@(gr4,gr7) ,cc7,#1 - csubcc gr5,gr6,gr5 ,cc7,#1 ; also set ICC3 - cstdu.p gr12,@(gr4,gr7) ,cc7,#1 - subicc gr5,#64,gr0,icc0 - cstdu.p gr12,@(gr4,gr7) ,cc7,#1 - beqlr icc3,#0 - bnc icc0,#2,0b - - # now do 32-byte remnant - subicc.p gr5,#32,gr0,icc0 - setlos #32,gr6 - cknc icc0,cc7 - cstdu.p gr12,@(gr4,gr7) ,cc7,#1 - csubcc gr5,gr6,gr5 ,cc7,#1 ; also set ICC3 - cstdu.p gr12,@(gr4,gr7) ,cc7,#1 - setlos #16,gr6 - cstdu.p gr12,@(gr4,gr7) ,cc7,#1 - subicc gr5,#16,gr0,icc0 - cstdu.p gr12,@(gr4,gr7) ,cc7,#1 - beqlr icc3,#0 - - # now do 16-byte remnant - cknc icc0,cc7 - cstdu.p gr12,@(gr4,gr7) ,cc7,#1 - csubcc gr5,gr6,gr5 ,cc7,#1 ; also set ICC3 - cstdu.p gr12,@(gr4,gr7) ,cc7,#1 - beqlr icc3,#0 - - # now do 8-byte remnant - subicc gr5,#8,gr0,icc1 - cknc icc1,cc7 - cstdu.p gr12,@(gr4,gr7) ,cc7,#1 - csubcc gr5,gr7,gr5 ,cc7,#1 ; also set ICC3 - setlos.p #4,gr7 - beqlr icc3,#0 - - # now do 4-byte remnant - subicc gr5,#4,gr0,icc0 - addi.p gr4,#4,gr4 - cknc icc0,cc7 - cstu.p gr12,@(gr4,gr7) ,cc7,#1 - csubcc gr5,gr7,gr5 ,cc7,#1 ; also set ICC3 - subicc.p gr5,#2,gr0,icc1 - beqlr icc3,#0 - - # now do 2-byte remnant - setlos #2,gr7 - addi.p gr4,#2,gr4 - cknc icc1,cc7 - csthu.p gr12,@(gr4,gr7) ,cc7,#1 - csubcc gr5,gr7,gr5 ,cc7,#1 ; also set ICC3 - subicc.p gr5,#1,gr0,icc0 - beqlr icc3,#0 - - # now do 1-byte remnant - setlos #0,gr7 - addi.p gr4,#2,gr4 - cknc icc0,cc7 - cstb.p gr12,@(gr4,gr0) ,cc7,#1 - bralr -__memset_end: - - .size memset, __memset_end-memset - -############################################################################### -# -# clear memory in userspace -# - return the number of bytes that could not be cleared (0 on complete success) -# -# long __memset_user(void *p, size_t count) -# -############################################################################### - .globl __memset_user, __memset_user_error_lr, __memset_user_error_handler - .type __memset_user,@function -__memset_user: - movsg lr,gr11 - - # abuse memset to do the dirty work - or.p gr9,gr9,gr10 - setlos #0,gr9 - call memset -__memset_user_error_lr: - jmpl.p @(gr11,gr0) - setlos #0,gr8 - - # deal any exception generated by memset - # GR4 - memset's address tracking pointer - # GR7 - memset's step value (index register for store insns) - # GR8 - memset's original start address - # GR10 - memset's original count -__memset_user_error_handler: - add.p gr4,gr7,gr4 - add gr8,gr10,gr8 - jmpl.p @(gr11,gr0) - sub gr8,gr4,gr8 ; we return the amount left uncleared - - .size __memset_user, .-__memset_user diff --git a/arch/frv/lib/outsl_ns.S b/arch/frv/lib/outsl_ns.S deleted file mode 100644 index 4cd4c46a69661..0000000000000 --- a/arch/frv/lib/outsl_ns.S +++ /dev/null @@ -1,59 +0,0 @@ -/* outsl_ns.S: output array of 4b words to device without byte swapping - * - * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - - - .text - .p2align 4 - -############################################################################### -# -# void __outsl_ns(unsigned int port, const void *buf, int n) -# -############################################################################### - .globl __outsl_ns - .type __outsl_ns,@function -__outsl_ns: - andicc.p gr9,#3,gr0,icc0 - setlos #4,gr4 - bne icc0,#0,__outsl_ns_misaligned - subi gr9,#4,gr9 -0: - ldu.p @(gr9,gr4),gr5 - subicc gr10,#1,gr10,icc0 - sti.p gr5,@(gr8,#0) - bhi icc0,#2,0b - - membar - bralr - -__outsl_ns_misaligned: - subi.p gr9,#1,gr9 - setlos #1,gr4 -0: - ldubu @(gr9,gr4),gr5 - ldubu.p @(gr9,gr4),gr6 - slli gr5,#8,gr5 - ldubu.p @(gr9,gr4),gr7 - or gr5,gr6,gr5 - ldubu.p @(gr9,gr4),gr6 - slli gr5,#16,gr5 - slli.p gr7,#8,gr7 - or gr5,gr6,gr5 - subicc.p gr10,#1,gr10,icc0 - or gr5,gr7,gr5 - - sti.p gr5,@(gr8,#0) - bhi icc0,#2,0b - - membar - bralr - - .size __outsl_ns, .-__outsl_ns diff --git a/arch/frv/lib/outsl_sw.S b/arch/frv/lib/outsl_sw.S deleted file mode 100644 index 7eb56d35a9567..0000000000000 --- a/arch/frv/lib/outsl_sw.S +++ /dev/null @@ -1,45 +0,0 @@ -/* outsl_ns.S: output array of 4b words to device with byte swapping - * - * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - - - .text - .p2align 4 - -############################################################################### -# -# void __outsl_sw(unsigned int port, const void *buf, int n) -# -############################################################################### - .globl __outsl_sw - .type __outsl_sw,@function -__outsl_sw: - subi.p gr9,#1,gr9 - setlos #1,gr4 -0: - ldubu @(gr9,gr4),gr5 - ldubu @(gr9,gr4),gr6 - slli gr6,#8,gr6 - ldubu.p @(gr9,gr4),gr7 - or gr5,gr6,gr5 - ldubu.p @(gr9,gr4),gr6 - slli gr7,#16,gr7 - slli.p gr6,#24,gr6 - or gr5,gr7,gr5 - subicc.p gr10,#1,gr10,icc0 - or gr5,gr6,gr5 - - sti.p gr5,@(gr8,#0) - bhi icc0,#2,0b - - membar - bralr - - .size __outsl_sw, .-__outsl_sw diff --git a/arch/frv/mb93090-mb00/Makefile b/arch/frv/mb93090-mb00/Makefile deleted file mode 100644 index bcb03ebb3583b..0000000000000 --- a/arch/frv/mb93090-mb00/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# -# Makefile for the MB93090-MB00 motherboard stuff -# - -ifeq "$(CONFIG_PCI)" "y" -obj-y := pci-frv.o pci-irq.o pci-vdk.o - -ifeq "$(CONFIG_MMU)" "y" -obj-y += pci-dma.o -else -obj-y += pci-dma-nommu.o -endif -endif - -obj-$(CONFIG_MTD) += flash.o diff --git a/arch/frv/mb93090-mb00/flash.c b/arch/frv/mb93090-mb00/flash.c deleted file mode 100644 index e1cf802d1639b..0000000000000 --- a/arch/frv/mb93090-mb00/flash.c +++ /dev/null @@ -1,90 +0,0 @@ -/* Flash mappings for the MB93090-MB00 motherboard - * - * Copyright (C) 2009 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public Licence - * as published by the Free Software Foundation; either version - * 2 of the Licence, or (at your option) any later version. - */ - -#include -#include -#include -#include - -#define MB93090_BOOTROM_ADDR 0xFF000000 /* Boot ROM */ -#define MB93090_BOOTROM_SIZE (2 * 1024 * 1024) -#define MB93090_USERROM_ADDR 0xFF200000 /* User ROM */ -#define MB93090_USERROM_SIZE (2 * 1024 * 1024) - -/* - * default MTD partition table for both main flash devices, expected to be - * overridden by RedBoot - */ -static struct mtd_partition mb93090_partitions[] = { - { - .name = "Filesystem", - .size = MTDPART_SIZ_FULL, - .offset = 0, - } -}; - -/* - * Definition of the MB93090 Boot ROM (on the CPU card) - */ -static struct physmap_flash_data mb93090_bootrom_data = { - .width = 2, - .nr_parts = 2, - .parts = mb93090_partitions, -}; - -static struct resource mb93090_bootrom_resource = { - .start = MB93090_BOOTROM_ADDR, - .end = MB93090_BOOTROM_ADDR + MB93090_BOOTROM_SIZE - 1, - .flags = IORESOURCE_MEM, -}; - -static struct platform_device mb93090_bootrom = { - .name = "physmap-flash", - .id = 0, - .dev.platform_data = &mb93090_bootrom_data, - .num_resources = 1, - .resource = &mb93090_bootrom_resource, -}; - -/* - * Definition of the MB93090 User ROM definition (on the motherboard) - */ -static struct physmap_flash_data mb93090_userrom_data = { - .width = 2, - .nr_parts = 2, - .parts = mb93090_partitions, -}; - -static struct resource mb93090_userrom_resource = { - .start = MB93090_USERROM_ADDR, - .end = MB93090_USERROM_ADDR + MB93090_USERROM_SIZE - 1, - .flags = IORESOURCE_MEM, -}; - -static struct platform_device mb93090_userrom = { - .name = "physmap-flash", - .id = 1, - .dev.platform_data = &mb93090_userrom_data, - .num_resources = 1, - .resource = &mb93090_userrom_resource, -}; - -/* - * register the MB93090 flashes - */ -static int __init mb93090_mtd_init(void) -{ - platform_device_register(&mb93090_bootrom); - platform_device_register(&mb93090_userrom); - return 0; -} - -module_init(mb93090_mtd_init); diff --git a/arch/frv/mb93090-mb00/pci-dma-nommu.c b/arch/frv/mb93090-mb00/pci-dma-nommu.c deleted file mode 100644 index 4a96de7f0af4e..0000000000000 --- a/arch/frv/mb93090-mb00/pci-dma-nommu.c +++ /dev/null @@ -1,176 +0,0 @@ -/* pci-dma-nommu.c: Dynamic DMA mapping support for the FRV - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Woodhouse (dwmw2@infradead.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. - */ - -#include -#include -#include -#include -#include -#include -#include - -#if 1 -#define DMA_SRAM_START dma_coherent_mem_start -#define DMA_SRAM_END dma_coherent_mem_end -#else // Use video RAM on Matrox -#define DMA_SRAM_START 0xe8900000 -#define DMA_SRAM_END 0xe8a00000 -#endif - -struct dma_alloc_record { - struct list_head list; - unsigned long ofs; - unsigned long len; -}; - -static DEFINE_SPINLOCK(dma_alloc_lock); -static LIST_HEAD(dma_alloc_list); - -static void *frv_dma_alloc(struct device *hwdev, size_t size, dma_addr_t *dma_handle, - gfp_t gfp, unsigned long attrs) -{ - struct dma_alloc_record *new; - struct list_head *this = &dma_alloc_list; - unsigned long flags; - unsigned long start = DMA_SRAM_START; - unsigned long end; - - if (!DMA_SRAM_START) { - printk("%s called without any DMA area reserved!\n", __func__); - return NULL; - } - - new = kmalloc(sizeof (*new), GFP_ATOMIC); - if (!new) - return NULL; - - /* Round up to a reasonable alignment */ - new->len = (size + 31) & ~31; - - spin_lock_irqsave(&dma_alloc_lock, flags); - - list_for_each (this, &dma_alloc_list) { - struct dma_alloc_record *this_r = list_entry(this, struct dma_alloc_record, list); - end = this_r->ofs; - - if (end - start >= size) - goto gotone; - - start = this_r->ofs + this_r->len; - } - /* Reached end of list. */ - end = DMA_SRAM_END; - this = &dma_alloc_list; - - if (end - start >= size) { - gotone: - new->ofs = start; - list_add_tail(&new->list, this); - spin_unlock_irqrestore(&dma_alloc_lock, flags); - - *dma_handle = start; - return (void *)start; - } - - kfree(new); - spin_unlock_irqrestore(&dma_alloc_lock, flags); - return NULL; -} - -static void frv_dma_free(struct device *hwdev, size_t size, void *vaddr, - dma_addr_t dma_handle, unsigned long attrs) -{ - struct dma_alloc_record *rec; - unsigned long flags; - - spin_lock_irqsave(&dma_alloc_lock, flags); - - list_for_each_entry(rec, &dma_alloc_list, list) { - if (rec->ofs == dma_handle) { - list_del(&rec->list); - kfree(rec); - spin_unlock_irqrestore(&dma_alloc_lock, flags); - return; - } - } - spin_unlock_irqrestore(&dma_alloc_lock, flags); - BUG(); -} - -static int frv_dma_map_sg(struct device *dev, struct scatterlist *sglist, - int nents, enum dma_data_direction direction, - unsigned long attrs) -{ - struct scatterlist *sg; - int i; - - BUG_ON(direction == DMA_NONE); - - if (attrs & DMA_ATTR_SKIP_CPU_SYNC) - return nents; - - for_each_sg(sglist, sg, nents, i) { - frv_cache_wback_inv(sg_dma_address(sg), - sg_dma_address(sg) + sg_dma_len(sg)); - } - - return nents; -} - -static dma_addr_t frv_dma_map_page(struct device *dev, struct page *page, - unsigned long offset, size_t size, - enum dma_data_direction direction, unsigned long attrs) -{ - BUG_ON(direction == DMA_NONE); - - if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC)) - flush_dcache_page(page); - - return (dma_addr_t) page_to_phys(page) + offset; -} - -static void frv_dma_sync_single_for_device(struct device *dev, - dma_addr_t dma_handle, size_t size, - enum dma_data_direction direction) -{ - flush_write_buffers(); -} - -static void frv_dma_sync_sg_for_device(struct device *dev, - struct scatterlist *sg, int nelems, - enum dma_data_direction direction) -{ - flush_write_buffers(); -} - - -static int frv_dma_supported(struct device *dev, u64 mask) -{ - /* - * we fall back to GFP_DMA when the mask isn't all 1s, - * so we can't guarantee allocations that must be - * within a tighter range than GFP_DMA.. - */ - if (mask < 0x00ffffff) - return 0; - return 1; -} - -const struct dma_map_ops frv_dma_ops = { - .alloc = frv_dma_alloc, - .free = frv_dma_free, - .map_page = frv_dma_map_page, - .map_sg = frv_dma_map_sg, - .sync_single_for_device = frv_dma_sync_single_for_device, - .sync_sg_for_device = frv_dma_sync_sg_for_device, - .dma_supported = frv_dma_supported, -}; -EXPORT_SYMBOL(frv_dma_ops); diff --git a/arch/frv/mb93090-mb00/pci-dma.c b/arch/frv/mb93090-mb00/pci-dma.c deleted file mode 100644 index e7130abc0dae6..0000000000000 --- a/arch/frv/mb93090-mb00/pci-dma.c +++ /dev/null @@ -1,118 +0,0 @@ -/* pci-dma.c: Dynamic DMA mapping support for the FRV CPUs that have MMUs - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -static void *frv_dma_alloc(struct device *hwdev, size_t size, - dma_addr_t *dma_handle, gfp_t gfp, unsigned long attrs) -{ - void *ret; - - ret = consistent_alloc(gfp, size, dma_handle); - if (ret) - memset(ret, 0, size); - - return ret; -} - -static void frv_dma_free(struct device *hwdev, size_t size, void *vaddr, - dma_addr_t dma_handle, unsigned long attrs) -{ - consistent_free(vaddr); -} - -static int frv_dma_map_sg(struct device *dev, struct scatterlist *sglist, - int nents, enum dma_data_direction direction, - unsigned long attrs) -{ - struct scatterlist *sg; - unsigned long dampr2; - void *vaddr; - int i; - - BUG_ON(direction == DMA_NONE); - - if (attrs & DMA_ATTR_SKIP_CPU_SYNC) - return nents; - - dampr2 = __get_DAMPR(2); - - for_each_sg(sglist, sg, nents, i) { - vaddr = kmap_atomic_primary(sg_page(sg)); - - frv_dcache_writeback((unsigned long) vaddr, - (unsigned long) vaddr + PAGE_SIZE); - - } - - kunmap_atomic_primary(vaddr); - if (dampr2) { - __set_DAMPR(2, dampr2); - __set_IAMPR(2, dampr2); - } - - return nents; -} - -static dma_addr_t frv_dma_map_page(struct device *dev, struct page *page, - unsigned long offset, size_t size, - enum dma_data_direction direction, unsigned long attrs) -{ - if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC)) - flush_dcache_page(page); - - return (dma_addr_t) page_to_phys(page) + offset; -} - -static void frv_dma_sync_single_for_device(struct device *dev, - dma_addr_t dma_handle, size_t size, - enum dma_data_direction direction) -{ - flush_write_buffers(); -} - -static void frv_dma_sync_sg_for_device(struct device *dev, - struct scatterlist *sg, int nelems, - enum dma_data_direction direction) -{ - flush_write_buffers(); -} - - -static int frv_dma_supported(struct device *dev, u64 mask) -{ - /* - * we fall back to GFP_DMA when the mask isn't all 1s, - * so we can't guarantee allocations that must be - * within a tighter range than GFP_DMA.. - */ - if (mask < 0x00ffffff) - return 0; - return 1; -} - -const struct dma_map_ops frv_dma_ops = { - .alloc = frv_dma_alloc, - .free = frv_dma_free, - .map_page = frv_dma_map_page, - .map_sg = frv_dma_map_sg, - .sync_single_for_device = frv_dma_sync_single_for_device, - .sync_sg_for_device = frv_dma_sync_sg_for_device, - .dma_supported = frv_dma_supported, -}; -EXPORT_SYMBOL(frv_dma_ops); diff --git a/arch/frv/mb93090-mb00/pci-frv.c b/arch/frv/mb93090-mb00/pci-frv.c deleted file mode 100644 index c452ddb5620f2..0000000000000 --- a/arch/frv/mb93090-mb00/pci-frv.c +++ /dev/null @@ -1,193 +0,0 @@ -/* pci-frv.c: low-level PCI access routines - * - * Copyright (C) 2003-5 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - Derived from the i386 equivalent stuff - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include - -#include "pci-frv.h" - -/* - * We need to avoid collisions with `mirrored' VGA ports - * and other strange ISA hardware, so we always want the - * addresses to be allocated in the 0x000-0x0ff region - * modulo 0x400. - * - * Why? Because some silly external IO cards only decode - * the low 10 bits of the IO address. The 0x00-0xff region - * is reserved for motherboard devices that decode all 16 - * bits, so it's ok to allocate at, say, 0x2800-0x28ff, - * but we want to try to avoid allocating at 0x2900-0x2bff - * which might have be mirrored at 0x0100-0x03ff.. - */ -resource_size_t -pcibios_align_resource(void *data, const struct resource *res, - resource_size_t size, resource_size_t align) -{ - resource_size_t start = res->start; - - if ((res->flags & IORESOURCE_IO) && (start & 0x300)) - start = (start + 0x3ff) & ~0x3ff; - - return start; -} - - -/* - * Handle resources of PCI devices. If the world were perfect, we could - * just allocate all the resource regions and do nothing more. It isn't. - * On the other hand, we cannot just re-allocate all devices, as it would - * require us to know lots of host bridge internals. So we attempt to - * keep as much of the original configuration as possible, but tweak it - * when it's found to be wrong. - * - * Known BIOS problems we have to work around: - * - I/O or memory regions not configured - * - regions configured, but not enabled in the command register - * - bogus I/O addresses above 64K used - * - expansion ROMs left enabled (this may sound harmless, but given - * the fact the PCI specs explicitly allow address decoders to be - * shared between expansion ROMs and other resource regions, it's - * at least dangerous) - * - * Our solution: - * (1) Allocate resources for all buses behind PCI-to-PCI bridges. - * This gives us fixed barriers on where we can allocate. - * (2) Allocate resources for all enabled devices. If there is - * a collision, just mark the resource as unallocated. Also - * disable expansion ROMs during this step. - * (3) Try to allocate resources for disabled devices. If the - * resources were assigned correctly, everything goes well, - * if they weren't, they won't disturb allocation of other - * resources. - * (4) Assign new addresses to resources which were either - * not configured at all or misconfigured. If explicitly - * requested by the user, configure expansion ROM address - * as well. - */ - -static void __init pcibios_allocate_bus_resources(struct list_head *bus_list) -{ - struct list_head *ln; - struct pci_bus *bus; - struct pci_dev *dev; - int idx; - struct resource *r; - - /* Depth-First Search on bus tree */ - for (ln=bus_list->next; ln != bus_list; ln=ln->next) { - bus = list_entry(ln, struct pci_bus, node); - if ((dev = bus->self)) { - for (idx = PCI_BRIDGE_RESOURCES; idx < PCI_NUM_RESOURCES; idx++) { - r = &dev->resource[idx]; - if (!r->start) - continue; - pci_claim_bridge_resource(dev, idx); - } - } - pcibios_allocate_bus_resources(&bus->children); - } -} - -static void __init pcibios_allocate_resources(int pass) -{ - struct pci_dev *dev = NULL; - int idx, disabled; - u16 command; - struct resource *r; - - for_each_pci_dev(dev) { - pci_read_config_word(dev, PCI_COMMAND, &command); - for(idx = 0; idx < 6; idx++) { - r = &dev->resource[idx]; - if (r->parent) /* Already allocated */ - continue; - if (!r->start) /* Address not assigned at all */ - continue; - if (r->flags & IORESOURCE_IO) - disabled = !(command & PCI_COMMAND_IO); - else - disabled = !(command & PCI_COMMAND_MEMORY); - if (pass == disabled) { - DBG("PCI: Resource %08lx-%08lx (f=%lx, d=%d, p=%d)\n", - r->start, r->end, r->flags, disabled, pass); - if (pci_claim_resource(dev, idx) < 0) { - /* We'll assign a new address later */ - r->end -= r->start; - r->start = 0; - } - } - } - if (!pass) { - r = &dev->resource[PCI_ROM_RESOURCE]; - if (r->flags & IORESOURCE_ROM_ENABLE) { - /* Turn the ROM off, leave the resource region, but keep it unregistered. */ - u32 reg; - DBG("PCI: Switching off ROM of %s\n", pci_name(dev)); - r->flags &= ~IORESOURCE_ROM_ENABLE; - pci_read_config_dword(dev, dev->rom_base_reg, ®); - pci_write_config_dword(dev, dev->rom_base_reg, reg & ~PCI_ROM_ADDRESS_ENABLE); - } - } - } -} - -static void __init pcibios_assign_resources(void) -{ - struct pci_dev *dev = NULL; - int idx, err; - struct resource *r; - - for_each_pci_dev(dev) { - int class = dev->class >> 8; - - /* Don't touch classless devices and host bridges */ - if (!class || class == PCI_CLASS_BRIDGE_HOST) - continue; - - for(idx=0; idx<6; idx++) { - r = &dev->resource[idx]; - - /* - * Don't touch IDE controllers and I/O ports of video cards! - */ - if ((class == PCI_CLASS_STORAGE_IDE && idx < 4) || - (class == PCI_CLASS_DISPLAY_VGA && (r->flags & IORESOURCE_IO))) - continue; - - /* - * We shall assign a new address to this resource, either because - * the BIOS forgot to do so or because we have decided the old - * address was unusable for some reason. - */ - if (!r->start && r->end) { - err = pci_assign_resource(dev, idx); - if (err) - dev_err(&dev->dev, - "Failed to assign new address to %d\n", - idx); - } - } - } -} - -void __init pcibios_resource_survey(void) -{ - DBG("PCI: Allocating resources\n"); - pcibios_allocate_bus_resources(&pci_root_buses); - pcibios_allocate_resources(0); - pcibios_allocate_resources(1); - pcibios_assign_resources(); -} diff --git a/arch/frv/mb93090-mb00/pci-frv.h b/arch/frv/mb93090-mb00/pci-frv.h deleted file mode 100644 index 41fbb6bae558d..0000000000000 --- a/arch/frv/mb93090-mb00/pci-frv.h +++ /dev/null @@ -1,33 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Low-Level PCI Access for FRV machines. - * - * (c) 1999 Martin Mares - */ - -#include - -#undef DEBUG - -#ifdef DEBUG -#define DBG(x...) printk(x) -#else -#define DBG(x...) -#endif - -extern unsigned int __nongpreldata pci_probe; - -/* pci-frv.c */ - -void pcibios_resource_survey(void); - -/* pci-vdk.c */ - -extern struct pci_ops *__nongpreldata pci_root_ops; - -/* pci-irq.c */ -extern unsigned int pcibios_irq_mask; - -void pcibios_irq_init(void); -void pcibios_fixup_irqs(void); -void pcibios_enable_irq(struct pci_dev *dev); diff --git a/arch/frv/mb93090-mb00/pci-irq.c b/arch/frv/mb93090-mb00/pci-irq.c deleted file mode 100644 index a40aa8663056f..0000000000000 --- a/arch/frv/mb93090-mb00/pci-irq.c +++ /dev/null @@ -1,62 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* pci-irq.c: PCI IRQ routing on the FRV motherboard - * - * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * derived from: arch/i386/kernel/pci-irq.c: (c) 1999--2000 Martin Mares - */ - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "pci-frv.h" - -/* - * DEVICE DEVNO INT#A INT#B INT#C INT#D - * ======= ======= ======= ======= ======= ======= - * MB86943 0 fpga.10 - - - - * RTL8029 16 fpga.12 - - - - * SLOT 1 19 fpga.6 fpga.5 fpga.4 fpga.3 - * SLOT 2 18 fpga.5 fpga.4 fpga.3 fpga.6 - * SLOT 3 17 fpga.4 fpga.3 fpga.6 fpga.5 - * - */ - -static const uint8_t __initconst pci_bus0_irq_routing[32][4] = { - [0 ] = { IRQ_FPGA_MB86943_PCI_INTA }, - [16] = { IRQ_FPGA_RTL8029_INTA }, - [17] = { IRQ_FPGA_PCI_INTC, IRQ_FPGA_PCI_INTD, IRQ_FPGA_PCI_INTA, IRQ_FPGA_PCI_INTB }, - [18] = { IRQ_FPGA_PCI_INTB, IRQ_FPGA_PCI_INTC, IRQ_FPGA_PCI_INTD, IRQ_FPGA_PCI_INTA }, - [19] = { IRQ_FPGA_PCI_INTA, IRQ_FPGA_PCI_INTB, IRQ_FPGA_PCI_INTC, IRQ_FPGA_PCI_INTD }, -}; - -void __init pcibios_irq_init(void) -{ -} - -void __init pcibios_fixup_irqs(void) -{ - struct pci_dev *dev = NULL; - uint8_t line, pin; - - for_each_pci_dev(dev) { - pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin); - if (pin) { - dev->irq = pci_bus0_irq_routing[PCI_SLOT(dev->devfn)][pin - 1]; - pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq); - } - pci_read_config_byte(dev, PCI_INTERRUPT_LINE, &line); - } -} - -void pcibios_enable_irq(struct pci_dev *dev) -{ - pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq); -} diff --git a/arch/frv/mb93090-mb00/pci-vdk.c b/arch/frv/mb93090-mb00/pci-vdk.c deleted file mode 100644 index f211839e2cae1..0000000000000 --- a/arch/frv/mb93090-mb00/pci-vdk.c +++ /dev/null @@ -1,419 +0,0 @@ -/* pci-vdk.c: MB93090-MB00 (VDK) PCI support - * - * Copyright (C) 2003, 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include "pci-frv.h" - -unsigned int __nongpreldata pci_probe = 1; - -struct pci_ops *__nongpreldata pci_root_ops; - -/* - * The accessible PCI window does not cover the entire CPU address space, but - * there are devices we want to access outside of that window, so we need to - * insert specific PCI bus resources instead of using the platform-level bus - * resources directly for the PCI root bus. - * - * These are configured and inserted by pcibios_init() and are attached to the - * root bus by pcibios_fixup_bus(). - */ -static struct resource pci_ioport_resource = { - .name = "PCI IO", - .start = 0, - .end = IO_SPACE_LIMIT, - .flags = IORESOURCE_IO, -}; - -static struct resource pci_iomem_resource = { - .name = "PCI mem", - .start = 0, - .end = -1, - .flags = IORESOURCE_MEM, -}; - -/* - * Functions for accessing PCI configuration space - */ - -#define CONFIG_CMD(bus, dev, where) \ - (0x80000000 | (bus->number << 16) | (devfn << 8) | (where & ~3)) - -#define __set_PciCfgAddr(A) writel((A), (volatile void __iomem *) __region_CS1 + 0x80) - -#define __get_PciCfgDataB(A) readb((volatile void __iomem *) __region_CS1 + 0x88 + ((A) & 3)) -#define __get_PciCfgDataW(A) readw((volatile void __iomem *) __region_CS1 + 0x88 + ((A) & 2)) -#define __get_PciCfgDataL(A) readl((volatile void __iomem *) __region_CS1 + 0x88) - -#define __set_PciCfgDataB(A,V) \ - writeb((V), (volatile void __iomem *) __region_CS1 + 0x88 + (3 - ((A) & 3))) - -#define __set_PciCfgDataW(A,V) \ - writew((V), (volatile void __iomem *) __region_CS1 + 0x88 + (2 - ((A) & 2))) - -#define __set_PciCfgDataL(A,V) \ - writel((V), (volatile void __iomem *) __region_CS1 + 0x88) - -#define __get_PciBridgeDataB(A) readb((volatile void __iomem *) __region_CS1 + 0x800 + (A)) -#define __get_PciBridgeDataW(A) readw((volatile void __iomem *) __region_CS1 + 0x800 + (A)) -#define __get_PciBridgeDataL(A) readl((volatile void __iomem *) __region_CS1 + 0x800 + (A)) - -#define __set_PciBridgeDataB(A,V) writeb((V), (volatile void __iomem *) __region_CS1 + 0x800 + (A)) -#define __set_PciBridgeDataW(A,V) writew((V), (volatile void __iomem *) __region_CS1 + 0x800 + (A)) -#define __set_PciBridgeDataL(A,V) writel((V), (volatile void __iomem *) __region_CS1 + 0x800 + (A)) - -static inline int __query(const struct pci_dev *dev) -{ -// return dev->bus->number==0 && (dev->devfn==PCI_DEVFN(0,0)); -// return dev->bus->number==1; -// return dev->bus->number==0 && -// (dev->devfn==PCI_DEVFN(2,0) || dev->devfn==PCI_DEVFN(3,0)); - return 0; -} - -/*****************************************************************************/ -/* - * - */ -static int pci_frv_read_config(struct pci_bus *bus, unsigned int devfn, int where, int size, - u32 *val) -{ - u32 _value; - - if (bus->number == 0 && devfn == PCI_DEVFN(0, 0)) { - _value = __get_PciBridgeDataL(where & ~3); - } - else { - __set_PciCfgAddr(CONFIG_CMD(bus, devfn, where)); - _value = __get_PciCfgDataL(where & ~3); - } - - switch (size) { - case 1: - _value = _value >> ((where & 3) * 8); - break; - - case 2: - _value = _value >> ((where & 2) * 8); - break; - - case 4: - break; - - default: - BUG(); - } - - *val = _value; - return PCIBIOS_SUCCESSFUL; -} - -static int pci_frv_write_config(struct pci_bus *bus, unsigned int devfn, int where, int size, - u32 value) -{ - switch (size) { - case 1: - if (bus->number == 0 && devfn == PCI_DEVFN(0, 0)) { - __set_PciBridgeDataB(where, value); - } - else { - __set_PciCfgAddr(CONFIG_CMD(bus, devfn, where)); - __set_PciCfgDataB(where, value); - } - break; - - case 2: - if (bus->number == 0 && devfn == PCI_DEVFN(0, 0)) { - __set_PciBridgeDataW(where, value); - } - else { - __set_PciCfgAddr(CONFIG_CMD(bus, devfn, where)); - __set_PciCfgDataW(where, value); - } - break; - - case 4: - if (bus->number == 0 && devfn == PCI_DEVFN(0, 0)) { - __set_PciBridgeDataL(where, value); - } - else { - __set_PciCfgAddr(CONFIG_CMD(bus, devfn, where)); - __set_PciCfgDataL(where, value); - } - break; - - default: - BUG(); - } - - return PCIBIOS_SUCCESSFUL; -} - -static struct pci_ops pci_direct_frv = { - .read = pci_frv_read_config, - .write = pci_frv_write_config, -}; - -/* - * Before we decide to use direct hardware access mechanisms, we try to do some - * trivial checks to ensure it at least _seems_ to be working -- we just test - * whether bus 00 contains a host bridge (this is similar to checking - * techniques used in XFree86, but ours should be more reliable since we - * attempt to make use of direct access hints provided by the PCI BIOS). - * - * This should be close to trivial, but it isn't, because there are buggy - * chipsets (yes, you guessed it, by Intel and Compaq) that have no class ID. - */ -static int __init pci_sanity_check(struct pci_ops *o) -{ - struct pci_bus bus; /* Fake bus and device */ - u32 id; - - bus.number = 0; - - if (o->read(&bus, 0, PCI_VENDOR_ID, 4, &id) == PCIBIOS_SUCCESSFUL) { - printk("PCI: VDK Bridge device:vendor: %08x\n", id); - if (id == 0x200e10cf) - return 1; - } - - printk("PCI: VDK Bridge: Sanity check failed\n"); - return 0; -} - -static struct pci_ops * __init pci_check_direct(void) -{ - unsigned long flags; - - local_irq_save(flags); - - /* check if access works */ - if (pci_sanity_check(&pci_direct_frv)) { - local_irq_restore(flags); - printk("PCI: Using configuration frv\n"); -// request_mem_region(0xBE040000, 256, "FRV bridge"); -// request_mem_region(0xBFFFFFF4, 12, "PCI frv"); - return &pci_direct_frv; - } - - local_irq_restore(flags); - return NULL; -} - -/* - * Exceptions for specific devices. Usually work-arounds for fatal design flaws. - */ - -static void __init pci_fixup_umc_ide(struct pci_dev *d) -{ - /* - * UM8886BF IDE controller sets region type bits incorrectly, - * therefore they look like memory despite of them being I/O. - */ - int i; - - printk("PCI: Fixing base address flags for device %s\n", pci_name(d)); - for(i=0; i<4; i++) - d->resource[i].flags |= PCI_BASE_ADDRESS_SPACE_IO; -} - -static void pci_fixup_ide_bases(struct pci_dev *d) -{ - int i; - - /* - * PCI IDE controllers use non-standard I/O port decoding, respect it. - */ - if ((d->class >> 8) != PCI_CLASS_STORAGE_IDE) - return; - printk("PCI: IDE base address fixup for %s\n", pci_name(d)); - for(i=0; i<4; i++) { - struct resource *r = &d->resource[i]; - if ((r->start & ~0x80) == 0x374) { - r->start |= 2; - r->end = r->start; - } - } -} - -static void pci_fixup_ide_trash(struct pci_dev *d) -{ - int i; - - /* - * There exist PCI IDE controllers which have utter garbage - * in first four base registers. Ignore that. - */ - printk("PCI: IDE base address trash cleared for %s\n", pci_name(d)); - for(i=0; i<4; i++) - d->resource[i].start = d->resource[i].end = d->resource[i].flags = 0; -} - -static void pci_fixup_latency(struct pci_dev *d) -{ - /* - * SiS 5597 and 5598 chipsets require latency timer set to - * at most 32 to avoid lockups. - */ - DBG("PCI: Setting max latency to 32\n"); - pcibios_max_latency = 32; -} - -DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_UMC, PCI_DEVICE_ID_UMC_UM8886BF, pci_fixup_umc_ide); -DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_5513, pci_fixup_ide_trash); -DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_5597, pci_fixup_latency); -DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_5598, pci_fixup_latency); -DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pci_fixup_ide_bases); - -/* - * Called after each bus is probed, but before its children - * are examined. - */ - -void pcibios_fixup_bus(struct pci_bus *bus) -{ -#if 0 - printk("### PCIBIOS_FIXUP_BUS(%d)\n",bus->number); -#endif - - pci_read_bridge_bases(bus); - - if (bus->number == 0) { - struct pci_dev *dev; - list_for_each_entry(dev, &bus->devices, bus_list) { - if (dev->devfn == 0) { - dev->resource[0].start = 0; - dev->resource[0].end = 0; - } - } - } -} - -/* - * Initialization. Try all known PCI access methods. Note that we support - * using both PCI BIOS and direct access: in such cases, we use I/O ports - * to access config space, but we still keep BIOS order of cards to be - * compatible with 2.0.X. This should go away some day. - */ - -int __init pcibios_init(void) -{ - struct pci_bus *bus; - struct pci_ops *dir = NULL; - LIST_HEAD(resources); - - if (!mb93090_mb00_detected) - return -ENXIO; - - __reg_MB86943_sl_ctl |= MB86943_SL_CTL_DRCT_MASTER_SWAP | MB86943_SL_CTL_DRCT_SLAVE_SWAP; - - __reg_MB86943_ecs_base(1) = ((__region_CS2 + 0x01000000) >> 9) | 0x08000000; - __reg_MB86943_ecs_base(2) = ((__region_CS2 + 0x00000000) >> 9) | 0x08000000; - - *(volatile uint32_t *) (__region_CS1 + 0x848) = 0xe0000000; - *(volatile uint32_t *) (__region_CS1 + 0x8b8) = 0x00000000; - - __reg_MB86943_sl_pci_io_base = (__region_CS2 + 0x04000000) >> 9; - __reg_MB86943_sl_pci_mem_base = (__region_CS2 + 0x08000000) >> 9; - __reg_MB86943_pci_sl_io_base = __region_CS2 + 0x04000000; - __reg_MB86943_pci_sl_mem_base = __region_CS2 + 0x08000000; - mb(); - - /* enable PCI arbitration */ - __reg_MB86943_pci_arbiter = MB86943_PCIARB_EN; - - pci_ioport_resource.start = (__reg_MB86943_sl_pci_io_base << 9) & 0xfffffc00; - pci_ioport_resource.end = (__reg_MB86943_sl_pci_io_range << 9) | 0x3ff; - pci_ioport_resource.end += pci_ioport_resource.start; - - printk("PCI IO window: %08llx-%08llx\n", - (unsigned long long) pci_ioport_resource.start, - (unsigned long long) pci_ioport_resource.end); - - pci_iomem_resource.start = (__reg_MB86943_sl_pci_mem_base << 9) & 0xfffffc00; - pci_iomem_resource.end = (__reg_MB86943_sl_pci_mem_range << 9) | 0x3ff; - pci_iomem_resource.end += pci_iomem_resource.start; - - /* Reserve somewhere to write to flush posted writes. This is used by - * __flush_PCI_writes() from asm/io.h to force the write FIFO in the - * CPU-PCI bridge to flush as this doesn't happen automatically when a - * read is performed on the MB93090 development kit motherboard. - */ - pci_iomem_resource.start += 0x400; - - printk("PCI MEM window: %08llx-%08llx\n", - (unsigned long long) pci_iomem_resource.start, - (unsigned long long) pci_iomem_resource.end); - printk("PCI DMA memory: %08lx-%08lx\n", - dma_coherent_mem_start, dma_coherent_mem_end); - - if (insert_resource(&iomem_resource, &pci_iomem_resource) < 0) - panic("Unable to insert PCI IOMEM resource\n"); - if (insert_resource(&ioport_resource, &pci_ioport_resource) < 0) - panic("Unable to insert PCI IOPORT resource\n"); - - if (!pci_probe) - return -ENXIO; - - dir = pci_check_direct(); - if (dir) - pci_root_ops = dir; - else { - printk("PCI: No PCI bus detected\n"); - return -ENXIO; - } - - printk("PCI: Probing PCI hardware\n"); - pci_add_resource(&resources, &pci_ioport_resource); - pci_add_resource(&resources, &pci_iomem_resource); - bus = pci_scan_root_bus(NULL, 0, pci_root_ops, NULL, &resources); - - pcibios_irq_init(); - pcibios_fixup_irqs(); - pcibios_resource_survey(); - if (!bus) - return 0; - - pci_bus_add_devices(bus); - return 0; -} - -arch_initcall(pcibios_init); - -char * __init pcibios_setup(char *str) -{ - if (!strcmp(str, "off")) { - pci_probe = 0; - return NULL; - } - return str; -} - -int pcibios_enable_device(struct pci_dev *dev, int mask) -{ - int err; - - if ((err = pci_enable_resources(dev, mask)) < 0) - return err; - if (!dev->msi_enabled) - pcibios_enable_irq(dev); - return 0; -} diff --git a/arch/frv/mm/Makefile b/arch/frv/mm/Makefile deleted file mode 100644 index 1bca5ab8a6ab0..0000000000000 --- a/arch/frv/mm/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# -# Makefile for the arch-specific parts of the memory manager. -# - -obj-y := init.o kmap.o - -obj-$(CONFIG_MMU) += \ - pgalloc.o highmem.o fault.o extable.o cache-page.o tlb-flush.o tlb-miss.o \ - mmu-context.o dma-alloc.o elf-fdpic.o diff --git a/arch/frv/mm/cache-page.c b/arch/frv/mm/cache-page.c deleted file mode 100644 index 8e09dae0ec3f2..0000000000000 --- a/arch/frv/mm/cache-page.c +++ /dev/null @@ -1,71 +0,0 @@ -/* cache-page.c: whole-page cache wrangling functions for MMU linux - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ -#include -#include -#include -#include -#include - -/*****************************************************************************/ -/* - * DCF takes a virtual address and the page may not currently have one - * - temporarily hijack a kmap_atomic() slot and attach the page to it - */ -void flush_dcache_page(struct page *page) -{ - unsigned long dampr2; - void *vaddr; - - dampr2 = __get_DAMPR(2); - - vaddr = kmap_atomic_primary(page); - - frv_dcache_writeback((unsigned long) vaddr, (unsigned long) vaddr + PAGE_SIZE); - - kunmap_atomic_primary(vaddr); - - if (dampr2) { - __set_DAMPR(2, dampr2); - __set_IAMPR(2, dampr2); - } - -} /* end flush_dcache_page() */ - -EXPORT_SYMBOL(flush_dcache_page); - -/*****************************************************************************/ -/* - * ICI takes a virtual address and the page may not currently have one - * - so we temporarily attach the page to a bit of virtual space so that is can be flushed - */ -void flush_icache_user_range(struct vm_area_struct *vma, struct page *page, - unsigned long start, unsigned long len) -{ - unsigned long dampr2; - void *vaddr; - - dampr2 = __get_DAMPR(2); - - vaddr = kmap_atomic_primary(page); - - start = (start & ~PAGE_MASK) | (unsigned long) vaddr; - frv_cache_wback_inv(start, start + len); - - kunmap_atomic_primary(vaddr); - - if (dampr2) { - __set_DAMPR(2, dampr2); - __set_IAMPR(2, dampr2); - } - -} /* end flush_icache_user_range() */ - -EXPORT_SYMBOL(flush_icache_user_range); diff --git a/arch/frv/mm/dma-alloc.c b/arch/frv/mm/dma-alloc.c deleted file mode 100644 index e701aa9e6a146..0000000000000 --- a/arch/frv/mm/dma-alloc.c +++ /dev/null @@ -1,183 +0,0 @@ -/* dma-alloc.c: consistent DMA memory allocation - * - * Derived from arch/ppc/mm/cachemap.c - * - * PowerPC version derived from arch/arm/mm/consistent.c - * Copyright (C) 2001 Dan Malek (dmalek@jlc.net) - * - * linux/arch/arm/mm/consistent.c - * - * Copyright (C) 2000 Russell King - * - * Consistent memory allocators. Used for DMA devices that want to - * share uncached memory with the processor core. The function return - * is the virtual address and 'dma_handle' is the physical address. - * Mostly stolen from the ARM port, with some changes for PowerPC. - * -- Dan - * Modified for 36-bit support. -Matt - * - * 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -static int map_page(unsigned long va, unsigned long pa, pgprot_t prot) -{ - pgd_t *pge; - pud_t *pue; - pmd_t *pme; - pte_t *pte; - int err = -ENOMEM; - - /* Use upper 10 bits of VA to index the first level map */ - pge = pgd_offset_k(va); - pue = pud_offset(pge, va); - pme = pmd_offset(pue, va); - - /* Use middle 10 bits of VA to index the second-level map */ - pte = pte_alloc_kernel(pme, va); - if (pte != 0) { - err = 0; - set_pte(pte, mk_pte_phys(pa & PAGE_MASK, prot)); - } - - return err; -} - -/* - * This function will allocate the requested contiguous pages and - * map them into the kernel's vmalloc() space. This is done so we - * get unique mapping for these pages, outside of the kernel's 1:1 - * virtual:physical mapping. This is necessary so we can cover large - * portions of the kernel with single large page TLB entries, and - * still get unique uncached pages for consistent DMA. - */ -void *consistent_alloc(gfp_t gfp, size_t size, dma_addr_t *dma_handle) -{ - struct vm_struct *area; - unsigned long page, va, pa; - void *ret; - int order, err, i; - - if (in_interrupt()) - BUG(); - - /* only allocate page size areas */ - size = PAGE_ALIGN(size); - order = get_order(size); - - page = __get_free_pages(gfp, order); - if (!page) { - BUG(); - return NULL; - } - - /* allocate some common virtual space to map the new pages */ - area = get_vm_area(size, VM_ALLOC); - if (area == 0) { - free_pages(page, order); - return NULL; - } - va = VMALLOC_VMADDR(area->addr); - ret = (void *) va; - - /* this gives us the real physical address of the first page */ - *dma_handle = pa = virt_to_bus((void *) page); - - /* set refcount=1 on all pages in an order>0 allocation so that vfree() will actually free - * all pages that were allocated. - */ - if (order > 0) { - struct page *rpage = virt_to_page(page); - split_page(rpage, order); - } - - err = 0; - for (i = 0; i < size && err == 0; i += PAGE_SIZE) - err = map_page(va + i, pa + i, PAGE_KERNEL_NOCACHE); - - if (err) { - vfree((void *) va); - return NULL; - } - - /* we need to ensure that there are no cachelines in use, or worse dirty in this area - * - can't do until after virtual address mappings are created - */ - frv_cache_invalidate(va, va + size); - - return ret; -} - -/* - * free page(s) as defined by the above mapping. - */ -void consistent_free(void *vaddr) -{ - if (in_interrupt()) - BUG(); - vfree(vaddr); -} - -/* - * make an area consistent. - */ -void consistent_sync(void *vaddr, size_t size, int direction) -{ - unsigned long start = (unsigned long) vaddr; - unsigned long end = start + size; - - switch (direction) { - case PCI_DMA_NONE: - BUG(); - case PCI_DMA_FROMDEVICE: /* invalidate only */ - frv_cache_invalidate(start, end); - break; - case PCI_DMA_TODEVICE: /* writeback only */ - frv_dcache_writeback(start, end); - break; - case PCI_DMA_BIDIRECTIONAL: /* writeback and invalidate */ - frv_dcache_writeback(start, end); - break; - } -} - -/* - * consistent_sync_page make a page are consistent. identical - * to consistent_sync, but takes a struct page instead of a virtual address - */ - -void consistent_sync_page(struct page *page, unsigned long offset, - size_t size, int direction) -{ - void *start; - - start = page_address(page) + offset; - consistent_sync(start, size, direction); -} diff --git a/arch/frv/mm/elf-fdpic.c b/arch/frv/mm/elf-fdpic.c deleted file mode 100644 index 46aa289c5102b..0000000000000 --- a/arch/frv/mm/elf-fdpic.c +++ /dev/null @@ -1,114 +0,0 @@ -/* elf-fdpic.c: ELF FDPIC memory layout management - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#include -#include -#include -#include -#include -#include - -/*****************************************************************************/ -/* - * lay out the userspace VM according to our grand design - */ -#ifdef CONFIG_MMU -void elf_fdpic_arch_lay_out_mm(struct elf_fdpic_params *exec_params, - struct elf_fdpic_params *interp_params, - unsigned long *start_stack, - unsigned long *start_brk) -{ - *start_stack = 0x02200000UL; - - /* if the only executable is a shared object, assume that it is an interpreter rather than - * a true executable, and map it such that "ld.so --list" comes out right - */ - if (!(interp_params->flags & ELF_FDPIC_FLAG_PRESENT) && - exec_params->hdr.e_type != ET_EXEC - ) { - exec_params->load_addr = PAGE_SIZE; - - *start_brk = 0x80000000UL; - } - else { - exec_params->load_addr = 0x02200000UL; - - if ((exec_params->flags & ELF_FDPIC_FLAG_ARRANGEMENT) == - ELF_FDPIC_FLAG_INDEPENDENT - ) { - exec_params->flags &= ~ELF_FDPIC_FLAG_ARRANGEMENT; - exec_params->flags |= ELF_FDPIC_FLAG_CONSTDISP; - } - } - -} /* end elf_fdpic_arch_lay_out_mm() */ -#endif - -/*****************************************************************************/ -/* - * place non-fixed mmaps firstly in the bottom part of memory, working up, and then in the top part - * of memory, working down - */ -unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsigned long len, - unsigned long pgoff, unsigned long flags) -{ - struct vm_area_struct *vma; - struct vm_unmapped_area_info info; - - if (len > TASK_SIZE) - return -ENOMEM; - - /* handle MAP_FIXED */ - if (flags & MAP_FIXED) - return addr; - - /* only honour a hint if we're not going to clobber something doing so */ - if (addr) { - addr = PAGE_ALIGN(addr); - vma = find_vma(current->mm, addr); - if (TASK_SIZE - len >= addr && - (!vma || addr + len <= vm_start_gap(vma))) - goto success; - } - - /* search between the bottom of user VM and the stack grow area */ - info.flags = 0; - info.length = len; - info.low_limit = PAGE_SIZE; - info.high_limit = (current->mm->start_stack - 0x00200000); - info.align_mask = 0; - info.align_offset = 0; - addr = vm_unmapped_area(&info); - if (!(addr & ~PAGE_MASK)) - goto success; - VM_BUG_ON(addr != -ENOMEM); - - /* search from just above the WorkRAM area to the top of memory */ - info.low_limit = PAGE_ALIGN(0x80000000); - info.high_limit = TASK_SIZE; - addr = vm_unmapped_area(&info); - if (!(addr & ~PAGE_MASK)) - goto success; - VM_BUG_ON(addr != -ENOMEM); - -#if 0 - printk("[area] l=%lx (ENOMEM) f='%s'\n", - len, filp ? filp->f_path.dentry->d_name.name : ""); -#endif - return -ENOMEM; - - success: -#if 0 - printk("[area] l=%lx ad=%lx f='%s'\n", - len, addr, filp ? filp->f_path.dentry->d_name.name : ""); -#endif - return addr; -} /* end arch_get_unmapped_area() */ diff --git a/arch/frv/mm/extable.c b/arch/frv/mm/extable.c deleted file mode 100644 index 77c0c5ba88bc1..0000000000000 --- a/arch/frv/mm/extable.c +++ /dev/null @@ -1,49 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * linux/arch/frv/mm/extable.c - */ - -#include -#include -#include - -extern const void __memset_end, __memset_user_error_lr, __memset_user_error_handler; -extern const void __memcpy_end, __memcpy_user_error_lr, __memcpy_user_error_handler; -extern spinlock_t modlist_lock; - -int fixup_exception(struct pt_regs *regs) -{ - const struct exception_table_entry *extab; - unsigned long pc = regs->pc; - - /* determine if the fault lay during a memcpy_user or a memset_user */ - if (regs->lr == (unsigned long) &__memset_user_error_lr && - (unsigned long) &memset <= pc && pc < (unsigned long) &__memset_end - ) { - /* the fault occurred in a protected memset - * - we search for the return address (in LR) instead of the program counter - * - it was probably during a clear_user() - */ - regs->pc = (unsigned long) &__memset_user_error_handler; - return 1; - } - - if (regs->lr == (unsigned long) &__memcpy_user_error_lr && - (unsigned long) &memcpy <= pc && pc < (unsigned long) &__memcpy_end - ) { - /* the fault occurred in a protected memset - * - we search for the return address (in LR) instead of the program counter - * - it was probably during a copy_to/from_user() - */ - regs->pc = (unsigned long) &__memcpy_user_error_handler; - return 1; - } - - extab = search_exception_tables(pc); - if (extab) { - regs->pc = extab->fixup; - return 1; - } - - return 0; -} diff --git a/arch/frv/mm/fault.c b/arch/frv/mm/fault.c deleted file mode 100644 index cbe7aec863e30..0000000000000 --- a/arch/frv/mm/fault.c +++ /dev/null @@ -1,328 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * linux/arch/frv/mm/fault.c - * - * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. - * - Written by David Howells (dhowells@redhat.com) - * - Derived from arch/m68knommu/mm/fault.c - * - Copyright (C) 1998 D. Jeff Dionne , - * - Copyright (C) 2000 Lineo, Inc. (www.lineo.com) - * - * Based on: - * - * linux/arch/m68k/mm/fault.c - * - * Copyright (C) 1995 Hamish Macdonald - */ - -#include -#include -#include -#include -#include -#include - -#include -#include - -/*****************************************************************************/ -/* - * This routine handles page faults. It determines the problem, and - * then passes it off to one of the appropriate routines. - */ -asmlinkage void do_page_fault(int datammu, unsigned long esr0, unsigned long ear0) -{ - struct vm_area_struct *vma; - struct mm_struct *mm; - unsigned long _pme, lrai, lrad; - unsigned long flags = 0; - siginfo_t info; - pgd_t *pge; - pud_t *pue; - pte_t *pte; - int fault; - -#if 0 - const char *atxc[16] = { - [0x0] = "mmu-miss", [0x8] = "multi-dat", [0x9] = "multi-sat", - [0xa] = "tlb-miss", [0xc] = "privilege", [0xd] = "write-prot", - }; - - printk("do_page_fault(%d,%lx [%s],%lx)\n", - datammu, esr0, atxc[esr0 >> 20 & 0xf], ear0); -#endif - - mm = current->mm; - - /* - * We fault-in kernel-space virtual memory on-demand. The - * 'reference' page table is init_mm.pgd. - * - * NOTE! We MUST NOT take any locks for this case. We may - * be in an interrupt or a critical region, and should - * only copy the information from the master page table, - * nothing more. - * - * This verifies that the fault happens in kernel space - * and that the fault was a page not present (invalid) error - */ - if (!user_mode(__frame) && (esr0 & ESR0_ATXC) == ESR0_ATXC_AMRTLB_MISS) { - if (ear0 >= VMALLOC_START && ear0 < VMALLOC_END) - goto kernel_pte_fault; - if (ear0 >= PKMAP_BASE && ear0 < PKMAP_END) - goto kernel_pte_fault; - } - - info.si_code = SEGV_MAPERR; - - /* - * If we're in an interrupt or have no user - * context, we must not take the fault.. - */ - if (faulthandler_disabled() || !mm) - goto no_context; - - if (user_mode(__frame)) - flags |= FAULT_FLAG_USER; - - down_read(&mm->mmap_sem); - - vma = find_vma(mm, ear0); - if (!vma) - goto bad_area; - if (vma->vm_start <= ear0) - goto good_area; - if (!(vma->vm_flags & VM_GROWSDOWN)) - goto bad_area; - - if (user_mode(__frame)) { - /* - * accessing the stack below %esp is always a bug. - * The "+ 32" is there due to some instructions (like - * pusha) doing post-decrement on the stack and that - * doesn't show up until later.. - */ - if ((ear0 & PAGE_MASK) + 2 * PAGE_SIZE < __frame->sp) { -#if 0 - printk("[%d] ### Access below stack @%lx (sp=%lx)\n", - current->pid, ear0, __frame->sp); - show_registers(__frame); - printk("[%d] ### Code: [%08lx] %02x %02x %02x %02x %02x %02x %02x %02x\n", - current->pid, - __frame->pc, - ((u8*)__frame->pc)[0], - ((u8*)__frame->pc)[1], - ((u8*)__frame->pc)[2], - ((u8*)__frame->pc)[3], - ((u8*)__frame->pc)[4], - ((u8*)__frame->pc)[5], - ((u8*)__frame->pc)[6], - ((u8*)__frame->pc)[7] - ); -#endif - goto bad_area; - } - } - - if (expand_stack(vma, ear0)) - goto bad_area; - -/* - * Ok, we have a good vm_area for this memory access, so - * we can handle it.. - */ - good_area: - info.si_code = SEGV_ACCERR; - switch (esr0 & ESR0_ATXC) { - default: - /* handle write to write protected page */ - case ESR0_ATXC_WP_EXCEP: -#ifdef TEST_VERIFY_AREA - if (!(user_mode(__frame))) - printk("WP fault at %08lx\n", __frame->pc); -#endif - if (!(vma->vm_flags & VM_WRITE)) - goto bad_area; - flags |= FAULT_FLAG_WRITE; - break; - - /* handle read from protected page */ - case ESR0_ATXC_PRIV_EXCEP: - goto bad_area; - - /* handle read, write or exec on absent page - * - can't support write without permitting read - * - don't support execute without permitting read and vice-versa - */ - case ESR0_ATXC_AMRTLB_MISS: - if (!(vma->vm_flags & (VM_READ | VM_WRITE | VM_EXEC))) - goto bad_area; - break; - } - - /* - * If for any reason at all we couldn't handle the fault, - * make sure we exit gracefully rather than endlessly redo - * the fault. - */ - fault = handle_mm_fault(vma, ear0, flags); - if (unlikely(fault & VM_FAULT_ERROR)) { - if (fault & VM_FAULT_OOM) - goto out_of_memory; - else if (fault & VM_FAULT_SIGSEGV) - goto bad_area; - else if (fault & VM_FAULT_SIGBUS) - goto do_sigbus; - BUG(); - } - if (fault & VM_FAULT_MAJOR) - current->maj_flt++; - else - current->min_flt++; - - up_read(&mm->mmap_sem); - return; - -/* - * Something tried to access memory that isn't in our memory map.. - * Fix it, but check if it's kernel or user first.. - */ - bad_area: - up_read(&mm->mmap_sem); - - /* User mode accesses just cause a SIGSEGV */ - if (user_mode(__frame)) { - info.si_signo = SIGSEGV; - info.si_errno = 0; - /* info.si_code has been set above */ - info.si_addr = (void *) ear0; - force_sig_info(SIGSEGV, &info, current); - return; - } - - no_context: - /* are we prepared to handle this kernel fault? */ - if (fixup_exception(__frame)) - return; - -/* - * Oops. The kernel tried to access some bad page. We'll have to - * terminate things with extreme prejudice. - */ - - bust_spinlocks(1); - - if (ear0 < PAGE_SIZE) - printk(KERN_ALERT "Unable to handle kernel NULL pointer dereference"); - else - printk(KERN_ALERT "Unable to handle kernel paging request"); - printk(" at virtual addr %08lx\n", ear0); - printk(" PC : %08lx\n", __frame->pc); - printk(" EXC : esr0=%08lx ear0=%08lx\n", esr0, ear0); - - asm("lrai %1,%0,#1,#0,#0" : "=&r"(lrai) : "r"(ear0)); - asm("lrad %1,%0,#1,#0,#0" : "=&r"(lrad) : "r"(ear0)); - - printk(KERN_ALERT " LRAI: %08lx\n", lrai); - printk(KERN_ALERT " LRAD: %08lx\n", lrad); - - __break_hijack_kernel_event(); - - pge = pgd_offset(current->mm, ear0); - pue = pud_offset(pge, ear0); - _pme = pue->pue[0].ste[0]; - - printk(KERN_ALERT " PGE : %8p { PME %08lx }\n", pge, _pme); - - if (_pme & xAMPRx_V) { - unsigned long dampr, damlr, val; - - asm volatile("movsg dampr2,%0 ! movgs %2,dampr2 ! movsg damlr2,%1" - : "=&r"(dampr), "=r"(damlr) - : "r" (_pme | xAMPRx_L|xAMPRx_SS_16Kb|xAMPRx_S|xAMPRx_C|xAMPRx_V) - ); - - pte = (pte_t *) damlr + __pte_index(ear0); - val = pte_val(*pte); - - asm volatile("movgs %0,dampr2" :: "r" (dampr)); - - printk(KERN_ALERT " PTE : %8p { %08lx }\n", pte, val); - } - - die_if_kernel("Oops\n"); - do_exit(SIGKILL); - -/* - * We ran out of memory, or some other thing happened to us that made - * us unable to handle the page fault gracefully. - */ - out_of_memory: - up_read(&mm->mmap_sem); - if (!user_mode(__frame)) - goto no_context; - pagefault_out_of_memory(); - return; - - do_sigbus: - up_read(&mm->mmap_sem); - - /* - * Send a sigbus, regardless of whether we were in kernel - * or user mode. - */ - info.si_signo = SIGBUS; - info.si_errno = 0; - info.si_code = BUS_ADRERR; - info.si_addr = (void *) ear0; - force_sig_info(SIGBUS, &info, current); - - /* Kernel mode? Handle exceptions or die */ - if (!user_mode(__frame)) - goto no_context; - return; - -/* - * The fault was caused by a kernel PTE (such as installed by vmalloc or kmap) - */ - kernel_pte_fault: - { - /* - * Synchronize this task's top level page-table - * with the 'reference' page table. - * - * Do _not_ use "tsk" here. We might be inside - * an interrupt in the middle of a task switch.. - */ - int index = pgd_index(ear0); - pgd_t *pgd, *pgd_k; - pud_t *pud, *pud_k; - pmd_t *pmd, *pmd_k; - pte_t *pte_k; - - pgd = (pgd_t *) __get_TTBR(); - pgd = (pgd_t *)__va(pgd) + index; - pgd_k = ((pgd_t *)(init_mm.pgd)) + index; - - if (!pgd_present(*pgd_k)) - goto no_context; - //set_pgd(pgd, *pgd_k); /////// gcc ICE's on this line - - pud_k = pud_offset(pgd_k, ear0); - if (!pud_present(*pud_k)) - goto no_context; - - pmd_k = pmd_offset(pud_k, ear0); - if (!pmd_present(*pmd_k)) - goto no_context; - - pud = pud_offset(pgd, ear0); - pmd = pmd_offset(pud, ear0); - set_pmd(pmd, *pmd_k); - - pte_k = pte_offset_kernel(pmd_k, ear0); - if (!pte_present(*pte_k)) - goto no_context; - return; - } -} /* end do_page_fault() */ diff --git a/arch/frv/mm/highmem.c b/arch/frv/mm/highmem.c deleted file mode 100644 index 45750fb65c492..0000000000000 --- a/arch/frv/mm/highmem.c +++ /dev/null @@ -1,86 +0,0 @@ -/* highmem.c: arch-specific highmem stuff - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ -#include -#include - -void *kmap(struct page *page) -{ - might_sleep(); - if (!PageHighMem(page)) - return page_address(page); - return kmap_high(page); -} - -EXPORT_SYMBOL(kmap); - -void kunmap(struct page *page) -{ - if (in_interrupt()) - BUG(); - if (!PageHighMem(page)) - return; - kunmap_high(page); -} - -EXPORT_SYMBOL(kunmap); - -void *kmap_atomic(struct page *page) -{ - unsigned long paddr; - int type; - - preempt_disable(); - pagefault_disable(); - type = kmap_atomic_idx_push(); - paddr = page_to_phys(page); - - switch (type) { - /* - * The first 4 primary maps are reserved for architecture code - */ - case 0: return __kmap_atomic_primary(0, paddr, 6); - case 1: return __kmap_atomic_primary(0, paddr, 7); - case 2: return __kmap_atomic_primary(0, paddr, 8); - case 3: return __kmap_atomic_primary(0, paddr, 9); - case 4: return __kmap_atomic_primary(0, paddr, 10); - - case 5 ... 5 + NR_TLB_LINES - 1: - return __kmap_atomic_secondary(type - 5, paddr); - - default: - BUG(); - return NULL; - } -} -EXPORT_SYMBOL(kmap_atomic); - -void __kunmap_atomic(void *kvaddr) -{ - int type = kmap_atomic_idx(); - switch (type) { - case 0: __kunmap_atomic_primary(0, 6); break; - case 1: __kunmap_atomic_primary(0, 7); break; - case 2: __kunmap_atomic_primary(0, 8); break; - case 3: __kunmap_atomic_primary(0, 9); break; - case 4: __kunmap_atomic_primary(0, 10); break; - - case 5 ... 5 + NR_TLB_LINES - 1: - __kunmap_atomic_secondary(type - 5, kvaddr); - break; - - default: - BUG(); - } - kmap_atomic_idx_pop(); - pagefault_enable(); - preempt_enable(); -} -EXPORT_SYMBOL(__kunmap_atomic); diff --git a/arch/frv/mm/init.c b/arch/frv/mm/init.c deleted file mode 100644 index cf464100e8388..0000000000000 --- a/arch/frv/mm/init.c +++ /dev/null @@ -1,144 +0,0 @@ -/* init.c: memory initialisation for FRV - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - * - * Derived from: - * - linux/arch/m68knommu/mm/init.c - * - Copyright (C) 1998 D. Jeff Dionne , Kenneth Albanowski , - * - Copyright (C) 2000 Lineo, Inc. (www.lineo.com) - * - linux/arch/m68k/mm/init.c - * - Copyright (C) 1995 Hamish Macdonald - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#undef DEBUG - -/* - * ZERO_PAGE is a special page that is used for zero-initialized - * data and COW. - */ -unsigned long empty_zero_page; -EXPORT_SYMBOL(empty_zero_page); - -/*****************************************************************************/ -/* - * paging_init() continues the virtual memory environment setup which - * was begun by the code in arch/head.S. - * The parameters are pointers to where to stick the starting and ending - * addresses of available kernel virtual memory. - */ -void __init paging_init(void) -{ - unsigned long zones_size[MAX_NR_ZONES] = {0, }; - - /* allocate some pages for kernel housekeeping tasks */ - empty_zero_page = (unsigned long) alloc_bootmem_pages(PAGE_SIZE); - - memset((void *) empty_zero_page, 0, PAGE_SIZE); - -#ifdef CONFIG_HIGHMEM - if (get_num_physpages() - num_mappedpages) { - pgd_t *pge; - pud_t *pue; - pmd_t *pme; - - pkmap_page_table = alloc_bootmem_pages(PAGE_SIZE); - - pge = swapper_pg_dir + pgd_index_k(PKMAP_BASE); - pue = pud_offset(pge, PKMAP_BASE); - pme = pmd_offset(pue, PKMAP_BASE); - __set_pmd(pme, virt_to_phys(pkmap_page_table) | _PAGE_TABLE); - } -#endif - - /* distribute the allocatable pages across the various zones and pass them to the allocator - */ - zones_size[ZONE_NORMAL] = max_low_pfn - min_low_pfn; -#ifdef CONFIG_HIGHMEM - zones_size[ZONE_HIGHMEM] = get_num_physpages() - num_mappedpages; -#endif - - free_area_init(zones_size); - -#ifdef CONFIG_MMU - /* initialise init's MMU context */ - init_new_context(&init_task, &init_mm); -#endif - -} /* end paging_init() */ - -/*****************************************************************************/ -/* - * - */ -void __init mem_init(void) -{ - unsigned long code_size = _etext - _stext; - - /* this will put all low memory onto the freelists */ - free_all_bootmem(); -#if defined(CONFIG_MMU) && defined(CONFIG_HIGHMEM) - { - unsigned long pfn; - - for (pfn = get_num_physpages() - 1; - pfn >= num_mappedpages; pfn--) - free_highmem_page(&mem_map[pfn]); - } -#endif - - mem_init_print_info(NULL); - if (rom_length > 0 && rom_length >= code_size) - printk("Memory available: %luKiB/%luKiB ROM\n", - (rom_length - code_size) >> 10, rom_length >> 10); -} /* end mem_init() */ - -/*****************************************************************************/ -/* - * free the memory that was only required for initialisation - */ -void free_initmem(void) -{ -#if defined(CONFIG_RAMKERNEL) && !defined(CONFIG_PROTECT_KERNEL) - free_initmem_default(-1); -#endif -} /* end free_initmem() */ - -/*****************************************************************************/ -/* - * free the initial ramdisk memory - */ -#ifdef CONFIG_BLK_DEV_INITRD -void __init free_initrd_mem(unsigned long start, unsigned long end) -{ - free_reserved_area((void *)start, (void *)end, -1, "initrd"); -} /* end free_initrd_mem() */ -#endif diff --git a/arch/frv/mm/kmap.c b/arch/frv/mm/kmap.c deleted file mode 100644 index e9217e605aa85..0000000000000 --- a/arch/frv/mm/kmap.c +++ /dev/null @@ -1,51 +0,0 @@ -/* kmap.c: ioremapping handlers - * - * Copyright (C) 2003-5 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.com) - * - Derived from arch/m68k/mm/kmap.c - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#undef DEBUG - -/*****************************************************************************/ -/* - * Map some physical address range into the kernel address space. - */ - -void __iomem *__ioremap(unsigned long physaddr, unsigned long size, int cacheflag) -{ - return (void __iomem *)physaddr; -} - -/* - * Unmap a ioremap()ed region again - */ -void iounmap(void volatile __iomem *addr) -{ -} - -/* - * Set new cache mode for some kernel address space. - * The caller must push data for that range itself, if such data may already - * be in the cache. - */ -void kernel_set_cachemode(void *addr, unsigned long size, int cmode) -{ -} diff --git a/arch/frv/mm/mmu-context.c b/arch/frv/mm/mmu-context.c deleted file mode 100644 index 16946a58f64db..0000000000000 --- a/arch/frv/mm/mmu-context.c +++ /dev/null @@ -1,210 +0,0 @@ -/* mmu-context.c: MMU context allocation and management - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#include -#include -#include -#include -#include - -#define NR_CXN 4096 - -static unsigned long cxn_bitmap[NR_CXN / (sizeof(unsigned long) * 8)]; -static LIST_HEAD(cxn_owners_lru); -static DEFINE_SPINLOCK(cxn_owners_lock); - -int __nongpreldata cxn_pinned = -1; - - -/*****************************************************************************/ -/* - * initialise a new context - */ -int init_new_context(struct task_struct *tsk, struct mm_struct *mm) -{ - memset(&mm->context, 0, sizeof(mm->context)); - INIT_LIST_HEAD(&mm->context.id_link); - mm->context.itlb_cached_pge = 0xffffffffUL; - mm->context.dtlb_cached_pge = 0xffffffffUL; - - return 0; -} /* end init_new_context() */ - -/*****************************************************************************/ -/* - * make sure a kernel MMU context has a CPU context number - * - call with cxn_owners_lock held - */ -static unsigned get_cxn(mm_context_t *ctx) -{ - struct list_head *_p; - mm_context_t *p; - unsigned cxn; - - if (!list_empty(&ctx->id_link)) { - list_move_tail(&ctx->id_link, &cxn_owners_lru); - } - else { - /* find the first unallocated context number - * - 0 is reserved for the kernel - */ - cxn = find_next_zero_bit(cxn_bitmap, NR_CXN, 1); - if (cxn < NR_CXN) { - set_bit(cxn, cxn_bitmap); - } - else { - /* none remaining - need to steal someone else's cxn */ - p = NULL; - list_for_each(_p, &cxn_owners_lru) { - p = list_entry(_p, mm_context_t, id_link); - if (!p->id_busy && p->id != cxn_pinned) - break; - } - - BUG_ON(_p == &cxn_owners_lru); - - cxn = p->id; - p->id = 0; - list_del_init(&p->id_link); - __flush_tlb_mm(cxn); - } - - ctx->id = cxn; - list_add_tail(&ctx->id_link, &cxn_owners_lru); - } - - return ctx->id; -} /* end get_cxn() */ - -/*****************************************************************************/ -/* - * restore the current TLB miss handler mapped page tables into the MMU context and set up a - * mapping for the page directory - */ -void change_mm_context(mm_context_t *old, mm_context_t *ctx, pgd_t *pgd) -{ - unsigned long _pgd; - - _pgd = virt_to_phys(pgd); - - /* save the state of the outgoing MMU context */ - old->id_busy = 0; - - asm volatile("movsg scr0,%0" : "=r"(old->itlb_cached_pge)); - asm volatile("movsg dampr4,%0" : "=r"(old->itlb_ptd_mapping)); - asm volatile("movsg scr1,%0" : "=r"(old->dtlb_cached_pge)); - asm volatile("movsg dampr5,%0" : "=r"(old->dtlb_ptd_mapping)); - - /* select an MMU context number */ - spin_lock(&cxn_owners_lock); - get_cxn(ctx); - ctx->id_busy = 1; - spin_unlock(&cxn_owners_lock); - - asm volatile("movgs %0,cxnr" : : "r"(ctx->id)); - - /* restore the state of the incoming MMU context */ - asm volatile("movgs %0,scr0" : : "r"(ctx->itlb_cached_pge)); - asm volatile("movgs %0,dampr4" : : "r"(ctx->itlb_ptd_mapping)); - asm volatile("movgs %0,scr1" : : "r"(ctx->dtlb_cached_pge)); - asm volatile("movgs %0,dampr5" : : "r"(ctx->dtlb_ptd_mapping)); - - /* map the PGD into uncached virtual memory */ - asm volatile("movgs %0,ttbr" : : "r"(_pgd)); - asm volatile("movgs %0,dampr3" - :: "r"(_pgd | xAMPRx_L | xAMPRx_M | xAMPRx_SS_16Kb | - xAMPRx_S | xAMPRx_C | xAMPRx_V)); - -} /* end change_mm_context() */ - -/*****************************************************************************/ -/* - * finished with an MMU context number - */ -void destroy_context(struct mm_struct *mm) -{ - mm_context_t *ctx = &mm->context; - - spin_lock(&cxn_owners_lock); - - if (!list_empty(&ctx->id_link)) { - if (ctx->id == cxn_pinned) - cxn_pinned = -1; - - list_del_init(&ctx->id_link); - clear_bit(ctx->id, cxn_bitmap); - __flush_tlb_mm(ctx->id); - ctx->id = 0; - } - - spin_unlock(&cxn_owners_lock); -} /* end destroy_context() */ - -/*****************************************************************************/ -/* - * display the MMU context currently a process is currently using - */ -#ifdef CONFIG_PROC_FS -char *proc_pid_status_frv_cxnr(struct mm_struct *mm, char *buffer) -{ - spin_lock(&cxn_owners_lock); - buffer += sprintf(buffer, "CXNR: %u\n", mm->context.id); - spin_unlock(&cxn_owners_lock); - - return buffer; -} /* end proc_pid_status_frv_cxnr() */ -#endif - -/*****************************************************************************/ -/* - * (un)pin a process's mm_struct's MMU context ID - */ -int cxn_pin_by_pid(pid_t pid) -{ - struct task_struct *tsk; - struct mm_struct *mm = NULL; - int ret; - - /* unpin if pid is zero */ - if (pid == 0) { - cxn_pinned = -1; - return 0; - } - - ret = -ESRCH; - - /* get a handle on the mm_struct */ - read_lock(&tasklist_lock); - tsk = find_task_by_vpid(pid); - if (tsk) { - ret = -EINVAL; - - task_lock(tsk); - if (tsk->mm) { - mm = tsk->mm; - mmget(mm); - ret = 0; - } - task_unlock(tsk); - } - read_unlock(&tasklist_lock); - - if (ret < 0) - return ret; - - /* make sure it has a CXN and pin it */ - spin_lock(&cxn_owners_lock); - cxn_pinned = get_cxn(&mm->context); - spin_unlock(&cxn_owners_lock); - - mmput(mm); - return 0; -} /* end cxn_pin_by_pid() */ diff --git a/arch/frv/mm/pgalloc.c b/arch/frv/mm/pgalloc.c deleted file mode 100644 index c9ed14f6c67de..0000000000000 --- a/arch/frv/mm/pgalloc.c +++ /dev/null @@ -1,157 +0,0 @@ -/* pgalloc.c: page directory & page table allocation - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -pgd_t swapper_pg_dir[PTRS_PER_PGD] __attribute__((aligned(PAGE_SIZE))); - -pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address) -{ - pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL); - if (pte) - clear_page(pte); - return pte; -} - -pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address) -{ - struct page *page; - -#ifdef CONFIG_HIGHPTE - page = alloc_pages(GFP_KERNEL|__GFP_HIGHMEM, 0); -#else - page = alloc_pages(GFP_KERNEL, 0); -#endif - if (!page) - return NULL; - - clear_highpage(page); - if (!pgtable_page_ctor(page)) { - __free_page(page); - return NULL; - } - flush_dcache_page(page); - return page; -} - -void __set_pmd(pmd_t *pmdptr, unsigned long pmd) -{ - unsigned long *__ste_p = pmdptr->ste; - int loop; - - if (!pmd) { - memset(__ste_p, 0, PME_SIZE); - } - else { - BUG_ON(pmd & (0x3f00 | xAMPRx_SS | 0xe)); - - for (loop = PME_SIZE; loop > 0; loop -= 4) { - *__ste_p++ = pmd; - pmd += __frv_PT_SIZE; - } - } - - frv_dcache_writeback((unsigned long) pmdptr, (unsigned long) (pmdptr + 1)); -} - -/* - * List of all pgd's needed for non-PAE so it can invalidate entries - * in both cached and uncached pgd's; not needed for PAE since the - * kernel pmd is shared. If PAE were not to share the pmd a similar - * tactic would be needed. This is essentially codepath-based locking - * against pageattr.c; it is the unique case in which a valid change - * of kernel pagetables can't be lazily synchronized by vmalloc faults. - * vmalloc faults work because attached pagetables are never freed. - * If the locking proves to be non-performant, a ticketing scheme with - * checks at dup_mmap(), exec(), and other mmlist addition points - * could be used. The locking scheme was chosen on the basis of - * manfred's recommendations and having no core impact whatsoever. - * -- nyc - */ -DEFINE_SPINLOCK(pgd_lock); -struct page *pgd_list; - -static inline void pgd_list_add(pgd_t *pgd) -{ - struct page *page = virt_to_page(pgd); - page->index = (unsigned long) pgd_list; - if (pgd_list) - set_page_private(pgd_list, (unsigned long) &page->index); - pgd_list = page; - set_page_private(page, (unsigned long)&pgd_list); -} - -static inline void pgd_list_del(pgd_t *pgd) -{ - struct page *next, **pprev, *page = virt_to_page(pgd); - next = (struct page *) page->index; - pprev = (struct page **) page_private(page); - *pprev = next; - if (next) - set_page_private(next, (unsigned long) pprev); -} - -void pgd_ctor(void *pgd) -{ - unsigned long flags; - - if (PTRS_PER_PMD == 1) - spin_lock_irqsave(&pgd_lock, flags); - - memcpy((pgd_t *) pgd + USER_PGDS_IN_LAST_PML4, - swapper_pg_dir + USER_PGDS_IN_LAST_PML4, - (PTRS_PER_PGD - USER_PGDS_IN_LAST_PML4) * sizeof(pgd_t)); - - if (PTRS_PER_PMD > 1) - return; - - pgd_list_add(pgd); - spin_unlock_irqrestore(&pgd_lock, flags); - memset(pgd, 0, USER_PGDS_IN_LAST_PML4 * sizeof(pgd_t)); -} - -/* never called when PTRS_PER_PMD > 1 */ -void pgd_dtor(void *pgd) -{ - unsigned long flags; /* can be called from interrupt context */ - - spin_lock_irqsave(&pgd_lock, flags); - pgd_list_del(pgd); - spin_unlock_irqrestore(&pgd_lock, flags); -} - -pgd_t *pgd_alloc(struct mm_struct *mm) -{ - return quicklist_alloc(0, GFP_KERNEL, pgd_ctor); -} - -void pgd_free(struct mm_struct *mm, pgd_t *pgd) -{ - /* in the non-PAE case, clear_page_tables() clears user pgd entries */ - quicklist_free(0, pgd_dtor, pgd); -} - -void __init pgtable_cache_init(void) -{ -} - -void check_pgt_cache(void) -{ - quicklist_trim(0, pgd_dtor, 25, 16); -} - diff --git a/arch/frv/mm/tlb-flush.S b/arch/frv/mm/tlb-flush.S deleted file mode 100644 index 79b3c70910aca..0000000000000 --- a/arch/frv/mm/tlb-flush.S +++ /dev/null @@ -1,184 +0,0 @@ -/* tlb-flush.S: TLB flushing routines - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#include -#include -#include -#include -#include - -.macro DEBUG ch -# sethi.p %hi(0xfeff9c00),gr4 -# setlo %lo(0xfeff9c00),gr4 -# setlos #\ch,gr5 -# stbi gr5,@(gr4,#0) -# membar -.endm - - .section .rodata - - # sizes corresponding to TPXR.LMAX - .balign 1 -__tlb_lmax_sizes: - .byte 0, 64, 0, 0 - .byte 0, 0, 0, 0 - .byte 0, 0, 0, 0 - .byte 0, 0, 0, 0 - - .section .text - .balign 4 - -############################################################################### -# -# flush everything -# - void __flush_tlb_all(void) -# -############################################################################### - .globl __flush_tlb_all - .type __flush_tlb_all,@function -__flush_tlb_all: - DEBUG 'A' - - # kill cached PGE value - setlos #0xffffffff,gr4 - movgs gr4,scr0 - movgs gr4,scr1 - - # kill AMPR-cached TLB values - movgs gr0,iamlr1 - movgs gr0,iampr1 - movgs gr0,damlr1 - movgs gr0,dampr1 - - # find out how many lines there are - movsg tpxr,gr5 - sethi.p %hi(__tlb_lmax_sizes),gr4 - srli gr5,#TPXR_LMAX_SHIFT,gr5 - setlo.p %lo(__tlb_lmax_sizes),gr4 - andi gr5,#TPXR_LMAX_SMASK,gr5 - ldub @(gr4,gr5),gr4 - - # now, we assume that the TLB line step is page size in size - setlos.p #PAGE_SIZE,gr5 - setlos #0,gr6 -1: - tlbpr gr6,gr0,#6,#0 - subicc.p gr4,#1,gr4,icc0 - add gr6,gr5,gr6 - bne icc0,#2,1b - - DEBUG 'B' - bralr - - .size __flush_tlb_all, .-__flush_tlb_all - -############################################################################### -# -# flush everything to do with one context -# - void __flush_tlb_mm(unsigned long contextid [GR8]) -# -############################################################################### - .globl __flush_tlb_mm - .type __flush_tlb_mm,@function -__flush_tlb_mm: - DEBUG 'M' - - # kill cached PGE value - setlos #0xffffffff,gr4 - movgs gr4,scr0 - movgs gr4,scr1 - - # specify the context we want to flush - movgs gr8,tplr - - # find out how many lines there are - movsg tpxr,gr5 - sethi.p %hi(__tlb_lmax_sizes),gr4 - srli gr5,#TPXR_LMAX_SHIFT,gr5 - setlo.p %lo(__tlb_lmax_sizes),gr4 - andi gr5,#TPXR_LMAX_SMASK,gr5 - ldub @(gr4,gr5),gr4 - - # now, we assume that the TLB line step is page size in size - setlos.p #PAGE_SIZE,gr5 - setlos #0,gr6 -0: - tlbpr gr6,gr0,#5,#0 - subicc.p gr4,#1,gr4,icc0 - add gr6,gr5,gr6 - bne icc0,#2,0b - - DEBUG 'N' - bralr - - .size __flush_tlb_mm, .-__flush_tlb_mm - -############################################################################### -# -# flush a range of addresses from the TLB -# - void __flush_tlb_page(unsigned long contextid [GR8], -# unsigned long start [GR9]) -# -############################################################################### - .globl __flush_tlb_page - .type __flush_tlb_page,@function -__flush_tlb_page: - # kill cached PGE value - setlos #0xffffffff,gr4 - movgs gr4,scr0 - movgs gr4,scr1 - - # specify the context we want to flush - movgs gr8,tplr - - # zap the matching TLB line and AMR values - setlos #~(PAGE_SIZE-1),gr5 - and gr9,gr5,gr9 - tlbpr gr9,gr0,#5,#0 - - bralr - - .size __flush_tlb_page, .-__flush_tlb_page - -############################################################################### -# -# flush a range of addresses from the TLB -# - void __flush_tlb_range(unsigned long contextid [GR8], -# unsigned long start [GR9], -# unsigned long end [GR10]) -# -############################################################################### - .globl __flush_tlb_range - .type __flush_tlb_range,@function -__flush_tlb_range: - # kill cached PGE value - setlos #0xffffffff,gr4 - movgs gr4,scr0 - movgs gr4,scr1 - - # specify the context we want to flush - movgs gr8,tplr - - # round the start down to beginning of TLB line and end up to beginning of next TLB line - setlos.p #~(PAGE_SIZE-1),gr5 - setlos #PAGE_SIZE,gr6 - subi.p gr10,#1,gr10 - and gr9,gr5,gr9 - and gr10,gr5,gr10 -2: - tlbpr gr9,gr0,#5,#0 - subcc.p gr9,gr10,gr0,icc0 - add gr9,gr6,gr9 - bne icc0,#0,2b ; most likely a 1-page flush - - bralr - - .size __flush_tlb_range, .-__flush_tlb_range diff --git a/arch/frv/mm/tlb-miss.S b/arch/frv/mm/tlb-miss.S deleted file mode 100644 index f3ac019bb18bf..0000000000000 --- a/arch/frv/mm/tlb-miss.S +++ /dev/null @@ -1,629 +0,0 @@ -/* tlb-miss.S: TLB miss handlers - * - * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. - * Written by David Howells (dhowells@redhat.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. - */ - -#include -#include -#include -#include -#include - - .section .text..tlbmiss - .balign 4 - - .globl __entry_insn_mmu_miss -__entry_insn_mmu_miss: - break - nop - - .globl __entry_insn_mmu_exception -__entry_insn_mmu_exception: - break - nop - - .globl __entry_data_mmu_miss -__entry_data_mmu_miss: - break - nop - - .globl __entry_data_mmu_exception -__entry_data_mmu_exception: - break - nop - -############################################################################### -# -# handle a lookup failure of one sort or another in a kernel TLB handler -# On entry: -# GR29 - faulting address -# SCR2 - saved CCR -# -############################################################################### - .type __tlb_kernel_fault,@function -__tlb_kernel_fault: - # see if we're supposed to re-enable single-step mode upon return - sethi.p %hi(__break_tlb_miss_return_break),gr30 - setlo %lo(__break_tlb_miss_return_break),gr30 - movsg pcsr,gr31 - - subcc gr31,gr30,gr0,icc0 - beq icc0,#0,__tlb_kernel_fault_sstep - - movsg scr2,gr30 - movgs gr30,ccr - movgs gr29,scr2 /* save EAR0 value */ - sethi.p %hi(__kernel_current_task),gr29 - setlo %lo(__kernel_current_task),gr29 - ldi.p @(gr29,#0),gr29 /* restore GR29 */ - - bra __entry_kernel_handle_mmu_fault - - # we've got to re-enable single-stepping -__tlb_kernel_fault_sstep: - sethi.p %hi(__break_tlb_miss_real_return_info),gr30 - setlo %lo(__break_tlb_miss_real_return_info),gr30 - lddi @(gr30,0),gr30 - movgs gr30,pcsr - movgs gr31,psr - - movsg scr2,gr30 - movgs gr30,ccr - movgs gr29,scr2 /* save EAR0 value */ - sethi.p %hi(__kernel_current_task),gr29 - setlo %lo(__kernel_current_task),gr29 - ldi.p @(gr29,#0),gr29 /* restore GR29 */ - bra __entry_kernel_handle_mmu_fault_sstep - - .size __tlb_kernel_fault, .-__tlb_kernel_fault - -############################################################################### -# -# handle a lookup failure of one sort or another in a user TLB handler -# On entry: -# GR28 - faulting address -# SCR2 - saved CCR -# -############################################################################### - .type __tlb_user_fault,@function -__tlb_user_fault: - # see if we're supposed to re-enable single-step mode upon return - sethi.p %hi(__break_tlb_miss_return_break),gr30 - setlo %lo(__break_tlb_miss_return_break),gr30 - movsg pcsr,gr31 - subcc gr31,gr30,gr0,icc0 - beq icc0,#0,__tlb_user_fault_sstep - - movsg scr2,gr30 - movgs gr30,ccr - bra __entry_uspace_handle_mmu_fault - - # we've got to re-enable single-stepping -__tlb_user_fault_sstep: - sethi.p %hi(__break_tlb_miss_real_return_info),gr30 - setlo %lo(__break_tlb_miss_real_return_info),gr30 - lddi @(gr30,0),gr30 - movgs gr30,pcsr - movgs gr31,psr - movsg scr2,gr30 - movgs gr30,ccr - bra __entry_uspace_handle_mmu_fault_sstep - - .size __tlb_user_fault, .-__tlb_user_fault - -############################################################################### -# -# Kernel instruction TLB miss handler -# On entry: -# GR1 - kernel stack pointer -# GR28 - saved exception frame pointer -# GR29 - faulting address -# GR31 - EAR0 ^ SCR0 -# SCR0 - base of virtual range covered by cached PGE from last ITLB miss (or 0xffffffff) -# DAMR3 - mapped page directory -# DAMR4 - mapped page table as matched by SCR0 -# -############################################################################### - .globl __entry_kernel_insn_tlb_miss - .type __entry_kernel_insn_tlb_miss,@function -__entry_kernel_insn_tlb_miss: -#if 0 - sethi.p %hi(0xe1200004),gr30 - setlo %lo(0xe1200004),gr30 - st gr0,@(gr30,gr0) - sethi.p %hi(0xffc00100),gr30 - setlo %lo(0xffc00100),gr30 - sth gr30,@(gr30,gr0) - membar -#endif - - movsg ccr,gr30 /* save CCR */ - movgs gr30,scr2 - - # see if the cached page table mapping is appropriate - srlicc.p gr31,#26,gr0,icc0 - setlos 0x3ffc,gr30 - srli.p gr29,#12,gr31 /* use EAR0[25:14] as PTE index */ - bne icc0,#0,__itlb_k_PTD_miss - -__itlb_k_PTD_mapped: - # access the PTD with EAR0[25:14] - # - DAMLR4 points to the virtual address of the appropriate page table - # - the PTD holds 4096 PTEs - # - the PTD must be accessed uncached - # - the PTE must be marked accessed if it was valid - # - and gr31,gr30,gr31 - movsg damlr4,gr30 - add gr30,gr31,gr31 - ldi @(gr31,#0),gr30 /* fetch the PTE */ - andicc gr30,#_PAGE_PRESENT,gr0,icc0 - ori.p gr30,#_PAGE_ACCESSED,gr30 - beq icc0,#0,__tlb_kernel_fault /* jump if PTE invalid */ - sti.p gr30,@(gr31,#0) /* update the PTE */ - andi gr30,#~_PAGE_ACCESSED,gr30 - - # we're using IAMR1 as an extra TLB entry - # - punt the entry here (if valid) to the real TLB and then replace with the new PTE - # - need to check DAMR1 lest we cause an multiple-DAT-hit exception - # - IAMPR1 has no WP bit, and we mustn't lose WP information - movsg iampr1,gr31 - andicc gr31,#xAMPRx_V,gr0,icc0 - setlos.p 0xfffff000,gr31 - beq icc0,#0,__itlb_k_nopunt /* punt not required */ - - movsg iamlr1,gr31 - movgs gr31,tplr /* set TPLR.CXN */ - tlbpr gr31,gr0,#4,#0 /* delete matches from TLB, IAMR1, DAMR1 */ - - movsg dampr1,gr31 - ori gr31,#xAMPRx_V,gr31 /* entry was invalidated by tlbpr #4 */ - movgs gr31,tppr - movsg iamlr1,gr31 /* set TPLR.CXN */ - movgs gr31,tplr - tlbpr gr31,gr0,#2,#0 /* save to the TLB */ - movsg tpxr,gr31 /* check the TLB write error flag */ - andicc.p gr31,#TPXR_E,gr0,icc0 - setlos #0xfffff000,gr31 - bne icc0,#0,__tlb_kernel_fault - -__itlb_k_nopunt: - - # assemble the new TLB entry - and gr29,gr31,gr29 - movsg cxnr,gr31 - or gr29,gr31,gr29 - movgs gr29,iamlr1 /* xAMLR = address | context number */ - movgs gr30,iampr1 - movgs gr29,damlr1 - movgs gr30,dampr1 - - # return, restoring registers - movsg scr2,gr30 - movgs gr30,ccr - sethi.p %hi(__kernel_current_task),gr29 - setlo %lo(__kernel_current_task),gr29 - ldi @(gr29,#0),gr29 - rett #0 - beq icc0,#3,0 /* prevent icache prefetch */ - - # the PTE we want wasn't in the PTD we have mapped, so we need to go looking for a more - # appropriate page table and map that instead - # - access the PGD with EAR0[31:26] - # - DAMLR3 points to the virtual address of the page directory - # - the PGD holds 64 PGEs and each PGE/PME points to a set of page tables -__itlb_k_PTD_miss: - srli gr29,#26,gr31 /* calculate PGE offset */ - slli gr31,#8,gr31 /* and clear bottom bits */ - - movsg damlr3,gr30 - ld @(gr31,gr30),gr30 /* access the PGE */ - - andicc.p gr30,#_PAGE_PRESENT,gr0,icc0 - andicc gr30,#xAMPRx_SS,gr0,icc1 - - # map this PTD instead and record coverage address - ori.p gr30,#xAMPRx_L|xAMPRx_SS_16Kb|xAMPRx_S|xAMPRx_C|xAMPRx_V,gr30 - beq icc0,#0,__tlb_kernel_fault /* jump if PGE not present */ - slli.p gr31,#18,gr31 - bne icc1,#0,__itlb_k_bigpage - movgs gr30,dampr4 - movgs gr31,scr0 - - # we can now resume normal service - setlos 0x3ffc,gr30 - srli.p gr29,#12,gr31 /* use EAR0[25:14] as PTE index */ - bra __itlb_k_PTD_mapped - -__itlb_k_bigpage: - break - nop - - .size __entry_kernel_insn_tlb_miss, .-__entry_kernel_insn_tlb_miss - -############################################################################### -# -# Kernel data TLB miss handler -# On entry: -# GR1 - kernel stack pointer -# GR28 - saved exception frame pointer -# GR29 - faulting address -# GR31 - EAR0 ^ SCR1 -# SCR1 - base of virtual range covered by cached PGE from last DTLB miss (or 0xffffffff) -# DAMR3 - mapped page directory -# DAMR5 - mapped page table as matched by SCR1 -# -############################################################################### - .globl __entry_kernel_data_tlb_miss - .type __entry_kernel_data_tlb_miss,@function -__entry_kernel_data_tlb_miss: -#if 0 - sethi.p %hi(0xe1200004),gr30 - setlo %lo(0xe1200004),gr30 - st gr0,@(gr30,gr0) - sethi.p %hi(0xffc00100),gr30 - setlo %lo(0xffc00100),gr30 - sth gr30,@(gr30,gr0) - membar -#endif - - movsg ccr,gr30 /* save CCR */ - movgs gr30,scr2 - - # see if the cached page table mapping is appropriate - srlicc.p gr31,#26,gr0,icc0 - setlos 0x3ffc,gr30 - srli.p gr29,#12,gr31 /* use EAR0[25:14] as PTE index */ - bne icc0,#0,__dtlb_k_PTD_miss - -__dtlb_k_PTD_mapped: - # access the PTD with EAR0[25:14] - # - DAMLR5 points to the virtual address of the appropriate page table - # - the PTD holds 4096 PTEs - # - the PTD must be accessed uncached - # - the PTE must be marked accessed if it was valid - # - and gr31,gr30,gr31 - movsg damlr5,gr30 - add gr30,gr31,gr31 - ldi @(gr31,#0),gr30 /* fetch the PTE */ - andicc gr30,#_PAGE_PRESENT,gr0,icc0 - ori.p gr30,#_PAGE_ACCESSED,gr30 - beq icc0,#0,__tlb_kernel_fault /* jump if PTE invalid */ - sti.p gr30,@(gr31,#0) /* update the PTE */ - andi gr30,#~_PAGE_ACCESSED,gr30 - - # we're using DAMR1 as an extra TLB entry - # - punt the entry here (if valid) to the real TLB and then replace with the new PTE - # - need to check IAMR1 lest we cause an multiple-DAT-hit exception - movsg dampr1,gr31 - andicc gr31,#xAMPRx_V,gr0,icc0 - setlos.p 0xfffff000,gr31 - beq icc0,#0,__dtlb_k_nopunt /* punt not required */ - - movsg damlr1,gr31 - movgs gr31,tplr /* set TPLR.CXN */ - tlbpr gr31,gr0,#4,#0 /* delete matches from TLB, IAMR1, DAMR1 */ - - movsg dampr1,gr31 - ori gr31,#xAMPRx_V,gr31 /* entry was invalidated by tlbpr #4 */ - movgs gr31,tppr - movsg damlr1,gr31 /* set TPLR.CXN */ - movgs gr31,tplr - tlbpr gr31,gr0,#2,#0 /* save to the TLB */ - movsg tpxr,gr31 /* check the TLB write error flag */ - andicc.p gr31,#TPXR_E,gr0,icc0 - setlos #0xfffff000,gr31 - bne icc0,#0,__tlb_kernel_fault - -__dtlb_k_nopunt: - - # assemble the new TLB entry - and gr29,gr31,gr29 - movsg cxnr,gr31 - or gr29,gr31,gr29 - movgs gr29,iamlr1 /* xAMLR = address | context number */ - movgs gr30,iampr1 - movgs gr29,damlr1 - movgs gr30,dampr1 - - # return, restoring registers - movsg scr2,gr30 - movgs gr30,ccr - sethi.p %hi(__kernel_current_task),gr29 - setlo %lo(__kernel_current_task),gr29 - ldi @(gr29,#0),gr29 - rett #0 - beq icc0,#3,0 /* prevent icache prefetch */ - - # the PTE we want wasn't in the PTD we have mapped, so we need to go looking for a more - # appropriate page table and map that instead - # - access the PGD with EAR0[31:26] - # - DAMLR3 points to the virtual address of the page directory - # - the PGD holds 64 PGEs and each PGE/PME points to a set of page tables -__dtlb_k_PTD_miss: - srli gr29,#26,gr31 /* calculate PGE offset */ - slli gr31,#8,gr31 /* and clear bottom bits */ - - movsg damlr3,gr30 - ld @(gr31,gr30),gr30 /* access the PGE */ - - andicc.p gr30,#_PAGE_PRESENT,gr0,icc0 - andicc gr30,#xAMPRx_SS,gr0,icc1 - - # map this PTD instead and record coverage address - ori.p gr30,#xAMPRx_L|xAMPRx_SS_16Kb|xAMPRx_S|xAMPRx_C|xAMPRx_V,gr30 - beq icc0,#0,__tlb_kernel_fault /* jump if PGE not present */ - slli.p gr31,#18,gr31 - bne icc1,#0,__dtlb_k_bigpage - movgs gr30,dampr5 - movgs gr31,scr1 - - # we can now resume normal service - setlos 0x3ffc,gr30 - srli.p gr29,#12,gr31 /* use EAR0[25:14] as PTE index */ - bra __dtlb_k_PTD_mapped - -__dtlb_k_bigpage: - break - nop - - .size __entry_kernel_data_tlb_miss, .-__entry_kernel_data_tlb_miss - -############################################################################### -# -# Userspace instruction TLB miss handler (with PGE prediction) -# On entry: -# GR28 - faulting address -# GR31 - EAR0 ^ SCR0 -# SCR0 - base of virtual range covered by cached PGE from last ITLB miss (or 0xffffffff) -# DAMR3 - mapped page directory -# DAMR4 - mapped page table as matched by SCR0 -# -############################################################################### - .globl __entry_user_insn_tlb_miss - .type __entry_user_insn_tlb_miss,@function -__entry_user_insn_tlb_miss: -#if 0 - sethi.p %hi(0xe1200004),gr30 - setlo %lo(0xe1200004),gr30 - st gr0,@(gr30,gr0) - sethi.p %hi(0xffc00100),gr30 - setlo %lo(0xffc00100),gr30 - sth gr30,@(gr30,gr0) - membar -#endif - - movsg ccr,gr30 /* save CCR */ - movgs gr30,scr2 - - # see if the cached page table mapping is appropriate - srlicc.p gr31,#26,gr0,icc0 - setlos 0x3ffc,gr30 - srli.p gr28,#12,gr31 /* use EAR0[25:14] as PTE index */ - bne icc0,#0,__itlb_u_PTD_miss - -__itlb_u_PTD_mapped: - # access the PTD with EAR0[25:14] - # - DAMLR4 points to the virtual address of the appropriate page table - # - the PTD holds 4096 PTEs - # - the PTD must be accessed uncached - # - the PTE must be marked accessed if it was valid - # - and gr31,gr30,gr31 - movsg damlr4,gr30 - add gr30,gr31,gr31 - ldi @(gr31,#0),gr30 /* fetch the PTE */ - andicc gr30,#_PAGE_PRESENT,gr0,icc0 - ori.p gr30,#_PAGE_ACCESSED,gr30 - beq icc0,#0,__tlb_user_fault /* jump if PTE invalid */ - sti.p gr30,@(gr31,#0) /* update the PTE */ - andi gr30,#~_PAGE_ACCESSED,gr30 - - # we're using IAMR1/DAMR1 as an extra TLB entry - # - punt the entry here (if valid) to the real TLB and then replace with the new PTE - movsg dampr1,gr31 - andicc gr31,#xAMPRx_V,gr0,icc0 - setlos.p 0xfffff000,gr31 - beq icc0,#0,__itlb_u_nopunt /* punt not required */ - - movsg dampr1,gr31 - movgs gr31,tppr - movsg damlr1,gr31 /* set TPLR.CXN */ - movgs gr31,tplr - tlbpr gr31,gr0,#2,#0 /* save to the TLB */ - movsg tpxr,gr31 /* check the TLB write error flag */ - andicc.p gr31,#TPXR_E,gr0,icc0 - setlos #0xfffff000,gr31 - bne icc0,#0,__tlb_user_fault - -__itlb_u_nopunt: - - # assemble the new TLB entry - and gr28,gr31,gr28 - movsg cxnr,gr31 - or gr28,gr31,gr28 - movgs gr28,iamlr1 /* xAMLR = address | context number */ - movgs gr30,iampr1 - movgs gr28,damlr1 - movgs gr30,dampr1 - - # return, restoring registers - movsg scr2,gr30 - movgs gr30,ccr - rett #0 - beq icc0,#3,0 /* prevent icache prefetch */ - - # the PTE we want wasn't in the PTD we have mapped, so we need to go looking for a more - # appropriate page table and map that instead - # - access the PGD with EAR0[31:26] - # - DAMLR3 points to the virtual address of the page directory - # - the PGD holds 64 PGEs and each PGE/PME points to a set of page tables -__itlb_u_PTD_miss: - srli gr28,#26,gr31 /* calculate PGE offset */ - slli gr31,#8,gr31 /* and clear bottom bits */ - - movsg damlr3,gr30 - ld @(gr31,gr30),gr30 /* access the PGE */ - - andicc.p gr30,#_PAGE_PRESENT,gr0,icc0 - andicc gr30,#xAMPRx_SS,gr0,icc1 - - # map this PTD instead and record coverage address - ori.p gr30,#xAMPRx_L|xAMPRx_SS_16Kb|xAMPRx_S|xAMPRx_C|xAMPRx_V,gr30 - beq icc0,#0,__tlb_user_fault /* jump if PGE not present */ - slli.p gr31,#18,gr31 - bne icc1,#0,__itlb_u_bigpage - movgs gr30,dampr4 - movgs gr31,scr0 - - # we can now resume normal service - setlos 0x3ffc,gr30 - srli.p gr28,#12,gr31 /* use EAR0[25:14] as PTE index */ - bra __itlb_u_PTD_mapped - -__itlb_u_bigpage: - break - nop - - .size __entry_user_insn_tlb_miss, .-__entry_user_insn_tlb_miss - -############################################################################### -# -# Userspace data TLB miss handler -# On entry: -# GR28 - faulting address -# GR31 - EAR0 ^ SCR1 -# SCR1 - base of virtual range covered by cached PGE from last DTLB miss (or 0xffffffff) -# DAMR3 - mapped page directory -# DAMR5 - mapped page table as matched by SCR1 -# -############################################################################### - .globl __entry_user_data_tlb_miss - .type __entry_user_data_tlb_miss,@function -__entry_user_data_tlb_miss: -#if 0 - sethi.p %hi(0xe1200004),gr30 - setlo %lo(0xe1200004),gr30 - st gr0,@(gr30,gr0) - sethi.p %hi(0xffc00100),gr30 - setlo %lo(0xffc00100),gr30 - sth gr30,@(gr30,gr0) - membar -#endif - - movsg ccr,gr30 /* save CCR */ - movgs gr30,scr2 - - # see if the cached page table mapping is appropriate - srlicc.p gr31,#26,gr0,icc0 - setlos 0x3ffc,gr30 - srli.p gr28,#12,gr31 /* use EAR0[25:14] as PTE index */ - bne icc0,#0,__dtlb_u_PTD_miss - -__dtlb_u_PTD_mapped: - # access the PTD with EAR0[25:14] - # - DAMLR5 points to the virtual address of the appropriate page table - # - the PTD holds 4096 PTEs - # - the PTD must be accessed uncached - # - the PTE must be marked accessed if it was valid - # - and gr31,gr30,gr31 - movsg damlr5,gr30 - -__dtlb_u_using_iPTD: - add gr30,gr31,gr31 - ldi @(gr31,#0),gr30 /* fetch the PTE */ - andicc gr30,#_PAGE_PRESENT,gr0,icc0 - ori.p gr30,#_PAGE_ACCESSED,gr30 - beq icc0,#0,__tlb_user_fault /* jump if PTE invalid */ - sti.p gr30,@(gr31,#0) /* update the PTE */ - andi gr30,#~_PAGE_ACCESSED,gr30 - - # we're using DAMR1 as an extra TLB entry - # - punt the entry here (if valid) to the real TLB and then replace with the new PTE - movsg dampr1,gr31 - andicc gr31,#xAMPRx_V,gr0,icc0 - setlos.p 0xfffff000,gr31 - beq icc0,#0,__dtlb_u_nopunt /* punt not required */ - - movsg dampr1,gr31 - movgs gr31,tppr - movsg damlr1,gr31 /* set TPLR.CXN */ - movgs gr31,tplr - tlbpr gr31,gr0,#2,#0 /* save to the TLB */ - movsg tpxr,gr31 /* check the TLB write error flag */ - andicc.p gr31,#TPXR_E,gr0,icc0 - setlos #0xfffff000,gr31 - bne icc0,#0,__tlb_user_fault - -__dtlb_u_nopunt: - - # assemble the new TLB entry - and gr28,gr31,gr28 - movsg cxnr,gr31 - or gr28,gr31,gr28 - movgs gr28,iamlr1 /* xAMLR = address | context number */ - movgs gr30,iampr1 - movgs gr28,damlr1 - movgs gr30,dampr1 - - # return, restoring registers - movsg scr2,gr30 - movgs gr30,ccr - rett #0 - beq icc0,#3,0 /* prevent icache prefetch */ - - # the PTE we want wasn't in the PTD we have mapped, so we need to go looking for a more - # appropriate page table and map that instead - # - first of all, check the insn PGE cache - we may well get a hit there - # - access the PGD with EAR0[31:26] - # - DAMLR3 points to the virtual address of the page directory - # - the PGD holds 64 PGEs and each PGE/PME points to a set of page tables -__dtlb_u_PTD_miss: - movsg scr0,gr31 /* consult the insn-PGE-cache key */ - xor gr28,gr31,gr31 - srlicc gr31,#26,gr0,icc0 - srli gr28,#12,gr31 /* use EAR0[25:14] as PTE index */ - bne icc0,#0,__dtlb_u_iPGE_miss - - # what we're looking for is covered by the insn-PGE-cache - setlos 0x3ffc,gr30 - and gr31,gr30,gr31 - movsg damlr4,gr30 - bra __dtlb_u_using_iPTD - -__dtlb_u_iPGE_miss: - srli gr28,#26,gr31 /* calculate PGE offset */ - slli gr31,#8,gr31 /* and clear bottom bits */ - - movsg damlr3,gr30 - ld @(gr31,gr30),gr30 /* access the PGE */ - - andicc.p gr30,#_PAGE_PRESENT,gr0,icc0 - andicc gr30,#xAMPRx_SS,gr0,icc1 - - # map this PTD instead and record coverage address - ori.p gr30,#xAMPRx_L|xAMPRx_SS_16Kb|xAMPRx_S|xAMPRx_C|xAMPRx_V,gr30 - beq icc0,#0,__tlb_user_fault /* jump if PGE not present */ - slli.p gr31,#18,gr31 - bne icc1,#0,__dtlb_u_bigpage - movgs gr30,dampr5 - movgs gr31,scr1 - - # we can now resume normal service - setlos 0x3ffc,gr30 - srli.p gr28,#12,gr31 /* use EAR0[25:14] as PTE index */ - bra __dtlb_u_PTD_mapped - -__dtlb_u_bigpage: - break - nop - - .size __entry_user_data_tlb_miss, .-__entry_user_data_tlb_miss diff --git a/tools/arch/frv/include/uapi/asm/bitsperlong.h b/tools/arch/frv/include/uapi/asm/bitsperlong.h deleted file mode 100644 index 76da34b10f598..0000000000000 --- a/tools/arch/frv/include/uapi/asm/bitsperlong.h +++ /dev/null @@ -1,2 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#include diff --git a/tools/arch/frv/include/uapi/asm/mman.h b/tools/arch/frv/include/uapi/asm/mman.h deleted file mode 100644 index 5bc900b0bc782..0000000000000 --- a/tools/arch/frv/include/uapi/asm/mman.h +++ /dev/null @@ -1,7 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef TOOLS_ARCH_FRV_UAPI_ASM_MMAN_FIX_H -#define TOOLS_ARCH_FRV_UAPI_ASM_MMAN_FIX_H -#include -/* MAP_32BIT is undefined on frv, fix it for perf */ -#define MAP_32BIT 0 -#endif -- GitLab From 553b085c2075f6a4a2591108554f830fa61e881f Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Wed, 7 Mar 2018 21:36:19 +0100 Subject: [PATCH 14/74] arch: remove m32r port The Mitsubishi/Renesas m32r architecture has been around for many years, but the Linux port has been obsolete for a very long time as well, with the last significant updates done for linux-2.6.14. While some m32r microcontrollers are still being marketed by Renesas, those are apparently no longer possible to support, mainly due to the lack of an external memory interface. Hirokazu Takata was the maintainer until the architecture got marked Orphaned in 2014. Link: http://www.linux-m32r.org/ Link: https://www.renesas.com/en-eu/products/microcontrollers-microprocessors/m32r.html Cc: Hirokazu Takata Signed-off-by: Arnd Bergmann --- MAINTAINERS | 5 - arch/m32r/Kconfig | 419 --------- arch/m32r/Kconfig.debug | 22 - arch/m32r/Makefile | 63 -- arch/m32r/boot/Makefile | 19 - arch/m32r/boot/compressed/Makefile | 51 -- arch/m32r/boot/compressed/boot.h | 60 -- arch/m32r/boot/compressed/head.S | 177 ---- arch/m32r/boot/compressed/install.sh | 57 -- arch/m32r/boot/compressed/m32r_sio.c | 77 -- arch/m32r/boot/compressed/misc.c | 93 -- arch/m32r/boot/compressed/vmlinux.lds.S | 31 - arch/m32r/boot/compressed/vmlinux.scr | 9 - arch/m32r/boot/setup.S | 185 ---- arch/m32r/configs/m32104ut_defconfig | 144 --- arch/m32r/configs/m32700ut.smp_defconfig | 85 -- arch/m32r/configs/m32700ut.up_defconfig | 84 -- arch/m32r/configs/mappi.nommu_defconfig | 46 - arch/m32r/configs/mappi.smp_defconfig | 62 -- arch/m32r/configs/mappi.up_defconfig | 60 -- arch/m32r/configs/mappi2.opsp_defconfig | 65 -- arch/m32r/configs/mappi2.vdec2_defconfig | 64 -- arch/m32r/configs/mappi3.smp_defconfig | 62 -- arch/m32r/configs/oaks32r_defconfig | 43 - arch/m32r/configs/opsput_defconfig | 63 -- arch/m32r/configs/usrv_defconfig | 78 -- arch/m32r/include/asm/Kbuild | 13 - arch/m32r/include/asm/addrspace.h | 57 -- arch/m32r/include/asm/asm-offsets.h | 1 - arch/m32r/include/asm/assembler.h | 231 ----- arch/m32r/include/asm/atomic.h | 275 ------ arch/m32r/include/asm/barrier.h | 16 - arch/m32r/include/asm/bitops.h | 274 ------ arch/m32r/include/asm/bug.h | 5 - arch/m32r/include/asm/bugs.h | 20 - arch/m32r/include/asm/cache.h | 9 - arch/m32r/include/asm/cachectl.h | 27 - arch/m32r/include/asm/cacheflush.h | 73 -- arch/m32r/include/asm/checksum.h | 202 ----- arch/m32r/include/asm/cmpxchg.h | 225 ----- arch/m32r/include/asm/dcache_clear.h | 29 - arch/m32r/include/asm/delay.h | 1 - arch/m32r/include/asm/device.h | 10 - arch/m32r/include/asm/div64.h | 1 - arch/m32r/include/asm/dma.h | 13 - arch/m32r/include/asm/elf.h | 132 --- arch/m32r/include/asm/emergency-restart.h | 7 - arch/m32r/include/asm/fb.h | 20 - arch/m32r/include/asm/flat.h | 143 --- arch/m32r/include/asm/ftrace.h | 1 - arch/m32r/include/asm/futex.h | 6 - arch/m32r/include/asm/hardirq.h | 10 - arch/m32r/include/asm/hw_irq.h | 4 - arch/m32r/include/asm/io.h | 225 ----- arch/m32r/include/asm/irq.h | 91 -- arch/m32r/include/asm/irq_regs.h | 1 - arch/m32r/include/asm/irqflags.h | 104 --- arch/m32r/include/asm/kdebug.h | 1 - arch/m32r/include/asm/kmap_types.h | 13 - arch/m32r/include/asm/linkage.h | 8 - arch/m32r/include/asm/local.h | 341 ------- arch/m32r/include/asm/local64.h | 1 - arch/m32r/include/asm/m32102.h | 315 ------- arch/m32r/include/asm/m32104ut/m32104ut_pld.h | 161 ---- arch/m32r/include/asm/m32700ut/m32700ut_lan.h | 103 --- arch/m32r/include/asm/m32700ut/m32700ut_lcd.h | 55 -- arch/m32r/include/asm/m32700ut/m32700ut_pld.h | 259 ------ arch/m32r/include/asm/m32r.h | 161 ---- arch/m32r/include/asm/m32r_mp_fpga.h | 314 ------- arch/m32r/include/asm/mappi2/mappi2_pld.h | 150 ---- arch/m32r/include/asm/mappi3/mappi3_pld.h | 142 --- arch/m32r/include/asm/mc146818rtc.h | 30 - arch/m32r/include/asm/mmu.h | 22 - arch/m32r/include/asm/mmu_context.h | 167 ---- arch/m32r/include/asm/mmzone.h | 54 -- arch/m32r/include/asm/opsput/opsput_lan.h | 52 -- arch/m32r/include/asm/opsput/opsput_lcd.h | 55 -- arch/m32r/include/asm/opsput/opsput_pld.h | 255 ------ arch/m32r/include/asm/page.h | 90 -- arch/m32r/include/asm/pci.h | 7 - arch/m32r/include/asm/percpu.h | 7 - arch/m32r/include/asm/pgalloc.h | 82 -- arch/m32r/include/asm/pgtable-2level.h | 76 -- arch/m32r/include/asm/pgtable.h | 348 -------- arch/m32r/include/asm/processor.h | 127 --- arch/m32r/include/asm/ptrace.h | 44 - arch/m32r/include/asm/rtc.h | 66 -- arch/m32r/include/asm/s1d13806.h | 200 ----- arch/m32r/include/asm/segment.h | 11 - arch/m32r/include/asm/serial.h | 10 - arch/m32r/include/asm/setup.h | 32 - arch/m32r/include/asm/shmparam.h | 7 - arch/m32r/include/asm/signal.h | 25 - arch/m32r/include/asm/smp.h | 113 --- arch/m32r/include/asm/spinlock.h | 308 ------- arch/m32r/include/asm/spinlock_types.h | 24 - arch/m32r/include/asm/string.h | 14 - arch/m32r/include/asm/switch_to.h | 51 -- arch/m32r/include/asm/syscall.h | 9 - arch/m32r/include/asm/termios.h | 52 -- arch/m32r/include/asm/thread_info.h | 126 --- arch/m32r/include/asm/timex.h | 28 - arch/m32r/include/asm/tlb.h | 21 - arch/m32r/include/asm/tlbflush.h | 98 -- arch/m32r/include/asm/topology.h | 7 - arch/m32r/include/asm/types.h | 13 - arch/m32r/include/asm/uaccess.h | 515 ----------- arch/m32r/include/asm/ucontext.h | 13 - arch/m32r/include/asm/unaligned.h | 19 - arch/m32r/include/asm/unistd.h | 51 -- arch/m32r/include/asm/user.h | 53 -- arch/m32r/include/asm/vga.h | 21 - arch/m32r/include/asm/xor.h | 7 - arch/m32r/include/uapi/asm/Kbuild | 7 - arch/m32r/include/uapi/asm/auxvec.h | 4 - arch/m32r/include/uapi/asm/bitsperlong.h | 2 - arch/m32r/include/uapi/asm/byteorder.h | 11 - arch/m32r/include/uapi/asm/errno.h | 7 - arch/m32r/include/uapi/asm/fcntl.h | 2 - arch/m32r/include/uapi/asm/ioctl.h | 2 - arch/m32r/include/uapi/asm/ioctls.h | 7 - arch/m32r/include/uapi/asm/ipcbuf.h | 2 - arch/m32r/include/uapi/asm/mman.h | 1 - arch/m32r/include/uapi/asm/msgbuf.h | 32 - arch/m32r/include/uapi/asm/param.h | 8 - arch/m32r/include/uapi/asm/posix_types.h | 26 - arch/m32r/include/uapi/asm/ptrace.h | 118 --- arch/m32r/include/uapi/asm/resource.h | 7 - arch/m32r/include/uapi/asm/sembuf.h | 26 - arch/m32r/include/uapi/asm/setup.h | 12 - arch/m32r/include/uapi/asm/shmbuf.h | 43 - arch/m32r/include/uapi/asm/sigcontext.h | 40 - arch/m32r/include/uapi/asm/signal.h | 118 --- arch/m32r/include/uapi/asm/socket.h | 108 --- arch/m32r/include/uapi/asm/sockios.h | 14 - arch/m32r/include/uapi/asm/stat.h | 88 -- arch/m32r/include/uapi/asm/statfs.h | 7 - arch/m32r/include/uapi/asm/swab.h | 11 - arch/m32r/include/uapi/asm/termbits.h | 201 ----- arch/m32r/include/uapi/asm/termios.h | 44 - arch/m32r/include/uapi/asm/types.h | 1 - arch/m32r/include/uapi/asm/unistd.h | 336 ------- arch/m32r/kernel/.gitignore | 1 - arch/m32r/kernel/Makefile | 12 - arch/m32r/kernel/align.c | 585 ------------ arch/m32r/kernel/asm-offsets.c | 15 - arch/m32r/kernel/entry.S | 553 ------------ arch/m32r/kernel/head.S | 284 ------ arch/m32r/kernel/irq.c | 44 - arch/m32r/kernel/m32r_ksyms.c | 89 -- arch/m32r/kernel/module.c | 203 ----- arch/m32r/kernel/process.c | 154 ---- arch/m32r/kernel/ptrace.c | 708 --------------- arch/m32r/kernel/setup.c | 424 --------- arch/m32r/kernel/signal.c | 336 ------- arch/m32r/kernel/smp.c | 836 ------------------ arch/m32r/kernel/smpboot.c | 627 ------------- arch/m32r/kernel/sys_m32r.c | 91 -- arch/m32r/kernel/syscall_table.S | 328 ------- arch/m32r/kernel/time.c | 199 ----- arch/m32r/kernel/traps.c | 324 ------- arch/m32r/kernel/vmlinux.lds.S | 79 -- arch/m32r/lib/Makefile | 7 - arch/m32r/lib/ashxdi3.S | 294 ------ arch/m32r/lib/checksum.S | 320 ------- arch/m32r/lib/csum_partial_copy.c | 59 -- arch/m32r/lib/delay.c | 130 --- arch/m32r/lib/libgcc.h | 24 - arch/m32r/lib/memcpy.S | 93 -- arch/m32r/lib/memset.S | 179 ---- arch/m32r/lib/strlen.S | 118 --- arch/m32r/lib/ucmpdi2.c | 18 - arch/m32r/lib/usercopy.c | 362 -------- arch/m32r/mm/Makefile | 13 - arch/m32r/mm/cache.c | 89 -- arch/m32r/mm/discontig.c | 163 ---- arch/m32r/mm/extable.c | 20 - arch/m32r/mm/fault-nommu.c | 134 --- arch/m32r/mm/fault.c | 550 ------------ arch/m32r/mm/init.c | 152 ---- arch/m32r/mm/ioremap-nommu.c | 52 -- arch/m32r/mm/ioremap.c | 111 --- arch/m32r/mm/mmu.S | 355 -------- arch/m32r/mm/page.S | 82 -- arch/m32r/oprofile/Makefile | 10 - arch/m32r/oprofile/init.c | 22 - arch/m32r/platforms/Makefile | 10 - arch/m32r/platforms/m32104ut/Makefile | 1 - arch/m32r/platforms/m32104ut/io.c | 298 ------- arch/m32r/platforms/m32104ut/setup.c | 139 --- arch/m32r/platforms/m32700ut/Makefile | 1 - .../m32700ut/dot.gdbinit_200MHz_16MB | 249 ------ .../m32700ut/dot.gdbinit_300MHz_32MB | 249 ------ .../m32700ut/dot.gdbinit_400MHz_32MB | 249 ------ arch/m32r/platforms/m32700ut/io.c | 395 --------- arch/m32r/platforms/m32700ut/setup.c | 451 ---------- arch/m32r/platforms/mappi/Makefile | 1 - arch/m32r/platforms/mappi/dot.gdbinit | 242 ----- arch/m32r/platforms/mappi/dot.gdbinit.nommu | 245 ----- arch/m32r/platforms/mappi/dot.gdbinit.smp | 344 ------- arch/m32r/platforms/mappi/io.c | 326 ------- arch/m32r/platforms/mappi/setup.c | 175 ---- arch/m32r/platforms/mappi2/Makefile | 1 - arch/m32r/platforms/mappi2/dot.gdbinit.vdec2 | 233 ----- arch/m32r/platforms/mappi2/io.c | 384 -------- arch/m32r/platforms/mappi2/setup.c | 172 ---- arch/m32r/platforms/mappi3/Makefile | 1 - arch/m32r/platforms/mappi3/dot.gdbinit | 224 ----- arch/m32r/platforms/mappi3/io.c | 406 --------- arch/m32r/platforms/mappi3/setup.c | 221 ----- arch/m32r/platforms/oaks32r/Makefile | 1 - arch/m32r/platforms/oaks32r/dot.gdbinit.nommu | 154 ---- arch/m32r/platforms/oaks32r/io.c | 229 ----- arch/m32r/platforms/oaks32r/setup.c | 114 --- arch/m32r/platforms/opsput/Makefile | 1 - arch/m32r/platforms/opsput/dot.gdbinit | 218 ----- arch/m32r/platforms/opsput/io.c | 395 --------- arch/m32r/platforms/opsput/setup.c | 448 ---------- arch/m32r/platforms/usrv/Makefile | 1 - arch/m32r/platforms/usrv/io.c | 225 ----- arch/m32r/platforms/usrv/setup.c | 213 ----- .../arch/m32r/include/uapi/asm/bitsperlong.h | 2 - tools/arch/m32r/include/uapi/asm/mman.h | 7 - 223 files changed, 27243 deletions(-) delete mode 100644 arch/m32r/Kconfig delete mode 100644 arch/m32r/Kconfig.debug delete mode 100644 arch/m32r/Makefile delete mode 100644 arch/m32r/boot/Makefile delete mode 100644 arch/m32r/boot/compressed/Makefile delete mode 100644 arch/m32r/boot/compressed/boot.h delete mode 100644 arch/m32r/boot/compressed/head.S delete mode 100644 arch/m32r/boot/compressed/install.sh delete mode 100644 arch/m32r/boot/compressed/m32r_sio.c delete mode 100644 arch/m32r/boot/compressed/misc.c delete mode 100644 arch/m32r/boot/compressed/vmlinux.lds.S delete mode 100644 arch/m32r/boot/compressed/vmlinux.scr delete mode 100644 arch/m32r/boot/setup.S delete mode 100644 arch/m32r/configs/m32104ut_defconfig delete mode 100644 arch/m32r/configs/m32700ut.smp_defconfig delete mode 100644 arch/m32r/configs/m32700ut.up_defconfig delete mode 100644 arch/m32r/configs/mappi.nommu_defconfig delete mode 100644 arch/m32r/configs/mappi.smp_defconfig delete mode 100644 arch/m32r/configs/mappi.up_defconfig delete mode 100644 arch/m32r/configs/mappi2.opsp_defconfig delete mode 100644 arch/m32r/configs/mappi2.vdec2_defconfig delete mode 100644 arch/m32r/configs/mappi3.smp_defconfig delete mode 100644 arch/m32r/configs/oaks32r_defconfig delete mode 100644 arch/m32r/configs/opsput_defconfig delete mode 100644 arch/m32r/configs/usrv_defconfig delete mode 100644 arch/m32r/include/asm/Kbuild delete mode 100644 arch/m32r/include/asm/addrspace.h delete mode 100644 arch/m32r/include/asm/asm-offsets.h delete mode 100644 arch/m32r/include/asm/assembler.h delete mode 100644 arch/m32r/include/asm/atomic.h delete mode 100644 arch/m32r/include/asm/barrier.h delete mode 100644 arch/m32r/include/asm/bitops.h delete mode 100644 arch/m32r/include/asm/bug.h delete mode 100644 arch/m32r/include/asm/bugs.h delete mode 100644 arch/m32r/include/asm/cache.h delete mode 100644 arch/m32r/include/asm/cachectl.h delete mode 100644 arch/m32r/include/asm/cacheflush.h delete mode 100644 arch/m32r/include/asm/checksum.h delete mode 100644 arch/m32r/include/asm/cmpxchg.h delete mode 100644 arch/m32r/include/asm/dcache_clear.h delete mode 100644 arch/m32r/include/asm/delay.h delete mode 100644 arch/m32r/include/asm/device.h delete mode 100644 arch/m32r/include/asm/div64.h delete mode 100644 arch/m32r/include/asm/dma.h delete mode 100644 arch/m32r/include/asm/elf.h delete mode 100644 arch/m32r/include/asm/emergency-restart.h delete mode 100644 arch/m32r/include/asm/fb.h delete mode 100644 arch/m32r/include/asm/flat.h delete mode 100644 arch/m32r/include/asm/ftrace.h delete mode 100644 arch/m32r/include/asm/futex.h delete mode 100644 arch/m32r/include/asm/hardirq.h delete mode 100644 arch/m32r/include/asm/hw_irq.h delete mode 100644 arch/m32r/include/asm/io.h delete mode 100644 arch/m32r/include/asm/irq.h delete mode 100644 arch/m32r/include/asm/irq_regs.h delete mode 100644 arch/m32r/include/asm/irqflags.h delete mode 100644 arch/m32r/include/asm/kdebug.h delete mode 100644 arch/m32r/include/asm/kmap_types.h delete mode 100644 arch/m32r/include/asm/linkage.h delete mode 100644 arch/m32r/include/asm/local.h delete mode 100644 arch/m32r/include/asm/local64.h delete mode 100644 arch/m32r/include/asm/m32102.h delete mode 100644 arch/m32r/include/asm/m32104ut/m32104ut_pld.h delete mode 100644 arch/m32r/include/asm/m32700ut/m32700ut_lan.h delete mode 100644 arch/m32r/include/asm/m32700ut/m32700ut_lcd.h delete mode 100644 arch/m32r/include/asm/m32700ut/m32700ut_pld.h delete mode 100644 arch/m32r/include/asm/m32r.h delete mode 100644 arch/m32r/include/asm/m32r_mp_fpga.h delete mode 100644 arch/m32r/include/asm/mappi2/mappi2_pld.h delete mode 100644 arch/m32r/include/asm/mappi3/mappi3_pld.h delete mode 100644 arch/m32r/include/asm/mc146818rtc.h delete mode 100644 arch/m32r/include/asm/mmu.h delete mode 100644 arch/m32r/include/asm/mmu_context.h delete mode 100644 arch/m32r/include/asm/mmzone.h delete mode 100644 arch/m32r/include/asm/opsput/opsput_lan.h delete mode 100644 arch/m32r/include/asm/opsput/opsput_lcd.h delete mode 100644 arch/m32r/include/asm/opsput/opsput_pld.h delete mode 100644 arch/m32r/include/asm/page.h delete mode 100644 arch/m32r/include/asm/pci.h delete mode 100644 arch/m32r/include/asm/percpu.h delete mode 100644 arch/m32r/include/asm/pgalloc.h delete mode 100644 arch/m32r/include/asm/pgtable-2level.h delete mode 100644 arch/m32r/include/asm/pgtable.h delete mode 100644 arch/m32r/include/asm/processor.h delete mode 100644 arch/m32r/include/asm/ptrace.h delete mode 100644 arch/m32r/include/asm/rtc.h delete mode 100644 arch/m32r/include/asm/s1d13806.h delete mode 100644 arch/m32r/include/asm/segment.h delete mode 100644 arch/m32r/include/asm/serial.h delete mode 100644 arch/m32r/include/asm/setup.h delete mode 100644 arch/m32r/include/asm/shmparam.h delete mode 100644 arch/m32r/include/asm/signal.h delete mode 100644 arch/m32r/include/asm/smp.h delete mode 100644 arch/m32r/include/asm/spinlock.h delete mode 100644 arch/m32r/include/asm/spinlock_types.h delete mode 100644 arch/m32r/include/asm/string.h delete mode 100644 arch/m32r/include/asm/switch_to.h delete mode 100644 arch/m32r/include/asm/syscall.h delete mode 100644 arch/m32r/include/asm/termios.h delete mode 100644 arch/m32r/include/asm/thread_info.h delete mode 100644 arch/m32r/include/asm/timex.h delete mode 100644 arch/m32r/include/asm/tlb.h delete mode 100644 arch/m32r/include/asm/tlbflush.h delete mode 100644 arch/m32r/include/asm/topology.h delete mode 100644 arch/m32r/include/asm/types.h delete mode 100644 arch/m32r/include/asm/uaccess.h delete mode 100644 arch/m32r/include/asm/ucontext.h delete mode 100644 arch/m32r/include/asm/unaligned.h delete mode 100644 arch/m32r/include/asm/unistd.h delete mode 100644 arch/m32r/include/asm/user.h delete mode 100644 arch/m32r/include/asm/vga.h delete mode 100644 arch/m32r/include/asm/xor.h delete mode 100644 arch/m32r/include/uapi/asm/Kbuild delete mode 100644 arch/m32r/include/uapi/asm/auxvec.h delete mode 100644 arch/m32r/include/uapi/asm/bitsperlong.h delete mode 100644 arch/m32r/include/uapi/asm/byteorder.h delete mode 100644 arch/m32r/include/uapi/asm/errno.h delete mode 100644 arch/m32r/include/uapi/asm/fcntl.h delete mode 100644 arch/m32r/include/uapi/asm/ioctl.h delete mode 100644 arch/m32r/include/uapi/asm/ioctls.h delete mode 100644 arch/m32r/include/uapi/asm/ipcbuf.h delete mode 100644 arch/m32r/include/uapi/asm/mman.h delete mode 100644 arch/m32r/include/uapi/asm/msgbuf.h delete mode 100644 arch/m32r/include/uapi/asm/param.h delete mode 100644 arch/m32r/include/uapi/asm/posix_types.h delete mode 100644 arch/m32r/include/uapi/asm/ptrace.h delete mode 100644 arch/m32r/include/uapi/asm/resource.h delete mode 100644 arch/m32r/include/uapi/asm/sembuf.h delete mode 100644 arch/m32r/include/uapi/asm/setup.h delete mode 100644 arch/m32r/include/uapi/asm/shmbuf.h delete mode 100644 arch/m32r/include/uapi/asm/sigcontext.h delete mode 100644 arch/m32r/include/uapi/asm/signal.h delete mode 100644 arch/m32r/include/uapi/asm/socket.h delete mode 100644 arch/m32r/include/uapi/asm/sockios.h delete mode 100644 arch/m32r/include/uapi/asm/stat.h delete mode 100644 arch/m32r/include/uapi/asm/statfs.h delete mode 100644 arch/m32r/include/uapi/asm/swab.h delete mode 100644 arch/m32r/include/uapi/asm/termbits.h delete mode 100644 arch/m32r/include/uapi/asm/termios.h delete mode 100644 arch/m32r/include/uapi/asm/types.h delete mode 100644 arch/m32r/include/uapi/asm/unistd.h delete mode 100644 arch/m32r/kernel/.gitignore delete mode 100644 arch/m32r/kernel/Makefile delete mode 100644 arch/m32r/kernel/align.c delete mode 100644 arch/m32r/kernel/asm-offsets.c delete mode 100644 arch/m32r/kernel/entry.S delete mode 100644 arch/m32r/kernel/head.S delete mode 100644 arch/m32r/kernel/irq.c delete mode 100644 arch/m32r/kernel/m32r_ksyms.c delete mode 100644 arch/m32r/kernel/module.c delete mode 100644 arch/m32r/kernel/process.c delete mode 100644 arch/m32r/kernel/ptrace.c delete mode 100644 arch/m32r/kernel/setup.c delete mode 100644 arch/m32r/kernel/signal.c delete mode 100644 arch/m32r/kernel/smp.c delete mode 100644 arch/m32r/kernel/smpboot.c delete mode 100644 arch/m32r/kernel/sys_m32r.c delete mode 100644 arch/m32r/kernel/syscall_table.S delete mode 100644 arch/m32r/kernel/time.c delete mode 100644 arch/m32r/kernel/traps.c delete mode 100644 arch/m32r/kernel/vmlinux.lds.S delete mode 100644 arch/m32r/lib/Makefile delete mode 100644 arch/m32r/lib/ashxdi3.S delete mode 100644 arch/m32r/lib/checksum.S delete mode 100644 arch/m32r/lib/csum_partial_copy.c delete mode 100644 arch/m32r/lib/delay.c delete mode 100644 arch/m32r/lib/libgcc.h delete mode 100644 arch/m32r/lib/memcpy.S delete mode 100644 arch/m32r/lib/memset.S delete mode 100644 arch/m32r/lib/strlen.S delete mode 100644 arch/m32r/lib/ucmpdi2.c delete mode 100644 arch/m32r/lib/usercopy.c delete mode 100644 arch/m32r/mm/Makefile delete mode 100644 arch/m32r/mm/cache.c delete mode 100644 arch/m32r/mm/discontig.c delete mode 100644 arch/m32r/mm/extable.c delete mode 100644 arch/m32r/mm/fault-nommu.c delete mode 100644 arch/m32r/mm/fault.c delete mode 100644 arch/m32r/mm/init.c delete mode 100644 arch/m32r/mm/ioremap-nommu.c delete mode 100644 arch/m32r/mm/ioremap.c delete mode 100644 arch/m32r/mm/mmu.S delete mode 100644 arch/m32r/mm/page.S delete mode 100644 arch/m32r/oprofile/Makefile delete mode 100644 arch/m32r/oprofile/init.c delete mode 100644 arch/m32r/platforms/Makefile delete mode 100644 arch/m32r/platforms/m32104ut/Makefile delete mode 100644 arch/m32r/platforms/m32104ut/io.c delete mode 100644 arch/m32r/platforms/m32104ut/setup.c delete mode 100644 arch/m32r/platforms/m32700ut/Makefile delete mode 100644 arch/m32r/platforms/m32700ut/dot.gdbinit_200MHz_16MB delete mode 100644 arch/m32r/platforms/m32700ut/dot.gdbinit_300MHz_32MB delete mode 100644 arch/m32r/platforms/m32700ut/dot.gdbinit_400MHz_32MB delete mode 100644 arch/m32r/platforms/m32700ut/io.c delete mode 100644 arch/m32r/platforms/m32700ut/setup.c delete mode 100644 arch/m32r/platforms/mappi/Makefile delete mode 100644 arch/m32r/platforms/mappi/dot.gdbinit delete mode 100644 arch/m32r/platforms/mappi/dot.gdbinit.nommu delete mode 100644 arch/m32r/platforms/mappi/dot.gdbinit.smp delete mode 100644 arch/m32r/platforms/mappi/io.c delete mode 100644 arch/m32r/platforms/mappi/setup.c delete mode 100644 arch/m32r/platforms/mappi2/Makefile delete mode 100644 arch/m32r/platforms/mappi2/dot.gdbinit.vdec2 delete mode 100644 arch/m32r/platforms/mappi2/io.c delete mode 100644 arch/m32r/platforms/mappi2/setup.c delete mode 100644 arch/m32r/platforms/mappi3/Makefile delete mode 100644 arch/m32r/platforms/mappi3/dot.gdbinit delete mode 100644 arch/m32r/platforms/mappi3/io.c delete mode 100644 arch/m32r/platforms/mappi3/setup.c delete mode 100644 arch/m32r/platforms/oaks32r/Makefile delete mode 100644 arch/m32r/platforms/oaks32r/dot.gdbinit.nommu delete mode 100644 arch/m32r/platforms/oaks32r/io.c delete mode 100644 arch/m32r/platforms/oaks32r/setup.c delete mode 100644 arch/m32r/platforms/opsput/Makefile delete mode 100644 arch/m32r/platforms/opsput/dot.gdbinit delete mode 100644 arch/m32r/platforms/opsput/io.c delete mode 100644 arch/m32r/platforms/opsput/setup.c delete mode 100644 arch/m32r/platforms/usrv/Makefile delete mode 100644 arch/m32r/platforms/usrv/io.c delete mode 100644 arch/m32r/platforms/usrv/setup.c delete mode 100644 tools/arch/m32r/include/uapi/asm/bitsperlong.h delete mode 100644 tools/arch/m32r/include/uapi/asm/mman.h diff --git a/MAINTAINERS b/MAINTAINERS index 3655d284af209..f48790625e3fa 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -8308,11 +8308,6 @@ W: http://linux-test-project.github.io/ T: git git://github.com/linux-test-project/ltp.git S: Maintained -M32R ARCHITECTURE -W: http://www.linux-m32r.org/ -S: Orphan -F: arch/m32r/ - M68K ARCHITECTURE M: Geert Uytterhoeven L: linux-m68k@lists.linux-m68k.org diff --git a/arch/m32r/Kconfig b/arch/m32r/Kconfig deleted file mode 100644 index dd84ee194579f..0000000000000 --- a/arch/m32r/Kconfig +++ /dev/null @@ -1,419 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -config M32R - bool - default y - select HAVE_IDE - select HAVE_OPROFILE - select INIT_ALL_POSSIBLE - select HAVE_KERNEL_GZIP - select HAVE_KERNEL_BZIP2 - select HAVE_KERNEL_LZMA - select ARCH_WANT_IPC_PARSE_VERSION - select HAVE_DEBUG_BUGVERBOSE - select VIRT_TO_BUS - select GENERIC_IRQ_PROBE - select GENERIC_IRQ_SHOW - select GENERIC_ATOMIC64 - select ARCH_HAS_DEVMEM_IS_ALLOWED - select ARCH_USES_GETTIMEOFFSET - select MODULES_USE_ELF_RELA - select HAVE_DEBUG_STACKOVERFLOW - select CPU_NO_EFFICIENT_FFS - select DMA_DIRECT_OPS - select ARCH_NO_COHERENT_DMA_MMAP if !MMU - -config SBUS - bool - -config GENERIC_ISA_DMA - bool - default y - -config ZONE_DMA - bool - default y - -config NO_IOPORT_MAP - def_bool y - -config NO_DMA - def_bool n - -config HZ - int - default 100 - -source "init/Kconfig" - -source "kernel/Kconfig.freezer" - - -menu "Processor type and features" - -choice - prompt "Platform Type" - default PLAT_MAPPI - -config PLAT_MAPPI - bool "Mappi-I" - help - The Mappi-I is an FPGA board for SOC (System-On-a-Chip) prototyping. - You can operate a Linux system on this board by using an M32R - softmacro core, which is a fully-synthesizable functional model - described in Verilog-HDL. - - The Mappi-I board was the first platform, which had been used - to port and develop a Linux system for the M32R processor. - Currently, the Mappi-II, an heir to the Mappi-I, is available. - -config PLAT_USRV - bool "uServer" - select PLAT_HAS_INT1ICU - -config PLAT_M32700UT - bool "M32700UT" - select PLAT_HAS_INT0ICU - select PLAT_HAS_INT1ICU - select PLAT_HAS_INT2ICU - help - The M3T-M32700UT is an evaluation board based on uT-Engine - specification. This board has an M32700 (Chaos) evaluation chip. - You can say Y for SMP, because the M32700 is a single chip - multiprocessor. - -config PLAT_OPSPUT - bool "OPSPUT" - select PLAT_HAS_INT0ICU - select PLAT_HAS_INT1ICU - select PLAT_HAS_INT2ICU - help - The OPSPUT is an evaluation board based on uT-Engine - specification. This board has a OPSP-REP chip. - -config PLAT_OAKS32R - bool "OAKS32R" - help - The OAKS32R is a tiny, inexpensive evaluation board. - Please note that if you say Y here and choose chip "M32102", - say N for MMU and select a no-MMU version kernel, otherwise - a kernel with MMU support will not work, because the M32102 - is a microcontroller for embedded systems and it has no MMU. - -config PLAT_MAPPI2 - bool "Mappi-II(M3A-ZA36/M3A-ZA52)" - -config PLAT_MAPPI3 - bool "Mappi-III(M3A-2170)" - -config PLAT_M32104UT - bool "M32104UT" - select PLAT_HAS_INT1ICU - help - The M3T-M32104UT is an reference board based on uT-Engine - specification. This board has a M32104 chip. - -endchoice - -choice - prompt "Processor family" - default CHIP_M32700 - -config CHIP_M32700 - bool "M32700 (Chaos)" - -config CHIP_M32102 - bool "M32102" - -config CHIP_M32104 - bool "M32104" - depends on PLAT_M32104UT - -config CHIP_VDEC2 - bool "VDEC2" - -config CHIP_OPSP - bool "OPSP" - -endchoice - -config MMU - bool "Support for memory management hardware" - depends on CHIP_M32700 || CHIP_VDEC2 || CHIP_OPSP - default y - -config TLB_ENTRIES - int "TLB Entries" - depends on CHIP_M32700 || CHIP_VDEC2 || CHIP_OPSP - default 32 if CHIP_M32700 || CHIP_OPSP - default 16 if CHIP_VDEC2 - - -config ISA_M32R - bool - depends on CHIP_M32102 || CHIP_M32104 - default y - -config ISA_M32R2 - bool - depends on CHIP_M32700 || CHIP_VDEC2 || CHIP_OPSP - default y - -config ISA_DSP_LEVEL2 - bool - depends on CHIP_M32700 || CHIP_OPSP - default y - -config ISA_DUAL_ISSUE - bool - depends on CHIP_M32700 || CHIP_OPSP - default y - -config PLAT_HAS_INT0ICU - bool - default n - -config PLAT_HAS_INT1ICU - bool - default n - -config PLAT_HAS_INT2ICU - bool - default n - -config BUS_CLOCK - int "Bus Clock [Hz] (integer)" - default "70000000" if PLAT_MAPPI - default "25000000" if PLAT_USRV - default "50000000" if PLAT_MAPPI3 - default "50000000" if PLAT_M32700UT - default "50000000" if PLAT_OPSPUT - default "54000000" if PLAT_M32104UT - default "33333333" if PLAT_OAKS32R - default "20000000" if PLAT_MAPPI2 - -config TIMER_DIVIDE - int "Timer divider (integer)" - default "128" - -config CPU_BIG_ENDIAN - bool - default !CPU_LITTLE_ENDIAN - -config CPU_LITTLE_ENDIAN - bool "Generate little endian code" - default n - -config MEMORY_START - hex "Physical memory start address (hex)" - default "08000000" if PLAT_MAPPI || PLAT_MAPPI2 || PLAT_MAPPI3 - default "08000000" if PLAT_USRV - default "08000000" if PLAT_M32700UT - default "08000000" if PLAT_OPSPUT - default "04000000" if PLAT_M32104UT - default "01000000" if PLAT_OAKS32R - -config MEMORY_SIZE - hex "Physical memory size (hex)" - default "08000000" if PLAT_MAPPI3 - default "04000000" if PLAT_MAPPI || PLAT_MAPPI2 - default "02000000" if PLAT_USRV - default "01000000" if PLAT_M32700UT - default "01000000" if PLAT_OPSPUT - default "01000000" if PLAT_M32104UT - default "00800000" if PLAT_OAKS32R - -config ARCH_DISCONTIGMEM_ENABLE - bool "Internal RAM Support" - depends on CHIP_M32700 || CHIP_M32102 || CHIP_VDEC2 || CHIP_OPSP || CHIP_M32104 - default y - -source "mm/Kconfig" - -config IRAM_START - hex "Internal memory start address (hex)" - default "00f00000" if !CHIP_M32104 - default "00700000" if CHIP_M32104 - depends on (CHIP_M32700 || CHIP_M32102 || CHIP_VDEC2 || CHIP_OPSP || CHIP_M32104) && DISCONTIGMEM - -config IRAM_SIZE - hex "Internal memory size (hex)" - depends on (CHIP_M32700 || CHIP_M32102 || CHIP_VDEC2 || CHIP_OPSP || CHIP_M32104) && DISCONTIGMEM - default "00080000" if CHIP_M32700 - default "00010000" if CHIP_M32102 || CHIP_OPSP || CHIP_M32104 - default "00008000" if CHIP_VDEC2 - -# -# Define implied options from the CPU selection here -# - -config GENERIC_LOCKBREAK - bool - default y - depends on SMP && PREEMPT - -config RWSEM_GENERIC_SPINLOCK - bool - depends on M32R - default y - -config RWSEM_XCHGADD_ALGORITHM - bool - default n - -config ARCH_HAS_ILOG2_U32 - bool - default n - -config ARCH_HAS_ILOG2_U64 - bool - default n - -config GENERIC_HWEIGHT - bool - default y - -config GENERIC_CALIBRATE_DELAY - bool - default y - -config SCHED_OMIT_FRAME_POINTER - bool - default y - -source "kernel/Kconfig.preempt" - -config SMP - bool "Symmetric multi-processing support" - depends on MMU - ---help--- - This enables support for systems with more than one CPU. If you have - a system with only one CPU, say N. If you have a system with more - than one CPU, say Y. - - If you say N here, the kernel will run on uni- and multiprocessor - machines, but will use only one CPU of a multiprocessor machine. If - you say Y here, the kernel will run on many, but not all, - uniprocessor machines. On a uniprocessor machine, the kernel - will run faster if you say N here. - - People using multiprocessor machines who say Y here should also say - Y to "Enhanced Real Time Clock Support", below. The "Advanced Power - Management" code will be disabled if you say Y here. - - See also the SMP-HOWTO available at - . - - If you don't know what to do here, say N. - -config CHIP_M32700_TS1 - bool "Workaround code for the M32700 TS1 chip's bug" - depends on (CHIP_M32700 && SMP) - default n - -config NR_CPUS - int "Maximum number of CPUs (2-32)" - range 2 32 - depends on SMP - default "2" - help - This allows you to specify the maximum number of CPUs which this - kernel will support. The maximum supported value is 32 and the - minimum value which makes sense is 2. - - This is purely to save memory - each supported CPU adds - approximately eight kilobytes to the kernel image. - -# Common NUMA Features -config NUMA - bool "Numa Memory Allocation Support" - depends on SMP && BROKEN - default n - -config NODES_SHIFT - int - default "1" - depends on NEED_MULTIPLE_NODES - -endmenu - - -menu "Bus options (PCI, PCMCIA, EISA, MCA, ISA)" - -config PCI - bool "PCI support" - depends on BROKEN - default n - help - Find out whether you have a PCI motherboard. PCI is the name of a - bus system, i.e. the way the CPU talks to the other stuff inside - your box. Other bus systems are ISA, EISA, MicroChannel (MCA) or - VESA. If you have PCI, say Y, otherwise N. - -choice - prompt "PCI access mode" - depends on PCI - default PCI_GOANY - -config PCI_GOBIOS - bool "BIOS" - ---help--- - On PCI systems, the BIOS can be used to detect the PCI devices and - determine their configuration. However, some old PCI motherboards - have BIOS bugs and may crash if this is done. Also, some embedded - PCI-based systems don't have any BIOS at all. Linux can also try to - detect the PCI hardware directly without using the BIOS. - - With this option, you can specify how Linux should detect the PCI - devices. If you choose "BIOS", the BIOS will be used, if you choose - "Direct", the BIOS won't be used, and if you choose "Any", the - kernel will try the direct access method and falls back to the BIOS - if that doesn't work. If unsure, go with the default, which is - "Any". - -config PCI_GODIRECT - bool "Direct" - -config PCI_GOANY - bool "Any" - -endchoice - -config PCI_BIOS - bool - depends on PCI && (PCI_GOBIOS || PCI_GOANY) - default y - -config PCI_DIRECT - bool - depends on PCI && (PCI_GODIRECT || PCI_GOANY) - default y - -source "drivers/pci/Kconfig" - -config ISA - bool - -source "drivers/pcmcia/Kconfig" - -endmenu - - -menu "Executable file formats" - -source "fs/Kconfig.binfmt" - -endmenu - -source "net/Kconfig" - -source "drivers/Kconfig" - -source "fs/Kconfig" - -source "arch/m32r/Kconfig.debug" - -source "security/Kconfig" - -source "crypto/Kconfig" - -source "lib/Kconfig" diff --git a/arch/m32r/Kconfig.debug b/arch/m32r/Kconfig.debug deleted file mode 100644 index ffca1e194f91e..0000000000000 --- a/arch/m32r/Kconfig.debug +++ /dev/null @@ -1,22 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -menu "Kernel hacking" - -source "lib/Kconfig.debug" - -config DEBUG_PAGEALLOC - bool "Debug page memory allocations" - depends on DEBUG_KERNEL && BROKEN - help - Unmap pages from the kernel linear mapping after free_pages(). - This results in a large slowdown, but helps to find certain types - of memory corruptions. - -config FRAME_POINTER - bool "Compile the kernel with frame pointers" - help - If you say Y here the resulting kernel image will be slightly larger - and slower, but it will give very useful debugging information. - If you don't debug the kernel, you can say N, but we may not be able - to solve problems without frame pointers. - -endmenu diff --git a/arch/m32r/Makefile b/arch/m32r/Makefile deleted file mode 100644 index d73b58c847a63..0000000000000 --- a/arch/m32r/Makefile +++ /dev/null @@ -1,63 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# -# m32r/Makefile -# -# This file is included by the global makefile so that you can add your own -# architecture-specific flags and dependencies. -# - -KBUILD_DEFCONFIG := m32700ut.smp_defconfig - -LDFLAGS := -OBJCOPYFLAGS := -O binary -R .note -R .comment -S -LDFLAGS_vmlinux := - -KBUILD_CFLAGS += -pipe -fno-schedule-insns -KBUILD_CFLAGS_KERNEL += -mmodel=medium -KBUILD_CFLAGS_MODULE += -mmodel=large - -ifdef CONFIG_CHIP_VDEC2 -cflags-$(CONFIG_ISA_M32R2) += -DNO_FPU -Wa,-bitinst -aflags-$(CONFIG_ISA_M32R2) += -DNO_FPU -O2 -Wa,-bitinst -Wa,-no-parallel -else -cflags-$(CONFIG_ISA_M32R2) += -DNO_FPU -m32r2 -aflags-$(CONFIG_ISA_M32R2) += -DNO_FPU -m32r2 -O2 -endif - -cflags-$(CONFIG_ISA_M32R) += -DNO_FPU -aflags-$(CONFIG_ISA_M32R) += -DNO_FPU -O2 -Wa,-no-bitinst - -KBUILD_CFLAGS += $(cflags-y) -KBUILD_AFLAGS += $(aflags-y) - -CHECKFLAGS += -D__m32r__ -D__BIG_ENDIAN__=1 - -head-y := arch/m32r/kernel/head.o - -LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) - -libs-y += arch/m32r/lib/ $(LIBGCC) -core-y += arch/m32r/kernel/ \ - arch/m32r/mm/ \ - arch/m32r/boot/ \ - arch/m32r/platforms/ - -drivers-$(CONFIG_OPROFILE) += arch/m32r/oprofile/ - -boot := arch/m32r/boot - -PHONY += zImage - -all: zImage - -zImage: vmlinux - $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ - -compressed: zImage - -archclean: - $(Q)$(MAKE) $(clean)=$(boot) - -define archhelp - echo '* zImage - Compressed kernel image (arch/$(ARCH)/boot/zImage)' -endef diff --git a/arch/m32r/boot/Makefile b/arch/m32r/boot/Makefile deleted file mode 100644 index af2cef475d98d..0000000000000 --- a/arch/m32r/boot/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -# -# arch/m32r/boot/Makefile -# -# This file is subject to the terms and conditions of the GNU General Public -# License. See the file "COPYING" in the main directory of this archive -# for more details. - -targets := zImage -subdir- := compressed - -obj-y := setup.o - -$(obj)/zImage: $(obj)/compressed/vmlinux FORCE - $(call if_changed,objcopy) - @echo 'Kernel: $@ is ready' - -$(obj)/compressed/vmlinux: FORCE - $(Q)$(MAKE) $(build)=$(obj)/compressed $@ - diff --git a/arch/m32r/boot/compressed/Makefile b/arch/m32r/boot/compressed/Makefile deleted file mode 100644 index abd3c75ebd32c..0000000000000 --- a/arch/m32r/boot/compressed/Makefile +++ /dev/null @@ -1,51 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# -# linux/arch/m32r/boot/compressed/Makefile -# -# create a compressed vmlinux image from the original vmlinux -# - -targets := vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 \ - vmlinux.bin.lzma head.o misc.o piggy.o vmlinux.lds - -OBJECTS = $(obj)/head.o $(obj)/misc.o - -# -# IMAGE_OFFSET is the load offset of the compression loader -# -#IMAGE_OFFSET := $(shell printf "0x%08x" $$[$(CONFIG_MEMORY_START)+0x2000]) -#IMAGE_OFFSET := $(shell printf "0x%08x" $$[$(CONFIG_MEMORY_START)+0x00400000]) - -LDFLAGS_vmlinux := -T - -$(obj)/vmlinux: $(obj)/vmlinux.lds $(OBJECTS) $(obj)/piggy.o FORCE - $(call if_changed,ld) - -$(obj)/vmlinux.bin: vmlinux FORCE - $(call if_changed,objcopy) - -$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE - $(call if_changed,gzip) - -$(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin FORCE - $(call if_changed,bzip2) - -$(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE - $(call if_changed,lzma) - -CFLAGS_misc.o += -fpic - -ifdef CONFIG_MMU -LDFLAGS_piggy.o := -r --format binary --oformat elf32-m32r-linux -T -else -LDFLAGS_piggy.o := -r --format binary --oformat elf32-m32r -T -endif - -OBJCOPYFLAGS += -R .empty_zero_page - -suffix-$(CONFIG_KERNEL_GZIP) = gz -suffix-$(CONFIG_KERNEL_BZIP2) = bz2 -suffix-$(CONFIG_KERNEL_LZMA) = lzma - -$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.$(suffix-y) FORCE - $(call if_changed,ld) diff --git a/arch/m32r/boot/compressed/boot.h b/arch/m32r/boot/compressed/boot.h deleted file mode 100644 index 7fce713e8aac6..0000000000000 --- a/arch/m32r/boot/compressed/boot.h +++ /dev/null @@ -1,60 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * 1. load vmlinuz - * - * CONFIG_MEMORY_START +-----------------------+ - * | vmlinuz | - * +-----------------------+ - * 2. decompressed - * - * CONFIG_MEMORY_START +-----------------------+ - * | vmlinuz | - * +-----------------------+ - * | | - * BOOT_RELOC_ADDR +-----------------------+ - * | | - * KERNEL_DECOMPRESS_ADDR +-----------------------+ - * | vmlinux | - * +-----------------------+ - * - * 3. relocate copy & jump code - * - * CONFIG_MEMORY_START +-----------------------+ - * | vmlinuz | - * +-----------------------+ - * | | - * BOOT_RELOC_ADDR +-----------------------+ - * | boot(copy&jump) | - * KERNEL_DECOMPRESS_ADDR +-----------------------+ - * | vmlinux | - * +-----------------------+ - * - * 4. relocate decompressed kernel - * - * CONFIG_MEMORY_START +-----------------------+ - * | vmlinux | - * +-----------------------+ - * | | - * BOOT_RELOC_ADDR +-----------------------+ - * | boot(copy&jump) | - * KERNEL_DECOMPRESS_ADDR +-----------------------+ - * | | - * +-----------------------+ - * - */ -#ifdef __ASSEMBLY__ -#define __val(x) x -#else -#define __val(x) (x) -#endif - -#define DECOMPRESS_OFFSET_BASE __val(0x00900000) -#define BOOT_RELOC_SIZE __val(0x00001000) - -#define KERNEL_EXEC_ADDR __val(CONFIG_MEMORY_START) -#define KERNEL_DECOMPRESS_ADDR __val(CONFIG_MEMORY_START + \ - DECOMPRESS_OFFSET_BASE + BOOT_RELOC_SIZE) -#define KERNEL_ENTRY __val(CONFIG_MEMORY_START + 0x1000) - -#define BOOT_EXEC_ADDR __val(CONFIG_MEMORY_START) -#define BOOT_RELOC_ADDR __val(CONFIG_MEMORY_START + DECOMPRESS_OFFSET_BASE) diff --git a/arch/m32r/boot/compressed/head.S b/arch/m32r/boot/compressed/head.S deleted file mode 100644 index 39b693640375f..0000000000000 --- a/arch/m32r/boot/compressed/head.S +++ /dev/null @@ -1,177 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * linux/arch/m32r/boot/compressed/head.S - * - * Copyright (c) 2001-2003 Hiroyuki Kondo, Hirokazu Takata, - * Hitoshi Yamamoto, Takeo Takahashi - * Copyright (c) 2004 Hirokazu Takata - */ - - .text -#include -#include -#include -#include - - /* - * This code can be loaded anywhere, as long as output will not - * overlap it. - * - * NOTE: This head.S should *NOT* be compiled with -fpic. - * - */ - - .global startup - .global __bss_start, _ebss, end, zimage_data, zimage_len - __ALIGN -startup: - ldi r0, #0x0000 /* SPI, disable EI */ - mvtc r0, psw - - ldi r12, #-8 - bl 1f - .fillinsn -1: - seth r1, #high(CONFIG_MEMORY_START + 0x00400000) /* Start address */ - add r12, r14 /* Real address */ - sub r12, r1 /* difference */ - - .global got_len - seth r3, #high(_GLOBAL_OFFSET_TABLE_+8) - or3 r3, r3, #low(_GLOBAL_OFFSET_TABLE_+12) - add r3, r14 - - /* Update the contents of global offset table */ - ldi r1, #low(got_len) - srli r1, #2 - beqz r1, 2f - .fillinsn -1: - ld r2, @r3 - add r2, r12 - st r2, @r3 - addi r3, #4 - addi r1, #-1 - bnez r1, 1b - .fillinsn -2: - /* XXX: resolve plt */ - -/* - * Clear BSS first so that there are no surprises... - */ -#ifdef CONFIG_ISA_DUAL_ISSUE - seth r2, #high(__bss_start) - or3 r2, r2, #low(__bss_start) - add r2, r12 - seth r3, #high(_ebss) - or3 r3, r3, #low(_ebss) - add r3, r12 - sub r3, r2 - - ; R4 = BSS size in longwords (rounded down) - mv r4, r3 || ldi r1, #0 - srli r4, #4 || addi r2, #-4 - beqz r4, .Lendloop1 -.Lloop1: -#ifndef CONFIG_CHIP_M32310 - ; Touch memory for the no-write-allocating cache. - ld r0, @(4,r2) -#endif - st r1, @+r2 || addi r4, #-1 - st r1, @+r2 - st r1, @+r2 - st r1, @+r2 || cmpeq r1, r4 ; R4 = 0? - bnc .Lloop1 -.Lendloop1: - and3 r4, r3, #15 - addi r2, #4 - beqz r4, .Lendloop2 -.Lloop2: - stb r1, @r2 || addi r4, #-1 - addi r2, #1 - bnez r4, .Lloop2 -.Lendloop2: - -#else /* not CONFIG_ISA_DUAL_ISSUE */ - seth r2, #high(__bss_start) - or3 r2, r2, #low(__bss_start) - add r2, r12 - seth r3, #high(_ebss) - or3 r3, r3, #low(_ebss) - add r3, r12 - sub r3, r2 - mv r4, r3 - srli r4, #2 ; R4 = BSS size in longwords (rounded down) - ldi r1, #0 ; clear R1 for longwords store - addi r2, #-4 ; account for pre-inc store - beqz r4, .Lendloop1 ; any more to go? -.Lloop1: - st r1, @+r2 ; yep, zero out another longword - addi r4, #-1 ; decrement count - bnez r4, .Lloop1 ; go do some more -.Lendloop1: - -#endif /* not CONFIG_ISA_DUAL_ISSUE */ - - seth r1, #high(end) - or3 r1, r1, #low(end) - add r1, r12 - mv sp, r1 - -/* - * decompress the kernel - */ - mv r0, sp - srli r0, 31 /* MMU is ON or OFF */ - seth r1, #high(zimage_data) - or3 r1, r1, #low(zimage_data) - add r1, r12 - seth r2, #high(zimage_len) - or3 r2, r2, #low(zimage_len) - mv r3, sp - - bl decompress_kernel - -#if defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_OPSP) || defined(CONFIG_CHIP_VDEC2) - /* Cache flush */ - ldi r0, -1 - ldi r1, 0xd0 ; invalidate i-cache, copy back d-cache - stb r1, @r0 -#elif defined(CONFIG_CHIP_M32102) - /* Cache flush */ - ldi r0, -2 - ldi r1, 0x0100 ; invalidate - stb r1, @r0 -#elif defined(CONFIG_CHIP_M32104) - /* Cache flush */ - ldi r0, -2 - ldi r1, 0x0700 ; invalidate i-cache, copy back d-cache - sth r1, @r0 -#else -#error "put your cache flush function, please" -#endif - - mv r0, sp - srli r0, 31 /* MMU is ON or OFF */ - slli r0, 31 - or3 r0, r0, #0x2000 - seth r1, #high(CONFIG_MEMORY_START) - or r0, r1 - jmp r0 - - .balign 512 -fake_headers_as_bzImage: - .short 0 - .ascii "HdrS" - .short 0x0202 - .short 0 - .short 0 - .byte 0x00, 0x10 - .short 0 - .byte 0 - .byte 1 - .byte 0x00, 0x80 - .long 0 - .long 0 - diff --git a/arch/m32r/boot/compressed/install.sh b/arch/m32r/boot/compressed/install.sh deleted file mode 100644 index 16e5a0a134375..0000000000000 --- a/arch/m32r/boot/compressed/install.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh -# -# arch/sh/boot/install.sh -# -# This file is subject to 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) 1995 by Linus Torvalds -# -# Adapted from code in arch/i386/boot/Makefile by H. Peter Anvin -# Adapted from code in arch/i386/boot/install.sh by Russell King -# Adapted from code in arch/arm/boot/install.sh by Stuart Menefy -# Adapted from code in arch/sh/boot/install.sh by Takeo Takahashi -# -# "make install" script for sh architecture -# -# Arguments: -# $1 - kernel version -# $2 - kernel image file -# $3 - kernel map file -# $4 - default install path (blank if root directory) -# - -# User may have a custom install script - -if [ -x /sbin/${INSTALLKERNEL} ]; then - exec /sbin/${INSTALLKERNEL} "$@" -fi - -if [ "$2" = "zImage" ]; then -# Compressed install - echo "Installing compressed kernel" - if [ -f $4/vmlinuz-$1 ]; then - mv $4/vmlinuz-$1 $4/vmlinuz.old - fi - - if [ -f $4/System.map-$1 ]; then - mv $4/System.map-$1 $4/System.old - fi - - cat $2 > $4/vmlinuz-$1 - cp $3 $4/System.map-$1 -else -# Normal install - echo "Installing normal kernel" - if [ -f $4/vmlinux-$1 ]; then - mv $4/vmlinux-$1 $4/vmlinux.old - fi - - if [ -f $4/System.map ]; then - mv $4/System.map $4/System.old - fi - - cat $2 > $4/vmlinux-$1 - cp $3 $4/System.map -fi diff --git a/arch/m32r/boot/compressed/m32r_sio.c b/arch/m32r/boot/compressed/m32r_sio.c deleted file mode 100644 index 9d34bd063c318..0000000000000 --- a/arch/m32r/boot/compressed/m32r_sio.c +++ /dev/null @@ -1,77 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * arch/m32r/boot/compressed/m32r_sio.c - * - * 2003-02-12: Takeo Takahashi - * 2006-11-30: OPSPUT support by Kazuhiro Inaoka - * - */ - -#include - -static void m32r_putc(char c); - -static int puts(const char *s) -{ - char c; - while ((c = *s++)) - m32r_putc(c); - return 0; -} - -#if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_OPSPUT) -#include -#include - -#define USE_FPGA_MAP 0 - -#if USE_FPGA_MAP -/* - * fpga configuration program uses MMU, and define map as same as - * M32104 uT-Engine board. - */ -#define BOOT_SIO0STS (volatile unsigned short *)(0x02c00000 + 0x20006) -#define BOOT_SIO0TXB (volatile unsigned short *)(0x02c00000 + 0x2000c) -#else -#undef PLD_BASE -#if defined(CONFIG_PLAT_OPSPUT) -#define PLD_BASE 0x1cc00000 -#else -#define PLD_BASE 0xa4c00000 -#endif -#define BOOT_SIO0STS PLD_ESIO0STS -#define BOOT_SIO0TXB PLD_ESIO0TXB -#endif - -static void m32r_putc(char c) -{ - while ((*BOOT_SIO0STS & 0x3) != 0x3) - cpu_relax(); - if (c == '\n') { - *BOOT_SIO0TXB = '\r'; - while ((*BOOT_SIO0STS & 0x3) != 0x3) - cpu_relax(); - } - *BOOT_SIO0TXB = c; -} -#else /* !(CONFIG_PLAT_M32700UT) */ -#if defined(CONFIG_PLAT_MAPPI2) -#define SIO0STS (volatile unsigned short *)(0xa0efd000 + 14) -#define SIO0TXB (volatile unsigned short *)(0xa0efd000 + 30) -#else -#define SIO0STS (volatile unsigned short *)(0x00efd000 + 14) -#define SIO0TXB (volatile unsigned short *)(0x00efd000 + 30) -#endif - -static void m32r_putc(char c) -{ - while ((*SIO0STS & 0x1) == 0) - cpu_relax(); - if (c == '\n') { - *SIO0TXB = '\r'; - while ((*SIO0STS & 0x1) == 0) - cpu_relax(); - } - *SIO0TXB = c; -} -#endif diff --git a/arch/m32r/boot/compressed/misc.c b/arch/m32r/boot/compressed/misc.c deleted file mode 100644 index 43e3670556692..0000000000000 --- a/arch/m32r/boot/compressed/misc.c +++ /dev/null @@ -1,93 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * arch/m32r/boot/compressed/misc.c - * - * This is a collection of several routines from gzip-1.0.3 - * adapted for Linux. - * - * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994 - * - * Adapted for SH by Stuart Menefy, Aug 1999 - * - * 2003-02-12: Support M32R by Takeo Takahashi - */ - -/* - * gzip declarations - */ -#define STATIC static - -#undef memset -#undef memcpy -#define memzero(s, n) memset ((s), 0, (n)) - -static void error(char *m); - -#include "m32r_sio.c" - -static unsigned long free_mem_ptr; -static unsigned long free_mem_end_ptr; - -#ifdef CONFIG_KERNEL_BZIP2 -void *memset(void *s, int c, size_t n) -{ - char *ss = s; - - while (n--) - *ss++ = c; - return s; -} -#endif - -#ifdef CONFIG_KERNEL_GZIP -void *memcpy(void *dest, const void *src, size_t n) -{ - char *d = dest; - const char *s = src; - while (n--) - *d++ = *s++; - - return dest; -} - -#define BOOT_HEAP_SIZE 0x10000 -#include "../../../../lib/decompress_inflate.c" -#endif - -#ifdef CONFIG_KERNEL_BZIP2 -#define BOOT_HEAP_SIZE 0x400000 -#include "../../../../lib/decompress_bunzip2.c" -#endif - -#ifdef CONFIG_KERNEL_LZMA -#define BOOT_HEAP_SIZE 0x10000 -#include "../../../../lib/decompress_unlzma.c" -#endif - -static void error(char *x) -{ - puts("\n\n"); - puts(x); - puts("\n\n -- System halted"); - - while(1); /* Halt */ -} - -void -decompress_kernel(int mmu_on, unsigned char *zimage_data, - unsigned int zimage_len, unsigned long heap) -{ - unsigned char *input_data = zimage_data; - int input_len = zimage_len; - unsigned char *output_data; - - output_data = (unsigned char *)CONFIG_MEMORY_START + 0x2000 - + (mmu_on ? 0x80000000 : 0); - free_mem_ptr = heap; - free_mem_end_ptr = free_mem_ptr + BOOT_HEAP_SIZE; - - puts("\nDecompressing Linux... "); - __decompress(input_data, input_len, NULL, NULL, output_data, 0, - NULL, error); - puts("done.\nBooting the kernel.\n"); -} diff --git a/arch/m32r/boot/compressed/vmlinux.lds.S b/arch/m32r/boot/compressed/vmlinux.lds.S deleted file mode 100644 index c393eb559c4ce..0000000000000 --- a/arch/m32r/boot/compressed/vmlinux.lds.S +++ /dev/null @@ -1,31 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ - -OUTPUT_ARCH(m32r) -ENTRY(startup) -SECTIONS -{ - . = CONFIG_MEMORY_START + 0x00400000; - - _text = .; - .text : { *(.text) } = 0 - .rodata : { *(.rodata) *(.rodata.*) } - _etext = .; - - . = ALIGN(32 / 8); - .data : { *(.data) } - . = ALIGN(32 / 8); - _got = .; - .got : { *(.got) _egot = .; *(.got.*) } - _edata = .; - - . = ALIGN(32 / 8); - __bss_start = .; - .bss : { *(.bss) *(.sbss) } - . = ALIGN(32 / 8); - _ebss = .; - . = ALIGN(4096); - . += 4096; - end = . ; - - got_len = (_egot - _got); -} diff --git a/arch/m32r/boot/compressed/vmlinux.scr b/arch/m32r/boot/compressed/vmlinux.scr deleted file mode 100644 index 924c7992c55b9..0000000000000 --- a/arch/m32r/boot/compressed/vmlinux.scr +++ /dev/null @@ -1,9 +0,0 @@ -SECTIONS -{ - .data : { - zimage_data = .; - *(.data) - zimage_data_end = .; - } - zimage_len = zimage_data_end - zimage_data; -} diff --git a/arch/m32r/boot/setup.S b/arch/m32r/boot/setup.S deleted file mode 100644 index 5909a825e2ed1..0000000000000 --- a/arch/m32r/boot/setup.S +++ /dev/null @@ -1,185 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * linux/arch/m32r/boot/setup.S -- A setup code. - * - * Copyright (C) 2001-2005 Hiroyuki Kondo, Hirokazu Takata, - * Hitoshi Yamamoto, Hayato Fujiwara - * - */ - -#include -#include -#include -#include - -#include -#include -#include - -/* - * References to members of the boot_cpu_data structure. - */ - -#define CPU_PARAMS boot_cpu_data -#define M32R_MCICAR 0xfffffff0 -#define M32R_MCDCAR 0xfffffff4 -#define M32R_MCCR 0xfffffffc -#define M32R_BSCR0 0xffffffd2 - -;BSEL -#define BSEL0CR0 0x00ef5000 -#define BSEL0CR1 0x00ef5004 -#define BSEL1CR0 0x00ef5100 -#define BSEL1CR1 0x00ef5104 -#define BSEL0CR0_VAL 0x00000000 -#define BSEL0CR1_VAL 0x01200100 -#define BSEL1CR0_VAL 0x01018000 -#define BSEL1CR1_VAL 0x00200001 - -;SDRAMC -#define SDRAMC_SDRF0 0x00ef6000 -#define SDRAMC_SDRF1 0x00ef6004 -#define SDRAMC_SDIR0 0x00ef6008 -#define SDRAMC_SDIR1 0x00ef600c -#define SDRAMC_SD0ADR 0x00ef6020 -#define SDRAMC_SD0ER 0x00ef6024 -#define SDRAMC_SD0TR 0x00ef6028 -#define SDRAMC_SD0MOD 0x00ef602c -#define SDRAMC_SD1ADR 0x00ef6040 -#define SDRAMC_SD1ER 0x00ef6044 -#define SDRAMC_SD1TR 0x00ef6048 -#define SDRAMC_SD1MOD 0x00ef604c -#define SDRAM0 0x18000000 -#define SDRAM1 0x1c000000 - -/*------------------------------------------------------------------------ - * start up - */ - -/*------------------------------------------------------------------------ - * Kernel entry - */ - .section .boot, "ax" -ENTRY(boot) - -/* Set cache mode */ -#if defined(CONFIG_CHIP_XNUX2) - ldi r0, #-2 ;LDIMM (r0, M32R_MCCR) - ldi r1, #0x0101 ; cache on (with invalidation) -; ldi r1, #0x00 ; cache off - sth r1, @r0 -#elif defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_VDEC2) \ - || defined(CONFIG_CHIP_OPSP) - ldi r0, #-4 ;LDIMM (r0, M32R_MCCR) - ldi r1, #0x73 ; cache on (with invalidation) -; ldi r1, #0x00 ; cache off - st r1, @r0 -#elif defined(CONFIG_CHIP_M32102) - ldi r0, #-4 ;LDIMM (r0, M32R_MCCR) - ldi r1, #0x101 ; cache on (with invalidation) -; ldi r1, #0x00 ; cache off - st r1, @r0 -#elif defined(CONFIG_CHIP_M32104) - ldi r0, #-96 ; DNCR0 - seth r1, #0x0060 ; from 0x00600000 - or3 r1, r1, #0x0005 ; size 2MB - st r1, @r0 - seth r1, #0x0100 ; from 0x01000000 - or3 r1, r1, #0x0003 ; size 16MB - st r1, @+r0 - seth r1, #0x0200 ; from 0x02000000 - or3 r1, r1, #0x0002 ; size 32MB - st r1, @+r0 - ldi r0, #-4 ;LDIMM (r0, M32R_MCCR) - ldi r1, #0x703 ; cache on (with invalidation) - st r1, @r0 -#else -#error unknown chip configuration -#endif - -#ifdef CONFIG_SMP - ;; if not BSP (CPU#0) goto AP_loop - seth r5, #shigh(M32R_CPUID_PORTL) - ld r5, @(low(M32R_CPUID_PORTL), r5) - bnez r5, AP_loop -#if !defined(CONFIG_PLAT_USRV) - ;; boot AP - ld24 r5, #0xeff2f8 ; IPICR7 - ldi r6, #0x2 ; IPI to CPU1 - st r6, @r5 -#endif -#endif - -/* - * Now, Jump to stext - * if with MMU, TLB on. - * if with no MMU, only jump. - */ - .global eit_vector -mmu_on: - LDIMM (r13, stext) -#ifdef CONFIG_MMU - bl init_tlb - LDIMM (r2, eit_vector) ; set EVB(cr5) - mvtc r2, cr5 - seth r0, #high(MMU_REG_BASE) ; Set MMU_REG_BASE higher - or3 r0, r0, #low(MMU_REG_BASE) ; Set MMU_REG_BASE lower - ldi r1, #0x01 - st r1, @(MATM_offset,r0) ; Set MATM (T bit ON) - ld r0, @(MATM_offset,r0) ; Check -#else -#if defined(CONFIG_CHIP_M32700) - seth r0,#high(M32R_MCDCAR) - or3 r0,r0,#low(M32R_MCDCAR) - ld24 r1,#0x8080 - st r1,@r0 -#elif defined(CONFIG_CHIP_M32104) - LDIMM (r2, eit_vector) ; set EVB(cr5) - mvtc r2, cr5 -#endif -#endif /* CONFIG_MMU */ - jmp r13 - nop - nop - -#ifdef CONFIG_SMP -/* - * AP wait loop - */ -ENTRY(AP_loop) - ;; disable interrupt - clrpsw #0x40 - ;; reset EVB - LDIMM (r4, _AP_RE) - seth r5, #high(__PAGE_OFFSET) - or3 r5, r5, #low(__PAGE_OFFSET) - not r5, r5 - and r4, r5 - mvtc r4, cr5 - ;; disable maskable interrupt - seth r4, #high(M32R_ICU_IMASK_PORTL) - or3 r4, r4, #low(M32R_ICU_IMASK_PORTL) - ldi r5, #0 - st r5, @r4 - ld r5, @r4 - ;; enable only IPI - setpsw #0x40 - ;; LOOOOOOOOOOOOOOP!!! - .fillinsn -2: - nop - nop - bra 2b - nop - nop - -#ifdef CONFIG_CHIP_M32700_TS1 - .global dcache_dummy - .balign 16, 0 -dcache_dummy: - .byte 16 -#endif /* CONFIG_CHIP_M32700_TS1 */ -#endif /* CONFIG_SMP */ - - .end - diff --git a/arch/m32r/configs/m32104ut_defconfig b/arch/m32r/configs/m32104ut_defconfig deleted file mode 100644 index 4aa42acbd5129..0000000000000 --- a/arch/m32r/configs/m32104ut_defconfig +++ /dev/null @@ -1,144 +0,0 @@ -CONFIG_SYSVIPC=y -CONFIG_IKCONFIG=y -CONFIG_IKCONFIG_PROC=y -CONFIG_LOG_BUF_SHIFT=14 -CONFIG_SLAB=y -CONFIG_PROFILING=y -CONFIG_OPROFILE=m -CONFIG_MODULES=y -CONFIG_MODULE_UNLOAD=y -CONFIG_MODULE_FORCE_UNLOAD=y -# CONFIG_BLK_DEV_BSG is not set -CONFIG_PLAT_M32104UT=y -CONFIG_CHIP_M32104=y -CONFIG_MEMORY_START=0x04000000 -CONFIG_MEMORY_SIZE=0x01000000 -CONFIG_IRAM_START=0x00700000 -CONFIG_IRAM_SIZE=0x00010000 -CONFIG_PREEMPT=y -CONFIG_BINFMT_MISC=y -CONFIG_NET=y -CONFIG_PACKET=y -CONFIG_UNIX=y -CONFIG_INET=y -# CONFIG_IPV6 is not set -CONFIG_NETFILTER=y -CONFIG_NETFILTER_NETLINK_QUEUE=m -CONFIG_NETFILTER_NETLINK_LOG=m -CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m -CONFIG_NETFILTER_XT_TARGET_MARK=m -CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m -CONFIG_NETFILTER_XT_MATCH_COMMENT=m -CONFIG_NETFILTER_XT_MATCH_DCCP=m -CONFIG_NETFILTER_XT_MATCH_LENGTH=m -CONFIG_NETFILTER_XT_MATCH_LIMIT=m -CONFIG_NETFILTER_XT_MATCH_MAC=m -CONFIG_NETFILTER_XT_MATCH_MARK=m -CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m -CONFIG_NETFILTER_XT_MATCH_REALM=m -CONFIG_NETFILTER_XT_MATCH_SCTP=m -CONFIG_NETFILTER_XT_MATCH_STRING=m -CONFIG_NETFILTER_XT_MATCH_TCPMSS=m -CONFIG_IP_NF_IPTABLES=m -CONFIG_IP_NF_MATCH_ADDRTYPE=m -CONFIG_IP_NF_MATCH_ECN=m -CONFIG_IP_NF_MATCH_TTL=m -CONFIG_IP_NF_FILTER=m -CONFIG_IP_NF_TARGET_REJECT=m -CONFIG_IP_NF_TARGET_LOG=m -CONFIG_IP_NF_MANGLE=m -CONFIG_IP_NF_TARGET_ECN=m -CONFIG_IP_NF_TARGET_TTL=m -CONFIG_IP_NF_RAW=m -CONFIG_IP_NF_ARPTABLES=m -CONFIG_IP_NF_ARPFILTER=m -CONFIG_IP_NF_ARP_MANGLE=m -CONFIG_PARPORT=m -CONFIG_PARPORT_1284=y -CONFIG_BLK_DEV_LOOP=y -CONFIG_BLK_DEV_NBD=m -CONFIG_CDROM_PKTCDVD=m -CONFIG_CDROM_PKTCDVD_WCACHE=y -CONFIG_IDE=y -CONFIG_BLK_DEV_IDECD=y -CONFIG_IDE_GENERIC=y -CONFIG_SCSI=y -CONFIG_BLK_DEV_SD=y -CONFIG_CHR_DEV_ST=m -CONFIG_BLK_DEV_SR=m -CONFIG_CHR_DEV_SG=m -CONFIG_SCSI_MULTI_LUN=y -CONFIG_SCSI_CONSTANTS=y -CONFIG_SCSI_SPI_ATTRS=y -CONFIG_MD=y -CONFIG_BLK_DEV_MD=y -CONFIG_MD_RAID1=y -CONFIG_BLK_DEV_DM=m -CONFIG_DM_CRYPT=m -CONFIG_DM_SNAPSHOT=m -CONFIG_NETDEVICES=y -CONFIG_DUMMY=m -CONFIG_NET_ETHERNET=y -CONFIG_MII=y -CONFIG_NE2000=m -CONFIG_SERIAL_8250=m -# CONFIG_HW_RANDOM is not set -CONFIG_I2C=m -CONFIG_I2C_CHARDEV=m -CONFIG_SENSORS_ADM1021=m -CONFIG_SENSORS_ADM1025=m -CONFIG_SENSORS_ADM1031=m -CONFIG_SENSORS_DS1621=m -CONFIG_SENSORS_GL518SM=m -CONFIG_SENSORS_IT87=m -CONFIG_SENSORS_LM75=m -CONFIG_SENSORS_LM77=m -CONFIG_SENSORS_LM78=m -CONFIG_SENSORS_LM80=m -CONFIG_SENSORS_LM83=m -CONFIG_SENSORS_LM85=m -CONFIG_SENSORS_LM90=m -CONFIG_SENSORS_MAX1619=m -CONFIG_SENSORS_SMSC47M1=m -CONFIG_SENSORS_W83781D=m -CONFIG_SENSORS_W83L785TS=m -CONFIG_SENSORS_W83627HF=m -CONFIG_EXT2_FS=y -CONFIG_EXT2_FS_XATTR=y -CONFIG_EXT2_FS_POSIX_ACL=y -CONFIG_EXT2_FS_SECURITY=y -CONFIG_EXT3_FS=y -CONFIG_EXT3_FS_POSIX_ACL=y -CONFIG_EXT3_FS_SECURITY=y -CONFIG_ISO9660_FS=y -CONFIG_JOLIET=y -CONFIG_UDF_FS=m -CONFIG_MSDOS_FS=y -CONFIG_VFAT_FS=y -CONFIG_CONFIGFS_FS=m -CONFIG_ROMFS_FS=y -CONFIG_NFS_FS=y -CONFIG_NFS_V3=y -CONFIG_NFSD=m -CONFIG_NFSD_V3=y -CONFIG_NLS_DEFAULT="cp437" -CONFIG_NLS_CODEPAGE_437=y -CONFIG_NLS_CODEPAGE_932=y -CONFIG_NLS_ISO8859_1=y -CONFIG_CRYPTO_NULL=m -CONFIG_CRYPTO_ECB=m -CONFIG_CRYPTO_PCBC=m -CONFIG_CRYPTO_HMAC=y -CONFIG_CRYPTO_MD4=m -CONFIG_CRYPTO_MD5=m -CONFIG_CRYPTO_SHA1=m -CONFIG_CRYPTO_SHA256=m -CONFIG_CRYPTO_SHA512=m -CONFIG_CRYPTO_WP512=m -CONFIG_CRYPTO_BLOWFISH=m -CONFIG_CRYPTO_DES=m -CONFIG_CRYPTO_SERPENT=m -CONFIG_CRYPTO_TWOFISH=m -CONFIG_CRC_CCITT=m -CONFIG_CRC16=m -CONFIG_LIBCRC32C=m diff --git a/arch/m32r/configs/m32700ut.smp_defconfig b/arch/m32r/configs/m32700ut.smp_defconfig deleted file mode 100644 index 41a0495b65df4..0000000000000 --- a/arch/m32r/configs/m32700ut.smp_defconfig +++ /dev/null @@ -1,85 +0,0 @@ -CONFIG_SYSVIPC=y -CONFIG_BSD_PROCESS_ACCT=y -CONFIG_IKCONFIG=y -CONFIG_IKCONFIG_PROC=y -CONFIG_LOG_BUF_SHIFT=15 -# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set -CONFIG_EXPERT=y -# CONFIG_KALLSYMS is not set -# CONFIG_FUTEX is not set -# CONFIG_EPOLL is not set -CONFIG_SLAB=y -CONFIG_PROFILING=y -CONFIG_OPROFILE=y -CONFIG_MODULES=y -CONFIG_MODULE_UNLOAD=y -# CONFIG_BLK_DEV_BSG is not set -CONFIG_PLAT_M32700UT=y -CONFIG_MEMORY_START=0x08000000 -CONFIG_MEMORY_SIZE=0x01000000 -CONFIG_IRAM_START=0x00f00000 -CONFIG_IRAM_SIZE=0x00080000 -CONFIG_PREEMPT=y -CONFIG_SMP=y -CONFIG_NET=y -CONFIG_PACKET=y -CONFIG_UNIX=y -CONFIG_INET=y -CONFIG_IP_PNP=y -CONFIG_IP_PNP_DHCP=y -# CONFIG_IPV6 is not set -CONFIG_MTD=y -CONFIG_MTD_REDBOOT_PARTS=y -CONFIG_MTD_BLOCK=y -CONFIG_MTD_CFI=m -CONFIG_MTD_JEDECPROBE=m -CONFIG_MTD_CFI_ADV_OPTIONS=y -CONFIG_MTD_CFI_BE_BYTE_SWAP=y -CONFIG_MTD_CFI_GEOMETRY=y -# CONFIG_MTD_CFI_I2 is not set -CONFIG_MTD_CFI_AMDSTD=m -CONFIG_BLK_DEV_LOOP=y -CONFIG_BLK_DEV_NBD=y -CONFIG_BLK_DEV_RAM=y -CONFIG_ATA_OVER_ETH=m -CONFIG_IDE=y -CONFIG_BLK_DEV_IDECD=m -CONFIG_IDE_GENERIC=y -CONFIG_SCSI=m -CONFIG_BLK_DEV_SD=m -CONFIG_BLK_DEV_SR=m -CONFIG_CHR_DEV_SG=m -CONFIG_SCSI_MULTI_LUN=y -CONFIG_NETDEVICES=y -CONFIG_NET_ETHERNET=y -CONFIG_SMC91X=y -# CONFIG_INPUT_MOUSEDEV is not set -# CONFIG_INPUT_KEYBOARD is not set -# CONFIG_INPUT_MOUSE is not set -# CONFIG_SERIO_I8042 is not set -CONFIG_SERIAL_M32R_SIO_CONSOLE=y -CONFIG_SERIAL_M32R_PLDSIO=y -CONFIG_HW_RANDOM=y -CONFIG_DS1302=y -CONFIG_FB=y -CONFIG_FIRMWARE_EDID=y -CONFIG_FB_S1D13XXX=y -# CONFIG_VGA_CONSOLE is not set -CONFIG_FRAMEBUFFER_CONSOLE=y -CONFIG_LOGO=y -CONFIG_MMC=y -CONFIG_MMC_DEBUG=y -CONFIG_EXT2_FS=y -CONFIG_EXT3_FS=y -CONFIG_REISERFS_FS=m -CONFIG_ISO9660_FS=m -CONFIG_JOLIET=y -CONFIG_UDF_FS=m -CONFIG_MSDOS_FS=m -CONFIG_VFAT_FS=m -CONFIG_PROC_KCORE=y -CONFIG_TMPFS=y -CONFIG_NFS_FS=y -CONFIG_NFS_V3=y -CONFIG_ROOT_NFS=y -CONFIG_NLS=y diff --git a/arch/m32r/configs/m32700ut.up_defconfig b/arch/m32r/configs/m32700ut.up_defconfig deleted file mode 100644 index 20078a866f45e..0000000000000 --- a/arch/m32r/configs/m32700ut.up_defconfig +++ /dev/null @@ -1,84 +0,0 @@ -CONFIG_SYSVIPC=y -CONFIG_BSD_PROCESS_ACCT=y -CONFIG_IKCONFIG=y -CONFIG_IKCONFIG_PROC=y -CONFIG_LOG_BUF_SHIFT=14 -# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set -CONFIG_EXPERT=y -# CONFIG_KALLSYMS is not set -# CONFIG_FUTEX is not set -# CONFIG_EPOLL is not set -CONFIG_SLAB=y -CONFIG_PROFILING=y -CONFIG_OPROFILE=y -CONFIG_MODULES=y -CONFIG_MODULE_UNLOAD=y -# CONFIG_BLK_DEV_BSG is not set -CONFIG_PLAT_M32700UT=y -CONFIG_MEMORY_START=0x08000000 -CONFIG_MEMORY_SIZE=0x01000000 -CONFIG_IRAM_START=0x00f00000 -CONFIG_IRAM_SIZE=0x00080000 -CONFIG_PREEMPT=y -CONFIG_NET=y -CONFIG_PACKET=y -CONFIG_UNIX=y -CONFIG_INET=y -CONFIG_IP_PNP=y -CONFIG_IP_PNP_DHCP=y -# CONFIG_IPV6 is not set -CONFIG_MTD=y -CONFIG_MTD_REDBOOT_PARTS=y -CONFIG_MTD_BLOCK=y -CONFIG_MTD_CFI=m -CONFIG_MTD_JEDECPROBE=m -CONFIG_MTD_CFI_ADV_OPTIONS=y -CONFIG_MTD_CFI_BE_BYTE_SWAP=y -CONFIG_MTD_CFI_GEOMETRY=y -# CONFIG_MTD_CFI_I2 is not set -CONFIG_MTD_CFI_AMDSTD=m -CONFIG_BLK_DEV_LOOP=y -CONFIG_BLK_DEV_NBD=y -CONFIG_BLK_DEV_RAM=y -CONFIG_ATA_OVER_ETH=m -CONFIG_IDE=y -CONFIG_BLK_DEV_IDECD=m -CONFIG_IDE_GENERIC=y -CONFIG_SCSI=m -CONFIG_BLK_DEV_SD=m -CONFIG_BLK_DEV_SR=m -CONFIG_CHR_DEV_SG=m -CONFIG_SCSI_MULTI_LUN=y -CONFIG_NETDEVICES=y -CONFIG_NET_ETHERNET=y -CONFIG_SMC91X=y -# CONFIG_INPUT_MOUSEDEV is not set -# CONFIG_INPUT_KEYBOARD is not set -# CONFIG_INPUT_MOUSE is not set -# CONFIG_SERIO_I8042 is not set -CONFIG_SERIAL_M32R_SIO_CONSOLE=y -CONFIG_SERIAL_M32R_PLDSIO=y -CONFIG_HW_RANDOM=y -CONFIG_DS1302=y -CONFIG_FB=y -CONFIG_FIRMWARE_EDID=y -CONFIG_FB_S1D13XXX=y -# CONFIG_VGA_CONSOLE is not set -CONFIG_FRAMEBUFFER_CONSOLE=y -CONFIG_LOGO=y -CONFIG_MMC=y -CONFIG_MMC_DEBUG=y -CONFIG_EXT2_FS=y -CONFIG_EXT3_FS=y -CONFIG_REISERFS_FS=m -CONFIG_ISO9660_FS=m -CONFIG_JOLIET=y -CONFIG_UDF_FS=m -CONFIG_MSDOS_FS=m -CONFIG_VFAT_FS=m -CONFIG_PROC_KCORE=y -CONFIG_TMPFS=y -CONFIG_NFS_FS=y -CONFIG_NFS_V3=y -CONFIG_ROOT_NFS=y -CONFIG_NLS=y diff --git a/arch/m32r/configs/mappi.nommu_defconfig b/arch/m32r/configs/mappi.nommu_defconfig deleted file mode 100644 index 4bf3820e054a8..0000000000000 --- a/arch/m32r/configs/mappi.nommu_defconfig +++ /dev/null @@ -1,46 +0,0 @@ -CONFIG_BSD_PROCESS_ACCT=y -CONFIG_IKCONFIG=y -CONFIG_LOG_BUF_SHIFT=14 -# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set -CONFIG_EXPERT=y -# CONFIG_KALLSYMS is not set -# CONFIG_FUTEX is not set -# CONFIG_EPOLL is not set -CONFIG_SLAB=y -CONFIG_MODULES=y -CONFIG_MODULE_UNLOAD=y -# CONFIG_BLK_DEV_BSG is not set -# CONFIG_MMU is not set -CONFIG_BUS_CLOCK=50000000 -CONFIG_MEMORY_START=0x00000000 -CONFIG_MEMORY_SIZE=0x00E00000 -CONFIG_IRAM_START=0x00f00000 -CONFIG_IRAM_SIZE=0x00080000 -CONFIG_PREEMPT=y -CONFIG_PCCARD=y -CONFIG_M32R_PCC=y -CONFIG_BINFMT_FLAT=y -CONFIG_NET=y -CONFIG_PACKET=y -CONFIG_UNIX=y -CONFIG_INET=y -CONFIG_IP_PNP=y -CONFIG_IP_PNP_DHCP=y -# CONFIG_IPV6 is not set -CONFIG_BLK_DEV_LOOP=y -CONFIG_BLK_DEV_NBD=y -CONFIG_BLK_DEV_RAM=y -CONFIG_NETDEVICES=y -# CONFIG_INPUT_MOUSEDEV is not set -# CONFIG_INPUT_KEYBOARD is not set -# CONFIG_INPUT_MOUSE is not set -# CONFIG_SERIO_I8042 is not set -# CONFIG_VT is not set -CONFIG_SERIAL_M32R_SIO_CONSOLE=y -CONFIG_HW_RANDOM=y -CONFIG_EXT2_FS=y -CONFIG_EXT3_FS=y -CONFIG_NFS_FS=y -CONFIG_NFS_V3=y -CONFIG_ROOT_NFS=y -CONFIG_NLS=y diff --git a/arch/m32r/configs/mappi.smp_defconfig b/arch/m32r/configs/mappi.smp_defconfig deleted file mode 100644 index f9ed7bdbf4ded..0000000000000 --- a/arch/m32r/configs/mappi.smp_defconfig +++ /dev/null @@ -1,62 +0,0 @@ -CONFIG_SYSVIPC=y -CONFIG_IKCONFIG=y -CONFIG_IKCONFIG_PROC=y -CONFIG_LOG_BUF_SHIFT=15 -CONFIG_BLK_DEV_INITRD=y -# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set -CONFIG_EXPERT=y -# CONFIG_KALLSYMS is not set -# CONFIG_FUTEX is not set -# CONFIG_EPOLL is not set -CONFIG_SLAB=y -CONFIG_MODULES=y -CONFIG_MODULE_UNLOAD=y -# CONFIG_BLK_DEV_BSG is not set -CONFIG_BUS_CLOCK=10000000 -CONFIG_MEMORY_START=0x08000000 -CONFIG_MEMORY_SIZE=0x04000000 -CONFIG_IRAM_START=0x00f00000 -CONFIG_IRAM_SIZE=0x00080000 -CONFIG_PREEMPT=y -CONFIG_SMP=y -CONFIG_CHIP_M32700_TS1=y -CONFIG_PCCARD=y -CONFIG_M32R_PCC=y -CONFIG_NET=y -CONFIG_UNIX=y -CONFIG_INET=y -CONFIG_IP_PNP=y -CONFIG_IP_PNP_DHCP=y -# CONFIG_IPV6 is not set -# CONFIG_STANDALONE is not set -CONFIG_MTD=y -CONFIG_MTD_REDBOOT_PARTS=y -CONFIG_MTD_BLOCK=y -CONFIG_BLK_DEV_LOOP=y -CONFIG_BLK_DEV_NBD=m -CONFIG_BLK_DEV_RAM=y -CONFIG_IDE=m -CONFIG_BLK_DEV_IDECS=m -CONFIG_BLK_DEV_IDECD=m -CONFIG_IDE_GENERIC=m -CONFIG_NETDEVICES=y -# CONFIG_INPUT_KEYBOARD is not set -# CONFIG_INPUT_MOUSE is not set -# CONFIG_SERIO_I8042 is not set -# CONFIG_SERIO_SERPORT is not set -# CONFIG_VT is not set -CONFIG_SERIAL_M32R_SIO_CONSOLE=y -CONFIG_HW_RANDOM=y -CONFIG_EXT2_FS=y -CONFIG_EXT3_FS=y -CONFIG_ISO9660_FS=y -CONFIG_MSDOS_FS=m -CONFIG_VFAT_FS=m -CONFIG_PROC_KCORE=y -CONFIG_TMPFS=y -CONFIG_JFFS2_FS=y -CONFIG_ROMFS_FS=y -CONFIG_NFS_FS=y -CONFIG_NFS_V3=y -CONFIG_ROOT_NFS=y -CONFIG_NLS=y diff --git a/arch/m32r/configs/mappi.up_defconfig b/arch/m32r/configs/mappi.up_defconfig deleted file mode 100644 index 289ae7421e121..0000000000000 --- a/arch/m32r/configs/mappi.up_defconfig +++ /dev/null @@ -1,60 +0,0 @@ -CONFIG_SYSVIPC=y -CONFIG_IKCONFIG=y -CONFIG_IKCONFIG_PROC=y -CONFIG_LOG_BUF_SHIFT=14 -CONFIG_BLK_DEV_INITRD=y -# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set -CONFIG_EXPERT=y -# CONFIG_KALLSYMS is not set -# CONFIG_FUTEX is not set -# CONFIG_EPOLL is not set -CONFIG_SLAB=y -CONFIG_MODULES=y -CONFIG_MODULE_UNLOAD=y -# CONFIG_BLK_DEV_BSG is not set -CONFIG_BUS_CLOCK=10000000 -CONFIG_MEMORY_START=0x08000000 -CONFIG_MEMORY_SIZE=0x04000000 -CONFIG_IRAM_START=0x00f00000 -CONFIG_IRAM_SIZE=0x00080000 -CONFIG_PREEMPT=y -CONFIG_PCCARD=y -CONFIG_M32R_PCC=y -CONFIG_NET=y -CONFIG_UNIX=y -CONFIG_INET=y -CONFIG_IP_PNP=y -CONFIG_IP_PNP_DHCP=y -# CONFIG_IPV6 is not set -# CONFIG_STANDALONE is not set -CONFIG_MTD=y -CONFIG_MTD_REDBOOT_PARTS=y -CONFIG_MTD_BLOCK=y -CONFIG_BLK_DEV_LOOP=y -CONFIG_BLK_DEV_NBD=m -CONFIG_BLK_DEV_RAM=y -CONFIG_IDE=m -CONFIG_BLK_DEV_IDECS=m -CONFIG_BLK_DEV_IDECD=m -CONFIG_IDE_GENERIC=m -CONFIG_NETDEVICES=y -# CONFIG_INPUT_KEYBOARD is not set -# CONFIG_INPUT_MOUSE is not set -# CONFIG_SERIO_I8042 is not set -# CONFIG_SERIO_SERPORT is not set -# CONFIG_VT is not set -CONFIG_SERIAL_M32R_SIO_CONSOLE=y -CONFIG_HW_RANDOM=y -CONFIG_EXT2_FS=y -CONFIG_EXT3_FS=y -CONFIG_ISO9660_FS=y -CONFIG_MSDOS_FS=m -CONFIG_VFAT_FS=m -CONFIG_PROC_KCORE=y -CONFIG_TMPFS=y -CONFIG_JFFS2_FS=y -CONFIG_ROMFS_FS=y -CONFIG_NFS_FS=y -CONFIG_NFS_V3=y -CONFIG_ROOT_NFS=y -CONFIG_NLS=y diff --git a/arch/m32r/configs/mappi2.opsp_defconfig b/arch/m32r/configs/mappi2.opsp_defconfig deleted file mode 100644 index 2852f6e7e246a..0000000000000 --- a/arch/m32r/configs/mappi2.opsp_defconfig +++ /dev/null @@ -1,65 +0,0 @@ -CONFIG_SYSVIPC=y -CONFIG_BSD_PROCESS_ACCT=y -CONFIG_IKCONFIG=y -CONFIG_LOG_BUF_SHIFT=14 -# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set -CONFIG_EXPERT=y -# CONFIG_KALLSYMS is not set -# CONFIG_FUTEX is not set -# CONFIG_EPOLL is not set -CONFIG_SLAB=y -CONFIG_MODULES=y -CONFIG_MODULE_UNLOAD=y -# CONFIG_BLK_DEV_BSG is not set -CONFIG_PLAT_MAPPI2=y -CONFIG_CHIP_OPSP=y -CONFIG_TLB_ENTRIES=16 -CONFIG_BUS_CLOCK=50000000 -CONFIG_MEMORY_START=0x08000000 -CONFIG_MEMORY_SIZE=0x01000000 -CONFIG_IRAM_START=0x00f00000 -CONFIG_IRAM_SIZE=0x00008000 -CONFIG_PREEMPT=y -CONFIG_PCCARD=y -CONFIG_NET=y -CONFIG_PACKET=y -CONFIG_UNIX=y -CONFIG_INET=y -CONFIG_IP_PNP=y -CONFIG_IP_PNP_DHCP=y -# CONFIG_IPV6 is not set -CONFIG_BLK_DEV_LOOP=y -CONFIG_BLK_DEV_NBD=y -CONFIG_BLK_DEV_RAM=y -CONFIG_IDE=y -CONFIG_BLK_DEV_IDECS=y -CONFIG_BLK_DEV_IDECD=m -CONFIG_IDE_GENERIC=y -CONFIG_SCSI=m -CONFIG_BLK_DEV_SD=m -CONFIG_BLK_DEV_SR=m -CONFIG_CHR_DEV_SG=m -CONFIG_SCSI_MULTI_LUN=y -CONFIG_NETDEVICES=y -CONFIG_NET_ETHERNET=y -CONFIG_SMC91X=y -# CONFIG_INPUT_MOUSEDEV is not set -# CONFIG_INPUT_KEYBOARD is not set -# CONFIG_INPUT_MOUSE is not set -# CONFIG_SERIO_I8042 is not set -CONFIG_SERIAL_M32R_SIO_CONSOLE=y -CONFIG_HW_RANDOM=y -# CONFIG_VGA_CONSOLE is not set -CONFIG_EXT2_FS=y -CONFIG_EXT3_FS=y -CONFIG_ISO9660_FS=m -CONFIG_JOLIET=y -CONFIG_UDF_FS=m -CONFIG_MSDOS_FS=m -CONFIG_VFAT_FS=m -CONFIG_PROC_KCORE=y -CONFIG_TMPFS=y -CONFIG_NFS_FS=y -CONFIG_NFS_V3=y -CONFIG_ROOT_NFS=y -CONFIG_NLS=y diff --git a/arch/m32r/configs/mappi2.vdec2_defconfig b/arch/m32r/configs/mappi2.vdec2_defconfig deleted file mode 100644 index 8da4dbad8510c..0000000000000 --- a/arch/m32r/configs/mappi2.vdec2_defconfig +++ /dev/null @@ -1,64 +0,0 @@ -CONFIG_SYSVIPC=y -CONFIG_BSD_PROCESS_ACCT=y -CONFIG_IKCONFIG=y -CONFIG_LOG_BUF_SHIFT=14 -# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set -CONFIG_EXPERT=y -# CONFIG_KALLSYMS is not set -# CONFIG_FUTEX is not set -# CONFIG_EPOLL is not set -CONFIG_SLAB=y -CONFIG_MODULES=y -CONFIG_MODULE_UNLOAD=y -# CONFIG_BLK_DEV_BSG is not set -CONFIG_PLAT_MAPPI2=y -CONFIG_CHIP_VDEC2=y -CONFIG_BUS_CLOCK=50000000 -CONFIG_MEMORY_START=0x08000000 -CONFIG_MEMORY_SIZE=0x01000000 -CONFIG_IRAM_START=0x00f00000 -CONFIG_IRAM_SIZE=0x00008000 -CONFIG_PREEMPT=y -CONFIG_PCCARD=y -CONFIG_NET=y -CONFIG_PACKET=y -CONFIG_UNIX=y -CONFIG_INET=y -CONFIG_IP_PNP=y -CONFIG_IP_PNP_DHCP=y -# CONFIG_IPV6 is not set -CONFIG_BLK_DEV_LOOP=y -CONFIG_BLK_DEV_NBD=y -CONFIG_BLK_DEV_RAM=y -CONFIG_IDE=y -CONFIG_BLK_DEV_IDECS=y -CONFIG_BLK_DEV_IDECD=m -CONFIG_IDE_GENERIC=y -CONFIG_SCSI=m -CONFIG_BLK_DEV_SD=m -CONFIG_BLK_DEV_SR=m -CONFIG_CHR_DEV_SG=m -CONFIG_SCSI_MULTI_LUN=y -CONFIG_NETDEVICES=y -CONFIG_NET_ETHERNET=y -CONFIG_SMC91X=y -# CONFIG_INPUT_MOUSEDEV is not set -# CONFIG_INPUT_KEYBOARD is not set -# CONFIG_INPUT_MOUSE is not set -# CONFIG_SERIO_I8042 is not set -CONFIG_SERIAL_M32R_SIO_CONSOLE=y -CONFIG_HW_RANDOM=y -# CONFIG_VGA_CONSOLE is not set -CONFIG_EXT2_FS=y -CONFIG_EXT3_FS=y -CONFIG_ISO9660_FS=m -CONFIG_JOLIET=y -CONFIG_UDF_FS=m -CONFIG_MSDOS_FS=m -CONFIG_VFAT_FS=m -CONFIG_PROC_KCORE=y -CONFIG_TMPFS=y -CONFIG_NFS_FS=y -CONFIG_NFS_V3=y -CONFIG_ROOT_NFS=y -CONFIG_NLS=y diff --git a/arch/m32r/configs/mappi3.smp_defconfig b/arch/m32r/configs/mappi3.smp_defconfig deleted file mode 100644 index 5605b23e2faf8..0000000000000 --- a/arch/m32r/configs/mappi3.smp_defconfig +++ /dev/null @@ -1,62 +0,0 @@ -CONFIG_SYSVIPC=y -CONFIG_IKCONFIG=y -CONFIG_IKCONFIG_PROC=y -CONFIG_LOG_BUF_SHIFT=15 -CONFIG_BLK_DEV_INITRD=y -# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set -CONFIG_EXPERT=y -# CONFIG_KALLSYMS is not set -# CONFIG_FUTEX is not set -# CONFIG_EPOLL is not set -CONFIG_SLAB=y -CONFIG_MODULES=y -CONFIG_MODULE_UNLOAD=y -# CONFIG_BLK_DEV_BSG is not set -CONFIG_PLAT_MAPPI3=y -CONFIG_BUS_CLOCK=10000000 -CONFIG_MEMORY_START=0x08000000 -CONFIG_MEMORY_SIZE=0x08000000 -CONFIG_IRAM_START=0x00f00000 -CONFIG_IRAM_SIZE=0x00080000 -CONFIG_PREEMPT=y -CONFIG_SMP=y -CONFIG_PCCARD=y -CONFIG_NET=y -CONFIG_UNIX=y -CONFIG_INET=y -CONFIG_IP_PNP=y -CONFIG_IP_PNP_DHCP=y -# CONFIG_IPV6 is not set -CONFIG_MTD=y -CONFIG_MTD_REDBOOT_PARTS=y -CONFIG_MTD_BLOCK=y -CONFIG_BLK_DEV_LOOP=y -CONFIG_BLK_DEV_NBD=m -CONFIG_BLK_DEV_RAM=y -CONFIG_IDE=y -CONFIG_BLK_DEV_IDECS=m -CONFIG_BLK_DEV_IDECD=m -CONFIG_IDE_GENERIC=y -CONFIG_NETDEVICES=y -CONFIG_NET_ETHERNET=y -CONFIG_SMC91X=y -# CONFIG_INPUT_KEYBOARD is not set -# CONFIG_INPUT_MOUSE is not set -# CONFIG_SERIO_I8042 is not set -# CONFIG_SERIO_SERPORT is not set -# CONFIG_VT is not set -CONFIG_SERIAL_M32R_SIO_CONSOLE=y -CONFIG_HW_RANDOM=y -CONFIG_EXT2_FS=y -CONFIG_EXT3_FS=y -CONFIG_ISO9660_FS=y -CONFIG_MSDOS_FS=m -CONFIG_VFAT_FS=m -CONFIG_PROC_KCORE=y -CONFIG_TMPFS=y -CONFIG_JFFS2_FS=y -CONFIG_ROMFS_FS=y -CONFIG_NFS_FS=y -CONFIG_NFS_V3=y -CONFIG_ROOT_NFS=y -CONFIG_NLS=y diff --git a/arch/m32r/configs/oaks32r_defconfig b/arch/m32r/configs/oaks32r_defconfig deleted file mode 100644 index 5ccab127f6ad8..0000000000000 --- a/arch/m32r/configs/oaks32r_defconfig +++ /dev/null @@ -1,43 +0,0 @@ -CONFIG_BSD_PROCESS_ACCT=y -CONFIG_LOG_BUF_SHIFT=14 -# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set -CONFIG_EXPERT=y -# CONFIG_KALLSYMS is not set -# CONFIG_FUTEX is not set -# CONFIG_EPOLL is not set -CONFIG_SLAB=y -CONFIG_MODULES=y -CONFIG_MODULE_UNLOAD=y -# CONFIG_BLK_DEV_BSG is not set -CONFIG_PLAT_OAKS32R=y -CONFIG_CHIP_M32102=y -CONFIG_MEMORY_START=0x01000000 -CONFIG_MEMORY_SIZE=0x00800000 -CONFIG_IRAM_START=0x00f00000 -CONFIG_IRAM_SIZE=0x00010000 -CONFIG_PREEMPT=y -CONFIG_BINFMT_FLAT=y -CONFIG_NET=y -CONFIG_PACKET=y -CONFIG_UNIX=y -CONFIG_INET=y -CONFIG_IP_PNP=y -CONFIG_IP_PNP_DHCP=y -# CONFIG_IPV6 is not set -# CONFIG_FW_LOADER is not set -CONFIG_BLK_DEV_LOOP=y -CONFIG_BLK_DEV_NBD=y -CONFIG_BLK_DEV_RAM=y -CONFIG_NETDEVICES=y -# CONFIG_INPUT_MOUSEDEV is not set -# CONFIG_INPUT_KEYBOARD is not set -# CONFIG_INPUT_MOUSE is not set -# CONFIG_SERIO_I8042 is not set -# CONFIG_VT is not set -CONFIG_SERIAL_M32R_SIO_CONSOLE=y -CONFIG_HW_RANDOM=y -CONFIG_EXT2_FS=y -CONFIG_NFS_FS=y -CONFIG_NFS_V3=y -CONFIG_ROOT_NFS=y -CONFIG_NLS=y diff --git a/arch/m32r/configs/opsput_defconfig b/arch/m32r/configs/opsput_defconfig deleted file mode 100644 index 3ce1d08355e53..0000000000000 --- a/arch/m32r/configs/opsput_defconfig +++ /dev/null @@ -1,63 +0,0 @@ -CONFIG_SYSVIPC=y -CONFIG_BSD_PROCESS_ACCT=y -CONFIG_IKCONFIG=y -CONFIG_LOG_BUF_SHIFT=14 -# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set -CONFIG_EXPERT=y -# CONFIG_KALLSYMS is not set -# CONFIG_FUTEX is not set -# CONFIG_EPOLL is not set -CONFIG_SLAB=y -CONFIG_MODULES=y -CONFIG_MODULE_UNLOAD=y -# CONFIG_BLK_DEV_BSG is not set -CONFIG_PLAT_OPSPUT=y -CONFIG_CHIP_OPSP=y -CONFIG_MEMORY_START=0x08000000 -CONFIG_MEMORY_SIZE=0x01000000 -CONFIG_IRAM_START=0x00f00000 -CONFIG_IRAM_SIZE=0x00010000 -CONFIG_PCCARD=y -CONFIG_M32R_CFC=y -CONFIG_NET=y -CONFIG_PACKET=y -CONFIG_UNIX=y -CONFIG_INET=y -CONFIG_IP_PNP=y -CONFIG_IP_PNP_DHCP=y -# CONFIG_IPV6 is not set -CONFIG_BLK_DEV_LOOP=y -CONFIG_BLK_DEV_RAM=y -CONFIG_SCSI=m -CONFIG_BLK_DEV_SD=m -CONFIG_BLK_DEV_SR=m -CONFIG_CHR_DEV_SG=m -CONFIG_SCSI_MULTI_LUN=y -CONFIG_NETDEVICES=y -CONFIG_NET_ETHERNET=y -CONFIG_SMC91X=y -# CONFIG_INPUT_MOUSEDEV is not set -# CONFIG_INPUT_KEYBOARD is not set -# CONFIG_INPUT_MOUSE is not set -# CONFIG_SERIO_I8042 is not set -# CONFIG_VT is not set -CONFIG_SERIAL_M32R_SIO_CONSOLE=y -CONFIG_SERIAL_M32R_PLDSIO=y -CONFIG_HW_RANDOM=y -CONFIG_DS1302=y -CONFIG_EXT2_FS=y -CONFIG_EXT3_FS=y -CONFIG_ISO9660_FS=m -CONFIG_JOLIET=y -CONFIG_UDF_FS=m -CONFIG_MSDOS_FS=m -CONFIG_VFAT_FS=m -CONFIG_PROC_KCORE=y -CONFIG_TMPFS=y -CONFIG_NFS_FS=y -CONFIG_NFS_V3=y -CONFIG_ROOT_NFS=y -CONFIG_NLS=y -CONFIG_DEBUG_KERNEL=y -# CONFIG_DEBUG_BUGVERBOSE is not set -CONFIG_DEBUG_INFO=y diff --git a/arch/m32r/configs/usrv_defconfig b/arch/m32r/configs/usrv_defconfig deleted file mode 100644 index cb8c051c3d466..0000000000000 --- a/arch/m32r/configs/usrv_defconfig +++ /dev/null @@ -1,78 +0,0 @@ -CONFIG_SYSVIPC=y -CONFIG_POSIX_MQUEUE=y -CONFIG_BSD_PROCESS_ACCT=y -CONFIG_LOG_BUF_SHIFT=15 -CONFIG_BLK_DEV_INITRD=y -# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set -CONFIG_EXPERT=y -CONFIG_KALLSYMS_EXTRA_PASS=y -CONFIG_SLAB=y -CONFIG_MODULES=y -CONFIG_MODULE_UNLOAD=y -# CONFIG_BLK_DEV_BSG is not set -# CONFIG_IOSCHED_DEADLINE is not set -# CONFIG_IOSCHED_CFQ is not set -CONFIG_PLAT_USRV=y -CONFIG_BUS_CLOCK=50000000 -CONFIG_MEMORY_START=0x08000000 -CONFIG_MEMORY_SIZE=0x02000000 -# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set -CONFIG_SMP=y -CONFIG_PCCARD=y -CONFIG_M32R_CFC=y -CONFIG_M32R_CFC_NUM=2 -CONFIG_NET=y -CONFIG_PACKET=y -CONFIG_UNIX=y -CONFIG_XFRM_USER=y -CONFIG_INET=y -CONFIG_IP_MULTICAST=y -CONFIG_IP_PNP=y -CONFIG_INET_AH=y -CONFIG_INET_ESP=y -CONFIG_INET_IPCOMP=y -# CONFIG_IPV6 is not set -CONFIG_MTD=y -CONFIG_MTD_BLOCK=y -CONFIG_MTD_CFI=y -CONFIG_MTD_CFI_ADV_OPTIONS=y -CONFIG_MTD_CFI_BE_BYTE_SWAP=y -CONFIG_MTD_CFI_GEOMETRY=y -# CONFIG_MTD_MAP_BANK_WIDTH_1 is not set -# CONFIG_MTD_MAP_BANK_WIDTH_4 is not set -# CONFIG_MTD_CFI_I2 is not set -CONFIG_MTD_CFI_AMDSTD=y -CONFIG_MTD_RAM=y -CONFIG_MTD_ROM=y -CONFIG_BLK_DEV_LOOP=y -CONFIG_BLK_DEV_RAM=y -CONFIG_IDE=y -CONFIG_BLK_DEV_IDECS=y -CONFIG_NETDEVICES=y -CONFIG_NET_PCMCIA=y -CONFIG_PCMCIA_PCNET=y -# CONFIG_INPUT is not set -# CONFIG_SERIO is not set -# CONFIG_VT is not set -CONFIG_SERIAL_8250=y -CONFIG_SERIAL_8250_CONSOLE=y -# CONFIG_SERIAL_M32R_SIO is not set -# CONFIG_HWMON is not set -CONFIG_EXT2_FS=y -CONFIG_EXT3_FS=y -# CONFIG_EXT3_FS_XATTR is not set -CONFIG_PROC_KCORE=y -CONFIG_TMPFS=y -CONFIG_JFFS2_FS=y -CONFIG_CRAMFS=y -CONFIG_NFS_FS=y -CONFIG_NFS_V3=y -CONFIG_ROOT_NFS=y -CONFIG_DEBUG_KERNEL=y -CONFIG_DEBUG_INFO=y -CONFIG_FRAME_POINTER=y -CONFIG_CRYPTO_ECB=y -CONFIG_CRYPTO_PCBC=m -CONFIG_CRYPTO_MICHAEL_MIC=y -CONFIG_CRYPTO_AES=y -CONFIG_CRYPTO_ARC4=y diff --git a/arch/m32r/include/asm/Kbuild b/arch/m32r/include/asm/Kbuild deleted file mode 100644 index 985ef1d9f556d..0000000000000 --- a/arch/m32r/include/asm/Kbuild +++ /dev/null @@ -1,13 +0,0 @@ -generic-y += current.h -generic-y += dma-mapping.h -generic-y += exec.h -generic-y += extable.h -generic-y += irq_work.h -generic-y += kprobes.h -generic-y += mcs_spinlock.h -generic-y += mm-arch-hooks.h -generic-y += module.h -generic-y += preempt.h -generic-y += sections.h -generic-y += trace_clock.h -generic-y += word-at-a-time.h diff --git a/arch/m32r/include/asm/addrspace.h b/arch/m32r/include/asm/addrspace.h deleted file mode 100644 index 81782c122da45..0000000000000 --- a/arch/m32r/include/asm/addrspace.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * This file is subject to 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) 2001 by Hiroyuki Kondo - * - * Defitions for the address spaces of the M32R CPUs. - */ -#ifndef __ASM_M32R_ADDRSPACE_H -#define __ASM_M32R_ADDRSPACE_H - -/* - * Memory segments (32bit kernel mode addresses) - */ -#define KUSEG 0x00000000 -#define KSEG0 0x80000000 -#define KSEG1 0xa0000000 -#define KSEG2 0xc0000000 -#define KSEG3 0xe0000000 - -#define K0BASE KSEG0 - -/* - * Returns the kernel segment base of a given address - */ -#ifndef __ASSEMBLY__ -#define KSEGX(a) (((unsigned long)(a)) & 0xe0000000) -#else -#define KSEGX(a) ((a) & 0xe0000000) -#endif - -/* - * Returns the physical address of a KSEG0/KSEG1 address - */ -#ifndef __ASSEMBLY__ -#define PHYSADDR(a) (((unsigned long)(a)) & 0x1fffffff) -#else -#define PHYSADDR(a) ((a) & 0x1fffffff) -#endif - -/* - * Map an address to a certain kernel segment - */ -#ifndef __ASSEMBLY__ -#define KSEG0ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | KSEG0)) -#define KSEG1ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | KSEG1)) -#define KSEG2ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | KSEG2)) -#define KSEG3ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | KSEG3)) -#else -#define KSEG0ADDR(a) (((a) & 0x1fffffff) | KSEG0) -#define KSEG1ADDR(a) (((a) & 0x1fffffff) | KSEG1) -#define KSEG2ADDR(a) (((a) & 0x1fffffff) | KSEG2) -#define KSEG3ADDR(a) (((a) & 0x1fffffff) | KSEG3) -#endif - -#endif /* __ASM_M32R_ADDRSPACE_H */ diff --git a/arch/m32r/include/asm/asm-offsets.h b/arch/m32r/include/asm/asm-offsets.h deleted file mode 100644 index d370ee36a182b..0000000000000 --- a/arch/m32r/include/asm/asm-offsets.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/arch/m32r/include/asm/assembler.h b/arch/m32r/include/asm/assembler.h deleted file mode 100644 index ed90d894f2859..0000000000000 --- a/arch/m32r/include/asm/assembler.h +++ /dev/null @@ -1,231 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_M32R_ASSEMBLER_H -#define _ASM_M32R_ASSEMBLER_H - -/* - * linux/asm-m32r/assembler.h - * - * Copyright (C) 2004 Hirokazu Takata - * - * This file contains M32R architecture specific macro definitions. - */ - -#include - -#undef __STR - -#ifdef __ASSEMBLY__ -#define __STR(x) x -#else -#define __STR(x) __stringify(x) -#endif - -#ifdef CONFIG_SMP -#define M32R_LOCK __STR(lock) -#define M32R_UNLOCK __STR(unlock) -#else -#define M32R_LOCK __STR(ld) -#define M32R_UNLOCK __STR(st) -#endif - -#ifdef __ASSEMBLY__ -#undef ENTRY -#define ENTRY(name) ENTRY_M name - .macro ENTRY_M name - .global \name - ALIGN -\name: - .endm -#endif - - -/** - * LDIMM - load immediate value - * STI - enable interruption - * CLI - disable interruption - */ - -#ifdef __ASSEMBLY__ - -#define LDIMM(reg,x) LDIMM reg x - .macro LDIMM reg x - seth \reg, #high(\x) - or3 \reg, \reg, #low(\x) - .endm - -#if !(defined(CONFIG_CHIP_M32102) || defined(CONFIG_CHIP_M32104)) -#define ENABLE_INTERRUPTS(reg) ENABLE_INTERRUPTS reg - .macro ENABLE_INTERRUPTS reg - setpsw #0x40 -> nop - ; WORKAROUND: "-> nop" is a workaround for the M32700(TS1). - .endm - -#define DISABLE_INTERRUPTS(reg) DISABLE_INTERRUPTS reg - .macro DISABLE_INTERRUPTS reg - clrpsw #0x40 -> nop - ; WORKAROUND: "-> nop" is a workaround for the M32700(TS1). - .endm -#else /* CONFIG_CHIP_M32102 || CONFIG_CHIP_M32104 */ -#define ENABLE_INTERRUPTS(reg) ENABLE_INTERRUPTS reg - .macro ENABLE_INTERRUPTS reg - mvfc \reg, psw - or3 \reg, \reg, #0x0040 - mvtc \reg, psw - .endm - -#define DISABLE_INTERRUPTS(reg) DISABLE_INTERRUPTS reg - .macro DISABLE_INTERRUPTS reg - mvfc \reg, psw - and3 \reg, \reg, #0xffbf - mvtc \reg, psw - .endm -#endif /* CONFIG_CHIP_M32102 */ - - .macro SAVE_ALL - push r0 ; orig_r0 - push sp ; spi (r15) - push lr ; r14 - push r13 - mvfc r13, cr3 ; spu - push r13 - mvfc r13, bbpc - push r13 - mvfc r13, bbpsw - push r13 - mvfc r13, bpc - push r13 - mvfc r13, psw - push r13 -#if defined(CONFIG_ISA_M32R2) && defined(CONFIG_ISA_DSP_LEVEL2) - mvfaclo r13, a1 - push r13 - mvfachi r13, a1 - push r13 - mvfaclo r13, a0 - push r13 - mvfachi r13, a0 - push r13 -#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R) - mvfaclo r13 - push r13 - mvfachi r13 - push r13 - ldi r13, #0 - push r13 ; dummy push acc1h - push r13 ; dummy push acc1l -#else -#error unknown isa configuration -#endif - ldi r13, #-1 - push r13 ; syscall_nr (default: -1) - push r12 - push r11 - push r10 - push r9 - push r8 - push r7 - push r3 - push r2 - push r1 - push r0 - addi sp, #-4 ; room for implicit pt_regs parameter - push r6 - push r5 - push r4 - .endm - - .macro RESTORE_ALL - pop r4 - pop r5 - pop r6 - addi sp, #4 - pop r0 - pop r1 - pop r2 - pop r3 - pop r7 - pop r8 - pop r9 - pop r10 - pop r11 - pop r12 - addi r15, #4 ; Skip syscall number -#if defined(CONFIG_ISA_M32R2) && defined(CONFIG_ISA_DSP_LEVEL2) - pop r13 - mvtachi r13, a0 - pop r13 - mvtaclo r13, a0 - pop r13 - mvtachi r13, a1 - pop r13 - mvtaclo r13, a1 -#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R) - pop r13 ; dummy pop acc1h - pop r13 ; dummy pop acc1l - pop r13 - mvtachi r13 - pop r13 - mvtaclo r13 -#else -#error unknown isa configuration -#endif - pop r14 - mvtc r14, psw - pop r14 - mvtc r14, bpc - addi sp, #8 ; Skip bbpsw, bbpc - pop r14 - mvtc r14, cr3 ; spu - pop r13 - pop lr ; r14 - pop sp ; spi (r15) - addi sp, #4 ; Skip orig_r0 - .fillinsn -1: rte - .section .fixup,"ax" -2: bl do_exit - .previous - .section __ex_table,"a" - ALIGN - .long 1b, 2b - .previous - .endm - -#define GET_CURRENT(reg) get_current reg - .macro get_current reg - ldi \reg, #-8192 - and \reg, sp - .endm - -#if !(defined(CONFIG_CHIP_M32102) || defined(CONFIG_CHIP_M32104)) - .macro SWITCH_TO_KERNEL_STACK - ; switch to kernel stack (spi) - clrpsw #0x80 -> nop - .endm -#else /* CONFIG_CHIP_M32102 || CONFIG_CHIP_M32104 */ - .macro SWITCH_TO_KERNEL_STACK - push r0 ; save r0 for working - mvfc r0, psw - and3 r0, r0, #0x00ff7f - mvtc r0, psw - slli r0, #16 - bltz r0, 1f ; check BSM-bit -; - ;; called from kernel context: previous stack = spi - pop r0 ; retrieve r0 - bra 2f - .fillinsn -1: - ;; called from user context: previous stack = spu - mvfc r0, cr3 ; spu - addi r0, #4 - mvtc r0, cr3 ; spu - ld r0, @(-4,r0) ; retrieve r0 - .fillinsn -2: - .endm -#endif /* CONFIG_CHIP_M32102 || CONFIG_CHIP_M32104 */ - -#endif /* __ASSEMBLY__ */ - -#endif /* _ASM_M32R_ASSEMBLER_H */ diff --git a/arch/m32r/include/asm/atomic.h b/arch/m32r/include/asm/atomic.h deleted file mode 100644 index 8bf67e55ff549..0000000000000 --- a/arch/m32r/include/asm/atomic.h +++ /dev/null @@ -1,275 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_M32R_ATOMIC_H -#define _ASM_M32R_ATOMIC_H - -/* - * linux/include/asm-m32r/atomic.h - * - * M32R version: - * Copyright (C) 2001, 2002 Hitoshi Yamamoto - * Copyright (C) 2004 Hirokazu Takata - */ - -#include -#include -#include -#include -#include - -/* - * Atomic operations that C can't guarantee us. Useful for - * resource counting etc.. - */ - -#define ATOMIC_INIT(i) { (i) } - -/** - * atomic_read - read atomic variable - * @v: pointer of type atomic_t - * - * Atomically reads the value of @v. - */ -#define atomic_read(v) READ_ONCE((v)->counter) - -/** - * atomic_set - set atomic variable - * @v: pointer of type atomic_t - * @i: required value - * - * Atomically sets the value of @v to @i. - */ -#define atomic_set(v,i) WRITE_ONCE(((v)->counter), (i)) - -#ifdef CONFIG_CHIP_M32700_TS1 -#define __ATOMIC_CLOBBER , "r4" -#else -#define __ATOMIC_CLOBBER -#endif - -#define ATOMIC_OP(op) \ -static __inline__ void atomic_##op(int i, atomic_t *v) \ -{ \ - unsigned long flags; \ - int result; \ - \ - local_irq_save(flags); \ - __asm__ __volatile__ ( \ - "# atomic_" #op " \n\t" \ - DCACHE_CLEAR("%0", "r4", "%1") \ - M32R_LOCK" %0, @%1; \n\t" \ - #op " %0, %2; \n\t" \ - M32R_UNLOCK" %0, @%1; \n\t" \ - : "=&r" (result) \ - : "r" (&v->counter), "r" (i) \ - : "memory" \ - __ATOMIC_CLOBBER \ - ); \ - local_irq_restore(flags); \ -} \ - -#define ATOMIC_OP_RETURN(op) \ -static __inline__ int atomic_##op##_return(int i, atomic_t *v) \ -{ \ - unsigned long flags; \ - int result; \ - \ - local_irq_save(flags); \ - __asm__ __volatile__ ( \ - "# atomic_" #op "_return \n\t" \ - DCACHE_CLEAR("%0", "r4", "%1") \ - M32R_LOCK" %0, @%1; \n\t" \ - #op " %0, %2; \n\t" \ - M32R_UNLOCK" %0, @%1; \n\t" \ - : "=&r" (result) \ - : "r" (&v->counter), "r" (i) \ - : "memory" \ - __ATOMIC_CLOBBER \ - ); \ - local_irq_restore(flags); \ - \ - return result; \ -} - -#define ATOMIC_FETCH_OP(op) \ -static __inline__ int atomic_fetch_##op(int i, atomic_t *v) \ -{ \ - unsigned long flags; \ - int result, val; \ - \ - local_irq_save(flags); \ - __asm__ __volatile__ ( \ - "# atomic_fetch_" #op " \n\t" \ - DCACHE_CLEAR("%0", "r4", "%2") \ - M32R_LOCK" %1, @%2; \n\t" \ - "mv %0, %1 \n\t" \ - #op " %1, %3; \n\t" \ - M32R_UNLOCK" %1, @%2; \n\t" \ - : "=&r" (result), "=&r" (val) \ - : "r" (&v->counter), "r" (i) \ - : "memory" \ - __ATOMIC_CLOBBER \ - ); \ - local_irq_restore(flags); \ - \ - return result; \ -} - -#define ATOMIC_OPS(op) ATOMIC_OP(op) ATOMIC_OP_RETURN(op) ATOMIC_FETCH_OP(op) - -ATOMIC_OPS(add) -ATOMIC_OPS(sub) - -#undef ATOMIC_OPS -#define ATOMIC_OPS(op) ATOMIC_OP(op) ATOMIC_FETCH_OP(op) - -ATOMIC_OPS(and) -ATOMIC_OPS(or) -ATOMIC_OPS(xor) - -#undef ATOMIC_OPS -#undef ATOMIC_FETCH_OP -#undef ATOMIC_OP_RETURN -#undef ATOMIC_OP - -/** - * atomic_sub_and_test - subtract value from variable and test result - * @i: integer value to subtract - * @v: pointer of type atomic_t - * - * Atomically subtracts @i from @v and returns - * true if the result is zero, or false for all - * other cases. - */ -#define atomic_sub_and_test(i,v) (atomic_sub_return((i), (v)) == 0) - -/** - * atomic_inc_return - increment atomic variable and return it - * @v: pointer of type atomic_t - * - * Atomically increments @v by 1 and returns the result. - */ -static __inline__ int atomic_inc_return(atomic_t *v) -{ - unsigned long flags; - int result; - - local_irq_save(flags); - __asm__ __volatile__ ( - "# atomic_inc_return \n\t" - DCACHE_CLEAR("%0", "r4", "%1") - M32R_LOCK" %0, @%1; \n\t" - "addi %0, #1; \n\t" - M32R_UNLOCK" %0, @%1; \n\t" - : "=&r" (result) - : "r" (&v->counter) - : "memory" - __ATOMIC_CLOBBER - ); - local_irq_restore(flags); - - return result; -} - -/** - * atomic_dec_return - decrement atomic variable and return it - * @v: pointer of type atomic_t - * - * Atomically decrements @v by 1 and returns the result. - */ -static __inline__ int atomic_dec_return(atomic_t *v) -{ - unsigned long flags; - int result; - - local_irq_save(flags); - __asm__ __volatile__ ( - "# atomic_dec_return \n\t" - DCACHE_CLEAR("%0", "r4", "%1") - M32R_LOCK" %0, @%1; \n\t" - "addi %0, #-1; \n\t" - M32R_UNLOCK" %0, @%1; \n\t" - : "=&r" (result) - : "r" (&v->counter) - : "memory" - __ATOMIC_CLOBBER - ); - local_irq_restore(flags); - - return result; -} - -/** - * atomic_inc - increment atomic variable - * @v: pointer of type atomic_t - * - * Atomically increments @v by 1. - */ -#define atomic_inc(v) ((void)atomic_inc_return(v)) - -/** - * atomic_dec - decrement atomic variable - * @v: pointer of type atomic_t - * - * Atomically decrements @v by 1. - */ -#define atomic_dec(v) ((void)atomic_dec_return(v)) - -/** - * atomic_inc_and_test - increment and test - * @v: pointer of type atomic_t - * - * Atomically increments @v by 1 - * and returns true if the result is zero, or false for all - * other cases. - */ -#define atomic_inc_and_test(v) (atomic_inc_return(v) == 0) - -/** - * atomic_dec_and_test - decrement and test - * @v: pointer of type atomic_t - * - * Atomically decrements @v by 1 and - * returns true if the result is 0, or false for all - * other cases. - */ -#define atomic_dec_and_test(v) (atomic_dec_return(v) == 0) - -/** - * atomic_add_negative - add and test if negative - * @v: pointer of type atomic_t - * @i: integer value to add - * - * Atomically adds @i to @v and returns true - * if the result is negative, or false when - * result is greater than or equal to zero. - */ -#define atomic_add_negative(i,v) (atomic_add_return((i), (v)) < 0) - -#define atomic_cmpxchg(v, o, n) ((int)cmpxchg(&((v)->counter), (o), (n))) -#define atomic_xchg(v, new) (xchg(&((v)->counter), new)) - -/** - * __atomic_add_unless - add unless the number is a given value - * @v: pointer of type atomic_t - * @a: the amount to add to v... - * @u: ...unless v is equal to u. - * - * Atomically adds @a to @v, so long as it was not @u. - * Returns the old value of @v. - */ -static __inline__ int __atomic_add_unless(atomic_t *v, int a, int u) -{ - int c, old; - c = atomic_read(v); - for (;;) { - if (unlikely(c == (u))) - break; - old = atomic_cmpxchg((v), c, c + (a)); - if (likely(old == c)) - break; - c = old; - } - return c; -} - -#endif /* _ASM_M32R_ATOMIC_H */ diff --git a/arch/m32r/include/asm/barrier.h b/arch/m32r/include/asm/barrier.h deleted file mode 100644 index 1a40265e8d883..0000000000000 --- a/arch/m32r/include/asm/barrier.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * This file is subject to 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) 2001 Hiroyuki Kondo, Hirokazu Takata, and Hitoshi Yamamoto - * Copyright (C) 2004, 2006 Hirokazu Takata - */ -#ifndef _ASM_M32R_BARRIER_H -#define _ASM_M32R_BARRIER_H - -#define nop() __asm__ __volatile__ ("nop" : : ) - -#include - -#endif /* _ASM_M32R_BARRIER_H */ diff --git a/arch/m32r/include/asm/bitops.h b/arch/m32r/include/asm/bitops.h deleted file mode 100644 index 64e70e57c1541..0000000000000 --- a/arch/m32r/include/asm/bitops.h +++ /dev/null @@ -1,274 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_M32R_BITOPS_H -#define _ASM_M32R_BITOPS_H - -/* - * linux/include/asm-m32r/bitops.h - * - * Copyright 1992, Linus Torvalds. - * - * M32R version: - * Copyright (C) 2001, 2002 Hitoshi Yamamoto - * Copyright (C) 2004 Hirokazu Takata - */ - -#ifndef _LINUX_BITOPS_H -#error only can be included directly -#endif - -#include -#include -#include -#include -#include -#include -#include - -/* - * These have to be done with inline assembly: that way the bit-setting - * is guaranteed to be atomic. All bit operations return 0 if the bit - * was cleared before the operation and != 0 if it was not. - * - * bit 0 is the LSB of addr; bit 32 is the LSB of (addr+1). - */ - -/** - * set_bit - Atomically set a bit in memory - * @nr: the bit to set - * @addr: the address to start counting from - * - * This function is atomic and may not be reordered. See __set_bit() - * if you do not require the atomic guarantees. - * Note that @nr may be almost arbitrarily large; this function is not - * restricted to acting on a single-word quantity. - */ -static __inline__ void set_bit(int nr, volatile void * addr) -{ - __u32 mask; - volatile __u32 *a = addr; - unsigned long flags; - unsigned long tmp; - - a += (nr >> 5); - mask = (1 << (nr & 0x1F)); - - local_irq_save(flags); - __asm__ __volatile__ ( - DCACHE_CLEAR("%0", "r6", "%1") - M32R_LOCK" %0, @%1; \n\t" - "or %0, %2; \n\t" - M32R_UNLOCK" %0, @%1; \n\t" - : "=&r" (tmp) - : "r" (a), "r" (mask) - : "memory" -#ifdef CONFIG_CHIP_M32700_TS1 - , "r6" -#endif /* CONFIG_CHIP_M32700_TS1 */ - ); - local_irq_restore(flags); -} - -/** - * clear_bit - Clears a bit in memory - * @nr: Bit to clear - * @addr: Address to start counting from - * - * clear_bit() is atomic and may not be reordered. However, it does - * not contain a memory barrier, so if it is used for locking purposes, - * you should call smp_mb__before_atomic() and/or smp_mb__after_atomic() - * in order to ensure changes are visible on other processors. - */ -static __inline__ void clear_bit(int nr, volatile void * addr) -{ - __u32 mask; - volatile __u32 *a = addr; - unsigned long flags; - unsigned long tmp; - - a += (nr >> 5); - mask = (1 << (nr & 0x1F)); - - local_irq_save(flags); - - __asm__ __volatile__ ( - DCACHE_CLEAR("%0", "r6", "%1") - M32R_LOCK" %0, @%1; \n\t" - "and %0, %2; \n\t" - M32R_UNLOCK" %0, @%1; \n\t" - : "=&r" (tmp) - : "r" (a), "r" (~mask) - : "memory" -#ifdef CONFIG_CHIP_M32700_TS1 - , "r6" -#endif /* CONFIG_CHIP_M32700_TS1 */ - ); - local_irq_restore(flags); -} - -/** - * change_bit - Toggle a bit in memory - * @nr: Bit to clear - * @addr: Address to start counting from - * - * change_bit() is atomic and may not be reordered. - * Note that @nr may be almost arbitrarily large; this function is not - * restricted to acting on a single-word quantity. - */ -static __inline__ void change_bit(int nr, volatile void * addr) -{ - __u32 mask; - volatile __u32 *a = addr; - unsigned long flags; - unsigned long tmp; - - a += (nr >> 5); - mask = (1 << (nr & 0x1F)); - - local_irq_save(flags); - __asm__ __volatile__ ( - DCACHE_CLEAR("%0", "r6", "%1") - M32R_LOCK" %0, @%1; \n\t" - "xor %0, %2; \n\t" - M32R_UNLOCK" %0, @%1; \n\t" - : "=&r" (tmp) - : "r" (a), "r" (mask) - : "memory" -#ifdef CONFIG_CHIP_M32700_TS1 - , "r6" -#endif /* CONFIG_CHIP_M32700_TS1 */ - ); - local_irq_restore(flags); -} - -/** - * test_and_set_bit - Set a bit and return its old value - * @nr: Bit to set - * @addr: Address to count from - * - * This operation is atomic and cannot be reordered. - * It also implies a memory barrier. - */ -static __inline__ int test_and_set_bit(int nr, volatile void * addr) -{ - __u32 mask, oldbit; - volatile __u32 *a = addr; - unsigned long flags; - unsigned long tmp; - - a += (nr >> 5); - mask = (1 << (nr & 0x1F)); - - local_irq_save(flags); - __asm__ __volatile__ ( - DCACHE_CLEAR("%0", "%1", "%2") - M32R_LOCK" %0, @%2; \n\t" - "mv %1, %0; \n\t" - "and %0, %3; \n\t" - "or %1, %3; \n\t" - M32R_UNLOCK" %1, @%2; \n\t" - : "=&r" (oldbit), "=&r" (tmp) - : "r" (a), "r" (mask) - : "memory" - ); - local_irq_restore(flags); - - return (oldbit != 0); -} - -/** - * test_and_clear_bit - Clear a bit and return its old value - * @nr: Bit to set - * @addr: Address to count from - * - * This operation is atomic and cannot be reordered. - * It also implies a memory barrier. - */ -static __inline__ int test_and_clear_bit(int nr, volatile void * addr) -{ - __u32 mask, oldbit; - volatile __u32 *a = addr; - unsigned long flags; - unsigned long tmp; - - a += (nr >> 5); - mask = (1 << (nr & 0x1F)); - - local_irq_save(flags); - - __asm__ __volatile__ ( - DCACHE_CLEAR("%0", "%1", "%3") - M32R_LOCK" %0, @%3; \n\t" - "mv %1, %0; \n\t" - "and %0, %2; \n\t" - "not %2, %2; \n\t" - "and %1, %2; \n\t" - M32R_UNLOCK" %1, @%3; \n\t" - : "=&r" (oldbit), "=&r" (tmp), "+r" (mask) - : "r" (a) - : "memory" - ); - local_irq_restore(flags); - - return (oldbit != 0); -} - -/** - * test_and_change_bit - Change a bit and return its old value - * @nr: Bit to set - * @addr: Address to count from - * - * This operation is atomic and cannot be reordered. - * It also implies a memory barrier. - */ -static __inline__ int test_and_change_bit(int nr, volatile void * addr) -{ - __u32 mask, oldbit; - volatile __u32 *a = addr; - unsigned long flags; - unsigned long tmp; - - a += (nr >> 5); - mask = (1 << (nr & 0x1F)); - - local_irq_save(flags); - __asm__ __volatile__ ( - DCACHE_CLEAR("%0", "%1", "%2") - M32R_LOCK" %0, @%2; \n\t" - "mv %1, %0; \n\t" - "and %0, %3; \n\t" - "xor %1, %3; \n\t" - M32R_UNLOCK" %1, @%2; \n\t" - : "=&r" (oldbit), "=&r" (tmp) - : "r" (a), "r" (mask) - : "memory" - ); - local_irq_restore(flags); - - return (oldbit != 0); -} - -#include -#include -#include -#include -#include -#include - -#ifdef __KERNEL__ - -#include -#include -#include -#include -#include - -#endif /* __KERNEL__ */ - -#ifdef __KERNEL__ - -#include -#include - -#endif /* __KERNEL__ */ - -#endif /* _ASM_M32R_BITOPS_H */ diff --git a/arch/m32r/include/asm/bug.h b/arch/m32r/include/asm/bug.h deleted file mode 100644 index 7197688254da7..0000000000000 --- a/arch/m32r/include/asm/bug.h +++ /dev/null @@ -1,5 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _M32R_BUG_H -#define _M32R_BUG_H -#include -#endif diff --git a/arch/m32r/include/asm/bugs.h b/arch/m32r/include/asm/bugs.h deleted file mode 100644 index 74a6d428aebe5..0000000000000 --- a/arch/m32r/include/asm/bugs.h +++ /dev/null @@ -1,20 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_M32R_BUGS_H -#define _ASM_M32R_BUGS_H - -/* - * This is included by init/main.c to check for architecture-dependent bugs. - * - * Needs: - * void check_bugs(void); - */ -#include - -static void __init check_bugs(void) -{ - extern unsigned long loops_per_jiffy; - - current_cpu_data.loops_per_jiffy = loops_per_jiffy; -} - -#endif /* _ASM_M32R_BUGS_H */ diff --git a/arch/m32r/include/asm/cache.h b/arch/m32r/include/asm/cache.h deleted file mode 100644 index 47a766a258f86..0000000000000 --- a/arch/m32r/include/asm/cache.h +++ /dev/null @@ -1,9 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_M32R_CACHE_H -#define _ASM_M32R_CACHE_H - -/* L1 cache line size */ -#define L1_CACHE_SHIFT 4 -#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) - -#endif /* _ASM_M32R_CACHE_H */ diff --git a/arch/m32r/include/asm/cachectl.h b/arch/m32r/include/asm/cachectl.h deleted file mode 100644 index 12f73f6c17590..0000000000000 --- a/arch/m32r/include/asm/cachectl.h +++ /dev/null @@ -1,27 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * cachectl.h -- defines for M32R cache control system calls - * - * Copyright (C) 2003 by Kazuhiro Inaoka - */ -#ifndef __ASM_M32R_CACHECTL -#define __ASM_M32R_CACHECTL - -/* - * Options for cacheflush system call - * - * cacheflush() is currently fluch_cache_all(). - */ -#define ICACHE (1<<0) /* flush instruction cache */ -#define DCACHE (1<<1) /* writeback and flush data cache */ -#define BCACHE (ICACHE|DCACHE) /* flush both caches */ - -/* - * Caching modes for the cachectl(2) call - * - * cachectl(2) is currently not supported and returns ENOSYS. - */ -#define CACHEABLE 0 /* make pages cacheable */ -#define UNCACHEABLE 1 /* make pages uncacheable */ - -#endif /* __ASM_M32R_CACHECTL */ diff --git a/arch/m32r/include/asm/cacheflush.h b/arch/m32r/include/asm/cacheflush.h deleted file mode 100644 index 5ad2a30454832..0000000000000 --- a/arch/m32r/include/asm/cacheflush.h +++ /dev/null @@ -1,73 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_M32R_CACHEFLUSH_H -#define _ASM_M32R_CACHEFLUSH_H - -#include - -extern void _flush_cache_all(void); -extern void _flush_cache_copyback_all(void); - -#if defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_OPSP) || defined(CONFIG_CHIP_M32104) -#define flush_cache_all() do { } while (0) -#define flush_cache_mm(mm) do { } while (0) -#define flush_cache_dup_mm(mm) do { } while (0) -#define flush_cache_range(vma, start, end) do { } while (0) -#define flush_cache_page(vma, vmaddr, pfn) do { } while (0) -#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0 -#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) -#ifndef CONFIG_SMP -#define flush_icache_range(start, end) _flush_cache_copyback_all() -#define flush_icache_page(vma,pg) _flush_cache_copyback_all() -#define flush_icache_user_range(vma,pg,adr,len) _flush_cache_copyback_all() -#define flush_cache_sigtramp(addr) _flush_cache_copyback_all() -#else /* CONFIG_SMP */ -extern void smp_flush_cache_all(void); -#define flush_icache_range(start, end) smp_flush_cache_all() -#define flush_icache_page(vma,pg) smp_flush_cache_all() -#define flush_icache_user_range(vma,pg,adr,len) smp_flush_cache_all() -#define flush_cache_sigtramp(addr) _flush_cache_copyback_all() -#endif /* CONFIG_SMP */ -#elif defined(CONFIG_CHIP_M32102) -#define flush_cache_all() do { } while (0) -#define flush_cache_mm(mm) do { } while (0) -#define flush_cache_dup_mm(mm) do { } while (0) -#define flush_cache_range(vma, start, end) do { } while (0) -#define flush_cache_page(vma, vmaddr, pfn) do { } while (0) -#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0 -#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, end) _flush_cache_all() -#define flush_icache_page(vma,pg) _flush_cache_all() -#define flush_icache_user_range(vma,pg,adr,len) _flush_cache_all() -#define flush_cache_sigtramp(addr) _flush_cache_all() -#else -#define flush_cache_all() do { } while (0) -#define flush_cache_mm(mm) do { } while (0) -#define flush_cache_dup_mm(mm) do { } while (0) -#define flush_cache_range(vma, start, end) do { } while (0) -#define flush_cache_page(vma, vmaddr, pfn) do { } while (0) -#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0 -#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, end) do { } while (0) -#define flush_icache_page(vma,pg) do { } while (0) -#define flush_icache_user_range(vma,pg,adr,len) do { } while (0) -#define flush_cache_sigtramp(addr) do { } while (0) -#endif /* CONFIG_CHIP_* */ - -#define flush_cache_vmap(start, end) do { } while (0) -#define flush_cache_vunmap(start, end) do { } while (0) - -#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_M32R_CACHEFLUSH_H */ diff --git a/arch/m32r/include/asm/checksum.h b/arch/m32r/include/asm/checksum.h deleted file mode 100644 index d68e93c9bd62d..0000000000000 --- a/arch/m32r/include/asm/checksum.h +++ /dev/null @@ -1,202 +0,0 @@ -#ifdef __KERNEL__ -#ifndef _ASM_M32R_CHECKSUM_H -#define _ASM_M32R_CHECKSUM_H - -/* - * include/asm-m32r/checksum.h - * - * IP/TCP/UDP checksum routines - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - * Some code taken from mips and parisc architecture. - * - * Copyright (C) 2001, 2002 Hiroyuki Kondo, Hirokazu Takata - * Copyright (C) 2004 Hirokazu Takata - */ - -#include - -/* - * 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 - */ -asmlinkage __wsum csum_partial(const void *buff, int len, __wsum sum); - -/* - * The same as csum_partial, but copies from src while it checksums. - * - * Here even more important to align src and dst on a 32-bit (or even - * better 64-bit) boundary - */ -extern __wsum csum_partial_copy_nocheck(const void *src, void *dst, - int len, __wsum sum); - -/* - * This is a new version of the above that records errors it finds in *errp, - * but continues and zeros thre rest of the buffer. - */ -extern __wsum csum_partial_copy_from_user(const void __user *src, void *dst, - int len, __wsum sum, - int *err_ptr); - -/* - * Fold a partial checksum - */ - -static inline __sum16 csum_fold(__wsum sum) -{ - unsigned long tmpreg; - __asm__( - " sll3 %1, %0, #16 \n" - " cmp %0, %0 \n" - " addx %0, %1 \n" - " ldi %1, #0 \n" - " srli %0, #16 \n" - " addx %0, %1 \n" - " xor3 %0, %0, #0x0000ffff \n" - : "=r" (sum), "=&r" (tmpreg) - : "0" (sum) - : "cbit" - ); - return (__force __sum16)sum; -} - -/* - * This is a version of ip_compute_csum() optimized for IP headers, - * which always checksum on 4 octet boundaries. - */ -static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl) -{ - unsigned long tmpreg0, tmpreg1; - __wsum sum; - - __asm__ __volatile__( - " ld %0, @%1+ \n" - " addi %2, #-4 \n" - "# bgez %2, 2f \n" - " cmp %0, %0 \n" - " ld %3, @%1+ \n" - " ld %4, @%1+ \n" - " addx %0, %3 \n" - " ld %3, @%1+ \n" - " addx %0, %4 \n" - " addx %0, %3 \n" - " .fillinsn\n" - "1: \n" - " ld %4, @%1+ \n" - " addi %2, #-1 \n" - " addx %0, %4 \n" - " bgtz %2, 1b \n" - "\n" - " ldi %3, #0 \n" - " addx %0, %3 \n" - " .fillinsn\n" - "2: \n" - /* Since the input registers which are loaded with iph and ihl - are modified, we must also specify them as outputs, or gcc - will assume they contain their original values. */ - : "=&r" (sum), "=r" (iph), "=r" (ihl), "=&r" (tmpreg0), "=&r" (tmpreg1) - : "1" (iph), "2" (ihl) - : "cbit", "memory"); - - return csum_fold(sum); -} - -static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr, - __u32 len, __u8 proto, - __wsum sum) -{ -#if defined(__LITTLE_ENDIAN) - unsigned long len_proto = (proto + len) << 8; -#else - unsigned long len_proto = proto + len; -#endif - unsigned long tmpreg; - - __asm__( - " cmp %0, %0 \n" - " addx %0, %2 \n" - " addx %0, %3 \n" - " addx %0, %4 \n" - " ldi %1, #0 \n" - " addx %0, %1 \n" - : "=r" (sum), "=&r" (tmpreg) - : "r" (daddr), "r" (saddr), "r" (len_proto), "0" (sum) - : "cbit" - ); - - return sum; -} - -/* - * computes the checksum of the TCP/UDP pseudo-header - * returns a 16-bit checksum, already complemented - */ -static inline __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr, - __u32 len, __u8 proto, - __wsum sum) -{ - return csum_fold(csum_tcpudp_nofold(saddr,daddr,len,proto,sum)); -} - -/* - * this routine is used for miscellaneous IP-like checksums, mainly - * in icmp.c - */ - -static inline __sum16 ip_compute_csum(const void *buff, int len) -{ - return csum_fold (csum_partial(buff, len, 0)); -} - -#define _HAVE_ARCH_IPV6_CSUM -static inline __sum16 csum_ipv6_magic(const struct in6_addr *saddr, - const struct in6_addr *daddr, - __u32 len, unsigned short proto, - __wsum sum) -{ - unsigned long tmpreg0, tmpreg1, tmpreg2, tmpreg3; - __asm__( - " ld %1, @(%5) \n" - " ld %2, @(4,%5) \n" - " ld %3, @(8,%5) \n" - " ld %4, @(12,%5) \n" - " add %0, %1 \n" - " addx %0, %2 \n" - " addx %0, %3 \n" - " addx %0, %4 \n" - " ld %1, @(%6) \n" - " ld %2, @(4,%6) \n" - " ld %3, @(8,%6) \n" - " ld %4, @(12,%6) \n" - " addx %0, %1 \n" - " addx %0, %2 \n" - " addx %0, %3 \n" - " addx %0, %4 \n" - " addx %0, %7 \n" - " addx %0, %8 \n" - " ldi %1, #0 \n" - " addx %0, %1 \n" - : "=&r" (sum), "=&r" (tmpreg0), "=&r" (tmpreg1), - "=&r" (tmpreg2), "=&r" (tmpreg3) - : "r" (saddr), "r" (daddr), - "r" (htonl(len)), "r" (htonl(proto)), "0" (sum) - : "cbit" - ); - - return csum_fold(sum); -} - -#endif /* _ASM_M32R_CHECKSUM_H */ -#endif /* __KERNEL__ */ diff --git a/arch/m32r/include/asm/cmpxchg.h b/arch/m32r/include/asm/cmpxchg.h deleted file mode 100644 index 1ccdce5ff0ac5..0000000000000 --- a/arch/m32r/include/asm/cmpxchg.h +++ /dev/null @@ -1,225 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_M32R_CMPXCHG_H -#define _ASM_M32R_CMPXCHG_H - -/* - * M32R version: - * Copyright (C) 2001, 2002 Hitoshi Yamamoto - * Copyright (C) 2004 Hirokazu Takata - */ - -#include -#include -#include - -extern void __xchg_called_with_bad_pointer(void); - -static __always_inline unsigned long -__xchg(unsigned long x, volatile void *ptr, int size) -{ - unsigned long flags; - unsigned long tmp = 0; - - local_irq_save(flags); - - switch (size) { -#ifndef CONFIG_SMP - case 1: - __asm__ __volatile__ ( - "ldb %0, @%2 \n\t" - "stb %1, @%2 \n\t" - : "=&r" (tmp) : "r" (x), "r" (ptr) : "memory"); - break; - case 2: - __asm__ __volatile__ ( - "ldh %0, @%2 \n\t" - "sth %1, @%2 \n\t" - : "=&r" (tmp) : "r" (x), "r" (ptr) : "memory"); - break; - case 4: - __asm__ __volatile__ ( - "ld %0, @%2 \n\t" - "st %1, @%2 \n\t" - : "=&r" (tmp) : "r" (x), "r" (ptr) : "memory"); - break; -#else /* CONFIG_SMP */ - case 4: - __asm__ __volatile__ ( - DCACHE_CLEAR("%0", "r4", "%2") - "lock %0, @%2; \n\t" - "unlock %1, @%2; \n\t" - : "=&r" (tmp) : "r" (x), "r" (ptr) - : "memory" -#ifdef CONFIG_CHIP_M32700_TS1 - , "r4" -#endif /* CONFIG_CHIP_M32700_TS1 */ - ); - break; -#endif /* CONFIG_SMP */ - default: - __xchg_called_with_bad_pointer(); - } - - local_irq_restore(flags); - - return (tmp); -} - -#define xchg(ptr, x) ({ \ - ((__typeof__(*(ptr)))__xchg((unsigned long)(x), (ptr), \ - sizeof(*(ptr)))); \ -}) - -static __always_inline unsigned long -__xchg_local(unsigned long x, volatile void *ptr, int size) -{ - unsigned long flags; - unsigned long tmp = 0; - - local_irq_save(flags); - - switch (size) { - case 1: - __asm__ __volatile__ ( - "ldb %0, @%2 \n\t" - "stb %1, @%2 \n\t" - : "=&r" (tmp) : "r" (x), "r" (ptr) : "memory"); - break; - case 2: - __asm__ __volatile__ ( - "ldh %0, @%2 \n\t" - "sth %1, @%2 \n\t" - : "=&r" (tmp) : "r" (x), "r" (ptr) : "memory"); - break; - case 4: - __asm__ __volatile__ ( - "ld %0, @%2 \n\t" - "st %1, @%2 \n\t" - : "=&r" (tmp) : "r" (x), "r" (ptr) : "memory"); - break; - default: - __xchg_called_with_bad_pointer(); - } - - local_irq_restore(flags); - - return (tmp); -} - -#define xchg_local(ptr, x) \ - ((__typeof__(*(ptr)))__xchg_local((unsigned long)(x), (ptr), \ - sizeof(*(ptr)))) - -static inline unsigned long -__cmpxchg_u32(volatile unsigned int *p, unsigned int old, unsigned int new) -{ - unsigned long flags; - unsigned int retval; - - local_irq_save(flags); - __asm__ __volatile__ ( - DCACHE_CLEAR("%0", "r4", "%1") - M32R_LOCK" %0, @%1; \n" - " bne %0, %2, 1f; \n" - M32R_UNLOCK" %3, @%1; \n" - " bra 2f; \n" - " .fillinsn \n" - "1:" - M32R_UNLOCK" %0, @%1; \n" - " .fillinsn \n" - "2:" - : "=&r" (retval) - : "r" (p), "r" (old), "r" (new) - : "cbit", "memory" -#ifdef CONFIG_CHIP_M32700_TS1 - , "r4" -#endif /* CONFIG_CHIP_M32700_TS1 */ - ); - local_irq_restore(flags); - - return retval; -} - -static inline unsigned long -__cmpxchg_local_u32(volatile unsigned int *p, unsigned int old, - unsigned int new) -{ - unsigned long flags; - unsigned int retval; - - local_irq_save(flags); - __asm__ __volatile__ ( - DCACHE_CLEAR("%0", "r4", "%1") - "ld %0, @%1; \n" - " bne %0, %2, 1f; \n" - "st %3, @%1; \n" - " bra 2f; \n" - " .fillinsn \n" - "1:" - "st %0, @%1; \n" - " .fillinsn \n" - "2:" - : "=&r" (retval) - : "r" (p), "r" (old), "r" (new) - : "cbit", "memory" -#ifdef CONFIG_CHIP_M32700_TS1 - , "r4" -#endif /* CONFIG_CHIP_M32700_TS1 */ - ); - local_irq_restore(flags); - - return retval; -} - -/* This function doesn't exist, so you'll get a linker error - if something tries to do an invalid cmpxchg(). */ -extern void __cmpxchg_called_with_bad_pointer(void); - -static inline unsigned long -__cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) -{ - switch (size) { - case 4: - return __cmpxchg_u32(ptr, old, new); -#if 0 /* we don't have __cmpxchg_u64 */ - case 8: - return __cmpxchg_u64(ptr, old, new); -#endif /* 0 */ - } - __cmpxchg_called_with_bad_pointer(); - return old; -} - -#define cmpxchg(ptr, o, n) ({ \ - ((__typeof__(*(ptr))) \ - __cmpxchg((ptr), (unsigned long)(o), \ - (unsigned long)(n), \ - sizeof(*(ptr)))); \ -}) - -#include - -static inline unsigned long __cmpxchg_local(volatile void *ptr, - unsigned long old, - unsigned long new, int size) -{ - switch (size) { - case 4: - return __cmpxchg_local_u32(ptr, old, new); - default: - return __cmpxchg_local_generic(ptr, old, new, size); - } - - return old; -} - -/* - * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make - * them available. - */ -#define cmpxchg_local(ptr, o, n) \ - ((__typeof__(*(ptr)))__cmpxchg_local((ptr), (unsigned long)(o), \ - (unsigned long)(n), sizeof(*(ptr)))) -#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n)) - -#endif /* _ASM_M32R_CMPXCHG_H */ diff --git a/arch/m32r/include/asm/dcache_clear.h b/arch/m32r/include/asm/dcache_clear.h deleted file mode 100644 index a0ae06c2e9e77..0000000000000 --- a/arch/m32r/include/asm/dcache_clear.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * This file is subject to 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) 2001 Hiroyuki Kondo, Hirokazu Takata, and Hitoshi Yamamoto - * Copyright (C) 2004, 2006 Hirokazu Takata - */ -#ifndef _ASM_M32R_DCACHE_CLEAR_H -#define _ASM_M32R_DCACHE_CLEAR_H - -#ifdef CONFIG_CHIP_M32700_TS1 -#define DCACHE_CLEAR(reg0, reg1, addr) \ - "seth "reg1", #high(dcache_dummy); \n\t" \ - "or3 "reg1", "reg1", #low(dcache_dummy); \n\t" \ - "lock "reg0", @"reg1"; \n\t" \ - "add3 "reg0", "addr", #0x1000; \n\t" \ - "ld "reg0", @"reg0"; \n\t" \ - "add3 "reg0", "addr", #0x2000; \n\t" \ - "ld "reg0", @"reg0"; \n\t" \ - "unlock "reg0", @"reg1"; \n\t" - /* FIXME: This workaround code cannot handle kernel modules - * correctly under SMP environment. - */ -#else /* CONFIG_CHIP_M32700_TS1 */ -#define DCACHE_CLEAR(reg0, reg1, addr) -#endif /* CONFIG_CHIP_M32700_TS1 */ - -#endif /* _ASM_M32R_DCACHE_CLEAR_H */ diff --git a/arch/m32r/include/asm/delay.h b/arch/m32r/include/asm/delay.h deleted file mode 100644 index 9670e127b7b27..0000000000000 --- a/arch/m32r/include/asm/delay.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/arch/m32r/include/asm/device.h b/arch/m32r/include/asm/device.h deleted file mode 100644 index 5203fc87f080e..0000000000000 --- a/arch/m32r/include/asm/device.h +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Arch specific extensions to struct device - * - * This file is released under the GPLv2 - */ -struct dev_archdata { -}; - -struct pdev_archdata { -}; diff --git a/arch/m32r/include/asm/div64.h b/arch/m32r/include/asm/div64.h deleted file mode 100644 index 6cd978cefb285..0000000000000 --- a/arch/m32r/include/asm/div64.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/arch/m32r/include/asm/dma.h b/arch/m32r/include/asm/dma.h deleted file mode 100644 index 661bc3b343ed2..0000000000000 --- a/arch/m32r/include/asm/dma.h +++ /dev/null @@ -1,13 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_M32R_DMA_H -#define _ASM_M32R_DMA_H - -#include - -/* - * The maximum address that we can perform a DMA transfer - * to on this platform - */ -#define MAX_DMA_ADDRESS (PAGE_OFFSET+0x20000000) - -#endif /* _ASM_M32R_DMA_H */ diff --git a/arch/m32r/include/asm/elf.h b/arch/m32r/include/asm/elf.h deleted file mode 100644 index 576b2ff579573..0000000000000 --- a/arch/m32r/include/asm/elf.h +++ /dev/null @@ -1,132 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_M32R__ELF_H -#define _ASM_M32R__ELF_H - -/* - * ELF-specific definitions. - * - * Copyright (C) 1999-2004, Renesas Technology Corp. - * Hirokazu Takata - */ - -#include -#include -#include - -/* M32R relocation types */ -#define R_M32R_NONE 0 -#define R_M32R_16 1 -#define R_M32R_32 2 -#define R_M32R_24 3 -#define R_M32R_10_PCREL 4 -#define R_M32R_18_PCREL 5 -#define R_M32R_26_PCREL 6 -#define R_M32R_HI16_ULO 7 -#define R_M32R_HI16_SLO 8 -#define R_M32R_LO16 9 -#define R_M32R_SDA16 10 -#define R_M32R_GNU_VTINHERIT 11 -#define R_M32R_GNU_VTENTRY 12 - -#define R_M32R_16_RELA 33 -#define R_M32R_32_RELA 34 -#define R_M32R_24_RELA 35 -#define R_M32R_10_PCREL_RELA 36 -#define R_M32R_18_PCREL_RELA 37 -#define R_M32R_26_PCREL_RELA 38 -#define R_M32R_HI16_ULO_RELA 39 -#define R_M32R_HI16_SLO_RELA 40 -#define R_M32R_LO16_RELA 41 -#define R_M32R_SDA16_RELA 42 -#define R_M32R_RELA_GNU_VTINHERIT 43 -#define R_M32R_RELA_GNU_VTENTRY 44 - -#define R_M32R_GOT24 48 -#define R_M32R_26_PLTREL 49 -#define R_M32R_COPY 50 -#define R_M32R_GLOB_DAT 51 -#define R_M32R_JMP_SLOT 52 -#define R_M32R_RELATIVE 53 -#define R_M32R_GOTOFF 54 -#define R_M32R_GOTPC24 55 -#define R_M32R_GOT16_HI_ULO 56 -#define R_M32R_GOT16_HI_SLO 57 -#define R_M32R_GOT16_LO 58 -#define R_M32R_GOTPC_HI_ULO 59 -#define R_M32R_GOTPC_HI_SLO 60 -#define R_M32R_GOTPC_LO 61 -#define R_M32R_GOTOFF_HI_ULO 62 -#define R_M32R_GOTOFF_HI_SLO 63 -#define R_M32R_GOTOFF_LO 64 - -#define R_M32R_NUM 256 - -/* - * ELF register definitions.. - */ -#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t)) - -typedef unsigned long elf_greg_t; -typedef elf_greg_t elf_gregset_t[ELF_NGREG]; - -/* We have no FP mumumu. */ -typedef double elf_fpreg_t; -typedef elf_fpreg_t elf_fpregset_t; - -/* - * This is used to ensure we don't load something for the wrong architecture. - */ -#define elf_check_arch(x) \ - (((x)->e_machine == EM_M32R) || ((x)->e_machine == EM_CYGNUS_M32R)) - -/* - * These are used to set parameters in the core dumps. - */ -#define ELF_CLASS ELFCLASS32 -#if defined(__LITTLE_ENDIAN__) -#define ELF_DATA ELFDATA2LSB -#elif defined(__BIG_ENDIAN__) -#define ELF_DATA ELFDATA2MSB -#else -#error no endian defined -#endif -#define ELF_ARCH EM_M32R - -/* r0 is set by ld.so to a pointer to a function which might be - * registered using 'atexit'. This provides a mean for the dynamic - * linker to call DT_FINI functions for shared libraries that have - * been loaded before the code runs. - * - * So that we can use the same startup file with static executables, - * we start programs with a value of 0 to indicate that there is no - * such function. - */ -#define ELF_PLAT_INIT(_r, load_addr) (_r)->r0 = 0 - -#define ELF_EXEC_PAGESIZE PAGE_SIZE - -/* - * This is the location that an ET_DYN program is loaded if exec'ed. - * Typical use of this is to invoke "./ld.so someprog" to test out a - * new version of the loader. We need to make sure that it is out of - * the way of the program that it will "exec", and that there is - * sufficient room for the brk. - */ -#define ELF_ET_DYN_BASE (TASK_SIZE / 3 * 2) - -/* regs is struct pt_regs, pr_reg is elf_gregset_t (which is - now struct_user_regs, they are different) */ - -#define ELF_CORE_COPY_REGS(pr_reg, regs) \ - memcpy((char *)pr_reg, (char *)regs, sizeof (struct pt_regs)); - -/* This yields a mask that user programs can use to figure out what - instruction set this CPU supports. */ -#define ELF_HWCAP (0) - -/* This yields a string that ld.so will use to load implementation - specific libraries for optimization. This is more specific in - intent than poking at uname or /proc/cpuinfo. */ -#define ELF_PLATFORM (NULL) - -#endif /* _ASM_M32R__ELF_H */ diff --git a/arch/m32r/include/asm/emergency-restart.h b/arch/m32r/include/asm/emergency-restart.h deleted file mode 100644 index cca44d5ae264e..0000000000000 --- a/arch/m32r/include/asm/emergency-restart.h +++ /dev/null @@ -1,7 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_EMERGENCY_RESTART_H -#define _ASM_EMERGENCY_RESTART_H - -#include - -#endif /* _ASM_EMERGENCY_RESTART_H */ diff --git a/arch/m32r/include/asm/fb.h b/arch/m32r/include/asm/fb.h deleted file mode 100644 index 9a0bca2686fd3..0000000000000 --- a/arch/m32r/include/asm/fb.h +++ /dev/null @@ -1,20 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_FB_H_ -#define _ASM_FB_H_ - -#include -#include -#include - -static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma, - unsigned long off) -{ - vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot); -} - -static inline int fb_is_primary_device(struct fb_info *info) -{ - return 0; -} - -#endif /* _ASM_FB_H_ */ diff --git a/arch/m32r/include/asm/flat.h b/arch/m32r/include/asm/flat.h deleted file mode 100644 index dfcb0e4eb2568..0000000000000 --- a/arch/m32r/include/asm/flat.h +++ /dev/null @@ -1,143 +0,0 @@ -/* - * include/asm-m32r/flat.h - * - * uClinux flat-format executables - * - * Copyright (C) 2004 Kazuhiro Inaoka - * - * This file is subject to 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_M32R_FLAT_H -#define __ASM_M32R_FLAT_H - -#define flat_argvp_envp_on_stack() 0 -#define flat_old_ram_flag(flags) (flags) -#define flat_set_persistent(relval, p) 0 -#define flat_reloc_valid(reloc, size) \ - (((reloc) - textlen_for_m32r_lo16_data) <= (size)) - -/* Convert a relocation entry into an address. */ -static inline unsigned long -flat_get_relocate_addr (unsigned long relval) -{ - return relval & 0x00ffffff; /* Mask out top 8-bits */ -} - -#define flat_m32r_get_reloc_type(relval) ((relval) >> 24) - -#define M32R_SETH_OPCODE 0xd0c00000 /* SETH instruction code */ - -#define FLAT_M32R_32 0x00 /* 32bits reloc */ -#define FLAT_M32R_24 0x01 /* unsigned 24bits reloc */ -#define FLAT_M32R_16 0x02 /* 16bits reloc */ -#define FLAT_M32R_LO16 0x03 /* signed low 16bits reloc (low()) */ -#define FLAT_M32R_LO16_DATA 0x04 /* signed low 16bits reloc (low()) - for a symbol in .data section */ - /* High 16bits of an address used - when the lower 16bbits are treated - as unsigned. - To create SETH instruction only. - 0x1X: X means a number of register. - 0x10 - 0x3F are reserved. */ -#define FLAT_M32R_HI16_ULO 0x10 /* reloc for SETH Rn,#high(imm16) */ - /* High 16bits of an address used - when the lower 16bbits are treated - as signed. - To create SETH instruction only. - 0x2X: X means a number of register. - 0x20 - 0x4F are reserved. */ -#define FLAT_M32R_HI16_SLO 0x20 /* reloc for SETH Rn,#shigh(imm16) */ - -static unsigned long textlen_for_m32r_lo16_data = 0; - -static inline unsigned long m32r_flat_get_addr_from_rp (u32 *rp, - u32 relval, - u32 textlen) -{ - unsigned int reloc = flat_m32r_get_reloc_type (relval); - textlen_for_m32r_lo16_data = 0; - if (reloc & 0xf0) { - unsigned long addr = htonl(*rp); - switch (reloc & 0xf0) - { - case FLAT_M32R_HI16_ULO: - case FLAT_M32R_HI16_SLO: - if (addr == 0) { - /* put "seth Rn,#0x0" instead of 0 (addr). */ - *rp = (M32R_SETH_OPCODE | ((reloc & 0x0f)<<24)); - } - return addr; - default: - break; - } - } else { - switch (reloc) - { - case FLAT_M32R_LO16: - return htonl(*rp) & 0xFFFF; - case FLAT_M32R_LO16_DATA: - /* FIXME: The return value will decrease by textlen - at m32r_flat_put_addr_at_rp () */ - textlen_for_m32r_lo16_data = textlen; - return (htonl(*rp) & 0xFFFF) + textlen; - case FLAT_M32R_16: - return htons(*(unsigned short *)rp) & 0xFFFF; - case FLAT_M32R_24: - return htonl(*rp) & 0xFFFFFF; - case FLAT_M32R_32: - return htonl(*rp); - default: - break; - } - } - return ~0; /* bogus value */ -} - -static inline int flat_put_addr_at_rp(u32 *rp, u32 addr, u32 relval) -{ - unsigned int reloc = flat_m32r_get_reloc_type (relval); - if (reloc & 0xf0) { - unsigned long Rn = reloc & 0x0f; /* get a number of register */ - Rn <<= 24; /* 0x0R000000 */ - reloc &= 0xf0; - switch (reloc) - { - case FLAT_M32R_HI16_ULO: /* To create SETH Rn,#high(imm16) */ - *rp = (M32R_SETH_OPCODE | Rn - | ((addr >> 16) & 0xFFFF)); - break; - case FLAT_M32R_HI16_SLO: /* To create SETH Rn,#shigh(imm16) */ - *rp = (M32R_SETH_OPCODE | Rn - | (((addr >> 16) + ((addr & 0x8000) ? 1 : 0)) - & 0xFFFF)); - break; - } - } else { - switch (reloc) { - case FLAT_M32R_LO16_DATA: - addr -= textlen_for_m32r_lo16_data; - textlen_for_m32r_lo16_data = 0; - case FLAT_M32R_LO16: - *rp = (htonl(*rp) & 0xFFFF0000) | (addr & 0xFFFF); - break; - case FLAT_M32R_16: - *(unsigned short *)rp = addr & 0xFFFF; - break; - case FLAT_M32R_24: - *rp = (htonl(*rp) & 0xFF000000) | (addr & 0xFFFFFF); - break; - case FLAT_M32R_32: - *rp = addr; - break; - } - } - return 0; -} - -// kludge - text_len is a local variable in the only user. -#define flat_get_addr_from_rp(rp, relval, flags, addr, persistent) \ - (m32r_flat_get_addr_from_rp(rp, relval, text_len), 0) - -#endif /* __ASM_M32R_FLAT_H */ diff --git a/arch/m32r/include/asm/ftrace.h b/arch/m32r/include/asm/ftrace.h deleted file mode 100644 index 40a8c178f10d9..0000000000000 --- a/arch/m32r/include/asm/ftrace.h +++ /dev/null @@ -1 +0,0 @@ -/* empty */ diff --git a/arch/m32r/include/asm/futex.h b/arch/m32r/include/asm/futex.h deleted file mode 100644 index 6a332a9f099c2..0000000000000 --- a/arch/m32r/include/asm/futex.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _ASM_FUTEX_H -#define _ASM_FUTEX_H - -#include - -#endif diff --git a/arch/m32r/include/asm/hardirq.h b/arch/m32r/include/asm/hardirq.h deleted file mode 100644 index 10c23de02b3ab..0000000000000 --- a/arch/m32r/include/asm/hardirq.h +++ /dev/null @@ -1,10 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifdef __KERNEL__ -#ifndef __ASM_HARDIRQ_H -#define __ASM_HARDIRQ_H - -#include -#include - -#endif /* __ASM_HARDIRQ_H */ -#endif /* __KERNEL__ */ diff --git a/arch/m32r/include/asm/hw_irq.h b/arch/m32r/include/asm/hw_irq.h deleted file mode 100644 index 7138537cda030..0000000000000 --- a/arch/m32r/include/asm/hw_irq.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef _ASM_M32R_HW_IRQ_H -#define _ASM_M32R_HW_IRQ_H - -#endif /* _ASM_M32R_HW_IRQ_H */ diff --git a/arch/m32r/include/asm/io.h b/arch/m32r/include/asm/io.h deleted file mode 100644 index a4272d8f0d9ca..0000000000000 --- a/arch/m32r/include/asm/io.h +++ /dev/null @@ -1,225 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_M32R_IO_H -#define _ASM_M32R_IO_H - -#include -#include -#include /* __va */ - -#ifdef __KERNEL__ - -#define IO_SPACE_LIMIT 0xFFFFFFFF - -/** - * 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 virt_to_phys(volatile void * address) -{ - return __pa(address); -} - -/** - * 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 __va(address); -} - -extern void __iomem * -__ioremap(unsigned long offset, unsigned long size, unsigned long flags); - -/** - * ioremap - map bus memory into CPU space - * @offset: bus address of the memory - * @size: size of the resource to map - * - * ioremap performs a platform specific sequence of operations to - * make bus memory CPU accessible via the readb/readw/readl/writeb/ - * writew/writel functions and the other mmio helpers. The returned - * address is not guaranteed to be usable directly as a virtual - * address. - */ - -static inline void __iomem *ioremap(unsigned long offset, unsigned long size) -{ - return __ioremap(offset, size, 0); -} - -extern void iounmap(volatile void __iomem *addr); -#define ioremap_nocache(off,size) ioremap(off,size) -#define ioremap_wc ioremap_nocache -#define ioremap_wt ioremap_nocache -#define ioremap_uc ioremap_nocache - -/* - * IO bus memory addresses are also 1:1 with the physical address - */ -#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT) -#define page_to_bus page_to_phys -#define virt_to_bus virt_to_phys - -extern unsigned char _inb(unsigned long); -extern unsigned short _inw(unsigned long); -extern unsigned long _inl(unsigned long); -extern unsigned char _inb_p(unsigned long); -extern unsigned short _inw_p(unsigned long); -extern unsigned long _inl_p(unsigned long); -extern void _outb(unsigned char, unsigned long); -extern void _outw(unsigned short, unsigned long); -extern void _outl(unsigned long, unsigned long); -extern void _outb_p(unsigned char, unsigned long); -extern void _outw_p(unsigned short, unsigned long); -extern void _outl_p(unsigned long, unsigned long); -extern void _insb(unsigned int, void *, unsigned long); -extern void _insw(unsigned int, void *, unsigned long); -extern void _insl(unsigned int, void *, unsigned long); -extern void _outsb(unsigned int, const void *, unsigned long); -extern void _outsw(unsigned int, const void *, unsigned long); -extern void _outsl(unsigned int, const void *, unsigned long); - -static inline unsigned char _readb(unsigned long addr) -{ - return *(volatile unsigned char __force *)addr; -} - -static inline unsigned short _readw(unsigned long addr) -{ - return *(volatile unsigned short __force *)addr; -} - -static inline unsigned long _readl(unsigned long addr) -{ - return *(volatile unsigned long __force *)addr; -} - -static inline void _writeb(unsigned char b, unsigned long addr) -{ - *(volatile unsigned char __force *)addr = b; -} - -static inline void _writew(unsigned short w, unsigned long addr) -{ - *(volatile unsigned short __force *)addr = w; -} - -static inline void _writel(unsigned long l, unsigned long addr) -{ - *(volatile unsigned long __force *)addr = l; -} - -#define inb _inb -#define inw _inw -#define inl _inl -#define outb _outb -#define outw _outw -#define outl _outl - -#define inb_p _inb_p -#define inw_p _inw_p -#define inl_p _inl_p -#define outb_p _outb_p -#define outw_p _outw_p -#define outl_p _outl_p - -#define insb _insb -#define insw _insw -#define insl _insl -#define outsb _outsb -#define outsw _outsw -#define outsl _outsl - -#define readb(addr) _readb((unsigned long)(addr)) -#define readw(addr) _readw((unsigned long)(addr)) -#define readl(addr) _readl((unsigned long)(addr)) -#define __raw_readb readb -#define __raw_readw readw -#define __raw_readl readl -#define readb_relaxed readb -#define readw_relaxed readw -#define readl_relaxed readl - -#define writeb(val, addr) _writeb((val), (unsigned long)(addr)) -#define writew(val, addr) _writew((val), (unsigned long)(addr)) -#define writel(val, addr) _writel((val), (unsigned long)(addr)) -#define __raw_writeb writeb -#define __raw_writew writew -#define __raw_writel writel -#define writeb_relaxed writeb -#define writew_relaxed writew -#define writel_relaxed writel - -#define ioread8 readb -#define ioread16 readw -#define ioread32 readl -#define iowrite8 writeb -#define iowrite16 writew -#define iowrite32 writel - -#define ioread8_rep(p, dst, count) insb((unsigned long)(p), (dst), (count)) -#define ioread16_rep(p, dst, count) insw((unsigned long)(p), (dst), (count)) -#define ioread32_rep(p, dst, count) insl((unsigned long)(p), (dst), (count)) - -#define iowrite8_rep(p, src, count) outsb((unsigned long)(p), (src), (count)) -#define iowrite16_rep(p, src, count) outsw((unsigned long)(p), (src), (count)) -#define iowrite32_rep(p, src, count) outsl((unsigned long)(p), (src), (count)) - -#define ioread16be(addr) be16_to_cpu(readw(addr)) -#define ioread32be(addr) be32_to_cpu(readl(addr)) -#define iowrite16be(v, addr) writew(cpu_to_be16(v), (addr)) -#define iowrite32be(v, addr) writel(cpu_to_be32(v), (addr)) - -#define mmiowb() - -static inline void -memset_io(volatile void __iomem *addr, unsigned char val, int count) -{ - memset((void __force *) addr, val, count); -} - -static inline void -memcpy_fromio(void *dst, volatile void __iomem *src, int count) -{ - memcpy(dst, (void __force *) src, count); -} - -static inline void -memcpy_toio(volatile void __iomem *dst, const void *src, int count) -{ - memcpy((void __force *) dst, src, count); -} - -/* - * 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 - -#endif /* __KERNEL__ */ - -#endif /* _ASM_M32R_IO_H */ diff --git a/arch/m32r/include/asm/irq.h b/arch/m32r/include/asm/irq.h deleted file mode 100644 index 85b475fff90ed..0000000000000 --- a/arch/m32r/include/asm/irq.h +++ /dev/null @@ -1,91 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifdef __KERNEL__ -#ifndef _ASM_M32R_IRQ_H -#define _ASM_M32R_IRQ_H - - -#if defined(CONFIG_PLAT_USRV) -/* - * IRQ definitions for M32700UT - * M32700 Chip: 64 interrupts - * ICU of M32700UT-on-board PLD: 32 interrupts cascaded to INT1# chip pin - */ -#define M32700UT_NUM_CPU_IRQ (64) -#define M32700UT_NUM_PLD_IRQ (32) -#define M32700UT_IRQ_BASE 0 -#define M32700UT_CPU_IRQ_BASE M32700UT_IRQ_BASE -#define M32700UT_PLD_IRQ_BASE (M32700UT_CPU_IRQ_BASE + M32700UT_NUM_CPU_IRQ) - -#define NR_IRQS (M32700UT_NUM_CPU_IRQ + M32700UT_NUM_PLD_IRQ) -#elif defined(CONFIG_PLAT_M32700UT) -/* - * IRQ definitions for M32700UT(Rev.C) + M32R-LAN - * M32700 Chip: 64 interrupts - * ICU of M32700UT-on-board PLD: 32 interrupts cascaded to INT1# chip pin - * ICU of M32R-LCD-on-board PLD: 32 interrupts cascaded to INT2# chip pin - * ICU of M32R-LAN-on-board PLD: 32 interrupts cascaded to INT0# chip pin - */ -#define M32700UT_NUM_CPU_IRQ (64) -#define M32700UT_NUM_PLD_IRQ (32) -#define M32700UT_NUM_LCD_PLD_IRQ (32) -#define M32700UT_NUM_LAN_PLD_IRQ (32) -#define M32700UT_IRQ_BASE 0 -#define M32700UT_CPU_IRQ_BASE (M32700UT_IRQ_BASE) -#define M32700UT_PLD_IRQ_BASE \ - (M32700UT_CPU_IRQ_BASE + M32700UT_NUM_CPU_IRQ) -#define M32700UT_LCD_PLD_IRQ_BASE \ - (M32700UT_PLD_IRQ_BASE + M32700UT_NUM_PLD_IRQ) -#define M32700UT_LAN_PLD_IRQ_BASE \ - (M32700UT_LCD_PLD_IRQ_BASE + M32700UT_NUM_LCD_PLD_IRQ) - -#define NR_IRQS \ - (M32700UT_NUM_CPU_IRQ + M32700UT_NUM_PLD_IRQ \ - + M32700UT_NUM_LCD_PLD_IRQ + M32700UT_NUM_LAN_PLD_IRQ) -#elif defined(CONFIG_PLAT_OPSPUT) -/* - * IRQ definitions for OPSPUT + M32R-LAN - * OPSP Chip: 64 interrupts - * ICU of OPSPUT-on-board PLD: 32 interrupts cascaded to INT1# chip pin - * ICU of M32R-LCD-on-board PLD: 32 interrupts cascaded to INT2# chip pin - * ICU of M32R-LAN-on-board PLD: 32 interrupts cascaded to INT0# chip pin - */ -#define OPSPUT_NUM_CPU_IRQ (64) -#define OPSPUT_NUM_PLD_IRQ (32) -#define OPSPUT_NUM_LCD_PLD_IRQ (32) -#define OPSPUT_NUM_LAN_PLD_IRQ (32) -#define OPSPUT_IRQ_BASE 0 -#define OPSPUT_CPU_IRQ_BASE (OPSPUT_IRQ_BASE) -#define OPSPUT_PLD_IRQ_BASE \ - (OPSPUT_CPU_IRQ_BASE + OPSPUT_NUM_CPU_IRQ) -#define OPSPUT_LCD_PLD_IRQ_BASE \ - (OPSPUT_PLD_IRQ_BASE + OPSPUT_NUM_PLD_IRQ) -#define OPSPUT_LAN_PLD_IRQ_BASE \ - (OPSPUT_LCD_PLD_IRQ_BASE + OPSPUT_NUM_LCD_PLD_IRQ) - -#define NR_IRQS \ - (OPSPUT_NUM_CPU_IRQ + OPSPUT_NUM_PLD_IRQ \ - + OPSPUT_NUM_LCD_PLD_IRQ + OPSPUT_NUM_LAN_PLD_IRQ) - -#elif defined(CONFIG_PLAT_M32104UT) -/* - * IRQ definitions for M32104UT - * M32104 Chip: 64 interrupts - * ICU of M32104UT-on-board PLD: 32 interrupts cascaded to INT1# chip pin - */ -#define M32104UT_NUM_CPU_IRQ (64) -#define M32104UT_NUM_PLD_IRQ (32) -#define M32104UT_IRQ_BASE 0 -#define M32104UT_CPU_IRQ_BASE M32104UT_IRQ_BASE -#define M32104UT_PLD_IRQ_BASE (M32104UT_CPU_IRQ_BASE + M32104UT_NUM_CPU_IRQ) - -#define NR_IRQS \ - (M32104UT_NUM_CPU_IRQ + M32104UT_NUM_PLD_IRQ) - -#else -#define NR_IRQS 64 -#endif - -#define irq_canonicalize(irq) (irq) - -#endif /* _ASM_M32R_IRQ_H */ -#endif /* __KERNEL__ */ diff --git a/arch/m32r/include/asm/irq_regs.h b/arch/m32r/include/asm/irq_regs.h deleted file mode 100644 index 3dd9c0b702704..0000000000000 --- a/arch/m32r/include/asm/irq_regs.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/arch/m32r/include/asm/irqflags.h b/arch/m32r/include/asm/irqflags.h deleted file mode 100644 index 1f92d29982ae5..0000000000000 --- a/arch/m32r/include/asm/irqflags.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * This file is subject to 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) 2001 Hiroyuki Kondo, Hirokazu Takata, and Hitoshi Yamamoto - * Copyright (C) 2004, 2006 Hirokazu Takata - */ - -#ifndef _ASM_M32R_IRQFLAGS_H -#define _ASM_M32R_IRQFLAGS_H - -#include - -static inline unsigned long arch_local_save_flags(void) -{ - unsigned long flags; - asm volatile("mvfc %0,psw" : "=r"(flags)); - return flags; -} - -static inline void arch_local_irq_disable(void) -{ -#if !defined(CONFIG_CHIP_M32102) && !defined(CONFIG_CHIP_M32104) - asm volatile ( - "clrpsw #0x40 -> nop" - : : : "memory"); -#else - unsigned long tmpreg0, tmpreg1; - asm volatile ( - "ld24 %0, #0 ; Use 32-bit insn. \n\t" - "mvfc %1, psw ; No interrupt can be accepted here. \n\t" - "mvtc %0, psw \n\t" - "and3 %0, %1, #0xffbf \n\t" - "mvtc %0, psw \n\t" - : "=&r" (tmpreg0), "=&r" (tmpreg1) - : - : "cbit", "memory"); -#endif -} - -static inline void arch_local_irq_enable(void) -{ -#if !defined(CONFIG_CHIP_M32102) && !defined(CONFIG_CHIP_M32104) - asm volatile ( - "setpsw #0x40 -> nop" - : : : "memory"); -#else - unsigned long tmpreg; - asm volatile ( - "mvfc %0, psw; \n\t" - "or3 %0, %0, #0x0040; \n\t" - "mvtc %0, psw; \n\t" - : "=&r" (tmpreg) - : - : "cbit", "memory"); -#endif -} - -static inline unsigned long arch_local_irq_save(void) -{ - unsigned long flags; - -#if !(defined(CONFIG_CHIP_M32102) || defined(CONFIG_CHIP_M32104)) - asm volatile ( - "mvfc %0, psw; \n\t" - "clrpsw #0x40 -> nop; \n\t" - : "=r" (flags) - : - : "memory"); -#else - unsigned long tmpreg; - asm volatile ( - "ld24 %1, #0 \n\t" - "mvfc %0, psw \n\t" - "mvtc %1, psw \n\t" - "and3 %1, %0, #0xffbf \n\t" - "mvtc %1, psw \n\t" - : "=r" (flags), "=&r" (tmpreg) - : - : "cbit", "memory"); -#endif - return flags; -} - -static inline void arch_local_irq_restore(unsigned long flags) -{ - asm volatile("mvtc %0,psw" - : - : "r" (flags) - : "cbit", "memory"); -} - -static inline bool arch_irqs_disabled_flags(unsigned long flags) -{ - return !(flags & 0x40); -} - -static inline bool arch_irqs_disabled(void) -{ - return arch_irqs_disabled_flags(arch_local_save_flags()); -} - -#endif /* _ASM_M32R_IRQFLAGS_H */ diff --git a/arch/m32r/include/asm/kdebug.h b/arch/m32r/include/asm/kdebug.h deleted file mode 100644 index 6ece1b0376655..0000000000000 --- a/arch/m32r/include/asm/kdebug.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/arch/m32r/include/asm/kmap_types.h b/arch/m32r/include/asm/kmap_types.h deleted file mode 100644 index 3dcba0d17d40a..0000000000000 --- a/arch/m32r/include/asm/kmap_types.h +++ /dev/null @@ -1,13 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __M32R_KMAP_TYPES_H -#define __M32R_KMAP_TYPES_H - -#ifdef CONFIG_DEBUG_HIGHMEM -#define __WITH_KM_FENCE -#endif - -#include - -#undef __WITH_KM_FENCE - -#endif /* __M32R_KMAP_TYPES_H */ diff --git a/arch/m32r/include/asm/linkage.h b/arch/m32r/include/asm/linkage.h deleted file mode 100644 index f1aee6ec5bc3d..0000000000000 --- a/arch/m32r/include/asm/linkage.h +++ /dev/null @@ -1,8 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __ASM_LINKAGE_H -#define __ASM_LINKAGE_H - -#define __ALIGN .balign 4 -#define __ALIGN_STR ".balign 4" - -#endif /* __ASM_LINKAGE_H */ diff --git a/arch/m32r/include/asm/local.h b/arch/m32r/include/asm/local.h deleted file mode 100644 index 6780680c185d9..0000000000000 --- a/arch/m32r/include/asm/local.h +++ /dev/null @@ -1,341 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __M32R_LOCAL_H -#define __M32R_LOCAL_H - -/* - * linux/include/asm-m32r/local.h - * - * M32R version: - * Copyright (C) 2001, 2002 Hitoshi Yamamoto - * Copyright (C) 2004 Hirokazu Takata - * Copyright (C) 2007 Mathieu Desnoyers - */ - -#include -#include -#include - -/* - * Atomic operations that C can't guarantee us. Useful for - * resource counting etc.. - */ - -/* - * Make sure gcc doesn't try to be clever and move things around - * on us. We need to use _exactly_ the address the user gave us, - * not some alias that contains the same information. - */ -typedef struct { volatile int counter; } local_t; - -#define LOCAL_INIT(i) { (i) } - -/** - * local_read - read local variable - * @l: pointer of type local_t - * - * Atomically reads the value of @l. - */ -#define local_read(l) ((l)->counter) - -/** - * local_set - set local variable - * @l: pointer of type local_t - * @i: required value - * - * Atomically sets the value of @l to @i. - */ -#define local_set(l, i) (((l)->counter) = (i)) - -/** - * local_add_return - add long to local variable and return it - * @i: long value to add - * @l: pointer of type local_t - * - * Atomically adds @i to @l and return (@i + @l). - */ -static inline long local_add_return(long i, local_t *l) -{ - unsigned long flags; - long result; - - local_irq_save(flags); - __asm__ __volatile__ ( - "# local_add_return \n\t" - DCACHE_CLEAR("%0", "r4", "%1") - "ld %0, @%1; \n\t" - "add %0, %2; \n\t" - "st %0, @%1; \n\t" - : "=&r" (result) - : "r" (&l->counter), "r" (i) - : "memory" -#ifdef CONFIG_CHIP_M32700_TS1 - , "r4" -#endif /* CONFIG_CHIP_M32700_TS1 */ - ); - local_irq_restore(flags); - - return result; -} - -/** - * local_sub_return - subtract long from local variable and return it - * @i: long value to subtract - * @l: pointer of type local_t - * - * Atomically subtracts @i from @l and return (@l - @i). - */ -static inline long local_sub_return(long i, local_t *l) -{ - unsigned long flags; - long result; - - local_irq_save(flags); - __asm__ __volatile__ ( - "# local_sub_return \n\t" - DCACHE_CLEAR("%0", "r4", "%1") - "ld %0, @%1; \n\t" - "sub %0, %2; \n\t" - "st %0, @%1; \n\t" - : "=&r" (result) - : "r" (&l->counter), "r" (i) - : "memory" -#ifdef CONFIG_CHIP_M32700_TS1 - , "r4" -#endif /* CONFIG_CHIP_M32700_TS1 */ - ); - local_irq_restore(flags); - - return result; -} - -/** - * local_add - add long to local variable - * @i: long value to add - * @l: pointer of type local_t - * - * Atomically adds @i to @l. - */ -#define local_add(i, l) ((void) local_add_return((i), (l))) - -/** - * local_sub - subtract the local variable - * @i: long value to subtract - * @l: pointer of type local_t - * - * Atomically subtracts @i from @l. - */ -#define local_sub(i, l) ((void) local_sub_return((i), (l))) - -/** - * local_sub_and_test - subtract value from variable and test result - * @i: integer value to subtract - * @l: pointer of type local_t - * - * Atomically subtracts @i from @l and returns - * true if the result is zero, or false for all - * other cases. - */ -#define local_sub_and_test(i, l) (local_sub_return((i), (l)) == 0) - -/** - * local_inc_return - increment local variable and return it - * @l: pointer of type local_t - * - * Atomically increments @l by 1 and returns the result. - */ -static inline long local_inc_return(local_t *l) -{ - unsigned long flags; - long result; - - local_irq_save(flags); - __asm__ __volatile__ ( - "# local_inc_return \n\t" - DCACHE_CLEAR("%0", "r4", "%1") - "ld %0, @%1; \n\t" - "addi %0, #1; \n\t" - "st %0, @%1; \n\t" - : "=&r" (result) - : "r" (&l->counter) - : "memory" -#ifdef CONFIG_CHIP_M32700_TS1 - , "r4" -#endif /* CONFIG_CHIP_M32700_TS1 */ - ); - local_irq_restore(flags); - - return result; -} - -/** - * local_dec_return - decrement local variable and return it - * @l: pointer of type local_t - * - * Atomically decrements @l by 1 and returns the result. - */ -static inline long local_dec_return(local_t *l) -{ - unsigned long flags; - long result; - - local_irq_save(flags); - __asm__ __volatile__ ( - "# local_dec_return \n\t" - DCACHE_CLEAR("%0", "r4", "%1") - "ld %0, @%1; \n\t" - "addi %0, #-1; \n\t" - "st %0, @%1; \n\t" - : "=&r" (result) - : "r" (&l->counter) - : "memory" -#ifdef CONFIG_CHIP_M32700_TS1 - , "r4" -#endif /* CONFIG_CHIP_M32700_TS1 */ - ); - local_irq_restore(flags); - - return result; -} - -/** - * local_inc - increment local variable - * @l: pointer of type local_t - * - * Atomically increments @l by 1. - */ -#define local_inc(l) ((void)local_inc_return(l)) - -/** - * local_dec - decrement local variable - * @l: pointer of type local_t - * - * Atomically decrements @l by 1. - */ -#define local_dec(l) ((void)local_dec_return(l)) - -/** - * local_inc_and_test - increment and test - * @l: pointer of type local_t - * - * Atomically increments @l by 1 - * and returns true if the result is zero, or false for all - * other cases. - */ -#define local_inc_and_test(l) (local_inc_return(l) == 0) - -/** - * local_dec_and_test - decrement and test - * @l: pointer of type local_t - * - * Atomically decrements @l by 1 and - * returns true if the result is 0, or false for all - * other cases. - */ -#define local_dec_and_test(l) (local_dec_return(l) == 0) - -/** - * local_add_negative - add and test if negative - * @l: pointer of type local_t - * @i: integer value to add - * - * Atomically adds @i to @l and returns true - * if the result is negative, or false when - * result is greater than or equal to zero. - */ -#define local_add_negative(i, l) (local_add_return((i), (l)) < 0) - -#define local_cmpxchg(l, o, n) (cmpxchg_local(&((l)->counter), (o), (n))) -#define local_xchg(v, new) (xchg_local(&((l)->counter), new)) - -/** - * local_add_unless - add unless the number is a given value - * @l: pointer of type local_t - * @a: the amount to add to l... - * @u: ...unless l is equal to u. - * - * Atomically adds @a to @l, so long as it was not @u. - * Returns non-zero if @l was not @u, and zero otherwise. - */ -static inline int local_add_unless(local_t *l, long a, long u) -{ - long c, old; - c = local_read(l); - for (;;) { - if (unlikely(c == (u))) - break; - old = local_cmpxchg((l), c, c + (a)); - if (likely(old == c)) - break; - c = old; - } - return c != (u); -} - -#define local_inc_not_zero(l) local_add_unless((l), 1, 0) - -static inline void local_clear_mask(unsigned long mask, local_t *addr) -{ - unsigned long flags; - unsigned long tmp; - - local_irq_save(flags); - __asm__ __volatile__ ( - "# local_clear_mask \n\t" - DCACHE_CLEAR("%0", "r5", "%1") - "ld %0, @%1; \n\t" - "and %0, %2; \n\t" - "st %0, @%1; \n\t" - : "=&r" (tmp) - : "r" (addr), "r" (~mask) - : "memory" -#ifdef CONFIG_CHIP_M32700_TS1 - , "r5" -#endif /* CONFIG_CHIP_M32700_TS1 */ - ); - local_irq_restore(flags); -} - -static inline void local_set_mask(unsigned long mask, local_t *addr) -{ - unsigned long flags; - unsigned long tmp; - - local_irq_save(flags); - __asm__ __volatile__ ( - "# local_set_mask \n\t" - DCACHE_CLEAR("%0", "r5", "%1") - "ld %0, @%1; \n\t" - "or %0, %2; \n\t" - "st %0, @%1; \n\t" - : "=&r" (tmp) - : "r" (addr), "r" (mask) - : "memory" -#ifdef CONFIG_CHIP_M32700_TS1 - , "r5" -#endif /* CONFIG_CHIP_M32700_TS1 */ - ); - local_irq_restore(flags); -} - -/* Atomic operations are already serializing on m32r */ -#define smp_mb__before_local_dec() barrier() -#define smp_mb__after_local_dec() barrier() -#define smp_mb__before_local_inc() barrier() -#define smp_mb__after_local_inc() barrier() - -/* Use these for per-cpu local_t variables: on some archs they are - * much more efficient than these naive implementations. Note they take - * a variable, not an address. - */ - -#define __local_inc(l) ((l)->a.counter++) -#define __local_dec(l) ((l)->a.counter++) -#define __local_add(i, l) ((l)->a.counter += (i)) -#define __local_sub(i, l) ((l)->a.counter -= (i)) - -/* Use these for per-cpu local_t variables: on some archs they are - * much more efficient than these naive implementations. Note they take - * a variable, not an address. - */ - -#endif /* __M32R_LOCAL_H */ diff --git a/arch/m32r/include/asm/local64.h b/arch/m32r/include/asm/local64.h deleted file mode 100644 index 36c93b5cc239b..0000000000000 --- a/arch/m32r/include/asm/local64.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/arch/m32r/include/asm/m32102.h b/arch/m32r/include/asm/m32102.h deleted file mode 100644 index f0a986fece65b..0000000000000 --- a/arch/m32r/include/asm/m32102.h +++ /dev/null @@ -1,315 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _M32102_H_ -#define _M32102_H_ - -/* - * Renesas M32R 32102 group - * - * Copyright (c) 2001 Hitoshi Yamamoto - * Copyright (c) 2003, 2004 Renesas Technology Corp. - */ - -/*======================================================================* - * Special Function Register - *======================================================================*/ -#if !defined(CONFIG_CHIP_M32104) -#define M32R_SFR_OFFSET (0x00E00000) /* 0x00E00000-0x00EFFFFF 1[MB] */ -#else -#define M32R_SFR_OFFSET (0x00700000) /* 0x00700000-0x007FFFFF 1[MB] */ -#endif - -/* - * Clock and Power Management registers. - */ -#define M32R_CPM_OFFSET (0x000F4000+M32R_SFR_OFFSET) - -#define M32R_CPM_CPUCLKCR_PORTL (0x00+M32R_CPM_OFFSET) -#define M32R_CPM_CLKMOD_PORTL (0x04+M32R_CPM_OFFSET) -#define M32R_CPM_PLLCR_PORTL (0x08+M32R_CPM_OFFSET) - -/* - * DMA Controller registers. - */ -#define M32R_DMA_OFFSET (0x000F8000+M32R_SFR_OFFSET) - -#define M32R_DMAEN_PORTL (0x000+M32R_DMA_OFFSET) -#define M32R_DMAISTS_PORTL (0x004+M32R_DMA_OFFSET) -#define M32R_DMAEDET_PORTL (0x008+M32R_DMA_OFFSET) -#define M32R_DMAASTS_PORTL (0x00c+M32R_DMA_OFFSET) - -#define M32R_DMA0CR0_PORTL (0x100+M32R_DMA_OFFSET) -#define M32R_DMA0CR1_PORTL (0x104+M32R_DMA_OFFSET) -#define M32R_DMA0CSA_PORTL (0x108+M32R_DMA_OFFSET) -#define M32R_DMA0RSA_PORTL (0x10c+M32R_DMA_OFFSET) -#define M32R_DMA0CDA_PORTL (0x110+M32R_DMA_OFFSET) -#define M32R_DMA0RDA_PORTL (0x114+M32R_DMA_OFFSET) -#define M32R_DMA0CBCUT_PORTL (0x118+M32R_DMA_OFFSET) -#define M32R_DMA0RBCUT_PORTL (0x11c+M32R_DMA_OFFSET) - -#define M32R_DMA1CR0_PORTL (0x200+M32R_DMA_OFFSET) -#define M32R_DMA1CR1_PORTL (0x204+M32R_DMA_OFFSET) -#define M32R_DMA1CSA_PORTL (0x208+M32R_DMA_OFFSET) -#define M32R_DMA1RSA_PORTL (0x20c+M32R_DMA_OFFSET) -#define M32R_DMA1CDA_PORTL (0x210+M32R_DMA_OFFSET) -#define M32R_DMA1RDA_PORTL (0x214+M32R_DMA_OFFSET) -#define M32R_DMA1CBCUT_PORTL (0x218+M32R_DMA_OFFSET) -#define M32R_DMA1RBCUT_PORTL (0x21c+M32R_DMA_OFFSET) - -/* - * Multi Function Timer registers. - */ -#define M32R_MFT_OFFSET (0x000FC000+M32R_SFR_OFFSET) - -#define M32R_MFTCR_PORTL (0x000+M32R_MFT_OFFSET) /* MFT control */ -#define M32R_MFTRPR_PORTL (0x004+M32R_MFT_OFFSET) /* MFT real port */ - -#define M32R_MFT0_OFFSET (0x100+M32R_MFT_OFFSET) -#define M32R_MFT0MOD_PORTL (0x00+M32R_MFT0_OFFSET) /* MFT0 mode */ -#define M32R_MFT0BOS_PORTL (0x04+M32R_MFT0_OFFSET) /* MFT0 b-port output status */ -#define M32R_MFT0CUT_PORTL (0x08+M32R_MFT0_OFFSET) /* MFT0 count */ -#define M32R_MFT0RLD_PORTL (0x0C+M32R_MFT0_OFFSET) /* MFT0 reload */ -#define M32R_MFT0CMPRLD_PORTL (0x10+M32R_MFT0_OFFSET) /* MFT0 compare reload */ - -#define M32R_MFT1_OFFSET (0x200+M32R_MFT_OFFSET) -#define M32R_MFT1MOD_PORTL (0x00+M32R_MFT1_OFFSET) /* MFT1 mode */ -#define M32R_MFT1BOS_PORTL (0x04+M32R_MFT1_OFFSET) /* MFT1 b-port output status */ -#define M32R_MFT1CUT_PORTL (0x08+M32R_MFT1_OFFSET) /* MFT1 count */ -#define M32R_MFT1RLD_PORTL (0x0C+M32R_MFT1_OFFSET) /* MFT1 reload */ -#define M32R_MFT1CMPRLD_PORTL (0x10+M32R_MFT1_OFFSET) /* MFT1 compare reload */ - -#define M32R_MFT2_OFFSET (0x300+M32R_MFT_OFFSET) -#define M32R_MFT2MOD_PORTL (0x00+M32R_MFT2_OFFSET) /* MFT2 mode */ -#define M32R_MFT2BOS_PORTL (0x04+M32R_MFT2_OFFSET) /* MFT2 b-port output status */ -#define M32R_MFT2CUT_PORTL (0x08+M32R_MFT2_OFFSET) /* MFT2 count */ -#define M32R_MFT2RLD_PORTL (0x0C+M32R_MFT2_OFFSET) /* MFT2 reload */ -#define M32R_MFT2CMPRLD_PORTL (0x10+M32R_MFT2_OFFSET) /* MFT2 compare reload */ - -#define M32R_MFT3_OFFSET (0x400+M32R_MFT_OFFSET) -#define M32R_MFT3MOD_PORTL (0x00+M32R_MFT3_OFFSET) /* MFT3 mode */ -#define M32R_MFT3BOS_PORTL (0x04+M32R_MFT3_OFFSET) /* MFT3 b-port output status */ -#define M32R_MFT3CUT_PORTL (0x08+M32R_MFT3_OFFSET) /* MFT3 count */ -#define M32R_MFT3RLD_PORTL (0x0C+M32R_MFT3_OFFSET) /* MFT3 reload */ -#define M32R_MFT3CMPRLD_PORTL (0x10+M32R_MFT3_OFFSET) /* MFT3 compare reload */ - -#define M32R_MFT4_OFFSET (0x500+M32R_MFT_OFFSET) -#define M32R_MFT4MOD_PORTL (0x00+M32R_MFT4_OFFSET) /* MFT4 mode */ -#define M32R_MFT4BOS_PORTL (0x04+M32R_MFT4_OFFSET) /* MFT4 b-port output status */ -#define M32R_MFT4CUT_PORTL (0x08+M32R_MFT4_OFFSET) /* MFT4 count */ -#define M32R_MFT4RLD_PORTL (0x0C+M32R_MFT4_OFFSET) /* MFT4 reload */ -#define M32R_MFT4CMPRLD_PORTL (0x10+M32R_MFT4_OFFSET) /* MFT4 compare reload */ - -#define M32R_MFT5_OFFSET (0x600+M32R_MFT_OFFSET) -#define M32R_MFT5MOD_PORTL (0x00+M32R_MFT5_OFFSET) /* MFT4 mode */ -#define M32R_MFT5BOS_PORTL (0x04+M32R_MFT5_OFFSET) /* MFT4 b-port output status */ -#define M32R_MFT5CUT_PORTL (0x08+M32R_MFT5_OFFSET) /* MFT4 count */ -#define M32R_MFT5RLD_PORTL (0x0C+M32R_MFT5_OFFSET) /* MFT4 reload */ -#define M32R_MFT5CMPRLD_PORTL (0x10+M32R_MFT5_OFFSET) /* MFT4 compare reload */ - -#if (defined(CONFIG_CHIP_M32700) && !defined(CONFIG_PLAT_MAPPI2)) \ - || defined(CONFIG_CHIP_M32104) -#define M32R_MFTCR_MFT0MSK (1UL<<31) /* b0 */ -#define M32R_MFTCR_MFT1MSK (1UL<<30) /* b1 */ -#define M32R_MFTCR_MFT2MSK (1UL<<29) /* b2 */ -#define M32R_MFTCR_MFT3MSK (1UL<<28) /* b3 */ -#define M32R_MFTCR_MFT4MSK (1UL<<27) /* b4 */ -#define M32R_MFTCR_MFT5MSK (1UL<<26) /* b5 */ -#define M32R_MFTCR_MFT0EN (1UL<<23) /* b8 */ -#define M32R_MFTCR_MFT1EN (1UL<<22) /* b9 */ -#define M32R_MFTCR_MFT2EN (1UL<<21) /* b10 */ -#define M32R_MFTCR_MFT3EN (1UL<<20) /* b11 */ -#define M32R_MFTCR_MFT4EN (1UL<<19) /* b12 */ -#define M32R_MFTCR_MFT5EN (1UL<<18) /* b13 */ -#else -#define M32R_MFTCR_MFT0MSK (1UL<<15) /* b16 */ -#define M32R_MFTCR_MFT1MSK (1UL<<14) /* b17 */ -#define M32R_MFTCR_MFT2MSK (1UL<<13) /* b18 */ -#define M32R_MFTCR_MFT3MSK (1UL<<12) /* b19 */ -#define M32R_MFTCR_MFT4MSK (1UL<<11) /* b20 */ -#define M32R_MFTCR_MFT5MSK (1UL<<10) /* b21 */ -#define M32R_MFTCR_MFT0EN (1UL<<7) /* b24 */ -#define M32R_MFTCR_MFT1EN (1UL<<6) /* b25 */ -#define M32R_MFTCR_MFT2EN (1UL<<5) /* b26 */ -#define M32R_MFTCR_MFT3EN (1UL<<4) /* b27 */ -#define M32R_MFTCR_MFT4EN (1UL<<3) /* b28 */ -#define M32R_MFTCR_MFT5EN (1UL<<2) /* b29 */ -#endif - -#define M32R_MFTMOD_CC_MASK (1UL<<15) /* b16 */ -#define M32R_MFTMOD_TCCR (1UL<<13) /* b18 */ -#define M32R_MFTMOD_GTSEL000 (0UL<<8) /* b21-23 : 000 */ -#define M32R_MFTMOD_GTSEL001 (1UL<<8) /* b21-23 : 001 */ -#define M32R_MFTMOD_GTSEL010 (2UL<<8) /* b21-23 : 010 */ -#define M32R_MFTMOD_GTSEL011 (3UL<<8) /* b21-23 : 011 */ -#define M32R_MFTMOD_GTSEL110 (6UL<<8) /* b21-23 : 110 */ -#define M32R_MFTMOD_GTSEL111 (7UL<<8) /* b21-23 : 111 */ -#define M32R_MFTMOD_CMSEL (1UL<<3) /* b28 */ -#define M32R_MFTMOD_CSSEL000 (0UL<<0) /* b29-b31 : 000 */ -#define M32R_MFTMOD_CSSEL001 (1UL<<0) /* b29-b31 : 001 */ -#define M32R_MFTMOD_CSSEL010 (2UL<<0) /* b29-b31 : 010 */ -#define M32R_MFTMOD_CSSEL011 (3UL<<0) /* b29-b31 : 011 */ -#define M32R_MFTMOD_CSSEL100 (4UL<<0) /* b29-b31 : 100 */ -#define M32R_MFTMOD_CSSEL110 (6UL<<0) /* b29-b31 : 110 */ - -/* - * Serial I/O registers. - */ -#define M32R_SIO_OFFSET (0x000FD000+M32R_SFR_OFFSET) - -#define M32R_SIO0_CR_PORTL (0x000+M32R_SIO_OFFSET) -#define M32R_SIO0_MOD0_PORTL (0x004+M32R_SIO_OFFSET) -#define M32R_SIO0_MOD1_PORTL (0x008+M32R_SIO_OFFSET) -#define M32R_SIO0_STS_PORTL (0x00C+M32R_SIO_OFFSET) -#define M32R_SIO0_TRCR_PORTL (0x010+M32R_SIO_OFFSET) -#define M32R_SIO0_BAUR_PORTL (0x014+M32R_SIO_OFFSET) -#define M32R_SIO0_RBAUR_PORTL (0x018+M32R_SIO_OFFSET) -#define M32R_SIO0_TXB_PORTL (0x01C+M32R_SIO_OFFSET) -#define M32R_SIO0_RXB_PORTL (0x020+M32R_SIO_OFFSET) - -/* - * Interrupt Control Unit registers. - */ -#define M32R_ICU_OFFSET (0x000FF000+M32R_SFR_OFFSET) -#define M32R_ICU_ISTS_PORTL (0x004+M32R_ICU_OFFSET) -#define M32R_ICU_IREQ0_PORTL (0x008+M32R_ICU_OFFSET) -#define M32R_ICU_IREQ1_PORTL (0x00C+M32R_ICU_OFFSET) -#define M32R_ICU_SBICR_PORTL (0x018+M32R_ICU_OFFSET) -#define M32R_ICU_IMASK_PORTL (0x01C+M32R_ICU_OFFSET) -#define M32R_ICU_CR1_PORTL (0x200+M32R_ICU_OFFSET) /* INT0 */ -#define M32R_ICU_CR2_PORTL (0x204+M32R_ICU_OFFSET) /* INT1 */ -#define M32R_ICU_CR3_PORTL (0x208+M32R_ICU_OFFSET) /* INT2 */ -#define M32R_ICU_CR4_PORTL (0x20C+M32R_ICU_OFFSET) /* INT3 */ -#define M32R_ICU_CR5_PORTL (0x210+M32R_ICU_OFFSET) /* INT4 */ -#define M32R_ICU_CR6_PORTL (0x214+M32R_ICU_OFFSET) /* INT5 */ -#define M32R_ICU_CR7_PORTL (0x218+M32R_ICU_OFFSET) /* INT6 */ -#define M32R_ICU_CR8_PORTL (0x219+M32R_ICU_OFFSET) /* INT7 */ -#define M32R_ICU_CR16_PORTL (0x23C+M32R_ICU_OFFSET) /* MFT0 */ -#define M32R_ICU_CR17_PORTL (0x240+M32R_ICU_OFFSET) /* MFT1 */ -#define M32R_ICU_CR18_PORTL (0x244+M32R_ICU_OFFSET) /* MFT2 */ -#define M32R_ICU_CR19_PORTL (0x248+M32R_ICU_OFFSET) /* MFT3 */ -#define M32R_ICU_CR20_PORTL (0x24C+M32R_ICU_OFFSET) /* MFT4 */ -#define M32R_ICU_CR21_PORTL (0x250+M32R_ICU_OFFSET) /* MFT5 */ -#define M32R_ICU_CR32_PORTL (0x27C+M32R_ICU_OFFSET) /* DMA0 */ -#define M32R_ICU_CR33_PORTL (0x280+M32R_ICU_OFFSET) /* DMA1 */ -#define M32R_ICU_CR48_PORTL (0x2BC+M32R_ICU_OFFSET) /* SIO0 */ -#define M32R_ICU_CR49_PORTL (0x2C0+M32R_ICU_OFFSET) /* SIO0 */ -#define M32R_ICU_CR50_PORTL (0x2C4+M32R_ICU_OFFSET) /* SIO1 */ -#define M32R_ICU_CR51_PORTL (0x2C8+M32R_ICU_OFFSET) /* SIO1 */ -#define M32R_ICU_CR52_PORTL (0x2CC+M32R_ICU_OFFSET) /* SIO2 */ -#define M32R_ICU_CR53_PORTL (0x2D0+M32R_ICU_OFFSET) /* SIO2 */ -#define M32R_ICU_CR54_PORTL (0x2D4+M32R_ICU_OFFSET) /* SIO3 */ -#define M32R_ICU_CR55_PORTL (0x2D8+M32R_ICU_OFFSET) /* SIO3 */ -#define M32R_ICU_CR56_PORTL (0x2DC+M32R_ICU_OFFSET) /* SIO4 */ -#define M32R_ICU_CR57_PORTL (0x2E0+M32R_ICU_OFFSET) /* SIO4 */ - -#ifdef CONFIG_SMP -#define M32R_ICU_IPICR0_PORTL (0x2dc+M32R_ICU_OFFSET) /* IPI0 */ -#define M32R_ICU_IPICR1_PORTL (0x2e0+M32R_ICU_OFFSET) /* IPI1 */ -#define M32R_ICU_IPICR2_PORTL (0x2e4+M32R_ICU_OFFSET) /* IPI2 */ -#define M32R_ICU_IPICR3_PORTL (0x2e8+M32R_ICU_OFFSET) /* IPI3 */ -#define M32R_ICU_IPICR4_PORTL (0x2ec+M32R_ICU_OFFSET) /* IPI4 */ -#define M32R_ICU_IPICR5_PORTL (0x2f0+M32R_ICU_OFFSET) /* IPI5 */ -#define M32R_ICU_IPICR6_PORTL (0x2f4+M32R_ICU_OFFSET) /* IPI6 */ -#define M32R_ICU_IPICR7_PORTL (0x2f8+M32R_ICU_OFFSET) /* IPI7 */ -#endif /* CONFIG_SMP */ - -#define M32R_ICUIMASK_IMSK0 (0UL<<16) /* b13-b15: Disable interrupt */ -#define M32R_ICUIMASK_IMSK1 (1UL<<16) /* b13-b15: Enable level 0 interrupt */ -#define M32R_ICUIMASK_IMSK2 (2UL<<16) /* b13-b15: Enable level 0,1 interrupt */ -#define M32R_ICUIMASK_IMSK3 (3UL<<16) /* b13-b15: Enable level 0-2 interrupt */ -#define M32R_ICUIMASK_IMSK4 (4UL<<16) /* b13-b15: Enable level 0-3 interrupt */ -#define M32R_ICUIMASK_IMSK5 (5UL<<16) /* b13-b15: Enable level 0-4 interrupt */ -#define M32R_ICUIMASK_IMSK6 (6UL<<16) /* b13-b15: Enable level 0-5 interrupt */ -#define M32R_ICUIMASK_IMSK7 (7UL<<16) /* b13-b15: Enable level 0-6 interrupt */ - -#define M32R_ICUCR_IEN (1UL<<12) /* b19: Interrupt enable */ -#define M32R_ICUCR_IRQ (1UL<<8) /* b23: Interrupt request */ -#define M32R_ICUCR_ISMOD00 (0UL<<4) /* b26-b27: Interrupt sense mode Edge HtoL */ -#define M32R_ICUCR_ISMOD01 (1UL<<4) /* b26-b27: Interrupt sense mode Level L */ -#define M32R_ICUCR_ISMOD10 (2UL<<4) /* b26-b27: Interrupt sense mode Edge LtoH*/ -#define M32R_ICUCR_ISMOD11 (3UL<<4) /* b26-b27: Interrupt sense mode Level H */ -#define M32R_ICUCR_ILEVEL0 (0UL<<0) /* b29-b31: Interrupt priority level 0 */ -#define M32R_ICUCR_ILEVEL1 (1UL<<0) /* b29-b31: Interrupt priority level 1 */ -#define M32R_ICUCR_ILEVEL2 (2UL<<0) /* b29-b31: Interrupt priority level 2 */ -#define M32R_ICUCR_ILEVEL3 (3UL<<0) /* b29-b31: Interrupt priority level 3 */ -#define M32R_ICUCR_ILEVEL4 (4UL<<0) /* b29-b31: Interrupt priority level 4 */ -#define M32R_ICUCR_ILEVEL5 (5UL<<0) /* b29-b31: Interrupt priority level 5 */ -#define M32R_ICUCR_ILEVEL6 (6UL<<0) /* b29-b31: Interrupt priority level 6 */ -#define M32R_ICUCR_ILEVEL7 (7UL<<0) /* b29-b31: Disable interrupt */ - -#define M32R_IRQ_INT0 (1) /* INT0 */ -#define M32R_IRQ_INT1 (2) /* INT1 */ -#define M32R_IRQ_INT2 (3) /* INT2 */ -#define M32R_IRQ_INT3 (4) /* INT3 */ -#define M32R_IRQ_INT4 (5) /* INT4 */ -#define M32R_IRQ_INT5 (6) /* INT5 */ -#define M32R_IRQ_INT6 (7) /* INT6 */ -#define M32R_IRQ_MFT0 (16) /* MFT0 */ -#define M32R_IRQ_MFT1 (17) /* MFT1 */ -#define M32R_IRQ_MFT2 (18) /* MFT2 */ -#define M32R_IRQ_MFT3 (19) /* MFT3 */ -#ifdef CONFIG_CHIP_M32104 -#define M32R_IRQ_MFTX0 (24) /* MFTX0 */ -#define M32R_IRQ_MFTX1 (25) /* MFTX1 */ -#define M32R_IRQ_DMA0 (32) /* DMA0 */ -#define M32R_IRQ_DMA1 (33) /* DMA1 */ -#define M32R_IRQ_DMA2 (34) /* DMA2 */ -#define M32R_IRQ_DMA3 (35) /* DMA3 */ -#define M32R_IRQ_SIO0_R (40) /* SIO0 send */ -#define M32R_IRQ_SIO0_S (41) /* SIO0 receive */ -#define M32R_IRQ_SIO1_R (42) /* SIO1 send */ -#define M32R_IRQ_SIO1_S (43) /* SIO1 receive */ -#define M32R_IRQ_SIO2_R (44) /* SIO2 send */ -#define M32R_IRQ_SIO2_S (45) /* SIO2 receive */ -#define M32R_IRQ_SIO3_R (46) /* SIO3 send */ -#define M32R_IRQ_SIO3_S (47) /* SIO3 receive */ -#define M32R_IRQ_ADC (56) /* ADC */ -#define M32R_IRQ_PC (57) /* PC */ -#else /* ! M32104 */ -#define M32R_IRQ_DMA0 (32) /* DMA0 */ -#define M32R_IRQ_DMA1 (33) /* DMA1 */ -#define M32R_IRQ_SIO0_R (48) /* SIO0 send */ -#define M32R_IRQ_SIO0_S (49) /* SIO0 receive */ -#define M32R_IRQ_SIO1_R (50) /* SIO1 send */ -#define M32R_IRQ_SIO1_S (51) /* SIO1 receive */ -#define M32R_IRQ_SIO2_R (52) /* SIO2 send */ -#define M32R_IRQ_SIO2_S (53) /* SIO2 receive */ -#define M32R_IRQ_SIO3_R (54) /* SIO3 send */ -#define M32R_IRQ_SIO3_S (55) /* SIO3 receive */ -#define M32R_IRQ_SIO4_R (56) /* SIO4 send */ -#define M32R_IRQ_SIO4_S (57) /* SIO4 receive */ -#endif /* ! M32104 */ - -#ifdef CONFIG_SMP -#define M32R_IRQ_IPI0 (56) -#define M32R_IRQ_IPI1 (57) -#define M32R_IRQ_IPI2 (58) -#define M32R_IRQ_IPI3 (59) -#define M32R_IRQ_IPI4 (60) -#define M32R_IRQ_IPI5 (61) -#define M32R_IRQ_IPI6 (62) -#define M32R_IRQ_IPI7 (63) -#define M32R_CPUID_PORTL (0xffffffe0) - -#define M32R_FPGA_TOP (0x000F0000+M32R_SFR_OFFSET) - -#define M32R_FPGA_NUM_OF_CPUS_PORTL (0x00+M32R_FPGA_TOP) -#define M32R_FPGA_CPU_NAME0_PORTL (0x10+M32R_FPGA_TOP) -#define M32R_FPGA_CPU_NAME1_PORTL (0x14+M32R_FPGA_TOP) -#define M32R_FPGA_CPU_NAME2_PORTL (0x18+M32R_FPGA_TOP) -#define M32R_FPGA_CPU_NAME3_PORTL (0x1c+M32R_FPGA_TOP) -#define M32R_FPGA_MODEL_ID0_PORTL (0x20+M32R_FPGA_TOP) -#define M32R_FPGA_MODEL_ID1_PORTL (0x24+M32R_FPGA_TOP) -#define M32R_FPGA_MODEL_ID2_PORTL (0x28+M32R_FPGA_TOP) -#define M32R_FPGA_MODEL_ID3_PORTL (0x2c+M32R_FPGA_TOP) -#define M32R_FPGA_VERSION0_PORTL (0x30+M32R_FPGA_TOP) -#define M32R_FPGA_VERSION1_PORTL (0x34+M32R_FPGA_TOP) - -#endif /* CONFIG_SMP */ - -#ifndef __ASSEMBLY__ -typedef struct { - unsigned long icucr; /* ICU Control Register */ -} icu_data_t; -#endif - -#endif /* _M32102_H_ */ diff --git a/arch/m32r/include/asm/m32104ut/m32104ut_pld.h b/arch/m32r/include/asm/m32104ut/m32104ut_pld.h deleted file mode 100644 index 1feae9709f24f..0000000000000 --- a/arch/m32r/include/asm/m32104ut/m32104ut_pld.h +++ /dev/null @@ -1,161 +0,0 @@ -#ifndef _M32104UT_M32104UT_PLD_H -#define _M32104UT_M32104UT_PLD_H - -/* - * include/asm-m32r/m32104ut/m32104ut_pld.h - * - * Definitions for Programmable Logic Device(PLD) on M32104UT board. - * Based on m32700ut_pld.h - * - * Copyright (c) 2002 Takeo Takahashi - * Copyright (c) 2005 Naoto Sugai - * - * This file is subject to the terms and conditions of the GNU General - * Public License. See the file "COPYING" in the main directory of - * this archive for more details. - */ - -#if defined(CONFIG_PLAT_M32104UT) -#define PLD_PLAT_BASE 0x02c00000 -#else -#error "no platform configuration" -#endif - -#ifndef __ASSEMBLY__ -/* - * C functions use non-cache address. - */ -#define PLD_BASE (PLD_PLAT_BASE /* + NONCACHE_OFFSET */) -#define __reg8 (volatile unsigned char *) -#define __reg16 (volatile unsigned short *) -#define __reg32 (volatile unsigned int *) -#else -#define PLD_BASE (PLD_PLAT_BASE + NONCACHE_OFFSET) -#define __reg8 -#define __reg16 -#define __reg32 -#endif /* __ASSEMBLY__ */ - -/* CFC */ -#define PLD_CFRSTCR __reg16(PLD_BASE + 0x0000) -#define PLD_CFSTS __reg16(PLD_BASE + 0x0002) -#define PLD_CFIMASK __reg16(PLD_BASE + 0x0004) -#define PLD_CFBUFCR __reg16(PLD_BASE + 0x0006) - -/* MMC */ -#define PLD_MMCCR __reg16(PLD_BASE + 0x4000) -#define PLD_MMCMOD __reg16(PLD_BASE + 0x4002) -#define PLD_MMCSTS __reg16(PLD_BASE + 0x4006) -#define PLD_MMCBAUR __reg16(PLD_BASE + 0x400a) -#define PLD_MMCCMDBCUT __reg16(PLD_BASE + 0x400c) -#define PLD_MMCCDTBCUT __reg16(PLD_BASE + 0x400e) -#define PLD_MMCDET __reg16(PLD_BASE + 0x4010) -#define PLD_MMCWP __reg16(PLD_BASE + 0x4012) -#define PLD_MMCWDATA __reg16(PLD_BASE + 0x5000) -#define PLD_MMCRDATA __reg16(PLD_BASE + 0x6000) -#define PLD_MMCCMDDATA __reg16(PLD_BASE + 0x7000) -#define PLD_MMCRSPDATA __reg16(PLD_BASE + 0x7006) - -/* ICU - * ICUISTS: status register - * ICUIREQ0: request register - * ICUIREQ1: request register - * ICUCR3: control register for CFIREQ# interrupt - * ICUCR4: control register for CFC Card insert interrupt - * ICUCR5: control register for CFC Card eject interrupt - * ICUCR6: control register for external interrupt - * ICUCR11: control register for MMC Card insert/eject interrupt - * ICUCR13: control register for SC error interrupt - * ICUCR14: control register for SC receive interrupt - * ICUCR15: control register for SC send interrupt - */ - -#define PLD_IRQ_INT0 (M32104UT_PLD_IRQ_BASE + 0) /* None */ -#define PLD_IRQ_CFIREQ (M32104UT_PLD_IRQ_BASE + 3) /* CF IREQ */ -#define PLD_IRQ_CFC_INSERT (M32104UT_PLD_IRQ_BASE + 4) /* CF Insert */ -#define PLD_IRQ_CFC_EJECT (M32104UT_PLD_IRQ_BASE + 5) /* CF Eject */ -#define PLD_IRQ_EXINT (M32104UT_PLD_IRQ_BASE + 6) /* EXINT */ -#define PLD_IRQ_MMCCARD (M32104UT_PLD_IRQ_BASE + 11) /* MMC Insert/Eject */ -#define PLD_IRQ_SC_ERROR (M32104UT_PLD_IRQ_BASE + 13) /* SC error */ -#define PLD_IRQ_SC_RCV (M32104UT_PLD_IRQ_BASE + 14) /* SC receive */ -#define PLD_IRQ_SC_SND (M32104UT_PLD_IRQ_BASE + 15) /* SC send */ - -#define PLD_ICUISTS __reg16(PLD_BASE + 0x8002) -#define PLD_ICUISTS_VECB_MASK (0xf000) -#define PLD_ICUISTS_VECB(x) ((x) & PLD_ICUISTS_VECB_MASK) -#define PLD_ICUISTS_ISN_MASK (0x07c0) -#define PLD_ICUISTS_ISN(x) ((x) & PLD_ICUISTS_ISN_MASK) -#define PLD_ICUCR3 __reg16(PLD_BASE + 0x8104) -#define PLD_ICUCR4 __reg16(PLD_BASE + 0x8106) -#define PLD_ICUCR5 __reg16(PLD_BASE + 0x8108) -#define PLD_ICUCR6 __reg16(PLD_BASE + 0x810a) -#define PLD_ICUCR11 __reg16(PLD_BASE + 0x8114) -#define PLD_ICUCR13 __reg16(PLD_BASE + 0x8118) -#define PLD_ICUCR14 __reg16(PLD_BASE + 0x811a) -#define PLD_ICUCR15 __reg16(PLD_BASE + 0x811c) -#define PLD_ICUCR_IEN (0x1000) -#define PLD_ICUCR_IREQ (0x0100) -#define PLD_ICUCR_ISMOD00 (0x0000) /* Low edge */ -#define PLD_ICUCR_ISMOD01 (0x0010) /* Low level */ -#define PLD_ICUCR_ISMOD02 (0x0020) /* High edge */ -#define PLD_ICUCR_ISMOD03 (0x0030) /* High level */ -#define PLD_ICUCR_ILEVEL0 (0x0000) -#define PLD_ICUCR_ILEVEL1 (0x0001) -#define PLD_ICUCR_ILEVEL2 (0x0002) -#define PLD_ICUCR_ILEVEL3 (0x0003) -#define PLD_ICUCR_ILEVEL4 (0x0004) -#define PLD_ICUCR_ILEVEL5 (0x0005) -#define PLD_ICUCR_ILEVEL6 (0x0006) -#define PLD_ICUCR_ILEVEL7 (0x0007) - -/* Power Control of MMC and CF */ -#define PLD_CPCR __reg16(PLD_BASE + 0x14000) -#define PLD_CPCR_CDP 0x0001 - -/* LED Control - * - * 1: DIP swich side - * 2: Reset switch side - */ -#define PLD_IOLEDCR __reg16(PLD_BASE + 0x14002) -#define PLD_IOLED_1_ON 0x001 -#define PLD_IOLED_1_OFF 0x000 -#define PLD_IOLED_2_ON 0x002 -#define PLD_IOLED_2_OFF 0x000 - -/* DIP Switch - * 0: Write-protect of Flash Memory (0:protected, 1:non-protected) - * 1: - - * 2: - - * 3: - - */ -#define PLD_IOSWSTS __reg16(PLD_BASE + 0x14004) -#define PLD_IOSWSTS_IOSW2 0x0200 -#define PLD_IOSWSTS_IOSW1 0x0100 -#define PLD_IOSWSTS_IOWP0 0x0001 - -/* CRC */ -#define PLD_CRC7DATA __reg16(PLD_BASE + 0x18000) -#define PLD_CRC7INDATA __reg16(PLD_BASE + 0x18002) -#define PLD_CRC16DATA __reg16(PLD_BASE + 0x18004) -#define PLD_CRC16INDATA __reg16(PLD_BASE + 0x18006) -#define PLD_CRC16ADATA __reg16(PLD_BASE + 0x18008) -#define PLD_CRC16AINDATA __reg16(PLD_BASE + 0x1800a) - -/* RTC */ -#define PLD_RTCCR __reg16(PLD_BASE + 0x1c000) -#define PLD_RTCBAUR __reg16(PLD_BASE + 0x1c002) -#define PLD_RTCWRDATA __reg16(PLD_BASE + 0x1c004) -#define PLD_RTCRDDATA __reg16(PLD_BASE + 0x1c006) -#define PLD_RTCRSTODT __reg16(PLD_BASE + 0x1c008) - -/* SIM Card */ -#define PLD_SCCR __reg16(PLD_BASE + 0x38000) -#define PLD_SCMOD __reg16(PLD_BASE + 0x38004) -#define PLD_SCSTS __reg16(PLD_BASE + 0x38006) -#define PLD_SCINTCR __reg16(PLD_BASE + 0x38008) -#define PLD_SCBAUR __reg16(PLD_BASE + 0x3800a) -#define PLD_SCTXB __reg16(PLD_BASE + 0x3800c) -#define PLD_SCRXB __reg16(PLD_BASE + 0x3800e) - -#endif /* _M32104UT_M32104UT_PLD_H */ diff --git a/arch/m32r/include/asm/m32700ut/m32700ut_lan.h b/arch/m32r/include/asm/m32700ut/m32700ut_lan.h deleted file mode 100644 index aae810a4fb2c8..0000000000000 --- a/arch/m32r/include/asm/m32700ut/m32700ut_lan.h +++ /dev/null @@ -1,103 +0,0 @@ -#ifndef _M32700UT_M32700UT_LAN_H -#define _M32700UT_M32700UT_LAN_H - -/* - * include/asm-m32r/m32700ut/m32700ut_lan.h - * - * M32700UT-LAN board - * - * Copyright (c) 2002 Takeo Takahashi - * - * This file is subject to 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 __ASSEMBLY__ -/* - * C functions use non-cache address. - */ -#define M32700UT_LAN_BASE (0x10000000 /* + NONCACHE_OFFSET */) -#else -#define M32700UT_LAN_BASE (0x10000000 + NONCACHE_OFFSET) -#endif /* __ASSEMBLY__ */ - -/* ICU - * ICUISTS: status register - * ICUIREQ0: request register - * ICUIREQ1: request register - * ICUCR3: control register for CFIREQ# interrupt - * ICUCR4: control register for CFC Card insert interrupt - * ICUCR5: control register for CFC Card eject interrupt - * ICUCR6: control register for external interrupt - * ICUCR11: control register for MMC Card insert/eject interrupt - * ICUCR13: control register for SC error interrupt - * ICUCR14: control register for SC receive interrupt - * ICUCR15: control register for SC send interrupt - * ICUCR16: control register for SIO0 receive interrupt - * ICUCR17: control register for SIO0 send interrupt - */ -#define M32700UT_LAN_IRQ_LAN (M32700UT_LAN_PLD_IRQ_BASE + 1) /* LAN */ -#define M32700UT_LAN_IRQ_I2C (M32700UT_LAN_PLD_IRQ_BASE + 3) /* I2C */ - -#define M32700UT_LAN_ICUISTS __reg16(M32700UT_LAN_BASE + 0xc0002) -#define M32700UT_LAN_ICUISTS_VECB_MASK (0xf000) -#define M32700UT_LAN_VECB(x) ((x) & M32700UT_LAN_ICUISTS_VECB_MASK) -#define M32700UT_LAN_ICUISTS_ISN_MASK (0x07c0) -#define M32700UT_LAN_ICUISTS_ISN(x) ((x) & M32700UT_LAN_ICUISTS_ISN_MASK) -#define M32700UT_LAN_ICUIREQ0 __reg16(M32700UT_LAN_BASE + 0xc0004) -#define M32700UT_LAN_ICUCR1 __reg16(M32700UT_LAN_BASE + 0xc0010) -#define M32700UT_LAN_ICUCR3 __reg16(M32700UT_LAN_BASE + 0xc0014) - -/* - * AR register on PLD - */ -#define ARVCR0 __reg32(M32700UT_LAN_BASE + 0x40000) -#define ARVCR0_VDS 0x00080000 -#define ARVCR0_RST 0x00010000 -#define ARVCR1 __reg32(M32700UT_LAN_BASE + 0x40004) -#define ARVCR1_QVGA 0x02000000 -#define ARVCR1_NORMAL 0x01000000 -#define ARVCR1_HIEN 0x00010000 -#define ARVHCOUNT __reg32(M32700UT_LAN_BASE + 0x40008) -#define ARDATA __reg32(M32700UT_LAN_BASE + 0x40010) -#define ARINTSEL __reg32(M32700UT_LAN_BASE + 0x40014) -#define ARINTSEL_INT3 0x10000000 /* CPU INT3 */ -#define ARDATA32 __reg32(M32700UT_LAN_BASE + 0x04040010) // Block 5 -/* -#define ARINTSEL_SEL2 0x00002000 -#define ARINTSEL_SEL3 0x00001000 -#define ARINTSEL_SEL6 0x00000200 -#define ARINTSEL_SEL7 0x00000100 -#define ARINTSEL_SEL9 0x00000040 -#define ARINTSEL_SEL10 0x00000020 -#define ARINTSEL_SEL11 0x00000010 -#define ARINTSEL_SEL12 0x00000008 -*/ - -/* - * I2C register on PLD - */ -#define PLDI2CCR __reg32(M32700UT_LAN_BASE + 0x40040) -#define PLDI2CCR_ES0 0x00000001 /* enable I2C interface */ -#define PLDI2CMOD __reg32(M32700UT_LAN_BASE + 0x40044) -#define PLDI2CMOD_ACKCLK 0x00000200 -#define PLDI2CMOD_DTWD 0x00000100 -#define PLDI2CMOD_10BT 0x00000004 -#define PLDI2CMOD_ATM_NORMAL 0x00000000 -#define PLDI2CMOD_ATM_AUTO 0x00000003 -#define PLDI2CACK __reg32(M32700UT_LAN_BASE + 0x40048) -#define PLDI2CACK_ACK 0x00000001 -#define PLDI2CFREQ __reg32(M32700UT_LAN_BASE + 0x4004c) -#define PLDI2CCND __reg32(M32700UT_LAN_BASE + 0x40050) -#define PLDI2CCND_START 0x00000001 -#define PLDI2CCND_STOP 0x00000002 -#define PLDI2CSTEN __reg32(M32700UT_LAN_BASE + 0x40054) -#define PLDI2CSTEN_STEN 0x00000001 -#define PLDI2CDATA __reg32(M32700UT_LAN_BASE + 0x40060) -#define PLDI2CSTS __reg32(M32700UT_LAN_BASE + 0x40064) -#define PLDI2CSTS_TRX 0x00000020 -#define PLDI2CSTS_BB 0x00000010 -#define PLDI2CSTS_NOACK 0x00000001 /* 0:ack, 1:noack */ - -#endif /* _M32700UT_M32700UT_LAN_H */ diff --git a/arch/m32r/include/asm/m32700ut/m32700ut_lcd.h b/arch/m32r/include/asm/m32700ut/m32700ut_lcd.h deleted file mode 100644 index 4c2489079788e..0000000000000 --- a/arch/m32r/include/asm/m32700ut/m32700ut_lcd.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef _M32700UT_M32700UT_LCD_H -#define _M32700UT_M32700UT_LCD_H - -/* - * include/asm-m32r/m32700ut/m32700ut_lcd.h - * - * M32700UT-LCD board - * - * Copyright (c) 2002 Takeo Takahashi - * - * This file is subject to 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 __ASSEMBLY__ -/* - * C functions use non-cache address. - */ -#define M32700UT_LCD_BASE (0x10000000 /* + NONCACHE_OFFSET */) -#else -#define M32700UT_LCD_BASE (0x10000000 + NONCACHE_OFFSET) -#endif /* __ASSEMBLY__ */ - -/* - * ICU - */ -#define M32700UT_LCD_IRQ_BAT_INT (M32700UT_LCD_PLD_IRQ_BASE + 1) -#define M32700UT_LCD_IRQ_USB_INT1 (M32700UT_LCD_PLD_IRQ_BASE + 2) -#define M32700UT_LCD_IRQ_AUDT0 (M32700UT_LCD_PLD_IRQ_BASE + 3) -#define M32700UT_LCD_IRQ_AUDT2 (M32700UT_LCD_PLD_IRQ_BASE + 4) -#define M32700UT_LCD_IRQ_BATSIO_RCV (M32700UT_LCD_PLD_IRQ_BASE + 16) -#define M32700UT_LCD_IRQ_BATSIO_SND (M32700UT_LCD_PLD_IRQ_BASE + 17) -#define M32700UT_LCD_IRQ_ASNDSIO_RCV (M32700UT_LCD_PLD_IRQ_BASE + 18) -#define M32700UT_LCD_IRQ_ASNDSIO_SND (M32700UT_LCD_PLD_IRQ_BASE + 19) -#define M32700UT_LCD_IRQ_ACNLSIO_SND (M32700UT_LCD_PLD_IRQ_BASE + 21) - -#define M32700UT_LCD_ICUISTS __reg16(M32700UT_LCD_BASE + 0x300002) -#define M32700UT_LCD_ICUISTS_VECB_MASK (0xf000) -#define M32700UT_LCD_VECB(x) ((x) & M32700UT_LCD_ICUISTS_VECB_MASK) -#define M32700UT_LCD_ICUISTS_ISN_MASK (0x07c0) -#define M32700UT_LCD_ICUISTS_ISN(x) ((x) & M32700UT_LCD_ICUISTS_ISN_MASK) -#define M32700UT_LCD_ICUIREQ0 __reg16(M32700UT_LCD_BASE + 0x300004) -#define M32700UT_LCD_ICUIREQ1 __reg16(M32700UT_LCD_BASE + 0x300006) -#define M32700UT_LCD_ICUCR1 __reg16(M32700UT_LCD_BASE + 0x300020) -#define M32700UT_LCD_ICUCR2 __reg16(M32700UT_LCD_BASE + 0x300022) -#define M32700UT_LCD_ICUCR3 __reg16(M32700UT_LCD_BASE + 0x300024) -#define M32700UT_LCD_ICUCR4 __reg16(M32700UT_LCD_BASE + 0x300026) -#define M32700UT_LCD_ICUCR16 __reg16(M32700UT_LCD_BASE + 0x300030) -#define M32700UT_LCD_ICUCR17 __reg16(M32700UT_LCD_BASE + 0x300032) -#define M32700UT_LCD_ICUCR18 __reg16(M32700UT_LCD_BASE + 0x300034) -#define M32700UT_LCD_ICUCR19 __reg16(M32700UT_LCD_BASE + 0x300036) -#define M32700UT_LCD_ICUCR21 __reg16(M32700UT_LCD_BASE + 0x30003a) - -#endif /* _M32700UT_M32700UT_LCD_H */ diff --git a/arch/m32r/include/asm/m32700ut/m32700ut_pld.h b/arch/m32r/include/asm/m32700ut/m32700ut_pld.h deleted file mode 100644 index 35294670b1874..0000000000000 --- a/arch/m32r/include/asm/m32700ut/m32700ut_pld.h +++ /dev/null @@ -1,259 +0,0 @@ -#ifndef _M32700UT_M32700UT_PLD_H -#define _M32700UT_M32700UT_PLD_H - -/* - * include/asm-m32r/m32700ut/m32700ut_pld.h - * - * Definitions for Programmable Logic Device(PLD) on M32700UT board. - * - * Copyright (c) 2002 Takeo Takahashi - * - * This file is subject to the terms and conditions of the GNU General - * Public License. See the file "COPYING" in the main directory of - * this archive for more details. - */ - -#if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_USRV) -#define PLD_PLAT_BASE 0x04c00000 -#else -#error "no platform configuration" -#endif - -#ifndef __ASSEMBLY__ -/* - * C functions use non-cache address. - */ -#define PLD_BASE (PLD_PLAT_BASE /* + NONCACHE_OFFSET */) -#define __reg8 (volatile unsigned char *) -#define __reg16 (volatile unsigned short *) -#define __reg32 (volatile unsigned int *) -#else -#define PLD_BASE (PLD_PLAT_BASE + NONCACHE_OFFSET) -#define __reg8 -#define __reg16 -#define __reg32 -#endif /* __ASSEMBLY__ */ - -/* CFC */ -#define PLD_CFRSTCR __reg16(PLD_BASE + 0x0000) -#define PLD_CFSTS __reg16(PLD_BASE + 0x0002) -#define PLD_CFIMASK __reg16(PLD_BASE + 0x0004) -#define PLD_CFBUFCR __reg16(PLD_BASE + 0x0006) -#define PLD_CFVENCR __reg16(PLD_BASE + 0x0008) -#define PLD_CFCR0 __reg16(PLD_BASE + 0x000a) -#define PLD_CFCR1 __reg16(PLD_BASE + 0x000c) -#define PLD_IDERSTCR __reg16(PLD_BASE + 0x0010) - -/* MMC */ -#define PLD_MMCCR __reg16(PLD_BASE + 0x4000) -#define PLD_MMCMOD __reg16(PLD_BASE + 0x4002) -#define PLD_MMCSTS __reg16(PLD_BASE + 0x4006) -#define PLD_MMCBAUR __reg16(PLD_BASE + 0x400a) -#define PLD_MMCCMDBCUT __reg16(PLD_BASE + 0x400c) -#define PLD_MMCCDTBCUT __reg16(PLD_BASE + 0x400e) -#define PLD_MMCDET __reg16(PLD_BASE + 0x4010) -#define PLD_MMCWP __reg16(PLD_BASE + 0x4012) -#define PLD_MMCWDATA __reg16(PLD_BASE + 0x5000) -#define PLD_MMCRDATA __reg16(PLD_BASE + 0x6000) -#define PLD_MMCCMDDATA __reg16(PLD_BASE + 0x7000) -#define PLD_MMCRSPDATA __reg16(PLD_BASE + 0x7006) - -/* ICU - * ICUISTS: status register - * ICUIREQ0: request register - * ICUIREQ1: request register - * ICUCR3: control register for CFIREQ# interrupt - * ICUCR4: control register for CFC Card insert interrupt - * ICUCR5: control register for CFC Card eject interrupt - * ICUCR6: control register for external interrupt - * ICUCR11: control register for MMC Card insert/eject interrupt - * ICUCR13: control register for SC error interrupt - * ICUCR14: control register for SC receive interrupt - * ICUCR15: control register for SC send interrupt - * ICUCR16: control register for SIO0 receive interrupt - * ICUCR17: control register for SIO0 send interrupt - */ -#if !defined(CONFIG_PLAT_USRV) -#define PLD_IRQ_INT0 (M32700UT_PLD_IRQ_BASE + 0) /* None */ -#define PLD_IRQ_INT1 (M32700UT_PLD_IRQ_BASE + 1) /* reserved */ -#define PLD_IRQ_INT2 (M32700UT_PLD_IRQ_BASE + 2) /* reserved */ -#define PLD_IRQ_CFIREQ (M32700UT_PLD_IRQ_BASE + 3) /* CF IREQ */ -#define PLD_IRQ_CFC_INSERT (M32700UT_PLD_IRQ_BASE + 4) /* CF Insert */ -#define PLD_IRQ_CFC_EJECT (M32700UT_PLD_IRQ_BASE + 5) /* CF Eject */ -#define PLD_IRQ_EXINT (M32700UT_PLD_IRQ_BASE + 6) /* EXINT */ -#define PLD_IRQ_INT7 (M32700UT_PLD_IRQ_BASE + 7) /* reserved */ -#define PLD_IRQ_INT8 (M32700UT_PLD_IRQ_BASE + 8) /* reserved */ -#define PLD_IRQ_INT9 (M32700UT_PLD_IRQ_BASE + 9) /* reserved */ -#define PLD_IRQ_INT10 (M32700UT_PLD_IRQ_BASE + 10) /* reserved */ -#define PLD_IRQ_MMCCARD (M32700UT_PLD_IRQ_BASE + 11) /* MMC Insert/Eject */ -#define PLD_IRQ_INT12 (M32700UT_PLD_IRQ_BASE + 12) /* reserved */ -#define PLD_IRQ_SC_ERROR (M32700UT_PLD_IRQ_BASE + 13) /* SC error */ -#define PLD_IRQ_SC_RCV (M32700UT_PLD_IRQ_BASE + 14) /* SC receive */ -#define PLD_IRQ_SC_SND (M32700UT_PLD_IRQ_BASE + 15) /* SC send */ -#define PLD_IRQ_SIO0_RCV (M32700UT_PLD_IRQ_BASE + 16) /* SIO receive */ -#define PLD_IRQ_SIO0_SND (M32700UT_PLD_IRQ_BASE + 17) /* SIO send */ -#define PLD_IRQ_INT18 (M32700UT_PLD_IRQ_BASE + 18) /* reserved */ -#define PLD_IRQ_INT19 (M32700UT_PLD_IRQ_BASE + 19) /* reserved */ -#define PLD_IRQ_INT20 (M32700UT_PLD_IRQ_BASE + 20) /* reserved */ -#define PLD_IRQ_INT21 (M32700UT_PLD_IRQ_BASE + 21) /* reserved */ -#define PLD_IRQ_INT22 (M32700UT_PLD_IRQ_BASE + 22) /* reserved */ -#define PLD_IRQ_INT23 (M32700UT_PLD_IRQ_BASE + 23) /* reserved */ -#define PLD_IRQ_INT24 (M32700UT_PLD_IRQ_BASE + 24) /* reserved */ -#define PLD_IRQ_INT25 (M32700UT_PLD_IRQ_BASE + 25) /* reserved */ -#define PLD_IRQ_INT26 (M32700UT_PLD_IRQ_BASE + 26) /* reserved */ -#define PLD_IRQ_INT27 (M32700UT_PLD_IRQ_BASE + 27) /* reserved */ -#define PLD_IRQ_INT28 (M32700UT_PLD_IRQ_BASE + 28) /* reserved */ -#define PLD_IRQ_INT29 (M32700UT_PLD_IRQ_BASE + 29) /* reserved */ -#define PLD_IRQ_INT30 (M32700UT_PLD_IRQ_BASE + 30) /* reserved */ -#define PLD_IRQ_INT31 (M32700UT_PLD_IRQ_BASE + 31) /* reserved */ - -#else /* CONFIG_PLAT_USRV */ - -#define PLD_IRQ_INT0 (M32700UT_PLD_IRQ_BASE + 0) /* None */ -#define PLD_IRQ_INT1 (M32700UT_PLD_IRQ_BASE + 1) /* reserved */ -#define PLD_IRQ_INT2 (M32700UT_PLD_IRQ_BASE + 2) /* reserved */ -#define PLD_IRQ_CF0 (M32700UT_PLD_IRQ_BASE + 3) /* CF0# */ -#define PLD_IRQ_CF1 (M32700UT_PLD_IRQ_BASE + 4) /* CF1# */ -#define PLD_IRQ_CF2 (M32700UT_PLD_IRQ_BASE + 5) /* CF2# */ -#define PLD_IRQ_CF3 (M32700UT_PLD_IRQ_BASE + 6) /* CF3# */ -#define PLD_IRQ_CF4 (M32700UT_PLD_IRQ_BASE + 7) /* CF4# */ -#define PLD_IRQ_INT8 (M32700UT_PLD_IRQ_BASE + 8) /* reserved */ -#define PLD_IRQ_INT9 (M32700UT_PLD_IRQ_BASE + 9) /* reserved */ -#define PLD_IRQ_INT10 (M32700UT_PLD_IRQ_BASE + 10) /* reserved */ -#define PLD_IRQ_INT11 (M32700UT_PLD_IRQ_BASE + 11) /* reserved */ -#define PLD_IRQ_UART0 (M32700UT_PLD_IRQ_BASE + 12) /* UARTIRQ0 */ -#define PLD_IRQ_UART1 (M32700UT_PLD_IRQ_BASE + 13) /* UARTIRQ1 */ -#define PLD_IRQ_INT14 (M32700UT_PLD_IRQ_BASE + 14) /* reserved */ -#define PLD_IRQ_INT15 (M32700UT_PLD_IRQ_BASE + 15) /* reserved */ -#define PLD_IRQ_SNDINT (M32700UT_PLD_IRQ_BASE + 16) /* SNDINT# */ -#define PLD_IRQ_INT17 (M32700UT_PLD_IRQ_BASE + 17) /* reserved */ -#define PLD_IRQ_INT18 (M32700UT_PLD_IRQ_BASE + 18) /* reserved */ -#define PLD_IRQ_INT19 (M32700UT_PLD_IRQ_BASE + 19) /* reserved */ -#define PLD_IRQ_INT20 (M32700UT_PLD_IRQ_BASE + 20) /* reserved */ -#define PLD_IRQ_INT21 (M32700UT_PLD_IRQ_BASE + 21) /* reserved */ -#define PLD_IRQ_INT22 (M32700UT_PLD_IRQ_BASE + 22) /* reserved */ -#define PLD_IRQ_INT23 (M32700UT_PLD_IRQ_BASE + 23) /* reserved */ -#define PLD_IRQ_INT24 (M32700UT_PLD_IRQ_BASE + 24) /* reserved */ -#define PLD_IRQ_INT25 (M32700UT_PLD_IRQ_BASE + 25) /* reserved */ -#define PLD_IRQ_INT26 (M32700UT_PLD_IRQ_BASE + 26) /* reserved */ -#define PLD_IRQ_INT27 (M32700UT_PLD_IRQ_BASE + 27) /* reserved */ -#define PLD_IRQ_INT28 (M32700UT_PLD_IRQ_BASE + 28) /* reserved */ -#define PLD_IRQ_INT29 (M32700UT_PLD_IRQ_BASE + 29) /* reserved */ -#define PLD_IRQ_INT30 (M32700UT_PLD_IRQ_BASE + 30) /* reserved */ - -#endif /* CONFIG_PLAT_USRV */ - -#define PLD_ICUISTS __reg16(PLD_BASE + 0x8002) -#define PLD_ICUISTS_VECB_MASK (0xf000) -#define PLD_ICUISTS_VECB(x) ((x) & PLD_ICUISTS_VECB_MASK) -#define PLD_ICUISTS_ISN_MASK (0x07c0) -#define PLD_ICUISTS_ISN(x) ((x) & PLD_ICUISTS_ISN_MASK) -#define PLD_ICUIREQ0 __reg16(PLD_BASE + 0x8004) -#define PLD_ICUIREQ1 __reg16(PLD_BASE + 0x8006) -#define PLD_ICUCR1 __reg16(PLD_BASE + 0x8100) -#define PLD_ICUCR2 __reg16(PLD_BASE + 0x8102) -#define PLD_ICUCR3 __reg16(PLD_BASE + 0x8104) -#define PLD_ICUCR4 __reg16(PLD_BASE + 0x8106) -#define PLD_ICUCR5 __reg16(PLD_BASE + 0x8108) -#define PLD_ICUCR6 __reg16(PLD_BASE + 0x810a) -#define PLD_ICUCR7 __reg16(PLD_BASE + 0x810c) -#define PLD_ICUCR8 __reg16(PLD_BASE + 0x810e) -#define PLD_ICUCR9 __reg16(PLD_BASE + 0x8110) -#define PLD_ICUCR10 __reg16(PLD_BASE + 0x8112) -#define PLD_ICUCR11 __reg16(PLD_BASE + 0x8114) -#define PLD_ICUCR12 __reg16(PLD_BASE + 0x8116) -#define PLD_ICUCR13 __reg16(PLD_BASE + 0x8118) -#define PLD_ICUCR14 __reg16(PLD_BASE + 0x811a) -#define PLD_ICUCR15 __reg16(PLD_BASE + 0x811c) -#define PLD_ICUCR16 __reg16(PLD_BASE + 0x811e) -#define PLD_ICUCR17 __reg16(PLD_BASE + 0x8120) -#define PLD_ICUCR_IEN (0x1000) -#define PLD_ICUCR_IREQ (0x0100) -#define PLD_ICUCR_ISMOD00 (0x0000) /* Low edge */ -#define PLD_ICUCR_ISMOD01 (0x0010) /* Low level */ -#define PLD_ICUCR_ISMOD02 (0x0020) /* High edge */ -#define PLD_ICUCR_ISMOD03 (0x0030) /* High level */ -#define PLD_ICUCR_ILEVEL0 (0x0000) -#define PLD_ICUCR_ILEVEL1 (0x0001) -#define PLD_ICUCR_ILEVEL2 (0x0002) -#define PLD_ICUCR_ILEVEL3 (0x0003) -#define PLD_ICUCR_ILEVEL4 (0x0004) -#define PLD_ICUCR_ILEVEL5 (0x0005) -#define PLD_ICUCR_ILEVEL6 (0x0006) -#define PLD_ICUCR_ILEVEL7 (0x0007) - -/* Power Control of MMC and CF */ -#define PLD_CPCR __reg16(PLD_BASE + 0x14000) -#define PLD_CPCR_CF 0x0001 -#define PLD_CPCR_MMC 0x0002 - -/* LED Control - * - * 1: DIP swich side - * 2: Reset switch side - */ -#define PLD_IOLEDCR __reg16(PLD_BASE + 0x14002) -#define PLD_IOLED_1_ON 0x001 -#define PLD_IOLED_1_OFF 0x000 -#define PLD_IOLED_2_ON 0x002 -#define PLD_IOLED_2_OFF 0x000 - -/* DIP Switch - * 0: Write-protect of Flash Memory (0:protected, 1:non-protected) - * 1: - - * 2: - - * 3: - - */ -#define PLD_IOSWSTS __reg16(PLD_BASE + 0x14004) -#define PLD_IOSWSTS_IOSW2 0x0200 -#define PLD_IOSWSTS_IOSW1 0x0100 -#define PLD_IOSWSTS_IOWP0 0x0001 - -/* CRC */ -#define PLD_CRC7DATA __reg16(PLD_BASE + 0x18000) -#define PLD_CRC7INDATA __reg16(PLD_BASE + 0x18002) -#define PLD_CRC16DATA __reg16(PLD_BASE + 0x18004) -#define PLD_CRC16INDATA __reg16(PLD_BASE + 0x18006) -#define PLD_CRC16ADATA __reg16(PLD_BASE + 0x18008) -#define PLD_CRC16AINDATA __reg16(PLD_BASE + 0x1800a) - -/* RTC */ -#define PLD_RTCCR __reg16(PLD_BASE + 0x1c000) -#define PLD_RTCBAUR __reg16(PLD_BASE + 0x1c002) -#define PLD_RTCWRDATA __reg16(PLD_BASE + 0x1c004) -#define PLD_RTCRDDATA __reg16(PLD_BASE + 0x1c006) -#define PLD_RTCRSTODT __reg16(PLD_BASE + 0x1c008) - -/* SIO0 */ -#define PLD_ESIO0CR __reg16(PLD_BASE + 0x20000) -#define PLD_ESIO0CR_TXEN 0x0001 -#define PLD_ESIO0CR_RXEN 0x0002 -#define PLD_ESIO0MOD0 __reg16(PLD_BASE + 0x20002) -#define PLD_ESIO0MOD0_CTSS 0x0040 -#define PLD_ESIO0MOD0_RTSS 0x0080 -#define PLD_ESIO0MOD1 __reg16(PLD_BASE + 0x20004) -#define PLD_ESIO0MOD1_LMFS 0x0010 -#define PLD_ESIO0STS __reg16(PLD_BASE + 0x20006) -#define PLD_ESIO0STS_TEMP 0x0001 -#define PLD_ESIO0STS_TXCP 0x0002 -#define PLD_ESIO0STS_RXCP 0x0004 -#define PLD_ESIO0STS_TXSC 0x0100 -#define PLD_ESIO0STS_RXSC 0x0200 -#define PLD_ESIO0STS_TXREADY (PLD_ESIO0STS_TXCP | PLD_ESIO0STS_TEMP) -#define PLD_ESIO0INTCR __reg16(PLD_BASE + 0x20008) -#define PLD_ESIO0INTCR_TXIEN 0x0002 -#define PLD_ESIO0INTCR_RXCEN 0x0004 -#define PLD_ESIO0BAUR __reg16(PLD_BASE + 0x2000a) -#define PLD_ESIO0TXB __reg16(PLD_BASE + 0x2000c) -#define PLD_ESIO0RXB __reg16(PLD_BASE + 0x2000e) - -/* SIM Card */ -#define PLD_SCCR __reg16(PLD_BASE + 0x38000) -#define PLD_SCMOD __reg16(PLD_BASE + 0x38004) -#define PLD_SCSTS __reg16(PLD_BASE + 0x38006) -#define PLD_SCINTCR __reg16(PLD_BASE + 0x38008) -#define PLD_SCBAUR __reg16(PLD_BASE + 0x3800a) -#define PLD_SCTXB __reg16(PLD_BASE + 0x3800c) -#define PLD_SCRXB __reg16(PLD_BASE + 0x3800e) - -#endif /* _M32700UT_M32700UT_PLD.H */ diff --git a/arch/m32r/include/asm/m32r.h b/arch/m32r/include/asm/m32r.h deleted file mode 100644 index d27f056d92f31..0000000000000 --- a/arch/m32r/include/asm/m32r.h +++ /dev/null @@ -1,161 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_M32R_M32R_H_ -#define _ASM_M32R_M32R_H_ - -/* - * Renesas M32R processor - * - * Copyright (C) 2003, 2004 Renesas Technology Corp. - */ - - -/* Chip type */ -#if defined(CONFIG_CHIP_XNUX_MP) || defined(CONFIG_CHIP_XNUX2_MP) -#include -#elif defined(CONFIG_CHIP_VDEC2) || defined(CONFIG_CHIP_XNUX2) \ - || defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_M32102) \ - || defined(CONFIG_CHIP_OPSP) || defined(CONFIG_CHIP_M32104) -#include -#endif - -/* Platform type */ -#if defined(CONFIG_PLAT_M32700UT) -#include -#include -#include -/* for ei_handler:linux/arch/m32r/kernel/entry.S */ -#define M32R_INT1ICU_ISTS PLD_ICUISTS -#define M32R_INT1ICU_IRQ_BASE M32700UT_PLD_IRQ_BASE -#define M32R_INT0ICU_ISTS M32700UT_LAN_ICUISTS -#define M32R_INT0ICU_IRQ_BASE M32700UT_LAN_PLD_IRQ_BASE -#define M32R_INT2ICU_ISTS M32700UT_LCD_ICUISTS -#define M32R_INT2ICU_IRQ_BASE M32700UT_LCD_PLD_IRQ_BASE -#endif /* CONFIG_PLAT_M32700UT */ - -#if defined(CONFIG_PLAT_OPSPUT) -#include -#include -#include -/* for ei_handler:linux/arch/m32r/kernel/entry.S */ -#define M32R_INT1ICU_ISTS PLD_ICUISTS -#define M32R_INT1ICU_IRQ_BASE OPSPUT_PLD_IRQ_BASE -#define M32R_INT0ICU_ISTS OPSPUT_LAN_ICUISTS -#define M32R_INT0ICU_IRQ_BASE OPSPUT_LAN_PLD_IRQ_BASE -#define M32R_INT2ICU_ISTS OPSPUT_LCD_ICUISTS -#define M32R_INT2ICU_IRQ_BASE OPSPUT_LCD_PLD_IRQ_BASE -#endif /* CONFIG_PLAT_OPSPUT */ - -#if defined(CONFIG_PLAT_MAPPI2) -#include -#endif /* CONFIG_PLAT_MAPPI2 */ - -#if defined(CONFIG_PLAT_MAPPI3) -#include -#endif /* CONFIG_PLAT_MAPPI3 */ - -#if defined(CONFIG_PLAT_USRV) -#include -/* for ei_handler:linux/arch/m32r/kernel/entry.S */ -#define M32R_INT1ICU_ISTS PLD_ICUISTS -#define M32R_INT1ICU_IRQ_BASE M32700UT_PLD_IRQ_BASE -#endif - -#if defined(CONFIG_PLAT_M32104UT) -#include -/* for ei_handler:linux/arch/m32r/kernel/entry.S */ -#define M32R_INT1ICU_ISTS PLD_ICUISTS -#define M32R_INT1ICU_IRQ_BASE M32104UT_PLD_IRQ_BASE -#endif /* CONFIG_PLAT_M32104 */ - -/* - * M32R Register - */ - -/* - * MMU Register - */ - -#define MMU_REG_BASE (0xffff0000) -#define ITLB_BASE (0xfe000000) -#define DTLB_BASE (0xfe000800) - -#define NR_TLB_ENTRIES CONFIG_TLB_ENTRIES - -#define MATM MMU_REG_BASE /* MMU Address Translation Mode - Register */ -#define MPSZ (0x04 + MMU_REG_BASE) /* MMU Page Size Designation Register */ -#define MASID (0x08 + MMU_REG_BASE) /* MMU Address Space ID Register */ -#define MESTS (0x0c + MMU_REG_BASE) /* MMU Exception Status Register */ -#define MDEVA (0x10 + MMU_REG_BASE) /* MMU Operand Exception Virtual - Address Register */ -#define MDEVP (0x14 + MMU_REG_BASE) /* MMU Operand Exception Virtual Page - Number Register */ -#define MPTB (0x18 + MMU_REG_BASE) /* MMU Page Table Base Register */ -#define MSVA (0x20 + MMU_REG_BASE) /* MMU Search Virtual Address - Register */ -#define MTOP (0x24 + MMU_REG_BASE) /* MMU TLB Operation Register */ -#define MIDXI (0x28 + MMU_REG_BASE) /* MMU Index Register for - Instruciton */ -#define MIDXD (0x2c + MMU_REG_BASE) /* MMU Index Register for Operand */ - -#define MATM_offset (MATM - MMU_REG_BASE) -#define MPSZ_offset (MPSZ - MMU_REG_BASE) -#define MASID_offset (MASID - MMU_REG_BASE) -#define MESTS_offset (MESTS - MMU_REG_BASE) -#define MDEVA_offset (MDEVA - MMU_REG_BASE) -#define MDEVP_offset (MDEVP - MMU_REG_BASE) -#define MPTB_offset (MPTB - MMU_REG_BASE) -#define MSVA_offset (MSVA - MMU_REG_BASE) -#define MTOP_offset (MTOP - MMU_REG_BASE) -#define MIDXI_offset (MIDXI - MMU_REG_BASE) -#define MIDXD_offset (MIDXD - MMU_REG_BASE) - -#define MESTS_IT (1 << 0) /* Instruction TLB miss */ -#define MESTS_IA (1 << 1) /* Instruction Access Exception */ -#define MESTS_DT (1 << 4) /* Operand TLB miss */ -#define MESTS_DA (1 << 5) /* Operand Access Exception */ -#define MESTS_DRW (1 << 6) /* Operand Write Exception Flag */ - -/* - * PSW (Processor Status Word) - */ - -/* PSW bit */ -#define M32R_PSW_BIT_SM (7) /* Stack Mode */ -#define M32R_PSW_BIT_IE (6) /* Interrupt Enable */ -#define M32R_PSW_BIT_PM (3) /* Processor Mode [0:Supervisor,1:User] */ -#define M32R_PSW_BIT_C (0) /* Condition */ -#define M32R_PSW_BIT_BSM (7+8) /* Backup Stack Mode */ -#define M32R_PSW_BIT_BIE (6+8) /* Backup Interrupt Enable */ -#define M32R_PSW_BIT_BPM (3+8) /* Backup Processor Mode */ -#define M32R_PSW_BIT_BC (0+8) /* Backup Condition */ - -/* PSW bit map */ -#define M32R_PSW_SM (1UL<< M32R_PSW_BIT_SM) /* Stack Mode */ -#define M32R_PSW_IE (1UL<< M32R_PSW_BIT_IE) /* Interrupt Enable */ -#define M32R_PSW_PM (1UL<< M32R_PSW_BIT_PM) /* Processor Mode */ -#define M32R_PSW_C (1UL<< M32R_PSW_BIT_C) /* Condition */ -#define M32R_PSW_BSM (1UL<< M32R_PSW_BIT_BSM) /* Backup Stack Mode */ -#define M32R_PSW_BIE (1UL<< M32R_PSW_BIT_BIE) /* Backup Interrupt Enable */ -#define M32R_PSW_BPM (1UL<< M32R_PSW_BIT_BPM) /* Backup Processor Mode */ -#define M32R_PSW_BC (1UL<< M32R_PSW_BIT_BC) /* Backup Condition */ - -/* - * Direct address to SFR - */ - -#include -#ifdef CONFIG_MMU -#define NONCACHE_OFFSET (__PAGE_OFFSET + 0x20000000) -#else -#define NONCACHE_OFFSET __PAGE_OFFSET -#endif /* CONFIG_MMU */ - -#define M32R_ICU_ISTS_ADDR M32R_ICU_ISTS_PORTL+NONCACHE_OFFSET -#define M32R_ICU_IPICR_ADDR M32R_ICU_IPICR0_PORTL+NONCACHE_OFFSET -#define M32R_ICU_IMASK_ADDR M32R_ICU_IMASK_PORTL+NONCACHE_OFFSET -#define M32R_FPGA_CPU_NAME_ADDR M32R_FPGA_CPU_NAME0_PORTL+NONCACHE_OFFSET -#define M32R_FPGA_MODEL_ID_ADDR M32R_FPGA_MODEL_ID0_PORTL+NONCACHE_OFFSET -#define M32R_FPGA_VERSION_ADDR M32R_FPGA_VERSION0_PORTL+NONCACHE_OFFSET - -#endif /* _ASM_M32R_M32R_H_ */ diff --git a/arch/m32r/include/asm/m32r_mp_fpga.h b/arch/m32r/include/asm/m32r_mp_fpga.h deleted file mode 100644 index 8eeaa9a420c59..0000000000000 --- a/arch/m32r/include/asm/m32r_mp_fpga.h +++ /dev/null @@ -1,314 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_M32R_M32R_MP_FPGA_ -#define _ASM_M32R_M32R_MP_FPGA_ - -/* - * Renesas M32R-MP-FPGA - * - * Copyright (c) 2002 Hitoshi Yamamoto - * Copyright (c) 2003, 2004 Renesas Technology Corp. - */ - -/* - * ======================================================== - * M32R-MP-FPGA Memory Map - * ======================================================== - * 0x00000000 : Block#0 : 64[MB] - * 0x03E00000 : SFR - * 0x03E00000 : reserved - * 0x03EF0000 : FPGA - * 0x03EF1000 : reserved - * 0x03EF4000 : CKM - * 0x03EF4000 : BSELC - * 0x03EF5000 : reserved - * 0x03EFC000 : MFT - * 0x03EFD000 : SIO - * 0x03EFE000 : reserved - * 0x03EFF000 : ICU - * 0x03F00000 : Internal SRAM 64[KB] - * 0x03F10000 : reserved - * -------------------------------------------------------- - * 0x04000000 : Block#1 : 64[MB] - * 0x04000000 : Debug board SRAM 4[MB] - * 0x04400000 : reserved - * -------------------------------------------------------- - * 0x08000000 : Block#2 : 64[MB] - * -------------------------------------------------------- - * 0x0C000000 : Block#3 : 64[MB] - * -------------------------------------------------------- - * 0x10000000 : Block#4 : 64[MB] - * -------------------------------------------------------- - * 0x14000000 : Block#5 : 64[MB] - * -------------------------------------------------------- - * 0x18000000 : Block#6 : 64[MB] - * -------------------------------------------------------- - * 0x1C000000 : Block#7 : 64[MB] - * -------------------------------------------------------- - * 0xFE000000 : TLB - * 0xFE000000 : ITLB - * 0xFE000080 : reserved - * 0xFE000800 : DTLB - * 0xFE000880 : reserved - * -------------------------------------------------------- - * 0xFF000000 : System area - * 0xFFFF0000 : MMU - * 0xFFFF0030 : reserved - * 0xFFFF8000 : Debug function - * 0xFFFFA000 : reserved - * 0xFFFFC000 : CPU control - * 0xFFFFFFFF - * ======================================================== - */ - -/*======================================================================* - * Special Function Register - *======================================================================*/ -#define M32R_SFR_OFFSET (0x00E00000) /* 0x03E00000-0x03EFFFFF 1[MB] */ - -/* - * FPGA registers. - */ -#define M32R_FPGA_TOP (0x000F0000+M32R_SFR_OFFSET) - -#define M32R_FPGA_NUM_OF_CPUS_PORTL (0x00+M32R_FPGA_TOP) -#define M32R_FPGA_CPU_NAME0_PORTL (0x10+M32R_FPGA_TOP) -#define M32R_FPGA_CPU_NAME1_PORTL (0x14+M32R_FPGA_TOP) -#define M32R_FPGA_CPU_NAME2_PORTL (0x18+M32R_FPGA_TOP) -#define M32R_FPGA_CPU_NAME3_PORTL (0x1C+M32R_FPGA_TOP) -#define M32R_FPGA_MODEL_ID0_PORTL (0x20+M32R_FPGA_TOP) -#define M32R_FPGA_MODEL_ID1_PORTL (0x24+M32R_FPGA_TOP) -#define M32R_FPGA_MODEL_ID2_PORTL (0x28+M32R_FPGA_TOP) -#define M32R_FPGA_MODEL_ID3_PORTL (0x2C+M32R_FPGA_TOP) -#define M32R_FPGA_VERSION0_PORTL (0x30+M32R_FPGA_TOP) -#define M32R_FPGA_VERSION1_PORTL (0x34+M32R_FPGA_TOP) - -/* - * Clock and Power Manager registers. - */ -#define M32R_CPM_OFFSET (0x000F4000+M32R_SFR_OFFSET) - -#define M32R_CPM_CPUCLKCR_PORTL (0x00+M32R_CPM_OFFSET) -#define M32R_CPM_CLKMOD_PORTL (0x04+M32R_CPM_OFFSET) -#define M32R_CPM_PLLCR_PORTL (0x08+M32R_CPM_OFFSET) - -/* - * Block SELect Controller registers. - */ -#define M32R_BSELC_OFFSET (0x000F5000+M32R_SFR_OFFSET) - -#define M32R_BSEL0_CR0_PORTL (0x000+M32R_BSELC_OFFSET) -#define M32R_BSEL0_CR1_PORTL (0x004+M32R_BSELC_OFFSET) -#define M32R_BSEL1_CR0_PORTL (0x100+M32R_BSELC_OFFSET) -#define M32R_BSEL1_CR1_PORTL (0x104+M32R_BSELC_OFFSET) -#define M32R_BSEL2_CR0_PORTL (0x200+M32R_BSELC_OFFSET) -#define M32R_BSEL2_CR1_PORTL (0x204+M32R_BSELC_OFFSET) -#define M32R_BSEL3_CR0_PORTL (0x300+M32R_BSELC_OFFSET) -#define M32R_BSEL3_CR1_PORTL (0x304+M32R_BSELC_OFFSET) -#define M32R_BSEL4_CR0_PORTL (0x400+M32R_BSELC_OFFSET) -#define M32R_BSEL4_CR1_PORTL (0x404+M32R_BSELC_OFFSET) -#define M32R_BSEL5_CR0_PORTL (0x500+M32R_BSELC_OFFSET) -#define M32R_BSEL5_CR1_PORTL (0x504+M32R_BSELC_OFFSET) -#define M32R_BSEL6_CR0_PORTL (0x600+M32R_BSELC_OFFSET) -#define M32R_BSEL6_CR1_PORTL (0x604+M32R_BSELC_OFFSET) -#define M32R_BSEL7_CR0_PORTL (0x700+M32R_BSELC_OFFSET) -#define M32R_BSEL7_CR1_PORTL (0x704+M32R_BSELC_OFFSET) - -/* - * Multi Function Timer registers. - */ -#define M32R_MFT_OFFSET (0x000FC000+M32R_SFR_OFFSET) - -#define M32R_MFTCR_PORTL (0x000+M32R_MFT_OFFSET) /* MFT control */ -#define M32R_MFTRPR_PORTL (0x004+M32R_MFT_OFFSET) /* MFT real port */ - -#define M32R_MFT0_OFFSET (0x100+M32R_MFT_OFFSET) -#define M32R_MFT0MOD_PORTL (0x00+M32R_MFT0_OFFSET) /* MFT0 mode */ -#define M32R_MFT0BOS_PORTL (0x04+M32R_MFT0_OFFSET) /* MFT0 b-port output status */ -#define M32R_MFT0CUT_PORTL (0x08+M32R_MFT0_OFFSET) /* MFT0 count */ -#define M32R_MFT0RLD_PORTL (0x0C+M32R_MFT0_OFFSET) /* MFT0 reload */ -#define M32R_MFT0CMPRLD_PORTL (0x10+M32R_MFT0_OFFSET) /* MFT0 compare reload */ - -#define M32R_MFT1_OFFSET (0x200+M32R_MFT_OFFSET) -#define M32R_MFT1MOD_PORTL (0x00+M32R_MFT1_OFFSET) /* MFT1 mode */ -#define M32R_MFT1BOS_PORTL (0x04+M32R_MFT1_OFFSET) /* MFT1 b-port output status */ -#define M32R_MFT1CUT_PORTL (0x08+M32R_MFT1_OFFSET) /* MFT1 count */ -#define M32R_MFT1RLD_PORTL (0x0C+M32R_MFT1_OFFSET) /* MFT1 reload */ -#define M32R_MFT1CMPRLD_PORTL (0x10+M32R_MFT1_OFFSET) /* MFT1 compare reload */ - -#define M32R_MFT2_OFFSET (0x300+M32R_MFT_OFFSET) -#define M32R_MFT2MOD_PORTL (0x00+M32R_MFT2_OFFSET) /* MFT2 mode */ -#define M32R_MFT2BOS_PORTL (0x04+M32R_MFT2_OFFSET) /* MFT2 b-port output status */ -#define M32R_MFT2CUT_PORTL (0x08+M32R_MFT2_OFFSET) /* MFT2 count */ -#define M32R_MFT2RLD_PORTL (0x0C+M32R_MFT2_OFFSET) /* MFT2 reload */ -#define M32R_MFT2CMPRLD_PORTL (0x10+M32R_MFT2_OFFSET) /* MFT2 compare reload */ - -#define M32R_MFT3_OFFSET (0x400+M32R_MFT_OFFSET) -#define M32R_MFT3MOD_PORTL (0x00+M32R_MFT3_OFFSET) /* MFT3 mode */ -#define M32R_MFT3BOS_PORTL (0x04+M32R_MFT3_OFFSET) /* MFT3 b-port output status */ -#define M32R_MFT3CUT_PORTL (0x08+M32R_MFT3_OFFSET) /* MFT3 count */ -#define M32R_MFT3RLD_PORTL (0x0C+M32R_MFT3_OFFSET) /* MFT3 reload */ -#define M32R_MFT3CMPRLD_PORTL (0x10+M32R_MFT3_OFFSET) /* MFT3 compare reload */ - -#define M32R_MFT4_OFFSET (0x500+M32R_MFT_OFFSET) -#define M32R_MFT4MOD_PORTL (0x00+M32R_MFT4_OFFSET) /* MFT4 mode */ -#define M32R_MFT4BOS_PORTL (0x04+M32R_MFT4_OFFSET) /* MFT4 b-port output status */ -#define M32R_MFT4CUT_PORTL (0x08+M32R_MFT4_OFFSET) /* MFT4 count */ -#define M32R_MFT4RLD_PORTL (0x0C+M32R_MFT4_OFFSET) /* MFT4 reload */ -#define M32R_MFT4CMPRLD_PORTL (0x10+M32R_MFT4_OFFSET) /* MFT4 compare reload */ - -#define M32R_MFT5_OFFSET (0x600+M32R_MFT_OFFSET) -#define M32R_MFT5MOD_PORTL (0x00+M32R_MFT5_OFFSET) /* MFT4 mode */ -#define M32R_MFT5BOS_PORTL (0x04+M32R_MFT5_OFFSET) /* MFT4 b-port output status */ -#define M32R_MFT5CUT_PORTL (0x08+M32R_MFT5_OFFSET) /* MFT4 count */ -#define M32R_MFT5RLD_PORTL (0x0C+M32R_MFT5_OFFSET) /* MFT4 reload */ -#define M32R_MFT5CMPRLD_PORTL (0x10+M32R_MFT5_OFFSET) /* MFT4 compare reload */ - -#define M32R_MFTCR_MFT0MSK (1UL<<15) /* b16 */ -#define M32R_MFTCR_MFT1MSK (1UL<<14) /* b17 */ -#define M32R_MFTCR_MFT2MSK (1UL<<13) /* b18 */ -#define M32R_MFTCR_MFT3MSK (1UL<<12) /* b19 */ -#define M32R_MFTCR_MFT4MSK (1UL<<11) /* b20 */ -#define M32R_MFTCR_MFT5MSK (1UL<<10) /* b21 */ -#define M32R_MFTCR_MFT0EN (1UL<<7) /* b24 */ -#define M32R_MFTCR_MFT1EN (1UL<<6) /* b25 */ -#define M32R_MFTCR_MFT2EN (1UL<<5) /* b26 */ -#define M32R_MFTCR_MFT3EN (1UL<<4) /* b27 */ -#define M32R_MFTCR_MFT4EN (1UL<<3) /* b28 */ -#define M32R_MFTCR_MFT5EN (1UL<<2) /* b29 */ - -#define M32R_MFTMOD_CC_MASK (1UL<<15) /* b16 */ -#define M32R_MFTMOD_TCCR (1UL<<13) /* b18 */ -#define M32R_MFTMOD_GTSEL000 (0UL<<8) /* b21-23 : 000 */ -#define M32R_MFTMOD_GTSEL001 (1UL<<8) /* b21-23 : 001 */ -#define M32R_MFTMOD_GTSEL010 (2UL<<8) /* b21-23 : 010 */ -#define M32R_MFTMOD_GTSEL011 (3UL<<8) /* b21-23 : 011 */ -#define M32R_MFTMOD_GTSEL110 (6UL<<8) /* b21-23 : 110 */ -#define M32R_MFTMOD_GTSEL111 (7UL<<8) /* b21-23 : 111 */ -#define M32R_MFTMOD_CMSEL (1UL<<3) /* b28 */ -#define M32R_MFTMOD_CSSEL000 (0UL<<0) /* b29-b31 : 000 */ -#define M32R_MFTMOD_CSSEL001 (1UL<<0) /* b29-b31 : 001 */ -#define M32R_MFTMOD_CSSEL010 (2UL<<0) /* b29-b31 : 010 */ -#define M32R_MFTMOD_CSSEL011 (3UL<<0) /* b29-b31 : 011 */ -#define M32R_MFTMOD_CSSEL100 (4UL<<0) /* b29-b31 : 100 */ -#define M32R_MFTMOD_CSSEL110 (6UL<<0) /* b29-b31 : 110 */ - -/* - * Serial I/O registers. - */ -#define M32R_SIO_OFFSET (0x000FD000+M32R_SFR_OFFSET) - -#define M32R_SIO0_CR_PORTL (0x000+M32R_SIO_OFFSET) -#define M32R_SIO0_MOD0_PORTL (0x004+M32R_SIO_OFFSET) -#define M32R_SIO0_MOD1_PORTL (0x008+M32R_SIO_OFFSET) -#define M32R_SIO0_STS_PORTL (0x00C+M32R_SIO_OFFSET) -#define M32R_SIO0_TRCR_PORTL (0x010+M32R_SIO_OFFSET) -#define M32R_SIO0_BAUR_PORTL (0x014+M32R_SIO_OFFSET) -#define M32R_SIO0_RBAUR_PORTL (0x018+M32R_SIO_OFFSET) -#define M32R_SIO0_TXB_PORTL (0x01C+M32R_SIO_OFFSET) -#define M32R_SIO0_RXB_PORTL (0x020+M32R_SIO_OFFSET) - -/* - * Interrupt Control Unit registers. - */ -#define M32R_ICU_OFFSET (0x000FF000+M32R_SFR_OFFSET) - -#define M32R_ICU_ISTS_PORTL (0x004+M32R_ICU_OFFSET) -#define M32R_ICU_IREQ0_PORTL (0x008+M32R_ICU_OFFSET) -#define M32R_ICU_IREQ1_PORTL (0x00C+M32R_ICU_OFFSET) -#define M32R_ICU_SBICR_PORTL (0x018+M32R_ICU_OFFSET) -#define M32R_ICU_IMASK_PORTL (0x01C+M32R_ICU_OFFSET) -#define M32R_ICU_CR1_PORTL (0x200+M32R_ICU_OFFSET) /* INT0 */ -#define M32R_ICU_CR2_PORTL (0x204+M32R_ICU_OFFSET) /* INT1 */ -#define M32R_ICU_CR3_PORTL (0x208+M32R_ICU_OFFSET) /* INT2 */ -#define M32R_ICU_CR4_PORTL (0x20C+M32R_ICU_OFFSET) /* INT3 */ -#define M32R_ICU_CR5_PORTL (0x210+M32R_ICU_OFFSET) /* INT4 */ -#define M32R_ICU_CR6_PORTL (0x214+M32R_ICU_OFFSET) /* INT5 */ -#define M32R_ICU_CR7_PORTL (0x218+M32R_ICU_OFFSET) /* INT6 */ -#define M32R_ICU_CR8_PORTL (0x218+M32R_ICU_OFFSET) /* INT7 */ -#define M32R_ICU_CR32_PORTL (0x27C+M32R_ICU_OFFSET) /* SIO0 RX */ -#define M32R_ICU_CR33_PORTL (0x280+M32R_ICU_OFFSET) /* SIO0 TX */ -#define M32R_ICU_CR40_PORTL (0x29C+M32R_ICU_OFFSET) /* DMAC0 */ -#define M32R_ICU_CR41_PORTL (0x2A0+M32R_ICU_OFFSET) /* DMAC1 */ -#define M32R_ICU_CR48_PORTL (0x2BC+M32R_ICU_OFFSET) /* MFT0 */ -#define M32R_ICU_CR49_PORTL (0x2C0+M32R_ICU_OFFSET) /* MFT1 */ -#define M32R_ICU_CR50_PORTL (0x2C4+M32R_ICU_OFFSET) /* MFT2 */ -#define M32R_ICU_CR51_PORTL (0x2C8+M32R_ICU_OFFSET) /* MFT3 */ -#define M32R_ICU_CR52_PORTL (0x2CC+M32R_ICU_OFFSET) /* MFT4 */ -#define M32R_ICU_CR53_PORTL (0x2D0+M32R_ICU_OFFSET) /* MFT5 */ -#define M32R_ICU_IPICR0_PORTL (0x2DC+M32R_ICU_OFFSET) /* IPI0 */ -#define M32R_ICU_IPICR1_PORTL (0x2E0+M32R_ICU_OFFSET) /* IPI1 */ -#define M32R_ICU_IPICR2_PORTL (0x2E4+M32R_ICU_OFFSET) /* IPI2 */ -#define M32R_ICU_IPICR3_PORTL (0x2E8+M32R_ICU_OFFSET) /* IPI3 */ -#define M32R_ICU_IPICR4_PORTL (0x2EC+M32R_ICU_OFFSET) /* IPI4 */ -#define M32R_ICU_IPICR5_PORTL (0x2F0+M32R_ICU_OFFSET) /* IPI5 */ -#define M32R_ICU_IPICR6_PORTL (0x2F4+M32R_ICU_OFFSET) /* IPI6 */ -#define M32R_ICU_IPICR7_PORTL (0x2FC+M32R_ICU_OFFSET) /* IPI7 */ - -#define M32R_ICUISTS_VECB(val) ((val>>28) & 0xF) -#define M32R_ICUISTS_ISN(val) ((val>>22) & 0x3F) -#define M32R_ICUISTS_PIML(val) ((val>>16) & 0x7) - -#define M32R_ICUIMASK_IMSK0 (0UL<<16) /* b13-b15: Disable interrupt */ -#define M32R_ICUIMASK_IMSK1 (1UL<<16) /* b13-b15: Enable level 0 interrupt */ -#define M32R_ICUIMASK_IMSK2 (2UL<<16) /* b13-b15: Enable level 0,1 interrupt */ -#define M32R_ICUIMASK_IMSK3 (3UL<<16) /* b13-b15: Enable level 0-2 interrupt */ -#define M32R_ICUIMASK_IMSK4 (4UL<<16) /* b13-b15: Enable level 0-3 interrupt */ -#define M32R_ICUIMASK_IMSK5 (5UL<<16) /* b13-b15: Enable level 0-4 interrupt */ -#define M32R_ICUIMASK_IMSK6 (6UL<<16) /* b13-b15: Enable level 0-5 interrupt */ -#define M32R_ICUIMASK_IMSK7 (7UL<<16) /* b13-b15: Enable level 0-6 interrupt */ - -#define M32R_ICUCR_IEN (1UL<<12) /* b19: Interrupt enable */ -#define M32R_ICUCR_IRQ (1UL<<8) /* b23: Interrupt request */ -#define M32R_ICUCR_ISMOD00 (0UL<<4) /* b26-b27: Interrupt sense mode Edge HtoL */ -#define M32R_ICUCR_ISMOD01 (1UL<<4) /* b26-b27: Interrupt sense mode Level L */ -#define M32R_ICUCR_ISMOD10 (2UL<<4) /* b26-b27: Interrupt sense mode Edge LtoH*/ -#define M32R_ICUCR_ISMOD11 (3UL<<4) /* b26-b27: Interrupt sense mode Level H */ -#define M32R_ICUCR_ILEVEL0 (0UL<<0) /* b29-b31: Interrupt priority level 0 */ -#define M32R_ICUCR_ILEVEL1 (1UL<<0) /* b29-b31: Interrupt priority level 1 */ -#define M32R_ICUCR_ILEVEL2 (2UL<<0) /* b29-b31: Interrupt priority level 2 */ -#define M32R_ICUCR_ILEVEL3 (3UL<<0) /* b29-b31: Interrupt priority level 3 */ -#define M32R_ICUCR_ILEVEL4 (4UL<<0) /* b29-b31: Interrupt priority level 4 */ -#define M32R_ICUCR_ILEVEL5 (5UL<<0) /* b29-b31: Interrupt priority level 5 */ -#define M32R_ICUCR_ILEVEL6 (6UL<<0) /* b29-b31: Interrupt priority level 6 */ -#define M32R_ICUCR_ILEVEL7 (7UL<<0) /* b29-b31: Disable interrupt */ -#define M32R_ICUCR_ILEVEL_MASK (7UL) - -#define M32R_IRQ_INT0 (1) /* INT0 */ -#define M32R_IRQ_INT1 (2) /* INT1 */ -#define M32R_IRQ_INT2 (3) /* INT2 */ -#define M32R_IRQ_INT3 (4) /* INT3 */ -#define M32R_IRQ_INT4 (5) /* INT4 */ -#define M32R_IRQ_INT5 (6) /* INT5 */ -#define M32R_IRQ_INT6 (7) /* INT6 */ -#define M32R_IRQ_INT7 (8) /* INT7 */ -#define M32R_IRQ_MFT0 (16) /* MFT0 */ -#define M32R_IRQ_MFT1 (17) /* MFT1 */ -#define M32R_IRQ_MFT2 (18) /* MFT2 */ -#define M32R_IRQ_MFT3 (19) /* MFT3 */ -#define M32R_IRQ_MFT4 (20) /* MFT4 */ -#define M32R_IRQ_MFT5 (21) /* MFT5 */ -#define M32R_IRQ_DMAC0 (32) /* DMAC0 */ -#define M32R_IRQ_DMAC1 (33) /* DMAC1 */ -#define M32R_IRQ_SIO0_R (48) /* SIO0 receive */ -#define M32R_IRQ_SIO0_S (49) /* SIO0 send */ -#define M32R_IRQ_SIO1_R (50) /* SIO1 send */ -#define M32R_IRQ_SIO1_S (51) /* SIO1 receive */ -#define M32R_IRQ_IPI0 (56) /* IPI0 */ -#define M32R_IRQ_IPI1 (57) /* IPI1 */ -#define M32R_IRQ_IPI2 (58) /* IPI2 */ -#define M32R_IRQ_IPI3 (59) /* IPI3 */ -#define M32R_IRQ_IPI4 (60) /* IPI4 */ -#define M32R_IRQ_IPI5 (61) /* IPI5 */ -#define M32R_IRQ_IPI6 (62) /* IPI6 */ -#define M32R_IRQ_IPI7 (63) /* IPI7 */ - -/*======================================================================* - * CPU - *======================================================================*/ - -#define M32R_CPUID_PORTL (0xFFFFFFE0) -#define M32R_MCICAR_PORTL (0xFFFFFFF0) -#define M32R_MCDCAR_PORTL (0xFFFFFFF4) -#define M32R_MCCR_PORTL (0xFFFFFFFC) - -#endif /* _ASM_M32R_M32R_MP_FPGA_ */ diff --git a/arch/m32r/include/asm/mappi2/mappi2_pld.h b/arch/m32r/include/asm/mappi2/mappi2_pld.h deleted file mode 100644 index 2624c9db72555..0000000000000 --- a/arch/m32r/include/asm/mappi2/mappi2_pld.h +++ /dev/null @@ -1,150 +0,0 @@ -#ifndef _MAPPI2_PLD_H -#define _MAPPI2_PLD_H - -/* - * include/asm-m32r/mappi2/mappi2_pld.h - * - * Definitions for Extended IO Logic on MAPPI2 board. - * based on m32700ut_pld.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 __ASSEMBLY__ -/* FIXME: - * Some C functions use non-cache address, so can't define non-cache address. - */ -#define PLD_BASE (0x10c00000 /* + NONCACHE_OFFSET */) -#define __reg8 (volatile unsigned char *) -#define __reg16 (volatile unsigned short *) -#define __reg32 (volatile unsigned int *) -#else -#define PLD_BASE (0x10c00000 + NONCACHE_OFFSET) -#define __reg8 -#define __reg16 -#define __reg32 -#endif /* __ASSEMBLY__ */ - -/* CFC */ -#define PLD_CFRSTCR __reg16(PLD_BASE + 0x0000) -#define PLD_CFSTS __reg16(PLD_BASE + 0x0002) -#define PLD_CFIMASK __reg16(PLD_BASE + 0x0004) -#define PLD_CFBUFCR __reg16(PLD_BASE + 0x0006) -#define PLD_CFCR0 __reg16(PLD_BASE + 0x000a) -#define PLD_CFCR1 __reg16(PLD_BASE + 0x000c) - -/* MMC */ -#define PLD_MMCCR __reg16(PLD_BASE + 0x4000) -#define PLD_MMCMOD __reg16(PLD_BASE + 0x4002) -#define PLD_MMCSTS __reg16(PLD_BASE + 0x4006) -#define PLD_MMCBAUR __reg16(PLD_BASE + 0x400a) -#define PLD_MMCCMDBCUT __reg16(PLD_BASE + 0x400c) -#define PLD_MMCCDTBCUT __reg16(PLD_BASE + 0x400e) -#define PLD_MMCDET __reg16(PLD_BASE + 0x4010) -#define PLD_MMCWP __reg16(PLD_BASE + 0x4012) -#define PLD_MMCWDATA __reg16(PLD_BASE + 0x5000) -#define PLD_MMCRDATA __reg16(PLD_BASE + 0x6000) -#define PLD_MMCCMDDATA __reg16(PLD_BASE + 0x7000) -#define PLD_MMCRSPDATA __reg16(PLD_BASE + 0x7006) - -/* Power Control of MMC and CF */ -#define PLD_CPCR __reg16(PLD_BASE + 0x14000) - - -/*==== ICU ====*/ -#define M32R_IRQ_PC104 (5) /* INT4(PC/104) */ -#define M32R_IRQ_I2C (28) /* I2C-BUS */ -#if 1 -#define PLD_IRQ_CFIREQ (40) /* CFC Card Interrupt */ -#define PLD_IRQ_CFC_INSERT (41) /* CFC Card Insert */ -#define PLD_IRQ_CFC_EJECT (42) /* CFC Card Eject */ -#define PLD_IRQ_MMCCARD (43) /* MMC Card Insert */ -#define PLD_IRQ_MMCIRQ (44) /* MMC Transfer Done */ -#else -#define PLD_IRQ_CFIREQ (34) /* CFC Card Interrupt */ -#define PLD_IRQ_CFC_INSERT (35) /* CFC Card Insert */ -#define PLD_IRQ_CFC_EJECT (36) /* CFC Card Eject */ -#define PLD_IRQ_MMCCARD (37) /* MMC Card Insert */ -#define PLD_IRQ_MMCIRQ (38) /* MMC Transfer Done */ -#endif - - -#if 0 -/* LED Control - * - * 1: DIP swich side - * 2: Reset switch side - */ -#define PLD_IOLEDCR __reg16(PLD_BASE + 0x14002) -#define PLD_IOLED_1_ON 0x001 -#define PLD_IOLED_1_OFF 0x000 -#define PLD_IOLED_2_ON 0x002 -#define PLD_IOLED_2_OFF 0x000 - -/* DIP Switch - * 0: Write-protect of Flash Memory (0:protected, 1:non-protected) - * 1: - - * 2: - - * 3: - - */ -#define PLD_IOSWSTS __reg16(PLD_BASE + 0x14004) -#define PLD_IOSWSTS_IOSW2 0x0200 -#define PLD_IOSWSTS_IOSW1 0x0100 -#define PLD_IOSWSTS_IOWP0 0x0001 - -#endif - -/* CRC */ -#define PLD_CRC7DATA __reg16(PLD_BASE + 0x18000) -#define PLD_CRC7INDATA __reg16(PLD_BASE + 0x18002) -#define PLD_CRC16DATA __reg16(PLD_BASE + 0x18004) -#define PLD_CRC16INDATA __reg16(PLD_BASE + 0x18006) -#define PLD_CRC16ADATA __reg16(PLD_BASE + 0x18008) -#define PLD_CRC16AINDATA __reg16(PLD_BASE + 0x1800a) - - -#if 0 -/* RTC */ -#define PLD_RTCCR __reg16(PLD_BASE + 0x1c000) -#define PLD_RTCBAUR __reg16(PLD_BASE + 0x1c002) -#define PLD_RTCWRDATA __reg16(PLD_BASE + 0x1c004) -#define PLD_RTCRDDATA __reg16(PLD_BASE + 0x1c006) -#define PLD_RTCRSTODT __reg16(PLD_BASE + 0x1c008) - -/* SIO0 */ -#define PLD_ESIO0CR __reg16(PLD_BASE + 0x20000) -#define PLD_ESIO0CR_TXEN 0x0001 -#define PLD_ESIO0CR_RXEN 0x0002 -#define PLD_ESIO0MOD0 __reg16(PLD_BASE + 0x20002) -#define PLD_ESIO0MOD0_CTSS 0x0040 -#define PLD_ESIO0MOD0_RTSS 0x0080 -#define PLD_ESIO0MOD1 __reg16(PLD_BASE + 0x20004) -#define PLD_ESIO0MOD1_LMFS 0x0010 -#define PLD_ESIO0STS __reg16(PLD_BASE + 0x20006) -#define PLD_ESIO0STS_TEMP 0x0001 -#define PLD_ESIO0STS_TXCP 0x0002 -#define PLD_ESIO0STS_RXCP 0x0004 -#define PLD_ESIO0STS_TXSC 0x0100 -#define PLD_ESIO0STS_RXSC 0x0200 -#define PLD_ESIO0STS_TXREADY (PLD_ESIO0STS_TXCP | PLD_ESIO0STS_TEMP) -#define PLD_ESIO0INTCR __reg16(PLD_BASE + 0x20008) -#define PLD_ESIO0INTCR_TXIEN 0x0002 -#define PLD_ESIO0INTCR_RXCEN 0x0004 -#define PLD_ESIO0BAUR __reg16(PLD_BASE + 0x2000a) -#define PLD_ESIO0TXB __reg16(PLD_BASE + 0x2000c) -#define PLD_ESIO0RXB __reg16(PLD_BASE + 0x2000e) - -/* SIM Card */ -#define PLD_SCCR __reg16(PLD_BASE + 0x38000) -#define PLD_SCMOD __reg16(PLD_BASE + 0x38004) -#define PLD_SCSTS __reg16(PLD_BASE + 0x38006) -#define PLD_SCINTCR __reg16(PLD_BASE + 0x38008) -#define PLD_SCBAUR __reg16(PLD_BASE + 0x3800a) -#define PLD_SCTXB __reg16(PLD_BASE + 0x3800c) -#define PLD_SCRXB __reg16(PLD_BASE + 0x3800e) - -#endif - -#endif /* _MAPPI2_PLD.H */ diff --git a/arch/m32r/include/asm/mappi3/mappi3_pld.h b/arch/m32r/include/asm/mappi3/mappi3_pld.h deleted file mode 100644 index 451c40ee70af8..0000000000000 --- a/arch/m32r/include/asm/mappi3/mappi3_pld.h +++ /dev/null @@ -1,142 +0,0 @@ -#ifndef _MAPPI3_PLD_H -#define _MAPPI3_PLD_H - -/* - * include/asm-m32r/mappi3/mappi3_pld.h - * - * Definitions for Extended IO Logic on MAPPI3 board. - * based on m32700ut_pld.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 __ASSEMBLY__ -/* FIXME: - * Some C functions use non-cache address, so can't define non-cache address. - */ -#define PLD_BASE (0x1c000000 /* + NONCACHE_OFFSET */) -#define __reg8 (volatile unsigned char *) -#define __reg16 (volatile unsigned short *) -#define __reg32 (volatile unsigned int *) -#else -#define PLD_BASE (0x1c000000 + NONCACHE_OFFSET) -#define __reg8 -#define __reg16 -#define __reg32 -#endif /* __ASSEMBLY__ */ - -/* CFC */ -#define PLD_CFRSTCR __reg16(PLD_BASE + 0x0000) -#define PLD_CFSTS __reg16(PLD_BASE + 0x0002) -#define PLD_CFIMASK __reg16(PLD_BASE + 0x0004) -#define PLD_CFBUFCR __reg16(PLD_BASE + 0x0006) -#define PLD_CFCR0 __reg16(PLD_BASE + 0x000a) -#define PLD_CFCR1 __reg16(PLD_BASE + 0x000c) - -/* MMC */ -#define PLD_MMCCR __reg16(PLD_BASE + 0x4000) -#define PLD_MMCMOD __reg16(PLD_BASE + 0x4002) -#define PLD_MMCSTS __reg16(PLD_BASE + 0x4006) -#define PLD_MMCBAUR __reg16(PLD_BASE + 0x400a) -#define PLD_MMCCMDBCUT __reg16(PLD_BASE + 0x400c) -#define PLD_MMCCDTBCUT __reg16(PLD_BASE + 0x400e) -#define PLD_MMCDET __reg16(PLD_BASE + 0x4010) -#define PLD_MMCWP __reg16(PLD_BASE + 0x4012) -#define PLD_MMCWDATA __reg16(PLD_BASE + 0x5000) -#define PLD_MMCRDATA __reg16(PLD_BASE + 0x6000) -#define PLD_MMCCMDDATA __reg16(PLD_BASE + 0x7000) -#define PLD_MMCRSPDATA __reg16(PLD_BASE + 0x7006) - -/* Power Control of MMC and CF */ -#define PLD_CPCR __reg16(PLD_BASE + 0x14000) - -/* ICU */ -#define M32R_IRQ_PC104 (5) /* INT4(PC/104) */ -#define M32R_IRQ_I2C (28) /* I2C-BUS */ -#define PLD_IRQ_CFIREQ (6) /* INT5 CFC Card Interrupt */ -#define PLD_IRQ_CFC_INSERT (7) /* INT6 CFC Card Insert & Eject */ -#define PLD_IRQ_IDEIREQ (8) /* INT7 IDE Interrupt */ -#define PLD_IRQ_MMCCARD (43) /* MMC Card Insert */ -#define PLD_IRQ_MMCIRQ (44) /* MMC Transfer Done */ - -#if 0 -/* LED Control - * - * 1: DIP swich side - * 2: Reset switch side - */ -#define PLD_IOLEDCR __reg16(PLD_BASE + 0x14002) -#define PLD_IOLED_1_ON 0x001 -#define PLD_IOLED_1_OFF 0x000 -#define PLD_IOLED_2_ON 0x002 -#define PLD_IOLED_2_OFF 0x000 - -/* DIP Switch - * 0: Write-protect of Flash Memory (0:protected, 1:non-protected) - * 1: - - * 2: - - * 3: - - */ -#define PLD_IOSWSTS __reg16(PLD_BASE + 0x14004) -#define PLD_IOSWSTS_IOSW2 0x0200 -#define PLD_IOSWSTS_IOSW1 0x0100 -#define PLD_IOSWSTS_IOWP0 0x0001 - -#endif - -/* CRC */ -#define PLD_CRC7DATA __reg16(PLD_BASE + 0x18000) -#define PLD_CRC7INDATA __reg16(PLD_BASE + 0x18002) -#define PLD_CRC16DATA __reg16(PLD_BASE + 0x18004) -#define PLD_CRC16INDATA __reg16(PLD_BASE + 0x18006) -#define PLD_CRC16ADATA __reg16(PLD_BASE + 0x18008) -#define PLD_CRC16AINDATA __reg16(PLD_BASE + 0x1800a) - -#if 0 -/* RTC */ -#define PLD_RTCCR __reg16(PLD_BASE + 0x1c000) -#define PLD_RTCBAUR __reg16(PLD_BASE + 0x1c002) -#define PLD_RTCWRDATA __reg16(PLD_BASE + 0x1c004) -#define PLD_RTCRDDATA __reg16(PLD_BASE + 0x1c006) -#define PLD_RTCRSTODT __reg16(PLD_BASE + 0x1c008) - -/* SIO0 */ -#define PLD_ESIO0CR __reg16(PLD_BASE + 0x20000) -#define PLD_ESIO0CR_TXEN 0x0001 -#define PLD_ESIO0CR_RXEN 0x0002 -#define PLD_ESIO0MOD0 __reg16(PLD_BASE + 0x20002) -#define PLD_ESIO0MOD0_CTSS 0x0040 -#define PLD_ESIO0MOD0_RTSS 0x0080 -#define PLD_ESIO0MOD1 __reg16(PLD_BASE + 0x20004) -#define PLD_ESIO0MOD1_LMFS 0x0010 -#define PLD_ESIO0STS __reg16(PLD_BASE + 0x20006) -#define PLD_ESIO0STS_TEMP 0x0001 -#define PLD_ESIO0STS_TXCP 0x0002 -#define PLD_ESIO0STS_RXCP 0x0004 -#define PLD_ESIO0STS_TXSC 0x0100 -#define PLD_ESIO0STS_RXSC 0x0200 -#define PLD_ESIO0STS_TXREADY (PLD_ESIO0STS_TXCP | PLD_ESIO0STS_TEMP) -#define PLD_ESIO0INTCR __reg16(PLD_BASE + 0x20008) -#define PLD_ESIO0INTCR_TXIEN 0x0002 -#define PLD_ESIO0INTCR_RXCEN 0x0004 -#define PLD_ESIO0BAUR __reg16(PLD_BASE + 0x2000a) -#define PLD_ESIO0TXB __reg16(PLD_BASE + 0x2000c) -#define PLD_ESIO0RXB __reg16(PLD_BASE + 0x2000e) - -/* SIM Card */ -#define PLD_SCCR __reg16(PLD_BASE + 0x38000) -#define PLD_SCMOD __reg16(PLD_BASE + 0x38004) -#define PLD_SCSTS __reg16(PLD_BASE + 0x38006) -#define PLD_SCINTCR __reg16(PLD_BASE + 0x38008) -#define PLD_SCBAUR __reg16(PLD_BASE + 0x3800a) -#define PLD_SCTXB __reg16(PLD_BASE + 0x3800c) -#define PLD_SCRXB __reg16(PLD_BASE + 0x3800e) - -#endif - -/* Reset Control */ -#define PLD_REBOOT __reg16(PLD_BASE + 0x38000) - -#endif /* _MAPPI3_PLD.H */ diff --git a/arch/m32r/include/asm/mc146818rtc.h b/arch/m32r/include/asm/mc146818rtc.h deleted file mode 100644 index 4effa4704347b..0000000000000 --- a/arch/m32r/include/asm/mc146818rtc.h +++ /dev/null @@ -1,30 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Machine dependent access functions for RTC registers. - */ -#ifndef _ASM_MC146818RTC_H -#define _ASM_MC146818RTC_H - -#include - -#ifndef RTC_PORT -#define RTC_PORT(x) ((x)) -#define RTC_ALWAYS_BCD 1 /* RTC operates in binary mode */ -#endif - -/* - * The yet supported machines all access the RTC index register via - * an ISA port access but the way to access the date register differs ... - */ -#define CMOS_READ(addr) ({ \ -outb_p((addr),RTC_PORT(0)); \ -inb_p(RTC_PORT(1)); \ -}) -#define CMOS_WRITE(val, addr) ({ \ -outb_p((addr),RTC_PORT(0)); \ -outb_p((val),RTC_PORT(1)); \ -}) - -#define RTC_IRQ 8 - -#endif /* _ASM_MC146818RTC_H */ diff --git a/arch/m32r/include/asm/mmu.h b/arch/m32r/include/asm/mmu.h deleted file mode 100644 index 34bcccd8007d9..0000000000000 --- a/arch/m32r/include/asm/mmu.h +++ /dev/null @@ -1,22 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_M32R_MMU_H -#define _ASM_M32R_MMU_H - -#if !defined(CONFIG_MMU) - -typedef struct { - unsigned long end_brk; -} mm_context_t; - -#else /* CONFIG_MMU */ - -/* Default "unsigned long" context */ -#ifndef CONFIG_SMP -typedef unsigned long mm_context_t; -#else -typedef unsigned long mm_context_t[NR_CPUS]; -#endif - -#endif /* CONFIG_MMU */ - -#endif /* _ASM_M32R_MMU_H */ diff --git a/arch/m32r/include/asm/mmu_context.h b/arch/m32r/include/asm/mmu_context.h deleted file mode 100644 index 8a499d0fb3a2f..0000000000000 --- a/arch/m32r/include/asm/mmu_context.h +++ /dev/null @@ -1,167 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_M32R_MMU_CONTEXT_H -#define _ASM_M32R_MMU_CONTEXT_H -#ifdef __KERNEL__ - -#include - -#define MMU_CONTEXT_ASID_MASK (0x000000FF) -#define MMU_CONTEXT_VERSION_MASK (0xFFFFFF00) -#define MMU_CONTEXT_FIRST_VERSION (0x00000100) -#define NO_CONTEXT (0x00000000) - -#ifndef __ASSEMBLY__ - -#include -#include - -#include -#include -#include -#include - -/* - * Cache of MMU context last used. - */ -#ifndef CONFIG_SMP -extern unsigned long mmu_context_cache_dat; -#define mmu_context_cache mmu_context_cache_dat -#define mm_context(mm) mm->context -#else /* not CONFIG_SMP */ -extern unsigned long mmu_context_cache_dat[]; -#define mmu_context_cache mmu_context_cache_dat[smp_processor_id()] -#define mm_context(mm) mm->context[smp_processor_id()] -#endif /* not CONFIG_SMP */ - -#define set_tlb_tag(entry, tag) (*entry = (tag & PAGE_MASK)|get_asid()) -#define set_tlb_data(entry, data) (*entry = (data | _PAGE_PRESENT)) - -#ifdef CONFIG_MMU -#define enter_lazy_tlb(mm, tsk) do { } while (0) - -static inline void get_new_mmu_context(struct mm_struct *mm) -{ - unsigned long mc = ++mmu_context_cache; - - if (!(mc & MMU_CONTEXT_ASID_MASK)) { - /* We exhaust ASID of this version. - Flush all TLB and start new cycle. */ - local_flush_tlb_all(); - /* Fix version if needed. - Note that we avoid version #0 to distinguish NO_CONTEXT. */ - if (!mc) - mmu_context_cache = mc = MMU_CONTEXT_FIRST_VERSION; - } - mm_context(mm) = mc; -} - -/* - * Get MMU context if needed. - */ -static inline void get_mmu_context(struct mm_struct *mm) -{ - if (mm) { - unsigned long mc = mmu_context_cache; - - /* Check if we have old version of context. - If it's old, we need to get new context with new version. */ - if ((mm_context(mm) ^ mc) & MMU_CONTEXT_VERSION_MASK) - get_new_mmu_context(mm); - } -} - -/* - * Initialize the context related info for a new mm_struct - * instance. - */ -static inline int init_new_context(struct task_struct *tsk, - struct mm_struct *mm) -{ -#ifndef CONFIG_SMP - mm->context = NO_CONTEXT; -#else /* CONFIG_SMP */ - int num_cpus = num_online_cpus(); - int i; - - for (i = 0 ; i < num_cpus ; i++) - mm->context[i] = NO_CONTEXT; -#endif /* CONFIG_SMP */ - - return 0; -} - -/* - * Destroy context related info for an mm_struct that is about - * to be put to rest. - */ -#define destroy_context(mm) do { } while (0) - -static inline void set_asid(unsigned long asid) -{ - *(volatile unsigned long *)MASID = (asid & MMU_CONTEXT_ASID_MASK); -} - -static inline unsigned long get_asid(void) -{ - unsigned long asid; - - asid = *(volatile long *)MASID; - asid &= MMU_CONTEXT_ASID_MASK; - - return asid; -} - -/* - * After we have set current->mm to a new value, this activates - * the context for the new mm so we see the new mappings. - */ -static inline void activate_context(struct mm_struct *mm) -{ - get_mmu_context(mm); - set_asid(mm_context(mm) & MMU_CONTEXT_ASID_MASK); -} - -static inline void switch_mm(struct mm_struct *prev, - struct mm_struct *next, struct task_struct *tsk) -{ -#ifdef CONFIG_SMP - int cpu = smp_processor_id(); -#endif /* CONFIG_SMP */ - - if (prev != next) { -#ifdef CONFIG_SMP - cpumask_set_cpu(cpu, mm_cpumask(next)); -#endif /* CONFIG_SMP */ - /* Set MPTB = next->pgd */ - *(volatile unsigned long *)MPTB = (unsigned long)next->pgd; - activate_context(next); - } -#ifdef CONFIG_SMP - else - if (!cpumask_test_and_set_cpu(cpu, mm_cpumask(next))) - activate_context(next); -#endif /* CONFIG_SMP */ -} - -#define deactivate_mm(tsk, mm) do { } while (0) - -#define activate_mm(prev, next) \ - switch_mm((prev), (next), NULL) - -#else /* not CONFIG_MMU */ -#define get_mmu_context(mm) do { } while (0) -#define init_new_context(tsk,mm) (0) -#define destroy_context(mm) do { } while (0) -#define set_asid(asid) do { } while (0) -#define get_asid() (0) -#define activate_context(mm) do { } while (0) -#define switch_mm(prev,next,tsk) do { } while (0) -#define deactivate_mm(mm,tsk) do { } while (0) -#define activate_mm(prev,next) do { } while (0) -#define enter_lazy_tlb(mm,tsk) do { } while (0) -#endif /* not CONFIG_MMU */ - -#endif /* not __ASSEMBLY__ */ - -#endif /* __KERNEL__ */ -#endif /* _ASM_M32R_MMU_CONTEXT_H */ diff --git a/arch/m32r/include/asm/mmzone.h b/arch/m32r/include/asm/mmzone.h deleted file mode 100644 index 568946c13ba67..0000000000000 --- a/arch/m32r/include/asm/mmzone.h +++ /dev/null @@ -1,54 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Written by Pat Gaughen (gone@us.ibm.com) Mar 2002 - * - */ - -#ifndef _ASM_MMZONE_H_ -#define _ASM_MMZONE_H_ - -#include - -#ifdef CONFIG_DISCONTIGMEM - -extern struct pglist_data *node_data[]; -#define NODE_DATA(nid) (node_data[nid]) - -#define node_localnr(pfn, nid) ((pfn) - NODE_DATA(nid)->node_start_pfn) - -#define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)) -/* - * pfn_valid should be made as fast as possible, and the current definition - * is valid for machines that are NUMA, but still contiguous, which is what - * is currently supported. A more generalised, but slower definition would - * be something like this - mbligh: - * ( pfn_to_pgdat(pfn) && ((pfn) < node_end_pfn(pfn_to_nid(pfn))) ) - */ -#if 1 /* M32R_FIXME */ -#define pfn_valid(pfn) (1) -#else -#define pfn_valid(pfn) ((pfn) < num_physpages) -#endif - -/* - * generic node memory support, the following assumptions apply: - */ - -static __inline__ int pfn_to_nid(unsigned long pfn) -{ - int node; - - for (node = 0 ; node < MAX_NUMNODES ; node++) - if (pfn >= node_start_pfn(node) && pfn < node_end_pfn(node)) - break; - - return node; -} - -static __inline__ struct pglist_data *pfn_to_pgdat(unsigned long pfn) -{ - return(NODE_DATA(pfn_to_nid(pfn))); -} - -#endif /* CONFIG_DISCONTIGMEM */ -#endif /* _ASM_MMZONE_H_ */ diff --git a/arch/m32r/include/asm/opsput/opsput_lan.h b/arch/m32r/include/asm/opsput/opsput_lan.h deleted file mode 100644 index a5f18dd1ab20b..0000000000000 --- a/arch/m32r/include/asm/opsput/opsput_lan.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef _OPSPUT_OPSPUT_LAN_H -#define _OPSPUT_OPSPUT_LAN_H - -/* - * include/asm-m32r/opsput/opsput_lan.h - * - * OPSPUT-LAN board - * - * Copyright (c) 2002-2004 Takeo Takahashi, Mamoru Sakugawa - * - * This file is subject to 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 __ASSEMBLY__ -/* - * C functions use non-cache address. - */ -#define OPSPUT_LAN_BASE (0x10000000 /* + NONCACHE_OFFSET */) -#else -#define OPSPUT_LAN_BASE (0x10000000 + NONCACHE_OFFSET) -#endif /* __ASSEMBLY__ */ - -/* ICU - * ICUISTS: status register - * ICUIREQ0: request register - * ICUIREQ1: request register - * ICUCR3: control register for CFIREQ# interrupt - * ICUCR4: control register for CFC Card insert interrupt - * ICUCR5: control register for CFC Card eject interrupt - * ICUCR6: control register for external interrupt - * ICUCR11: control register for MMC Card insert/eject interrupt - * ICUCR13: control register for SC error interrupt - * ICUCR14: control register for SC receive interrupt - * ICUCR15: control register for SC send interrupt - * ICUCR16: control register for SIO0 receive interrupt - * ICUCR17: control register for SIO0 send interrupt - */ -#define OPSPUT_LAN_IRQ_LAN (OPSPUT_LAN_PLD_IRQ_BASE + 1) /* LAN */ -#define OPSPUT_LAN_IRQ_I2C (OPSPUT_LAN_PLD_IRQ_BASE + 3) /* I2C */ - -#define OPSPUT_LAN_ICUISTS __reg16(OPSPUT_LAN_BASE + 0xc0002) -#define OPSPUT_LAN_ICUISTS_VECB_MASK (0xf000) -#define OPSPUT_LAN_VECB(x) ((x) & OPSPUT_LAN_ICUISTS_VECB_MASK) -#define OPSPUT_LAN_ICUISTS_ISN_MASK (0x07c0) -#define OPSPUT_LAN_ICUISTS_ISN(x) ((x) & OPSPUT_LAN_ICUISTS_ISN_MASK) -#define OPSPUT_LAN_ICUIREQ0 __reg16(OPSPUT_LAN_BASE + 0xc0004) -#define OPSPUT_LAN_ICUCR1 __reg16(OPSPUT_LAN_BASE + 0xc0010) -#define OPSPUT_LAN_ICUCR3 __reg16(OPSPUT_LAN_BASE + 0xc0014) - -#endif /* _OPSPUT_OPSPUT_LAN_H */ diff --git a/arch/m32r/include/asm/opsput/opsput_lcd.h b/arch/m32r/include/asm/opsput/opsput_lcd.h deleted file mode 100644 index 369c9f0832a6a..0000000000000 --- a/arch/m32r/include/asm/opsput/opsput_lcd.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef _OPSPUT_OPSPUT_LCD_H -#define _OPSPUT_OPSPUT_LCD_H - -/* - * include/asm-m32r/opsput/opsput_lcd.h - * - * OPSPUT-LCD board - * - * Copyright (c) 2002 Takeo Takahashi - * - * This file is subject to 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 __ASSEMBLY__ -/* - * C functions use non-cache address. - */ -#define OPSPUT_LCD_BASE (0x10000000 /* + NONCACHE_OFFSET */) -#else -#define OPSPUT_LCD_BASE (0x10000000 + NONCACHE_OFFSET) -#endif /* __ASSEMBLY__ */ - -/* - * ICU - */ -#define OPSPUT_LCD_IRQ_BAT_INT (OPSPUT_LCD_PLD_IRQ_BASE + 1) -#define OPSPUT_LCD_IRQ_USB_INT1 (OPSPUT_LCD_PLD_IRQ_BASE + 2) -#define OPSPUT_LCD_IRQ_AUDT0 (OPSPUT_LCD_PLD_IRQ_BASE + 3) -#define OPSPUT_LCD_IRQ_AUDT2 (OPSPUT_LCD_PLD_IRQ_BASE + 4) -#define OPSPUT_LCD_IRQ_BATSIO_RCV (OPSPUT_LCD_PLD_IRQ_BASE + 16) -#define OPSPUT_LCD_IRQ_BATSIO_SND (OPSPUT_LCD_PLD_IRQ_BASE + 17) -#define OPSPUT_LCD_IRQ_ASNDSIO_RCV (OPSPUT_LCD_PLD_IRQ_BASE + 18) -#define OPSPUT_LCD_IRQ_ASNDSIO_SND (OPSPUT_LCD_PLD_IRQ_BASE + 19) -#define OPSPUT_LCD_IRQ_ACNLSIO_SND (OPSPUT_LCD_PLD_IRQ_BASE + 21) - -#define OPSPUT_LCD_ICUISTS __reg16(OPSPUT_LCD_BASE + 0x300002) -#define OPSPUT_LCD_ICUISTS_VECB_MASK (0xf000) -#define OPSPUT_LCD_VECB(x) ((x) & OPSPUT_LCD_ICUISTS_VECB_MASK) -#define OPSPUT_LCD_ICUISTS_ISN_MASK (0x07c0) -#define OPSPUT_LCD_ICUISTS_ISN(x) ((x) & OPSPUT_LCD_ICUISTS_ISN_MASK) -#define OPSPUT_LCD_ICUIREQ0 __reg16(OPSPUT_LCD_BASE + 0x300004) -#define OPSPUT_LCD_ICUIREQ1 __reg16(OPSPUT_LCD_BASE + 0x300006) -#define OPSPUT_LCD_ICUCR1 __reg16(OPSPUT_LCD_BASE + 0x300020) -#define OPSPUT_LCD_ICUCR2 __reg16(OPSPUT_LCD_BASE + 0x300022) -#define OPSPUT_LCD_ICUCR3 __reg16(OPSPUT_LCD_BASE + 0x300024) -#define OPSPUT_LCD_ICUCR4 __reg16(OPSPUT_LCD_BASE + 0x300026) -#define OPSPUT_LCD_ICUCR16 __reg16(OPSPUT_LCD_BASE + 0x300030) -#define OPSPUT_LCD_ICUCR17 __reg16(OPSPUT_LCD_BASE + 0x300032) -#define OPSPUT_LCD_ICUCR18 __reg16(OPSPUT_LCD_BASE + 0x300034) -#define OPSPUT_LCD_ICUCR19 __reg16(OPSPUT_LCD_BASE + 0x300036) -#define OPSPUT_LCD_ICUCR21 __reg16(OPSPUT_LCD_BASE + 0x30003a) - -#endif /* _OPSPUT_OPSPUT_LCD_H */ diff --git a/arch/m32r/include/asm/opsput/opsput_pld.h b/arch/m32r/include/asm/opsput/opsput_pld.h deleted file mode 100644 index 6901401fe9eba..0000000000000 --- a/arch/m32r/include/asm/opsput/opsput_pld.h +++ /dev/null @@ -1,255 +0,0 @@ -#ifndef _OPSPUT_OPSPUT_PLD_H -#define _OPSPUT_OPSPUT_PLD_H - -/* - * include/asm-m32r/opsput/opsput_pld.h - * - * Definitions for Programmable Logic Device(PLD) on OPSPUT board. - * - * Copyright (c) 2002 Takeo Takahashi - * - * This file is subject to the terms and conditions of the GNU General - * Public License. See the file "COPYING" in the main directory of - * this archive for more details. - */ - -#define PLD_PLAT_BASE 0x1cc00000 - -#ifndef __ASSEMBLY__ -/* - * C functions use non-cache address. - */ -#define PLD_BASE (PLD_PLAT_BASE /* + NONCACHE_OFFSET */) -#define __reg8 (volatile unsigned char *) -#define __reg16 (volatile unsigned short *) -#define __reg32 (volatile unsigned int *) -#else -#define PLD_BASE (PLD_PLAT_BASE + NONCACHE_OFFSET) -#define __reg8 -#define __reg16 -#define __reg32 -#endif /* __ASSEMBLY__ */ - -/* CFC */ -#define PLD_CFRSTCR __reg16(PLD_BASE + 0x0000) -#define PLD_CFSTS __reg16(PLD_BASE + 0x0002) -#define PLD_CFIMASK __reg16(PLD_BASE + 0x0004) -#define PLD_CFBUFCR __reg16(PLD_BASE + 0x0006) -#define PLD_CFVENCR __reg16(PLD_BASE + 0x0008) -#define PLD_CFCR0 __reg16(PLD_BASE + 0x000a) -#define PLD_CFCR1 __reg16(PLD_BASE + 0x000c) -#define PLD_IDERSTCR __reg16(PLD_BASE + 0x0010) - -/* MMC */ -#define PLD_MMCCR __reg16(PLD_BASE + 0x4000) -#define PLD_MMCMOD __reg16(PLD_BASE + 0x4002) -#define PLD_MMCSTS __reg16(PLD_BASE + 0x4006) -#define PLD_MMCBAUR __reg16(PLD_BASE + 0x400a) -#define PLD_MMCCMDBCUT __reg16(PLD_BASE + 0x400c) -#define PLD_MMCCDTBCUT __reg16(PLD_BASE + 0x400e) -#define PLD_MMCDET __reg16(PLD_BASE + 0x4010) -#define PLD_MMCWP __reg16(PLD_BASE + 0x4012) -#define PLD_MMCWDATA __reg16(PLD_BASE + 0x5000) -#define PLD_MMCRDATA __reg16(PLD_BASE + 0x6000) -#define PLD_MMCCMDDATA __reg16(PLD_BASE + 0x7000) -#define PLD_MMCRSPDATA __reg16(PLD_BASE + 0x7006) - -/* ICU - * ICUISTS: status register - * ICUIREQ0: request register - * ICUIREQ1: request register - * ICUCR3: control register for CFIREQ# interrupt - * ICUCR4: control register for CFC Card insert interrupt - * ICUCR5: control register for CFC Card eject interrupt - * ICUCR6: control register for external interrupt - * ICUCR11: control register for MMC Card insert/eject interrupt - * ICUCR13: control register for SC error interrupt - * ICUCR14: control register for SC receive interrupt - * ICUCR15: control register for SC send interrupt - * ICUCR16: control register for SIO0 receive interrupt - * ICUCR17: control register for SIO0 send interrupt - */ -#if !defined(CONFIG_PLAT_USRV) -#define PLD_IRQ_INT0 (OPSPUT_PLD_IRQ_BASE + 0) /* None */ -#define PLD_IRQ_INT1 (OPSPUT_PLD_IRQ_BASE + 1) /* reserved */ -#define PLD_IRQ_INT2 (OPSPUT_PLD_IRQ_BASE + 2) /* reserved */ -#define PLD_IRQ_CFIREQ (OPSPUT_PLD_IRQ_BASE + 3) /* CF IREQ */ -#define PLD_IRQ_CFC_INSERT (OPSPUT_PLD_IRQ_BASE + 4) /* CF Insert */ -#define PLD_IRQ_CFC_EJECT (OPSPUT_PLD_IRQ_BASE + 5) /* CF Eject */ -#define PLD_IRQ_EXINT (OPSPUT_PLD_IRQ_BASE + 6) /* EXINT */ -#define PLD_IRQ_INT7 (OPSPUT_PLD_IRQ_BASE + 7) /* reserved */ -#define PLD_IRQ_INT8 (OPSPUT_PLD_IRQ_BASE + 8) /* reserved */ -#define PLD_IRQ_INT9 (OPSPUT_PLD_IRQ_BASE + 9) /* reserved */ -#define PLD_IRQ_INT10 (OPSPUT_PLD_IRQ_BASE + 10) /* reserved */ -#define PLD_IRQ_MMCCARD (OPSPUT_PLD_IRQ_BASE + 11) /* MMC Insert/Eject */ -#define PLD_IRQ_INT12 (OPSPUT_PLD_IRQ_BASE + 12) /* reserved */ -#define PLD_IRQ_SC_ERROR (OPSPUT_PLD_IRQ_BASE + 13) /* SC error */ -#define PLD_IRQ_SC_RCV (OPSPUT_PLD_IRQ_BASE + 14) /* SC receive */ -#define PLD_IRQ_SC_SND (OPSPUT_PLD_IRQ_BASE + 15) /* SC send */ -#define PLD_IRQ_SIO0_RCV (OPSPUT_PLD_IRQ_BASE + 16) /* SIO receive */ -#define PLD_IRQ_SIO0_SND (OPSPUT_PLD_IRQ_BASE + 17) /* SIO send */ -#define PLD_IRQ_INT18 (OPSPUT_PLD_IRQ_BASE + 18) /* reserved */ -#define PLD_IRQ_INT19 (OPSPUT_PLD_IRQ_BASE + 19) /* reserved */ -#define PLD_IRQ_INT20 (OPSPUT_PLD_IRQ_BASE + 20) /* reserved */ -#define PLD_IRQ_INT21 (OPSPUT_PLD_IRQ_BASE + 21) /* reserved */ -#define PLD_IRQ_INT22 (OPSPUT_PLD_IRQ_BASE + 22) /* reserved */ -#define PLD_IRQ_INT23 (OPSPUT_PLD_IRQ_BASE + 23) /* reserved */ -#define PLD_IRQ_INT24 (OPSPUT_PLD_IRQ_BASE + 24) /* reserved */ -#define PLD_IRQ_INT25 (OPSPUT_PLD_IRQ_BASE + 25) /* reserved */ -#define PLD_IRQ_INT26 (OPSPUT_PLD_IRQ_BASE + 26) /* reserved */ -#define PLD_IRQ_INT27 (OPSPUT_PLD_IRQ_BASE + 27) /* reserved */ -#define PLD_IRQ_INT28 (OPSPUT_PLD_IRQ_BASE + 28) /* reserved */ -#define PLD_IRQ_INT29 (OPSPUT_PLD_IRQ_BASE + 29) /* reserved */ -#define PLD_IRQ_INT30 (OPSPUT_PLD_IRQ_BASE + 30) /* reserved */ -#define PLD_IRQ_INT31 (OPSPUT_PLD_IRQ_BASE + 31) /* reserved */ - -#else /* CONFIG_PLAT_USRV */ - -#define PLD_IRQ_INT0 (OPSPUT_PLD_IRQ_BASE + 0) /* None */ -#define PLD_IRQ_INT1 (OPSPUT_PLD_IRQ_BASE + 1) /* reserved */ -#define PLD_IRQ_INT2 (OPSPUT_PLD_IRQ_BASE + 2) /* reserved */ -#define PLD_IRQ_CF0 (OPSPUT_PLD_IRQ_BASE + 3) /* CF0# */ -#define PLD_IRQ_CF1 (OPSPUT_PLD_IRQ_BASE + 4) /* CF1# */ -#define PLD_IRQ_CF2 (OPSPUT_PLD_IRQ_BASE + 5) /* CF2# */ -#define PLD_IRQ_CF3 (OPSPUT_PLD_IRQ_BASE + 6) /* CF3# */ -#define PLD_IRQ_CF4 (OPSPUT_PLD_IRQ_BASE + 7) /* CF4# */ -#define PLD_IRQ_INT8 (OPSPUT_PLD_IRQ_BASE + 8) /* reserved */ -#define PLD_IRQ_INT9 (OPSPUT_PLD_IRQ_BASE + 9) /* reserved */ -#define PLD_IRQ_INT10 (OPSPUT_PLD_IRQ_BASE + 10) /* reserved */ -#define PLD_IRQ_INT11 (OPSPUT_PLD_IRQ_BASE + 11) /* reserved */ -#define PLD_IRQ_UART0 (OPSPUT_PLD_IRQ_BASE + 12) /* UARTIRQ0 */ -#define PLD_IRQ_UART1 (OPSPUT_PLD_IRQ_BASE + 13) /* UARTIRQ1 */ -#define PLD_IRQ_INT14 (OPSPUT_PLD_IRQ_BASE + 14) /* reserved */ -#define PLD_IRQ_INT15 (OPSPUT_PLD_IRQ_BASE + 15) /* reserved */ -#define PLD_IRQ_SNDINT (OPSPUT_PLD_IRQ_BASE + 16) /* SNDINT# */ -#define PLD_IRQ_INT17 (OPSPUT_PLD_IRQ_BASE + 17) /* reserved */ -#define PLD_IRQ_INT18 (OPSPUT_PLD_IRQ_BASE + 18) /* reserved */ -#define PLD_IRQ_INT19 (OPSPUT_PLD_IRQ_BASE + 19) /* reserved */ -#define PLD_IRQ_INT20 (OPSPUT_PLD_IRQ_BASE + 20) /* reserved */ -#define PLD_IRQ_INT21 (OPSPUT_PLD_IRQ_BASE + 21) /* reserved */ -#define PLD_IRQ_INT22 (OPSPUT_PLD_IRQ_BASE + 22) /* reserved */ -#define PLD_IRQ_INT23 (OPSPUT_PLD_IRQ_BASE + 23) /* reserved */ -#define PLD_IRQ_INT24 (OPSPUT_PLD_IRQ_BASE + 24) /* reserved */ -#define PLD_IRQ_INT25 (OPSPUT_PLD_IRQ_BASE + 25) /* reserved */ -#define PLD_IRQ_INT26 (OPSPUT_PLD_IRQ_BASE + 26) /* reserved */ -#define PLD_IRQ_INT27 (OPSPUT_PLD_IRQ_BASE + 27) /* reserved */ -#define PLD_IRQ_INT28 (OPSPUT_PLD_IRQ_BASE + 28) /* reserved */ -#define PLD_IRQ_INT29 (OPSPUT_PLD_IRQ_BASE + 29) /* reserved */ -#define PLD_IRQ_INT30 (OPSPUT_PLD_IRQ_BASE + 30) /* reserved */ - -#endif /* CONFIG_PLAT_USRV */ - -#define PLD_ICUISTS __reg16(PLD_BASE + 0x8002) -#define PLD_ICUISTS_VECB_MASK (0xf000) -#define PLD_ICUISTS_VECB(x) ((x) & PLD_ICUISTS_VECB_MASK) -#define PLD_ICUISTS_ISN_MASK (0x07c0) -#define PLD_ICUISTS_ISN(x) ((x) & PLD_ICUISTS_ISN_MASK) -#define PLD_ICUIREQ0 __reg16(PLD_BASE + 0x8004) -#define PLD_ICUIREQ1 __reg16(PLD_BASE + 0x8006) -#define PLD_ICUCR1 __reg16(PLD_BASE + 0x8100) -#define PLD_ICUCR2 __reg16(PLD_BASE + 0x8102) -#define PLD_ICUCR3 __reg16(PLD_BASE + 0x8104) -#define PLD_ICUCR4 __reg16(PLD_BASE + 0x8106) -#define PLD_ICUCR5 __reg16(PLD_BASE + 0x8108) -#define PLD_ICUCR6 __reg16(PLD_BASE + 0x810a) -#define PLD_ICUCR7 __reg16(PLD_BASE + 0x810c) -#define PLD_ICUCR8 __reg16(PLD_BASE + 0x810e) -#define PLD_ICUCR9 __reg16(PLD_BASE + 0x8110) -#define PLD_ICUCR10 __reg16(PLD_BASE + 0x8112) -#define PLD_ICUCR11 __reg16(PLD_BASE + 0x8114) -#define PLD_ICUCR12 __reg16(PLD_BASE + 0x8116) -#define PLD_ICUCR13 __reg16(PLD_BASE + 0x8118) -#define PLD_ICUCR14 __reg16(PLD_BASE + 0x811a) -#define PLD_ICUCR15 __reg16(PLD_BASE + 0x811c) -#define PLD_ICUCR16 __reg16(PLD_BASE + 0x811e) -#define PLD_ICUCR17 __reg16(PLD_BASE + 0x8120) -#define PLD_ICUCR_IEN (0x1000) -#define PLD_ICUCR_IREQ (0x0100) -#define PLD_ICUCR_ISMOD00 (0x0000) /* Low edge */ -#define PLD_ICUCR_ISMOD01 (0x0010) /* Low level */ -#define PLD_ICUCR_ISMOD02 (0x0020) /* High edge */ -#define PLD_ICUCR_ISMOD03 (0x0030) /* High level */ -#define PLD_ICUCR_ILEVEL0 (0x0000) -#define PLD_ICUCR_ILEVEL1 (0x0001) -#define PLD_ICUCR_ILEVEL2 (0x0002) -#define PLD_ICUCR_ILEVEL3 (0x0003) -#define PLD_ICUCR_ILEVEL4 (0x0004) -#define PLD_ICUCR_ILEVEL5 (0x0005) -#define PLD_ICUCR_ILEVEL6 (0x0006) -#define PLD_ICUCR_ILEVEL7 (0x0007) - -/* Power Control of MMC and CF */ -#define PLD_CPCR __reg16(PLD_BASE + 0x14000) -#define PLD_CPCR_CF 0x0001 -#define PLD_CPCR_MMC 0x0002 - -/* LED Control - * - * 1: DIP swich side - * 2: Reset switch side - */ -#define PLD_IOLEDCR __reg16(PLD_BASE + 0x14002) -#define PLD_IOLED_1_ON 0x001 -#define PLD_IOLED_1_OFF 0x000 -#define PLD_IOLED_2_ON 0x002 -#define PLD_IOLED_2_OFF 0x000 - -/* DIP Switch - * 0: Write-protect of Flash Memory (0:protected, 1:non-protected) - * 1: - - * 2: - - * 3: - - */ -#define PLD_IOSWSTS __reg16(PLD_BASE + 0x14004) -#define PLD_IOSWSTS_IOSW2 0x0200 -#define PLD_IOSWSTS_IOSW1 0x0100 -#define PLD_IOSWSTS_IOWP0 0x0001 - -/* CRC */ -#define PLD_CRC7DATA __reg16(PLD_BASE + 0x18000) -#define PLD_CRC7INDATA __reg16(PLD_BASE + 0x18002) -#define PLD_CRC16DATA __reg16(PLD_BASE + 0x18004) -#define PLD_CRC16INDATA __reg16(PLD_BASE + 0x18006) -#define PLD_CRC16ADATA __reg16(PLD_BASE + 0x18008) -#define PLD_CRC16AINDATA __reg16(PLD_BASE + 0x1800a) - -/* RTC */ -#define PLD_RTCCR __reg16(PLD_BASE + 0x1c000) -#define PLD_RTCBAUR __reg16(PLD_BASE + 0x1c002) -#define PLD_RTCWRDATA __reg16(PLD_BASE + 0x1c004) -#define PLD_RTCRDDATA __reg16(PLD_BASE + 0x1c006) -#define PLD_RTCRSTODT __reg16(PLD_BASE + 0x1c008) - -/* SIO0 */ -#define PLD_ESIO0CR __reg16(PLD_BASE + 0x20000) -#define PLD_ESIO0CR_TXEN 0x0001 -#define PLD_ESIO0CR_RXEN 0x0002 -#define PLD_ESIO0MOD0 __reg16(PLD_BASE + 0x20002) -#define PLD_ESIO0MOD0_CTSS 0x0040 -#define PLD_ESIO0MOD0_RTSS 0x0080 -#define PLD_ESIO0MOD1 __reg16(PLD_BASE + 0x20004) -#define PLD_ESIO0MOD1_LMFS 0x0010 -#define PLD_ESIO0STS __reg16(PLD_BASE + 0x20006) -#define PLD_ESIO0STS_TEMP 0x0001 -#define PLD_ESIO0STS_TXCP 0x0002 -#define PLD_ESIO0STS_RXCP 0x0004 -#define PLD_ESIO0STS_TXSC 0x0100 -#define PLD_ESIO0STS_RXSC 0x0200 -#define PLD_ESIO0STS_TXREADY (PLD_ESIO0STS_TXCP | PLD_ESIO0STS_TEMP) -#define PLD_ESIO0INTCR __reg16(PLD_BASE + 0x20008) -#define PLD_ESIO0INTCR_TXIEN 0x0002 -#define PLD_ESIO0INTCR_RXCEN 0x0004 -#define PLD_ESIO0BAUR __reg16(PLD_BASE + 0x2000a) -#define PLD_ESIO0TXB __reg16(PLD_BASE + 0x2000c) -#define PLD_ESIO0RXB __reg16(PLD_BASE + 0x2000e) - -/* SIM Card */ -#define PLD_SCCR __reg16(PLD_BASE + 0x38000) -#define PLD_SCMOD __reg16(PLD_BASE + 0x38004) -#define PLD_SCSTS __reg16(PLD_BASE + 0x38006) -#define PLD_SCINTCR __reg16(PLD_BASE + 0x38008) -#define PLD_SCBAUR __reg16(PLD_BASE + 0x3800a) -#define PLD_SCTXB __reg16(PLD_BASE + 0x3800c) -#define PLD_SCRXB __reg16(PLD_BASE + 0x3800e) - -#endif /* _OPSPUT_OPSPUT_PLD.H */ diff --git a/arch/m32r/include/asm/page.h b/arch/m32r/include/asm/page.h deleted file mode 100644 index fe4e38b394d30..0000000000000 --- a/arch/m32r/include/asm/page.h +++ /dev/null @@ -1,90 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_M32R_PAGE_H -#define _ASM_M32R_PAGE_H - -#include - -/* PAGE_SHIFT determines the page size */ -#define PAGE_SHIFT 12 -#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) -#define PAGE_MASK (~(PAGE_SIZE-1)) - -#ifndef __ASSEMBLY__ - -extern void clear_page(void *to); -extern void copy_page(void *to, void *from); - -#define clear_user_page(page, vaddr, pg) clear_page(page) -#define copy_user_page(to, from, vaddr, pg) copy_page(to, from) - -#define __alloc_zeroed_user_highpage(movableflags, vma, vaddr) \ - alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr) -#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE - -/* - * These are used to make use of C type-checking.. - */ -typedef struct { unsigned long pte; } pte_t; -typedef struct { unsigned long pmd; } pmd_t; -typedef struct { unsigned long pgd; } pgd_t; -#define pte_val(x) ((x).pte) -#define PTE_MASK PAGE_MASK - -typedef struct { unsigned long pgprot; } pgprot_t; -typedef struct page *pgtable_t; - -#define pmd_val(x) ((x).pmd) -#define pgd_val(x) ((x).pgd) -#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) } ) - -#endif /* !__ASSEMBLY__ */ - -/* - * This handles the memory map.. We could make this a config - * option, but too many people screw it up, and too few need - * it. - * - * A __PAGE_OFFSET of 0xC0000000 means that the kernel has - * a virtual address space of one gigabyte, which limits the - * amount of physical memory you can use to about 950MB. - * - * If you want more physical memory than this then see the CONFIG_HIGHMEM4G - * and CONFIG_HIGHMEM64G options in the kernel configuration. - */ - -#define __MEMORY_START CONFIG_MEMORY_START -#define __MEMORY_SIZE CONFIG_MEMORY_SIZE - -#ifdef CONFIG_MMU -#define __PAGE_OFFSET (0x80000000) -#else -#define __PAGE_OFFSET (0x00000000) -#endif - -#define PAGE_OFFSET ((unsigned long)__PAGE_OFFSET) -#define __pa(x) ((unsigned long)(x) - PAGE_OFFSET) -#define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET)) - -#ifndef CONFIG_DISCONTIGMEM -#define PFN_BASE (CONFIG_MEMORY_START >> PAGE_SHIFT) -#define ARCH_PFN_OFFSET PFN_BASE -#define pfn_valid(pfn) (((pfn) - PFN_BASE) < max_mapnr) -#endif /* !CONFIG_DISCONTIGMEM */ - -#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) -#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) - -#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ - VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC ) - -#define devmem_is_allowed(x) 1 - -#include -#include - -#endif /* _ASM_M32R_PAGE_H */ diff --git a/arch/m32r/include/asm/pci.h b/arch/m32r/include/asm/pci.h deleted file mode 100644 index cbcb28b5f6ffd..0000000000000 --- a/arch/m32r/include/asm/pci.h +++ /dev/null @@ -1,7 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_M32R_PCI_H -#define _ASM_M32R_PCI_H - -#include - -#endif /* _ASM_M32R_PCI_H */ diff --git a/arch/m32r/include/asm/percpu.h b/arch/m32r/include/asm/percpu.h deleted file mode 100644 index 41e1680d11174..0000000000000 --- a/arch/m32r/include/asm/percpu.h +++ /dev/null @@ -1,7 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __ARCH_M32R_PERCPU__ -#define __ARCH_M32R_PERCPU__ - -#include - -#endif /* __ARCH_M32R_PERCPU__ */ diff --git a/arch/m32r/include/asm/pgalloc.h b/arch/m32r/include/asm/pgalloc.h deleted file mode 100644 index eed2cad57d681..0000000000000 --- a/arch/m32r/include/asm/pgalloc.h +++ /dev/null @@ -1,82 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_M32R_PGALLOC_H -#define _ASM_M32R_PGALLOC_H - -#include - -#include - -#define pmd_populate_kernel(mm, pmd, pte) \ - set_pmd(pmd, __pmd(_PAGE_TABLE + __pa(pte))) - -static __inline__ void pmd_populate(struct mm_struct *mm, pmd_t *pmd, - pgtable_t pte) -{ - set_pmd(pmd, __pmd(_PAGE_TABLE + page_to_phys(pte))); -} -#define pmd_pgtable(pmd) pmd_page(pmd) - -/* - * Allocate and free page tables. - */ -static __inline__ pgd_t *pgd_alloc(struct mm_struct *mm) -{ - pgd_t *pgd = (pgd_t *)__get_free_page(GFP_KERNEL|__GFP_ZERO); - - return pgd; -} - -static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) -{ - free_page((unsigned long)pgd); -} - -static __inline__ pte_t *pte_alloc_one_kernel(struct mm_struct *mm, - unsigned long address) -{ - pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_ZERO); - - return pte; -} - -static __inline__ pgtable_t pte_alloc_one(struct mm_struct *mm, - unsigned long address) -{ - struct page *pte = alloc_page(GFP_KERNEL|__GFP_ZERO); - - if (!pte) - return NULL; - if (!pgtable_page_ctor(pte)) { - __free_page(pte); - return NULL; - } - return pte; -} - -static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) -{ - free_page((unsigned long)pte); -} - -static inline void pte_free(struct mm_struct *mm, pgtable_t pte) -{ - pgtable_page_dtor(pte); - __free_page(pte); -} - -#define __pte_free_tlb(tlb, pte, addr) pte_free((tlb)->mm, (pte)) - -/* - * allocating and freeing a pmd is trivial: the 1-entry pmd is - * inside the pgd, so has no extra memory associated with it. - * (In the PAE case we free the pmds as part of the pgd.) - */ - -#define pmd_alloc_one(mm, addr) ({ BUG(); ((pmd_t *)2); }) -#define pmd_free(mm, x) do { } while (0) -#define __pmd_free_tlb(tlb, x, addr) do { } while (0) -#define pgd_populate(mm, pmd, pte) BUG() - -#define check_pgt_cache() do { } while (0) - -#endif /* _ASM_M32R_PGALLOC_H */ diff --git a/arch/m32r/include/asm/pgtable-2level.h b/arch/m32r/include/asm/pgtable-2level.h deleted file mode 100644 index d7ab1e94e3cb1..0000000000000 --- a/arch/m32r/include/asm/pgtable-2level.h +++ /dev/null @@ -1,76 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_M32R_PGTABLE_2LEVEL_H -#define _ASM_M32R_PGTABLE_2LEVEL_H -#ifdef __KERNEL__ - -/* - * traditional M32R two-level paging structure: - */ - -#define PGDIR_SHIFT 22 -#define PTRS_PER_PGD 1024 - -/* - * the M32R is two-level, so we don't really have any - * PMD directory physically. - */ -#define __PAGETABLE_PMD_FOLDED -#define PMD_SHIFT 22 -#define PTRS_PER_PMD 1 - -#define PTRS_PER_PTE 1024 - -#define pte_ERROR(e) \ - printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e)) -#define pmd_ERROR(e) \ - printk("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, pmd_val(e)) -#define pgd_ERROR(e) \ - printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e)) - -/* - * The "pgd_xxx()" functions here are trivial for a folded two-level - * setup: the pgd is never bad, and a pmd always exists (as it's folded - * into the pgd entry) - */ -static inline int pgd_none(pgd_t pgd) { return 0; } -static inline int pgd_bad(pgd_t pgd) { return 0; } -static inline int pgd_present(pgd_t pgd) { return 1; } -#define pgd_clear(xp) do { } while (0) - -/* - * Certain architectures need to do special things when PTEs - * within a page table are directly modified. Thus, the following - * hook is made available. - */ -#define set_pte(pteptr, pteval) (*(pteptr) = pteval) -#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval) - -/* - * (pmds are folded into pgds so this doesn't get actually called, - * but the define is needed for a generic inline function.) - */ -#define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval) -#define set_pgd(pgdptr, pgdval) (*(pgdptr) = pgdval) - -#define pgd_page_vaddr(pgd) \ -((unsigned long) __va(pgd_val(pgd) & PAGE_MASK)) - -#ifndef CONFIG_DISCONTIGMEM -#define pgd_page(pgd) (mem_map + ((pgd_val(pgd) >> PAGE_SHIFT) - PFN_BASE)) -#endif /* !CONFIG_DISCONTIGMEM */ - -static inline pmd_t *pmd_offset(pgd_t * dir, unsigned long address) -{ - return (pmd_t *) dir; -} - -#define ptep_get_and_clear(mm,addr,xp) __pte(xchg(&(xp)->pte, 0)) -#define pte_same(a, b) (pte_val(a) == pte_val(b)) -#define pte_page(x) pfn_to_page(pte_pfn(x)) -#define pte_none(x) (!pte_val(x)) -#define pte_pfn(x) (pte_val(x) >> PAGE_SHIFT) -#define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) -#define pfn_pmd(pfn, prot) __pmd(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) - -#endif /* __KERNEL__ */ -#endif /* _ASM_M32R_PGTABLE_2LEVEL_H */ diff --git a/arch/m32r/include/asm/pgtable.h b/arch/m32r/include/asm/pgtable.h deleted file mode 100644 index eb7f9050c8d61..0000000000000 --- a/arch/m32r/include/asm/pgtable.h +++ /dev/null @@ -1,348 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_M32R_PGTABLE_H -#define _ASM_M32R_PGTABLE_H - -#include - -#ifdef __KERNEL__ -/* - * The Linux memory management assumes a three-level page table setup. On - * the M32R, we use that, but "fold" the mid level into the top-level page - * table, so that we physically have the same two-level page table as the - * M32R mmu expects. - * - * This file contains the functions and defines necessary to modify and use - * the M32R page table tree. - */ - -/* CAUTION!: If you change macro definitions in this file, you might have to - * change arch/m32r/mmu.S manually. - */ - -#ifndef __ASSEMBLY__ - -#include -#include -#include -#include -#include - -struct mm_struct; -struct vm_area_struct; - -extern pgd_t swapper_pg_dir[1024]; -extern void paging_init(void); - -/* - * ZERO_PAGE is a global shared page that is always zero: used - * for zero-mapped memory areas etc.. - */ -extern unsigned long empty_zero_page[1024]; -#define ZERO_PAGE(vaddr) (virt_to_page(empty_zero_page)) - -#endif /* !__ASSEMBLY__ */ - -#ifndef __ASSEMBLY__ -#include -#endif - -#define pgtable_cache_init() do { } while (0) - -#define PMD_SIZE (1UL << PMD_SHIFT) -#define PMD_MASK (~(PMD_SIZE - 1)) -#define PGDIR_SIZE (1UL << PGDIR_SHIFT) -#define PGDIR_MASK (~(PGDIR_SIZE - 1)) - -#define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SIZE) -#define FIRST_USER_ADDRESS 0UL - -#ifndef __ASSEMBLY__ -/* Just any arbitrary offset to the start of the vmalloc VM area: the - * current 8MB value just means that there will be a 8MB "hole" after the - * physical memory until the kernel virtual memory starts. That means that - * any out-of-bounds memory accesses will hopefully be caught. - * The vmalloc() routines leaves a hole of 4kB between each vmalloced - * area for the same reason. ;) - */ -#define VMALLOC_START KSEG2 -#define VMALLOC_END KSEG3 - -/* - * M32R TLB format - * - * [0] [1:19] [20:23] [24:31] - * +-----------------------+----+-------------+ - * | VPN |0000| ASID | - * +-----------------------+----+-------------+ - * +-+---------------------+----+-+---+-+-+-+-+ - * |0 PPN |0000|N|AC |L|G|V| | - * +-+---------------------+----+-+---+-+-+-+-+ - * RWX - */ - -#define _PAGE_BIT_DIRTY 0 /* software: page changed */ -#define _PAGE_BIT_PRESENT 1 /* Valid: page is valid */ -#define _PAGE_BIT_GLOBAL 2 /* Global */ -#define _PAGE_BIT_LARGE 3 /* Large */ -#define _PAGE_BIT_EXEC 4 /* Execute */ -#define _PAGE_BIT_WRITE 5 /* Write */ -#define _PAGE_BIT_READ 6 /* Read */ -#define _PAGE_BIT_NONCACHABLE 7 /* Non cachable */ -#define _PAGE_BIT_ACCESSED 8 /* software: page referenced */ -#define _PAGE_BIT_PROTNONE 9 /* software: if not present */ - -#define _PAGE_DIRTY (1UL << _PAGE_BIT_DIRTY) -#define _PAGE_PRESENT (1UL << _PAGE_BIT_PRESENT) -#define _PAGE_GLOBAL (1UL << _PAGE_BIT_GLOBAL) -#define _PAGE_LARGE (1UL << _PAGE_BIT_LARGE) -#define _PAGE_EXEC (1UL << _PAGE_BIT_EXEC) -#define _PAGE_WRITE (1UL << _PAGE_BIT_WRITE) -#define _PAGE_READ (1UL << _PAGE_BIT_READ) -#define _PAGE_NONCACHABLE (1UL << _PAGE_BIT_NONCACHABLE) -#define _PAGE_ACCESSED (1UL << _PAGE_BIT_ACCESSED) -#define _PAGE_PROTNONE (1UL << _PAGE_BIT_PROTNONE) - -#define _PAGE_TABLE \ - ( _PAGE_PRESENT | _PAGE_WRITE | _PAGE_READ | _PAGE_ACCESSED \ - | _PAGE_DIRTY ) -#define _KERNPG_TABLE \ - ( _PAGE_PRESENT | _PAGE_WRITE | _PAGE_READ | _PAGE_ACCESSED \ - | _PAGE_DIRTY ) -#define _PAGE_CHG_MASK \ - ( PTE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY ) - -#ifdef CONFIG_MMU -#define PAGE_NONE \ - __pgprot(_PAGE_PROTNONE | _PAGE_ACCESSED) -#define PAGE_SHARED \ - __pgprot(_PAGE_PRESENT | _PAGE_WRITE | _PAGE_READ | _PAGE_ACCESSED) -#define PAGE_SHARED_EXEC \ - __pgprot(_PAGE_PRESENT | _PAGE_EXEC | _PAGE_WRITE | _PAGE_READ \ - | _PAGE_ACCESSED) -#define PAGE_COPY \ - __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_ACCESSED) -#define PAGE_COPY_EXEC \ - __pgprot(_PAGE_PRESENT | _PAGE_EXEC | _PAGE_READ | _PAGE_ACCESSED) -#define PAGE_READONLY \ - __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_ACCESSED) -#define PAGE_READONLY_EXEC \ - __pgprot(_PAGE_PRESENT | _PAGE_EXEC | _PAGE_READ | _PAGE_ACCESSED) - -#define __PAGE_KERNEL \ - ( _PAGE_PRESENT | _PAGE_EXEC | _PAGE_WRITE | _PAGE_READ | _PAGE_DIRTY \ - | _PAGE_ACCESSED ) -#define __PAGE_KERNEL_RO ( __PAGE_KERNEL & ~_PAGE_WRITE ) -#define __PAGE_KERNEL_NOCACHE ( __PAGE_KERNEL | _PAGE_NONCACHABLE) - -#define MAKE_GLOBAL(x) __pgprot((x) | _PAGE_GLOBAL) - -#define PAGE_KERNEL MAKE_GLOBAL(__PAGE_KERNEL) -#define PAGE_KERNEL_RO MAKE_GLOBAL(__PAGE_KERNEL_RO) -#define PAGE_KERNEL_NOCACHE MAKE_GLOBAL(__PAGE_KERNEL_NOCACHE) - -#else -#define PAGE_NONE __pgprot(0) -#define PAGE_SHARED __pgprot(0) -#define PAGE_SHARED_EXEC __pgprot(0) -#define PAGE_COPY __pgprot(0) -#define PAGE_COPY_EXEC __pgprot(0) -#define PAGE_READONLY __pgprot(0) -#define PAGE_READONLY_EXEC __pgprot(0) - -#define PAGE_KERNEL __pgprot(0) -#define PAGE_KERNEL_RO __pgprot(0) -#define PAGE_KERNEL_NOCACHE __pgprot(0) -#endif /* CONFIG_MMU */ - - /* xwr */ -#define __P000 PAGE_NONE -#define __P001 PAGE_READONLY -#define __P010 PAGE_COPY -#define __P011 PAGE_COPY -#define __P100 PAGE_READONLY_EXEC -#define __P101 PAGE_READONLY_EXEC -#define __P110 PAGE_COPY_EXEC -#define __P111 PAGE_COPY_EXEC - -#define __S000 PAGE_NONE -#define __S001 PAGE_READONLY -#define __S010 PAGE_SHARED -#define __S011 PAGE_SHARED -#define __S100 PAGE_READONLY_EXEC -#define __S101 PAGE_READONLY_EXEC -#define __S110 PAGE_SHARED_EXEC -#define __S111 PAGE_SHARED_EXEC - -/* page table for 0-4MB for everybody */ - -#define pte_present(x) (pte_val(x) & (_PAGE_PRESENT | _PAGE_PROTNONE)) -#define pte_clear(mm,addr,xp) do { set_pte_at(mm, addr, xp, __pte(0)); } while (0) - -#define pmd_none(x) (!pmd_val(x)) -#define pmd_present(x) (pmd_val(x) & _PAGE_PRESENT) -#define pmd_clear(xp) do { set_pmd(xp, __pmd(0)); } while (0) -#define pmd_bad(x) ((pmd_val(x) & ~PAGE_MASK) != _KERNPG_TABLE) - -#define pages_to_mb(x) ((x) >> (20 - PAGE_SHIFT)) - -/* - * The following only work if pte_present() is true. - * Undefined behaviour if not.. - */ -static inline int pte_dirty(pte_t pte) -{ - return pte_val(pte) & _PAGE_DIRTY; -} - -static inline int pte_young(pte_t pte) -{ - return pte_val(pte) & _PAGE_ACCESSED; -} - -static inline int pte_write(pte_t pte) -{ - return pte_val(pte) & _PAGE_WRITE; -} - -static inline int pte_special(pte_t pte) -{ - return 0; -} - -static inline pte_t pte_mkclean(pte_t pte) -{ - pte_val(pte) &= ~_PAGE_DIRTY; - return pte; -} - -static inline pte_t pte_mkold(pte_t pte) -{ - pte_val(pte) &= ~_PAGE_ACCESSED; - return pte; -} - -static inline pte_t pte_wrprotect(pte_t pte) -{ - pte_val(pte) &= ~_PAGE_WRITE; - return pte; -} - -static inline pte_t pte_mkdirty(pte_t pte) -{ - pte_val(pte) |= _PAGE_DIRTY; - return pte; -} - -static inline pte_t pte_mkyoung(pte_t pte) -{ - pte_val(pte) |= _PAGE_ACCESSED; - return pte; -} - -static inline pte_t pte_mkwrite(pte_t pte) -{ - pte_val(pte) |= _PAGE_WRITE; - return pte; -} - -static inline pte_t pte_mkspecial(pte_t pte) -{ - return pte; -} - -static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, unsigned long addr, pte_t *ptep) -{ - return test_and_clear_bit(_PAGE_BIT_ACCESSED, ptep); -} - -static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep) -{ - clear_bit(_PAGE_BIT_WRITE, ptep); -} - -/* - * Macro and implementation to make a page protection as uncachable. - */ -static inline pgprot_t pgprot_noncached(pgprot_t _prot) -{ - unsigned long prot = pgprot_val(_prot); - - prot |= _PAGE_NONCACHABLE; - return __pgprot(prot); -} - -#define pgprot_writecombine(prot) pgprot_noncached(prot) - -/* - * Conversion functions: convert a page and protection to a page entry, - * and a page entry and page directory to the page they refer to. - */ -#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), pgprot) - -static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) -{ - set_pte(&pte, __pte((pte_val(pte) & _PAGE_CHG_MASK) \ - | pgprot_val(newprot))); - - return pte; -} - -/* - * Conversion functions: convert a page and protection to a page entry, - * and a page entry and page directory to the page they refer to. - */ - -static inline void pmd_set(pmd_t * pmdp, pte_t * ptep) -{ - pmd_val(*pmdp) = (((unsigned long) ptep) & PAGE_MASK); -} - -#define pmd_page_vaddr(pmd) \ - ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) - -#ifndef CONFIG_DISCONTIGMEM -#define pmd_page(pmd) (mem_map + ((pmd_val(pmd) >> PAGE_SHIFT) - PFN_BASE)) -#endif /* !CONFIG_DISCONTIGMEM */ - -/* to find an entry in a page-table-directory. */ -#define pgd_index(address) \ - (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1)) - -#define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address)) - -/* to find an entry in a kernel page-table-directory */ -#define pgd_offset_k(address) pgd_offset(&init_mm, address) - -#define pmd_index(address) \ - (((address) >> PMD_SHIFT) & (PTRS_PER_PMD - 1)) - -#define pte_index(address) \ - (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) -#define pte_offset_kernel(dir, address) \ - ((pte_t *)pmd_page_vaddr(*(dir)) + pte_index(address)) -#define pte_offset_map(dir, address) \ - ((pte_t *)page_address(pmd_page(*(dir))) + pte_index(address)) -#define pte_unmap(pte) do { } while (0) - -/* Encode and de-code a swap entry */ -#define __swp_type(x) (((x).val >> 2) & 0x1f) -#define __swp_offset(x) ((x).val >> 10) -#define __swp_entry(type, offset) \ - ((swp_entry_t) { ((type) << 2) | ((offset) << 10) }) -#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) -#define __swp_entry_to_pte(x) ((pte_t) { (x).val }) - -#endif /* !__ASSEMBLY__ */ - -/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */ -#define kern_addr_valid(addr) (1) - -#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG -#define __HAVE_ARCH_PTEP_GET_AND_CLEAR -#define __HAVE_ARCH_PTEP_SET_WRPROTECT -#define __HAVE_ARCH_PTE_SAME -#include - -#endif /* __KERNEL__ */ - -#endif /* _ASM_M32R_PGTABLE_H */ diff --git a/arch/m32r/include/asm/processor.h b/arch/m32r/include/asm/processor.h deleted file mode 100644 index c70fa9ac71690..0000000000000 --- a/arch/m32r/include/asm/processor.h +++ /dev/null @@ -1,127 +0,0 @@ -#ifndef _ASM_M32R_PROCESSOR_H -#define _ASM_M32R_PROCESSOR_H - -/* - * include/asm-m32r/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) 1994 Linus Torvalds - * Copyright (C) 2001 Hiroyuki Kondo, Hirokazu Takata, and Hitoshi Yamamoto - * Copyright (C) 2004 Hirokazu Takata - */ - -#include -#include -#include /* pt_regs */ - -/* - * Default implementation of macro that returns current - * instruction pointer ("program counter"). - */ -#define current_text_addr() ({ __label__ _l; _l: &&_l; }) - -/* - * CPU type and hardware bug flags. Kept separately for each CPU. - * Members of this structure are referenced in head.S, so think twice - * before touching them. [mj] - */ - -struct cpuinfo_m32r { - unsigned long pgtable_cache_sz; - unsigned long cpu_clock; - unsigned long bus_clock; - unsigned long timer_divide; - unsigned long loops_per_jiffy; -}; - -/* - * capabilities of CPUs - */ - -extern struct cpuinfo_m32r boot_cpu_data; - -#ifdef CONFIG_SMP -extern struct cpuinfo_m32r cpu_data[]; -#define current_cpu_data cpu_data[smp_processor_id()] -#else -#define cpu_data (&boot_cpu_data) -#define current_cpu_data boot_cpu_data -#endif - -/* - * User space process size: 2GB (default). - */ -#ifdef CONFIG_MMU -#define TASK_SIZE (0x80000000UL) -#else -#define TASK_SIZE (0x00400000UL) -#endif - -#ifdef __KERNEL__ -#define STACK_TOP TASK_SIZE -#define STACK_TOP_MAX STACK_TOP -#endif - -/* This decides where the kernel will search for a free chunk of vm - * space during mmap's. - */ -#define TASK_UNMAPPED_BASE PAGE_ALIGN(TASK_SIZE / 3) - -typedef struct { - unsigned long seg; -} mm_segment_t; - -#define MAX_TRAPS 10 - -struct debug_trap { - int nr_trap; - unsigned long addr[MAX_TRAPS]; - unsigned long insn[MAX_TRAPS]; -}; - -struct thread_struct { - unsigned long address; - unsigned long trap_no; /* Trap number */ - unsigned long error_code; /* Error code of trap */ - unsigned long lr; /* saved pc */ - unsigned long sp; /* user stack pointer */ - struct debug_trap debug_trap; -}; - -#define INIT_SP (sizeof(init_stack) + (unsigned long) &init_stack) - -#define INIT_THREAD { \ - .sp = INIT_SP, \ -} - -/* - * Do necessary setup to start up a newly executed thread. - */ - -/* User process Backup PSW */ -#define USERPS_BPSW (M32R_PSW_BSM|M32R_PSW_BIE|M32R_PSW_BPM) - -#define start_thread(regs, new_pc, new_spu) \ - do { \ - regs->psw = (regs->psw | USERPS_BPSW) & 0x0000FFFFUL; \ - regs->bpc = new_pc; \ - regs->spu = new_spu; \ - } while (0) - -/* Forward declaration, a strange C thing */ -struct task_struct; -struct mm_struct; - -/* Free all resources held by a thread. */ -extern void release_thread(struct task_struct *); - -unsigned long get_wchan(struct task_struct *p); -#define KSTK_EIP(tsk) ((tsk)->thread.lr) -#define KSTK_ESP(tsk) ((tsk)->thread.sp) - -#define cpu_relax() barrier() - -#endif /* _ASM_M32R_PROCESSOR_H */ diff --git a/arch/m32r/include/asm/ptrace.h b/arch/m32r/include/asm/ptrace.h deleted file mode 100644 index fa58ccfff865e..0000000000000 --- a/arch/m32r/include/asm/ptrace.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * linux/include/asm-m32r/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. - * - * M32R version: - * Copyright (C) 2001-2002, 2004 Hirokazu Takata - */ -#ifndef _ASM_M32R_PTRACE_H -#define _ASM_M32R_PTRACE_H - - -#include /* M32R_PSW_BSM, M32R_PSW_BPM */ -#include - -#define arch_has_single_step() (1) - -struct task_struct; -extern void init_debug_traps(struct task_struct *); -#define arch_ptrace_attach(child) \ - init_debug_traps(child) - -#if defined(CONFIG_ISA_M32R2) || defined(CONFIG_CHIP_VDEC2) -#define user_mode(regs) ((M32R_PSW_BPM & (regs)->psw) != 0) -#elif defined(CONFIG_ISA_M32R) -#define user_mode(regs) ((M32R_PSW_BSM & (regs)->psw) != 0) -#else -#error unknown isa configuration -#endif - -#define instruction_pointer(regs) ((regs)->bpc) -#define profile_pc(regs) instruction_pointer(regs) -#define user_stack_pointer(regs) ((regs)->spu) - -extern void withdraw_debug_trap(struct pt_regs *regs); - -#define task_pt_regs(task) \ - ((struct pt_regs *)(task_stack_page(task) + THREAD_SIZE) - 1) -#define current_pt_regs() ((struct pt_regs *) \ - ((unsigned long)current_thread_info() + THREAD_SIZE) - 1) - -#endif /* _ASM_M32R_PTRACE_H */ diff --git a/arch/m32r/include/asm/rtc.h b/arch/m32r/include/asm/rtc.h deleted file mode 100644 index a94cf1edc60f9..0000000000000 --- a/arch/m32r/include/asm/rtc.h +++ /dev/null @@ -1,66 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __RTC_H__ -#define __RTC_H__ - - /* Dallas DS1302 clock/calendar register numbers. */ -# define RTC_SECONDS 0 -# define RTC_MINUTES 1 -# define RTC_HOURS 2 -# define RTC_DAY_OF_MONTH 3 -# define RTC_MONTH 4 -# define RTC_WEEKDAY 5 -# define RTC_YEAR 6 -# define RTC_CONTROL 7 - - /* Bits in CONTROL register. */ -# define RTC_CONTROL_WRITEPROTECT 0x80 -# define RTC_TRICKLECHARGER 8 - - /* Bits in TRICKLECHARGER register TCS TCS TCS TCS DS DS RS RS. */ -# define RTC_TCR_PATTERN 0xA0 /* 1010xxxx */ -# define RTC_TCR_1DIOD 0x04 /* xxxx01xx */ -# define RTC_TCR_2DIOD 0x08 /* xxxx10xx */ -# define RTC_TCR_DISABLED 0x00 /* xxxxxx00 Disabled */ -# define RTC_TCR_2KOHM 0x01 /* xxxxxx01 2KOhm */ -# define RTC_TCR_4KOHM 0x02 /* xxxxxx10 4kOhm */ -# define RTC_TCR_8KOHM 0x03 /* xxxxxx11 8kOhm */ - -#ifdef CONFIG_DS1302 -extern unsigned char ds1302_readreg(int reg); -extern void ds1302_writereg(int reg, unsigned char val); -extern int ds1302_init(void); -# define CMOS_READ(x) ds1302_readreg(x) -# define CMOS_WRITE(val,reg) ds1302_writereg(reg,val) -# define RTC_INIT() ds1302_init() -#else - /* No RTC configured so we shouldn't try to access any. */ -# define CMOS_READ(x) 42 -# define CMOS_WRITE(x,y) -# define RTC_INIT() (-1) -#endif - -/* - * The struct used to pass data via the following ioctl. Similar to the - * struct tm in , but it needs to be here so that the kernel - * source is self contained, allowing cross-compiles, etc. etc. - */ -struct rtc_time { - int tm_sec; - int tm_min; - int tm_hour; - int tm_mday; - int tm_mon; - int tm_year; - int tm_wday; - int tm_yday; - int tm_isdst; -}; - -/* ioctl() calls that are permitted to the /dev/rtc interface. */ -#define RTC_MAGIC 'p' -#define RTC_RD_TIME _IOR(RTC_MAGIC, 0x09, struct rtc_time) /* Read RTC time. */ -#define RTC_SET_TIME _IOW(RTC_MAGIC, 0x0a, struct rtc_time) /* Set RTC time. */ -#define RTC_SET_CHARGE _IOW(RTC_MAGIC, 0x0b, int) -#define RTC_MAX_IOCTL 0x0b - -#endif /* __RTC_H__ */ diff --git a/arch/m32r/include/asm/s1d13806.h b/arch/m32r/include/asm/s1d13806.h deleted file mode 100644 index 79e98a259ebe8..0000000000000 --- a/arch/m32r/include/asm/s1d13806.h +++ /dev/null @@ -1,200 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -//---------------------------------------------------------------------------- -// -// File generated by S1D13806CFG.EXE -// -// Copyright (c) 2000,2001 Epson Research and Development, Inc. -// All rights reserved. -// -//---------------------------------------------------------------------------- - -// Panel: (active) 640x480 77Hz STN Single 8-bit (PCLK=CLKI=25.175MHz) -// Memory: Embedded SDRAM (MCLK=CLKI3=50.000MHz) (BUSCLK=33.333MHz) - -#define SWIVEL_VIEW 0 /* 0:none, 1:90 not completed */ - -static struct s1d13xxxfb_regval s1d13xxxfb_initregs[] = { - - {0x0001,0x00}, // Miscellaneous Register - {0x01FC,0x00}, // Display Mode Register -#if defined(CONFIG_PLAT_MAPPI) - {0x0004,0x00}, // General IO Pins Configuration Register 0 - {0x0005,0x00}, // General IO Pins Configuration Register 1 - {0x0008,0x00}, // General IO Pins Control Register 0 - {0x0009,0x00}, // General IO Pins Control Register 1 - {0x0010,0x00}, // Memory Clock Configuration Register - {0x0014,0x00}, // LCD Pixel Clock Configuration Register - {0x0018,0x00}, // CRT/TV Pixel Clock Configuration Register - {0x001C,0x00}, // MediaPlug Clock Configuration Register -/* - * .. 10MHz: 0x00 - * .. 30MHz: 0x01 - * 30MHz ..: 0x02 - */ - {0x001E,0x02}, // CPU To Memory Wait State Select Register - {0x0021,0x02}, // DRAM Refresh Rate Register - {0x002A,0x11}, // DRAM Timings Control Register 0 - {0x002B,0x13}, // DRAM Timings Control Register 1 - {0x0020,0x80}, // Memory Configuration Register - {0x0030,0x25}, // Panel Type Register - {0x0031,0x00}, // MOD Rate Register - {0x0032,0x4F}, // LCD Horizontal Display Width Register - {0x0034,0x12}, // LCD Horizontal Non-Display Period Register - {0x0035,0x01}, // TFT FPLINE Start Position Register - {0x0036,0x0B}, // TFT FPLINE Pulse Width Register - {0x0038,0xDF}, // LCD Vertical Display Height Register 0 - {0x0039,0x01}, // LCD Vertical Display Height Register 1 - {0x003A,0x2C}, // LCD Vertical Non-Display Period Register - {0x003B,0x0A}, // TFT FPFRAME Start Position Register - {0x003C,0x01}, // TFT FPFRAME Pulse Width Register - - {0x0041,0x00}, // LCD Miscellaneous Register - {0x0042,0x00}, // LCD Display Start Address Register 0 - {0x0043,0x00}, // LCD Display Start Address Register 1 - {0x0044,0x00}, // LCD Display Start Address Register 2 - -#elif defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_OPSPUT) || defined(CONFIG_PLAT_MAPPI3) - {0x0004,0x07}, // GPIO[0:7] direction - {0x0005,0x00}, // GPIO[8:12] direction - {0x0008,0x00}, // GPIO[0:7] data - {0x0009,0x00}, // GPIO[8:12] data - {0x0008,0x04}, // LCD panel Vcc on - {0x0008,0x05}, // LCD panel reset - {0x0010,0x01}, // Memory Clock Configuration Register - {0x0014,0x30}, // LCD Pixel Clock Configuration Register (CLKI 22MHz/4) - {0x0018,0x00}, // CRT/TV Pixel Clock Configuration Register - {0x001C,0x00}, // MediaPlug Clock Configuration Register(10MHz) - {0x001E,0x00}, // CPU To Memory Wait State Select Register - {0x0020,0x80}, // Memory Configuration Register - {0x0021,0x03}, // DRAM Refresh Rate Register - {0x002A,0x00}, // DRAM Timings Control Register 0 - {0x002B,0x01}, // DRAM Timings Control Register 1 - {0x0030,0x25}, // Panel Type Register - {0x0031,0x00}, // MOD Rate Register - {0x0032,0x1d}, // LCD Horizontal Display Width Register - {0x0034,0x05}, // LCD Horizontal Non-Display Period Register - {0x0035,0x01}, // TFT FPLINE Start Position Register - {0x0036,0x01}, // TFT FPLINE Pulse Width Register - {0x0038,0x3F}, // LCD Vertical Display Height Register 0 - {0x0039,0x01}, // LCD Vertical Display Height Register 1 - {0x003A,0x0b}, // LCD Vertical Non-Display Period Register - {0x003B,0x07}, // TFT FPFRAME Start Position Register - {0x003C,0x02}, // TFT FPFRAME Pulse Width Register - - {0x0041,0x00}, // LCD Miscellaneous Register -#if (SWIVEL_VIEW == 0) - {0x0042,0x00}, // LCD Display Start Address Register 0 - {0x0043,0x00}, // LCD Display Start Address Register 1 - {0x0044,0x00}, // LCD Display Start Address Register 2 - -#elif (SWIVEL_VIEW == 1) - // 1024 - W(320) = 0x2C0 - {0x0042,0xC0}, // LCD Display Start Address Register 0 - {0x0043,0x02}, // LCD Display Start Address Register 1 - {0x0044,0x00}, // LCD Display Start Address Register 2 - // 1024 - {0x0046,0x00}, // LCD Memory Address Offset Register 0 - {0x0047,0x02}, // LCD Memory Address Offset Register 1 -#else -#error unsupported SWIVEL_VIEW mode -#endif -#else -#error no platform configuration -#endif /* CONFIG_PLAT_XXX */ - - {0x0048,0x00}, // LCD Pixel Panning Register - {0x004A,0x00}, // LCD Display FIFO High Threshold Control Register - {0x004B,0x00}, // LCD Display FIFO Low Threshold Control Register - {0x0050,0x4F}, // CRT/TV Horizontal Display Width Register - {0x0052,0x13}, // CRT/TV Horizontal Non-Display Period Register - {0x0053,0x01}, // CRT/TV HRTC Start Position Register - {0x0054,0x0B}, // CRT/TV HRTC Pulse Width Register - {0x0056,0xDF}, // CRT/TV Vertical Display Height Register 0 - {0x0057,0x01}, // CRT/TV Vertical Display Height Register 1 - {0x0058,0x2B}, // CRT/TV Vertical Non-Display Period Register - {0x0059,0x09}, // CRT/TV VRTC Start Position Register - {0x005A,0x01}, // CRT/TV VRTC Pulse Width Register - {0x005B,0x10}, // TV Output Control Register - - {0x0062,0x00}, // CRT/TV Display Start Address Register 0 - {0x0063,0x00}, // CRT/TV Display Start Address Register 1 - {0x0064,0x00}, // CRT/TV Display Start Address Register 2 - - {0x0068,0x00}, // CRT/TV Pixel Panning Register - {0x006A,0x00}, // CRT/TV Display FIFO High Threshold Control Register - {0x006B,0x00}, // CRT/TV Display FIFO Low Threshold Control Register - {0x0070,0x00}, // LCD Ink/Cursor Control Register - {0x0071,0x01}, // LCD Ink/Cursor Start Address Register - {0x0072,0x00}, // LCD Cursor X Position Register 0 - {0x0073,0x00}, // LCD Cursor X Position Register 1 - {0x0074,0x00}, // LCD Cursor Y Position Register 0 - {0x0075,0x00}, // LCD Cursor Y Position Register 1 - {0x0076,0x00}, // LCD Ink/Cursor Blue Color 0 Register - {0x0077,0x00}, // LCD Ink/Cursor Green Color 0 Register - {0x0078,0x00}, // LCD Ink/Cursor Red Color 0 Register - {0x007A,0x1F}, // LCD Ink/Cursor Blue Color 1 Register - {0x007B,0x3F}, // LCD Ink/Cursor Green Color 1 Register - {0x007C,0x1F}, // LCD Ink/Cursor Red Color 1 Register - {0x007E,0x00}, // LCD Ink/Cursor FIFO Threshold Register - {0x0080,0x00}, // CRT/TV Ink/Cursor Control Register - {0x0081,0x01}, // CRT/TV Ink/Cursor Start Address Register - {0x0082,0x00}, // CRT/TV Cursor X Position Register 0 - {0x0083,0x00}, // CRT/TV Cursor X Position Register 1 - {0x0084,0x00}, // CRT/TV Cursor Y Position Register 0 - {0x0085,0x00}, // CRT/TV Cursor Y Position Register 1 - {0x0086,0x00}, // CRT/TV Ink/Cursor Blue Color 0 Register - {0x0087,0x00}, // CRT/TV Ink/Cursor Green Color 0 Register - {0x0088,0x00}, // CRT/TV Ink/Cursor Red Color 0 Register - {0x008A,0x1F}, // CRT/TV Ink/Cursor Blue Color 1 Register - {0x008B,0x3F}, // CRT/TV Ink/Cursor Green Color 1 Register - {0x008C,0x1F}, // CRT/TV Ink/Cursor Red Color 1 Register - {0x008E,0x00}, // CRT/TV Ink/Cursor FIFO Threshold Register - {0x0100,0x00}, // BitBlt Control Register 0 - {0x0101,0x00}, // BitBlt Control Register 1 - {0x0102,0x00}, // BitBlt ROP Code/Color Expansion Register - {0x0103,0x00}, // BitBlt Operation Register - {0x0104,0x00}, // BitBlt Source Start Address Register 0 - {0x0105,0x00}, // BitBlt Source Start Address Register 1 - {0x0106,0x00}, // BitBlt Source Start Address Register 2 - {0x0108,0x00}, // BitBlt Destination Start Address Register 0 - {0x0109,0x00}, // BitBlt Destination Start Address Register 1 - {0x010A,0x00}, // BitBlt Destination Start Address Register 2 - {0x010C,0x00}, // BitBlt Memory Address Offset Register 0 - {0x010D,0x00}, // BitBlt Memory Address Offset Register 1 - {0x0110,0x00}, // BitBlt Width Register 0 - {0x0111,0x00}, // BitBlt Width Register 1 - {0x0112,0x00}, // BitBlt Height Register 0 - {0x0113,0x00}, // BitBlt Height Register 1 - {0x0114,0x00}, // BitBlt Background Color Register 0 - {0x0115,0x00}, // BitBlt Background Color Register 1 - {0x0118,0x00}, // BitBlt Foreground Color Register 0 - {0x0119,0x00}, // BitBlt Foreground Color Register 1 - {0x01E0,0x00}, // Look-Up Table Mode Register - {0x01E2,0x00}, // Look-Up Table Address Register - {0x01F0,0x10}, // Power Save Configuration Register - {0x01F1,0x00}, // Power Save Status Register - {0x01F4,0x00}, // CPU-to-Memory Access Watchdog Timer Register -#if (SWIVEL_VIEW == 0) - {0x01FC,0x01}, // Display Mode Register(0x01:LCD, 0x02:CRT, 0x03:LCD&CRT) -#elif (SWIVEL_VIEW == 1) - {0x01FC,0x41}, // Display Mode Register(0x01:LCD, 0x02:CRT, 0x03:LCD&CRT) -#else -#error unsupported SWIVEL_VIEW mode -#endif /* SWIVEL_VIEW */ - -#if defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_OPSPUT) || defined(CONFIG_PLAT_MAPPI3) - {0x0008,0x07}, // LCD panel Vdd & Vg on -#endif - - {0x0040,0x05}, // LCD Display Mode Register (2:4bpp,3:8bpp,5:16bpp) -#if defined(CONFIG_PLAT_MAPPI) - {0x0046,0x80}, // LCD Memory Address Offset Register 0 - {0x0047,0x02}, // LCD Memory Address Offset Register 1 -#elif defined(CONFIG_PLAT_M32700UT) || defined(CONFIG_PLAT_OPSPUT) || defined(CONFIG_PLAT_MAPPI3) - {0x0046,0xf0}, // LCD Memory Address Offset Register 0 - {0x0047,0x00}, // LCD Memory Address Offset Register 1 -#endif - {0x0060,0x05}, // CRT/TV Display Mode Register (2:4bpp,3:8bpp,5:16bpp) - {0x0066,0x80}, // CRT/TV Memory Address Offset Register 0 // takeo - {0x0067,0x02}, // CRT/TV Memory Address Offset Register 1 -}; diff --git a/arch/m32r/include/asm/segment.h b/arch/m32r/include/asm/segment.h deleted file mode 100644 index 4095f14728e54..0000000000000 --- a/arch/m32r/include/asm/segment.h +++ /dev/null @@ -1,11 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_M32R_SEGMENT_H -#define _ASM_M32R_SEGMENT_H - -#define __KERNEL_CS 0x10 -#define __KERNEL_DS 0x18 - -#define __USER_CS 0x23 -#define __USER_DS 0x2B - -#endif /* _ASM_M32R_SEGMENT_H */ diff --git a/arch/m32r/include/asm/serial.h b/arch/m32r/include/asm/serial.h deleted file mode 100644 index b1375c841b4da..0000000000000 --- a/arch/m32r/include/asm/serial.h +++ /dev/null @@ -1,10 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_M32R_SERIAL_H -#define _ASM_M32R_SERIAL_H - -/* include/asm-m32r/serial.h */ - - -#define BASE_BAUD 115200 - -#endif /* _ASM_M32R_SERIAL_H */ diff --git a/arch/m32r/include/asm/setup.h b/arch/m32r/include/asm/setup.h deleted file mode 100644 index 71b4d65140788..0000000000000 --- a/arch/m32r/include/asm/setup.h +++ /dev/null @@ -1,32 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_M32R_SETUP_H -#define _ASM_M32R_SETUP_H - -#include - - -#define PARAM ((unsigned char *)empty_zero_page) - -#define MOUNT_ROOT_RDONLY (*(unsigned long *) (PARAM+0x000)) -#define RAMDISK_FLAGS (*(unsigned long *) (PARAM+0x004)) -#define ORIG_ROOT_DEV (*(unsigned long *) (PARAM+0x008)) -#define LOADER_TYPE (*(unsigned long *) (PARAM+0x00c)) -#define INITRD_START (*(unsigned long *) (PARAM+0x010)) -#define INITRD_SIZE (*(unsigned long *) (PARAM+0x014)) - -#define M32R_CPUCLK (*(unsigned long *) (PARAM+0x018)) -#define M32R_BUSCLK (*(unsigned long *) (PARAM+0x01c)) -#define M32R_TIMER_DIVIDE (*(unsigned long *) (PARAM+0x020)) - -#define COMMAND_LINE ((char *) (PARAM+0x100)) - -#define SCREEN_INFO (*(struct screen_info *) (PARAM+0x200)) - -#define RAMDISK_IMAGE_START_MASK (0x07FF) -#define RAMDISK_PROMPT_FLAG (0x8000) -#define RAMDISK_LOAD_FLAG (0x4000) - -extern unsigned long memory_start; -extern unsigned long memory_end; - -#endif /* _ASM_M32R_SETUP_H */ diff --git a/arch/m32r/include/asm/shmparam.h b/arch/m32r/include/asm/shmparam.h deleted file mode 100644 index 1af73d92c96da..0000000000000 --- a/arch/m32r/include/asm/shmparam.h +++ /dev/null @@ -1,7 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_M32R_SHMPARAM_H -#define _ASM_M32R_SHMPARAM_H - -#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */ - -#endif /* _ASM_M32R_SHMPARAM_H */ diff --git a/arch/m32r/include/asm/signal.h b/arch/m32r/include/asm/signal.h deleted file mode 100644 index 8bf57950d21ee..0000000000000 --- a/arch/m32r/include/asm/signal.h +++ /dev/null @@ -1,25 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_M32R_SIGNAL_H -#define _ASM_M32R_SIGNAL_H - -#include - -/* 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; - -#define __ARCH_HAS_SA_RESTORER -#include - -#undef __HAVE_ARCH_SIG_BITOPS - -#endif /* _ASM_M32R_SIGNAL_H */ diff --git a/arch/m32r/include/asm/smp.h b/arch/m32r/include/asm/smp.h deleted file mode 100644 index 763f22700ce65..0000000000000 --- a/arch/m32r/include/asm/smp.h +++ /dev/null @@ -1,113 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_M32R_SMP_H -#define _ASM_M32R_SMP_H - -#ifdef CONFIG_SMP -#ifndef __ASSEMBLY__ - -#include -#include -#include -#include - -#define PHYSID_ARRAY_SIZE 1 - -struct physid_mask -{ - unsigned long mask[PHYSID_ARRAY_SIZE]; -}; - -typedef struct physid_mask physid_mask_t; - -#define physid_set(physid, map) set_bit(physid, (map).mask) -#define physid_clear(physid, map) clear_bit(physid, (map).mask) -#define physid_isset(physid, map) test_bit(physid, (map).mask) -#define physid_test_and_set(physid, map) test_and_set_bit(physid, (map).mask) - -#define physids_and(dst, src1, src2) bitmap_and((dst).mask, (src1).mask, (src2).mask, MAX_APICS) -#define physids_or(dst, src1, src2) bitmap_or((dst).mask, (src1).mask, (src2).mask, MAX_APICS) -#define physids_clear(map) bitmap_zero((map).mask, MAX_APICS) -#define physids_complement(dst, src) bitmap_complement((dst).mask,(src).mask, MAX_APICS) -#define physids_empty(map) bitmap_empty((map).mask, MAX_APICS) -#define physids_equal(map1, map2) bitmap_equal((map1).mask, (map2).mask, MAX_APICS) -#define physids_weight(map) bitmap_weight((map).mask, MAX_APICS) -#define physids_shift_right(d, s, n) bitmap_shift_right((d).mask, (s).mask, n, MAX_APICS) -#define physids_shift_left(d, s, n) bitmap_shift_left((d).mask, (s).mask, n, MAX_APICS) -#define physids_coerce(map) ((map).mask[0]) - -#define physids_promote(physids) \ - ({ \ - physid_mask_t __physid_mask = PHYSID_MASK_NONE; \ - __physid_mask.mask[0] = physids; \ - __physid_mask; \ - }) - -#define physid_mask_of_physid(physid) \ - ({ \ - physid_mask_t __physid_mask = PHYSID_MASK_NONE; \ - physid_set(physid, __physid_mask); \ - __physid_mask; \ - }) - -#define PHYSID_MASK_ALL { {[0 ... PHYSID_ARRAY_SIZE-1] = ~0UL} } -#define PHYSID_MASK_NONE { {[0 ... PHYSID_ARRAY_SIZE-1] = 0UL} } - -extern physid_mask_t phys_cpu_present_map; - -/* - * Some lowlevel functions might want to know about - * the real CPU ID <-> CPU # mapping. - */ -extern volatile int cpu_2_physid[NR_CPUS]; -#define cpu_to_physid(cpu_id) cpu_2_physid[cpu_id] - -#define raw_smp_processor_id() (current_thread_info()->cpu) - -extern cpumask_t cpu_callout_map; - -static __inline__ int hard_smp_processor_id(void) -{ - return (int)*(volatile long *)M32R_CPUID_PORTL; -} - -static __inline__ int cpu_logical_map(int cpu) -{ - return cpu; -} - -static __inline__ int cpu_number_map(int cpu) -{ - return cpu; -} - -extern void smp_send_timer(void); -extern unsigned long send_IPI_mask_phys(const cpumask_t*, int, int); - -extern void arch_send_call_function_single_ipi(int cpu); -extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); - -#endif /* not __ASSEMBLY__ */ - -#define NO_PROC_ID (0xff) /* No processor magic marker */ - -/* - * M32R-mp IPI - */ -#define RESCHEDULE_IPI (M32R_IRQ_IPI0-M32R_IRQ_IPI0) -#define INVALIDATE_TLB_IPI (M32R_IRQ_IPI1-M32R_IRQ_IPI0) -#define CALL_FUNCTION_IPI (M32R_IRQ_IPI2-M32R_IRQ_IPI0) -#define LOCAL_TIMER_IPI (M32R_IRQ_IPI3-M32R_IRQ_IPI0) -#define INVALIDATE_CACHE_IPI (M32R_IRQ_IPI4-M32R_IRQ_IPI0) -#define CPU_BOOT_IPI (M32R_IRQ_IPI5-M32R_IRQ_IPI0) -#define CALL_FUNC_SINGLE_IPI (M32R_IRQ_IPI6-M32R_IRQ_IPI0) - -#define IPI_SHIFT (0) -#define NR_IPIS (8) - -#else /* CONFIG_SMP */ - -#define hard_smp_processor_id() 0 - -#endif /* CONFIG_SMP */ - -#endif /* _ASM_M32R_SMP_H */ diff --git a/arch/m32r/include/asm/spinlock.h b/arch/m32r/include/asm/spinlock.h deleted file mode 100644 index 0189f410f8f58..0000000000000 --- a/arch/m32r/include/asm/spinlock.h +++ /dev/null @@ -1,308 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_M32R_SPINLOCK_H -#define _ASM_M32R_SPINLOCK_H - -/* - * linux/include/asm-m32r/spinlock.h - * - * M32R version: - * Copyright (C) 2001, 2002 Hitoshi Yamamoto - * Copyright (C) 2004 Hirokazu Takata - */ - -#include -#include -#include -#include -#include -#include - -/* - * Your basic SMP spinlocks, allowing only a single CPU anywhere - * - * (the type definitions are in asm/spinlock_types.h) - * - * Simple spin lock operations. There are two variants, one clears IRQ's - * on the local processor, one does not. - * - * We make no fairness assumptions. They have a cost. - */ - -#define arch_spin_is_locked(x) (*(volatile int *)(&(x)->slock) <= 0) - -/** - * arch_spin_trylock - Try spin lock and return a result - * @lock: Pointer to the lock variable - * - * arch_spin_trylock() tries to get the lock and returns a result. - * On the m32r, the result value is 1 (= Success) or 0 (= Failure). - */ -static inline int arch_spin_trylock(arch_spinlock_t *lock) -{ - int oldval; - unsigned long tmp1, tmp2; - - /* - * lock->slock : =1 : unlock - * : <=0 : lock - * { - * oldval = lock->slock; <--+ need atomic operation - * lock->slock = 0; <--+ - * } - */ - __asm__ __volatile__ ( - "# arch_spin_trylock \n\t" - "ldi %1, #0; \n\t" - "mvfc %2, psw; \n\t" - "clrpsw #0x40 -> nop; \n\t" - DCACHE_CLEAR("%0", "r6", "%3") - "lock %0, @%3; \n\t" - "unlock %1, @%3; \n\t" - "mvtc %2, psw; \n\t" - : "=&r" (oldval), "=&r" (tmp1), "=&r" (tmp2) - : "r" (&lock->slock) - : "memory" -#ifdef CONFIG_CHIP_M32700_TS1 - , "r6" -#endif /* CONFIG_CHIP_M32700_TS1 */ - ); - - return (oldval > 0); -} - -static inline void arch_spin_lock(arch_spinlock_t *lock) -{ - unsigned long tmp0, tmp1; - - /* - * lock->slock : =1 : unlock - * : <=0 : lock - * - * for ( ; ; ) { - * lock->slock -= 1; <-- need atomic operation - * if (lock->slock == 0) break; - * for ( ; lock->slock <= 0 ; ); - * } - */ - __asm__ __volatile__ ( - "# arch_spin_lock \n\t" - ".fillinsn \n" - "1: \n\t" - "mvfc %1, psw; \n\t" - "clrpsw #0x40 -> nop; \n\t" - DCACHE_CLEAR("%0", "r6", "%2") - "lock %0, @%2; \n\t" - "addi %0, #-1; \n\t" - "unlock %0, @%2; \n\t" - "mvtc %1, psw; \n\t" - "bltz %0, 2f; \n\t" - LOCK_SECTION_START(".balign 4 \n\t") - ".fillinsn \n" - "2: \n\t" - "ld %0, @%2; \n\t" - "bgtz %0, 1b; \n\t" - "bra 2b; \n\t" - LOCK_SECTION_END - : "=&r" (tmp0), "=&r" (tmp1) - : "r" (&lock->slock) - : "memory" -#ifdef CONFIG_CHIP_M32700_TS1 - , "r6" -#endif /* CONFIG_CHIP_M32700_TS1 */ - ); -} - -static inline void arch_spin_unlock(arch_spinlock_t *lock) -{ - mb(); - lock->slock = 1; -} - -/* - * Read-write spinlocks, allowing multiple readers - * but only one writer. - * - * NOTE! it is quite common to have readers in interrupts - * but no interrupt writers. For those circumstances we - * can "mix" irq-safe locks - any writer needs to get a - * irq-safe write-lock, but readers can get non-irqsafe - * read-locks. - * - * On x86, we implement read-write locks as a 32-bit counter - * with the high bit (sign) being the "contended" bit. - * - * The inline assembly is non-obvious. Think about it. - * - * Changed to use the same technique as rw semaphores. See - * semaphore.h for details. -ben - */ - -static inline void arch_read_lock(arch_rwlock_t *rw) -{ - unsigned long tmp0, tmp1; - - /* - * rw->lock : >0 : unlock - * : <=0 : lock - * - * for ( ; ; ) { - * rw->lock -= 1; <-- need atomic operation - * if (rw->lock >= 0) break; - * rw->lock += 1; <-- need atomic operation - * for ( ; rw->lock <= 0 ; ); - * } - */ - __asm__ __volatile__ ( - "# read_lock \n\t" - ".fillinsn \n" - "1: \n\t" - "mvfc %1, psw; \n\t" - "clrpsw #0x40 -> nop; \n\t" - DCACHE_CLEAR("%0", "r6", "%2") - "lock %0, @%2; \n\t" - "addi %0, #-1; \n\t" - "unlock %0, @%2; \n\t" - "mvtc %1, psw; \n\t" - "bltz %0, 2f; \n\t" - LOCK_SECTION_START(".balign 4 \n\t") - ".fillinsn \n" - "2: \n\t" - "clrpsw #0x40 -> nop; \n\t" - DCACHE_CLEAR("%0", "r6", "%2") - "lock %0, @%2; \n\t" - "addi %0, #1; \n\t" - "unlock %0, @%2; \n\t" - "mvtc %1, psw; \n\t" - ".fillinsn \n" - "3: \n\t" - "ld %0, @%2; \n\t" - "bgtz %0, 1b; \n\t" - "bra 3b; \n\t" - LOCK_SECTION_END - : "=&r" (tmp0), "=&r" (tmp1) - : "r" (&rw->lock) - : "memory" -#ifdef CONFIG_CHIP_M32700_TS1 - , "r6" -#endif /* CONFIG_CHIP_M32700_TS1 */ - ); -} - -static inline void arch_write_lock(arch_rwlock_t *rw) -{ - unsigned long tmp0, tmp1, tmp2; - - /* - * rw->lock : =RW_LOCK_BIAS_STR : unlock - * : !=RW_LOCK_BIAS_STR : lock - * - * for ( ; ; ) { - * rw->lock -= RW_LOCK_BIAS_STR; <-- need atomic operation - * if (rw->lock == 0) break; - * rw->lock += RW_LOCK_BIAS_STR; <-- need atomic operation - * for ( ; rw->lock != RW_LOCK_BIAS_STR ; ) ; - * } - */ - __asm__ __volatile__ ( - "# write_lock \n\t" - "seth %1, #high(" RW_LOCK_BIAS_STR "); \n\t" - "or3 %1, %1, #low(" RW_LOCK_BIAS_STR "); \n\t" - ".fillinsn \n" - "1: \n\t" - "mvfc %2, psw; \n\t" - "clrpsw #0x40 -> nop; \n\t" - DCACHE_CLEAR("%0", "r7", "%3") - "lock %0, @%3; \n\t" - "sub %0, %1; \n\t" - "unlock %0, @%3; \n\t" - "mvtc %2, psw; \n\t" - "bnez %0, 2f; \n\t" - LOCK_SECTION_START(".balign 4 \n\t") - ".fillinsn \n" - "2: \n\t" - "clrpsw #0x40 -> nop; \n\t" - DCACHE_CLEAR("%0", "r7", "%3") - "lock %0, @%3; \n\t" - "add %0, %1; \n\t" - "unlock %0, @%3; \n\t" - "mvtc %2, psw; \n\t" - ".fillinsn \n" - "3: \n\t" - "ld %0, @%3; \n\t" - "beq %0, %1, 1b; \n\t" - "bra 3b; \n\t" - LOCK_SECTION_END - : "=&r" (tmp0), "=&r" (tmp1), "=&r" (tmp2) - : "r" (&rw->lock) - : "memory" -#ifdef CONFIG_CHIP_M32700_TS1 - , "r7" -#endif /* CONFIG_CHIP_M32700_TS1 */ - ); -} - -static inline void arch_read_unlock(arch_rwlock_t *rw) -{ - unsigned long tmp0, tmp1; - - __asm__ __volatile__ ( - "# read_unlock \n\t" - "mvfc %1, psw; \n\t" - "clrpsw #0x40 -> nop; \n\t" - DCACHE_CLEAR("%0", "r6", "%2") - "lock %0, @%2; \n\t" - "addi %0, #1; \n\t" - "unlock %0, @%2; \n\t" - "mvtc %1, psw; \n\t" - : "=&r" (tmp0), "=&r" (tmp1) - : "r" (&rw->lock) - : "memory" -#ifdef CONFIG_CHIP_M32700_TS1 - , "r6" -#endif /* CONFIG_CHIP_M32700_TS1 */ - ); -} - -static inline void arch_write_unlock(arch_rwlock_t *rw) -{ - unsigned long tmp0, tmp1, tmp2; - - __asm__ __volatile__ ( - "# write_unlock \n\t" - "seth %1, #high(" RW_LOCK_BIAS_STR "); \n\t" - "or3 %1, %1, #low(" RW_LOCK_BIAS_STR "); \n\t" - "mvfc %2, psw; \n\t" - "clrpsw #0x40 -> nop; \n\t" - DCACHE_CLEAR("%0", "r7", "%3") - "lock %0, @%3; \n\t" - "add %0, %1; \n\t" - "unlock %0, @%3; \n\t" - "mvtc %2, psw; \n\t" - : "=&r" (tmp0), "=&r" (tmp1), "=&r" (tmp2) - : "r" (&rw->lock) - : "memory" -#ifdef CONFIG_CHIP_M32700_TS1 - , "r7" -#endif /* CONFIG_CHIP_M32700_TS1 */ - ); -} - -static inline int arch_read_trylock(arch_rwlock_t *lock) -{ - atomic_t *count = (atomic_t*)lock; - if (atomic_dec_return(count) >= 0) - return 1; - atomic_inc(count); - return 0; -} - -static inline int arch_write_trylock(arch_rwlock_t *lock) -{ - atomic_t *count = (atomic_t *)lock; - if (atomic_sub_and_test(RW_LOCK_BIAS, count)) - return 1; - atomic_add(RW_LOCK_BIAS, count); - return 0; -} - -#endif /* _ASM_M32R_SPINLOCK_H */ diff --git a/arch/m32r/include/asm/spinlock_types.h b/arch/m32r/include/asm/spinlock_types.h deleted file mode 100644 index bb0d17b64198e..0000000000000 --- a/arch/m32r/include/asm/spinlock_types.h +++ /dev/null @@ -1,24 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_M32R_SPINLOCK_TYPES_H -#define _ASM_M32R_SPINLOCK_TYPES_H - -#ifndef __LINUX_SPINLOCK_TYPES_H -# error "please don't include this file directly" -#endif - -typedef struct { - volatile int slock; -} arch_spinlock_t; - -#define __ARCH_SPIN_LOCK_UNLOCKED { 1 } - -typedef struct { - volatile int lock; -} arch_rwlock_t; - -#define RW_LOCK_BIAS 0x01000000 -#define RW_LOCK_BIAS_STR "0x01000000" - -#define __ARCH_RW_LOCK_UNLOCKED { RW_LOCK_BIAS } - -#endif /* _ASM_M32R_SPINLOCK_TYPES_H */ diff --git a/arch/m32r/include/asm/string.h b/arch/m32r/include/asm/string.h deleted file mode 100644 index a9ea3b6c3e5a2..0000000000000 --- a/arch/m32r/include/asm/string.h +++ /dev/null @@ -1,14 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_M32R_STRING_H -#define _ASM_M32R_STRING_H - -#define __HAVE_ARCH_STRLEN -extern size_t strlen(const char * s); - -#define __HAVE_ARCH_MEMCPY -extern void *memcpy(void *__to, __const__ void *__from, size_t __n); - -#define __HAVE_ARCH_MEMSET -extern void *memset(void *__s, int __c, size_t __count); - -#endif /* _ASM_M32R_STRING_H */ diff --git a/arch/m32r/include/asm/switch_to.h b/arch/m32r/include/asm/switch_to.h deleted file mode 100644 index 4b262f7a8fe9b..0000000000000 --- a/arch/m32r/include/asm/switch_to.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * This file is subject to 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) 2001 Hiroyuki Kondo, Hirokazu Takata, and Hitoshi Yamamoto - * Copyright (C) 2004, 2006 Hirokazu Takata - */ -#ifndef _ASM_M32R_SWITCH_TO_H -#define _ASM_M32R_SWITCH_TO_H - -/* - * switch_to(prev, next) should switch from task `prev' to `next' - * `prev' will never be the same as `next'. - * - * `next' and `prev' should be struct task_struct, but it isn't always defined - */ - -#if defined(CONFIG_FRAME_POINTER) || \ - !defined(CONFIG_SCHED_OMIT_FRAME_POINTER) -#define M32R_PUSH_FP " push fp\n" -#define M32R_POP_FP " pop fp\n" -#else -#define M32R_PUSH_FP "" -#define M32R_POP_FP "" -#endif - -#define switch_to(prev, next, last) do { \ - __asm__ __volatile__ ( \ - " seth lr, #high(1f) \n" \ - " or3 lr, lr, #low(1f) \n" \ - " st lr, @%4 ; store old LR \n" \ - " ld lr, @%5 ; load new LR \n" \ - M32R_PUSH_FP \ - " st sp, @%2 ; store old SP \n" \ - " ld sp, @%3 ; load new SP \n" \ - " push %1 ; store `prev' on new stack \n" \ - " jmp lr \n" \ - " .fillinsn \n" \ - "1: \n" \ - " pop %0 ; restore `__last' from new stack \n" \ - M32R_POP_FP \ - : "=r" (last) \ - : "0" (prev), \ - "r" (&(prev->thread.sp)), "r" (&(next->thread.sp)), \ - "r" (&(prev->thread.lr)), "r" (&(next->thread.lr)) \ - : "memory", "lr" \ - ); \ -} while(0) - -#endif /* _ASM_M32R_SWITCH_TO_H */ diff --git a/arch/m32r/include/asm/syscall.h b/arch/m32r/include/asm/syscall.h deleted file mode 100644 index 22c8516d3c181..0000000000000 --- a/arch/m32r/include/asm/syscall.h +++ /dev/null @@ -1,9 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_M32R_SYSCALL_H -#define _ASM_M32R_SYSCALL_H - -/* Definitions for the system call vector. */ -#define SYSCALL_VECTOR "2" -#define SYSCALL_VECTOR_ADDRESS "0xa0" - -#endif /* _ASM_M32R_SYSCALL_H */ diff --git a/arch/m32r/include/asm/termios.h b/arch/m32r/include/asm/termios.h deleted file mode 100644 index 40274b89cea52..0000000000000 --- a/arch/m32r/include/asm/termios.h +++ /dev/null @@ -1,52 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _M32R_TERMIOS_H -#define _M32R_TERMIOS_H - -#include -#include - -/* 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" - -/* - * Translate a "termio" structure into a "termios". Ugh. - */ -#define SET_LOW_TERMIOS_BITS(termios, termio, x) { \ - unsigned short __tmp; \ - get_user(__tmp,&(termio)->x); \ - *(unsigned short *) &(termios)->x = __tmp; \ -} - -#define user_termio_to_kernel_termios(termios, termio) \ -({ \ - SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \ - SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \ - SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \ - SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \ - copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \ -}) - -/* - * Translate a "termios" structure into a "termio". Ugh. - */ -#define kernel_termios_to_user_termio(termio, termios) \ -({ \ - put_user((termios)->c_iflag, &(termio)->c_iflag); \ - put_user((termios)->c_oflag, &(termio)->c_oflag); \ - put_user((termios)->c_cflag, &(termio)->c_cflag); \ - put_user((termios)->c_lflag, &(termio)->c_lflag); \ - put_user((termios)->c_line, &(termio)->c_line); \ - copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \ -}) - -#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios2)) -#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios2)) -#define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios)) -#define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios)) - -#endif /* _M32R_TERMIOS_H */ diff --git a/arch/m32r/include/asm/thread_info.h b/arch/m32r/include/asm/thread_info.h deleted file mode 100644 index ba00f1032587d..0000000000000 --- a/arch/m32r/include/asm/thread_info.h +++ /dev/null @@ -1,126 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_M32R_THREAD_INFO_H -#define _ASM_M32R_THREAD_INFO_H - -/* thread_info.h: m32r low-level thread information - * - * Copyright (C) 2002 David Howells (dhowells@redhat.com) - * - Incorporating suggestions made by Linus Torvalds and Dave Miller - * Copyright (C) 2004 Hirokazu Takata - */ - -#ifdef __KERNEL__ - -#ifndef __ASSEMBLY__ -#include -#endif - -/* - * 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 - */ -#ifndef __ASSEMBLY__ - -struct thread_info { - struct task_struct *task; /* main task structure */ - unsigned long flags; /* low level flags */ - unsigned long status; /* thread-synchronous flags */ - __u32 cpu; /* current CPU */ - int preempt_count; /* 0 => preemptable, <0 => BUG */ - - mm_segment_t addr_limit; /* thread address space: - 0-0xBFFFFFFF for user-thread - 0-0xFFFFFFFF for kernel-thread - */ - - __u8 supervisor_stack[0]; -}; - -#endif /* !__ASSEMBLY__ */ - -#define THREAD_SIZE (PAGE_SIZE << 1) -#define THREAD_SIZE_ORDER 1 -/* - * macros/functions for gaining access to the thread information structure - */ -#ifndef __ASSEMBLY__ - -#define INIT_THREAD_INFO(tsk) \ -{ \ - .task = &tsk, \ - .flags = 0, \ - .cpu = 0, \ - .preempt_count = INIT_PREEMPT_COUNT, \ - .addr_limit = KERNEL_DS, \ -} - -/* how to get the thread information struct from C */ -static inline struct thread_info *current_thread_info(void) -{ - struct thread_info *ti; - - __asm__ __volatile__ ( - "ldi %0, #%1 \n\t" - "and %0, sp \n\t" - : "=r" (ti) : "i" (~(THREAD_SIZE - 1)) - ); - - return ti; -} - -#define TI_FLAG_FAULT_CODE_SHIFT 28 - -static inline void set_thread_fault_code(unsigned int val) -{ - struct thread_info *ti = current_thread_info(); - ti->flags = (ti->flags & (~0 >> (32 - TI_FLAG_FAULT_CODE_SHIFT))) - | (val << TI_FLAG_FAULT_CODE_SHIFT); -} - -static inline unsigned int get_thread_fault_code(void) -{ - struct thread_info *ti = current_thread_info(); - return ti->flags >> TI_FLAG_FAULT_CODE_SHIFT; -} - -#endif - -/* - * 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_SIGPENDING 1 /* signal pending */ -#define TIF_NEED_RESCHED 2 /* rescheduling necessary */ -#define TIF_SINGLESTEP 3 /* restore singlestep on return to user mode */ -#define TIF_NOTIFY_RESUME 5 /* callback before returning to user */ -#define TIF_RESTORE_SIGMASK 8 /* restore signal mask in do_signal() */ -#define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */ -#define TIF_MEMDIE 18 /* is terminating due to OOM killer */ - -#define _TIF_SYSCALL_TRACE (1<mm) - -#include - -#endif /* _M32R_TLB_H */ diff --git a/arch/m32r/include/asm/tlbflush.h b/arch/m32r/include/asm/tlbflush.h deleted file mode 100644 index f6c7237316d0e..0000000000000 --- a/arch/m32r/include/asm/tlbflush.h +++ /dev/null @@ -1,98 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_M32R_TLBFLUSH_H -#define _ASM_M32R_TLBFLUSH_H - -#include - -/* - * TLB flushing: - * - * - flush_tlb() flushes the current mm struct TLBs - * - flush_tlb_all() flushes all processes TLBs - * - flush_tlb_mm(mm) flushes the specified mm context TLB's - * - flush_tlb_page(vma, vmaddr) flushes one page - * - flush_tlb_range(vma, start, end) flushes a range of pages - * - flush_tlb_kernel_range(start, end) flushes a range of kernel pages - */ - -extern void local_flush_tlb_all(void); -extern void local_flush_tlb_mm(struct mm_struct *); -extern void local_flush_tlb_page(struct vm_area_struct *, unsigned long); -extern void local_flush_tlb_range(struct vm_area_struct *, unsigned long, - unsigned long); - -#ifndef CONFIG_SMP -#ifdef CONFIG_MMU -#define flush_tlb_all() local_flush_tlb_all() -#define flush_tlb_mm(mm) local_flush_tlb_mm(mm) -#define flush_tlb_page(vma, page) local_flush_tlb_page(vma, page) -#define flush_tlb_range(vma, start, end) \ - local_flush_tlb_range(vma, start, end) -#define flush_tlb_kernel_range(start, end) local_flush_tlb_all() -#else /* CONFIG_MMU */ -#define flush_tlb_all() do { } while (0) -#define flush_tlb_mm(mm) do { } while (0) -#define flush_tlb_page(vma, vmaddr) do { } while (0) -#define flush_tlb_range(vma, start, end) do { } while (0) -#endif /* CONFIG_MMU */ -#else /* CONFIG_SMP */ -extern void smp_flush_tlb_all(void); -extern void smp_flush_tlb_mm(struct mm_struct *); -extern void smp_flush_tlb_page(struct vm_area_struct *, unsigned long); -extern void smp_flush_tlb_range(struct vm_area_struct *, unsigned long, - unsigned long); - -#define flush_tlb_all() smp_flush_tlb_all() -#define flush_tlb_mm(mm) smp_flush_tlb_mm(mm) -#define flush_tlb_page(vma, page) smp_flush_tlb_page(vma, page) -#define flush_tlb_range(vma, start, end) \ - smp_flush_tlb_range(vma, start, end) -#define flush_tlb_kernel_range(start, end) smp_flush_tlb_all() -#endif /* CONFIG_SMP */ - -static __inline__ void __flush_tlb_page(unsigned long page) -{ - unsigned int tmpreg0, tmpreg1, tmpreg2; - - __asm__ __volatile__ ( - "seth %0, #high(%4) \n\t" - "st %3, @(%5, %0) \n\t" - "ldi %1, #1 \n\t" - "st %1, @(%6, %0) \n\t" - "add3 %1, %0, %7 \n\t" - ".fillinsn \n" - "1: \n\t" - "ld %2, @(%6, %0) \n\t" - "bnez %2, 1b \n\t" - "ld %0, @%1+ \n\t" - "ld %1, @%1 \n\t" - "st %2, @+%0 \n\t" - "st %2, @+%1 \n\t" - : "=&r" (tmpreg0), "=&r" (tmpreg1), "=&r" (tmpreg2) - : "r" (page), "i" (MMU_REG_BASE), "i" (MSVA_offset), - "i" (MTOP_offset), "i" (MIDXI_offset) - : "memory" - ); -} - -static __inline__ void __flush_tlb_all(void) -{ - unsigned int tmpreg0, tmpreg1; - - __asm__ __volatile__ ( - "seth %0, #high(%2) \n\t" - "or3 %0, %0, #low(%2) \n\t" - "ldi %1, #0xc \n\t" - "st %1, @%0 \n\t" - ".fillinsn \n" - "1: \n\t" - "ld %1, @%0 \n\t" - "bnez %1, 1b \n\t" - : "=&r" (tmpreg0), "=&r" (tmpreg1) - : "i" (MTOP) : "memory" - ); -} - -extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t *); - -#endif /* _ASM_M32R_TLBFLUSH_H */ diff --git a/arch/m32r/include/asm/topology.h b/arch/m32r/include/asm/topology.h deleted file mode 100644 index ee79404e88783..0000000000000 --- a/arch/m32r/include/asm/topology.h +++ /dev/null @@ -1,7 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_M32R_TOPOLOGY_H -#define _ASM_M32R_TOPOLOGY_H - -#include - -#endif /* _ASM_M32R_TOPOLOGY_H */ diff --git a/arch/m32r/include/asm/types.h b/arch/m32r/include/asm/types.h deleted file mode 100644 index fce0bf60536c2..0000000000000 --- a/arch/m32r/include/asm/types.h +++ /dev/null @@ -1,13 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_M32R_TYPES_H -#define _ASM_M32R_TYPES_H - -#include - -/* - * These aren't exported outside the kernel to avoid name space clashes - */ - -#define BITS_PER_LONG 32 - -#endif /* _ASM_M32R_TYPES_H */ diff --git a/arch/m32r/include/asm/uaccess.h b/arch/m32r/include/asm/uaccess.h deleted file mode 100644 index 9d89bc3d81812..0000000000000 --- a/arch/m32r/include/asm/uaccess.h +++ /dev/null @@ -1,515 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_M32R_UACCESS_H -#define _ASM_M32R_UACCESS_H - -/* - * linux/include/asm-m32r/uaccess.h - * - * M32R version. - * Copyright (C) 2004, 2006 Hirokazu Takata - */ - -/* - * User space memory access functions - */ -#include -#include -#include - -/* - * 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. - */ - -#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) }) - -#ifdef CONFIG_MMU - -#define KERNEL_DS MAKE_MM_SEG(0xFFFFFFFF) -#define USER_DS MAKE_MM_SEG(PAGE_OFFSET) -#define get_ds() (KERNEL_DS) -#define get_fs() (current_thread_info()->addr_limit) -#define set_fs(x) (current_thread_info()->addr_limit = (x)) - -#else /* not CONFIG_MMU */ - -#define KERNEL_DS MAKE_MM_SEG(0xFFFFFFFF) -#define USER_DS MAKE_MM_SEG(0xFFFFFFFF) -#define get_ds() (KERNEL_DS) - -static inline mm_segment_t get_fs(void) -{ - return USER_DS; -} - -static inline void set_fs(mm_segment_t s) -{ -} - -#endif /* not CONFIG_MMU */ - -#define segment_eq(a, b) ((a).seg == (b).seg) - -#define __addr_ok(addr) \ - ((unsigned long)(addr) < (current_thread_info()->addr_limit.seg)) - -/* - * Test whether a block of memory is a valid user space address. - * Returns 0 if the range is valid, nonzero otherwise. - * - * This is equivalent to the following test: - * (u33)addr + (u33)size >= (u33)current->addr_limit.seg - * - * This needs 33-bit arithmetic. We have a carry... - */ -#define __range_ok(addr, size) ({ \ - unsigned long flag, roksum; \ - __chk_user_ptr(addr); \ - asm ( \ - " cmpu %1, %1 ; clear cbit\n" \ - " addx %1, %3 ; set cbit if overflow\n" \ - " subx %0, %0\n" \ - " cmpu %4, %1\n" \ - " subx %0, %5\n" \ - : "=&r" (flag), "=r" (roksum) \ - : "1" (addr), "r" ((int)(size)), \ - "r" (current_thread_info()->addr_limit.seg), "r" (0) \ - : "cbit" ); \ - flag; }) - -/** - * access_ok: - Checks if a user space pointer is valid - * @type: Type of access: %VERIFY_READ or %VERIFY_WRITE. Note that - * %VERIFY_WRITE is a superset of %VERIFY_READ - if it is safe - * to write to a block, it is always safe to read from it. - * @addr: User space pointer to start of block to check - * @size: Size of block to check - * - * Context: User context only. This function may sleep if pagefaults are - * enabled. - * - * Checks if a pointer to a block of memory in user space is valid. - * - * Returns true (nonzero) if the memory block may be valid, false (zero) - * if it is definitely invalid. - * - * Note that, depending on architecture, this function probably just - * checks that the pointer is in the user space range - after calling - * this function, memory access functions may still return -EFAULT. - */ -#ifdef CONFIG_MMU -#define access_ok(type, addr, size) (likely(__range_ok(addr, size) == 0)) -#else -static inline int access_ok(int type, const void *addr, unsigned long size) -{ - unsigned long val = (unsigned long)addr; - - return ((val >= memory_start) && ((val + size) < memory_end)); -} -#endif /* CONFIG_MMU */ - -#include - -/* - * These are the main single-value transfer routines. They automatically - * use the right size if we just have the right pointer type. - * - * This gets kind of ugly. We want to return _two_ values in "get_user()" - * and yet we don't want to do any pointers, because that is too much - * of a performance impact. Thus we have a few rather ugly macros here, - * and hide all the uglyness from the user. - * - * The "__xxx" versions of the user access functions are versions that - * do not verify the address space, that must have been done previously - * with a separate "access_ok()" call (this is used when we do multiple - * accesses to the same area of user memory). - */ - -/* Careful: we have to cast the result to the type of the pointer for sign - reasons */ -/** - * get_user: - Get a simple variable from user space. - * @x: Variable to store result. - * @ptr: Source address, in user space. - * - * Context: User context only. This function may sleep if pagefaults are - * enabled. - * - * This macro copies a single simple variable from user space to kernel - * space. It supports simple types like char and int, but not larger - * data types like structures or arrays. - * - * @ptr must have pointer-to-simple-variable type, and the result of - * dereferencing @ptr must be assignable to @x without a cast. - * - * Returns zero on success, or -EFAULT on error. - * On error, the variable @x is set to zero. - */ -#define get_user(x, ptr) \ - __get_user_check((x), (ptr), sizeof(*(ptr))) - -/** - * put_user: - Write a simple value into user space. - * @x: Value to copy to user space. - * @ptr: Destination address, in user space. - * - * Context: User context only. This function may sleep if pagefaults are - * enabled. - * - * This macro copies a single simple value from kernel space to user - * space. It supports simple types like char and int, but not larger - * data types like structures or arrays. - * - * @ptr must have pointer-to-simple-variable type, and @x must be assignable - * to the result of dereferencing @ptr. - * - * Returns zero on success, or -EFAULT on error. - */ -#define put_user(x, ptr) \ - __put_user_check((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr))) - -/** - * __get_user: - Get a simple variable from user space, with less checking. - * @x: Variable to store result. - * @ptr: Source address, in user space. - * - * Context: User context only. This function may sleep if pagefaults are - * enabled. - * - * This macro copies a single simple variable from user space to kernel - * space. It supports simple types like char and int, but not larger - * data types like structures or arrays. - * - * @ptr must have pointer-to-simple-variable type, and the result of - * dereferencing @ptr must be assignable to @x without a cast. - * - * Caller must check the pointer with access_ok() before calling this - * function. - * - * Returns zero on success, or -EFAULT on error. - * On error, the variable @x is set to zero. - */ -#define __get_user(x, ptr) \ - __get_user_nocheck((x), (ptr), sizeof(*(ptr))) - -#define __get_user_nocheck(x, ptr, size) \ -({ \ - long __gu_err = 0; \ - unsigned long __gu_val = 0; \ - might_fault(); \ - __get_user_size(__gu_val, (ptr), (size), __gu_err); \ - (x) = (__force __typeof__(*(ptr)))__gu_val; \ - __gu_err; \ -}) - -#define __get_user_check(x, ptr, size) \ -({ \ - long __gu_err = -EFAULT; \ - unsigned long __gu_val = 0; \ - const __typeof__(*(ptr)) __user *__gu_addr = (ptr); \ - might_fault(); \ - if (access_ok(VERIFY_READ, __gu_addr, size)) \ - __get_user_size(__gu_val, __gu_addr, (size), __gu_err); \ - (x) = (__force __typeof__(*(ptr)))__gu_val; \ - __gu_err; \ -}) - -extern long __get_user_bad(void); - -#define __get_user_size(x, ptr, size, retval) \ -do { \ - retval = 0; \ - __chk_user_ptr(ptr); \ - switch (size) { \ - case 1: __get_user_asm(x, ptr, retval, "ub"); break; \ - case 2: __get_user_asm(x, ptr, retval, "uh"); break; \ - case 4: __get_user_asm(x, ptr, retval, ""); break; \ - default: (x) = __get_user_bad(); \ - } \ -} while (0) - -#define __get_user_asm(x, addr, err, itype) \ - __asm__ __volatile__( \ - " .fillinsn\n" \ - "1: ld"itype" %1,@%2\n" \ - " .fillinsn\n" \ - "2:\n" \ - ".section .fixup,\"ax\"\n" \ - " .balign 4\n" \ - "3: ldi %0,%3\n" \ - " seth r14,#high(2b)\n" \ - " or3 r14,r14,#low(2b)\n" \ - " jmp r14\n" \ - ".previous\n" \ - ".section __ex_table,\"a\"\n" \ - " .balign 4\n" \ - " .long 1b,3b\n" \ - ".previous" \ - : "=&r" (err), "=&r" (x) \ - : "r" (addr), "i" (-EFAULT), "0" (err) \ - : "r14", "memory") - -/** - * __put_user: - Write a simple value into user space, with less checking. - * @x: Value to copy to user space. - * @ptr: Destination address, in user space. - * - * Context: User context only. This function may sleep if pagefaults are - * enabled. - * - * This macro copies a single simple value from kernel space to user - * space. It supports simple types like char and int, but not larger - * data types like structures or arrays. - * - * @ptr must have pointer-to-simple-variable type, and @x must be assignable - * to the result of dereferencing @ptr. - * - * Caller must check the pointer with access_ok() before calling this - * function. - * - * Returns zero on success, or -EFAULT on error. - */ -#define __put_user(x, ptr) \ - __put_user_nocheck((__typeof__(*(ptr)))(x), (ptr), sizeof(*(ptr))) - - -#define __put_user_nocheck(x, ptr, size) \ -({ \ - long __pu_err; \ - might_fault(); \ - __put_user_size((x), (ptr), (size), __pu_err); \ - __pu_err; \ -}) - - -#define __put_user_check(x, ptr, size) \ -({ \ - long __pu_err = -EFAULT; \ - __typeof__(*(ptr)) __user *__pu_addr = (ptr); \ - might_fault(); \ - if (access_ok(VERIFY_WRITE, __pu_addr, size)) \ - __put_user_size((x), __pu_addr, (size), __pu_err); \ - __pu_err; \ -}) - -#if defined(__LITTLE_ENDIAN__) -#define __put_user_u64(x, addr, err) \ - __asm__ __volatile__( \ - " .fillinsn\n" \ - "1: st %L1,@%2\n" \ - " .fillinsn\n" \ - "2: st %H1,@(4,%2)\n" \ - " .fillinsn\n" \ - "3:\n" \ - ".section .fixup,\"ax\"\n" \ - " .balign 4\n" \ - "4: ldi %0,%3\n" \ - " seth r14,#high(3b)\n" \ - " or3 r14,r14,#low(3b)\n" \ - " jmp r14\n" \ - ".previous\n" \ - ".section __ex_table,\"a\"\n" \ - " .balign 4\n" \ - " .long 1b,4b\n" \ - " .long 2b,4b\n" \ - ".previous" \ - : "=&r" (err) \ - : "r" (x), "r" (addr), "i" (-EFAULT), "0" (err) \ - : "r14", "memory") - -#elif defined(__BIG_ENDIAN__) -#define __put_user_u64(x, addr, err) \ - __asm__ __volatile__( \ - " .fillinsn\n" \ - "1: st %H1,@%2\n" \ - " .fillinsn\n" \ - "2: st %L1,@(4,%2)\n" \ - " .fillinsn\n" \ - "3:\n" \ - ".section .fixup,\"ax\"\n" \ - " .balign 4\n" \ - "4: ldi %0,%3\n" \ - " seth r14,#high(3b)\n" \ - " or3 r14,r14,#low(3b)\n" \ - " jmp r14\n" \ - ".previous\n" \ - ".section __ex_table,\"a\"\n" \ - " .balign 4\n" \ - " .long 1b,4b\n" \ - " .long 2b,4b\n" \ - ".previous" \ - : "=&r" (err) \ - : "r" (x), "r" (addr), "i" (-EFAULT), "0" (err) \ - : "r14", "memory") -#else -#error no endian defined -#endif - -extern void __put_user_bad(void); - -#define __put_user_size(x, ptr, size, retval) \ -do { \ - retval = 0; \ - __chk_user_ptr(ptr); \ - switch (size) { \ - case 1: __put_user_asm(x, ptr, retval, "b"); break; \ - case 2: __put_user_asm(x, ptr, retval, "h"); break; \ - case 4: __put_user_asm(x, ptr, retval, ""); break; \ - case 8: __put_user_u64((__typeof__(*ptr))(x), ptr, retval); break;\ - default: __put_user_bad(); \ - } \ -} while (0) - -struct __large_struct { unsigned long buf[100]; }; -#define __m(x) (*(struct __large_struct *)(x)) - -/* - * Tell gcc we read from memory instead of writing: this is because - * we do not write to any memory gcc knows about, so there are no - * aliasing issues. - */ -#define __put_user_asm(x, addr, err, itype) \ - __asm__ __volatile__( \ - " .fillinsn\n" \ - "1: st"itype" %1,@%2\n" \ - " .fillinsn\n" \ - "2:\n" \ - ".section .fixup,\"ax\"\n" \ - " .balign 4\n" \ - "3: ldi %0,%3\n" \ - " seth r14,#high(2b)\n" \ - " or3 r14,r14,#low(2b)\n" \ - " jmp r14\n" \ - ".previous\n" \ - ".section __ex_table,\"a\"\n" \ - " .balign 4\n" \ - " .long 1b,3b\n" \ - ".previous" \ - : "=&r" (err) \ - : "r" (x), "r" (addr), "i" (-EFAULT), "0" (err) \ - : "r14", "memory") - -/* - * Here we special-case 1, 2 and 4-byte copy_*_user invocations. On a fault - * we return the initial request size (1, 2 or 4), as copy_*_user should do. - * If a store crosses a page boundary and gets a fault, the m32r will not write - * anything, so this is accurate. - */ - -/* - * Copy To/From Userspace - */ - -/* Generic arbitrary sized copy. */ -/* Return the number of bytes NOT copied. */ -#define __copy_user(to, from, size) \ -do { \ - unsigned long __dst, __src, __c; \ - __asm__ __volatile__ ( \ - " mv r14, %0\n" \ - " or r14, %1\n" \ - " beq %0, %1, 9f\n" \ - " beqz %2, 9f\n" \ - " and3 r14, r14, #3\n" \ - " bnez r14, 2f\n" \ - " and3 %2, %2, #3\n" \ - " beqz %3, 2f\n" \ - " addi %0, #-4 ; word_copy \n" \ - " .fillinsn\n" \ - "0: ld r14, @%1+\n" \ - " addi %3, #-1\n" \ - " .fillinsn\n" \ - "1: st r14, @+%0\n" \ - " bnez %3, 0b\n" \ - " beqz %2, 9f\n" \ - " addi %0, #4\n" \ - " .fillinsn\n" \ - "2: ldb r14, @%1 ; byte_copy \n" \ - " .fillinsn\n" \ - "3: stb r14, @%0\n" \ - " addi %1, #1\n" \ - " addi %2, #-1\n" \ - " addi %0, #1\n" \ - " bnez %2, 2b\n" \ - " .fillinsn\n" \ - "9:\n" \ - ".section .fixup,\"ax\"\n" \ - " .balign 4\n" \ - "5: addi %3, #1\n" \ - " addi %1, #-4\n" \ - " .fillinsn\n" \ - "6: slli %3, #2\n" \ - " add %2, %3\n" \ - " addi %0, #4\n" \ - " .fillinsn\n" \ - "7: seth r14, #high(9b)\n" \ - " or3 r14, r14, #low(9b)\n" \ - " jmp r14\n" \ - ".previous\n" \ - ".section __ex_table,\"a\"\n" \ - " .balign 4\n" \ - " .long 0b,6b\n" \ - " .long 1b,5b\n" \ - " .long 2b,9b\n" \ - " .long 3b,9b\n" \ - ".previous\n" \ - : "=&r" (__dst), "=&r" (__src), "=&r" (size), \ - "=&r" (__c) \ - : "0" (to), "1" (from), "2" (size), "3" (size / 4) \ - : "r14", "memory"); \ -} while (0) - -/* We let the __ versions of copy_from/to_user inline, because they're often - * used in fast paths and have only a small space overhead. - */ -static inline unsigned long -raw_copy_from_user(void *to, const void __user *from, unsigned long n) -{ - prefetchw(to); - __copy_user(to, from, n); - return n; -} - -static inline unsigned long -raw_copy_to_user(void __user *to, const void *from, unsigned long n) -{ - prefetch(from); - __copy_user(to, from, n); - return n; -} - -long __must_check strncpy_from_user(char *dst, const char __user *src, - long count); - -/** - * __clear_user: - Zero a block of memory in user space, with less checking. - * @to: Destination address, in user space. - * @n: Number of bytes to zero. - * - * Zero a block of memory in user space. Caller must check - * the specified block with access_ok() before calling this function. - * - * Returns number of bytes that could not be cleared. - * On success, this will be zero. - */ -unsigned long __clear_user(void __user *mem, unsigned long len); - -/** - * clear_user: - Zero a block of memory in user space. - * @to: Destination address, in user space. - * @n: Number of bytes to zero. - * - * Zero a block of memory in user space. Caller must check - * the specified block with access_ok() before calling this function. - * - * Returns number of bytes that could not be cleared. - * On success, this will be zero. - */ -unsigned long clear_user(void __user *mem, unsigned long len); - -long strnlen_user(const char __user *str, long n); - -#endif /* _ASM_M32R_UACCESS_H */ diff --git a/arch/m32r/include/asm/ucontext.h b/arch/m32r/include/asm/ucontext.h deleted file mode 100644 index 5f9de37366244..0000000000000 --- a/arch/m32r/include/asm/ucontext.h +++ /dev/null @@ -1,13 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_M32R_UCONTEXT_H -#define _ASM_M32R_UCONTEXT_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_M32R_UCONTEXT_H */ diff --git a/arch/m32r/include/asm/unaligned.h b/arch/m32r/include/asm/unaligned.h deleted file mode 100644 index 5981361672f9a..0000000000000 --- a/arch/m32r/include/asm/unaligned.h +++ /dev/null @@ -1,19 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_M32R_UNALIGNED_H -#define _ASM_M32R_UNALIGNED_H - -#if defined(__LITTLE_ENDIAN__) -# include -# include -# include -# define get_unaligned __get_unaligned_le -# define put_unaligned __put_unaligned_le -#else -# include -# include -# include -# define get_unaligned __get_unaligned_be -# define put_unaligned __put_unaligned_be -#endif - -#endif /* _ASM_M32R_UNALIGNED_H */ diff --git a/arch/m32r/include/asm/unistd.h b/arch/m32r/include/asm/unistd.h deleted file mode 100644 index dee4c196972e0..0000000000000 --- a/arch/m32r/include/asm/unistd.h +++ /dev/null @@ -1,51 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_M32R_UNISTD_H -#define _ASM_M32R_UNISTD_H - -#include - - -#define NR_syscalls 326 - -#define __ARCH_WANT_STAT64 -#define __ARCH_WANT_SYS_ALARM -#define __ARCH_WANT_SYS_GETHOSTNAME -#define __ARCH_WANT_SYS_IPC -#define __ARCH_WANT_SYS_PAUSE -#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_OLDUMOUNT -#define __ARCH_WANT_SYS_CLONE -#define __ARCH_WANT_SYS_FORK -#define __ARCH_WANT_SYS_VFORK - -#define __IGNORE_lchown -#define __IGNORE_setuid -#define __IGNORE_getuid -#define __IGNORE_setgid -#define __IGNORE_getgid -#define __IGNORE_geteuid -#define __IGNORE_getegid -#define __IGNORE_fcntl -#define __IGNORE_setreuid -#define __IGNORE_setregid -#define __IGNORE_getrlimit -#define __IGNORE_getgroups -#define __IGNORE_setgroups -#define __IGNORE_select -#define __IGNORE_mmap -#define __IGNORE_fchown -#define __IGNORE_setfsuid -#define __IGNORE_setfsgid -#define __IGNORE_setresuid -#define __IGNORE_getresuid -#define __IGNORE_setresgid -#define __IGNORE_getresgid -#define __IGNORE_chown - -#endif /* _ASM_M32R_UNISTD_H */ diff --git a/arch/m32r/include/asm/user.h b/arch/m32r/include/asm/user.h deleted file mode 100644 index 489b60d4aec21..0000000000000 --- a/arch/m32r/include/asm/user.h +++ /dev/null @@ -1,53 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_M32R_USER_H -#define _ASM_M32R_USER_H - -#include -#include -#include - -/* - * Core file format: The core file is written in such a way that gdb - * can understand it and provide useful information to the user (under - * linux we use the `trad-core' bfd). - * - * The actual file contents are as follows: - * UPAGE: 1 page consisting of a user struct that tells gdb - * what is present in the file. Directly after this is a - * copy of the task_struct, which is currently not used by gdb, - * but it may come in handy at some point. All of the registers - * are stored as part of the upage. The upage should always be - * only one page. - * DATA: The data area is stored. We use current->end_text to - * current->brk to pick up all of the user variables, plus any memory - * that may have been sbrk'ed. No attempt is made to determine if a - * page is demand-zero or if a page is totally unused, we just cover - * the entire range. All of the addresses are rounded in such a way - * that an integral number of pages is written. - * STACK: We need the stack information in order to get a meaningful - * backtrace. We need to write the data from usp to - * current->start_stack, so we round each of these off in order to be - * able to write an integer number of pages. - */ - -struct user { - struct pt_regs regs; /* entire machine state */ - size_t u_tsize; /* text size (pages) */ - size_t u_dsize; /* data size (pages) */ - size_t u_ssize; /* stack size (pages) */ - unsigned long start_code; /* text starting address */ - unsigned long start_data; /* data starting address */ - unsigned long start_stack; /* stack starting address */ - long int signal; /* signal causing core dump */ - unsigned long u_ar0; /* help gdb find registers */ - unsigned long magic; /* identifies a core file */ - char u_comm[32]; /* user command name */ -}; - -#define NBPG PAGE_SIZE -#define UPAGES 1 -#define HOST_TEXT_START_ADDR (u.start_code) -#define HOST_DATA_START_ADDR (u.start_data) -#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG) - -#endif /* _ASM_M32R_USER_H */ diff --git a/arch/m32r/include/asm/vga.h b/arch/m32r/include/asm/vga.h deleted file mode 100644 index 783d5bf779c22..0000000000000 --- a/arch/m32r/include/asm/vga.h +++ /dev/null @@ -1,21 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_M32R_VGA_H -#define _ASM_M32R_VGA_H - -/* - * Access to VGA videoram - * - * (c) 1998 Martin Mares - */ - -/* - * On the PC, we can just recalculate addresses and then - * access the videoram directly without any black magic. - */ - -#define VGA_MAP_MEM(x,s) (unsigned long)phys_to_virt(x) - -#define vga_readb(x) (*(x)) -#define vga_writeb(x,y) (*(y) = (x)) - -#endif /* _ASM_M32R_VGA_H */ diff --git a/arch/m32r/include/asm/xor.h b/arch/m32r/include/asm/xor.h deleted file mode 100644 index a4d546752c777..0000000000000 --- a/arch/m32r/include/asm/xor.h +++ /dev/null @@ -1,7 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _ASM_M32R_XOR_H -#define _ASM_M32R_XOR_H - -#include - -#endif /* _ASM_M32R_XOR_H */ diff --git a/arch/m32r/include/uapi/asm/Kbuild b/arch/m32r/include/uapi/asm/Kbuild deleted file mode 100644 index c3df55aeefe70..0000000000000 --- a/arch/m32r/include/uapi/asm/Kbuild +++ /dev/null @@ -1,7 +0,0 @@ -# UAPI Header export list -include include/uapi/asm-generic/Kbuild.asm - -generic-y += bpf_perf_event.h -generic-y += kvm_para.h -generic-y += poll.h -generic-y += siginfo.h diff --git a/arch/m32r/include/uapi/asm/auxvec.h b/arch/m32r/include/uapi/asm/auxvec.h deleted file mode 100644 index f76dcc860fae5..0000000000000 --- a/arch/m32r/include/uapi/asm/auxvec.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifndef _ASM_M32R__AUXVEC_H -#define _ASM_M32R__AUXVEC_H - -#endif /* _ASM_M32R__AUXVEC_H */ diff --git a/arch/m32r/include/uapi/asm/bitsperlong.h b/arch/m32r/include/uapi/asm/bitsperlong.h deleted file mode 100644 index 76da34b10f598..0000000000000 --- a/arch/m32r/include/uapi/asm/bitsperlong.h +++ /dev/null @@ -1,2 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#include diff --git a/arch/m32r/include/uapi/asm/byteorder.h b/arch/m32r/include/uapi/asm/byteorder.h deleted file mode 100644 index 9b4a8ba483cda..0000000000000 --- a/arch/m32r/include/uapi/asm/byteorder.h +++ /dev/null @@ -1,11 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _ASM_M32R_BYTEORDER_H -#define _ASM_M32R_BYTEORDER_H - -#if defined(__LITTLE_ENDIAN__) -# include -#else -# include -#endif - -#endif /* _ASM_M32R_BYTEORDER_H */ diff --git a/arch/m32r/include/uapi/asm/errno.h b/arch/m32r/include/uapi/asm/errno.h deleted file mode 100644 index ab38ef607882a..0000000000000 --- a/arch/m32r/include/uapi/asm/errno.h +++ /dev/null @@ -1,7 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _ASM_M32R_ERRNO_H -#define _ASM_M32R_ERRNO_H - -#include - -#endif /* _ASM_M32R_ERRNO_H */ diff --git a/arch/m32r/include/uapi/asm/fcntl.h b/arch/m32r/include/uapi/asm/fcntl.h deleted file mode 100644 index a77648c505d17..0000000000000 --- a/arch/m32r/include/uapi/asm/fcntl.h +++ /dev/null @@ -1,2 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#include diff --git a/arch/m32r/include/uapi/asm/ioctl.h b/arch/m32r/include/uapi/asm/ioctl.h deleted file mode 100644 index b809c4566e5f8..0000000000000 --- a/arch/m32r/include/uapi/asm/ioctl.h +++ /dev/null @@ -1,2 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#include diff --git a/arch/m32r/include/uapi/asm/ioctls.h b/arch/m32r/include/uapi/asm/ioctls.h deleted file mode 100644 index 31da4c3bab940..0000000000000 --- a/arch/m32r/include/uapi/asm/ioctls.h +++ /dev/null @@ -1,7 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef __ARCH_M32R_IOCTLS_H__ -#define __ARCH_M32R_IOCTLS_H__ - -#include - -#endif /* __ARCH_M32R_IOCTLS_H__ */ diff --git a/arch/m32r/include/uapi/asm/ipcbuf.h b/arch/m32r/include/uapi/asm/ipcbuf.h deleted file mode 100644 index 90d6445a14df8..0000000000000 --- a/arch/m32r/include/uapi/asm/ipcbuf.h +++ /dev/null @@ -1,2 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#include diff --git a/arch/m32r/include/uapi/asm/mman.h b/arch/m32r/include/uapi/asm/mman.h deleted file mode 100644 index 8eebf89f5ab17..0000000000000 --- a/arch/m32r/include/uapi/asm/mman.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/arch/m32r/include/uapi/asm/msgbuf.h b/arch/m32r/include/uapi/asm/msgbuf.h deleted file mode 100644 index 4386ff2735ba5..0000000000000 --- a/arch/m32r/include/uapi/asm/msgbuf.h +++ /dev/null @@ -1,32 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _ASM_M32R_MSGBUF_H -#define _ASM_M32R_MSGBUF_H - -/* - * The msqid64_ds structure for m32r 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_M32R_MSGBUF_H */ diff --git a/arch/m32r/include/uapi/asm/param.h b/arch/m32r/include/uapi/asm/param.h deleted file mode 100644 index 0bff6d6133f50..0000000000000 --- a/arch/m32r/include/uapi/asm/param.h +++ /dev/null @@ -1,8 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _ASM_M32R_PARAM_H -#define _ASM_M32R_PARAM_H - -#include - -#endif /* _ASM_M32R_PARAM_H */ - diff --git a/arch/m32r/include/uapi/asm/posix_types.h b/arch/m32r/include/uapi/asm/posix_types.h deleted file mode 100644 index 63316fcb1b570..0000000000000 --- a/arch/m32r/include/uapi/asm/posix_types.h +++ /dev/null @@ -1,26 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _ASM_M32R_POSIX_TYPES_H -#define _ASM_M32R_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 short __kernel_mode_t; -#define __kernel_mode_t __kernel_mode_t - -typedef unsigned short __kernel_ipc_pid_t; -#define __kernel_ipc_pid_t __kernel_ipc_pid_t - -typedef unsigned short __kernel_uid_t; -typedef unsigned short __kernel_gid_t; -#define __kernel_uid_t __kernel_uid_t - -typedef unsigned short __kernel_old_dev_t; -#define __kernel_old_dev_t __kernel_old_dev_t - -#include - -#endif /* _ASM_M32R_POSIX_TYPES_H */ diff --git a/arch/m32r/include/uapi/asm/ptrace.h b/arch/m32r/include/uapi/asm/ptrace.h deleted file mode 100644 index 99aec86cf5c0f..0000000000000 --- a/arch/m32r/include/uapi/asm/ptrace.h +++ /dev/null @@ -1,118 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -/* - * linux/include/asm-m32r/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. - * - * M32R version: - * Copyright (C) 2001-2002, 2004 Hirokazu Takata - */ -#ifndef _UAPI_ASM_M32R_PTRACE_H -#define _UAPI_ASM_M32R_PTRACE_H - - -/* 0 - 13 are integer registers (general purpose registers). */ -#define PT_R4 0 -#define PT_R5 1 -#define PT_R6 2 -#define PT_REGS 3 -#define PT_R0 4 -#define PT_R1 5 -#define PT_R2 6 -#define PT_R3 7 -#define PT_R7 8 -#define PT_R8 9 -#define PT_R9 10 -#define PT_R10 11 -#define PT_R11 12 -#define PT_R12 13 -#define PT_SYSCNR 14 -#define PT_R13 PT_FP -#define PT_R14 PT_LR -#define PT_R15 PT_SP - -/* processor status and miscellaneous context registers. */ -#define PT_ACC0H 15 -#define PT_ACC0L 16 -#define PT_ACC1H 17 /* ISA_DSP_LEVEL2 only */ -#define PT_ACC1L 18 /* ISA_DSP_LEVEL2 only */ -#define PT_PSW 19 -#define PT_BPC 20 -#define PT_BBPSW 21 -#define PT_BBPC 22 -#define PT_SPU 23 -#define PT_FP 24 -#define PT_LR 25 -#define PT_SPI 26 -#define PT_ORIGR0 27 - -/* virtual pt_reg entry for gdb */ -#define PT_PC 30 -#define PT_CBR 31 -#define PT_EVB 32 - - -/* Control registers. */ -#define SPR_CR0 PT_PSW -#define SPR_CR1 PT_CBR /* read only */ -#define SPR_CR2 PT_SPI -#define SPR_CR3 PT_SPU -#define SPR_CR4 -#define SPR_CR5 PT_EVB /* part of M32R/E, M32R/I core only */ -#define SPR_CR6 PT_BPC -#define SPR_CR7 -#define SPR_CR8 PT_BBPSW -#define SPR_CR9 -#define SPR_CR10 -#define SPR_CR11 -#define SPR_CR12 -#define SPR_CR13 PT_WR -#define SPR_CR14 PT_BBPC -#define SPR_CR15 - -/* this struct defines the way the registers are stored on the - stack during a system call. */ -struct pt_regs { - /* Saved main processor registers. */ - unsigned long r4; - unsigned long r5; - unsigned long r6; - struct pt_regs *pt_regs; - unsigned long r0; - unsigned long r1; - unsigned long r2; - unsigned long r3; - unsigned long r7; - unsigned long r8; - unsigned long r9; - unsigned long r10; - unsigned long r11; - unsigned long r12; - long syscall_nr; - - /* Saved main processor status and miscellaneous context registers. */ - unsigned long acc0h; - unsigned long acc0l; - unsigned long acc1h; /* ISA_DSP_LEVEL2 only */ - unsigned long acc1l; /* ISA_DSP_LEVEL2 only */ - unsigned long psw; - unsigned long bpc; /* saved PC for TRAP syscalls */ - unsigned long bbpsw; - unsigned long bbpc; - unsigned long spu; /* saved user stack */ - unsigned long fp; - unsigned long lr; /* saved PC for JL syscalls */ - unsigned long spi; /* saved kernel stack */ - unsigned long orig_r0; -}; - -/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */ -#define PTRACE_GETREGS 12 -#define PTRACE_SETREGS 13 - -#define PTRACE_OLDSETOPTIONS 21 - - -#endif /* _UAPI_ASM_M32R_PTRACE_H */ diff --git a/arch/m32r/include/uapi/asm/resource.h b/arch/m32r/include/uapi/asm/resource.h deleted file mode 100644 index 3282f3c4a5caf..0000000000000 --- a/arch/m32r/include/uapi/asm/resource.h +++ /dev/null @@ -1,7 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _ASM_M32R_RESOURCE_H -#define _ASM_M32R_RESOURCE_H - -#include - -#endif /* _ASM_M32R_RESOURCE_H */ diff --git a/arch/m32r/include/uapi/asm/sembuf.h b/arch/m32r/include/uapi/asm/sembuf.h deleted file mode 100644 index de34664d8cd72..0000000000000 --- a/arch/m32r/include/uapi/asm/sembuf.h +++ /dev/null @@ -1,26 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _ASM_M32R_SEMBUF_H -#define _ASM_M32R_SEMBUF_H - -/* - * The semid64_ds structure for m32r 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_M32R_SEMBUF_H */ diff --git a/arch/m32r/include/uapi/asm/setup.h b/arch/m32r/include/uapi/asm/setup.h deleted file mode 100644 index d936a64bbafdf..0000000000000 --- a/arch/m32r/include/uapi/asm/setup.h +++ /dev/null @@ -1,12 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _UAPI_ASM_M32R_SETUP_H -#define _UAPI_ASM_M32R_SETUP_H - -/* - * This is set up by the setup-routine at boot-time - */ - -#define COMMAND_LINE_SIZE 512 - - -#endif /* _UAPI_ASM_M32R_SETUP_H */ diff --git a/arch/m32r/include/uapi/asm/shmbuf.h b/arch/m32r/include/uapi/asm/shmbuf.h deleted file mode 100644 index 44c2ea9248293..0000000000000 --- a/arch/m32r/include/uapi/asm/shmbuf.h +++ /dev/null @@ -1,43 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _ASM_M32R_SHMBUF_H -#define _ASM_M32R_SHMBUF_H - -/* - * The shmid64_ds structure for M32R 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_M32R_SHMBUF_H */ diff --git a/arch/m32r/include/uapi/asm/sigcontext.h b/arch/m32r/include/uapi/asm/sigcontext.h deleted file mode 100644 index cc9ee73525ff8..0000000000000 --- a/arch/m32r/include/uapi/asm/sigcontext.h +++ /dev/null @@ -1,40 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _ASM_M32R_SIGCONTEXT_H -#define _ASM_M32R_SIGCONTEXT_H - -struct sigcontext { - /* CPU registers */ - /* Saved main processor registers. */ - unsigned long sc_r4; - unsigned long sc_r5; - unsigned long sc_r6; - struct pt_regs *sc_pt_regs; - unsigned long sc_r0; - unsigned long sc_r1; - unsigned long sc_r2; - unsigned long sc_r3; - unsigned long sc_r7; - unsigned long sc_r8; - unsigned long sc_r9; - unsigned long sc_r10; - unsigned long sc_r11; - unsigned long sc_r12; - - /* Saved main processor status and miscellaneous context registers. */ - unsigned long sc_acc0h; - unsigned long sc_acc0l; - unsigned long sc_acc1h; /* ISA_DSP_LEVEL2 only */ - unsigned long sc_acc1l; /* ISA_DSP_LEVEL2 only */ - unsigned long sc_psw; - unsigned long sc_bpc; /* saved PC for TRAP syscalls */ - unsigned long sc_bbpsw; - unsigned long sc_bbpc; - unsigned long sc_spu; /* saved user stack */ - unsigned long sc_fp; - unsigned long sc_lr; /* saved PC for JL syscalls */ - unsigned long sc_spi; /* saved kernel stack */ - - unsigned long oldmask; -}; - -#endif /* _ASM_M32R_SIGCONTEXT_H */ diff --git a/arch/m32r/include/uapi/asm/signal.h b/arch/m32r/include/uapi/asm/signal.h deleted file mode 100644 index c2ac3417fb984..0000000000000 --- a/arch/m32r/include/uapi/asm/signal.h +++ /dev/null @@ -1,118 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _UAPI_ASM_M32R_SIGNAL_H -#define _UAPI_ASM_M32R_SIGNAL_H - -#include -#include -#include - -/* Avoid too many header ordering problems. */ -struct siginfo; - -#ifndef __KERNEL__ -/* Here we must cater to libcs that poke about in kernel headers. */ - -#define NSIG 32 -typedef unsigned long sigset_t; - -#endif /* __KERNEL__ */ - -#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 0x00000001u -#define SA_NOCLDWAIT 0x00000002u -#define SA_SIGINFO 0x00000004u -#define SA_ONSTACK 0x08000000u -#define SA_RESTART 0x10000000u -#define SA_NODEFER 0x40000000u -#define SA_RESETHAND 0x80000000u - -#define SA_NOMASK SA_NODEFER -#define SA_ONESHOT SA_RESETHAND - -#define SA_RESTORER 0x04000000 - -#define MINSIGSTKSZ 2048 -#define SIGSTKSZ 8192 - -#include - -#ifndef __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 __user *ss_sp; - int ss_flags; - size_t ss_size; -} stack_t; - - -#endif /* _UAPI_ASM_M32R_SIGNAL_H */ diff --git a/arch/m32r/include/uapi/asm/socket.h b/arch/m32r/include/uapi/asm/socket.h deleted file mode 100644 index cf5018e82c3d8..0000000000000 --- a/arch/m32r/include/uapi/asm/socket.h +++ /dev/null @@ -1,108 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _ASM_M32R_SOCKET_H -#define _ASM_M32R_SOCKET_H - -#include - -/* 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 -#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_GET_FILTER SO_ATTACH_FILTER - -#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 - -#define SO_TIMESTAMPING 37 -#define SCM_TIMESTAMPING SO_TIMESTAMPING - -#define SO_PROTOCOL 38 -#define SO_DOMAIN 39 - -#define SO_RXQ_OVFL 40 - -#define SO_WIFI_STATUS 41 -#define SCM_WIFI_STATUS SO_WIFI_STATUS -#define SO_PEEK_OFF 42 - -/* Instruct lower device to use last 4-bytes of skb data as FCS */ -#define SO_NOFCS 43 - -#define SO_LOCK_FILTER 44 - -#define SO_SELECT_ERR_QUEUE 45 - -#define SO_BUSY_POLL 46 - -#define SO_MAX_PACING_RATE 47 - -#define SO_BPF_EXTENSIONS 48 - -#define SO_INCOMING_CPU 49 - -#define SO_ATTACH_BPF 50 -#define SO_DETACH_BPF SO_DETACH_FILTER - -#define SO_ATTACH_REUSEPORT_CBPF 51 -#define SO_ATTACH_REUSEPORT_EBPF 52 - -#define SO_CNX_ADVICE 53 - -#define SCM_TIMESTAMPING_OPT_STATS 54 - -#define SO_MEMINFO 55 - -#define SO_INCOMING_NAPI_ID 56 - -#define SO_COOKIE 57 - -#define SCM_TIMESTAMPING_PKTINFO 58 - -#define SO_PEERGROUPS 59 - -#define SO_ZEROCOPY 60 - -#endif /* _ASM_M32R_SOCKET_H */ diff --git a/arch/m32r/include/uapi/asm/sockios.h b/arch/m32r/include/uapi/asm/sockios.h deleted file mode 100644 index 948229e474c5c..0000000000000 --- a/arch/m32r/include/uapi/asm/sockios.h +++ /dev/null @@ -1,14 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _ASM_M32R_SOCKIOS_H -#define _ASM_M32R_SOCKIOS_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_M32R_SOCKIOS_H */ diff --git a/arch/m32r/include/uapi/asm/stat.h b/arch/m32r/include/uapi/asm/stat.h deleted file mode 100644 index 0fe9f96ce8f05..0000000000000 --- a/arch/m32r/include/uapi/asm/stat.h +++ /dev/null @@ -1,88 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _ASM_M32R_STAT_H -#define _ASM_M32R_STAT_H - -#include - -struct __old_kernel_stat { - unsigned short st_dev; - unsigned short st_ino; - unsigned short st_mode; - unsigned short st_nlink; - unsigned short st_uid; - unsigned short st_gid; - unsigned short st_rdev; - unsigned long st_size; - unsigned long st_atime; - unsigned long st_mtime; - unsigned long st_ctime; -}; - -#define STAT_HAVE_NSEC 1 - -struct stat { - unsigned short st_dev; - unsigned short __pad1; - unsigned long st_ino; - unsigned short st_mode; - unsigned short st_nlink; - unsigned short st_uid; - unsigned short st_gid; - unsigned short st_rdev; - unsigned short __pad2; - unsigned long st_size; - unsigned long st_blksize; - unsigned long st_blocks; - 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 __unused4; - unsigned long __unused5; -}; - -/* This matches struct stat64 in glibc2.1, hence the absolutely - * insane amounts of padding around dev_t's. - */ -struct stat64 { - unsigned long long st_dev; - unsigned char __pad0[4]; -#define STAT64_HAS_BROKEN_ST_INO - unsigned long __st_ino; - - unsigned int st_mode; - unsigned int st_nlink; - - unsigned long st_uid; - unsigned long st_gid; - - unsigned long long st_rdev; - unsigned char __pad3[4]; - - long long st_size; - unsigned long st_blksize; - -#if defined(__BYTE_ORDER) ? __BYTE_ORDER == __BIG_ENDIAN : defined(__BIG_ENDIAN) - unsigned long __pad4; /* future possible st_blocks high bits */ - unsigned long st_blocks; /* Number 512-byte blocks allocated. */ -#elif defined(__BYTE_ORDER) ? __BYTE_ORDER == __LITTLE_ENDIAN : defined(__LITTLE_ENDIAN) - unsigned long st_blocks; /* Number 512-byte blocks allocated. */ - unsigned long __pad4; /* future possible st_blocks high bits */ -#else -#error no endian defined -#endif - 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 long st_ino; -}; - -#endif /* _ASM_M32R_STAT_H */ diff --git a/arch/m32r/include/uapi/asm/statfs.h b/arch/m32r/include/uapi/asm/statfs.h deleted file mode 100644 index d42ae20dbb2b6..0000000000000 --- a/arch/m32r/include/uapi/asm/statfs.h +++ /dev/null @@ -1,7 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _ASM_M32R_STATFS_H -#define _ASM_M32R_STATFS_H - -#include - -#endif /* _ASM_M32R_STATFS_H */ diff --git a/arch/m32r/include/uapi/asm/swab.h b/arch/m32r/include/uapi/asm/swab.h deleted file mode 100644 index 18dce47d28417..0000000000000 --- a/arch/m32r/include/uapi/asm/swab.h +++ /dev/null @@ -1,11 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _ASM_M32R_SWAB_H -#define _ASM_M32R_SWAB_H - -#include - -#if !defined(__STRICT_ANSI__) || defined(__KERNEL__) -# define __SWAB_64_THRU_32__ -#endif - -#endif /* _ASM_M32R_SWAB_H */ diff --git a/arch/m32r/include/uapi/asm/termbits.h b/arch/m32r/include/uapi/asm/termbits.h deleted file mode 100644 index 6cbbae9695b4f..0000000000000 --- a/arch/m32r/include/uapi/asm/termbits.h +++ /dev/null @@ -1,201 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _ASM_M32R_TERMBITS_H -#define _ASM_M32R_TERMBITS_H - -#include - -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 termios2 { - 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 */ -}; - -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 BOTHER 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 */ -#define CTVB 004000000000 /* VisioBraille Terminal flow control */ -#define CMSPAR 010000000000 /* mark or space (stick) parity */ -#define CRTSCTS 020000000000 /* flow control */ - -#define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */ - -/* c_lflag bits */ -#define ISIG 0000001 -#define ICANON 0000002 -#define XCASE 0000004 -#define ECHO 0000010 -#define ECHOE 0000020 -#define ECHOK 0000040 -#define ECHONL 0000100 -#define NOFLSH 0000200 -#define TOSTOP 0000400 -#define ECHOCTL 0001000 -#define ECHOPRT 0002000 -#define ECHOKE 0004000 -#define FLUSHO 0010000 -#define PENDIN 0040000 -#define IEXTEN 0100000 -#define EXTPROC 0200000 - -/* 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_M32R_TERMBITS_H */ diff --git a/arch/m32r/include/uapi/asm/termios.h b/arch/m32r/include/uapi/asm/termios.h deleted file mode 100644 index 9b80a85e83acf..0000000000000 --- a/arch/m32r/include/uapi/asm/termios.h +++ /dev/null @@ -1,44 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _UAPI_M32R_TERMIOS_H -#define _UAPI_M32R_TERMIOS_H - -#include -#include - -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 */ -}; - -/* 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 */ - - -#endif /* _UAPI_M32R_TERMIOS_H */ diff --git a/arch/m32r/include/uapi/asm/types.h b/arch/m32r/include/uapi/asm/types.h deleted file mode 100644 index 9ec9d4c5ac4d0..0000000000000 --- a/arch/m32r/include/uapi/asm/types.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/arch/m32r/include/uapi/asm/unistd.h b/arch/m32r/include/uapi/asm/unistd.h deleted file mode 100644 index adf8666a68ef4..0000000000000 --- a/arch/m32r/include/uapi/asm/unistd.h +++ /dev/null @@ -1,336 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ -#ifndef _UAPI_ASM_M32R_UNISTD_H -#define _UAPI_ASM_M32R_UNISTD_H - -/* - * This file contains the system call numbers. - */ - -#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 -/* 16 is unused */ -/* 17 is unused */ -/* 18 is unused */ -#define __NR_lseek 19 -#define __NR_getpid 20 -#define __NR_mount 21 -#define __NR_umount 22 -/* 23 is unused */ -/* 24 is unused */ -#define __NR_stime 25 -#define __NR_ptrace 26 -#define __NR_alarm 27 -/* 28 is unused */ -#define __NR_pause 29 -#define __NR_utime 30 -/* 31 is unused */ -#define __NR_cachectl 32 /* old #define __NR_gtty 32*/ -#define __NR_access 33 -/* 34 is unused */ -/* 35 is unused */ -#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 -/* 44 is unused */ -#define __NR_brk 45 -/* 46 is unused */ -/* 47 is unused (getgid16) */ -/* 48 is unused */ -/* 49 is unused */ -/* 50 is unused */ -#define __NR_acct 51 -#define __NR_umount2 52 -/* 53 is unused */ -#define __NR_ioctl 54 -/* 55 is unused (fcntl) */ -/* 56 is unused */ -#define __NR_setpgid 57 -/* 58 is unused */ -/* 59 is unused */ -#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 -/* 67 is unused */ -/* 68 is unused*/ -/* 69 is unused*/ -/* 70 is unused */ -/* 71 is unused */ -/* 72 is unused */ -/* 73 is unused */ -#define __NR_sethostname 74 -#define __NR_setrlimit 75 -/* 76 is unused (old getrlimit) */ -#define __NR_getrusage 77 -#define __NR_gettimeofday 78 -#define __NR_settimeofday 79 -/* 80 is unused */ -/* 81 is unused */ -/* 82 is unused */ -#define __NR_symlink 83 -/* 84 is unused */ -#define __NR_readlink 85 -#define __NR_uselib 86 -#define __NR_swapon 87 -#define __NR_reboot 88 -/* 89 is unused */ -/* 90 is unused */ -#define __NR_munmap 91 -#define __NR_truncate 92 -#define __NR_ftruncate 93 -#define __NR_fchmod 94 -/* 95 is unused */ -#define __NR_getpriority 96 -#define __NR_setpriority 97 -/* 98 is unused */ -#define __NR_statfs 99 -#define __NR_fstatfs 100 -/* 101 is unused */ -#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 -/* 109 is unused */ -/* 110 is unused */ -#define __NR_vhangup 111 -/* 112 is unused */ -/* 113 is unused */ -#define __NR_wait4 114 -#define __NR_swapoff 115 -#define __NR_sysinfo 116 -#define __NR_ipc 117 -#define __NR_fsync 118 -/* 119 is unused */ -#define __NR_clone 120 -#define __NR_setdomainname 121 -#define __NR_uname 122 -/* 123 is unused */ -#define __NR_adjtimex 124 -#define __NR_mprotect 125 -/* 126 is unused */ -/* 127 is unused */ -#define __NR_init_module 128 -#define __NR_delete_module 129 -/* 130 is unused */ -#define __NR_quotactl 131 -#define __NR_getpgid 132 -#define __NR_fchdir 133 -#define __NR_bdflush 134 -#define __NR_sysfs 135 -#define __NR_personality 136 -/* 137 is unused */ -/* 138 is unused */ -/* 139 is unused */ -#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 -/* 164 is unused */ -/* 165 is unused */ -#define __NR_tas 166 -/* 167 is unused */ -#define __NR_poll 168 -#define __NR_nfsservctl 169 -/* 170 is unused */ -/* 171 is unused */ -#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 -/* 182 is unused */ -#define __NR_getcwd 183 -#define __NR_capget 184 -#define __NR_capset 185 -#define __NR_sigaltstack 186 -#define __NR_sendfile 187 -/* 188 is unused */ -/* 189 is unused */ -#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_getdents64 220 -#define __NR_fcntl64 221 -/* 222 is unused */ -/* 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 unused */ -#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 -/* 285 is unused */ -#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 322 removed */ -#define __NR_eventfd 323 -#define __NR_fallocate 324 -#define __NR_setns 325 - -#endif /* _UAPI_ASM_M32R_UNISTD_H */ diff --git a/arch/m32r/kernel/.gitignore b/arch/m32r/kernel/.gitignore deleted file mode 100644 index c5f676c3c224b..0000000000000 --- a/arch/m32r/kernel/.gitignore +++ /dev/null @@ -1 +0,0 @@ -vmlinux.lds diff --git a/arch/m32r/kernel/Makefile b/arch/m32r/kernel/Makefile deleted file mode 100644 index bd94dca515968..0000000000000 --- a/arch/m32r/kernel/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# -# Makefile for the Linux/M32R kernel. -# - -extra-y := head.o vmlinux.lds - -obj-y := process.o entry.o traps.o align.o irq.o setup.o time.o \ - m32r_ksyms.o sys_m32r.o signal.o ptrace.o - -obj-$(CONFIG_SMP) += smp.o smpboot.o -obj-$(CONFIG_MODULES) += module.o diff --git a/arch/m32r/kernel/align.c b/arch/m32r/kernel/align.c deleted file mode 100644 index 2919a6647affe..0000000000000 --- a/arch/m32r/kernel/align.c +++ /dev/null @@ -1,585 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * align.c - address exception handler for M32R - * - * Copyright (c) 2003 Hitoshi Yamamoto - */ - -#include -#include - -static int get_reg(struct pt_regs *regs, int nr) -{ - int val; - - if (nr < 4) - val = *(unsigned long *)(®s->r0 + nr); - else if (nr < 7) - val = *(unsigned long *)(®s->r4 + (nr - 4)); - else if (nr < 13) - val = *(unsigned long *)(®s->r7 + (nr - 7)); - else - val = *(unsigned long *)(®s->fp + (nr - 13)); - - return val; -} - -static void set_reg(struct pt_regs *regs, int nr, int val) -{ - if (nr < 4) - *(unsigned long *)(®s->r0 + nr) = val; - else if (nr < 7) - *(unsigned long *)(®s->r4 + (nr - 4)) = val; - else if (nr < 13) - *(unsigned long *)(®s->r7 + (nr - 7)) = val; - else - *(unsigned long *)(®s->fp + (nr - 13)) = val; -} - -#define REG1(insn) (((insn) & 0x0f00) >> 8) -#define REG2(insn) ((insn) & 0x000f) -#define PSW_BC 0x100 - -/* O- instruction */ -#define ISA_LD1 0x20c0 /* ld Rdest, @Rsrc */ -#define ISA_LD2 0x20e0 /* ld Rdest, @Rsrc+ */ -#define ISA_LDH 0x20a0 /* ldh Rdest, @Rsrc */ -#define ISA_LDUH 0x20b0 /* lduh Rdest, @Rsrc */ -#define ISA_ST1 0x2040 /* st Rsrc1, @Rsrc2 */ -#define ISA_ST2 0x2060 /* st Rsrc1, @+Rsrc2 */ -#define ISA_ST3 0x2070 /* st Rsrc1, @-Rsrc2 */ -#define ISA_STH1 0x2020 /* sth Rsrc1, @Rsrc2 */ -#define ISA_STH2 0x2030 /* sth Rsrc1, @Rsrc2+ */ - -#ifdef CONFIG_ISA_DUAL_ISSUE - -/* OS instruction */ -#define ISA_ADD 0x00a0 /* add Rdest, Rsrc */ -#define ISA_ADDI 0x4000 /* addi Rdest, #imm8 */ -#define ISA_ADDX 0x0090 /* addx Rdest, Rsrc */ -#define ISA_AND 0x00c0 /* and Rdest, Rsrc */ -#define ISA_CMP 0x0040 /* cmp Rsrc1, Rsrc2 */ -#define ISA_CMPEQ 0x0060 /* cmpeq Rsrc1, Rsrc2 */ -#define ISA_CMPU 0x0050 /* cmpu Rsrc1, Rsrc2 */ -#define ISA_CMPZ 0x0070 /* cmpz Rsrc */ -#define ISA_LDI 0x6000 /* ldi Rdest, #imm8 */ -#define ISA_MV 0x1080 /* mv Rdest, Rsrc */ -#define ISA_NEG 0x0030 /* neg Rdest, Rsrc */ -#define ISA_NOP 0x7000 /* nop */ -#define ISA_NOT 0x00b0 /* not Rdest, Rsrc */ -#define ISA_OR 0x00e0 /* or Rdest, Rsrc */ -#define ISA_SUB 0x0020 /* sub Rdest, Rsrc */ -#define ISA_SUBX 0x0010 /* subx Rdest, Rsrc */ -#define ISA_XOR 0x00d0 /* xor Rdest, Rsrc */ - -/* -S instruction */ -#define ISA_MUL 0x1060 /* mul Rdest, Rsrc */ -#define ISA_MULLO_A0 0x3010 /* mullo Rsrc1, Rsrc2, A0 */ -#define ISA_MULLO_A1 0x3090 /* mullo Rsrc1, Rsrc2, A1 */ -#define ISA_MVFACMI_A0 0x50f2 /* mvfacmi Rdest, A0 */ -#define ISA_MVFACMI_A1 0x50f6 /* mvfacmi Rdest, A1 */ - -static int emu_addi(unsigned short insn, struct pt_regs *regs) -{ - char imm = (char)(insn & 0xff); - int dest = REG1(insn); - int val; - - val = get_reg(regs, dest); - val += imm; - set_reg(regs, dest, val); - - return 0; -} - -static int emu_ldi(unsigned short insn, struct pt_regs *regs) -{ - char imm = (char)(insn & 0xff); - - set_reg(regs, REG1(insn), (int)imm); - - return 0; -} - -static int emu_add(unsigned short insn, struct pt_regs *regs) -{ - int dest = REG1(insn); - int src = REG2(insn); - int val; - - val = get_reg(regs, dest); - val += get_reg(regs, src); - set_reg(regs, dest, val); - - return 0; -} - -static int emu_addx(unsigned short insn, struct pt_regs *regs) -{ - int dest = REG1(insn); - unsigned int val, tmp; - - val = regs->psw & PSW_BC ? 1 : 0; - tmp = get_reg(regs, dest); - val += tmp; - val += (unsigned int)get_reg(regs, REG2(insn)); - set_reg(regs, dest, val); - - /* C bit set */ - if (val < tmp) - regs->psw |= PSW_BC; - else - regs->psw &= ~(PSW_BC); - - return 0; -} - -static int emu_and(unsigned short insn, struct pt_regs *regs) -{ - int dest = REG1(insn); - int val; - - val = get_reg(regs, dest); - val &= get_reg(regs, REG2(insn)); - set_reg(regs, dest, val); - - return 0; -} - -static int emu_cmp(unsigned short insn, struct pt_regs *regs) -{ - if (get_reg(regs, REG1(insn)) < get_reg(regs, REG2(insn))) - regs->psw |= PSW_BC; - else - regs->psw &= ~(PSW_BC); - - return 0; -} - -static int emu_cmpeq(unsigned short insn, struct pt_regs *regs) -{ - if (get_reg(regs, REG1(insn)) == get_reg(regs, REG2(insn))) - regs->psw |= PSW_BC; - else - regs->psw &= ~(PSW_BC); - - return 0; -} - -static int emu_cmpu(unsigned short insn, struct pt_regs *regs) -{ - if ((unsigned int)get_reg(regs, REG1(insn)) - < (unsigned int)get_reg(regs, REG2(insn))) - regs->psw |= PSW_BC; - else - regs->psw &= ~(PSW_BC); - - return 0; -} - -static int emu_cmpz(unsigned short insn, struct pt_regs *regs) -{ - if (!get_reg(regs, REG2(insn))) - regs->psw |= PSW_BC; - else - regs->psw &= ~(PSW_BC); - - return 0; -} - -static int emu_mv(unsigned short insn, struct pt_regs *regs) -{ - int val; - - val = get_reg(regs, REG2(insn)); - set_reg(regs, REG1(insn), val); - - return 0; -} - -static int emu_neg(unsigned short insn, struct pt_regs *regs) -{ - int val; - - val = get_reg(regs, REG2(insn)); - set_reg(regs, REG1(insn), 0 - val); - - return 0; -} - -static int emu_not(unsigned short insn, struct pt_regs *regs) -{ - int val; - - val = get_reg(regs, REG2(insn)); - set_reg(regs, REG1(insn), ~val); - - return 0; -} - -static int emu_or(unsigned short insn, struct pt_regs *regs) -{ - int dest = REG1(insn); - int val; - - val = get_reg(regs, dest); - val |= get_reg(regs, REG2(insn)); - set_reg(regs, dest, val); - - return 0; -} - -static int emu_sub(unsigned short insn, struct pt_regs *regs) -{ - int dest = REG1(insn); - int val; - - val = get_reg(regs, dest); - val -= get_reg(regs, REG2(insn)); - set_reg(regs, dest, val); - - return 0; -} - -static int emu_subx(unsigned short insn, struct pt_regs *regs) -{ - int dest = REG1(insn); - unsigned int val, tmp; - - val = tmp = get_reg(regs, dest); - val -= (unsigned int)get_reg(regs, REG2(insn)); - val -= regs->psw & PSW_BC ? 1 : 0; - set_reg(regs, dest, val); - - /* C bit set */ - if (val > tmp) - regs->psw |= PSW_BC; - else - regs->psw &= ~(PSW_BC); - - return 0; -} - -static int emu_xor(unsigned short insn, struct pt_regs *regs) -{ - int dest = REG1(insn); - unsigned int val; - - val = (unsigned int)get_reg(regs, dest); - val ^= (unsigned int)get_reg(regs, REG2(insn)); - set_reg(regs, dest, val); - - return 0; -} - -static int emu_mul(unsigned short insn, struct pt_regs *regs) -{ - int dest = REG1(insn); - int reg1, reg2; - - reg1 = get_reg(regs, dest); - reg2 = get_reg(regs, REG2(insn)); - - __asm__ __volatile__ ( - "mul %0, %1; \n\t" - : "+r" (reg1) : "r" (reg2) - ); - - set_reg(regs, dest, reg1); - - return 0; -} - -static int emu_mullo_a0(unsigned short insn, struct pt_regs *regs) -{ - int reg1, reg2; - - reg1 = get_reg(regs, REG1(insn)); - reg2 = get_reg(regs, REG2(insn)); - - __asm__ __volatile__ ( - "mullo %0, %1, a0; \n\t" - "mvfachi %0, a0; \n\t" - "mvfaclo %1, a0; \n\t" - : "+r" (reg1), "+r" (reg2) - ); - - regs->acc0h = reg1; - regs->acc0l = reg2; - - return 0; -} - -static int emu_mullo_a1(unsigned short insn, struct pt_regs *regs) -{ - int reg1, reg2; - - reg1 = get_reg(regs, REG1(insn)); - reg2 = get_reg(regs, REG2(insn)); - - __asm__ __volatile__ ( - "mullo %0, %1, a0; \n\t" - "mvfachi %0, a0; \n\t" - "mvfaclo %1, a0; \n\t" - : "+r" (reg1), "+r" (reg2) - ); - - regs->acc1h = reg1; - regs->acc1l = reg2; - - return 0; -} - -static int emu_mvfacmi_a0(unsigned short insn, struct pt_regs *regs) -{ - unsigned long val; - - val = (regs->acc0h << 16) | (regs->acc0l >> 16); - set_reg(regs, REG1(insn), (int)val); - - return 0; -} - -static int emu_mvfacmi_a1(unsigned short insn, struct pt_regs *regs) -{ - unsigned long val; - - val = (regs->acc1h << 16) | (regs->acc1l >> 16); - set_reg(regs, REG1(insn), (int)val); - - return 0; -} - -static int emu_m32r2(unsigned short insn, struct pt_regs *regs) -{ - int res = -1; - - if ((insn & 0x7fff) == ISA_NOP) /* nop */ - return 0; - - switch(insn & 0x7000) { - case ISA_ADDI: /* addi Rdest, #imm8 */ - res = emu_addi(insn, regs); - break; - case ISA_LDI: /* ldi Rdest, #imm8 */ - res = emu_ldi(insn, regs); - break; - default: - break; - } - - if (!res) - return 0; - - switch(insn & 0x70f0) { - case ISA_ADD: /* add Rdest, Rsrc */ - res = emu_add(insn, regs); - break; - case ISA_ADDX: /* addx Rdest, Rsrc */ - res = emu_addx(insn, regs); - break; - case ISA_AND: /* and Rdest, Rsrc */ - res = emu_and(insn, regs); - break; - case ISA_CMP: /* cmp Rsrc1, Rsrc2 */ - res = emu_cmp(insn, regs); - break; - case ISA_CMPEQ: /* cmpeq Rsrc1, Rsrc2 */ - res = emu_cmpeq(insn, regs); - break; - case ISA_CMPU: /* cmpu Rsrc1, Rsrc2 */ - res = emu_cmpu(insn, regs); - break; - case ISA_CMPZ: /* cmpz Rsrc */ - res = emu_cmpz(insn, regs); - break; - case ISA_MV: /* mv Rdest, Rsrc */ - res = emu_mv(insn, regs); - break; - case ISA_NEG: /* neg Rdest, Rsrc */ - res = emu_neg(insn, regs); - break; - case ISA_NOT: /* not Rdest, Rsrc */ - res = emu_not(insn, regs); - break; - case ISA_OR: /* or Rdest, Rsrc */ - res = emu_or(insn, regs); - break; - case ISA_SUB: /* sub Rdest, Rsrc */ - res = emu_sub(insn, regs); - break; - case ISA_SUBX: /* subx Rdest, Rsrc */ - res = emu_subx(insn, regs); - break; - case ISA_XOR: /* xor Rdest, Rsrc */ - res = emu_xor(insn, regs); - break; - case ISA_MUL: /* mul Rdest, Rsrc */ - res = emu_mul(insn, regs); - break; - case ISA_MULLO_A0: /* mullo Rsrc1, Rsrc2 */ - res = emu_mullo_a0(insn, regs); - break; - case ISA_MULLO_A1: /* mullo Rsrc1, Rsrc2 */ - res = emu_mullo_a1(insn, regs); - break; - default: - break; - } - - if (!res) - return 0; - - switch(insn & 0x70ff) { - case ISA_MVFACMI_A0: /* mvfacmi Rdest */ - res = emu_mvfacmi_a0(insn, regs); - break; - case ISA_MVFACMI_A1: /* mvfacmi Rdest */ - res = emu_mvfacmi_a1(insn, regs); - break; - default: - break; - } - - return res; -} - -#endif /* CONFIG_ISA_DUAL_ISSUE */ - -/* - * ld : ?010 dest 1100 src - * 0010 dest 1110 src : ld Rdest, @Rsrc+ - * ldh : ?010 dest 1010 src - * lduh : ?010 dest 1011 src - * st : ?010 src1 0100 src2 - * 0010 src1 0110 src2 : st Rsrc1, @+Rsrc2 - * 0010 src1 0111 src2 : st Rsrc1, @-Rsrc2 - * sth : ?010 src1 0010 src2 - */ - -static int insn_check(unsigned long insn, struct pt_regs *regs, - unsigned char **ucp) -{ - int res = 0; - - /* - * 32bit insn - * ld Rdest, @(disp16, Rsrc) - * st Rdest, @(disp16, Rsrc) - */ - if (insn & 0x80000000) { /* 32bit insn */ - *ucp += (short)(insn & 0x0000ffff); - regs->bpc += 4; - } else { /* 16bit insn */ -#ifdef CONFIG_ISA_DUAL_ISSUE - /* parallel exec check */ - if (!(regs->bpc & 0x2) && insn & 0x8000) { - res = emu_m32r2((unsigned short)insn, regs); - regs->bpc += 4; - } else -#endif /* CONFIG_ISA_DUAL_ISSUE */ - regs->bpc += 2; - } - - return res; -} - -static int emu_ld(unsigned long insn32, struct pt_regs *regs) -{ - unsigned char *ucp; - unsigned long val; - unsigned short insn16; - int size, src; - - insn16 = insn32 >> 16; - src = REG2(insn16); - ucp = (unsigned char *)get_reg(regs, src); - - if (insn_check(insn32, regs, &ucp)) - return -1; - - size = insn16 & 0x0040 ? 4 : 2; - if (copy_from_user(&val, ucp, size)) - return -1; - - if (size == 2) - val >>= 16; - - /* ldh sign check */ - if ((insn16 & 0x00f0) == 0x00a0 && (val & 0x8000)) - val |= 0xffff0000; - - set_reg(regs, REG1(insn16), val); - - /* ld increment check */ - if ((insn16 & 0xf0f0) == ISA_LD2) /* ld Rdest, @Rsrc+ */ - set_reg(regs, src, (unsigned long)(ucp + 4)); - - return 0; -} - -static int emu_st(unsigned long insn32, struct pt_regs *regs) -{ - unsigned char *ucp; - unsigned long val; - unsigned short insn16; - int size, src2; - - insn16 = insn32 >> 16; - src2 = REG2(insn16); - - ucp = (unsigned char *)get_reg(regs, src2); - - if (insn_check(insn32, regs, &ucp)) - return -1; - - size = insn16 & 0x0040 ? 4 : 2; - val = get_reg(regs, REG1(insn16)); - if (size == 2) - val <<= 16; - - /* st inc/dec check */ - if ((insn16 & 0xf0e0) == 0x2060) { - if (insn16 & 0x0010) - ucp -= 4; - else - ucp += 4; - - set_reg(regs, src2, (unsigned long)ucp); - } - - if (copy_to_user(ucp, &val, size)) - return -1; - - /* sth inc check */ - if ((insn16 & 0xf0f0) == ISA_STH2) { - ucp += 2; - set_reg(regs, src2, (unsigned long)ucp); - } - - return 0; -} - -int handle_unaligned_access(unsigned long insn32, struct pt_regs *regs) -{ - unsigned short insn16; - int res; - - insn16 = insn32 >> 16; - - /* ld or st check */ - if ((insn16 & 0x7000) != 0x2000) - return -1; - - /* insn alignment check */ - if ((insn16 & 0x8000) && (regs->bpc & 3)) - return -1; - - if (insn16 & 0x0080) /* ld */ - res = emu_ld(insn32, regs); - else /* st */ - res = emu_st(insn32, regs); - - return res; -} - diff --git a/arch/m32r/kernel/asm-offsets.c b/arch/m32r/kernel/asm-offsets.c deleted file mode 100644 index 7cb90b459e079..0000000000000 --- a/arch/m32r/kernel/asm-offsets.c +++ /dev/null @@ -1,15 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#include -#include - -int foo(void) -{ - OFFSET(TI_TASK, thread_info, task); - OFFSET(TI_FLAGS, thread_info, flags); - OFFSET(TI_STATUS, thread_info, status); - OFFSET(TI_CPU, thread_info, cpu); - OFFSET(TI_PRE_COUNT, thread_info, preempt_count); - OFFSET(TI_ADDR_LIMIT, thread_info, addr_limit); - - return 0; -} diff --git a/arch/m32r/kernel/entry.S b/arch/m32r/kernel/entry.S deleted file mode 100644 index bbf48f2aa2a71..0000000000000 --- a/arch/m32r/kernel/entry.S +++ /dev/null @@ -1,553 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * linux/arch/m32r/kernel/entry.S - * - * Copyright (c) 2001, 2002 Hirokazu Takata, Hitoshi Yamamoto, H. Kondo - * Copyright (c) 2003 Hitoshi Yamamoto - * Copyright (c) 2004 Hirokazu Takata - * - * Taken from i386 version. - * Copyright (C) 1991, 1992 Linus Torvalds - */ - -/* - * entry.S contains the system-call and fault low-level handling routines. - * This also contains the timer-interrupt handler, as well as all interrupts - * and faults that can result in a task-switch. - * - * NOTE: This code handles signal-recognition, which happens every time - * after a timer-interrupt and after each system call. - * - * Stack layout in 'ret_from_system_call': - * ptrace needs to have all regs on the stack. - * if the order here is changed, it needs to be - * updated in fork.c:copy_thread, signal.c:do_signal, - * ptrace.c and ptrace.h - * - * M32R/M32Rx/M32R2 - * @(sp) - r4 - * @(0x04,sp) - r5 - * @(0x08,sp) - r6 - * @(0x0c,sp) - *pt_regs - * @(0x10,sp) - r0 - * @(0x14,sp) - r1 - * @(0x18,sp) - r2 - * @(0x1c,sp) - r3 - * @(0x20,sp) - r7 - * @(0x24,sp) - r8 - * @(0x28,sp) - r9 - * @(0x2c,sp) - r10 - * @(0x30,sp) - r11 - * @(0x34,sp) - r12 - * @(0x38,sp) - syscall_nr - * @(0x3c,sp) - acc0h - * @(0x40,sp) - acc0l - * @(0x44,sp) - acc1h ; ISA_DSP_LEVEL2 only - * @(0x48,sp) - acc1l ; ISA_DSP_LEVEL2 only - * @(0x4c,sp) - psw - * @(0x50,sp) - bpc - * @(0x54,sp) - bbpsw - * @(0x58,sp) - bbpc - * @(0x5c,sp) - spu (cr3) - * @(0x60,sp) - fp (r13) - * @(0x64,sp) - lr (r14) - * @(0x68,sp) - spi (cr2) - * @(0x6c,sp) - orig_r0 - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if !defined(CONFIG_MMU) -#define sys_madvise sys_ni_syscall -#define sys_readahead sys_ni_syscall -#define sys_mprotect sys_ni_syscall -#define sys_msync sys_ni_syscall -#define sys_mlock sys_ni_syscall -#define sys_munlock sys_ni_syscall -#define sys_mlockall sys_ni_syscall -#define sys_munlockall sys_ni_syscall -#define sys_mremap sys_ni_syscall -#define sys_mincore sys_ni_syscall -#define sys_remap_file_pages sys_ni_syscall -#endif /* CONFIG_MMU */ - -#define R4(reg) @reg -#define R5(reg) @(0x04,reg) -#define R6(reg) @(0x08,reg) -#define PTREGS(reg) @(0x0C,reg) -#define R0(reg) @(0x10,reg) -#define R1(reg) @(0x14,reg) -#define R2(reg) @(0x18,reg) -#define R3(reg) @(0x1C,reg) -#define R7(reg) @(0x20,reg) -#define R8(reg) @(0x24,reg) -#define R9(reg) @(0x28,reg) -#define R10(reg) @(0x2C,reg) -#define R11(reg) @(0x30,reg) -#define R12(reg) @(0x34,reg) -#define SYSCALL_NR(reg) @(0x38,reg) -#define ACC0H(reg) @(0x3C,reg) -#define ACC0L(reg) @(0x40,reg) -#define ACC1H(reg) @(0x44,reg) -#define ACC1L(reg) @(0x48,reg) -#define PSW(reg) @(0x4C,reg) -#define BPC(reg) @(0x50,reg) -#define BBPSW(reg) @(0x54,reg) -#define BBPC(reg) @(0x58,reg) -#define SPU(reg) @(0x5C,reg) -#define FP(reg) @(0x60,reg) /* FP = R13 */ -#define LR(reg) @(0x64,reg) -#define SP(reg) @(0x68,reg) -#define ORIG_R0(reg) @(0x6C,reg) - -#define nr_syscalls ((syscall_table_size)/4) - -#ifdef CONFIG_PREEMPT -#define preempt_stop(x) DISABLE_INTERRUPTS(x) -#else -#define preempt_stop(x) -#define resume_kernel restore_all -#endif - -/* how to get the thread information struct from ASM */ -#define GET_THREAD_INFO(reg) GET_THREAD_INFO reg - .macro GET_THREAD_INFO reg - ldi \reg, #-THREAD_SIZE - and \reg, sp - .endm - -ENTRY(ret_from_kernel_thread) - pop r0 - bl schedule_tail - GET_THREAD_INFO(r8) - ld r0, R0(r8) - ld r1, R1(r8) - jl r1 - bra syscall_exit - -ENTRY(ret_from_fork) - pop r0 - bl schedule_tail - GET_THREAD_INFO(r8) - bra syscall_exit - -/* - * Return to user mode is not as complex as all this looks, - * but we want the default path for a system call return to - * go as quickly as possible which is why some of this is - * less clear than it otherwise should be. - */ - - ; userspace resumption stub bypassing syscall exit tracing - ALIGN -ret_from_exception: - preempt_stop(r4) -ret_from_intr: - ld r4, PSW(sp) -#ifdef CONFIG_ISA_M32R2 - and3 r4, r4, #0x8800 ; check BSM and BPM bits -#else - and3 r4, r4, #0x8000 ; check BSM bit -#endif - beqz r4, resume_kernel -resume_userspace: - DISABLE_INTERRUPTS(r4) ; make sure we don't miss an interrupt - ; setting need_resched or sigpending - ; between sampling and the iret - GET_THREAD_INFO(r8) - ld r9, @(TI_FLAGS, r8) - and3 r4, r9, #_TIF_WORK_MASK ; is there any work to be done on - ; int/exception return? - bnez r4, work_pending - bra restore_all - -#ifdef CONFIG_PREEMPT -ENTRY(resume_kernel) - GET_THREAD_INFO(r8) - ld r9, @(TI_PRE_COUNT, r8) ; non-zero preempt_count ? - bnez r9, restore_all -need_resched: - ld r9, @(TI_FLAGS, r8) ; need_resched set ? - and3 r4, r9, #_TIF_NEED_RESCHED - beqz r4, restore_all - ld r4, PSW(sp) ; interrupts off (exception path) ? - and3 r4, r4, #0x4000 - beqz r4, restore_all - bl preempt_schedule_irq - bra need_resched -#endif - - ; system call handler stub -ENTRY(system_call) - SWITCH_TO_KERNEL_STACK - SAVE_ALL - ENABLE_INTERRUPTS(r4) ; Enable interrupt - st sp, PTREGS(sp) ; implicit pt_regs parameter - cmpui r7, #NR_syscalls - bnc syscall_badsys - st r7, SYSCALL_NR(sp) ; syscall_nr - ; system call tracing in operation - GET_THREAD_INFO(r8) - ld r9, @(TI_FLAGS, r8) - and3 r4, r9, #_TIF_SYSCALL_TRACE - bnez r4, syscall_trace_entry -syscall_call: - slli r7, #2 ; table jump for the system call - LDIMM (r4, sys_call_table) - add r7, r4 - ld r7, @r7 - jl r7 ; execute system call - st r0, R0(sp) ; save the return value -syscall_exit: - DISABLE_INTERRUPTS(r4) ; make sure we don't miss an interrupt - ; setting need_resched or sigpending - ; between sampling and the iret - ld r9, @(TI_FLAGS, r8) - and3 r4, r9, #_TIF_ALLWORK_MASK ; current->work - bnez r4, syscall_exit_work -restore_all: - RESTORE_ALL - - # perform work that needs to be done immediately before resumption - # r9 : flags - ALIGN -work_pending: - and3 r4, r9, #_TIF_NEED_RESCHED - beqz r4, work_notifysig -work_resched: - bl schedule - DISABLE_INTERRUPTS(r4) ; make sure we don't miss an interrupt - ; setting need_resched or sigpending - ; between sampling and the iret - ld r9, @(TI_FLAGS, r8) - and3 r4, r9, #_TIF_WORK_MASK ; is there any work to be done other - ; than syscall tracing? - beqz r4, restore_all - and3 r4, r4, #_TIF_NEED_RESCHED - bnez r4, work_resched - -work_notifysig: ; deal with pending signals and - ; notify-resume requests - mv r0, sp ; arg1 : struct pt_regs *regs - mv r1, r9 ; arg2 : __u32 thread_info_flags - bl do_notify_resume - bra resume_userspace - - ; perform syscall exit tracing - ALIGN -syscall_trace_entry: - ldi r4, #-ENOSYS - st r4, R0(sp) - bl do_syscall_trace - ld r0, ORIG_R0(sp) - ld r1, R1(sp) - ld r2, R2(sp) - ld r3, R3(sp) - ld r4, R4(sp) - ld r5, R5(sp) - ld r6, R6(sp) - ld r7, SYSCALL_NR(sp) - cmpui r7, #NR_syscalls - bc syscall_call - bra syscall_exit - - ; perform syscall exit tracing - ALIGN -syscall_exit_work: - ld r9, @(TI_FLAGS, r8) - and3 r4, r9, #_TIF_SYSCALL_TRACE - beqz r4, work_pending - ENABLE_INTERRUPTS(r4) ; could let do_syscall_trace() call - ; schedule() instead - bl do_syscall_trace - bra resume_userspace - - ALIGN -syscall_fault: - SAVE_ALL - GET_THREAD_INFO(r8) - ldi r4, #-EFAULT - st r4, R0(sp) - bra resume_userspace - - ALIGN -syscall_badsys: - ldi r4, #-ENOSYS - st r4, R0(sp) - bra resume_userspace - - .global eit_vector - - .equ ei_vec_table, eit_vector + 0x0200 - -/* - * EI handler routine - */ -ENTRY(ei_handler) -#if defined(CONFIG_CHIP_M32700) - ; WORKAROUND: force to clear SM bit and use the kernel stack (SPI). - SWITCH_TO_KERNEL_STACK -#endif - SAVE_ALL - mv r1, sp ; arg1(regs) - ; get ICU status - seth r0, #shigh(M32R_ICU_ISTS_ADDR) - ld r0, @(low(M32R_ICU_ISTS_ADDR),r0) - push r0 -#if defined(CONFIG_SMP) - /* - * If IRQ == 0 --> Nothing to do, Not write IMASK - * If IRQ == IPI --> Do IPI handler, Not write IMASK - * If IRQ != 0, IPI --> Do do_IRQ(), Write IMASK - */ - slli r0, #4 - srli r0, #24 ; r0(irq_num<<2) - ;; IRQ exist check -#if defined(CONFIG_CHIP_M32700) - /* WORKAROUND: IMASK bug M32700-TS1, TS2 chip. */ - bnez r0, 0f - ld24 r14, #0x00070000 - seth r0, #shigh(M32R_ICU_IMASK_ADDR) - st r14, @(low(M32R_ICU_IMASK_ADDR),r0) - bra 1f - .fillinsn -0: -#endif /* CONFIG_CHIP_M32700 */ - beqz r0, 1f ; if (!irq_num) goto exit - ;; IPI check - cmpi r0, #(M32R_IRQ_IPI0<<2) ; ISN < IPI0 check - bc 2f - cmpi r0, #((M32R_IRQ_IPI7+1)<<2) ; ISN > IPI7 check - bnc 2f - LDIMM (r2, ei_vec_table) - add r2, r0 - ld r2, @r2 - beqz r2, 1f ; if (no IPI handler) goto exit - mv r0, r1 ; arg0(regs) - jl r2 - .fillinsn -1: - addi sp, #4 - bra restore_all - .fillinsn -2: - srli r0, #2 -#else /* not CONFIG_SMP */ - srli r0, #22 ; r0(irq) -#endif /* not CONFIG_SMP */ - -#if defined(CONFIG_PLAT_HAS_INT1ICU) - add3 r2, r0, #-(M32R_IRQ_INT1) ; INT1# interrupt - bnez r2, 3f - seth r0, #shigh(M32R_INT1ICU_ISTS) - lduh r0, @(low(M32R_INT1ICU_ISTS),r0) ; bit10-6 : ISN - slli r0, #21 - srli r0, #27 ; ISN - addi r0, #(M32R_INT1ICU_IRQ_BASE) - bra check_end - .fillinsn -3: -#endif /* CONFIG_PLAT_HAS_INT1ICU */ -#if defined(CONFIG_PLAT_HAS_INT0ICU) - add3 r2, r0, #-(M32R_IRQ_INT0) ; INT0# interrupt - bnez r2, 4f - seth r0, #shigh(M32R_INT0ICU_ISTS) - lduh r0, @(low(M32R_INT0ICU_ISTS),r0) ; bit10-6 : ISN - slli r0, #21 - srli r0, #27 ; ISN - add3 r0, r0, #(M32R_INT0ICU_IRQ_BASE) - bra check_end - .fillinsn -4: -#endif /* CONFIG_PLAT_HAS_INT0ICU */ -#if defined(CONFIG_PLAT_HAS_INT2ICU) - add3 r2, r0, #-(M32R_IRQ_INT2) ; INT2# interrupt - bnez r2, 5f - seth r0, #shigh(M32R_INT2ICU_ISTS) - lduh r0, @(low(M32R_INT2ICU_ISTS),r0) ; bit10-6 : ISN - slli r0, #21 - srli r0, #27 ; ISN - add3 r0, r0, #(M32R_INT2ICU_IRQ_BASE) - ; bra check_end - .fillinsn -5: -#endif /* CONFIG_PLAT_HAS_INT2ICU */ - -check_end: - bl do_IRQ - pop r14 - seth r0, #shigh(M32R_ICU_IMASK_ADDR) - st r14, @(low(M32R_ICU_IMASK_ADDR),r0) - bra ret_from_intr - -/* - * Default EIT handler - */ - ALIGN -int_msg: - .asciz "Unknown interrupt\n" - .byte 0 - -ENTRY(default_eit_handler) - push r0 - mvfc r0, psw - push r1 - push r2 - push r3 - push r0 - LDIMM (r0, __KERNEL_DS) - mv r0, r1 - mv r0, r2 - LDIMM (r0, int_msg) - bl printk - pop r0 - pop r3 - pop r2 - pop r1 - mvtc r0, psw - pop r0 -infinit: - bra infinit - -#ifdef CONFIG_MMU -/* - * Access Exception handler - */ -ENTRY(ace_handler) - SWITCH_TO_KERNEL_STACK - SAVE_ALL - - seth r2, #shigh(MMU_REG_BASE) /* Check status register */ - ld r4, @(low(MESTS_offset),r2) - st r4, @(low(MESTS_offset),r2) - srl3 r1, r4, #4 -#ifdef CONFIG_CHIP_M32700 - and3 r1, r1, #0x0000ffff - ; WORKAROUND: ignore TME bit for the M32700(TS1). -#endif /* CONFIG_CHIP_M32700 */ - beqz r1, inst -oprand: - ld r2, @(low(MDEVA_offset),r2) ; set address - srli r1, #1 - bra 1f -inst: - and3 r1, r4, #2 - srli r1, #1 - or3 r1, r1, #8 - mvfc r2, bpc ; set address - .fillinsn -1: - mvfc r3, psw - mv r0, sp - and3 r3, r3, 0x800 - srli r3, #9 - or r1, r3 - /* - * do_page_fault(): - * r0 : struct pt_regs *regs - * r1 : unsigned long error-code - * r2 : unsigned long address - * error-code: - * +------+------+------+------+ - * | bit3 | bit2 | bit1 | bit0 | - * +------+------+------+------+ - * bit 3 == 0:means data, 1:means instruction - * bit 2 == 0:means kernel, 1:means user-mode - * bit 1 == 0:means read, 1:means write - * bit 0 == 0:means no page found 1:means protection fault - * - */ - bl do_page_fault - bra ret_from_intr -#endif /* CONFIG_MMU */ - - -ENTRY(alignment_check) - /* void alignment_check(int error_code) */ - SWITCH_TO_KERNEL_STACK - SAVE_ALL - ldi r1, #0x30 ; error_code - mv r0, sp ; pt_regs - bl do_alignment_check -error_code: - bra ret_from_exception - -ENTRY(rie_handler) - /* void rie_handler(int error_code) */ - SWITCH_TO_KERNEL_STACK - SAVE_ALL - ldi r1, #0x20 ; error_code - mv r0, sp ; pt_regs - bl do_rie_handler - bra error_code - -ENTRY(pie_handler) - /* void pie_handler(int error_code) */ - SWITCH_TO_KERNEL_STACK - SAVE_ALL - ldi r1, #0 ; error_code ; FIXME - mv r0, sp ; pt_regs - bl do_pie_handler - bra error_code - -ENTRY(debug_trap) - /* void debug_trap(void) */ - .global withdraw_debug_trap - SWITCH_TO_KERNEL_STACK - SAVE_ALL - mv r0, sp ; pt_regs - bl withdraw_debug_trap - ldi r1, #0 ; error_code - mv r0, sp ; pt_regs - bl do_debug_trap - bra error_code - -ENTRY(ill_trap) - /* void ill_trap(void) */ - SWITCH_TO_KERNEL_STACK - SAVE_ALL - ldi r1, #0 ; error_code ; FIXME - mv r0, sp ; pt_regs - bl do_ill_trap - bra error_code - -ENTRY(cache_flushing_handler) - /* void _flush_cache_all(void); */ - .global _flush_cache_all - SWITCH_TO_KERNEL_STACK - push r0 - push r1 - push r2 - push r3 - push r4 - push r5 - push r6 - push r7 - push lr - bl _flush_cache_all - pop lr - pop r7 - pop r6 - pop r5 - pop r4 - pop r3 - pop r2 - pop r1 - pop r0 - rte - - .section .rodata,"a" -#include "syscall_table.S" - -syscall_table_size=(.-sys_call_table) diff --git a/arch/m32r/kernel/head.S b/arch/m32r/kernel/head.S deleted file mode 100644 index 1f040973df1cb..0000000000000 --- a/arch/m32r/kernel/head.S +++ /dev/null @@ -1,284 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * linux/arch/m32r/kernel/head.S - * - * M32R startup code. - * - * Copyright (c) 2001, 2002 Hiroyuki Kondo, Hirokazu Takata, - * Hitoshi Yamamoto - */ - -#include -__INIT -__INITDATA - - .text -#include -#include -#include -#include -#include -#include -#include - -/* - * References to members of the boot_cpu_data structure. - */ -__HEAD - .global start_kernel - .global __bss_start - .global _end -ENTRY(stext) -ENTRY(_stext) - /* Setup up the stack pointer */ - LDIMM (r0, spi_stack_top) - LDIMM (r1, spu_stack_top) - mvtc r0, spi - mvtc r1, spu - - /* Initilalize PSW */ - ldi r0, #0x0000 /* use SPI, disable EI */ - mvtc r0, psw - - /* Set up the stack pointer */ - LDIMM (r0, stack_start) - ld r0, @r0 - mvtc r0, spi - -/* - * Clear BSS first so that there are no surprises... - */ -#ifdef CONFIG_ISA_DUAL_ISSUE - - LDIMM (r2, __bss_start) - LDIMM (r3, _end) - sub r3, r2 ; BSS size in bytes - ; R4 = BSS size in longwords (rounded down) - mv r4, r3 || ldi r1, #0 - srli r4, #4 || addi r2, #-4 - beqz r4, .Lendloop1 -.Lloop1: -#ifndef CONFIG_CHIP_M32310 - ; Touch memory for the no-write-allocating cache. - ld r0, @(4,r2) -#endif - st r1, @+r2 || addi r4, #-1 - st r1, @+r2 - st r1, @+r2 - st r1, @+r2 || cmpeq r1, r4 ; R4 = 0? - bnc .Lloop1 -.Lendloop1: - and3 r4, r3, #15 - addi r2, #4 - beqz r4, .Lendloop2 -.Lloop2: - stb r1, @r2 || addi r4, #-1 - addi r2, #1 - bnez r4, .Lloop2 -.Lendloop2: - -#else /* not CONFIG_ISA_DUAL_ISSUE */ - - LDIMM (r2, __bss_start) - LDIMM (r3, _end) - sub r3, r2 ; BSS size in bytes - mv r4, r3 - srli r4, #2 ; R4 = BSS size in longwords (rounded down) - ldi r1, #0 ; clear R1 for longwords store - addi r2, #-4 ; account for pre-inc store - beqz r4, .Lendloop1 ; any more to go? -.Lloop1: - st r1, @+r2 ; yep, zero out another longword - addi r4, #-1 ; decrement count - bnez r4, .Lloop1 ; go do some more -.Lendloop1: - and3 r4, r3, #3 ; get no. of remaining BSS bytes to clear - addi r2, #4 ; account for pre-inc store - beqz r4, .Lendloop2 ; any more to go? -.Lloop2: - stb r1, @r2 ; yep, zero out another byte - addi r2, #1 ; bump address - addi r4, #-1 ; decrement count - bnez r4, .Lloop2 ; go do some more -.Lendloop2: - -#endif /* not CONFIG_ISA_DUAL_ISSUE */ - -#if 0 /* M32R_FIXME */ -/* - * Copy data segment from ROM to RAM. - */ - .global ROM_D, TOP_DATA, END_DATA - - LDIMM (r1, ROM_D) - LDIMM (r2, TOP_DATA) - LDIMM (r3, END_DATA) - addi r2, #-4 - addi r3, #-4 -loop1: - ld r0, @r1+ - st r0, @+r2 - cmp r2, r3 - bc loop1 -#endif /* 0 */ - -/* Jump to kernel */ - LDIMM (r2, start_kernel) - jl r2 - .fillinsn -1: - bra 1b ; main should never return here, but - ; just in case, we know what happens. - -#ifdef CONFIG_SMP -/* - * AP startup routine - */ - .global eit_vector -ENTRY(startup_AP) -;; setup EVB - LDIMM (r4, eit_vector) - mvtc r4, cr5 - -;; enable MMU - LDIMM (r2, init_tlb) - jl r2 - seth r4, #high(MATM) - or3 r4, r4, #low(MATM) - ldi r5, #0x01 - st r5, @r4 ; Set MATM Reg(T bit ON) - ld r6, @r4 ; MATM Check - LDIMM (r5, 1f) - jmp r5 ; enable MMU - nop - .fillinsn -1: -;; ISN check - ld r6, @r4 ; MATM Check - seth r4, #high(M32R_ICU_ISTS_ADDR) - or3 r4, r4, #low(M32R_ICU_ISTS_ADDR) - ld r5, @r4 ; Read ISTSi reg. - mv r6, r5 - slli r5, #13 ; PIML check - srli r5, #13 ; - seth r4, #high(M32R_ICU_IMASK_ADDR) - or3 r4, r4, #low(M32R_ICU_IMASK_ADDR) - st r5, @r4 ; Write IMASKi reg. - slli r6, #4 ; ISN check - srli r6, #26 ; - seth r4, #high(M32R_IRQ_IPI5) - or3 r4, r4, #low(M32R_IRQ_IPI5) - bne r4, r6, 2f ; if (ISN != CPU_BOOT_IPI) goto sleep; - -;; check cpu_bootout_map and set cpu_bootin_map - LDIMM (r4, cpu_bootout_map) - ld r4, @r4 - seth r5, #high(M32R_CPUID_PORTL) - or3 r5, r5, #low(M32R_CPUID_PORTL) - ld r5, @r5 - ldi r6, #1 - sll r6, r5 - and r4, r6 - beqz r4, 2f - LDIMM (r4, cpu_bootin_map) - ld r5, @r4 - or r5, r6 - st r6, @r4 - -;; clear PSW - ldi r4, #0 - mvtc r4, psw - -;; setup SPI - LDIMM (r4, stack_start) - ld r4, @r4 - mvtc r4, spi - -;; setup BPC (start_secondary) - LDIMM (r4, start_secondary) - mvtc r4, bpc - - rte ; goto startup_secondary - nop - nop - - .fillinsn -2: - ;; disable MMU - seth r4, #high(MATM) - or3 r4, r4, #low(MATM) - ldi r5, #0 - st r5, @r4 ; Set MATM Reg(T bit OFF) - ld r6, @r4 ; MATM Check - LDIMM (r4, 3f) - seth r5, #high(__PAGE_OFFSET) - or3 r5, r5, #low(__PAGE_OFFSET) - not r5, r5 - and r4, r5 - jmp r4 ; disable MMU - nop - .fillinsn -3: - ;; SLEEP and wait IPI - LDIMM (r4, AP_loop) - seth r5, #high(__PAGE_OFFSET) - or3 r5, r5, #low(__PAGE_OFFSET) - not r5, r5 - and r4, r5 - jmp r4 - nop - nop -#endif /* CONFIG_SMP */ - - .text -ENTRY(stack_start) - .long init_thread_union+8192 - .long __KERNEL_DS - -/* - * This is initialized to create a identity-mapping at 0-4M (for bootup - * purposes) and another mapping of the 0-4M area at virtual address - * PAGE_OFFSET. - */ - .text - -#define MOUNT_ROOT_RDONLY 1 -#define RAMDISK_FLAGS 0 ; 1024KB -#define ORIG_ROOT_DEV 0x0100 ; /dev/ram0 (major:01, minor:00) -#define LOADER_TYPE 1 ; (??? - non-zero value seems - ; to be needed to boot from initrd) - -#define COMMAND_LINE "" - - .section .empty_zero_page, "aw" -ENTRY(empty_zero_page) - .long MOUNT_ROOT_RDONLY /* offset: +0x00 */ - .long RAMDISK_FLAGS - .long ORIG_ROOT_DEV - .long LOADER_TYPE - .long 0 /* INITRD_START */ /* +0x10 */ - .long 0 /* INITRD_SIZE */ - .long 0 /* CPU_CLOCK */ - .long 0 /* BUS_CLOCK */ - .long 0 /* TIMER_DIVIDE */ /* +0x20 */ - .balign 256,0 - .asciz COMMAND_LINE - .byte 0 - .balign 4096,0,4096 - -/*------------------------------------------------------------------------ - * Stack area - */ - .section .init.data, "aw" - ALIGN - .global spi_stack_top - .zero 1024 -spi_stack_top: - - .section .init.data, "aw" - ALIGN - .global spu_stack_top - .zero 1024 -spu_stack_top: - - .end diff --git a/arch/m32r/kernel/irq.c b/arch/m32r/kernel/irq.c deleted file mode 100644 index 83b5032f176cd..0000000000000 --- a/arch/m32r/kernel/irq.c +++ /dev/null @@ -1,44 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * linux/arch/m32r/kernel/irq.c - * - * Copyright (c) 2003, 2004 Hitoshi Yamamoto - * Copyright (c) 2004 Hirokazu Takata - */ - -/* - * linux/arch/i386/kernel/irq.c - * - * Copyright (C) 1992, 1998 Linus Torvalds, Ingo Molnar - * - * This file contains the lowest level m32r-specific interrupt - * entry and irq statistics code. All the remaining irq logic is - * done by the generic kernel/irq/ code and in the - * m32r-specific irq controller code. - */ - -#include -#include -#include -#include - -/* - * do_IRQ handles all normal device IRQs (the special - * SMP cross-CPU interrupts have their own specific - * handlers). - */ -asmlinkage unsigned int do_IRQ(int irq, struct pt_regs *regs) -{ - struct pt_regs *old_regs; - old_regs = set_irq_regs(regs); - irq_enter(); - -#ifdef CONFIG_DEBUG_STACKOVERFLOW - /* FIXME M32R */ -#endif - generic_handle_irq(irq); - irq_exit(); - set_irq_regs(old_regs); - - return 1; -} diff --git a/arch/m32r/kernel/m32r_ksyms.c b/arch/m32r/kernel/m32r_ksyms.c deleted file mode 100644 index 46ebe071e4d6e..0000000000000 --- a/arch/m32r/kernel/m32r_ksyms.c +++ /dev/null @@ -1,89 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -/* platform dependent support */ -EXPORT_SYMBOL(boot_cpu_data); -EXPORT_SYMBOL(dump_fpu); -EXPORT_SYMBOL(__ioremap); -EXPORT_SYMBOL(iounmap); - -EXPORT_SYMBOL(strncpy_from_user); -EXPORT_SYMBOL(clear_user); -EXPORT_SYMBOL(__clear_user); -EXPORT_SYMBOL(strnlen_user); - -#ifdef CONFIG_SMP -#ifdef CONFIG_CHIP_M32700_TS1 -extern void *dcache_dummy; -EXPORT_SYMBOL(dcache_dummy); -#endif -EXPORT_SYMBOL(cpu_data); - -/* TLB flushing */ -EXPORT_SYMBOL(smp_flush_tlb_page); -#endif - -extern int __ucmpdi2(unsigned long long a, unsigned long long b); -EXPORT_SYMBOL(__ucmpdi2); - -/* compiler generated symbol */ -extern void __ashldi3(void); -extern void __ashrdi3(void); -extern void __lshldi3(void); -extern void __lshrdi3(void); -extern void __muldi3(void); -EXPORT_SYMBOL(__ashldi3); -EXPORT_SYMBOL(__ashrdi3); -EXPORT_SYMBOL(__lshldi3); -EXPORT_SYMBOL(__lshrdi3); -EXPORT_SYMBOL(__muldi3); - -/* memory and string operations */ -EXPORT_SYMBOL(memcpy); -EXPORT_SYMBOL(memset); -EXPORT_SYMBOL(copy_page); -EXPORT_SYMBOL(clear_page); -EXPORT_SYMBOL(strlen); -EXPORT_SYMBOL(empty_zero_page); - -EXPORT_SYMBOL(_inb); -EXPORT_SYMBOL(_inw); -EXPORT_SYMBOL(_inl); -EXPORT_SYMBOL(_outb); -EXPORT_SYMBOL(_outw); -EXPORT_SYMBOL(_outl); -EXPORT_SYMBOL(_inb_p); -EXPORT_SYMBOL(_inw_p); -EXPORT_SYMBOL(_inl_p); -EXPORT_SYMBOL(_outb_p); -EXPORT_SYMBOL(_outw_p); -EXPORT_SYMBOL(_outl_p); -EXPORT_SYMBOL(_insb); -EXPORT_SYMBOL(_insw); -EXPORT_SYMBOL(_insl); -EXPORT_SYMBOL(_outsb); -EXPORT_SYMBOL(_outsw); -EXPORT_SYMBOL(_outsl); -EXPORT_SYMBOL(_readb); -EXPORT_SYMBOL(_readw); -EXPORT_SYMBOL(_readl); -EXPORT_SYMBOL(_writeb); -EXPORT_SYMBOL(_writew); -EXPORT_SYMBOL(_writel); - diff --git a/arch/m32r/kernel/module.c b/arch/m32r/kernel/module.c deleted file mode 100644 index 38233b6596b6e..0000000000000 --- a/arch/m32r/kernel/module.c +++ /dev/null @@ -1,203 +0,0 @@ -/* Kernel module help for M32R. - - 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 -*/ - -#include -#include -#include -#include -#include -#include - -#if 0 -#define DEBUGP printk -#else -#define DEBUGP(fmt...) -#endif - -#define COPY_UNALIGNED_WORD(sw, tw, align) \ -{ \ - void *__s = &(sw), *__t = &(tw); \ - unsigned short *__s2 = __s, *__t2 =__t; \ - unsigned char *__s1 = __s, *__t1 =__t; \ - switch ((align)) \ - { \ - case 0: \ - *(unsigned long *) __t = *(unsigned long *) __s; \ - break; \ - case 2: \ - *__t2++ = *__s2++; \ - *__t2 = *__s2; \ - break; \ - default: \ - *__t1++ = *__s1++; \ - *__t1++ = *__s1++; \ - *__t1++ = *__s1++; \ - *__t1 = *__s1; \ - break; \ - } \ -} - -#define COPY_UNALIGNED_HWORD(sw, tw, align) \ - { \ - void *__s = &(sw), *__t = &(tw); \ - unsigned short *__s2 = __s, *__t2 =__t; \ - unsigned char *__s1 = __s, *__t1 =__t; \ - switch ((align)) \ - { \ - case 0: \ - *__t2 = *__s2; \ - break; \ - default: \ - *__t1++ = *__s1++; \ - *__t1 = *__s1; \ - break; \ - } \ - } - -int apply_relocate_add(Elf32_Shdr *sechdrs, - const char *strtab, - unsigned int symindex, - unsigned int relsec, - struct module *me) -{ - unsigned int i; - Elf32_Rela *rel = (void *)sechdrs[relsec].sh_addr; - Elf32_Sym *sym; - Elf32_Addr relocation; - uint32_t *location; - uint32_t value; - unsigned short *hlocation; - unsigned short hvalue; - int svalue; - int align; - - DEBUGP("Applying relocate section %u to %u\n", relsec, - sechdrs[relsec].sh_info); - for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) { - /* This is where to make the change */ - location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr - + rel[i].r_offset; - /* This is the symbol it is referring to. Note that all - undefined symbols have been resolved. */ - sym = (Elf32_Sym *)sechdrs[symindex].sh_addr - + ELF32_R_SYM(rel[i].r_info); - relocation = sym->st_value + rel[i].r_addend; - align = (int)location & 3; - - switch (ELF32_R_TYPE(rel[i].r_info)) { - case R_M32R_32_RELA: - COPY_UNALIGNED_WORD (*location, value, align); - value += relocation; - COPY_UNALIGNED_WORD (value, *location, align); - break; - case R_M32R_HI16_ULO_RELA: - COPY_UNALIGNED_WORD (*location, value, align); - relocation = (relocation >>16) & 0xffff; - /* RELA must has 0 at relocation field. */ - value += relocation; - COPY_UNALIGNED_WORD (value, *location, align); - break; - case R_M32R_HI16_SLO_RELA: - COPY_UNALIGNED_WORD (*location, value, align); - if (relocation & 0x8000) relocation += 0x10000; - relocation = (relocation >>16) & 0xffff; - /* RELA must has 0 at relocation field. */ - value += relocation; - COPY_UNALIGNED_WORD (value, *location, align); - break; - case R_M32R_16_RELA: - hlocation = (unsigned short *)location; - relocation = relocation & 0xffff; - /* RELA must has 0 at relocation field. */ - hvalue = relocation; - COPY_UNALIGNED_WORD (hvalue, *hlocation, align); - break; - case R_M32R_SDA16_RELA: - case R_M32R_LO16_RELA: - COPY_UNALIGNED_WORD (*location, value, align); - relocation = relocation & 0xffff; - /* RELA must has 0 at relocation field. */ - value += relocation; - COPY_UNALIGNED_WORD (value, *location, align); - break; - case R_M32R_24_RELA: - COPY_UNALIGNED_WORD (*location, value, align); - relocation = relocation & 0xffffff; - /* RELA must has 0 at relocation field. */ - value += relocation; - COPY_UNALIGNED_WORD (value, *location, align); - break; - case R_M32R_18_PCREL_RELA: - relocation = (relocation - (Elf32_Addr) location); - if (relocation < -0x20000 || 0x1fffc < relocation) - { - printk(KERN_ERR "module %s: relocation overflow: %u\n", - me->name, relocation); - return -ENOEXEC; - } - COPY_UNALIGNED_WORD (*location, value, align); - if (value & 0xffff) - { - /* RELA must has 0 at relocation field. */ - printk(KERN_ERR "module %s: illegal relocation field: %u\n", - me->name, value); - return -ENOEXEC; - } - relocation = (relocation >> 2) & 0xffff; - value += relocation; - COPY_UNALIGNED_WORD (value, *location, align); - break; - case R_M32R_10_PCREL_RELA: - hlocation = (unsigned short *)location; - relocation = (relocation - (Elf32_Addr) location); - COPY_UNALIGNED_HWORD (*hlocation, hvalue, align); - svalue = (int)hvalue; - svalue = (signed char)svalue << 2; - relocation += svalue; - relocation = (relocation >> 2) & 0xff; - hvalue = hvalue & 0xff00; - hvalue += relocation; - COPY_UNALIGNED_HWORD (hvalue, *hlocation, align); - break; - case R_M32R_26_PCREL_RELA: - relocation = (relocation - (Elf32_Addr) location); - if (relocation < -0x2000000 || 0x1fffffc < relocation) - { - printk(KERN_ERR "module %s: relocation overflow: %u\n", - me->name, relocation); - return -ENOEXEC; - } - COPY_UNALIGNED_WORD (*location, value, align); - if (value & 0xffffff) - { - /* RELA must has 0 at relocation field. */ - printk(KERN_ERR "module %s: illegal relocation field: %u\n", - me->name, value); - return -ENOEXEC; - } - relocation = (relocation >> 2) & 0xffffff; - value += relocation; - COPY_UNALIGNED_WORD (value, *location, align); - break; - default: - printk(KERN_ERR "module %s: Unknown relocation: %u\n", - me->name, ELF32_R_TYPE(rel[i].r_info)); - return -ENOEXEC; - } - } - return 0; -} diff --git a/arch/m32r/kernel/process.c b/arch/m32r/kernel/process.c deleted file mode 100644 index a1a4cb136e998..0000000000000 --- a/arch/m32r/kernel/process.c +++ /dev/null @@ -1,154 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * linux/arch/m32r/kernel/process.c - * - * Copyright (c) 2001, 2002 Hiroyuki Kondo, Hirokazu Takata, - * Hitoshi Yamamoto - * Taken from sh version. - * Copyright (C) 1995 Linus Torvalds - * SuperH version: Copyright (C) 1999, 2000 Niibe Yutaka & Kaz Kojima - */ - -#undef DEBUG_PROCESS -#ifdef DEBUG_PROCESS -#define DPRINTK(fmt, args...) printk("%s:%d:%s: " fmt, __FILE__, __LINE__, \ - __func__, ##args) -#else -#define DPRINTK(fmt, args...) -#endif - -/* - * This file handles the architecture-dependent parts of process handling.. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include - -void (*pm_power_off)(void) = NULL; -EXPORT_SYMBOL(pm_power_off); - -void machine_restart(char *__unused) -{ -#if defined(CONFIG_PLAT_MAPPI3) - outw(1, (unsigned long)PLD_REBOOT); -#endif - - printk("Please push reset button!\n"); - while (1) - cpu_relax(); -} - -void machine_halt(void) -{ - printk("Please push reset button!\n"); - while (1) - cpu_relax(); -} - -void machine_power_off(void) -{ - /* M32R_FIXME */ -} - -void show_regs(struct pt_regs * regs) -{ - printk("\n"); - show_regs_print_info(KERN_DEFAULT); - - printk("BPC[%08lx]:PSW[%08lx]:LR [%08lx]:FP [%08lx]\n", \ - regs->bpc, regs->psw, regs->lr, regs->fp); - printk("BBPC[%08lx]:BBPSW[%08lx]:SPU[%08lx]:SPI[%08lx]\n", \ - regs->bbpc, regs->bbpsw, regs->spu, regs->spi); - printk("R0 [%08lx]:R1 [%08lx]:R2 [%08lx]:R3 [%08lx]\n", \ - regs->r0, regs->r1, regs->r2, regs->r3); - printk("R4 [%08lx]:R5 [%08lx]:R6 [%08lx]:R7 [%08lx]\n", \ - regs->r4, regs->r5, regs->r6, regs->r7); - printk("R8 [%08lx]:R9 [%08lx]:R10[%08lx]:R11[%08lx]\n", \ - regs->r8, regs->r9, regs->r10, regs->r11); - printk("R12[%08lx]\n", \ - regs->r12); - -#if defined(CONFIG_ISA_M32R2) && defined(CONFIG_ISA_DSP_LEVEL2) - printk("ACC0H[%08lx]:ACC0L[%08lx]\n", \ - regs->acc0h, regs->acc0l); - printk("ACC1H[%08lx]:ACC1L[%08lx]\n", \ - regs->acc1h, regs->acc1l); -#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R) - printk("ACCH[%08lx]:ACCL[%08lx]\n", \ - regs->acc0h, regs->acc0l); -#else -#error unknown isa configuration -#endif -} - -void flush_thread(void) -{ - DPRINTK("pid = %d\n", current->pid); - memset(¤t->thread.debug_trap, 0, sizeof(struct debug_trap)); -} - -void release_thread(struct task_struct *dead_task) -{ - /* do nothing */ - DPRINTK("pid = %d\n", dead_task->pid); -} - -/* Fill in the fpu structure for a core dump.. */ -int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu) -{ - return 0; /* Task didn't use the fpu at all. */ -} - -int copy_thread(unsigned long clone_flags, unsigned long spu, - unsigned long arg, struct task_struct *tsk) -{ - struct pt_regs *childregs = task_pt_regs(tsk); - extern void ret_from_fork(void); - extern void ret_from_kernel_thread(void); - - if (unlikely(tsk->flags & PF_KTHREAD)) { - memset(childregs, 0, sizeof(struct pt_regs)); - childregs->psw = M32R_PSW_BIE; - childregs->r1 = spu; /* fn */ - childregs->r0 = arg; - tsk->thread.lr = (unsigned long)ret_from_kernel_thread; - } else { - /* Copy registers */ - *childregs = *current_pt_regs(); - if (spu) - childregs->spu = spu; - childregs->r0 = 0; /* Child gets zero as return value */ - tsk->thread.lr = (unsigned long)ret_from_fork; - } - tsk->thread.sp = (unsigned long)childregs; - - return 0; -} - -/* - * These bracket the sleeping functions.. - */ -#define first_sched ((unsigned long) scheduling_functions_start_here) -#define last_sched ((unsigned long) scheduling_functions_end_here) - -unsigned long get_wchan(struct task_struct *p) -{ - /* M32R_FIXME */ - return (0); -} diff --git a/arch/m32r/kernel/ptrace.c b/arch/m32r/kernel/ptrace.c deleted file mode 100644 index d702a5ca0f928..0000000000000 --- a/arch/m32r/kernel/ptrace.c +++ /dev/null @@ -1,708 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * linux/arch/m32r/kernel/ptrace.c - * - * Copyright (C) 2002 Hirokazu Takata, Takeo Takahashi - * Copyright (C) 2004 Hirokazu Takata, Kei Sakamoto - * - * Original x86 implementation: - * By Ross Biro 1/23/92 - * edited by Linus Torvalds - * - * Some code taken from sh version: - * Copyright (C) 1999, 2000 Kaz Kojima & Niibe Yutaka - * Some code taken from arm version: - * Copyright (C) 2000 Russell King - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -/* - * This routine will get a word off of the process kernel stack. - */ -static inline unsigned long int -get_stack_long(struct task_struct *task, int offset) -{ - unsigned long *stack; - - stack = (unsigned long *)task_pt_regs(task); - - return stack[offset]; -} - -/* - * This routine will put a word on the process kernel stack. - */ -static inline int -put_stack_long(struct task_struct *task, int offset, unsigned long data) -{ - unsigned long *stack; - - stack = (unsigned long *)task_pt_regs(task); - stack[offset] = data; - - return 0; -} - -static int reg_offset[] = { - PT_R0, PT_R1, PT_R2, PT_R3, PT_R4, PT_R5, PT_R6, PT_R7, - PT_R8, PT_R9, PT_R10, PT_R11, PT_R12, PT_FP, PT_LR, PT_SPU, -}; - -/* - * Read the word at offset "off" into the "struct user". We - * actually access the pt_regs stored on the kernel stack. - */ -static int ptrace_read_user(struct task_struct *tsk, unsigned long off, - unsigned long __user *data) -{ - unsigned long tmp; -#ifndef NO_FPU - struct user * dummy = NULL; -#endif - - if ((off & 3) || off > sizeof(struct user) - 3) - return -EIO; - - off >>= 2; - switch (off) { - case PT_EVB: - __asm__ __volatile__ ( - "mvfc %0, cr5 \n\t" - : "=r" (tmp) - ); - break; - case PT_CBR: { - unsigned long psw; - psw = get_stack_long(tsk, PT_PSW); - tmp = ((psw >> 8) & 1); - } - break; - case PT_PSW: { - unsigned long psw, bbpsw; - psw = get_stack_long(tsk, PT_PSW); - bbpsw = get_stack_long(tsk, PT_BBPSW); - tmp = ((psw >> 8) & 0xff) | ((bbpsw & 0xff) << 8); - } - break; - case PT_PC: - tmp = get_stack_long(tsk, PT_BPC); - break; - case PT_BPC: - off = PT_BBPC; - /* fall through */ - default: - if (off < (sizeof(struct pt_regs) >> 2)) - tmp = get_stack_long(tsk, off); -#ifndef NO_FPU - else if (off >= (long)(&dummy->fpu >> 2) && - off < (long)(&dummy->u_fpvalid >> 2)) { - if (!tsk_used_math(tsk)) { - if (off == (long)(&dummy->fpu.fpscr >> 2)) - tmp = FPSCR_INIT; - else - tmp = 0; - } else - tmp = ((long *)(&tsk->thread.fpu >> 2)) - [off - (long)&dummy->fpu]; - } else if (off == (long)(&dummy->u_fpvalid >> 2)) - tmp = !!tsk_used_math(tsk); -#endif /* not NO_FPU */ - else - tmp = 0; - } - - return put_user(tmp, data); -} - -static int ptrace_write_user(struct task_struct *tsk, unsigned long off, - unsigned long data) -{ - int ret = -EIO; -#ifndef NO_FPU - struct user * dummy = NULL; -#endif - - if ((off & 3) || off > sizeof(struct user) - 3) - return -EIO; - - off >>= 2; - switch (off) { - case PT_EVB: - case PT_BPC: - case PT_SPI: - /* We don't allow to modify evb. */ - ret = 0; - break; - case PT_PSW: - case PT_CBR: { - /* We allow to modify only cbr in psw */ - unsigned long psw; - psw = get_stack_long(tsk, PT_PSW); - psw = (psw & ~0x100) | ((data & 1) << 8); - ret = put_stack_long(tsk, PT_PSW, psw); - } - break; - case PT_PC: - off = PT_BPC; - data &= ~1; - /* fall through */ - default: - if (off < (sizeof(struct pt_regs) >> 2)) - ret = put_stack_long(tsk, off, data); -#ifndef NO_FPU - else if (off >= (long)(&dummy->fpu >> 2) && - off < (long)(&dummy->u_fpvalid >> 2)) { - set_stopped_child_used_math(tsk); - ((long *)&tsk->thread.fpu) - [off - (long)&dummy->fpu] = data; - ret = 0; - } else if (off == (long)(&dummy->u_fpvalid >> 2)) { - conditional_stopped_child_used_math(data, tsk); - ret = 0; - } -#endif /* not NO_FPU */ - break; - } - - return ret; -} - -/* - * Get all user integer registers. - */ -static int ptrace_getregs(struct task_struct *tsk, void __user *uregs) -{ - struct pt_regs *regs = task_pt_regs(tsk); - - return copy_to_user(uregs, regs, sizeof(struct pt_regs)) ? -EFAULT : 0; -} - -/* - * Set all user integer registers. - */ -static int ptrace_setregs(struct task_struct *tsk, void __user *uregs) -{ - struct pt_regs newregs; - int ret; - - ret = -EFAULT; - if (copy_from_user(&newregs, uregs, sizeof(struct pt_regs)) == 0) { - struct pt_regs *regs = task_pt_regs(tsk); - *regs = newregs; - ret = 0; - } - - return ret; -} - - -static inline int -check_condition_bit(struct task_struct *child) -{ - return (int)((get_stack_long(child, PT_PSW) >> 8) & 1); -} - -static int -check_condition_src(unsigned long op, unsigned long regno1, - unsigned long regno2, struct task_struct *child) -{ - unsigned long reg1, reg2; - - reg2 = get_stack_long(child, reg_offset[regno2]); - - switch (op) { - case 0x0: /* BEQ */ - reg1 = get_stack_long(child, reg_offset[regno1]); - return reg1 == reg2; - case 0x1: /* BNE */ - reg1 = get_stack_long(child, reg_offset[regno1]); - return reg1 != reg2; - case 0x8: /* BEQZ */ - return reg2 == 0; - case 0x9: /* BNEZ */ - return reg2 != 0; - case 0xa: /* BLTZ */ - return (int)reg2 < 0; - case 0xb: /* BGEZ */ - return (int)reg2 >= 0; - case 0xc: /* BLEZ */ - return (int)reg2 <= 0; - case 0xd: /* BGTZ */ - return (int)reg2 > 0; - default: - /* never reached */ - return 0; - } -} - -static void -compute_next_pc_for_16bit_insn(unsigned long insn, unsigned long pc, - unsigned long *next_pc, - struct task_struct *child) -{ - unsigned long op, op2, op3; - unsigned long disp; - unsigned long regno; - int parallel = 0; - - if (insn & 0x00008000) - parallel = 1; - if (pc & 3) - insn &= 0x7fff; /* right slot */ - else - insn >>= 16; /* left slot */ - - op = (insn >> 12) & 0xf; - op2 = (insn >> 8) & 0xf; - op3 = (insn >> 4) & 0xf; - - if (op == 0x7) { - switch (op2) { - case 0xd: /* BNC */ - case 0x9: /* BNCL */ - if (!check_condition_bit(child)) { - disp = (long)(insn << 24) >> 22; - *next_pc = (pc & ~0x3) + disp; - return; - } - break; - case 0x8: /* BCL */ - case 0xc: /* BC */ - if (check_condition_bit(child)) { - disp = (long)(insn << 24) >> 22; - *next_pc = (pc & ~0x3) + disp; - return; - } - break; - case 0xe: /* BL */ - case 0xf: /* BRA */ - disp = (long)(insn << 24) >> 22; - *next_pc = (pc & ~0x3) + disp; - return; - break; - } - } else if (op == 0x1) { - switch (op2) { - case 0x0: - if (op3 == 0xf) { /* TRAP */ -#if 1 - /* pass through */ -#else - /* kernel space is not allowed as next_pc */ - unsigned long evb; - unsigned long trapno; - trapno = insn & 0xf; - __asm__ __volatile__ ( - "mvfc %0, cr5\n" - :"=r"(evb) - : - ); - *next_pc = evb + (trapno << 2); - return; -#endif - } else if (op3 == 0xd) { /* RTE */ - *next_pc = get_stack_long(child, PT_BPC); - return; - } - break; - case 0xc: /* JC */ - if (op3 == 0xc && check_condition_bit(child)) { - regno = insn & 0xf; - *next_pc = get_stack_long(child, - reg_offset[regno]); - return; - } - break; - case 0xd: /* JNC */ - if (op3 == 0xc && !check_condition_bit(child)) { - regno = insn & 0xf; - *next_pc = get_stack_long(child, - reg_offset[regno]); - return; - } - break; - case 0xe: /* JL */ - case 0xf: /* JMP */ - if (op3 == 0xc) { /* JMP */ - regno = insn & 0xf; - *next_pc = get_stack_long(child, - reg_offset[regno]); - return; - } - break; - } - } - if (parallel) - *next_pc = pc + 4; - else - *next_pc = pc + 2; -} - -static void -compute_next_pc_for_32bit_insn(unsigned long insn, unsigned long pc, - unsigned long *next_pc, - struct task_struct *child) -{ - unsigned long op; - unsigned long op2; - unsigned long disp; - unsigned long regno1, regno2; - - op = (insn >> 28) & 0xf; - if (op == 0xf) { /* branch 24-bit relative */ - op2 = (insn >> 24) & 0xf; - switch (op2) { - case 0xd: /* BNC */ - case 0x9: /* BNCL */ - if (!check_condition_bit(child)) { - disp = (long)(insn << 8) >> 6; - *next_pc = (pc & ~0x3) + disp; - return; - } - break; - case 0x8: /* BCL */ - case 0xc: /* BC */ - if (check_condition_bit(child)) { - disp = (long)(insn << 8) >> 6; - *next_pc = (pc & ~0x3) + disp; - return; - } - break; - case 0xe: /* BL */ - case 0xf: /* BRA */ - disp = (long)(insn << 8) >> 6; - *next_pc = (pc & ~0x3) + disp; - return; - } - } else if (op == 0xb) { /* branch 16-bit relative */ - op2 = (insn >> 20) & 0xf; - switch (op2) { - case 0x0: /* BEQ */ - case 0x1: /* BNE */ - case 0x8: /* BEQZ */ - case 0x9: /* BNEZ */ - case 0xa: /* BLTZ */ - case 0xb: /* BGEZ */ - case 0xc: /* BLEZ */ - case 0xd: /* BGTZ */ - regno1 = ((insn >> 24) & 0xf); - regno2 = ((insn >> 16) & 0xf); - if (check_condition_src(op2, regno1, regno2, child)) { - disp = (long)(insn << 16) >> 14; - *next_pc = (pc & ~0x3) + disp; - return; - } - break; - } - } - *next_pc = pc + 4; -} - -static inline void -compute_next_pc(unsigned long insn, unsigned long pc, - unsigned long *next_pc, struct task_struct *child) -{ - if (insn & 0x80000000) - compute_next_pc_for_32bit_insn(insn, pc, next_pc, child); - else - compute_next_pc_for_16bit_insn(insn, pc, next_pc, child); -} - -static int -register_debug_trap(struct task_struct *child, unsigned long next_pc, - unsigned long next_insn, unsigned long *code) -{ - struct debug_trap *p = &child->thread.debug_trap; - unsigned long addr = next_pc & ~3; - - if (p->nr_trap == MAX_TRAPS) { - printk("kernel BUG at %s %d: p->nr_trap = %d\n", - __FILE__, __LINE__, p->nr_trap); - return -1; - } - p->addr[p->nr_trap] = addr; - p->insn[p->nr_trap] = next_insn; - p->nr_trap++; - if (next_pc & 3) { - *code = (next_insn & 0xffff0000) | 0x10f1; - /* xxx --> TRAP1 */ - } else { - if ((next_insn & 0x80000000) || (next_insn & 0x8000)) { - *code = 0x10f17000; - /* TRAP1 --> NOP */ - } else { - *code = (next_insn & 0xffff) | 0x10f10000; - /* TRAP1 --> xxx */ - } - } - return 0; -} - -static int -unregister_debug_trap(struct task_struct *child, unsigned long addr, - unsigned long *code) -{ - struct debug_trap *p = &child->thread.debug_trap; - int i; - - /* Search debug trap entry. */ - for (i = 0; i < p->nr_trap; i++) { - if (p->addr[i] == addr) - break; - } - if (i >= p->nr_trap) { - /* The trap may be requested from debugger. - * ptrace should do nothing in this case. - */ - return 0; - } - - /* Recover original instruction code. */ - *code = p->insn[i]; - - /* Shift debug trap entries. */ - while (i < p->nr_trap - 1) { - p->insn[i] = p->insn[i + 1]; - p->addr[i] = p->addr[i + 1]; - i++; - } - p->nr_trap--; - return 1; -} - -static void -unregister_all_debug_traps(struct task_struct *child) -{ - struct debug_trap *p = &child->thread.debug_trap; - int i; - - for (i = 0; i < p->nr_trap; i++) - access_process_vm(child, p->addr[i], &p->insn[i], sizeof(p->insn[i]), - FOLL_FORCE | FOLL_WRITE); - p->nr_trap = 0; -} - -static inline void -invalidate_cache(void) -{ -#if defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_OPSP) - - _flush_cache_copyback_all(); - -#else /* ! CONFIG_CHIP_M32700 */ - - /* Invalidate cache */ - __asm__ __volatile__ ( - "ldi r0, #-1 \n\t" - "ldi r1, #0 \n\t" - "stb r1, @r0 ; cache off \n\t" - "; \n\t" - "ldi r0, #-2 \n\t" - "ldi r1, #1 \n\t" - "stb r1, @r0 ; cache invalidate \n\t" - ".fillinsn \n" - "0: \n\t" - "ldb r1, @r0 ; invalidate check \n\t" - "bnez r1, 0b \n\t" - "; \n\t" - "ldi r0, #-1 \n\t" - "ldi r1, #1 \n\t" - "stb r1, @r0 ; cache on \n\t" - : : : "r0", "r1", "memory" - ); - /* FIXME: copying-back d-cache and invalidating i-cache are needed. - */ -#endif /* CONFIG_CHIP_M32700 */ -} - -/* Embed a debug trap (TRAP1) code */ -static int -embed_debug_trap(struct task_struct *child, unsigned long next_pc) -{ - unsigned long next_insn, code; - unsigned long addr = next_pc & ~3; - - if (access_process_vm(child, addr, &next_insn, sizeof(next_insn), - FOLL_FORCE) - != sizeof(next_insn)) { - return -1; /* error */ - } - - /* Set a trap code. */ - if (register_debug_trap(child, next_pc, next_insn, &code)) { - return -1; /* error */ - } - if (access_process_vm(child, addr, &code, sizeof(code), - FOLL_FORCE | FOLL_WRITE) - != sizeof(code)) { - return -1; /* error */ - } - return 0; /* success */ -} - -void -withdraw_debug_trap(struct pt_regs *regs) -{ - unsigned long addr; - unsigned long code; - - addr = (regs->bpc - 2) & ~3; - regs->bpc -= 2; - if (unregister_debug_trap(current, addr, &code)) { - access_process_vm(current, addr, &code, sizeof(code), - FOLL_FORCE | FOLL_WRITE); - invalidate_cache(); - } -} - -void -init_debug_traps(struct task_struct *child) -{ - struct debug_trap *p = &child->thread.debug_trap; - int i; - p->nr_trap = 0; - for (i = 0; i < MAX_TRAPS; i++) { - p->addr[i] = 0; - p->insn[i] = 0; - } -} - -void user_enable_single_step(struct task_struct *child) -{ - unsigned long next_pc; - unsigned long pc, insn; - - clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); - - /* Compute next pc. */ - pc = get_stack_long(child, PT_BPC); - - if (access_process_vm(child, pc&~3, &insn, sizeof(insn), - FOLL_FORCE) - != sizeof(insn)) - return; - - compute_next_pc(insn, pc, &next_pc, child); - if (next_pc & 0x80000000) - return; - - if (embed_debug_trap(child, next_pc)) - return; - - invalidate_cache(); -} - -void user_disable_single_step(struct task_struct *child) -{ - unregister_all_debug_traps(child); - invalidate_cache(); -} - -/* - * Called by kernel/ptrace.c when detaching.. - * - * Make sure single step bits etc are not set. - */ -void ptrace_disable(struct task_struct *child) -{ - /* nothing to do.. */ -} - -long -arch_ptrace(struct task_struct *child, long request, - unsigned long addr, unsigned long data) -{ - int ret; - unsigned long __user *datap = (unsigned long __user *) data; - - switch (request) { - /* - * read word at location "addr" in the child process. - */ - case PTRACE_PEEKTEXT: - case PTRACE_PEEKDATA: - ret = generic_ptrace_peekdata(child, addr, data); - break; - - /* - * read the word at location addr in the USER area. - */ - case PTRACE_PEEKUSR: - ret = ptrace_read_user(child, addr, datap); - break; - - /* - * write the word at location addr. - */ - case PTRACE_POKETEXT: - case PTRACE_POKEDATA: - ret = generic_ptrace_pokedata(child, addr, data); - if (ret == 0 && request == PTRACE_POKETEXT) - invalidate_cache(); - break; - - /* - * write the word at location addr in the USER area. - */ - case PTRACE_POKEUSR: - ret = ptrace_write_user(child, addr, data); - break; - - case PTRACE_GETREGS: - ret = ptrace_getregs(child, datap); - break; - - case PTRACE_SETREGS: - ret = ptrace_setregs(child, datap); - break; - - default: - ret = ptrace_request(child, request, addr, data); - break; - } - - return ret; -} - -/* notification of system call entry/exit - * - triggered by current->work.syscall_trace - */ -void do_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; - } -} diff --git a/arch/m32r/kernel/setup.c b/arch/m32r/kernel/setup.c deleted file mode 100644 index b72d5db39f00c..0000000000000 --- a/arch/m32r/kernel/setup.c +++ /dev/null @@ -1,424 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * linux/arch/m32r/kernel/setup.c - * - * Setup routines for Renesas M32R - * - * Copyright (c) 2001, 2002 Hiroyuki Kondo, Hirokazu Takata, - * Hitoshi Yamamoto - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#ifdef CONFIG_MMU -extern void init_mmu(void); -#endif - -extern char _end[]; - -/* - * Machine setup.. - */ -struct cpuinfo_m32r boot_cpu_data; - -#ifdef CONFIG_BLK_DEV_RAM -extern int rd_doload; /* 1 = load ramdisk, 0 = don't load */ -extern int rd_prompt; /* 1 = prompt for ramdisk, 0 = don't prompt */ -extern int rd_image_start; /* starting block # of image */ -#endif - -#if defined(CONFIG_VGA_CONSOLE) -struct screen_info screen_info = { - .orig_video_lines = 25, - .orig_video_cols = 80, - .orig_video_mode = 0, - .orig_video_ega_bx = 0, - .orig_video_isVGA = 1, - .orig_video_points = 8 -}; -#endif - -extern int root_mountflags; - -static char __initdata command_line[COMMAND_LINE_SIZE]; - -static struct resource data_resource = { - .name = "Kernel data", - .start = 0, - .end = 0, - .flags = IORESOURCE_BUSY | IORESOURCE_SYSTEM_RAM -}; - -static struct resource code_resource = { - .name = "Kernel code", - .start = 0, - .end = 0, - .flags = IORESOURCE_BUSY | IORESOURCE_SYSTEM_RAM -}; - -unsigned long memory_start; -EXPORT_SYMBOL(memory_start); - -unsigned long memory_end; -EXPORT_SYMBOL(memory_end); - -void __init setup_arch(char **); -int get_cpuinfo(char *); - -static __inline__ void parse_mem_cmdline(char ** cmdline_p) -{ - char c = ' '; - char *to = command_line; - char *from = COMMAND_LINE; - int len = 0; - int usermem = 0; - - /* Save unparsed command line copy for /proc/cmdline */ - memcpy(boot_command_line, COMMAND_LINE, COMMAND_LINE_SIZE); - boot_command_line[COMMAND_LINE_SIZE-1] = '\0'; - - memory_start = (unsigned long)CONFIG_MEMORY_START+PAGE_OFFSET; - memory_end = memory_start+(unsigned long)CONFIG_MEMORY_SIZE; - - for ( ; ; ) { - if (c == ' ' && !memcmp(from, "mem=", 4)) { - if (to != command_line) - to--; - - { - unsigned long mem_size; - - usermem = 1; - mem_size = memparse(from+4, &from); - memory_end = memory_start + mem_size; - } - } - c = *(from++); - if (!c) - break; - - if (COMMAND_LINE_SIZE <= ++len) - break; - - *(to++) = c; - } - *to = '\0'; - *cmdline_p = command_line; - if (usermem) - printk(KERN_INFO "user-defined physical RAM map:\n"); -} - -#ifndef CONFIG_DISCONTIGMEM -static unsigned long __init setup_memory(void) -{ - unsigned long start_pfn, max_low_pfn, bootmap_size; - - start_pfn = PFN_UP( __pa(_end) ); - max_low_pfn = PFN_DOWN( __pa(memory_end) ); - - /* - * Initialize the boot-time allocator (with low memory only): - */ - bootmap_size = init_bootmem_node(NODE_DATA(0), start_pfn, - CONFIG_MEMORY_START>>PAGE_SHIFT, max_low_pfn); - - /* - * Register fully available low RAM pages with the bootmem allocator. - */ - { - unsigned long curr_pfn; - unsigned long last_pfn; - unsigned long pages; - - /* - * We are rounding up the start address of usable memory: - */ - curr_pfn = PFN_UP(__pa(memory_start)); - - /* - * ... and at the end of the usable range downwards: - */ - last_pfn = PFN_DOWN(__pa(memory_end)); - - if (last_pfn > max_low_pfn) - last_pfn = max_low_pfn; - - pages = last_pfn - curr_pfn; - free_bootmem(PFN_PHYS(curr_pfn), PFN_PHYS(pages)); - } - - /* - * Reserve the kernel text and - * Reserve the bootmem bitmap. We do this in two steps (first step - * was init_bootmem()), because this catches the (definitely buggy) - * case of us accidentally initializing the bootmem allocator with - * an invalid RAM area. - */ - reserve_bootmem(CONFIG_MEMORY_START + PAGE_SIZE, - (PFN_PHYS(start_pfn) + bootmap_size + PAGE_SIZE - 1) - - CONFIG_MEMORY_START, - BOOTMEM_DEFAULT); - - /* - * reserve physical page 0 - it's a special BIOS page on many boxes, - * enabling clean reboots, SMP operation, laptop functions. - */ - reserve_bootmem(CONFIG_MEMORY_START, PAGE_SIZE, BOOTMEM_DEFAULT); - - /* - * reserve memory hole - */ -#ifdef CONFIG_MEMHOLE - reserve_bootmem(CONFIG_MEMHOLE_START, CONFIG_MEMHOLE_SIZE, - BOOTMEM_DEFAULT); -#endif - -#ifdef CONFIG_BLK_DEV_INITRD - if (LOADER_TYPE && INITRD_START) { - if (INITRD_START + INITRD_SIZE <= (max_low_pfn << PAGE_SHIFT)) { - reserve_bootmem(INITRD_START, INITRD_SIZE, - BOOTMEM_DEFAULT); - initrd_start = INITRD_START + PAGE_OFFSET; - initrd_end = initrd_start + INITRD_SIZE; - printk("initrd:start[%08lx],size[%08lx]\n", - initrd_start, INITRD_SIZE); - } else { - printk("initrd extends beyond end of memory " - "(0x%08lx > 0x%08lx)\ndisabling initrd\n", - INITRD_START + INITRD_SIZE, - max_low_pfn << PAGE_SHIFT); - - initrd_start = 0; - } - } -#endif - - return max_low_pfn; -} -#else /* CONFIG_DISCONTIGMEM */ -extern unsigned long setup_memory(void); -#endif /* CONFIG_DISCONTIGMEM */ - -void __init setup_arch(char **cmdline_p) -{ - ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV); - - boot_cpu_data.cpu_clock = M32R_CPUCLK; - boot_cpu_data.bus_clock = M32R_BUSCLK; - boot_cpu_data.timer_divide = M32R_TIMER_DIVIDE; - -#ifdef CONFIG_BLK_DEV_RAM - rd_image_start = RAMDISK_FLAGS & RAMDISK_IMAGE_START_MASK; - rd_prompt = ((RAMDISK_FLAGS & RAMDISK_PROMPT_FLAG) != 0); - rd_doload = ((RAMDISK_FLAGS & RAMDISK_LOAD_FLAG) != 0); -#endif - - if (!MOUNT_ROOT_RDONLY) - root_mountflags &= ~MS_RDONLY; - -#ifdef CONFIG_VT -#if defined(CONFIG_VGA_CONSOLE) - conswitchp = &vga_con; -#elif defined(CONFIG_DUMMY_CONSOLE) - conswitchp = &dummy_con; -#endif -#endif - -#ifdef CONFIG_DISCONTIGMEM - nodes_clear(node_online_map); - node_set_online(0); - node_set_online(1); -#endif /* CONFIG_DISCONTIGMEM */ - - init_mm.start_code = (unsigned long) _text; - init_mm.end_code = (unsigned long) _etext; - init_mm.end_data = (unsigned long) _edata; - init_mm.brk = (unsigned long) _end; - - code_resource.start = virt_to_phys(_text); - code_resource.end = virt_to_phys(_etext)-1; - data_resource.start = virt_to_phys(_etext); - data_resource.end = virt_to_phys(_edata)-1; - - parse_mem_cmdline(cmdline_p); - - setup_memory(); - - paging_init(); -} - -static struct cpu cpu_devices[NR_CPUS]; - -static int __init topology_init(void) -{ - int i; - - for_each_present_cpu(i) - register_cpu(&cpu_devices[i], i); - - return 0; -} - -subsys_initcall(topology_init); - -#ifdef CONFIG_PROC_FS -/* - * Get CPU information for use by the procfs. - */ -static int show_cpuinfo(struct seq_file *m, void *v) -{ - struct cpuinfo_m32r *c = v; - unsigned long cpu = c - cpu_data; - -#ifdef CONFIG_SMP - if (!cpu_online(cpu)) - return 0; -#endif /* CONFIG_SMP */ - - seq_printf(m, "processor\t: %ld\n", cpu); - -#if defined(CONFIG_CHIP_VDEC2) - seq_printf(m, "cpu family\t: VDEC2\n" - "cache size\t: Unknown\n"); -#elif defined(CONFIG_CHIP_M32700) - seq_printf(m,"cpu family\t: M32700\n" - "cache size\t: I-8KB/D-8KB\n"); -#elif defined(CONFIG_CHIP_M32102) - seq_printf(m,"cpu family\t: M32102\n" - "cache size\t: I-8KB\n"); -#elif defined(CONFIG_CHIP_OPSP) - seq_printf(m,"cpu family\t: OPSP\n" - "cache size\t: I-8KB/D-8KB\n"); -#elif defined(CONFIG_CHIP_MP) - seq_printf(m, "cpu family\t: M32R-MP\n" - "cache size\t: I-xxKB/D-xxKB\n"); -#elif defined(CONFIG_CHIP_M32104) - seq_printf(m,"cpu family\t: M32104\n" - "cache size\t: I-8KB/D-8KB\n"); -#else - seq_printf(m, "cpu family\t: Unknown\n"); -#endif - seq_printf(m, "bogomips\t: %lu.%02lu\n", - c->loops_per_jiffy/(500000/HZ), - (c->loops_per_jiffy/(5000/HZ)) % 100); -#if defined(CONFIG_PLAT_MAPPI) - seq_printf(m, "Machine\t\t: Mappi Evaluation board\n"); -#elif defined(CONFIG_PLAT_MAPPI2) - seq_printf(m, "Machine\t\t: Mappi-II Evaluation board\n"); -#elif defined(CONFIG_PLAT_MAPPI3) - seq_printf(m, "Machine\t\t: Mappi-III Evaluation board\n"); -#elif defined(CONFIG_PLAT_M32700UT) - seq_printf(m, "Machine\t\t: M32700UT Evaluation board\n"); -#elif defined(CONFIG_PLAT_OPSPUT) - seq_printf(m, "Machine\t\t: OPSPUT Evaluation board\n"); -#elif defined(CONFIG_PLAT_USRV) - seq_printf(m, "Machine\t\t: uServer\n"); -#elif defined(CONFIG_PLAT_OAKS32R) - seq_printf(m, "Machine\t\t: OAKS32R\n"); -#elif defined(CONFIG_PLAT_M32104UT) - seq_printf(m, "Machine\t\t: M3T-M32104UT uT Engine board\n"); -#else - seq_printf(m, "Machine\t\t: Unknown\n"); -#endif - -#define PRINT_CLOCK(name, value) \ - seq_printf(m, name " clock\t: %d.%02dMHz\n", \ - ((value) / 1000000), ((value) % 1000000)/10000) - - PRINT_CLOCK("CPU", (int)c->cpu_clock); - PRINT_CLOCK("Bus", (int)c->bus_clock); - - seq_printf(m, "\n"); - - return 0; -} - -static void *c_start(struct seq_file *m, loff_t *pos) -{ - return *pos < NR_CPUS ? cpu_data + *pos : 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) -{ -} - -const struct seq_operations cpuinfo_op = { - .start = c_start, - .next = c_next, - .stop = c_stop, - .show = show_cpuinfo, -}; -#endif /* CONFIG_PROC_FS */ - -unsigned long cpu_initialized __initdata = 0; - -/* - * cpu_init() initializes state that is per-CPU. Some data is already - * initialized (naturally) in the bootstrap process. - * We reload them nevertheless, this function acts as a - * 'CPU state barrier', nothing should get across. - */ -#if defined(CONFIG_CHIP_VDEC2) || defined(CONFIG_CHIP_XNUX2) \ - || defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_M32102) \ - || defined(CONFIG_CHIP_OPSP) || defined(CONFIG_CHIP_M32104) -void __init cpu_init (void) -{ - int cpu_id = smp_processor_id(); - - if (test_and_set_bit(cpu_id, &cpu_initialized)) { - printk(KERN_WARNING "CPU#%d already initialized!\n", cpu_id); - for ( ; ; ) - local_irq_enable(); - } - printk(KERN_INFO "Initializing CPU#%d\n", cpu_id); - - /* Set up and load the per-CPU TSS and LDT */ - mmgrab(&init_mm); - current->active_mm = &init_mm; - if (current->mm) - BUG(); - - /* Force FPU initialization */ - current_thread_info()->status = 0; - clear_used_math(); - -#ifdef CONFIG_MMU - /* Set up MMU */ - init_mmu(); -#endif - - /* Set up ICUIMASK */ - outl(0x00070000, M32R_ICU_IMASK_PORTL); /* imask=111 */ -} -#endif /* defined(CONFIG_CHIP_VDEC2) ... */ diff --git a/arch/m32r/kernel/signal.c b/arch/m32r/kernel/signal.c deleted file mode 100644 index ba4d8d6330f15..0000000000000 --- a/arch/m32r/kernel/signal.c +++ /dev/null @@ -1,336 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * linux/arch/m32r/kernel/signal.c - * - * Copyright (c) 2003 Hitoshi Yamamoto - * - * Taken from i386 version. - * Copyright (C) 1991, 1992 Linus Torvalds - * - * 1997-11-28 Modified for POSIX.1b signals by Richard Henderson - * 2000-06-20 Pentium III FXSR, SSE support by Gareth Hughes - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define DEBUG_SIG 0 - -/* - * Do a signal return; undo the signal stack. - */ - -struct rt_sigframe -{ - int sig; - struct siginfo __user *pinfo; - void __user *puc; - struct siginfo info; - struct ucontext uc; -// struct _fpstate fpstate; -}; - -static int -restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, - int *r0_p) -{ - unsigned int err = 0; - - /* Always make any pending restarted system calls return -EINTR */ - current->restart_block.fn = do_no_restart_syscall; - -#define COPY(x) err |= __get_user(regs->x, &sc->sc_##x) - COPY(r4); - COPY(r5); - COPY(r6); - COPY(pt_regs); - /* COPY(r0); Skip r0 */ - COPY(r1); - COPY(r2); - COPY(r3); - COPY(r7); - COPY(r8); - COPY(r9); - COPY(r10); - COPY(r11); - COPY(r12); - COPY(acc0h); - COPY(acc0l); - COPY(acc1h); /* ISA_DSP_LEVEL2 only */ - COPY(acc1l); /* ISA_DSP_LEVEL2 only */ - COPY(psw); - COPY(bpc); - COPY(bbpsw); - COPY(bbpc); - COPY(spu); - COPY(fp); - COPY(lr); - COPY(spi); -#undef COPY - - regs->syscall_nr = -1; /* disable syscall checks */ - err |= __get_user(*r0_p, &sc->sc_r0); - - return err; -} - -asmlinkage int -sys_rt_sigreturn(unsigned long r0, unsigned long r1, - unsigned long r2, unsigned long r3, unsigned long r4, - unsigned long r5, unsigned long r6, struct pt_regs *regs) -{ - struct rt_sigframe __user *frame = (struct rt_sigframe __user *)regs->spu; - sigset_t set; - int result; - - if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) - goto badframe; - if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) - goto badframe; - - set_current_blocked(&set); - - if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &result)) - goto badframe; - - if (restore_altstack(&frame->uc.uc_stack)) - goto badframe; - - return result; - -badframe: - force_sig(SIGSEGV, current); - return 0; -} - -/* - * Set up a signal frame. - */ - -static int -setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, - unsigned long mask) -{ - int err = 0; - -#define COPY(x) err |= __put_user(regs->x, &sc->sc_##x) - COPY(r4); - COPY(r5); - COPY(r6); - COPY(pt_regs); - COPY(r0); - COPY(r1); - COPY(r2); - COPY(r3); - COPY(r7); - COPY(r8); - COPY(r9); - COPY(r10); - COPY(r11); - COPY(r12); - COPY(acc0h); - COPY(acc0l); - COPY(acc1h); /* ISA_DSP_LEVEL2 only */ - COPY(acc1l); /* ISA_DSP_LEVEL2 only */ - COPY(psw); - COPY(bpc); - COPY(bbpsw); - COPY(bbpc); - COPY(spu); - COPY(fp); - COPY(lr); - COPY(spi); -#undef COPY - - err |= __put_user(mask, &sc->oldmask); - - return err; -} - -/* - * Determine which stack to use.. - */ -static inline void __user * -get_sigframe(struct ksignal *ksig, unsigned long sp, size_t frame_size) -{ - return (void __user *)((sigsp(sp, ksig) - frame_size) & -8ul); -} - -static int setup_rt_frame(struct ksignal *ksig, sigset_t *set, - struct pt_regs *regs) -{ - struct rt_sigframe __user *frame; - int err = 0; - int sig = ksig->sig; - - frame = get_sigframe(ksig, regs->spu, sizeof(*frame)); - - if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) - return -EFAULT; - - err |= __put_user(sig, &frame->sig); - if (err) - return -EFAULT; - - err |= __put_user(&frame->info, &frame->pinfo); - err |= __put_user(&frame->uc, &frame->puc); - err |= copy_siginfo_to_user(&frame->info, &ksig->info); - if (err) - return -EFAULT; - - /* Create the ucontext. */ - err |= __put_user(0, &frame->uc.uc_flags); - err |= __put_user(0, &frame->uc.uc_link); - err |= __save_altstack(&frame->uc.uc_stack, regs->spu); - err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, set->sig[0]); - err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); - if (err) - return -EFAULT; - - /* Set up to return from userspace. */ - regs->lr = (unsigned long)ksig->ka.sa.sa_restorer; - - /* Set up registers for signal handler */ - regs->spu = (unsigned long)frame; - regs->r0 = sig; /* Arg for signal handler */ - regs->r1 = (unsigned long)&frame->info; - regs->r2 = (unsigned long)&frame->uc; - regs->bpc = (unsigned long)ksig->ka.sa.sa_handler; - -#if DEBUG_SIG - printk("SIG deliver (%s:%d): sp=%p pc=%p\n", - current->comm, current->pid, frame, regs->pc); -#endif - - return 0; -} - -static int prev_insn(struct pt_regs *regs) -{ - u16 inst; - if (get_user(inst, (u16 __user *)(regs->bpc - 2))) - return -EFAULT; - if ((inst & 0xfff0) == 0x10f0) /* trap ? */ - regs->bpc -= 2; - else - regs->bpc -= 4; - regs->syscall_nr = -1; - return 0; -} - -/* - * OK, we're invoking a handler - */ - -static void -handle_signal(struct ksignal *ksig, struct pt_regs *regs) -{ - int ret; - - /* Are we from a system call? */ - if (regs->syscall_nr >= 0) { - /* If so, check system call restarting.. */ - switch (regs->r0) { - case -ERESTART_RESTARTBLOCK: - case -ERESTARTNOHAND: - regs->r0 = -EINTR; - break; - - case -ERESTARTSYS: - if (!(ksig->ka.sa.sa_flags & SA_RESTART)) { - regs->r0 = -EINTR; - break; - } - /* fallthrough */ - case -ERESTARTNOINTR: - regs->r0 = regs->orig_r0; - if (prev_insn(regs) < 0) - return; - } - } - - /* Set up the stack frame */ - ret = setup_rt_frame(ksig, sigmask_to_save(), regs); - - signal_setup_done(ret, ksig, 0); -} - -/* - * 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. - */ -static void do_signal(struct pt_regs *regs) -{ - struct ksignal ksig; - - /* - * 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; - - if (get_signal(&ksig)) { - /* Re-enable any watchpoints before delivering the - * signal to user space. The processor register will - * have been cleared if the watchpoint triggered - * inside the kernel. - */ - - /* Whee! Actually deliver the signal. */ - handle_signal(&ksig, regs); - - return; - } - - /* Did we come from a system call? */ - if (regs->syscall_nr >= 0) { - /* Restart the system call - no handlers present */ - if (regs->r0 == -ERESTARTNOHAND || - regs->r0 == -ERESTARTSYS || - regs->r0 == -ERESTARTNOINTR) { - regs->r0 = regs->orig_r0; - prev_insn(regs); - } else if (regs->r0 == -ERESTART_RESTARTBLOCK){ - regs->r0 = regs->orig_r0; - regs->r7 = __NR_restart_syscall; - prev_insn(regs); - } - } - restore_saved_sigmask(); -} - -/* - * notification of userspace execution resumption - * - triggered by current->work.notify_resume - */ -void do_notify_resume(struct pt_regs *regs, __u32 thread_info_flags) -{ - /* Pending single-step? */ - if (thread_info_flags & _TIF_SINGLESTEP) - clear_thread_flag(TIF_SINGLESTEP); - - /* deal with pending signal delivery */ - if (thread_info_flags & _TIF_SIGPENDING) - do_signal(regs); - - if (thread_info_flags & _TIF_NOTIFY_RESUME) { - clear_thread_flag(TIF_NOTIFY_RESUME); - tracehook_notify_resume(regs); - } -} diff --git a/arch/m32r/kernel/smp.c b/arch/m32r/kernel/smp.c deleted file mode 100644 index 564052e3d3a05..0000000000000 --- a/arch/m32r/kernel/smp.c +++ /dev/null @@ -1,836 +0,0 @@ -/* - * linux/arch/m32r/kernel/smp.c - * - * M32R SMP support routines. - * - * Copyright (c) 2001, 2002 Hitoshi Yamamoto - * - * Taken from i386 version. - * (c) 1995 Alan Cox, Building #3 - * (c) 1998-99, 2000 Ingo Molnar - * - * This code is released under the GNU General Public License version 2 or - * later. - */ - -#undef DEBUG_SMP - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ -/* Data structures and variables */ -/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ - -/* - * For flush_cache_all() - */ -static DEFINE_SPINLOCK(flushcache_lock); -static volatile unsigned long flushcache_cpumask = 0; - -/* - * For flush_tlb_others() - */ -static cpumask_t flush_cpumask; -static struct mm_struct *flush_mm; -static struct vm_area_struct *flush_vma; -static volatile unsigned long flush_va; -static DEFINE_SPINLOCK(tlbstate_lock); -#define FLUSH_ALL 0xffffffff - -DECLARE_PER_CPU(int, prof_multiplier); -DECLARE_PER_CPU(int, prof_old_multiplier); -DECLARE_PER_CPU(int, prof_counter); - -extern spinlock_t ipi_lock[]; - -/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ -/* Function Prototypes */ -/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ - -void smp_reschedule_interrupt(void); -void smp_flush_cache_all_interrupt(void); - -static void flush_tlb_all_ipi(void *); -static void flush_tlb_others(cpumask_t, struct mm_struct *, - struct vm_area_struct *, unsigned long); - -void smp_invalidate_interrupt(void); - -static void stop_this_cpu(void *); - -void smp_ipi_timer_interrupt(struct pt_regs *); -void smp_local_timer_interrupt(void); - -static void send_IPI_allbutself(int, int); -static void send_IPI_mask(const struct cpumask *, int, int); - -/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ -/* Rescheduling request Routines */ -/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ - -/*==========================================================================* - * Name: smp_send_reschedule - * - * Description: This routine requests other CPU to execute rescheduling. - * 1.Send 'RESCHEDULE_IPI' to other CPU. - * Request other CPU to execute 'smp_reschedule_interrupt()'. - * - * Born on Date: 2002.02.05 - * - * Arguments: cpu_id - Target CPU ID - * - * Returns: void (cannot fail) - * - * Modification log: - * Date Who Description - * ---------- --- -------------------------------------------------------- - * - *==========================================================================*/ -void smp_send_reschedule(int cpu_id) -{ - WARN_ON(cpu_is_offline(cpu_id)); - send_IPI_mask(cpumask_of(cpu_id), RESCHEDULE_IPI, 1); -} - -/*==========================================================================* - * Name: smp_reschedule_interrupt - * - * Description: This routine executes on CPU which received - * 'RESCHEDULE_IPI'. - * - * Born on Date: 2002.02.05 - * - * Arguments: NONE - * - * Returns: void (cannot fail) - * - * Modification log: - * Date Who Description - * ---------- --- -------------------------------------------------------- - * - *==========================================================================*/ -void smp_reschedule_interrupt(void) -{ - scheduler_ipi(); -} - -/*==========================================================================* - * Name: smp_flush_cache_all - * - * Description: This routine sends a 'INVALIDATE_CACHE_IPI' to all other - * CPUs in the system. - * - * Born on Date: 2003-05-28 - * - * Arguments: NONE - * - * Returns: void (cannot fail) - * - * Modification log: - * Date Who Description - * ---------- --- -------------------------------------------------------- - * - *==========================================================================*/ -void smp_flush_cache_all(void) -{ - cpumask_t cpumask; - unsigned long *mask; - - preempt_disable(); - cpumask_copy(&cpumask, cpu_online_mask); - cpumask_clear_cpu(smp_processor_id(), &cpumask); - spin_lock(&flushcache_lock); - mask=cpumask_bits(&cpumask); - atomic_or(*mask, (atomic_t *)&flushcache_cpumask); - send_IPI_mask(&cpumask, INVALIDATE_CACHE_IPI, 0); - _flush_cache_copyback_all(); - while (flushcache_cpumask) - mb(); - spin_unlock(&flushcache_lock); - preempt_enable(); -} -EXPORT_SYMBOL(smp_flush_cache_all); - -void smp_flush_cache_all_interrupt(void) -{ - _flush_cache_copyback_all(); - clear_bit(smp_processor_id(), &flushcache_cpumask); -} - -/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ -/* TLB flush request Routines */ -/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ - -/*==========================================================================* - * Name: smp_flush_tlb_all - * - * Description: This routine flushes all processes TLBs. - * 1.Request other CPU to execute 'flush_tlb_all_ipi()'. - * 2.Execute 'do_flush_tlb_all_local()'. - * - * Born on Date: 2002.02.05 - * - * Arguments: NONE - * - * Returns: void (cannot fail) - * - * Modification log: - * Date Who Description - * ---------- --- -------------------------------------------------------- - * - *==========================================================================*/ -void smp_flush_tlb_all(void) -{ - unsigned long flags; - - preempt_disable(); - local_irq_save(flags); - __flush_tlb_all(); - local_irq_restore(flags); - smp_call_function(flush_tlb_all_ipi, NULL, 1); - preempt_enable(); -} - -/*==========================================================================* - * Name: flush_tlb_all_ipi - * - * Description: This routine flushes all local TLBs. - * 1.Execute 'do_flush_tlb_all_local()'. - * - * Born on Date: 2002.02.05 - * - * Arguments: *info - not used - * - * Returns: void (cannot fail) - * - * Modification log: - * Date Who Description - * ---------- --- -------------------------------------------------------- - * - *==========================================================================*/ -static void flush_tlb_all_ipi(void *info) -{ - __flush_tlb_all(); -} - -/*==========================================================================* - * Name: smp_flush_tlb_mm - * - * Description: This routine flushes the specified mm context TLB's. - * - * Born on Date: 2002.02.05 - * - * Arguments: *mm - a pointer to the mm struct for flush TLB - * - * Returns: void (cannot fail) - * - * Modification log: - * Date Who Description - * ---------- --- -------------------------------------------------------- - * - *==========================================================================*/ -void smp_flush_tlb_mm(struct mm_struct *mm) -{ - int cpu_id; - cpumask_t cpu_mask; - unsigned long *mmc; - unsigned long flags; - - preempt_disable(); - cpu_id = smp_processor_id(); - mmc = &mm->context[cpu_id]; - cpumask_copy(&cpu_mask, mm_cpumask(mm)); - cpumask_clear_cpu(cpu_id, &cpu_mask); - - if (*mmc != NO_CONTEXT) { - local_irq_save(flags); - *mmc = NO_CONTEXT; - if (mm == current->mm) - activate_context(mm); - else - cpumask_clear_cpu(cpu_id, mm_cpumask(mm)); - local_irq_restore(flags); - } - if (!cpumask_empty(&cpu_mask)) - flush_tlb_others(cpu_mask, mm, NULL, FLUSH_ALL); - - preempt_enable(); -} - -/*==========================================================================* - * Name: smp_flush_tlb_range - * - * Description: This routine flushes a range of pages. - * - * Born on Date: 2002.02.05 - * - * Arguments: *mm - a pointer to the mm struct for flush TLB - * start - not used - * end - not used - * - * Returns: void (cannot fail) - * - * Modification log: - * Date Who Description - * ---------- --- -------------------------------------------------------- - * - *==========================================================================*/ -void smp_flush_tlb_range(struct vm_area_struct *vma, unsigned long start, - unsigned long end) -{ - smp_flush_tlb_mm(vma->vm_mm); -} - -/*==========================================================================* - * Name: smp_flush_tlb_page - * - * Description: This routine flushes one page. - * - * Born on Date: 2002.02.05 - * - * Arguments: *vma - a pointer to the vma struct include va - * va - virtual address for flush TLB - * - * Returns: void (cannot fail) - * - * Modification log: - * Date Who Description - * ---------- --- -------------------------------------------------------- - * - *==========================================================================*/ -void smp_flush_tlb_page(struct vm_area_struct *vma, unsigned long va) -{ - struct mm_struct *mm = vma->vm_mm; - int cpu_id; - cpumask_t cpu_mask; - unsigned long *mmc; - unsigned long flags; - - preempt_disable(); - cpu_id = smp_processor_id(); - mmc = &mm->context[cpu_id]; - cpumask_copy(&cpu_mask, mm_cpumask(mm)); - cpumask_clear_cpu(cpu_id, &cpu_mask); - -#ifdef DEBUG_SMP - if (!mm) - BUG(); -#endif - - if (*mmc != NO_CONTEXT) { - local_irq_save(flags); - va &= PAGE_MASK; - va |= (*mmc & MMU_CONTEXT_ASID_MASK); - __flush_tlb_page(va); - local_irq_restore(flags); - } - if (!cpumask_empty(&cpu_mask)) - flush_tlb_others(cpu_mask, mm, vma, va); - - preempt_enable(); -} - -/*==========================================================================* - * Name: flush_tlb_others - * - * Description: This routine requests other CPU to execute flush TLB. - * 1.Setup parameters. - * 2.Send 'INVALIDATE_TLB_IPI' to other CPU. - * Request other CPU to execute 'smp_invalidate_interrupt()'. - * 3.Wait for other CPUs operation finished. - * - * Born on Date: 2002.02.05 - * - * Arguments: cpumask - bitmap of target CPUs - * *mm - a pointer to the mm struct for flush TLB - * *vma - a pointer to the vma struct include va - * va - virtual address for flush TLB - * - * Returns: void (cannot fail) - * - * Modification log: - * Date Who Description - * ---------- --- -------------------------------------------------------- - * - *==========================================================================*/ -static void flush_tlb_others(cpumask_t cpumask, struct mm_struct *mm, - struct vm_area_struct *vma, unsigned long va) -{ - unsigned long *mask; -#ifdef DEBUG_SMP - unsigned long flags; - __save_flags(flags); - if (!(flags & 0x0040)) /* Interrupt Disable NONONO */ - BUG(); -#endif /* DEBUG_SMP */ - - /* - * A couple of (to be removed) sanity checks: - * - * - we do not send IPIs to not-yet booted CPUs. - * - current CPU must not be in mask - * - mask must exist :) - */ - BUG_ON(cpumask_empty(&cpumask)); - - BUG_ON(cpumask_test_cpu(smp_processor_id(), &cpumask)); - BUG_ON(!mm); - - /* If a CPU which we ran on has gone down, OK. */ - cpumask_and(&cpumask, &cpumask, cpu_online_mask); - if (cpumask_empty(&cpumask)) - return; - - /* - * i'm not happy about this global shared spinlock in the - * MM hot path, but we'll see how contended it is. - * Temporarily this turns IRQs off, so that lockups are - * detected by the NMI watchdog. - */ - spin_lock(&tlbstate_lock); - - flush_mm = mm; - flush_vma = vma; - flush_va = va; - mask=cpumask_bits(&cpumask); - atomic_or(*mask, (atomic_t *)&flush_cpumask); - - /* - * We have to send the IPI only to - * CPUs affected. - */ - send_IPI_mask(&cpumask, INVALIDATE_TLB_IPI, 0); - - while (!cpumask_empty(&flush_cpumask)) { - /* nothing. lockup detection does not belong here */ - mb(); - } - - flush_mm = NULL; - flush_vma = NULL; - flush_va = 0; - spin_unlock(&tlbstate_lock); -} - -/*==========================================================================* - * Name: smp_invalidate_interrupt - * - * Description: This routine executes on CPU which received - * 'INVALIDATE_TLB_IPI'. - * 1.Flush local TLB. - * 2.Report flush TLB process was finished. - * - * Born on Date: 2002.02.05 - * - * Arguments: NONE - * - * Returns: void (cannot fail) - * - * Modification log: - * Date Who Description - * ---------- --- -------------------------------------------------------- - * - *==========================================================================*/ -void smp_invalidate_interrupt(void) -{ - int cpu_id = smp_processor_id(); - unsigned long *mmc = &flush_mm->context[cpu_id]; - - if (!cpumask_test_cpu(cpu_id, &flush_cpumask)) - return; - - if (flush_va == FLUSH_ALL) { - *mmc = NO_CONTEXT; - if (flush_mm == current->active_mm) - activate_context(flush_mm); - else - cpumask_clear_cpu(cpu_id, mm_cpumask(flush_mm)); - } else { - unsigned long va = flush_va; - - if (*mmc != NO_CONTEXT) { - va &= PAGE_MASK; - va |= (*mmc & MMU_CONTEXT_ASID_MASK); - __flush_tlb_page(va); - } - } - cpumask_clear_cpu(cpu_id, &flush_cpumask); -} - -/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ -/* Stop CPU request Routines */ -/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ - -/*==========================================================================* - * Name: smp_send_stop - * - * Description: This routine requests stop all CPUs. - * 1.Request other CPU to execute 'stop_this_cpu()'. - * - * Born on Date: 2002.02.05 - * - * Arguments: NONE - * - * Returns: void (cannot fail) - * - * Modification log: - * Date Who Description - * ---------- --- -------------------------------------------------------- - * - *==========================================================================*/ -void smp_send_stop(void) -{ - smp_call_function(stop_this_cpu, NULL, 0); -} - -/*==========================================================================* - * Name: stop_this_cpu - * - * Description: This routine halt CPU. - * - * Born on Date: 2002.02.05 - * - * Arguments: NONE - * - * Returns: void (cannot fail) - * - * Modification log: - * Date Who Description - * ---------- --- -------------------------------------------------------- - * - *==========================================================================*/ -static void stop_this_cpu(void *dummy) -{ - int cpu_id = smp_processor_id(); - - /* - * Remove this CPU: - */ - set_cpu_online(cpu_id, false); - - /* - * PSW IE = 1; - * IMASK = 0; - * goto SLEEP - */ - local_irq_disable(); - outl(0, M32R_ICU_IMASK_PORTL); - inl(M32R_ICU_IMASK_PORTL); /* dummy read */ - local_irq_enable(); - - for ( ; ; ); -} - -void arch_send_call_function_ipi_mask(const struct cpumask *mask) -{ - send_IPI_mask(mask, CALL_FUNCTION_IPI, 0); -} - -void arch_send_call_function_single_ipi(int cpu) -{ - send_IPI_mask(cpumask_of(cpu), CALL_FUNC_SINGLE_IPI, 0); -} - -/*==========================================================================* - * Name: smp_call_function_interrupt - * - * Description: This routine executes on CPU which received - * 'CALL_FUNCTION_IPI'. - * - * Born on Date: 2002.02.05 - * - * Arguments: NONE - * - * Returns: void (cannot fail) - * - * Modification log: - * Date Who Description - * ---------- --- -------------------------------------------------------- - * - *==========================================================================*/ -void smp_call_function_interrupt(void) -{ - irq_enter(); - generic_smp_call_function_interrupt(); - irq_exit(); -} - -void smp_call_function_single_interrupt(void) -{ - irq_enter(); - generic_smp_call_function_single_interrupt(); - irq_exit(); -} - -/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ -/* Timer Routines */ -/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ - -/*==========================================================================* - * Name: smp_send_timer - * - * Description: This routine sends a 'LOCAL_TIMER_IPI' to all other CPUs - * in the system. - * - * Born on Date: 2002.02.05 - * - * Arguments: NONE - * - * Returns: void (cannot fail) - * - * Modification log: - * Date Who Description - * ---------- --- -------------------------------------------------------- - * - *==========================================================================*/ -void smp_send_timer(void) -{ - send_IPI_allbutself(LOCAL_TIMER_IPI, 1); -} - -/*==========================================================================* - * Name: smp_send_timer - * - * Description: This routine executes on CPU which received - * 'LOCAL_TIMER_IPI'. - * - * Born on Date: 2002.02.05 - * - * Arguments: *regs - a pointer to the saved regster info - * - * Returns: void (cannot fail) - * - * Modification log: - * Date Who Description - * ---------- --- -------------------------------------------------------- - * - *==========================================================================*/ -void smp_ipi_timer_interrupt(struct pt_regs *regs) -{ - struct pt_regs *old_regs; - old_regs = set_irq_regs(regs); - irq_enter(); - smp_local_timer_interrupt(); - irq_exit(); - set_irq_regs(old_regs); -} - -/*==========================================================================* - * Name: smp_local_timer_interrupt - * - * Description: Local timer interrupt handler. It does both profiling and - * process statistics/rescheduling. - * We do profiling in every local tick, statistics/rescheduling - * happen only every 'profiling multiplier' ticks. The default - * multiplier is 1 and it can be changed by writing the new - * multiplier value into /proc/profile. - * - * Born on Date: 2002.02.05 - * - * Arguments: *regs - a pointer to the saved regster info - * - * Returns: void (cannot fail) - * - * Original: arch/i386/kernel/apic.c - * - * Modification log: - * Date Who Description - * ---------- --- -------------------------------------------------------- - * 2003-06-24 hy use per_cpu structure. - *==========================================================================*/ -void smp_local_timer_interrupt(void) -{ - int user = user_mode(get_irq_regs()); - int cpu_id = smp_processor_id(); - - /* - * The profiling function is SMP safe. (nothing can mess - * around with "current", and the profiling counters are - * updated with atomic operations). This is especially - * useful with a profiling multiplier != 1 - */ - - profile_tick(CPU_PROFILING); - - if (--per_cpu(prof_counter, cpu_id) <= 0) { - /* - * The multiplier may have changed since the last time we got - * to this point as a result of the user writing to - * /proc/profile. In this case we need to adjust the APIC - * timer accordingly. - * - * Interrupts are already masked off at this point. - */ - per_cpu(prof_counter, cpu_id) - = per_cpu(prof_multiplier, cpu_id); - if (per_cpu(prof_counter, cpu_id) - != per_cpu(prof_old_multiplier, cpu_id)) - { - per_cpu(prof_old_multiplier, cpu_id) - = per_cpu(prof_counter, cpu_id); - } - - update_process_times(user); - } -} - -/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ -/* Send IPI Routines */ -/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ - -/*==========================================================================* - * Name: send_IPI_allbutself - * - * Description: This routine sends a IPI to all other CPUs in the system. - * - * Born on Date: 2002.02.05 - * - * Arguments: ipi_num - Number of IPI - * try - 0 : Send IPI certainly. - * !0 : The following IPI is not sent when Target CPU - * has not received the before IPI. - * - * Returns: void (cannot fail) - * - * Modification log: - * Date Who Description - * ---------- --- -------------------------------------------------------- - * - *==========================================================================*/ -static void send_IPI_allbutself(int ipi_num, int try) -{ - cpumask_t cpumask; - - cpumask_copy(&cpumask, cpu_online_mask); - cpumask_clear_cpu(smp_processor_id(), &cpumask); - - send_IPI_mask(&cpumask, ipi_num, try); -} - -/*==========================================================================* - * Name: send_IPI_mask - * - * Description: This routine sends a IPI to CPUs in the system. - * - * Born on Date: 2002.02.05 - * - * Arguments: cpu_mask - Bitmap of target CPUs logical ID - * ipi_num - Number of IPI - * try - 0 : Send IPI certainly. - * !0 : The following IPI is not sent when Target CPU - * has not received the before IPI. - * - * Returns: void (cannot fail) - * - * Modification log: - * Date Who Description - * ---------- --- -------------------------------------------------------- - * - *==========================================================================*/ -static void send_IPI_mask(const struct cpumask *cpumask, int ipi_num, int try) -{ - cpumask_t physid_mask, tmp; - int cpu_id, phys_id; - int num_cpus = num_online_cpus(); - - if (num_cpus <= 1) /* NO MP */ - return; - - cpumask_and(&tmp, cpumask, cpu_online_mask); - BUG_ON(!cpumask_equal(cpumask, &tmp)); - - cpumask_clear(&physid_mask); - for_each_cpu(cpu_id, cpumask) { - if ((phys_id = cpu_to_physid(cpu_id)) != -1) - cpumask_set_cpu(phys_id, &physid_mask); - } - - send_IPI_mask_phys(&physid_mask, ipi_num, try); -} - -/*==========================================================================* - * Name: send_IPI_mask_phys - * - * Description: This routine sends a IPI to other CPUs in the system. - * - * Born on Date: 2002.02.05 - * - * Arguments: cpu_mask - Bitmap of target CPUs physical ID - * ipi_num - Number of IPI - * try - 0 : Send IPI certainly. - * !0 : The following IPI is not sent when Target CPU - * has not received the before IPI. - * - * Returns: IPICRi regster value. - * - * Modification log: - * Date Who Description - * ---------- --- -------------------------------------------------------- - * - *==========================================================================*/ -unsigned long send_IPI_mask_phys(const cpumask_t *physid_mask, int ipi_num, - int try) -{ - spinlock_t *ipilock; - volatile unsigned long *ipicr_addr; - unsigned long ipicr_val; - unsigned long my_physid_mask; - unsigned long mask = cpumask_bits(physid_mask)[0]; - - - if (mask & ~physids_coerce(phys_cpu_present_map)) - BUG(); - if (ipi_num >= NR_IPIS || ipi_num < 0) - BUG(); - - mask <<= IPI_SHIFT; - ipilock = &ipi_lock[ipi_num]; - ipicr_addr = (volatile unsigned long *)(M32R_ICU_IPICR_ADDR - + (ipi_num << 2)); - my_physid_mask = ~(1 << smp_processor_id()); - - /* - * lock ipi_lock[i] - * check IPICRi == 0 - * write IPICRi (send IPIi) - * unlock ipi_lock[i] - */ - spin_lock(ipilock); - __asm__ __volatile__ ( - ";; CHECK IPICRi == 0 \n\t" - ".fillinsn \n" - "1: \n\t" - "ld %0, @%1 \n\t" - "and %0, %4 \n\t" - "beqz %0, 2f \n\t" - "bnez %3, 3f \n\t" - "bra 1b \n\t" - ";; WRITE IPICRi (send IPIi) \n\t" - ".fillinsn \n" - "2: \n\t" - "st %2, @%1 \n\t" - ".fillinsn \n" - "3: \n\t" - : "=&r"(ipicr_val) - : "r"(ipicr_addr), "r"(mask), "r"(try), "r"(my_physid_mask) - : "memory" - ); - spin_unlock(ipilock); - - return ipicr_val; -} diff --git a/arch/m32r/kernel/smpboot.c b/arch/m32r/kernel/smpboot.c deleted file mode 100644 index a7d04684d2c77..0000000000000 --- a/arch/m32r/kernel/smpboot.c +++ /dev/null @@ -1,627 +0,0 @@ -/* - * linux/arch/m32r/kernel/smpboot.c - * orig : i386 2.4.10 - * - * M32R SMP booting functions - * - * Copyright (c) 2001, 2002, 2003 Hitoshi Yamamoto - * - * Taken from i386 version. - * (c) 1995 Alan Cox, Building #3 - * (c) 1998, 1999, 2000 Ingo Molnar - * - * Much of the core SMP work is based on previous work by Thomas Radke, to - * whom a great many thanks are extended. - * - * Thanks to Intel for making available several different Pentium, - * Pentium Pro and Pentium-II/Xeon MP machines. - * Original development of Linux SMP code supported by Caldera. - * - * This code is released under the GNU General Public License version 2 or - * later. - * - * Fixes - * Felix Koop : NR_CPUS used properly - * Jose Renau : Handle single CPU case. - * Alan Cox : By repeated request - * 8) - Total BogoMIP report. - * Greg Wright : Fix for kernel stacks panic. - * Erich Boleyn : MP v1.4 and additional changes. - * Matthias Sattler : Changes for 2.1 kernel map. - * Michel Lespinasse : Changes for 2.1 kernel map. - * Michael Chastain : Change trampoline.S to gnu as. - * Alan Cox : Dumb bug: 'B' step PPro's are fine - * Ingo Molnar : Added APIC timers, based on code - * from Jose Renau - * Ingo Molnar : various cleanups and rewrites - * Tigran Aivazian : fixed "0.00 in /proc/uptime on SMP" bug. - * Maciej W. Rozycki : Bits for genuine 82489DX APICs - * Martin J. Bligh : Added support for multi-quad systems - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#define DEBUG_SMP -#ifdef DEBUG_SMP -#define Dprintk(x...) printk(x) -#else -#define Dprintk(x...) -#endif - -extern cpumask_t cpu_initialized; - -/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ -/* Data structures and variables */ -/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ - -/* Processor that is doing the boot up */ -static unsigned int bsp_phys_id = -1; - -/* Bitmask of physically existing CPUs */ -physid_mask_t phys_cpu_present_map; - -cpumask_t cpu_bootout_map; -cpumask_t cpu_bootin_map; -static cpumask_t cpu_callin_map; -cpumask_t cpu_callout_map; -EXPORT_SYMBOL(cpu_callout_map); - -/* Per CPU bogomips and other parameters */ -struct cpuinfo_m32r cpu_data[NR_CPUS] __cacheline_aligned; - -static int cpucount; -static cpumask_t smp_commenced_mask; - -extern struct { - void * spi; - unsigned short ss; -} stack_start; - -/* which physical physical ID maps to which logical CPU number */ -static volatile int physid_2_cpu[NR_CPUS]; -#define physid_to_cpu(physid) physid_2_cpu[physid] - -/* which logical CPU number maps to which physical ID */ -volatile int cpu_2_physid[NR_CPUS]; - -DEFINE_PER_CPU(int, prof_multiplier) = 1; -DEFINE_PER_CPU(int, prof_old_multiplier) = 1; -DEFINE_PER_CPU(int, prof_counter) = 1; - -spinlock_t ipi_lock[NR_IPIS]; - -static unsigned int calibration_result; - -/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ -/* Function Prototypes */ -/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ - -static void init_ipi_lock(void); -static void do_boot_cpu(int); - -int start_secondary(void *); -static void smp_callin(void); -static void smp_online(void); - -static void show_mp_info(int); -static void smp_store_cpu_info(int); -static void show_cpu_info(int); -int setup_profiling_timer(unsigned int); -static void init_cpu_to_physid(void); -static void map_cpu_to_physid(int, int); -static void unmap_cpu_to_physid(int, int); - -/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ -/* Boot up APs Routines : BSP */ -/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ -void smp_prepare_boot_cpu(void) -{ - bsp_phys_id = hard_smp_processor_id(); - physid_set(bsp_phys_id, phys_cpu_present_map); - set_cpu_online(0, true); /* BSP's cpu_id == 0 */ - cpumask_set_cpu(0, &cpu_callout_map); - cpumask_set_cpu(0, &cpu_callin_map); - - /* - * Initialize the logical to physical CPU number mapping - */ - init_cpu_to_physid(); - map_cpu_to_physid(0, bsp_phys_id); - current_thread_info()->cpu = 0; -} - -/*==========================================================================* - * Name: smp_prepare_cpus (old smp_boot_cpus) - * - * Description: This routine boot up APs. - * - * Born on Date: 2002.02.05 - * - * Arguments: NONE - * - * Returns: void (cannot fail) - * - * Modification log: - * Date Who Description - * ---------- --- -------------------------------------------------------- - * 2003-06-24 hy modify for linux-2.5.69 - * - *==========================================================================*/ -void __init smp_prepare_cpus(unsigned int max_cpus) -{ - int phys_id; - unsigned long nr_cpu; - - nr_cpu = inl(M32R_FPGA_NUM_OF_CPUS_PORTL); - if (nr_cpu > NR_CPUS) { - printk(KERN_INFO "NUM_OF_CPUS reg. value [%ld] > NR_CPU [%d]", - nr_cpu, NR_CPUS); - goto smp_done; - } - for (phys_id = 0 ; phys_id < nr_cpu ; phys_id++) - physid_set(phys_id, phys_cpu_present_map); -#ifndef CONFIG_HOTPLUG_CPU - init_cpu_present(cpu_possible_mask); -#endif - - show_mp_info(nr_cpu); - - init_ipi_lock(); - - /* - * Setup boot CPU information - */ - smp_store_cpu_info(0); /* Final full version of the data */ - - /* - * If SMP should be disabled, then really disable it! - */ - if (!max_cpus) { - printk(KERN_INFO "SMP mode deactivated by commandline.\n"); - goto smp_done; - } - - /* - * Now scan the CPU present map and fire up the other CPUs. - */ - Dprintk("CPU present map : %lx\n", physids_coerce(phys_cpu_present_map)); - - for (phys_id = 0 ; phys_id < NR_CPUS ; phys_id++) { - /* - * Don't even attempt to start the boot CPU! - */ - if (phys_id == bsp_phys_id) - continue; - - if (!physid_isset(phys_id, phys_cpu_present_map)) - continue; - - if (max_cpus <= cpucount + 1) - continue; - - do_boot_cpu(phys_id); - - /* - * Make sure we unmap all failed CPUs - */ - if (physid_to_cpu(phys_id) == -1) { - physid_clear(phys_id, phys_cpu_present_map); - printk("phys CPU#%d not responding - " \ - "cannot use it.\n", phys_id); - } - } - -smp_done: - Dprintk("Boot done.\n"); -} - -/* - * init_ipi_lock : Initialize IPI locks. - */ -static void __init init_ipi_lock(void) -{ - int ipi; - - for (ipi = 0 ; ipi < NR_IPIS ; ipi++) - spin_lock_init(&ipi_lock[ipi]); -} - -/*==========================================================================* - * Name: do_boot_cpu - * - * Description: This routine boot up one AP. - * - * Born on Date: 2002.02.05 - * - * Arguments: phys_id - Target CPU physical ID - * - * Returns: void (cannot fail) - * - * Modification log: - * Date Who Description - * ---------- --- -------------------------------------------------------- - * 2003-06-24 hy modify for linux-2.5.69 - * - *==========================================================================*/ -static void __init do_boot_cpu(int phys_id) -{ - struct task_struct *idle; - unsigned long send_status, boot_status; - int timeout, cpu_id; - - cpu_id = ++cpucount; - - /* - * We can't use kernel_thread since we must avoid to - * reschedule the child. - */ - idle = fork_idle(cpu_id); - if (IS_ERR(idle)) - panic("failed fork for CPU#%d.", cpu_id); - - idle->thread.lr = (unsigned long)start_secondary; - - map_cpu_to_physid(cpu_id, phys_id); - - /* So we see what's up */ - printk("Booting processor %d/%d\n", phys_id, cpu_id); - stack_start.spi = (void *)idle->thread.sp; - task_thread_info(idle)->cpu = cpu_id; - - /* - * Send Startup IPI - * 1.IPI received by CPU#(phys_id). - * 2.CPU#(phys_id) enter startup_AP (arch/m32r/kernel/head.S) - * 3.CPU#(phys_id) enter start_secondary() - */ - send_status = 0; - boot_status = 0; - - cpumask_set_cpu(phys_id, &cpu_bootout_map); - - /* Send Startup IPI */ - send_IPI_mask_phys(cpumask_of(phys_id), CPU_BOOT_IPI, 0); - - Dprintk("Waiting for send to finish...\n"); - timeout = 0; - - /* Wait 100[ms] */ - do { - Dprintk("+"); - udelay(1000); - send_status = !cpumask_test_cpu(phys_id, &cpu_bootin_map); - } while (send_status && (timeout++ < 100)); - - Dprintk("After Startup.\n"); - - if (!send_status) { - /* - * allow APs to start initializing. - */ - Dprintk("Before Callout %d.\n", cpu_id); - cpumask_set_cpu(cpu_id, &cpu_callout_map); - Dprintk("After Callout %d.\n", cpu_id); - - /* - * Wait 5s total for a response - */ - for (timeout = 0; timeout < 5000; timeout++) { - if (cpumask_test_cpu(cpu_id, &cpu_callin_map)) - break; /* It has booted */ - udelay(1000); - } - - if (cpumask_test_cpu(cpu_id, &cpu_callin_map)) { - /* number CPUs logically, starting from 1 (BSP is 0) */ - Dprintk("OK.\n"); - } else { - boot_status = 1; - printk("Not responding.\n"); - } - } else - printk("IPI never delivered???\n"); - - if (send_status || boot_status) { - unmap_cpu_to_physid(cpu_id, phys_id); - cpumask_clear_cpu(cpu_id, &cpu_callout_map); - cpumask_clear_cpu(cpu_id, &cpu_callin_map); - cpumask_clear_cpu(cpu_id, &cpu_initialized); - cpucount--; - } -} - -int __cpu_up(unsigned int cpu_id, struct task_struct *tidle) -{ - int timeout; - - cpumask_set_cpu(cpu_id, &smp_commenced_mask); - - /* - * Wait 5s total for a response - */ - for (timeout = 0; timeout < 5000; timeout++) { - if (cpu_online(cpu_id)) - break; - udelay(1000); - } - if (!cpu_online(cpu_id)) - BUG(); - - return 0; -} - -void __init smp_cpus_done(unsigned int max_cpus) -{ - int cpu_id, timeout; - unsigned long bogosum = 0; - - for (timeout = 0; timeout < 5000; timeout++) { - if (cpumask_equal(&cpu_callin_map, cpu_online_mask)) - break; - udelay(1000); - } - if (!cpumask_equal(&cpu_callin_map, cpu_online_mask)) - BUG(); - - for_each_online_cpu(cpu_id) - show_cpu_info(cpu_id); - - /* - * Allow the user to impress friends. - */ - Dprintk("Before bogomips.\n"); - if (cpucount) { - for_each_cpu(cpu_id,cpu_online_mask) - bogosum += cpu_data[cpu_id].loops_per_jiffy; - - printk(KERN_INFO "Total of %d processors activated " \ - "(%lu.%02lu BogoMIPS).\n", cpucount + 1, - bogosum / (500000 / HZ), - (bogosum / (5000 / HZ)) % 100); - Dprintk("Before bogocount - setting activated=1.\n"); - } -} - -/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ -/* Activate a secondary processor Routines */ -/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ - -/*==========================================================================* - * Name: start_secondary - * - * Description: This routine activate a secondary processor. - * - * Born on Date: 2002.02.05 - * - * Arguments: *unused - currently unused. - * - * Returns: void (cannot fail) - * - * Modification log: - * Date Who Description - * ---------- --- -------------------------------------------------------- - * 2003-06-24 hy modify for linux-2.5.69 - * - *==========================================================================*/ -int __init start_secondary(void *unused) -{ - cpu_init(); - preempt_disable(); - smp_callin(); - while (!cpumask_test_cpu(smp_processor_id(), &smp_commenced_mask)) - cpu_relax(); - - smp_online(); - - /* - * low-memory mappings have been cleared, flush them from - * the local TLBs too. - */ - local_flush_tlb_all(); - - cpu_startup_entry(CPUHP_AP_ONLINE_IDLE); - return 0; -} - -/*==========================================================================* - * Name: smp_callin - * - * Description: This routine activate a secondary processor. - * - * Born on Date: 2002.02.05 - * - * Arguments: NONE - * - * Returns: void (cannot fail) - * - * Modification log: - * Date Who Description - * ---------- --- -------------------------------------------------------- - * 2003-06-24 hy modify for linux-2.5.69 - * - *==========================================================================*/ -static void __init smp_callin(void) -{ - int phys_id = hard_smp_processor_id(); - int cpu_id = smp_processor_id(); - unsigned long timeout; - - if (cpumask_test_cpu(cpu_id, &cpu_callin_map)) { - printk("huh, phys CPU#%d, CPU#%d already present??\n", - phys_id, cpu_id); - BUG(); - } - Dprintk("CPU#%d (phys ID: %d) waiting for CALLOUT\n", cpu_id, phys_id); - - /* Waiting 2s total for startup (udelay is not yet working) */ - timeout = jiffies + (2 * HZ); - while (time_before(jiffies, timeout)) { - /* Has the boot CPU finished it's STARTUP sequence ? */ - if (cpumask_test_cpu(cpu_id, &cpu_callout_map)) - break; - cpu_relax(); - } - - if (!time_before(jiffies, timeout)) { - printk("BUG: CPU#%d started up but did not get a callout!\n", - cpu_id); - BUG(); - } - - /* Allow the master to continue. */ - cpumask_set_cpu(cpu_id, &cpu_callin_map); -} - -static void __init smp_online(void) -{ - int cpu_id = smp_processor_id(); - - notify_cpu_starting(cpu_id); - - local_irq_enable(); - - /* Get our bogomips. */ - calibrate_delay(); - - /* Save our processor parameters */ - smp_store_cpu_info(cpu_id); - - set_cpu_online(cpu_id, true); -} - -/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ -/* Boot up CPUs common Routines */ -/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ -static void __init show_mp_info(int nr_cpu) -{ - int i; - char cpu_model0[17], cpu_model1[17], cpu_ver[9]; - - strncpy(cpu_model0, (char *)M32R_FPGA_CPU_NAME_ADDR, 16); - strncpy(cpu_model1, (char *)M32R_FPGA_MODEL_ID_ADDR, 16); - strncpy(cpu_ver, (char *)M32R_FPGA_VERSION_ADDR, 8); - - cpu_model0[16] = '\0'; - for (i = 15 ; i >= 0 ; i--) { - if (cpu_model0[i] != ' ') - break; - cpu_model0[i] = '\0'; - } - cpu_model1[16] = '\0'; - for (i = 15 ; i >= 0 ; i--) { - if (cpu_model1[i] != ' ') - break; - cpu_model1[i] = '\0'; - } - cpu_ver[8] = '\0'; - for (i = 7 ; i >= 0 ; i--) { - if (cpu_ver[i] != ' ') - break; - cpu_ver[i] = '\0'; - } - - printk(KERN_INFO "M32R-mp information\n"); - printk(KERN_INFO " On-chip CPUs : %d\n", nr_cpu); - printk(KERN_INFO " CPU model : %s/%s(%s)\n", cpu_model0, - cpu_model1, cpu_ver); -} - -/* - * The bootstrap kernel entry code has set these up. Save them for - * a given CPU - */ -static void __init smp_store_cpu_info(int cpu_id) -{ - struct cpuinfo_m32r *ci = cpu_data + cpu_id; - - *ci = boot_cpu_data; - ci->loops_per_jiffy = loops_per_jiffy; -} - -static void __init show_cpu_info(int cpu_id) -{ - struct cpuinfo_m32r *ci = &cpu_data[cpu_id]; - - printk("CPU#%d : ", cpu_id); - -#define PRINT_CLOCK(name, value) \ - printk(name " clock %d.%02dMHz", \ - ((value) / 1000000), ((value) % 1000000) / 10000) - - PRINT_CLOCK("CPU", (int)ci->cpu_clock); - PRINT_CLOCK(", Bus", (int)ci->bus_clock); - printk(", loops_per_jiffy[%ld]\n", ci->loops_per_jiffy); -} - -/* - * the frequency of the profiling timer can be changed - * by writing a multiplier value into /proc/profile. - */ -int setup_profiling_timer(unsigned int multiplier) -{ - int i; - - /* - * Sanity check. [at least 500 APIC cycles should be - * between APIC interrupts as a rule of thumb, to avoid - * irqs flooding us] - */ - if ( (!multiplier) || (calibration_result / multiplier < 500)) - return -EINVAL; - - /* - * Set the new multiplier for each CPU. CPUs don't start using the - * new values until the next timer interrupt in which they do process - * accounting. At that time they also adjust their APIC timers - * accordingly. - */ - for_each_possible_cpu(i) - per_cpu(prof_multiplier, i) = multiplier; - - return 0; -} - -/* Initialize all maps between cpu number and apicids */ -static void __init init_cpu_to_physid(void) -{ - int i; - - for (i = 0 ; i < NR_CPUS ; i++) { - cpu_2_physid[i] = -1; - physid_2_cpu[i] = -1; - } -} - -/* - * set up a mapping between cpu and apicid. Uses logical apicids for multiquad, - * else physical apic ids - */ -static void __init map_cpu_to_physid(int cpu_id, int phys_id) -{ - physid_2_cpu[phys_id] = cpu_id; - cpu_2_physid[cpu_id] = phys_id; -} - -/* - * undo a mapping between cpu and apicid. Uses logical apicids for multiquad, - * else physical apic ids - */ -static void __init unmap_cpu_to_physid(int cpu_id, int phys_id) -{ - physid_2_cpu[phys_id] = -1; - cpu_2_physid[cpu_id] = -1; -} diff --git a/arch/m32r/kernel/sys_m32r.c b/arch/m32r/kernel/sys_m32r.c deleted file mode 100644 index 22a50fc49ab72..0000000000000 --- a/arch/m32r/kernel/sys_m32r.c +++ /dev/null @@ -1,91 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * linux/arch/m32r/kernel/sys_m32r.c - * - * This file contains various random system calls that - * have a non-standard calling sequence on the Linux/M32R platform. - * - * Taken from i386 version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -/* - * sys_tas() - test-and-set - */ -asmlinkage int sys_tas(int __user *addr) -{ - int oldval; - - if (!access_ok(VERIFY_WRITE, addr, sizeof (int))) - return -EFAULT; - - /* atomic operation: - * oldval = *addr; *addr = 1; - */ - __asm__ __volatile__ ( - DCACHE_CLEAR("%0", "r4", "%1") - " .fillinsn\n" - "1:\n" - " lock %0, @%1 -> unlock %2, @%1\n" - "2:\n" - /* NOTE: - * The m32r processor can accept interrupts only - * at the 32-bit instruction boundary. - * So, in the above code, the "unlock" instruction - * can be executed continuously after the "lock" - * instruction execution without any interruptions. - */ - ".section .fixup,\"ax\"\n" - " .balign 4\n" - "3: ldi %0, #%3\n" - " seth r14, #high(2b)\n" - " or3 r14, r14, #low(2b)\n" - " jmp r14\n" - ".previous\n" - ".section __ex_table,\"a\"\n" - " .balign 4\n" - " .long 1b,3b\n" - ".previous\n" - : "=&r" (oldval) - : "r" (addr), "r" (1), "i"(-EFAULT) - : "r14", "memory" -#ifdef CONFIG_CHIP_M32700_TS1 - , "r4" -#endif /* CONFIG_CHIP_M32700_TS1 */ - ); - - return oldval; -} - -asmlinkage int sys_cacheflush(void *addr, int bytes, int cache) -{ - /* This should flush more selectively ... */ - _flush_cache_all(); - return 0; -} - -asmlinkage int sys_cachectl(char *addr, int nbytes, int op) -{ - /* Not implemented yet. */ - return -ENOSYS; -} diff --git a/arch/m32r/kernel/syscall_table.S b/arch/m32r/kernel/syscall_table.S deleted file mode 100644 index cf0bcf014b981..0000000000000 --- a/arch/m32r/kernel/syscall_table.S +++ /dev/null @@ -1,328 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -ENTRY(sys_call_table) - .long sys_restart_syscall /* 0 - old "setup()" system call*/ - .long sys_exit - .long sys_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 - .long sys_chdir - .long sys_time - .long sys_mknod - .long sys_chmod /* 15 */ - .long sys_ni_syscall /* lchown16 syscall holder */ - .long sys_ni_syscall /* old break syscall holder */ - .long sys_ni_syscall /* old stat syscall holder */ - .long sys_lseek - .long sys_getpid /* 20 */ - .long sys_mount - .long sys_oldumount - .long sys_ni_syscall /* setuid16 syscall holder */ - .long sys_ni_syscall /* getuid16 syscall holder */ - .long sys_stime /* 25 */ - .long sys_ptrace - .long sys_alarm - .long sys_ni_syscall /* old fstat syscall holder */ - .long sys_pause - .long sys_utime /* 30 */ - .long sys_ni_syscall /* old stty syscall holder */ - .long sys_cachectl /* for M32R */ /* old gtty syscall holder */ - .long sys_access - .long sys_ni_syscall /* nice syscall holder */ - .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_ni_syscall /* setgid16 syscall holder */ - .long sys_getgid /* will be unused */ - .long sys_ni_syscall /* signal syscall holder */ - .long sys_ni_syscall /* geteuid16 syscall holder */ - .long sys_ni_syscall /* 50 - getegid16 syscall holder */ - .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 - will be unused */ - .long sys_ni_syscall /* mpx syscall holder */ - .long sys_setpgid - .long sys_ni_syscall /* old ulimit syscall holder */ - .long sys_ni_syscall /* sys_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_ni_syscall /* sigaction syscall holder */ - .long sys_ni_syscall /* sgetmask syscall holder */ - .long sys_ni_syscall /* ssetmask syscall holder */ - .long sys_ni_syscall /* 70 - setreuid16 syscall holder */ - .long sys_ni_syscall /* setregid16 syscall holder */ - .long sys_ni_syscall /* sigsuspend syscall holder */ - .long sys_ni_syscall /* sigpending syscall holder */ - .long sys_sethostname - .long sys_setrlimit /* 75 */ - .long sys_getrlimit/*will be unused*/ - .long sys_getrusage - .long sys_gettimeofday - .long sys_settimeofday - .long sys_ni_syscall /* 80 - getgroups16 syscall holder */ - .long sys_ni_syscall /* setgroups16 syscall holder */ - .long sys_ni_syscall /* sys_oldselect */ - .long sys_symlink - .long sys_ni_syscall /* old lstat syscall holder */ - .long sys_readlink /* 85 */ - .long sys_uselib - .long sys_swapon - .long sys_reboot - .long sys_ni_syscall /* readdir syscall holder */ - .long sys_ni_syscall /* 90 - old_mmap syscall holder */ - .long sys_munmap - .long sys_truncate - .long sys_ftruncate - .long sys_fchmod - .long sys_ni_syscall /* 95 - fchwon16 syscall holder */ - .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 syscall holder */ - .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 /* old uname syscall holder */ - .long sys_ni_syscall /* 110 - iopl syscall holder */ - .long sys_vhangup - .long sys_ni_syscall /* idle syscall holder */ - .long sys_ni_syscall /* vm86old syscall holder */ - .long sys_wait4 - .long sys_swapoff /* 115 */ - .long sys_sysinfo - .long sys_ipc - .long sys_fsync - .long sys_ni_syscall /* sigreturn syscall holder */ - .long sys_clone /* 120 */ - .long sys_setdomainname - .long sys_newuname - .long sys_ni_syscall /* modify_ldt syscall holder */ - .long sys_adjtimex - .long sys_mprotect /* 125 */ - .long sys_ni_syscall /* sigprocmask syscall holder */ - .long sys_ni_syscall /* create_module syscall holder */ - .long sys_init_module - .long sys_delete_module - .long sys_ni_syscall /* 130 - 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 /* afs_syscall syscall holder */ - .long sys_ni_syscall /* setfsuid16 syscall holder */ - .long sys_ni_syscall /* setfsgid16 syscall holder */ - .long sys_llseek /* 140 */ - .long sys_getdents - .long sys_select - .long sys_flock - .long sys_msync - .long sys_readv /* 145 */ - .long sys_writev - .long sys_getsid - .long sys_fdatasync - .long sys_sysctl - .long sys_mlock /* 150 */ - .long sys_munlock - .long sys_mlockall - .long 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_mremap - .long sys_ni_syscall /* setresuid16 syscall holder */ - .long sys_ni_syscall /* 165 - getresuid16 syscall holder */ - .long sys_tas /* vm86 syscall holder */ - .long sys_ni_syscall /* query_module syscall holder */ - .long sys_poll - .long sys_ni_syscall /* was nfsservctl */ - .long sys_setresgid /* 170 */ - .long sys_getresgid - .long sys_prctl - .long sys_rt_sigreturn - .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 - .long sys_pread64 /* 180 */ - .long sys_pwrite64 - .long sys_ni_syscall /* chown16 syscall holder */ - .long sys_getcwd - .long sys_capget - .long sys_capset /* 185 */ - .long sys_sigaltstack - .long sys_sendfile - .long sys_ni_syscall /* streams1 */ - .long sys_ni_syscall /* streams2 */ - .long sys_vfork /* 190 */ - .long sys_getrlimit - .long sys_mmap_pgoff - .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_mincore - .long sys_madvise - .long sys_getdents64 /* 220 */ - .long sys_fcntl64 - .long sys_ni_syscall /* reserved for TUX */ - .long sys_ni_syscall /* Reserved for Security */ - .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 /* reserved for "set_thread_area" system call */ - .long sys_ni_syscall /* reserved for "get_thread_area" system call */ - .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_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 /* Reserved for sys_vserver */ - .long sys_ni_syscall /* Reserved for sys_mbind */ - .long sys_ni_syscall /* Reserved for sys_get_mempolicy */ - .long sys_ni_syscall /* Reserved for 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_ni_syscall /* reserved for kexec */ - .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_migrate_pages - .long sys_openat /* 295 */ - .long sys_mkdirat - .long sys_mknodat - .long sys_fchownat - .long sys_futimesat - .long sys_fstatat64 /* 300 */ - .long sys_unlinkat - .long sys_renameat - .long sys_linkat - .long sys_symlinkat - .long sys_readlinkat /* 305 */ - .long sys_fchmodat - .long sys_faccessat - .long sys_pselect6 - .long sys_ppoll - .long sys_unshare /* 310 */ - .long sys_set_robust_list - .long sys_get_robust_list - .long sys_splice - .long sys_sync_file_range - .long sys_tee /* 315 */ - .long sys_vmsplice - .long sys_move_pages - .long sys_getcpu - .long sys_epoll_pwait - .long sys_utimensat /* 320 */ - .long sys_signalfd - .long sys_ni_syscall - .long sys_eventfd - .long sys_fallocate - .long sys_setns /* 325 */ diff --git a/arch/m32r/kernel/time.c b/arch/m32r/kernel/time.c deleted file mode 100644 index 521749fbbb564..0000000000000 --- a/arch/m32r/kernel/time.c +++ /dev/null @@ -1,199 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * linux/arch/m32r/kernel/time.c - * - * Copyright (c) 2001, 2002 Hiroyuki Kondo, Hirokazu Takata, - * Hitoshi Yamamoto - * Taken from i386 version. - * Copyright (C) 1991, 1992, 1995 Linus Torvalds - * Copyright (C) 1996, 1997, 1998 Ralf Baechle - * - * This file contains the time handling details for PC-style clocks as - * found in some MIPS systems. - * - * Some code taken from sh version. - * Copyright (C) 1999 Tetsuya Okada & Niibe Yutaka - * Copyright (C) 2000 Philipp Rumpf - */ - -#undef DEBUG_TIMER - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include - -#if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE) -/* this needs a better home */ -DEFINE_SPINLOCK(rtc_lock); - -#ifdef CONFIG_RTC_DRV_CMOS_MODULE -EXPORT_SYMBOL(rtc_lock); -#endif -#endif /* pc-style 'CMOS' RTC support */ - -#ifdef CONFIG_SMP -extern void smp_local_timer_interrupt(void); -#endif - -#define TICK_SIZE (tick_nsec / 1000) - -/* - * Change this if you have some constant time drift - */ - -/* This is for machines which generate the exact clock. */ -#define USECS_PER_JIFFY (1000000/HZ) - -static unsigned long latch; - -static u32 m32r_gettimeoffset(void) -{ - unsigned long elapsed_time = 0; /* [us] */ - -#if defined(CONFIG_CHIP_M32102) || defined(CONFIG_CHIP_XNUX2) \ - || defined(CONFIG_CHIP_VDEC2) || defined(CONFIG_CHIP_M32700) \ - || defined(CONFIG_CHIP_OPSP) || defined(CONFIG_CHIP_M32104) -#ifndef CONFIG_SMP - - unsigned long count; - - /* timer count may underflow right here */ - count = inl(M32R_MFT2CUT_PORTL); - - if (inl(M32R_ICU_CR18_PORTL) & 0x00000100) /* underflow check */ - count = 0; - - count = (latch - count) * TICK_SIZE; - elapsed_time = DIV_ROUND_CLOSEST(count, latch); - /* NOTE: LATCH is equal to the "interval" value (= reload count). */ - -#else /* CONFIG_SMP */ - unsigned long count; - static unsigned long p_jiffies = -1; - static unsigned long p_count = 0; - - /* timer count may underflow right here */ - count = inl(M32R_MFT2CUT_PORTL); - - if (jiffies == p_jiffies && count > p_count) - count = 0; - - p_jiffies = jiffies; - p_count = count; - - count = (latch - count) * TICK_SIZE; - elapsed_time = DIV_ROUND_CLOSEST(count, latch); - /* NOTE: LATCH is equal to the "interval" value (= reload count). */ -#endif /* CONFIG_SMP */ -#elif defined(CONFIG_CHIP_M32310) -#warning do_gettimeoffse not implemented -#else -#error no chip configuration -#endif - - return elapsed_time * 1000; -} - -/* - * timer_interrupt() needs to keep up the real-time clock, - * as well as call the "xtime_update()" routine every clocktick - */ -static irqreturn_t timer_interrupt(int irq, void *dev_id) -{ -#ifndef CONFIG_SMP - profile_tick(CPU_PROFILING); -#endif - xtime_update(1); - -#ifndef CONFIG_SMP - update_process_times(user_mode(get_irq_regs())); -#endif - /* As we return to user mode fire off the other CPU schedulers.. - this is basically because we don't yet share IRQ's around. - This message is rigged to be safe on the 386 - basically it's - a hack, so don't look closely for now.. */ - -#ifdef CONFIG_SMP - smp_local_timer_interrupt(); - smp_send_timer(); -#endif - - return IRQ_HANDLED; -} - -static struct irqaction irq0 = { - .handler = timer_interrupt, - .name = "MFT2", -}; - -void read_persistent_clock(struct timespec *ts) -{ - unsigned int epoch, year, mon, day, hour, min, sec; - - sec = min = hour = day = mon = year = 0; - epoch = 0; - - year = 23; - mon = 4; - day = 17; - - /* Attempt to guess the epoch. This is the same heuristic as in rtc.c - so no stupid things will happen to timekeeping. Who knows, maybe - Ultrix also uses 1952 as epoch ... */ - if (year > 10 && year < 44) - epoch = 1980; - else if (year < 96) - epoch = 1952; - year += epoch; - - ts->tv_sec = mktime(year, mon, day, hour, min, sec); - ts->tv_nsec = (INITIAL_JIFFIES % HZ) * (NSEC_PER_SEC / HZ); -} - - -void __init time_init(void) -{ - arch_gettimeoffset = m32r_gettimeoffset; - -#if defined(CONFIG_CHIP_M32102) || defined(CONFIG_CHIP_XNUX2) \ - || defined(CONFIG_CHIP_VDEC2) || defined(CONFIG_CHIP_M32700) \ - || defined(CONFIG_CHIP_OPSP) || defined(CONFIG_CHIP_M32104) - - /* M32102 MFT setup */ - setup_irq(M32R_IRQ_MFT2, &irq0); - { - unsigned long bus_clock; - unsigned short divide; - - bus_clock = boot_cpu_data.bus_clock; - divide = boot_cpu_data.timer_divide; - latch = DIV_ROUND_CLOSEST(bus_clock/divide, HZ); - - printk("Timer start : latch = %ld\n", latch); - - outl((M32R_MFTMOD_CC_MASK | M32R_MFTMOD_TCCR \ - |M32R_MFTMOD_CSSEL011), M32R_MFT2MOD_PORTL); - outl(latch, M32R_MFT2RLD_PORTL); - outl(latch, M32R_MFT2CUT_PORTL); - outl(0, M32R_MFT2CMPRLD_PORTL); - outl((M32R_MFTCR_MFT2MSK|M32R_MFTCR_MFT2EN), M32R_MFTCR_PORTL); - } - -#elif defined(CONFIG_CHIP_M32310) -#warning time_init not implemented -#else -#error no chip configuration -#endif -} diff --git a/arch/m32r/kernel/traps.c b/arch/m32r/kernel/traps.c deleted file mode 100644 index a6f300a208bd9..0000000000000 --- a/arch/m32r/kernel/traps.c +++ /dev/null @@ -1,324 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * linux/arch/m32r/kernel/traps.c - * - * Copyright (C) 2001, 2002 Hirokazu Takata, Hiroyuki Kondo, - * Hitoshi Yamamoto - */ - -/* - * 'traps.c' handles hardware traps and faults after we have saved some - * state in 'entry.S'. - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -#include - -#include - -asmlinkage void alignment_check(void); -asmlinkage void ei_handler(void); -asmlinkage void rie_handler(void); -asmlinkage void debug_trap(void); -asmlinkage void cache_flushing_handler(void); -asmlinkage void ill_trap(void); - -#ifdef CONFIG_SMP -extern void smp_reschedule_interrupt(void); -extern void smp_invalidate_interrupt(void); -extern void smp_call_function_interrupt(void); -extern void smp_ipi_timer_interrupt(void); -extern void smp_flush_cache_all_interrupt(void); -extern void smp_call_function_single_interrupt(void); - -/* - * for Boot AP function - */ -asm ( - " .section .eit_vector4,\"ax\" \n" - " .global _AP_RE \n" - " .global startup_AP \n" - "_AP_RE: \n" - " .fill 32, 4, 0 \n" - "_AP_EI: bra startup_AP \n" - " .previous \n" -); -#endif /* CONFIG_SMP */ - -extern unsigned long eit_vector[]; -#define BRA_INSN(func, entry) \ - ((unsigned long)func - (unsigned long)eit_vector - entry*4)/4 \ - + 0xff000000UL - -static void set_eit_vector_entries(void) -{ - extern void default_eit_handler(void); - extern void system_call(void); - extern void pie_handler(void); - extern void ace_handler(void); - extern void tme_handler(void); - extern void _flush_cache_copyback_all(void); - - eit_vector[0] = 0xd0c00001; /* seth r0, 0x01 */ - eit_vector[1] = BRA_INSN(default_eit_handler, 1); - eit_vector[4] = 0xd0c00010; /* seth r0, 0x10 */ - eit_vector[5] = BRA_INSN(default_eit_handler, 5); - eit_vector[8] = BRA_INSN(rie_handler, 8); - eit_vector[12] = BRA_INSN(alignment_check, 12); - eit_vector[16] = BRA_INSN(ill_trap, 16); - eit_vector[17] = BRA_INSN(debug_trap, 17); - eit_vector[18] = BRA_INSN(system_call, 18); - eit_vector[19] = BRA_INSN(ill_trap, 19); - eit_vector[20] = BRA_INSN(ill_trap, 20); - eit_vector[21] = BRA_INSN(ill_trap, 21); - eit_vector[22] = BRA_INSN(ill_trap, 22); - eit_vector[23] = BRA_INSN(ill_trap, 23); - eit_vector[24] = BRA_INSN(ill_trap, 24); - eit_vector[25] = BRA_INSN(ill_trap, 25); - eit_vector[26] = BRA_INSN(ill_trap, 26); - eit_vector[27] = BRA_INSN(ill_trap, 27); - eit_vector[28] = BRA_INSN(cache_flushing_handler, 28); - eit_vector[29] = BRA_INSN(ill_trap, 29); - eit_vector[30] = BRA_INSN(ill_trap, 30); - eit_vector[31] = BRA_INSN(ill_trap, 31); - eit_vector[32] = BRA_INSN(ei_handler, 32); - eit_vector[64] = BRA_INSN(pie_handler, 64); -#ifdef CONFIG_MMU - eit_vector[68] = BRA_INSN(ace_handler, 68); - eit_vector[72] = BRA_INSN(tme_handler, 72); -#endif /* CONFIG_MMU */ -#ifdef CONFIG_SMP - eit_vector[184] = (unsigned long)smp_reschedule_interrupt; - eit_vector[185] = (unsigned long)smp_invalidate_interrupt; - eit_vector[186] = (unsigned long)smp_call_function_interrupt; - eit_vector[187] = (unsigned long)smp_ipi_timer_interrupt; - eit_vector[188] = (unsigned long)smp_flush_cache_all_interrupt; - eit_vector[189] = 0; /* CPU_BOOT_IPI */ - eit_vector[190] = (unsigned long)smp_call_function_single_interrupt; - eit_vector[191] = 0; -#endif - _flush_cache_copyback_all(); -} - -void __init trap_init(void) -{ - set_eit_vector_entries(); - - /* - * Should be a barrier for any external CPU state. - */ - cpu_init(); -} - -static int kstack_depth_to_print = 24; - -static void show_trace(struct task_struct *task, unsigned long *stack) -{ - unsigned long addr; - - if (!stack) - stack = (unsigned long*)&stack; - - printk("Call Trace: "); - while (!kstack_end(stack)) { - addr = *stack++; - if (__kernel_text_address(addr)) - printk("[<%08lx>] %pSR\n", addr, (void *)addr); - } - printk("\n"); -} - -void show_stack(struct task_struct *task, unsigned long *sp) -{ - unsigned long *stack; - int i; - - /* - * debugging aid: "show_stack(NULL);" prints the - * back trace for this cpu. - */ - - if(sp==NULL) { - if (task) - sp = (unsigned long *)task->thread.sp; - else - sp=(unsigned long*)&sp; - } - - stack = sp; - for(i=0; i < kstack_depth_to_print; i++) { - if (kstack_end(stack)) - break; - if (i && ((i % 4) == 0)) - printk("\n "); - printk("%08lx ", *stack++); - } - printk("\n"); - show_trace(task, sp); -} - -static void show_registers(struct pt_regs *regs) -{ - int i = 0; - int in_kernel = 1; - unsigned long sp; - - printk("CPU: %d\n", smp_processor_id()); - show_regs(regs); - - sp = (unsigned long) (1+regs); - if (user_mode(regs)) { - in_kernel = 0; - sp = regs->spu; - printk("SPU: %08lx\n", sp); - } else { - printk("SPI: %08lx\n", sp); - } - printk("Process %s (pid: %d, process nr: %d, stackpage=%08lx)", - current->comm, task_pid_nr(current), 0xffff & i, 4096+(unsigned long)current); - - /* - * When in-kernel, we also print out the stack and code at the - * time of the fault.. - */ - if (in_kernel) { - printk("\nStack: "); - show_stack(current, (unsigned long*) sp); - - printk("\nCode: "); - if (regs->bpc < PAGE_OFFSET) - goto bad; - - for(i=0;i<20;i++) { - unsigned char c; - if (__get_user(c, &((unsigned char*)regs->bpc)[i])) { -bad: - printk(" Bad PC value."); - break; - } - printk("%02x ", c); - } - } - printk("\n"); -} - -static DEFINE_SPINLOCK(die_lock); - -void die(const char * str, struct pt_regs * regs, long err) -{ - console_verbose(); - spin_lock_irq(&die_lock); - bust_spinlocks(1); - printk("%s: %04lx\n", str, err & 0xffff); - show_registers(regs); - bust_spinlocks(0); - spin_unlock_irq(&die_lock); - do_exit(SIGSEGV); -} - -static __inline__ void die_if_kernel(const char * str, - struct pt_regs * regs, long err) -{ - if (!user_mode(regs)) - die(str, regs, err); -} - -static __inline__ void do_trap(int trapnr, int signr, const char * str, - struct pt_regs * regs, long error_code, siginfo_t *info) -{ - if (user_mode(regs)) { - /* trap_signal */ - struct task_struct *tsk = current; - tsk->thread.error_code = error_code; - tsk->thread.trap_no = trapnr; - if (info) - force_sig_info(signr, info, tsk); - else - force_sig(signr, tsk); - return; - } else { - /* kernel_trap */ - if (!fixup_exception(regs)) - die(str, regs, error_code); - return; - } -} - -#define DO_ERROR(trapnr, signr, str, name) \ -asmlinkage void do_##name(struct pt_regs * regs, long error_code) \ -{ \ - do_trap(trapnr, signr, NULL, regs, error_code, NULL); \ -} - -#define DO_ERROR_INFO(trapnr, signr, str, name, sicode, siaddr) \ -asmlinkage void do_##name(struct pt_regs * regs, long error_code) \ -{ \ - siginfo_t info; \ - info.si_signo = signr; \ - info.si_errno = 0; \ - info.si_code = sicode; \ - info.si_addr = (void __user *)siaddr; \ - do_trap(trapnr, signr, str, regs, error_code, &info); \ -} - -DO_ERROR( 1, SIGTRAP, "debug trap", debug_trap) -DO_ERROR_INFO(0x20, SIGILL, "reserved instruction ", rie_handler, ILL_ILLOPC, regs->bpc) -DO_ERROR_INFO(0x100, SIGILL, "privileged instruction", pie_handler, ILL_PRVOPC, regs->bpc) -DO_ERROR_INFO(-1, SIGILL, "illegal trap", ill_trap, ILL_ILLTRP, regs->bpc) - -extern int handle_unaligned_access(unsigned long, struct pt_regs *); - -/* This code taken from arch/sh/kernel/traps.c */ -asmlinkage void do_alignment_check(struct pt_regs *regs, long error_code) -{ - mm_segment_t oldfs; - unsigned long insn; - int tmp; - - oldfs = get_fs(); - - if (user_mode(regs)) { - local_irq_enable(); - current->thread.error_code = error_code; - current->thread.trap_no = 0x17; - - set_fs(USER_DS); - if (copy_from_user(&insn, (void *)regs->bpc, 4)) { - set_fs(oldfs); - goto uspace_segv; - } - tmp = handle_unaligned_access(insn, regs); - set_fs(oldfs); - - if (!tmp) - return; - - uspace_segv: - printk(KERN_NOTICE "Killing process \"%s\" due to unaligned " - "access\n", current->comm); - force_sig(SIGSEGV, current); - } else { - set_fs(KERNEL_DS); - if (copy_from_user(&insn, (void *)regs->bpc, 4)) { - set_fs(oldfs); - die("insn faulting in do_address_error", regs, 0); - } - handle_unaligned_access(insn, regs); - set_fs(oldfs); - } -} diff --git a/arch/m32r/kernel/vmlinux.lds.S b/arch/m32r/kernel/vmlinux.lds.S deleted file mode 100644 index 7e4d957f7f7f0..0000000000000 --- a/arch/m32r/kernel/vmlinux.lds.S +++ /dev/null @@ -1,79 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* ld script to make M32R Linux kernel - */ - -#include -#include -#include -#include - -OUTPUT_ARCH(m32r) -#if defined(__LITTLE_ENDIAN__) - jiffies = jiffies_64; -#else - jiffies = jiffies_64 + 4; -#endif - -kernel_entry = boot - 0x80000000; -ENTRY(kernel_entry) - -SECTIONS -{ - . = CONFIG_MEMORY_START + __PAGE_OFFSET; - eit_vector = .; - - . = . + 0x1000; - .empty_zero_page : { *(.empty_zero_page) } = 0 - - /* read-only */ - _text = .; /* Text and read-only data */ - .boot : { *(.boot) } = 0 - .text : { - HEAD_TEXT - TEXT_TEXT - SCHED_TEXT - CPUIDLE_TEXT - LOCK_TEXT - *(.fixup) - *(.gnu.warning) - } = 0x9090 -#ifdef CONFIG_SMP - . = ALIGN(65536); - .eit_vector4 : { *(.eit_vector4) } -#endif - _etext = .; /* End of text section */ - - EXCEPTION_TABLE(16) - NOTES - - _sdata = .; /* Start of data section */ - RODATA - RW_DATA_SECTION(32, PAGE_SIZE, THREAD_SIZE) - _edata = .; /* End of data section */ - - /* will be freed after init */ - . = ALIGN(PAGE_SIZE); /* Init code and data */ - __init_begin = .; - INIT_TEXT_SECTION(PAGE_SIZE) - INIT_DATA_SECTION(16) - PERCPU_SECTION(32) - . = ALIGN(PAGE_SIZE); - __init_end = .; - /* freed after init ends here */ - - BSS_SECTION(0, 0, 4) - - _end = . ; - - /* Stabs debugging sections. */ - .stab 0 : { *(.stab) } - .stabstr 0 : { *(.stabstr) } - .stab.excl 0 : { *(.stab.excl) } - .stab.exclstr 0 : { *(.stab.exclstr) } - .stab.index 0 : { *(.stab.index) } - .stab.indexstr 0 : { *(.stab.indexstr) } - .comment 0 : { *(.comment) } - - /* Sections to be discarded */ - DISCARDS -} diff --git a/arch/m32r/lib/Makefile b/arch/m32r/lib/Makefile deleted file mode 100644 index 5889eb9610b59..0000000000000 --- a/arch/m32r/lib/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# -# Makefile for M32R-specific library files.. -# - -lib-y := checksum.o ashxdi3.o memset.o memcpy.o \ - delay.o strlen.o usercopy.o csum_partial_copy.o \ - ucmpdi2.o diff --git a/arch/m32r/lib/ashxdi3.S b/arch/m32r/lib/ashxdi3.S deleted file mode 100644 index cd1acca539119..0000000000000 --- a/arch/m32r/lib/ashxdi3.S +++ /dev/null @@ -1,294 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * linux/arch/m32r/lib/ashxdi3.S - * - * Copyright (C) 2001,2002 Hiroyuki Kondo, and Hirokazu Takata - * - */ - -; -; input (r0,r1) src -; input r2 shift val -; r3 scratch -; output (r0,r1) -; - -#ifdef CONFIG_ISA_DUAL_ISSUE - -#ifndef __LITTLE_ENDIAN__ - - .text - .align 4 - .globl __ashrdi3 -__ashrdi3: - cmpz r2 || ldi r3, #32 - jc r14 || cmpu r2, r3 - bc 1f - ; case 32 =< shift - mv r1, r0 || srai r0, #31 - addi r2, #-32 - sra r1, r2 - jmp r14 - .fillinsn -1: ; case shift <32 - mv r3, r0 || srl r1, r2 - sra r0, r2 || neg r2, r2 - sll r3, r2 - or r1, r3 || jmp r14 - - .align 4 - .globl __ashldi3 - .globl __lshldi3 -__ashldi3: -__lshldi3: - cmpz r2 || ldi r3, #32 - jc r14 || cmpu r2, r3 - bc 1f - ; case 32 =< shift - mv r0, r1 || addi r2, #-32 - sll r0, r2 || ldi r1, #0 - jmp r14 - .fillinsn -1: ; case shift <32 - mv r3, r1 || sll r0, r2 - sll r1, r2 || neg r2, r2 - srl r3, r2 - or r0, r3 || jmp r14 - - .align 4 - .globl __lshrdi3 -__lshrdi3: - cmpz r2 || ldi r3, #32 - jc r14 || cmpu r2, r3 - bc 1f - ; case 32 =< shift - mv r1, r0 || addi r2, #-32 - ldi r0, #0 || srl r1, r2 - jmp r14 - .fillinsn -1: ; case shift <32 - mv r3, r0 || srl r1, r2 - srl r0, r2 || neg r2, r2 - sll r3, r2 - or r1, r3 || jmp r14 - -#else /* LITTLE_ENDIAN */ - - .text - .align 4 - .globl __ashrdi3 -__ashrdi3: - cmpz r2 || ldi r3, #32 - jc r14 || cmpu r2, r3 - bc 1f - ; case 32 =< shift - mv r0, r1 || srai r1, #31 - addi r2, #-32 - sra r0, r2 - jmp r14 - .fillinsn -1: ; case shift <32 - mv r3, r1 || srl r0, r2 - sra r1, r2 || neg r2, r2 - sll r3, r2 - or r0, r3 || jmp r14 - - .align 4 - .globl __ashldi3 - .globl __lshldi3 -__ashldi3: -__lshldi3: - cmpz r2 || ldi r3, #32 - jc r14 || cmpu r2, r3 - bc 1f - ; case 32 =< shift - mv r1, r0 || addi r2, #-32 - sll r1, r2 || ldi r0, #0 - jmp r14 - .fillinsn -1: ; case shift <32 - mv r3, r0 || sll r1, r2 - sll r0, r2 || neg r2, r2 - srl r3, r2 - or r1, r3 || jmp r14 - - .align 4 - .globl __lshrdi3 -__lshrdi3: - cmpz r2 || ldi r3, #32 - jc r14 || cmpu r2, r3 - bc 1f - ; case 32 =< shift - mv r0, r1 || addi r2, #-32 - ldi r1, #0 || srl r0, r2 - jmp r14 - .fillinsn -1: ; case shift <32 - mv r3, r1 || srl r0, r2 - srl r1, r2 || neg r2, r2 - sll r3, r2 - or r0, r3 || jmp r14 - -#endif - -#else /* not CONFIG_ISA_DUAL_ISSUE */ - -#ifndef __LITTLE_ENDIAN__ - - .text - .align 4 - .globl __ashrdi3 -__ashrdi3: - beqz r2, 2f - cmpui r2, #32 - bc 1f - ; case 32 =< shift - mv r1, r0 - srai r0, #31 - addi r2, #-32 - sra r1, r2 - jmp r14 - .fillinsn -1: ; case shift <32 - mv r3, r0 - srl r1, r2 - sra r0, r2 - neg r2, r2 - sll r3, r2 - or r1, r3 - .fillinsn -2: - jmp r14 - - .align 4 - .globl __ashldi3 - .globl __lshldi3 -__ashldi3: -__lshldi3: - beqz r2, 2f - cmpui r2, #32 - bc 1f - ; case 32 =< shift - mv r0, r1 - addi r2, #-32 - sll r0, r2 - ldi r1, #0 - jmp r14 - .fillinsn -1: ; case shift <32 - mv r3, r1 - sll r0, r2 - sll r1, r2 - neg r2, r2 - srl r3, r2 - or r0, r3 - .fillinsn -2: - jmp r14 - - .align 4 - .globl __lshrdi3 -__lshrdi3: - beqz r2, 2f - cmpui r2, #32 - bc 1f - ; case 32 =< shift - mv r1, r0 - ldi r0, #0 - addi r2, #-32 - srl r1, r2 - jmp r14 - .fillinsn -1: ; case shift <32 - mv r3, r0 - srl r1, r2 - srl r0, r2 - neg r2, r2 - sll r3, r2 - or r1, r3 - .fillinsn -2: - jmp r14 - -#else - - .text - .align 4 - .globl __ashrdi3 -__ashrdi3: - beqz r2, 2f - cmpui r2, #32 - bc 1f - ; case 32 =< shift - mv r0, r1 - srai r1, #31 - addi r2, #-32 - sra r0, r2 - jmp r14 - .fillinsn -1: ; case shift <32 - mv r3, r1 - srl r0, r2 - sra r1, r2 - neg r2, r2 - sll r3, r2 - or r0, r3 - .fillinsn -2: - jmp r14 - - .align 4 - .globl __ashldi3 - .globl __lshldi3 -__ashldi3: -__lshldi3: - beqz r2, 2f - cmpui r2, #32 - bc 1f - ; case 32 =< shift - mv r1, r0 - addi r2, #-32 - sll r1, r2 - ldi r0, #0 - jmp r14 - .fillinsn -1: ; case shift <32 - mv r3, r0 - sll r1, r2 - sll r0, r2 - neg r2, r2 - srl r3, r2 - or r1, r3 - .fillinsn -2: - jmp r14 - - .align 4 - .globl __lshrdi3 -__lshrdi3: - beqz r2, 2f - cmpui r2, #32 - bc 1f - ; case 32 =< shift - mv r0, r1 - ldi r1, #0 - addi r2, #-32 - srl r0, r2 - jmp r14 - .fillinsn -1: ; case shift <32 - mv r3, r1 - srl r0, r2 - srl r1, r2 - neg r2, r2 - sll r3, r2 - or r0, r3 - .fillinsn -2: - jmp r14 - -#endif - -#endif /* not CONFIG_ISA_DUAL_ISSUE */ - - .end diff --git a/arch/m32r/lib/checksum.S b/arch/m32r/lib/checksum.S deleted file mode 100644 index 0af0360c76d95..0000000000000 --- a/arch/m32r/lib/checksum.S +++ /dev/null @@ -1,320 +0,0 @@ -/* - * 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, - * Arnt Gulbrandsen, - * Tom May, - * Pentium Pro/II routines: - * Alexander Kjeldaas - * Finn Arne Gangstad - * Lots of code moved from tcp.c and ip.c; see those files - * for more names. - * - * Changes: Ingo Molnar, converted csum_partial_copy() to 2.1 exception - * handling. - * Andi Kleen, add zeroing on error - * converted to pure assembler - * Hirokazu Takata,Hiroyuki Kondo rewrite for the m32r architecture. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -#include -#include -#include - -/* - * computes a partial checksum, e.g. for TCP/UDP fragments - */ - -/* -unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum) - */ - - -#ifdef CONFIG_ISA_DUAL_ISSUE - - /* - * Experiments with Ethernet and SLIP connections show that buff - * is aligned on either a 2-byte or 4-byte boundary. We get at - * least a twofold speedup on 486 and Pentium if it is 4-byte aligned. - * Fortunately, it is easy to convert 2-byte alignment to 4-byte - * alignment for the unrolled loop. - */ - - .text -ENTRY(csum_partial) - ; Function args - ; r0: unsigned char *buff - ; r1: int len - ; r2: unsigned int sum - - push r2 || ldi r2, #0 - and3 r7, r0, #1 ; Check alignment. - beqz r7, 1f ; Jump if alignment is ok. - ; 1-byte mis aligned - ldub r4, @r0 || addi r0, #1 - ; clear c-bit || Alignment uses up bytes. - cmp r0, r0 || addi r1, #-1 - ldi r3, #0 || addx r2, r4 - addx r2, r3 - .fillinsn -1: - and3 r4, r0, #2 ; Check alignment. - beqz r4, 2f ; Jump if alignment is ok. - ; clear c-bit || Alignment uses up two bytes. - cmp r0, r0 || addi r1, #-2 - bgtz r1, 1f ; Jump if we had at least two bytes. - bra 4f || addi r1, #2 - .fillinsn ; len(r1) was < 2. Deal with it. -1: - ; 2-byte aligned - lduh r4, @r0 || ldi r3, #0 - addx r2, r4 || addi r0, #2 - addx r2, r3 - .fillinsn -2: - ; 4-byte aligned - cmp r0, r0 ; clear c-bit - srl3 r6, r1, #5 - beqz r6, 2f - .fillinsn - -1: ld r3, @r0+ - ld r4, @r0+ ; +4 - ld r5, @r0+ ; +8 - ld r3, @r0+ || addx r2, r3 ; +12 - ld r4, @r0+ || addx r2, r4 ; +16 - ld r5, @r0+ || addx r2, r5 ; +20 - ld r3, @r0+ || addx r2, r3 ; +24 - ld r4, @r0+ || addx r2, r4 ; +28 - addx r2, r5 || addi r6, #-1 - addx r2, r3 - addx r2, r4 - bnez r6, 1b - - addx r2, r6 ; r6=0 - cmp r0, r0 ; This clears c-bit - .fillinsn -2: and3 r6, r1, #0x1c ; withdraw len - beqz r6, 4f - srli r6, #2 - .fillinsn - -3: ld r4, @r0+ || addi r6, #-1 - addx r2, r4 - bnez r6, 3b - - addx r2, r6 ; r6=0 - cmp r0, r0 ; This clears c-bit - .fillinsn -4: and3 r1, r1, #3 - beqz r1, 7f ; if len == 0 goto end - and3 r6, r1, #2 - beqz r6, 5f ; if len < 2 goto 5f(1byte) - lduh r4, @r0 || addi r0, #2 - addi r1, #-2 || slli r4, #16 - addx r2, r4 - beqz r1, 6f - .fillinsn -5: ldub r4, @r0 || ldi r1, #0 -#ifndef __LITTLE_ENDIAN__ - slli r4, #8 -#endif - addx r2, r4 - .fillinsn -6: addx r2, r1 - .fillinsn -7: - and3 r0, r2, #0xffff - srli r2, #16 - add r0, r2 - srl3 r2, r0, #16 - beqz r2, 1f - addi r0, #1 - and3 r0, r0, #0xffff - .fillinsn -1: - beqz r7, 1f ; swap the upper byte for the lower - and3 r2, r0, #0xff - srl3 r0, r0, #8 - slli r2, #8 - or r0, r2 - .fillinsn -1: - pop r2 || cmp r0, r0 - addx r0, r2 || ldi r2, #0 - addx r0, r2 - jmp r14 - -#else /* not CONFIG_ISA_DUAL_ISSUE */ - - /* - * Experiments with Ethernet and SLIP connections show that buff - * is aligned on either a 2-byte or 4-byte boundary. We get at - * least a twofold speedup on 486 and Pentium if it is 4-byte aligned. - * Fortunately, it is easy to convert 2-byte alignment to 4-byte - * alignment for the unrolled loop. - */ - - .text -ENTRY(csum_partial) - ; Function args - ; r0: unsigned char *buff - ; r1: int len - ; r2: unsigned int sum - - push r2 - ldi r2, #0 - and3 r7, r0, #1 ; Check alignment. - beqz r7, 1f ; Jump if alignment is ok. - ; 1-byte mis aligned - ldub r4, @r0 - addi r0, #1 - addi r1, #-1 ; Alignment uses up bytes. - cmp r0, r0 ; clear c-bit - ldi r3, #0 - addx r2, r4 - addx r2, r3 - .fillinsn -1: - and3 r4, r0, #2 ; Check alignment. - beqz r4, 2f ; Jump if alignment is ok. - addi r1, #-2 ; Alignment uses up two bytes. - cmp r0, r0 ; clear c-bit - bgtz r1, 1f ; Jump if we had at least two bytes. - addi r1, #2 ; len(r1) was < 2. Deal with it. - bra 4f - .fillinsn -1: - ; 2-byte aligned - lduh r4, @r0 - addi r0, #2 - ldi r3, #0 - addx r2, r4 - addx r2, r3 - .fillinsn -2: - ; 4-byte aligned - cmp r0, r0 ; clear c-bit - srl3 r6, r1, #5 - beqz r6, 2f - .fillinsn - -1: ld r3, @r0+ - ld r4, @r0+ ; +4 - ld r5, @r0+ ; +8 - addx r2, r3 - addx r2, r4 - addx r2, r5 - ld r3, @r0+ ; +12 - ld r4, @r0+ ; +16 - ld r5, @r0+ ; +20 - addx r2, r3 - addx r2, r4 - addx r2, r5 - ld r3, @r0+ ; +24 - ld r4, @r0+ ; +28 - addi r6, #-1 - addx r2, r3 - addx r2, r4 - bnez r6, 1b - addx r2, r6 ; r6=0 - cmp r0, r0 ; This clears c-bit - .fillinsn - -2: and3 r6, r1, #0x1c ; withdraw len - beqz r6, 4f - srli r6, #2 - .fillinsn - -3: ld r4, @r0+ - addi r6, #-1 - addx r2, r4 - bnez r6, 3b - addx r2, r6 ; r6=0 - cmp r0, r0 ; This clears c-bit - .fillinsn - -4: and3 r1, r1, #3 - beqz r1, 7f ; if len == 0 goto end - and3 r6, r1, #2 - beqz r6, 5f ; if len < 2 goto 5f(1byte) - - lduh r4, @r0 - addi r0, #2 - addi r1, #-2 - slli r4, #16 - addx r2, r4 - beqz r1, 6f - .fillinsn -5: ldub r4, @r0 -#ifndef __LITTLE_ENDIAN__ - slli r4, #8 -#endif - addx r2, r4 - .fillinsn -6: ldi r5, #0 - addx r2, r5 - .fillinsn -7: - and3 r0, r2, #0xffff - srli r2, #16 - add r0, r2 - srl3 r2, r0, #16 - beqz r2, 1f - addi r0, #1 - and3 r0, r0, #0xffff - .fillinsn -1: - beqz r7, 1f - mv r2, r0 - srl3 r0, r2, #8 - and3 r2, r2, #0xff - slli r2, #8 - or r0, r2 - .fillinsn -1: - pop r2 - cmp r0, r0 - addx r0, r2 - ldi r2, #0 - addx r0, r2 - jmp r14 - -#endif /* not CONFIG_ISA_DUAL_ISSUE */ - -/* -unsigned int csum_partial_copy_generic (const char *src, char *dst, - int len, int sum, int *src_err_ptr, int *dst_err_ptr) - */ - -/* - * Copy from ds while checksumming, otherwise like csum_partial - * - * The macros SRC and DST specify the type of access for the instruction. - * thus we can call a custom exception handler for all access types. - * - * FIXME: could someone double-check whether I haven't mixed up some SRC and - * DST definitions? It's damn hard to trigger all cases. I hope I got - * them all but there's no guarantee. - */ - -ENTRY(csum_partial_copy_generic) - nop - nop - nop - nop - jmp r14 - nop - nop - nop - - .end diff --git a/arch/m32r/lib/csum_partial_copy.c b/arch/m32r/lib/csum_partial_copy.c deleted file mode 100644 index b3cd59c12b8e6..0000000000000 --- a/arch/m32r/lib/csum_partial_copy.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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. - * - * M32R specific IP/TCP/UDP checksumming routines - * (Some code taken from MIPS architecture) - * - * This file is subject to 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) 1994, 1995 Waldorf Electronics GmbH - * Copyright (C) 1998, 1999 Ralf Baechle - * Copyright (C) 2001-2005 Hiroyuki Kondo, Hirokazu Takata - * - */ - -#include -#include -#include - -#include -#include -#include - -/* - * Copy while checksumming, otherwise like csum_partial - */ -__wsum -csum_partial_copy_nocheck (const void *src, void *dst, int len, __wsum sum) -{ - sum = csum_partial(src, len, sum); - memcpy(dst, src, len); - - return sum; -} -EXPORT_SYMBOL(csum_partial_copy_nocheck); - -/* - * Copy from userspace and compute checksum. If we catch an exception - * then zero the rest of the buffer. - */ -__wsum -csum_partial_copy_from_user (const void __user *src, void *dst, - int len, __wsum sum, int *err_ptr) -{ - int missing; - - missing = copy_from_user(dst, src, len); - if (missing) { - memset(dst + len - missing, 0, missing); - *err_ptr = -EFAULT; - } - - return csum_partial(dst, len-missing, sum); -} -EXPORT_SYMBOL(csum_partial_copy_from_user); -EXPORT_SYMBOL(csum_partial); diff --git a/arch/m32r/lib/delay.c b/arch/m32r/lib/delay.c deleted file mode 100644 index ae1fe90892f91..0000000000000 --- a/arch/m32r/lib/delay.c +++ /dev/null @@ -1,130 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * linux/arch/m32r/lib/delay.c - * - * Copyright (c) 2002 Hitoshi Yamamoto, Hirokazu Takata - * Copyright (c) 2004 Hirokazu Takata - */ - -#include -#include -#ifdef CONFIG_SMP -#include -#include -#include -#endif /* CONFIG_SMP */ -#include - -void __delay(unsigned long loops) -{ -#ifdef CONFIG_ISA_DUAL_ISSUE - __asm__ __volatile__ ( - "beqz %0, 2f \n\t" - "addi %0, #-1 \n\t" - - " .fillinsn \n\t" - "1: \n\t" - "cmpz %0 || addi %0, #-1 \n\t" - "bc 2f || cmpz %0 \n\t" - "bc 2f || addi %0, #-1 \n\t" - "cmpz %0 || addi %0, #-1 \n\t" - "bc 2f || cmpz %0 \n\t" - "bnc 1b || addi %0, #-1 \n\t" - " .fillinsn \n\t" - "2: \n\t" - : "+r" (loops) - : "r" (0) - : "cbit" - ); -#else - __asm__ __volatile__ ( - "beqz %0, 2f \n\t" - " .fillinsn \n\t" - "1: \n\t" - "addi %0, #-1 \n\t" - "blez %0, 2f \n\t" - "addi %0, #-1 \n\t" - "blez %0, 2f \n\t" - "addi %0, #-1 \n\t" - "blez %0, 2f \n\t" - "addi %0, #-1 \n\t" - "bgtz %0, 1b \n\t" - " .fillinsn \n\t" - "2: \n\t" - : "+r" (loops) - : "r" (0) - ); -#endif -} - -void __const_udelay(unsigned long xloops) -{ -#if defined(CONFIG_ISA_M32R2) && defined(CONFIG_ISA_DSP_LEVEL2) - /* - * loops [1] = (xloops >> 32) [sec] * loops_per_jiffy [1/jiffy] - * * HZ [jiffy/sec] - * = (xloops >> 32) [sec] * (loops_per_jiffy * HZ) [1/sec] - * = (((xloops * loops_per_jiffy) >> 32) * HZ) [1] - * - * NOTE: - * - '[]' depicts variable's dimension in the above equation. - * - "rac" instruction rounds the accumulator in word size. - */ - __asm__ __volatile__ ( - "srli %0, #1 \n\t" - "mulwhi %0, %1 ; a0 \n\t" - "mulwu1 %0, %1 ; a1 \n\t" - "sadd ; a0 += (a1 >> 16) \n\t" - "rac a0, a0, #1 \n\t" - "mvfacmi %0, a0 \n\t" - : "+r" (xloops) - : "r" (current_cpu_data.loops_per_jiffy) - : "a0", "a1" - ); -#elif defined(CONFIG_ISA_M32R2) || defined(CONFIG_ISA_M32R) - /* - * u64 ull; - * ull = (u64)xloops * (u64)current_cpu_data.loops_per_jiffy; - * xloops = (ull >> 32); - */ - __asm__ __volatile__ ( - "and3 r4, %0, #0xffff \n\t" - "and3 r5, %1, #0xffff \n\t" - "mul r4, r5 \n\t" - "srl3 r6, %0, #16 \n\t" - "srli r4, #16 \n\t" - "mul r5, r6 \n\t" - "add r4, r5 \n\t" - "and3 r5, %0, #0xffff \n\t" - "srl3 r6, %1, #16 \n\t" - "mul r5, r6 \n\t" - "add r4, r5 \n\t" - "srl3 r5, %0, #16 \n\t" - "srli r4, #16 \n\t" - "mul r5, r6 \n\t" - "add r4, r5 \n\t" - "mv %0, r4 \n\t" - : "+r" (xloops) - : "r" (current_cpu_data.loops_per_jiffy) - : "r4", "r5", "r6" - ); -#else -#error unknown isa configuration -#endif - __delay(xloops * HZ); -} - -void __udelay(unsigned long usecs) -{ - __const_udelay(usecs * 0x000010c7); /* 2**32 / 1000000 (rounded up) */ -} - -void __ndelay(unsigned long nsecs) -{ - __const_udelay(nsecs * 0x00005); /* 2**32 / 1000000000 (rounded up) */ -} - -EXPORT_SYMBOL(__delay); -EXPORT_SYMBOL(__const_udelay); -EXPORT_SYMBOL(__udelay); -EXPORT_SYMBOL(__ndelay); diff --git a/arch/m32r/lib/libgcc.h b/arch/m32r/lib/libgcc.h deleted file mode 100644 index 4854690d944a7..0000000000000 --- a/arch/m32r/lib/libgcc.h +++ /dev/null @@ -1,24 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef __ASM_LIBGCC_H -#define __ASM_LIBGCC_H - -#include - -#ifdef __BIG_ENDIAN -struct DWstruct { - int high, low; -}; -#elif defined(__LITTLE_ENDIAN) -struct DWstruct { - int low, high; -}; -#else -#error I feel sick. -#endif - -typedef union { - struct DWstruct s; - long long ll; -} DWunion; - -#endif /* __ASM_LIBGCC_H */ diff --git a/arch/m32r/lib/memcpy.S b/arch/m32r/lib/memcpy.S deleted file mode 100644 index 249da3e3358dd..0000000000000 --- a/arch/m32r/lib/memcpy.S +++ /dev/null @@ -1,93 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * linux/arch/m32r/lib/memcpy.S - * - * Copyright (C) 2001 Hiroyuki Kondo, and Hirokazu Takata - * Copyright (C) 2004 Hirokazu Takata - * - * void *memcopy(void *dst, const void *src, int n); - * - * dst: r0 - * src: r1 - * n : r2 - */ - - .text -#include -#include - -#ifdef CONFIG_ISA_DUAL_ISSUE - - .text -ENTRY(memcpy) -memcopy: - mv r4, r0 || mv r7, r0 - or r7, r1 || cmpz r2 - jc r14 || cmpeq r0, r1 ; return if r2=0 - jc r14 ; return if r0=r1 - - and3 r7, r7, #3 - bnez r7, byte_copy - srl3 r3, r2, #2 - and3 r2, r2, #3 - beqz r3, byte_copy - addi r4, #-4 -word_copy: - ld r7, @r1+ || addi r3, #-1 - st r7, @+r4 || cmpz r2 - bnez r3, word_copy - addi r4, #4 || jc r14 ; return if r2=0 -#if defined(CONFIG_ISA_M32R2) -byte_copy: - ldb r7, @r1 || addi r1, #1 - addi r2, #-1 || stb r7, @r4+ - bnez r2, byte_copy -#elif defined(CONFIG_ISA_M32R) -byte_copy: - ldb r7, @r1 || addi r1, #1 - addi r2, #-1 || stb r7, @r4 - addi r4, #1 - bnez r2, byte_copy -#else -#error unknown isa configuration -#endif -end_memcopy: - jmp r14 - -#else /* not CONFIG_ISA_DUAL_ISSUE */ - - .text -ENTRY(memcpy) -memcopy: - mv r4, r0 - mv r7, r0 - or r7, r1 - beq r0, r1, end_memcopy - beqz r2, end_memcopy - - and3 r7, r7, #3 - bnez r7, byte_copy - srl3 r3, r2, #2 - and3 r2, r2, #3 - beqz r3, byte_copy - addi r4, #-4 -word_copy: - ld r7, @r1+ - addi r3, #-1 - st r7, @+r4 - bnez r3, word_copy - beqz r2, end_memcopy - addi r4, #4 -byte_copy: - ldb r7, @r1 - addi r1, #1 - addi r2, #-1 - stb r7, @r4 - addi r4, #1 - bnez r2, byte_copy -end_memcopy: - jmp r14 - -#endif /* not CONFIG_ISA_DUAL_ISSUE */ - - .end diff --git a/arch/m32r/lib/memset.S b/arch/m32r/lib/memset.S deleted file mode 100644 index e7f45e6c73f53..0000000000000 --- a/arch/m32r/lib/memset.S +++ /dev/null @@ -1,179 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * linux/arch/m32r/lib/memset.S - * - * Copyright (C) 2001,2002 Hiroyuki Kondo, and Hirokazu Takata - * Copyright (C) 2004 Hirokazu Takata - * - * void *memset(void *dst, int val, int len); - * - * dst: r0 - * val: r1 - * len: r2 - * ret: r0 - * - */ - - .text - .global memset - -#ifdef CONFIG_ISA_DUAL_ISSUE - - .align 4 -memset: - mv r4, r0 || cmpz r2 - jc r14 - cmpui r2, #16 - bnc qword_align_check - cmpui r2, #4 - bc byte_set -word_align_check: /* len >= 4 */ - and3 r3, r4, #3 - beqz r3, word_set - addi r3, #-4 - neg r3, r3 /* r3 = -(r3 - 4) */ -align_word: - stb r1, @r4 || addi r4, #1 - addi r2, #-1 || addi r3, #-1 - bnez r3, align_word - cmpui r2, #4 - bc byte_set -word_set: - and3 r1, r1, #0x00ff /* r1: abababab <-- ??????ab */ - sll3 r3, r1, #8 - or r1, r3 || addi r4, #-4 - sll3 r3, r1, #16 - or r1, r3 || addi r2, #-4 -word_set_loop: - st r1, @+r4 || addi r2, #-4 - bgtz r2, word_set_loop - bnez r2, byte_set_wrap - st r1, @+r4 - jmp r14 - -qword_align_check: /* len >= 16 */ - and3 r3, r4, #15 - bnez r3, word_align_check -qword_set: - and3 r1, r1, #0x00ff /* r1: abababab <-- ??????ab */ - sll3 r3, r1, #8 - or r1, r3 || addi r4, #-4 - sll3 r3, r1, #16 - or r1, r3 || ldi r5, #16 -qword_set_loop: - ld r3, @(4,r4) /* cache line allocate */ - st r1, @+r4 || addi r2, #-16 - st r1, @+r4 || cmpu r2, r5 - st r1, @+r4 - st r1, @+r4 - bnc qword_set_loop || cmpz r2 - jc r14 -set_remainder: - cmpui r2, #4 - bc byte_set_wrap1 - addi r2, #-4 - bra word_set_loop - -byte_set_wrap: - addi r2, #4 - cmpz r2 - jc r14 -byte_set_wrap1: - addi r4, #4 -#if defined(CONFIG_ISA_M32R2) -byte_set: - addi r2, #-1 || stb r1, @r4+ - bnez r2, byte_set -#elif defined(CONFIG_ISA_M32R) -byte_set: - addi r2, #-1 || stb r1, @r4 - addi r4, #1 - bnez r2, byte_set -#else -#error unknown isa configuration -#endif -end_memset: - jmp r14 - -#else /* not CONFIG_ISA_DUAL_ISSUE */ - - .align 4 -memset: - mv r4, r0 - beqz r2, end_memset - cmpui r2, #16 - bnc qword_align_check - cmpui r2, #4 - bc byte_set -word_align_check: /* len >= 4 */ - and3 r3, r4, #3 - beqz r3, word_set - addi r3, #-4 - neg r3, r3 /* r3 = -(r3 - 4) */ -align_word: - stb r1, @r4 - addi r4, #1 - addi r2, #-1 - addi r3, #-1 - bnez r3, align_word - cmpui r2, #4 - bc byte_set -word_set: - and3 r1, r1, #0x00ff /* r1: abababab <-- ??????ab */ - sll3 r3, r1, #8 - or r1, r3 - sll3 r3, r1, #16 - or r1, r3 - addi r2, #-4 - addi r4, #-4 -word_set_loop: - st r1, @+r4 - addi r2, #-4 - bgtz r2, word_set_loop - bnez r2, byte_set_wrap - st r1, @+r4 - jmp r14 - -qword_align_check: /* len >= 16 */ - and3 r3, r4, #15 - bnez r3, word_align_check -qword_set: - and3 r1, r1, #0x00ff /* r1: abababab <-- ??????ab */ - sll3 r3, r1, #8 - or r1, r3 - sll3 r3, r1, #16 - or r1, r3 - addi r4, #-4 -qword_set_loop: - ld r3, @(4,r4) /* cache line allocate */ - addi r2, #-16 - st r1, @+r4 - st r1, @+r4 - cmpui r2, #16 - st r1, @+r4 - st r1, @+r4 - bnc qword_set_loop - bnez r2, set_remainder - jmp r14 -set_remainder: - cmpui r2, #4 - bc byte_set_wrap1 - addi r2, #-4 - bra word_set_loop - -byte_set_wrap: - addi r2, #4 - beqz r2, end_memset -byte_set_wrap1: - addi r4, #4 -byte_set: - addi r2, #-1 - stb r1, @r4 - addi r4, #1 - bnez r2, byte_set -end_memset: - jmp r14 - -#endif /* not CONFIG_ISA_DUAL_ISSUE */ - - .end diff --git a/arch/m32r/lib/strlen.S b/arch/m32r/lib/strlen.S deleted file mode 100644 index 41c77e3875938..0000000000000 --- a/arch/m32r/lib/strlen.S +++ /dev/null @@ -1,118 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * linux/arch/m32r/strlen.S -- strlen code. - * - * Copyright (C) 2001 Hirokazu Takata - * - * size_t strlen(const char *s); - * - */ - -#include -#include - -#ifdef CONFIG_ISA_DUAL_ISSUE - - .text -ENTRY(strlen) - mv r6, r0 || ldi r2, #0 - and3 r0, r0, #3 - bnez r0, strlen_byte -; -strlen_word: - ld r0, @r6+ -; - seth r5, #high(0x01010101) - or3 r5, r5, #low(0x01010101) - sll3 r7, r5, #7 -strlen_word_loop: - ld r1, @r6+ || not r4, r0 - sub r0, r5 || and r4, r7 - and r4, r0 - bnez r4, strlen_last_bytes - ld r0, @r6+ || not r4, r1 - sub r1, r5 || and r4, r7 - and r4, r1 || addi r2, #4 - bnez r4, strlen_last_bytes - addi r2, #4 || bra.s strlen_word_loop - - ; NOTE: If a null char. exists, return 0. - ; if ((x - 0x01010101) & ~x & 0x80808080) - ; return 0; -; -strlen_byte: - ldb r1, @r6 || addi r6, #1 - beqz r1, strlen_exit - addi r2, #1 || bra.s strlen_byte -; -strlen_last_bytes: - ldi r0, #4 || addi r6, #-8 -; -strlen_byte_loop: - ldb r1, @r6 || addi r6, #1 - addi r0, #-1 || cmpz r1 - bc.s strlen_exit || cmpz r0 - addi r2, #1 || bnc.s strlen_byte_loop -; -strlen_exit: - mv r0, r2 || jmp r14 - -#else /* not CONFIG_ISA_DUAL_ISSUE */ - - .text -ENTRY(strlen) - mv r6, r0 - ldi r2, #0 - and3 r0, r0, #3 - bnez r0, strlen_byte -; -strlen_word: - ld r0, @r6+ -; - seth r5, #high(0x01010101) - or3 r5, r5, #low(0x01010101) - sll3 r7, r5, #7 -strlen_word_loop: - ld r1, @r6+ - not r4, r0 ; NOTE: If a null char. exists, return 0. - sub r0, r5 ; if ((x - 0x01010101) & ~x & 0x80808080) - and r4, r7 ; return 0; - and r4, r0 - bnez r4, strlen_last_bytes - addi r2, #4 -; - ld r0, @r6+ - not r4, r1 ; NOTE: If a null char. exists, return 0. - sub r1, r5 ; if ((x - 0x01010101) & ~x & 0x80808080) - and r4, r7 ; return 0; - and r4, r1 - bnez r4, strlen_last_bytes - addi r2, #4 - bra strlen_word_loop -; -strlen_byte: - ldb r1, @r6 - addi r6, #1 - beqz r1, strlen_exit - addi r2, #1 - bra strlen_byte -; -strlen_last_bytes: - ldi r0, #4 - addi r6, #-8 -; -strlen_byte_loop: - ldb r1, @r6 - addi r6, #1 - addi r0, #-1 - beqz r1, strlen_exit - addi r2, #1 - bnez r0, strlen_byte_loop -; -strlen_exit: - mv r0, r2 - jmp r14 - -#endif /* not CONFIG_ISA_DUAL_ISSUE */ - - .end diff --git a/arch/m32r/lib/ucmpdi2.c b/arch/m32r/lib/ucmpdi2.c deleted file mode 100644 index e20fa3484fd8e..0000000000000 --- a/arch/m32r/lib/ucmpdi2.c +++ /dev/null @@ -1,18 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#include "libgcc.h" - -int __ucmpdi2(unsigned long long a, unsigned long long b) -{ - const DWunion au = {.ll = a}; - const DWunion bu = {.ll = b}; - - if ((unsigned int)au.s.high < (unsigned int)bu.s.high) - return 0; - else if ((unsigned int)au.s.high > (unsigned int)bu.s.high) - return 2; - if ((unsigned int)au.s.low < (unsigned int)bu.s.low) - return 0; - else if ((unsigned int)au.s.low > (unsigned int)bu.s.low) - return 2; - return 1; -} diff --git a/arch/m32r/lib/usercopy.c b/arch/m32r/lib/usercopy.c deleted file mode 100644 index 0892a4341b3a4..0000000000000 --- a/arch/m32r/lib/usercopy.c +++ /dev/null @@ -1,362 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * User address space access functions. - * The non inlined parts of asm-m32r/uaccess.h are here. - * - * Copyright 1997 Andi Kleen - * Copyright 1997 Linus Torvalds - * Copyright 2001, 2002, 2004 Hirokazu Takata - */ -#include -#include -#include -#include - -/* - * Copy a null terminated string from userspace. - */ - -#ifdef CONFIG_ISA_DUAL_ISSUE - -#define __do_strncpy_from_user(dst,src,count,res) \ -do { \ - int __d0, __d1, __d2; \ - __asm__ __volatile__( \ - " beqz %1, 2f\n" \ - " .fillinsn\n" \ - "0: ldb r14, @%3 || addi %3, #1\n" \ - " stb r14, @%4 || addi %4, #1\n" \ - " beqz r14, 1f\n" \ - " addi %1, #-1\n" \ - " bnez %1, 0b\n" \ - " .fillinsn\n" \ - "1: sub %0, %1\n" \ - " .fillinsn\n" \ - "2:\n" \ - ".section .fixup,\"ax\"\n" \ - " .balign 4\n" \ - "3: seth r14, #high(2b)\n" \ - " or3 r14, r14, #low(2b)\n" \ - " jmp r14 || ldi %0, #%5\n" \ - ".previous\n" \ - ".section __ex_table,\"a\"\n" \ - " .balign 4\n" \ - " .long 0b,3b\n" \ - ".previous" \ - : "=&r"(res), "=&r"(count), "=&r" (__d0), "=&r" (__d1), \ - "=&r" (__d2) \ - : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), \ - "4"(dst) \ - : "r14", "cbit", "memory"); \ -} while (0) - -#else /* not CONFIG_ISA_DUAL_ISSUE */ - -#define __do_strncpy_from_user(dst,src,count,res) \ -do { \ - int __d0, __d1, __d2; \ - __asm__ __volatile__( \ - " beqz %1, 2f\n" \ - " .fillinsn\n" \ - "0: ldb r14, @%3\n" \ - " stb r14, @%4\n" \ - " addi %3, #1\n" \ - " addi %4, #1\n" \ - " beqz r14, 1f\n" \ - " addi %1, #-1\n" \ - " bnez %1, 0b\n" \ - " .fillinsn\n" \ - "1: sub %0, %1\n" \ - " .fillinsn\n" \ - "2:\n" \ - ".section .fixup,\"ax\"\n" \ - " .balign 4\n" \ - "3: ldi %0, #%5\n" \ - " seth r14, #high(2b)\n" \ - " or3 r14, r14, #low(2b)\n" \ - " jmp r14\n" \ - ".previous\n" \ - ".section __ex_table,\"a\"\n" \ - " .balign 4\n" \ - " .long 0b,3b\n" \ - ".previous" \ - : "=&r"(res), "=&r"(count), "=&r" (__d0), "=&r" (__d1), \ - "=&r" (__d2) \ - : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), \ - "4"(dst) \ - : "r14", "cbit", "memory"); \ -} while (0) - -#endif /* CONFIG_ISA_DUAL_ISSUE */ - -long -strncpy_from_user(char *dst, const char __user *src, long count) -{ - long res = -EFAULT; - if (access_ok(VERIFY_READ, src, 1)) - __do_strncpy_from_user(dst, src, count, res); - return res; -} - - -/* - * Zero Userspace - */ - -#ifdef CONFIG_ISA_DUAL_ISSUE - -#define __do_clear_user(addr,size) \ -do { \ - int __dst, __c; \ - __asm__ __volatile__( \ - " beqz %1, 9f\n" \ - " and3 r14, %0, #3\n" \ - " bnez r14, 2f\n" \ - " and3 r14, %1, #3\n" \ - " bnez r14, 2f\n" \ - " and3 %1, %1, #3\n" \ - " beqz %2, 2f\n" \ - " addi %0, #-4\n" \ - " .fillinsn\n" \ - "0: ; word clear \n" \ - " st %6, @+%0 || addi %2, #-1\n" \ - " bnez %2, 0b\n" \ - " beqz %1, 9f\n" \ - " .fillinsn\n" \ - "2: ; byte clear \n" \ - " stb %6, @%0 || addi %1, #-1\n" \ - " addi %0, #1\n" \ - " bnez %1, 2b\n" \ - " .fillinsn\n" \ - "9:\n" \ - ".section .fixup,\"ax\"\n" \ - " .balign 4\n" \ - "4: slli %2, #2\n" \ - " seth r14, #high(9b)\n" \ - " or3 r14, r14, #low(9b)\n" \ - " jmp r14 || add %1, %2\n" \ - ".previous\n" \ - ".section __ex_table,\"a\"\n" \ - " .balign 4\n" \ - " .long 0b,4b\n" \ - " .long 2b,9b\n" \ - ".previous\n" \ - : "=&r"(__dst), "=&r"(size), "=&r"(__c) \ - : "0"(addr), "1"(size), "2"(size / 4), "r"(0) \ - : "r14", "cbit", "memory"); \ -} while (0) - -#else /* not CONFIG_ISA_DUAL_ISSUE */ - -#define __do_clear_user(addr,size) \ -do { \ - int __dst, __c; \ - __asm__ __volatile__( \ - " beqz %1, 9f\n" \ - " and3 r14, %0, #3\n" \ - " bnez r14, 2f\n" \ - " and3 r14, %1, #3\n" \ - " bnez r14, 2f\n" \ - " and3 %1, %1, #3\n" \ - " beqz %2, 2f\n" \ - " addi %0, #-4\n" \ - " .fillinsn\n" \ - "0: st %6, @+%0 ; word clear \n" \ - " addi %2, #-1\n" \ - " bnez %2, 0b\n" \ - " beqz %1, 9f\n" \ - " .fillinsn\n" \ - "2: stb %6, @%0 ; byte clear \n" \ - " addi %1, #-1\n" \ - " addi %0, #1\n" \ - " bnez %1, 2b\n" \ - " .fillinsn\n" \ - "9:\n" \ - ".section .fixup,\"ax\"\n" \ - " .balign 4\n" \ - "4: slli %2, #2\n" \ - " add %1, %2\n" \ - " seth r14, #high(9b)\n" \ - " or3 r14, r14, #low(9b)\n" \ - " jmp r14\n" \ - ".previous\n" \ - ".section __ex_table,\"a\"\n" \ - " .balign 4\n" \ - " .long 0b,4b\n" \ - " .long 2b,9b\n" \ - ".previous\n" \ - : "=&r"(__dst), "=&r"(size), "=&r"(__c) \ - : "0"(addr), "1"(size), "2"(size / 4), "r"(0) \ - : "r14", "cbit", "memory"); \ -} while (0) - -#endif /* not CONFIG_ISA_DUAL_ISSUE */ - -unsigned long -clear_user(void __user *to, unsigned long n) -{ - if (access_ok(VERIFY_WRITE, to, n)) - __do_clear_user(to, n); - return n; -} - -unsigned long -__clear_user(void __user *to, unsigned long n) -{ - __do_clear_user(to, n); - return n; -} - -/* - * Return the size of a string (including the ending 0) - * - * Return 0 on exception, a value greater than N if too long - */ - -#ifdef CONFIG_ISA_DUAL_ISSUE - -long strnlen_user(const char __user *s, long n) -{ - unsigned long mask = -__addr_ok(s); - unsigned long res; - - __asm__ __volatile__( - " and %0, %5 || mv r1, %1\n" - " beqz %0, strnlen_exit\n" - " and3 r0, %1, #3\n" - " bnez r0, strnlen_byte_loop\n" - " cmpui %0, #4\n" - " bc strnlen_byte_loop\n" - "strnlen_word_loop:\n" - "0: ld r0, @%1+\n" - " pcmpbz r0\n" - " bc strnlen_last_bytes_fixup\n" - " addi %0, #-4\n" - " beqz %0, strnlen_exit\n" - " bgtz %0, strnlen_word_loop\n" - "strnlen_last_bytes:\n" - " mv %0, %4\n" - "strnlen_last_bytes_fixup:\n" - " addi %1, #-4\n" - "strnlen_byte_loop:\n" - "1: ldb r0, @%1 || addi %0, #-1\n" - " beqz r0, strnlen_exit\n" - " addi %1, #1\n" - " bnez %0, strnlen_byte_loop\n" - "strnlen_exit:\n" - " sub %1, r1\n" - " add3 %0, %1, #1\n" - " .fillinsn\n" - "9:\n" - ".section .fixup,\"ax\"\n" - " .balign 4\n" - "4: addi %1, #-4\n" - " .fillinsn\n" - "5: seth r1, #high(9b)\n" - " or3 r1, r1, #low(9b)\n" - " jmp r1 || ldi %0, #0\n" - ".previous\n" - ".section __ex_table,\"a\"\n" - " .balign 4\n" - " .long 0b,4b\n" - " .long 1b,5b\n" - ".previous" - : "=&r" (res), "=r" (s) - : "0" (n), "1" (s), "r" (n & 3), "r" (mask), "r"(0x01010101) - : "r0", "r1", "cbit"); - - /* NOTE: strnlen_user() algorithm: - * { - * char *p; - * for (p = s; n-- && *p != '\0'; ++p) - * ; - * return p - s + 1; - * } - */ - - /* NOTE: If a null char. exists, return 0. - * if ((x - 0x01010101) & ~x & 0x80808080)\n" - * return 0;\n" - */ - - return res & mask; -} - -#else /* not CONFIG_ISA_DUAL_ISSUE */ - -long strnlen_user(const char __user *s, long n) -{ - unsigned long mask = -__addr_ok(s); - unsigned long res; - - __asm__ __volatile__( - " and %0, %5\n" - " mv r1, %1\n" - " beqz %0, strnlen_exit\n" - " and3 r0, %1, #3\n" - " bnez r0, strnlen_byte_loop\n" - " cmpui %0, #4\n" - " bc strnlen_byte_loop\n" - " sll3 r3, %6, #7\n" - "strnlen_word_loop:\n" - "0: ld r0, @%1+\n" - " not r2, r0\n" - " sub r0, %6\n" - " and r2, r3\n" - " and r2, r0\n" - " bnez r2, strnlen_last_bytes_fixup\n" - " addi %0, #-4\n" - " beqz %0, strnlen_exit\n" - " bgtz %0, strnlen_word_loop\n" - "strnlen_last_bytes:\n" - " mv %0, %4\n" - "strnlen_last_bytes_fixup:\n" - " addi %1, #-4\n" - "strnlen_byte_loop:\n" - "1: ldb r0, @%1\n" - " addi %0, #-1\n" - " beqz r0, strnlen_exit\n" - " addi %1, #1\n" - " bnez %0, strnlen_byte_loop\n" - "strnlen_exit:\n" - " sub %1, r1\n" - " add3 %0, %1, #1\n" - " .fillinsn\n" - "9:\n" - ".section .fixup,\"ax\"\n" - " .balign 4\n" - "4: addi %1, #-4\n" - " .fillinsn\n" - "5: ldi %0, #0\n" - " seth r1, #high(9b)\n" - " or3 r1, r1, #low(9b)\n" - " jmp r1\n" - ".previous\n" - ".section __ex_table,\"a\"\n" - " .balign 4\n" - " .long 0b,4b\n" - " .long 1b,5b\n" - ".previous" - : "=&r" (res), "=r" (s) - : "0" (n), "1" (s), "r" (n & 3), "r" (mask), "r"(0x01010101) - : "r0", "r1", "r2", "r3", "cbit"); - - /* NOTE: strnlen_user() algorithm: - * { - * char *p; - * for (p = s; n-- && *p != '\0'; ++p) - * ; - * return p - s + 1; - * } - */ - - /* NOTE: If a null char. exists, return 0. - * if ((x - 0x01010101) & ~x & 0x80808080)\n" - * return 0;\n" - */ - - return res & mask; -} - -#endif /* CONFIG_ISA_DUAL_ISSUE */ - diff --git a/arch/m32r/mm/Makefile b/arch/m32r/mm/Makefile deleted file mode 100644 index cb20d90c51d17..0000000000000 --- a/arch/m32r/mm/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# -# Makefile for the Linux M32R-specific parts of the memory manager. -# - -ifdef CONFIG_MMU -obj-y := init.o fault.o mmu.o extable.o ioremap.o cache.o page.o -else -obj-y := init.o fault-nommu.o mmu.o extable.o ioremap-nommu.o cache.o page.o -endif - -obj-$(CONFIG_DISCONTIGMEM) += discontig.o - diff --git a/arch/m32r/mm/cache.c b/arch/m32r/mm/cache.c deleted file mode 100644 index 0d1ae744e56f3..0000000000000 --- a/arch/m32r/mm/cache.c +++ /dev/null @@ -1,89 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * linux/arch/m32r/mm/cache.c - * - * Copyright (C) 2002-2005 Hirokazu Takata, Hayato Fujiwara - */ - -#include - -#undef MCCR - -#if defined(CONFIG_CHIP_XNUX2) || defined(CONFIG_CHIP_M32700) \ - || defined(CONFIG_CHIP_VDEC2) || defined(CONFIG_CHIP_OPSP) -/* Cache Control Register */ -#define MCCR ((volatile unsigned long*)0xfffffffc) -#define MCCR_CC (1UL << 7) /* Cache mode modify bit */ -#define MCCR_IIV (1UL << 6) /* I-cache invalidate */ -#define MCCR_DIV (1UL << 5) /* D-cache invalidate */ -#define MCCR_DCB (1UL << 4) /* D-cache copy back */ -#define MCCR_ICM (1UL << 1) /* I-cache mode [0:off,1:on] */ -#define MCCR_DCM (1UL << 0) /* D-cache mode [0:off,1:on] */ -#define MCCR_ICACHE_INV (MCCR_CC|MCCR_IIV) -#define MCCR_DCACHE_CB (MCCR_CC|MCCR_DCB) -#define MCCR_DCACHE_CBINV (MCCR_CC|MCCR_DIV|MCCR_DCB) -#define CHECK_MCCR(mccr) (mccr = *MCCR) -#elif defined(CONFIG_CHIP_M32102) -#define MCCR ((volatile unsigned char*)0xfffffffe) -#define MCCR_IIV (1UL << 0) /* I-cache invalidate */ -#define MCCR_ICACHE_INV MCCR_IIV -#elif defined(CONFIG_CHIP_M32104) -#define MCCR ((volatile unsigned short*)0xfffffffe) -#define MCCR_IIV (1UL << 8) /* I-cache invalidate */ -#define MCCR_DIV (1UL << 9) /* D-cache invalidate */ -#define MCCR_DCB (1UL << 10) /* D-cache copy back */ -#define MCCR_ICM (1UL << 0) /* I-cache mode [0:off,1:on] */ -#define MCCR_DCM (1UL << 1) /* D-cache mode [0:off,1:on] */ -#define MCCR_ICACHE_INV MCCR_IIV -#define MCCR_DCACHE_CB MCCR_DCB -#define MCCR_DCACHE_CBINV (MCCR_DIV|MCCR_DCB) -#endif - -#ifndef MCCR -#error Unknown cache type. -#endif - - -/* Copy back and invalidate D-cache and invalidate I-cache all */ -void _flush_cache_all(void) -{ -#if defined(CONFIG_CHIP_M32102) - unsigned char mccr; - *MCCR = MCCR_ICACHE_INV; -#elif defined(CONFIG_CHIP_M32104) - unsigned short mccr; - - /* Copyback and invalidate D-cache */ - /* Invalidate I-cache */ - *MCCR |= (MCCR_ICACHE_INV | MCCR_DCACHE_CBINV); -#else - unsigned long mccr; - - /* Copyback and invalidate D-cache */ - /* Invalidate I-cache */ - *MCCR = MCCR_ICACHE_INV | MCCR_DCACHE_CBINV; -#endif - while ((mccr = *MCCR) & MCCR_IIV); /* loop while invalidating... */ -} - -/* Copy back D-cache and invalidate I-cache all */ -void _flush_cache_copyback_all(void) -{ -#if defined(CONFIG_CHIP_M32102) - unsigned char mccr; - *MCCR = MCCR_ICACHE_INV; -#elif defined(CONFIG_CHIP_M32104) - unsigned short mccr; - - /* Copyback and invalidate D-cache */ - /* Invalidate I-cache */ - *MCCR |= (MCCR_ICACHE_INV | MCCR_DCACHE_CB); -#else - unsigned long mccr; - - /* Copyback D-cache */ - /* Invalidate I-cache */ - *MCCR = MCCR_ICACHE_INV | MCCR_DCACHE_CB; -#endif - while ((mccr = *MCCR) & MCCR_IIV); /* loop while invalidating... */ -} diff --git a/arch/m32r/mm/discontig.c b/arch/m32r/mm/discontig.c deleted file mode 100644 index eb8e7966dcaff..0000000000000 --- a/arch/m32r/mm/discontig.c +++ /dev/null @@ -1,163 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * linux/arch/m32r/mm/discontig.c - * - * Discontig memory support - * - * Copyright (c) 2003 Hitoshi Yamamoto - */ - -#include -#include -#include -#include -#include -#include -#include - -#include - -extern char _end[]; - -struct pglist_data *node_data[MAX_NUMNODES]; -EXPORT_SYMBOL(node_data); - -pg_data_t m32r_node_data[MAX_NUMNODES]; - -/* Memory profile */ -typedef struct { - unsigned long start_pfn; - unsigned long pages; - unsigned long holes; - unsigned long free_pfn; -} mem_prof_t; -static mem_prof_t mem_prof[MAX_NUMNODES]; - -extern unsigned long memory_start; -extern unsigned long memory_end; - -static void __init mem_prof_init(void) -{ - unsigned long start_pfn, holes, free_pfn; - const unsigned long zone_alignment = 1UL << (MAX_ORDER - 1); - unsigned long ul; - mem_prof_t *mp; - - /* Node#0 SDRAM */ - mp = &mem_prof[0]; - mp->start_pfn = PFN_UP(CONFIG_MEMORY_START); - mp->pages = PFN_DOWN(memory_end - memory_start); - mp->holes = 0; - mp->free_pfn = PFN_UP(__pa(_end)); - - /* Node#1 internal SRAM */ - mp = &mem_prof[1]; - start_pfn = free_pfn = PFN_UP(CONFIG_IRAM_START); - holes = 0; - if (start_pfn & (zone_alignment - 1)) { - ul = zone_alignment; - while (start_pfn >= ul) - ul += zone_alignment; - - start_pfn = ul - zone_alignment; - holes = free_pfn - start_pfn; - } - - mp->start_pfn = start_pfn; - mp->pages = PFN_DOWN(CONFIG_IRAM_SIZE) + holes; - mp->holes = holes; - mp->free_pfn = PFN_UP(CONFIG_IRAM_START); -} - -unsigned long __init setup_memory(void) -{ - unsigned long bootmap_size; - unsigned long min_pfn; - int nid; - mem_prof_t *mp; - - max_low_pfn = 0; - min_low_pfn = -1; - - mem_prof_init(); - - for_each_online_node(nid) { - mp = &mem_prof[nid]; - NODE_DATA(nid)=(pg_data_t *)&m32r_node_data[nid]; - NODE_DATA(nid)->bdata = &bootmem_node_data[nid]; - min_pfn = mp->start_pfn; - max_pfn = mp->start_pfn + mp->pages; - bootmap_size = init_bootmem_node(NODE_DATA(nid), mp->free_pfn, - mp->start_pfn, max_pfn); - - free_bootmem_node(NODE_DATA(nid), PFN_PHYS(mp->start_pfn), - PFN_PHYS(mp->pages)); - - reserve_bootmem_node(NODE_DATA(nid), PFN_PHYS(mp->start_pfn), - PFN_PHYS(mp->free_pfn - mp->start_pfn) + bootmap_size, - BOOTMEM_DEFAULT); - - if (max_low_pfn < max_pfn) - max_low_pfn = max_pfn; - - if (min_low_pfn > min_pfn) - min_low_pfn = min_pfn; - } - -#ifdef CONFIG_BLK_DEV_INITRD - if (LOADER_TYPE && INITRD_START) { - if (INITRD_START + INITRD_SIZE <= PFN_PHYS(max_low_pfn)) { - reserve_bootmem_node(NODE_DATA(0), INITRD_START, - INITRD_SIZE, BOOTMEM_DEFAULT); - initrd_start = INITRD_START + PAGE_OFFSET; - initrd_end = initrd_start + INITRD_SIZE; - printk("initrd:start[%08lx],size[%08lx]\n", - initrd_start, INITRD_SIZE); - } else { - printk("initrd extends beyond end of memory " - "(0x%08lx > 0x%08llx)\ndisabling initrd\n", - INITRD_START + INITRD_SIZE, - (unsigned long long)PFN_PHYS(max_low_pfn)); - - initrd_start = 0; - } - } -#endif /* CONFIG_BLK_DEV_INITRD */ - - return max_low_pfn; -} - -#define START_PFN(nid) (NODE_DATA(nid)->bdata->node_min_pfn) -#define MAX_LOW_PFN(nid) (NODE_DATA(nid)->bdata->node_low_pfn) - -void __init zone_sizes_init(void) -{ - unsigned long zones_size[MAX_NR_ZONES], zholes_size[MAX_NR_ZONES]; - unsigned long low, start_pfn; - int nid, i; - mem_prof_t *mp; - - for_each_online_node(nid) { - mp = &mem_prof[nid]; - for (i = 0 ; i < MAX_NR_ZONES ; i++) { - zones_size[i] = 0; - zholes_size[i] = 0; - } - start_pfn = START_PFN(nid); - low = MAX_LOW_PFN(nid); - zones_size[ZONE_DMA] = low - start_pfn; - zholes_size[ZONE_DMA] = mp->holes; - - node_set_state(nid, N_NORMAL_MEMORY); - free_area_init_node(nid, zones_size, start_pfn, zholes_size); - } - - /* - * For test - * Use all area of internal RAM. - * see __alloc_pages() - */ - NODE_DATA(1)->node_zones->watermark[WMARK_MIN] = 0; - NODE_DATA(1)->node_zones->watermark[WMARK_LOW] = 0; - NODE_DATA(1)->node_zones->watermark[WMARK_HIGH] = 0; -} diff --git a/arch/m32r/mm/extable.c b/arch/m32r/mm/extable.c deleted file mode 100644 index 066982756a4e5..0000000000000 --- a/arch/m32r/mm/extable.c +++ /dev/null @@ -1,20 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * linux/arch/m32r/mm/extable.c - */ - -#include -#include - -int fixup_exception(struct pt_regs *regs) -{ - const struct exception_table_entry *fixup; - - fixup = search_exception_tables(regs->bpc); - if (fixup) { - regs->bpc = fixup->fixup; - return 1; - } - - return 0; -} diff --git a/arch/m32r/mm/fault-nommu.c b/arch/m32r/mm/fault-nommu.c deleted file mode 100644 index 240e00067d5e0..0000000000000 --- a/arch/m32r/mm/fault-nommu.c +++ /dev/null @@ -1,134 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * linux/arch/m32r/mm/fault.c - * - * Copyright (c) 2001, 2002 Hitoshi Yamamoto, and H. Kondo - * - * Some code taken from i386 version. - * Copyright (C) 1995 Linus Torvalds - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include /* For unblank_screen() */ - -#include -#include -#include -#include -#include -#include - -extern void die(const char *, struct pt_regs *, long); - -#ifndef CONFIG_SMP -asmlinkage unsigned int tlb_entry_i_dat; -asmlinkage unsigned int tlb_entry_d_dat; -#define tlb_entry_i tlb_entry_i_dat -#define tlb_entry_d tlb_entry_d_dat -#else -unsigned int tlb_entry_i_dat[NR_CPUS]; -unsigned int tlb_entry_d_dat[NR_CPUS]; -#define tlb_entry_i tlb_entry_i_dat[smp_processor_id()] -#define tlb_entry_d tlb_entry_d_dat[smp_processor_id()] -#endif - -void do_BUG(const char *file, int line) -{ - bust_spinlocks(1); - printk("kernel BUG at %s:%d!\n", file, line); -} - -/*======================================================================* - * do_page_fault() - *======================================================================* - * This routine handles page faults. It determines the address, - * and the problem, and then passes it off to one of the appropriate - * routines. - * - * ARGUMENT: - * regs : M32R SP reg. - * error_code : See below - * address : M32R MMU MDEVA reg. (Operand ACE) - * : M32R BPC reg. (Instruction ACE) - * - * error_code : - * bit 0 == 0 means no page found, 1 means protection fault - * bit 1 == 0 means read, 1 means write - * bit 2 == 0 means kernel, 1 means user-mode - *======================================================================*/ -asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long error_code, - unsigned long address) -{ - -/* - * Oops. The kernel tried to access some bad page. We'll have to - * terminate things with extreme prejudice. - */ - - bust_spinlocks(1); - - if (address < PAGE_SIZE) - printk(KERN_ALERT "Unable to handle kernel NULL pointer dereference"); - else - printk(KERN_ALERT "Unable to handle kernel paging request"); - printk(" at virtual address %08lx\n",address); - printk(" printing bpc:\n"); - printk(KERN_ALERT "bpc = %08lx\n", regs->bpc); - - die("Oops", regs, error_code); - bust_spinlocks(0); - do_exit(SIGKILL); -} - -/*======================================================================* - * update_mmu_cache() - *======================================================================*/ -void update_mmu_cache(struct vm_area_struct *vma, unsigned long addr, - pte_t *ptep) -{ - BUG(); -} - -/*======================================================================* - * flush_tlb_page() : flushes one page - *======================================================================*/ -void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long page) -{ - BUG(); -} - -/*======================================================================* - * flush_tlb_range() : flushes a range of pages - *======================================================================*/ -void local_flush_tlb_range(struct vm_area_struct *vma, unsigned long start, - unsigned long end) -{ - BUG(); -} - -/*======================================================================* - * flush_tlb_mm() : flushes the specified mm context TLB's - *======================================================================*/ -void local_flush_tlb_mm(struct mm_struct *mm) -{ - BUG(); -} - -/*======================================================================* - * flush_tlb_all() : flushes all processes TLBs - *======================================================================*/ -void local_flush_tlb_all(void) -{ - BUG(); -} diff --git a/arch/m32r/mm/fault.c b/arch/m32r/mm/fault.c deleted file mode 100644 index 46d9a5ca0e3ac..0000000000000 --- a/arch/m32r/mm/fault.c +++ /dev/null @@ -1,550 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * linux/arch/m32r/mm/fault.c - * - * Copyright (c) 2001, 2002 Hitoshi Yamamoto, and H. Kondo - * Copyright (c) 2004 Naoto Sugai, NIIBE Yutaka - * - * Some code taken from i386 version. - * Copyright (C) 1995 Linus Torvalds - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include /* For unblank_screen() */ -#include -#include -#include - -#include -#include -#include -#include - -extern void die(const char *, struct pt_regs *, long); - -#ifndef CONFIG_SMP -asmlinkage unsigned int tlb_entry_i_dat; -asmlinkage unsigned int tlb_entry_d_dat; -#define tlb_entry_i tlb_entry_i_dat -#define tlb_entry_d tlb_entry_d_dat -#else -unsigned int tlb_entry_i_dat[NR_CPUS]; -unsigned int tlb_entry_d_dat[NR_CPUS]; -#define tlb_entry_i tlb_entry_i_dat[smp_processor_id()] -#define tlb_entry_d tlb_entry_d_dat[smp_processor_id()] -#endif - -extern void init_tlb(void); - -/*======================================================================* - * do_page_fault() - *======================================================================* - * This routine handles page faults. It determines the address, - * and the problem, and then passes it off to one of the appropriate - * routines. - * - * ARGUMENT: - * regs : M32R SP reg. - * error_code : See below - * address : M32R MMU MDEVA reg. (Operand ACE) - * : M32R BPC reg. (Instruction ACE) - * - * error_code : - * bit 0 == 0 means no page found, 1 means protection fault - * bit 1 == 0 means read, 1 means write - * bit 2 == 0 means kernel, 1 means user-mode - * bit 3 == 0 means data, 1 means instruction - *======================================================================*/ -#define ACE_PROTECTION 1 -#define ACE_WRITE 2 -#define ACE_USERMODE 4 -#define ACE_INSTRUCTION 8 - -asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long error_code, - unsigned long address) -{ - struct task_struct *tsk; - struct mm_struct *mm; - struct vm_area_struct * vma; - unsigned long page, addr; - unsigned long flags = 0; - int fault; - siginfo_t info; - - /* - * If BPSW IE bit enable --> set PSW IE bit - */ - if (regs->psw & M32R_PSW_BIE) - local_irq_enable(); - - tsk = current; - - info.si_code = SEGV_MAPERR; - - /* - * We fault-in kernel-space virtual memory on-demand. The - * 'reference' page table is init_mm.pgd. - * - * NOTE! We MUST NOT take any locks for this case. We may - * be in an interrupt or a critical region, and should - * only copy the information from the master page table, - * nothing more. - * - * This verifies that the fault happens in kernel space - * (error_code & ACE_USERMODE) == 0, and that the fault was not a - * protection error (error_code & ACE_PROTECTION) == 0. - */ - if (address >= TASK_SIZE && !(error_code & ACE_USERMODE)) - goto vmalloc_fault; - - mm = tsk->mm; - - /* - * If we're in an interrupt or have no user context or have pagefaults - * disabled then we must not take the fault. - */ - if (faulthandler_disabled() || !mm) - goto bad_area_nosemaphore; - - if (error_code & ACE_USERMODE) - flags |= FAULT_FLAG_USER; - - /* When running in the kernel we expect faults to occur only to - * addresses in user space. All other faults represent errors in the - * kernel and should generate an OOPS. Unfortunately, in the case of an - * erroneous fault occurring in a code path which already holds mmap_sem - * we will deadlock attempting to validate the fault against the - * address space. Luckily the kernel only validly references user - * space from well defined areas of code, which are listed in the - * exceptions table. - * - * As the vast majority of faults will be valid we will only perform - * the source reference check when there is a possibility of a deadlock. - * Attempt to lock the address space, if we cannot we then validate the - * source. If this is invalid we can skip the address space check, - * thus avoiding the deadlock. - */ - if (!down_read_trylock(&mm->mmap_sem)) { - if ((error_code & ACE_USERMODE) == 0 && - !search_exception_tables(regs->psw)) - goto bad_area_nosemaphore; - down_read(&mm->mmap_sem); - } - - vma = find_vma(mm, address); - if (!vma) - goto bad_area; - if (vma->vm_start <= address) - goto good_area; - if (!(vma->vm_flags & VM_GROWSDOWN)) - goto bad_area; - - if (error_code & ACE_USERMODE) { - /* - * accessing the stack below "spu" is always a bug. - * The "+ 4" is there due to the push instruction - * doing pre-decrement on the stack and that - * doesn't show up until later.. - */ - if (address + 4 < regs->spu) - goto bad_area; - } - - if (expand_stack(vma, address)) - goto bad_area; -/* - * Ok, we have a good vm_area for this memory access, so - * we can handle it.. - */ -good_area: - info.si_code = SEGV_ACCERR; - switch (error_code & (ACE_WRITE|ACE_PROTECTION)) { - default: /* 3: write, present */ - /* fall through */ - case ACE_WRITE: /* write, not present */ - if (!(vma->vm_flags & VM_WRITE)) - goto bad_area; - flags |= FAULT_FLAG_WRITE; - break; - case ACE_PROTECTION: /* read, present */ - case 0: /* read, not present */ - if (!(vma->vm_flags & (VM_READ | VM_EXEC))) - goto bad_area; - } - - /* - * For instruction access exception, check if the area is executable - */ - if ((error_code & ACE_INSTRUCTION) && !(vma->vm_flags & VM_EXEC)) - goto bad_area; - - /* - * If for any reason at all we couldn't handle the fault, - * make sure we exit gracefully rather than endlessly redo - * the fault. - */ - addr = (address & PAGE_MASK); - set_thread_fault_code(error_code); - fault = handle_mm_fault(vma, addr, flags); - if (unlikely(fault & VM_FAULT_ERROR)) { - if (fault & VM_FAULT_OOM) - goto out_of_memory; - else if (fault & VM_FAULT_SIGSEGV) - goto bad_area; - else if (fault & VM_FAULT_SIGBUS) - goto do_sigbus; - BUG(); - } - if (fault & VM_FAULT_MAJOR) - tsk->maj_flt++; - else - tsk->min_flt++; - set_thread_fault_code(0); - up_read(&mm->mmap_sem); - return; - -/* - * Something tried to access memory that isn't in our memory map.. - * Fix it, but check if it's kernel or user first.. - */ -bad_area: - up_read(&mm->mmap_sem); - -bad_area_nosemaphore: - /* User mode accesses just cause a SIGSEGV */ - if (error_code & ACE_USERMODE) { - tsk->thread.address = address; - tsk->thread.error_code = error_code | (address >= TASK_SIZE); - tsk->thread.trap_no = 14; - info.si_signo = SIGSEGV; - info.si_errno = 0; - /* info.si_code has been set above */ - info.si_addr = (void __user *)address; - force_sig_info(SIGSEGV, &info, tsk); - return; - } - -no_context: - /* Are we prepared to handle this kernel fault? */ - if (fixup_exception(regs)) - return; - -/* - * Oops. The kernel tried to access some bad page. We'll have to - * terminate things with extreme prejudice. - */ - - bust_spinlocks(1); - - if (address < PAGE_SIZE) - printk(KERN_ALERT "Unable to handle kernel NULL pointer dereference"); - else - printk(KERN_ALERT "Unable to handle kernel paging request"); - printk(" at virtual address %08lx\n",address); - printk(KERN_ALERT " printing bpc:\n"); - printk("%08lx\n", regs->bpc); - page = *(unsigned long *)MPTB; - page = ((unsigned long *) page)[address >> PGDIR_SHIFT]; - printk(KERN_ALERT "*pde = %08lx\n", page); - if (page & _PAGE_PRESENT) { - page &= PAGE_MASK; - address &= 0x003ff000; - page = ((unsigned long *) __va(page))[address >> PAGE_SHIFT]; - printk(KERN_ALERT "*pte = %08lx\n", page); - } - die("Oops", regs, error_code); - bust_spinlocks(0); - do_exit(SIGKILL); - -/* - * We ran out of memory, or some other thing happened to us that made - * us unable to handle the page fault gracefully. - */ -out_of_memory: - up_read(&mm->mmap_sem); - if (!(error_code & ACE_USERMODE)) - goto no_context; - pagefault_out_of_memory(); - return; - -do_sigbus: - up_read(&mm->mmap_sem); - - /* Kernel mode? Handle exception or die */ - if (!(error_code & ACE_USERMODE)) - goto no_context; - - tsk->thread.address = address; - tsk->thread.error_code = error_code; - tsk->thread.trap_no = 14; - info.si_signo = SIGBUS; - info.si_errno = 0; - info.si_code = BUS_ADRERR; - info.si_addr = (void __user *)address; - force_sig_info(SIGBUS, &info, tsk); - return; - -vmalloc_fault: - { - /* - * Synchronize this task's top level page-table - * with the 'reference' page table. - * - * Do _not_ use "tsk" here. We might be inside - * an interrupt in the middle of a task switch.. - */ - int offset = pgd_index(address); - pgd_t *pgd, *pgd_k; - pmd_t *pmd, *pmd_k; - pte_t *pte_k; - - pgd = (pgd_t *)*(unsigned long *)MPTB; - pgd = offset + (pgd_t *)pgd; - pgd_k = init_mm.pgd + offset; - - if (!pgd_present(*pgd_k)) - goto no_context; - - /* - * set_pgd(pgd, *pgd_k); here would be useless on PAE - * and redundant with the set_pmd() on non-PAE. - */ - - pmd = pmd_offset(pgd, address); - pmd_k = pmd_offset(pgd_k, address); - if (!pmd_present(*pmd_k)) - goto no_context; - set_pmd(pmd, *pmd_k); - - pte_k = pte_offset_kernel(pmd_k, address); - if (!pte_present(*pte_k)) - goto no_context; - - addr = (address & PAGE_MASK); - set_thread_fault_code(error_code); - update_mmu_cache(NULL, addr, pte_k); - set_thread_fault_code(0); - return; - } -} - -/*======================================================================* - * update_mmu_cache() - *======================================================================*/ -#define TLB_MASK (NR_TLB_ENTRIES - 1) -#define ITLB_END (unsigned long *)(ITLB_BASE + (NR_TLB_ENTRIES * 8)) -#define DTLB_END (unsigned long *)(DTLB_BASE + (NR_TLB_ENTRIES * 8)) -void update_mmu_cache(struct vm_area_struct *vma, unsigned long vaddr, - pte_t *ptep) -{ - volatile unsigned long *entry1, *entry2; - unsigned long pte_data, flags; - unsigned int *entry_dat; - int inst = get_thread_fault_code() & ACE_INSTRUCTION; - int i; - - /* Ptrace may call this routine. */ - if (vma && current->active_mm != vma->vm_mm) - return; - - local_irq_save(flags); - - vaddr = (vaddr & PAGE_MASK) | get_asid(); - - pte_data = pte_val(*ptep); - -#ifdef CONFIG_CHIP_OPSP - entry1 = (unsigned long *)ITLB_BASE; - for (i = 0; i < NR_TLB_ENTRIES; i++) { - if (*entry1++ == vaddr) { - set_tlb_data(entry1, pte_data); - break; - } - entry1++; - } - entry2 = (unsigned long *)DTLB_BASE; - for (i = 0; i < NR_TLB_ENTRIES; i++) { - if (*entry2++ == vaddr) { - set_tlb_data(entry2, pte_data); - break; - } - entry2++; - } -#else - /* - * Update TLB entries - * entry1: ITLB entry address - * entry2: DTLB entry address - */ - __asm__ __volatile__ ( - "seth %0, #high(%4) \n\t" - "st %2, @(%5, %0) \n\t" - "ldi %1, #1 \n\t" - "st %1, @(%6, %0) \n\t" - "add3 r4, %0, %7 \n\t" - ".fillinsn \n" - "1: \n\t" - "ld %1, @(%6, %0) \n\t" - "bnez %1, 1b \n\t" - "ld %0, @r4+ \n\t" - "ld %1, @r4 \n\t" - "st %3, @+%0 \n\t" - "st %3, @+%1 \n\t" - : "=&r" (entry1), "=&r" (entry2) - : "r" (vaddr), "r" (pte_data), "i" (MMU_REG_BASE), - "i" (MSVA_offset), "i" (MTOP_offset), "i" (MIDXI_offset) - : "r4", "memory" - ); -#endif - - if ((!inst && entry2 >= DTLB_END) || (inst && entry1 >= ITLB_END)) - goto notfound; - -found: - local_irq_restore(flags); - - return; - - /* Valid entry not found */ -notfound: - /* - * Update ITLB or DTLB entry - * entry1: TLB entry address - * entry2: TLB base address - */ - if (!inst) { - entry2 = (unsigned long *)DTLB_BASE; - entry_dat = &tlb_entry_d; - } else { - entry2 = (unsigned long *)ITLB_BASE; - entry_dat = &tlb_entry_i; - } - entry1 = entry2 + (((*entry_dat - 1) & TLB_MASK) << 1); - - for (i = 0 ; i < NR_TLB_ENTRIES ; i++) { - if (!(entry1[1] & 2)) /* Valid bit check */ - break; - - if (entry1 != entry2) - entry1 -= 2; - else - entry1 += TLB_MASK << 1; - } - - if (i >= NR_TLB_ENTRIES) { /* Empty entry not found */ - entry1 = entry2 + (*entry_dat << 1); - *entry_dat = (*entry_dat + 1) & TLB_MASK; - } - *entry1++ = vaddr; /* Set TLB tag */ - set_tlb_data(entry1, pte_data); - - goto found; -} - -/*======================================================================* - * flush_tlb_page() : flushes one page - *======================================================================*/ -void local_flush_tlb_page(struct vm_area_struct *vma, unsigned long page) -{ - if (vma->vm_mm && mm_context(vma->vm_mm) != NO_CONTEXT) { - unsigned long flags; - - local_irq_save(flags); - page &= PAGE_MASK; - page |= (mm_context(vma->vm_mm) & MMU_CONTEXT_ASID_MASK); - __flush_tlb_page(page); - local_irq_restore(flags); - } -} - -/*======================================================================* - * flush_tlb_range() : flushes a range of pages - *======================================================================*/ -void local_flush_tlb_range(struct vm_area_struct *vma, unsigned long start, - unsigned long end) -{ - struct mm_struct *mm; - - mm = vma->vm_mm; - if (mm_context(mm) != NO_CONTEXT) { - unsigned long flags; - int size; - - local_irq_save(flags); - size = (end - start + (PAGE_SIZE - 1)) >> PAGE_SHIFT; - if (size > (NR_TLB_ENTRIES / 4)) { /* Too many TLB to flush */ - mm_context(mm) = NO_CONTEXT; - if (mm == current->mm) - activate_context(mm); - } else { - unsigned long asid; - - asid = mm_context(mm) & MMU_CONTEXT_ASID_MASK; - start &= PAGE_MASK; - end += (PAGE_SIZE - 1); - end &= PAGE_MASK; - - start |= asid; - end |= asid; - while (start < end) { - __flush_tlb_page(start); - start += PAGE_SIZE; - } - } - local_irq_restore(flags); - } -} - -/*======================================================================* - * flush_tlb_mm() : flushes the specified mm context TLB's - *======================================================================*/ -void local_flush_tlb_mm(struct mm_struct *mm) -{ - /* Invalidate all TLB of this process. */ - /* Instead of invalidating each TLB, we get new MMU context. */ - if (mm_context(mm) != NO_CONTEXT) { - unsigned long flags; - - local_irq_save(flags); - mm_context(mm) = NO_CONTEXT; - if (mm == current->mm) - activate_context(mm); - local_irq_restore(flags); - } -} - -/*======================================================================* - * flush_tlb_all() : flushes all processes TLBs - *======================================================================*/ -void local_flush_tlb_all(void) -{ - unsigned long flags; - - local_irq_save(flags); - __flush_tlb_all(); - local_irq_restore(flags); -} - -/*======================================================================* - * init_mmu() - *======================================================================*/ -void __init init_mmu(void) -{ - tlb_entry_i = 0; - tlb_entry_d = 0; - mmu_context_cache = MMU_CONTEXT_FIRST_VERSION; - set_asid(mmu_context_cache & MMU_CONTEXT_ASID_MASK); - *(volatile unsigned long *)MPTB = (unsigned long)swapper_pg_dir; -} diff --git a/arch/m32r/mm/init.c b/arch/m32r/mm/init.c deleted file mode 100644 index 93abc8c3a46e3..0000000000000 --- a/arch/m32r/mm/init.c +++ /dev/null @@ -1,152 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * linux/arch/m32r/mm/init.c - * - * Copyright (c) 2001, 2002 Hitoshi Yamamoto - * - * Some code taken from sh version. - * Copyright (C) 1999 Niibe Yutaka - * Based on linux/arch/i386/mm/init.c: - * Copyright (C) 1995 Linus Torvalds - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -pgd_t swapper_pg_dir[1024]; - -/* - * Cache of MMU context last used. - */ -#ifndef CONFIG_SMP -unsigned long mmu_context_cache_dat; -#else -unsigned long mmu_context_cache_dat[NR_CPUS]; -#endif - -/* - * function prototype - */ -void __init paging_init(void); -void __init mem_init(void); -void free_initmem(void); -#ifdef CONFIG_BLK_DEV_INITRD -void free_initrd_mem(unsigned long, unsigned long); -#endif - -/* It'd be good if these lines were in the standard header file. */ -#define START_PFN(nid) (NODE_DATA(nid)->bdata->node_min_pfn) -#define MAX_LOW_PFN(nid) (NODE_DATA(nid)->bdata->node_low_pfn) - -#ifndef CONFIG_DISCONTIGMEM -void __init zone_sizes_init(void) -{ - unsigned long zones_size[MAX_NR_ZONES] = {0, }; - unsigned long start_pfn; - -#ifdef CONFIG_MMU - { - unsigned long low; - unsigned long max_dma; - - start_pfn = START_PFN(0); - max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT; - low = MAX_LOW_PFN(0); - - if (low < max_dma) { - zones_size[ZONE_DMA] = low - start_pfn; - zones_size[ZONE_NORMAL] = 0; - } else { - zones_size[ZONE_DMA] = low - start_pfn; - zones_size[ZONE_NORMAL] = low - max_dma; - } - } -#else - zones_size[ZONE_DMA] = 0 >> PAGE_SHIFT; - zones_size[ZONE_NORMAL] = __MEMORY_SIZE >> PAGE_SHIFT; - start_pfn = __MEMORY_START >> PAGE_SHIFT; -#endif /* CONFIG_MMU */ - - free_area_init_node(0, zones_size, start_pfn, 0); -} -#else /* CONFIG_DISCONTIGMEM */ -extern void zone_sizes_init(void); -#endif /* CONFIG_DISCONTIGMEM */ - -/*======================================================================* - * paging_init() : sets up the page tables - *======================================================================*/ -void __init paging_init(void) -{ -#ifdef CONFIG_MMU - int i; - pgd_t *pg_dir; - - /* We don't need kernel mapping as hardware support that. */ - pg_dir = swapper_pg_dir; - - for (i = 0 ; i < USER_PTRS_PER_PGD * 2 ; i++) - pgd_val(pg_dir[i]) = 0; -#endif /* CONFIG_MMU */ - zone_sizes_init(); -} - -/*======================================================================* - * mem_init() : - * orig : arch/sh/mm/init.c - *======================================================================*/ -void __init mem_init(void) -{ -#ifndef CONFIG_MMU - extern unsigned long memory_end; - - high_memory = (void *)(memory_end & PAGE_MASK); -#else - high_memory = (void *)__va(PFN_PHYS(MAX_LOW_PFN(0))); -#endif /* CONFIG_MMU */ - - /* clear the zero-page */ - memset(empty_zero_page, 0, PAGE_SIZE); - - set_max_mapnr(get_num_physpages()); - free_all_bootmem(); - mem_init_print_info(NULL); -} - -/*======================================================================* - * free_initmem() : - * orig : arch/sh/mm/init.c - *======================================================================*/ -void free_initmem(void) -{ - free_initmem_default(-1); -} - -#ifdef CONFIG_BLK_DEV_INITRD -/*======================================================================* - * free_initrd_mem() : - * orig : arch/sh/mm/init.c - *======================================================================*/ -void free_initrd_mem(unsigned long start, unsigned long end) -{ - free_reserved_area((void *)start, (void *)end, -1, "initrd"); -} -#endif diff --git a/arch/m32r/mm/ioremap-nommu.c b/arch/m32r/mm/ioremap-nommu.c deleted file mode 100644 index 2759f2d483844..0000000000000 --- a/arch/m32r/mm/ioremap-nommu.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * linux/arch/m32r/mm/ioremap-nommu.c - * - * Copyright (c) 2001, 2002 Hiroyuki Kondo - * - * Taken from mips version. - * (C) Copyright 1995 1996 Linus Torvalds - * (C) Copyright 2001 Ralf Baechle - */ - -/* - * This file is subject to 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 -#include -#include - -#include -#include -#include -#include -#include - - -/* - * Remap an arbitrary physical address space into the kernel virtual - * address space. Needed when the kernel wants to access high addresses - * directly. - * - * NOTE! We need to allow non-page-aligned mappings too: we will obviously - * have to convert them into an offset in a page-aligned mapping, but the - * caller shouldn't need to know that small detail. - */ - -#define IS_LOW512(addr) (!((unsigned long)(addr) & ~0x1fffffffUL)) - -void __iomem * -__ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags) -{ - return (void *)phys_addr; -} - -#define IS_KSEG1(addr) (((unsigned long)(addr) & ~0x1fffffffUL) == KSEG1) - -void iounmap(volatile void __iomem *addr) -{ -} - diff --git a/arch/m32r/mm/ioremap.c b/arch/m32r/mm/ioremap.c deleted file mode 100644 index 5152c4e6ac80d..0000000000000 --- a/arch/m32r/mm/ioremap.c +++ /dev/null @@ -1,111 +0,0 @@ -/* - * linux/arch/m32r/mm/ioremap.c - * - * Copyright (c) 2001, 2002 Hiroyuki Kondo - * - * Taken from mips version. - * (C) Copyright 1995 1996 Linus Torvalds - * (C) Copyright 2001 Ralf Baechle - */ - -/* - * This file is subject to 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 -#include -#include - -#include -#include -#include - -/* - * Generic mapping function (not visible outside): - */ - -/* - * Remap an arbitrary physical address space into the kernel virtual - * address space. Needed when the kernel wants to access high addresses - * directly. - * - * NOTE! We need to allow non-page-aligned mappings too: we will obviously - * have to convert them into an offset in a page-aligned mapping, but the - * caller shouldn't need to know that small detail. - */ - -#define IS_LOW512(addr) (!((unsigned long)(addr) & ~0x1fffffffUL)) - -void __iomem * -__ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags) -{ - void __iomem * addr; - struct vm_struct * area; - unsigned long offset, last_addr; - pgprot_t pgprot; - - /* Don't allow wraparound or zero size */ - last_addr = phys_addr + size - 1; - if (!size || last_addr < phys_addr) - return NULL; - - /* - * Map objects in the low 512mb of address space using KSEG1, otherwise - * map using page tables. - */ - if (IS_LOW512(phys_addr) && IS_LOW512(phys_addr + size - 1)) - return (void *) KSEG1ADDR(phys_addr); - - /* - * Don't allow anybody to remap normal RAM that we're using.. - */ - if (phys_addr < virt_to_phys(high_memory)) { - char *t_addr, *t_end; - struct page *page; - - t_addr = __va(phys_addr); - t_end = t_addr + (size - 1); - - for(page = virt_to_page(t_addr); page <= virt_to_page(t_end); page++) - if(!PageReserved(page)) - return NULL; - } - - pgprot = __pgprot(_PAGE_GLOBAL | _PAGE_PRESENT | _PAGE_READ - | _PAGE_WRITE | flags); - - /* - * Mappings have to be page-aligned - */ - offset = phys_addr & ~PAGE_MASK; - phys_addr &= PAGE_MASK; - size = PAGE_ALIGN(last_addr + 1) - phys_addr; - - /* - * Ok, go for it.. - */ - area = get_vm_area(size, VM_IOREMAP); - if (!area) - return NULL; - area->phys_addr = phys_addr; - addr = (void __iomem *) area->addr; - if (ioremap_page_range((unsigned long)addr, (unsigned long)addr + size, - phys_addr, pgprot)) { - vunmap((void __force *) addr); - return NULL; - } - - return (void __iomem *) (offset + (char __iomem *)addr); -} - -#define IS_KSEG1(addr) (((unsigned long)(addr) & ~0x1fffffffUL) == KSEG1) - -void iounmap(volatile void __iomem *addr) -{ - if (!IS_KSEG1(addr)) - vfree((void *) (PAGE_MASK & (unsigned long) addr)); -} - diff --git a/arch/m32r/mm/mmu.S b/arch/m32r/mm/mmu.S deleted file mode 100644 index fd8f9c9b7b079..0000000000000 --- a/arch/m32r/mm/mmu.S +++ /dev/null @@ -1,355 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * linux/arch/m32r/mm/mmu.S - * - * Copyright (C) 2001 by Hiroyuki Kondo - */ - -#include -#include -#include - - .text -#ifdef CONFIG_MMU - -#include -#include -#include -#include - -/* - * TLB Miss Exception handler - */ - .balign 16 -ENTRY(tme_handler) - .global tlb_entry_i_dat - .global tlb_entry_d_dat - - SWITCH_TO_KERNEL_STACK - -#if defined(CONFIG_ISA_M32R2) - st r0, @-sp - st r1, @-sp - st r2, @-sp - st r3, @-sp - - seth r3, #high(MMU_REG_BASE) - ld r1, @(MESTS_offset, r3) ; r1: status (MESTS reg.) - ld r0, @(MDEVP_offset, r3) ; r0: PFN + ASID (MDEVP reg.) - st r1, @(MESTS_offset, r3) ; clear status (MESTS reg.) - and3 r1, r1, #(MESTS_IT) - bnez r1, 1f ; instruction TLB miss? - -;; data TLB miss -;; input -;; r0: PFN + ASID (MDEVP reg.) -;; r1 - r3: free -;; output -;; r0: PFN + ASID -;; r1: TLB entry base address -;; r2: &tlb_entry_{i|d}_dat -;; r3: free - -#ifndef CONFIG_SMP - seth r2, #high(tlb_entry_d_dat) - or3 r2, r2, #low(tlb_entry_d_dat) -#else /* CONFIG_SMP */ - ldi r1, #-8192 - seth r2, #high(tlb_entry_d_dat) - or3 r2, r2, #low(tlb_entry_d_dat) - and r1, sp - ld r1, @(16, r1) ; current_thread_info->cpu - slli r1, #2 - add r2, r1 -#endif /* !CONFIG_SMP */ - seth r1, #high(DTLB_BASE) - or3 r1, r1, #low(DTLB_BASE) - bra 2f - - .balign 16 - .fillinsn -1: -;; instrucntion TLB miss -;; input -;; r0: MDEVP reg. (included ASID) -;; r1 - r3: free -;; output -;; r0: PFN + ASID -;; r1: TLB entry base address -;; r2: &tlb_entry_{i|d}_dat -;; r3: free - ldi r3, #-4096 - and3 r0, r0, #(MMU_CONTEXT_ASID_MASK) - mvfc r1, bpc - and r1, r3 - or r0, r1 ; r0: PFN + ASID -#ifndef CONFIG_SMP - seth r2, #high(tlb_entry_i_dat) - or3 r2, r2, #low(tlb_entry_i_dat) -#else /* CONFIG_SMP */ - ldi r1, #-8192 - seth r2, #high(tlb_entry_i_dat) - or3 r2, r2, #low(tlb_entry_i_dat) - and r1, sp - ld r1, @(16, r1) ; current_thread_info->cpu - slli r1, #2 - add r2, r1 -#endif /* !CONFIG_SMP */ - seth r1, #high(ITLB_BASE) - or3 r1, r1, #low(ITLB_BASE) - - .fillinsn -2: -;; select TLB entry -;; input -;; r0: PFN + ASID -;; r1: TLB entry base address -;; r2: &tlb_entry_{i|d}_dat -;; r3: free -;; output -;; r0: PFN + ASID -;; r1: TLB entry address -;; r2, r3: free -#ifdef CONFIG_ISA_DUAL_ISSUE - ld r3, @r2 || srli r1, #3 -#else - ld r3, @r2 - srli r1, #3 -#endif - add r1, r3 - ; tlb_entry_{d|i}_dat++; - addi r3, #1 - and3 r3, r3, #(NR_TLB_ENTRIES - 1) -#ifdef CONFIG_ISA_DUAL_ISSUE - st r3, @r2 || slli r1, #3 -#else - st r3, @r2 - slli r1, #3 -#endif - -;; load pte -;; input -;; r0: PFN + ASID -;; r1: TLB entry address -;; r2, r3: free -;; output -;; r0: PFN + ASID -;; r1: TLB entry address -;; r2: pte_data -;; r3: free - ; pgd = *(unsigned long *)MPTB; - ld24 r2, #(-MPTB - 1) - srl3 r3, r0, #22 -#ifdef CONFIG_ISA_DUAL_ISSUE - not r2, r2 || slli r3, #2 ; r3: pgd offset -#else - not r2, r2 - slli r3, #2 -#endif - ld r2, @r2 ; r2: pgd base addr (MPTB reg.) - or r3, r2 ; r3: pmd addr - - ; pmd = pmd_offset(pgd, address); - ld r3, @r3 ; r3: pmd data - beqz r3, 3f ; pmd_none(*pmd) ? - - and3 r2, r3, #0xfff - add3 r2, r2, #-355 ; _KERNPG_TABLE(=0x163) - bnez r2, 3f ; pmd_bad(*pmd) ? - ldi r2, #-4096 - - ; pte = pte_offset(pmd, address); - and r2, r3 ; r2: pte base addr - srl3 r3, r0, #10 - and3 r3, r3, #0xffc ; r3: pte offset - or r3, r2 - seth r2, #0x8000 - or r3, r2 ; r3: pte addr - - ; pte_data = (unsigned long)pte_val(*pte); - ld r2, @r3 ; r2: pte data - and3 r3, r2, #2 ; _PAGE_PRESENT(=2) check - beqz r3, 3f - - .fillinsn -5: -;; set tlb -;; input -;; r0: PFN + ASID -;; r1: TLB entry address -;; r2: pte_data -;; r3: free - st r0, @r1 ; set_tlb_tag(entry++, address); - st r2, @+r1 ; set_tlb_data(entry, pte_data); - - .fillinsn -6: - ld r3, @sp+ - ld r2, @sp+ - ld r1, @sp+ - ld r0, @sp+ - rte - - .fillinsn -3: -;; error -;; input -;; r0: PFN + ASID -;; r1: TLB entry address -;; r2, r3: free -;; output -;; r0: PFN + ASID -;; r1: TLB entry address -;; r2: pte_data -;; r3: free -#ifdef CONFIG_ISA_DUAL_ISSUE - bra 5b || ldi r2, #2 -#else - ldi r2, #2 ; r2: pte_data = 0 | _PAGE_PRESENT(=2) - bra 5b -#endif - -#elif defined (CONFIG_ISA_M32R) - - st sp, @-sp - st r0, @-sp - st r1, @-sp - st r2, @-sp - st r3, @-sp - st r4, @-sp - - seth r3, #high(MMU_REG_BASE) - ld r0, @(MDEVA_offset,r3) ; r0: address (MDEVA reg.) - mvfc r2, bpc ; r2: bpc - ld r1, @(MESTS_offset,r3) ; r1: status (MESTS reg.) - st r1, @(MESTS_offset,r3) ; clear status (MESTS reg.) - and3 r1, r1, #(MESTS_IT) - beqz r1, 1f ; data TLB miss? - -;; instrucntion TLB miss - mv r0, r2 ; address = bpc; - ; entry = (unsigned long *)ITLB_BASE+tlb_entry_i*2; - seth r3, #shigh(tlb_entry_i_dat) - ld r4, @(low(tlb_entry_i_dat),r3) - sll3 r2, r4, #3 - seth r1, #high(ITLB_BASE) - or3 r1, r1, #low(ITLB_BASE) - add r2, r1 ; r2: entry - addi r4, #1 ; tlb_entry_i++; - and3 r4, r4, #(NR_TLB_ENTRIES-1) - st r4, @(low(tlb_entry_i_dat),r3) - bra 2f - .fillinsn -1: -;; data TLB miss - ; entry = (unsigned long *)DTLB_BASE+tlb_entry_d*2; - seth r3, #shigh(tlb_entry_d_dat) - ld r4, @(low(tlb_entry_d_dat),r3) - sll3 r2, r4, #3 - seth r1, #high(DTLB_BASE) - or3 r1, r1, #low(DTLB_BASE) - add r2, r1 ; r2: entry - addi r4, #1 ; tlb_entry_d++; - and3 r4, r4, #(NR_TLB_ENTRIES-1) - st r4, @(low(tlb_entry_d_dat),r3) - .fillinsn -2: -;; load pte -; r0: address, r2: entry -; r1,r3,r4: (free) - ; pgd = *(unsigned long *)MPTB; - ld24 r1, #(-MPTB-1) - not r1, r1 - ld r1, @r1 - srl3 r4, r0, #22 - sll3 r3, r4, #2 - add r3, r1 ; r3: pgd - ; pmd = pmd_offset(pgd, address); - ld r1, @r3 ; r1: pmd - beqz r1, 3f ; pmd_none(*pmd) ? -; - and3 r1, r1, #0x3ff - ldi r4, #0x163 ; _KERNPG_TABLE(=0x163) - bne r1, r4, 3f ; pmd_bad(*pmd) ? - - .fillinsn -4: - ; pte = pte_offset(pmd, address); - ld r4, @r3 ; r4: pte - ldi r3, #-4096 - and r4, r3 - srl3 r3, r0, #10 - and3 r3, r3, #0xffc - add r4, r3 - seth r3, #0x8000 - add r4, r3 ; r4: pte - ; pte_data = (unsigned long)pte_val(*pte); - ld r1, @r4 ; r1: pte_data - and3 r3, r1, #2 ; _PAGE_PRESENT(=2) check - beqz r3, 3f - - .fillinsn -;; set tlb -; r0: address, r1: pte_data, r2: entry -; r3,r4: (free) -5: - ldi r3, #-4096 ; set_tlb_tag(entry++, address); - and r3, r0 - seth r4, #shigh(MASID) - ld r4, @(low(MASID),r4) ; r4: MASID - and3 r4, r4, #(MMU_CONTEXT_ASID_MASK) - or r3, r4 - st r3, @r2 - st r1, @(4,r2) ; set_tlb_data(entry, pte_data); - - ld r4, @sp+ - ld r3, @sp+ - ld r2, @sp+ - ld r1, @sp+ - ld r0, @sp+ - ld sp, @sp+ - rte - - .fillinsn -3: - ldi r1, #2 ; r1: pte_data = 0 | _PAGE_PRESENT(=2) - bra 5b - -#else -#error unknown isa configuration -#endif - -ENTRY(init_tlb) -;; Set MMU Register - seth r0, #high(MMU_REG_BASE) ; Set MMU_REG_BASE higher - or3 r0, r0, #low(MMU_REG_BASE) ; Set MMU_REG_BASE lower - ldi r1, #0 - st r1, @(MPSZ_offset,r0) ; Set MPSZ Reg(Page size 4KB:0 16KB:1 64KB:2) - ldi r1, #0 - st r1, @(MASID_offset,r0) ; Set ASID Zero - -;; Set TLB - seth r0, #high(ITLB_BASE) ; Set ITLB_BASE higher - or3 r0, r0, #low(ITLB_BASE) ; Set ITLB_BASE lower - seth r1, #high(DTLB_BASE) ; Set DTLB_BASE higher - or3 r1, r1, #low(DTLB_BASE) ; Set DTLB_BASE lower - ldi r2, #0 - ldi r3, #NR_TLB_ENTRIES - addi r0, #-4 - addi r1, #-4 -clear_tlb: - st r2, @+r0 ; VPA <- 0 - st r2, @+r0 ; PPA <- 0 - st r2, @+r1 ; VPA <- 0 - st r2, @+r1 ; PPA <- 0 - addi r3, #-1 - bnez r3, clear_tlb -;; - jmp r14 - -ENTRY(m32r_itlb_entrys) -ENTRY(m32r_otlb_entrys) - -#endif /* CONFIG_MMU */ - - .end diff --git a/arch/m32r/mm/page.S b/arch/m32r/mm/page.S deleted file mode 100644 index a2e9367dbf79c..0000000000000 --- a/arch/m32r/mm/page.S +++ /dev/null @@ -1,82 +0,0 @@ -/* - * linux/arch/m32r/mm/page.S - * - * Clear/Copy page with CPU - * - * Copyright (C) 2004 The Free Software Initiative of Japan - * - * Written by Niibe Yutaka - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file "COPYING" in the main directory of this archive - * for more details. - * - */ - .text - .global copy_page - /* - * copy_page (to, from) - * - * PAGE_SIZE = 4096-byte - * Cache line = 16-byte - * 16 * 256 - */ - .align 4 -copy_page: - ldi r2, #255 - ld r3, @r0 /* cache line allocate */ - ld r4, @r1+ - ld r5, @r1+ - ld r6, @r1+ - ld r7, @r1+ - .fillinsn -0: - st r4, @r0 - st r5, @+r0 - st r6, @+r0 - st r7, @+r0 - ld r4, @r1+ - addi r0, #4 - ld r5, @r1+ - ld r6, @r1+ - ld r7, @r1+ - ld r3, @r0 /* cache line allocate */ - addi r2, #-1 - bnez r2, 0b - - st r4, @r0 - st r5, @+r0 - st r6, @+r0 - st r7, @+r0 - jmp r14 - - .text - .global clear_page - /* - * clear_page (to) - * - * PAGE_SIZE = 4096-byte - * Cache line = 16-byte - * 16 * 256 - */ - .align 4 -clear_page: - ldi r2, #255 - ldi r4, #0 - ld r3, @r0 /* cache line allocate */ - .fillinsn -0: - st r4, @r0 - st r4, @+r0 - st r4, @+r0 - st r4, @+r0 - addi r0, #4 - ld r3, @r0 /* cache line allocate */ - addi r2, #-1 - bnez r2, 0b - - st r4, @r0 - st r4, @+r0 - st r4, @+r0 - st r4, @+r0 - jmp r14 diff --git a/arch/m32r/oprofile/Makefile b/arch/m32r/oprofile/Makefile deleted file mode 100644 index 8e63a3a5a64cd..0000000000000 --- a/arch/m32r/oprofile/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -obj-$(CONFIG_OPROFILE) += oprofile.o - -DRIVER_OBJS := $(addprefix ../../../drivers/oprofile/, \ - oprof.o cpu_buffer.o buffer_sync.o \ - event_buffer.o oprofile_files.o \ - oprofilefs.o oprofile_stats.o \ - timer_int.o ) - -oprofile-y := $(DRIVER_OBJS) init.o diff --git a/arch/m32r/oprofile/init.c b/arch/m32r/oprofile/init.c deleted file mode 100644 index fa56860f4258b..0000000000000 --- a/arch/m32r/oprofile/init.c +++ /dev/null @@ -1,22 +0,0 @@ -/** - * @file init.c - * - * @remark Copyright 2002 OProfile authors - * @remark Read the file COPYING - * - * @author John Levon - */ - -#include -#include -#include -#include - -int __init oprofile_arch_init(struct oprofile_operations *ops) -{ - return -ENODEV; -} - -void oprofile_arch_exit(void) -{ -} diff --git a/arch/m32r/platforms/Makefile b/arch/m32r/platforms/Makefile deleted file mode 100644 index 9e1a82529ad9a..0000000000000 --- a/arch/m32r/platforms/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -# arch/m32r/platforms/Makefile -obj-$(CONFIG_PLAT_M32104UT) += m32104ut/ -obj-$(CONFIG_PLAT_M32700UT) += m32700ut/ -obj-$(CONFIG_PLAT_MAPPI) += mappi/ -obj-$(CONFIG_PLAT_MAPPI2) += mappi2/ -obj-$(CONFIG_PLAT_MAPPI3) += mappi3/ -obj-$(CONFIG_PLAT_OAKS32R) += oaks32r/ -obj-$(CONFIG_PLAT_OPSPUT) += opsput/ -obj-$(CONFIG_PLAT_USRV) += usrv/ diff --git a/arch/m32r/platforms/m32104ut/Makefile b/arch/m32r/platforms/m32104ut/Makefile deleted file mode 100644 index 0de59084f21cb..0000000000000 --- a/arch/m32r/platforms/m32104ut/Makefile +++ /dev/null @@ -1 +0,0 @@ -obj-y := setup.o io.o diff --git a/arch/m32r/platforms/m32104ut/io.c b/arch/m32r/platforms/m32104ut/io.c deleted file mode 100644 index ff2bb3b58bb5e..0000000000000 --- a/arch/m32r/platforms/m32104ut/io.c +++ /dev/null @@ -1,298 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * linux/arch/m32r/platforms/m32104ut/io.c - * - * Typical I/O routines for M32104UT board. - * - * Copyright (c) 2001-2005 Hiroyuki Kondo, Hirokazu Takata, - * Hitoshi Yamamoto, Mamoru Sakugawa, - * Naoto Sugai, Hayato Fujiwara - */ - -#include -#include -#include -#include - -#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) -#include - -#define M32R_PCC_IOMAP_SIZE 0x1000 - -#define M32R_PCC_IOSTART0 0x1000 -#define M32R_PCC_IOEND0 (M32R_PCC_IOSTART0 + M32R_PCC_IOMAP_SIZE - 1) - -extern void pcc_ioread_byte(int, unsigned long, void *, size_t, size_t, int); -extern void pcc_ioread_word(int, unsigned long, void *, size_t, size_t, int); -extern void pcc_iowrite_byte(int, unsigned long, void *, size_t, size_t, int); -extern void pcc_iowrite_word(int, unsigned long, void *, size_t, size_t, int); -#endif /* CONFIG_PCMCIA && CONFIG_M32R_CFC */ - -#define PORT2ADDR(port) _port2addr(port) - -static inline void *_port2addr(unsigned long port) -{ - return (void *)(port | NONCACHE_OFFSET); -} - -#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) -static inline void *__port2addr_ata(unsigned long port) -{ - static int dummy_reg; - - switch (port) { - case 0x1f0: return (void *)(0x0c002000 | NONCACHE_OFFSET); - case 0x1f1: return (void *)(0x0c012800 | NONCACHE_OFFSET); - case 0x1f2: return (void *)(0x0c012002 | NONCACHE_OFFSET); - case 0x1f3: return (void *)(0x0c012802 | NONCACHE_OFFSET); - case 0x1f4: return (void *)(0x0c012004 | NONCACHE_OFFSET); - case 0x1f5: return (void *)(0x0c012804 | NONCACHE_OFFSET); - case 0x1f6: return (void *)(0x0c012006 | NONCACHE_OFFSET); - case 0x1f7: return (void *)(0x0c012806 | NONCACHE_OFFSET); - case 0x3f6: return (void *)(0x0c01200e | NONCACHE_OFFSET); - default: return (void *)&dummy_reg; - } -} -#endif - -/* - * M32104T-LAN is located in the extended bus space - * from 0x01000000 to 0x01ffffff on physical address. - * The base address of LAN controller(LAN91C111) is 0x300. - */ -#define LAN_IOSTART (0x300 | NONCACHE_OFFSET) -#define LAN_IOEND (0x320 | NONCACHE_OFFSET) -static inline void *_port2addr_ne(unsigned long port) -{ - return (void *)(port + NONCACHE_OFFSET + 0x01000000); -} - -static inline void delay(void) -{ - __asm__ __volatile__ ("push r0; \n\t pop r0;" : : :"memory"); -} - -/* - * NIC I/O function - */ - -#define PORT2ADDR_NE(port) _port2addr_ne(port) - -static inline unsigned char _ne_inb(void *portp) -{ - return *(volatile unsigned char *)portp; -} - -static inline unsigned short _ne_inw(void *portp) -{ - return (unsigned short)le16_to_cpu(*(volatile unsigned short *)portp); -} - -static inline void _ne_insb(void *portp, void *addr, unsigned long count) -{ - unsigned char *buf = (unsigned char *)addr; - - while (count--) - *buf++ = _ne_inb(portp); -} - -static inline void _ne_outb(unsigned char b, void *portp) -{ - *(volatile unsigned char *)portp = b; -} - -static inline void _ne_outw(unsigned short w, void *portp) -{ - *(volatile unsigned short *)portp = cpu_to_le16(w); -} - -unsigned char _inb(unsigned long port) -{ - if (port >= LAN_IOSTART && port < LAN_IOEND) - return _ne_inb(PORT2ADDR_NE(port)); - - return *(volatile unsigned char *)PORT2ADDR(port); -} - -unsigned short _inw(unsigned long port) -{ - if (port >= LAN_IOSTART && port < LAN_IOEND) - return _ne_inw(PORT2ADDR_NE(port)); - - return *(volatile unsigned short *)PORT2ADDR(port); -} - -unsigned long _inl(unsigned long port) -{ - return *(volatile unsigned long *)PORT2ADDR(port); -} - -unsigned char _inb_p(unsigned long port) -{ - unsigned char v = _inb(port); - delay(); - return (v); -} - -unsigned short _inw_p(unsigned long port) -{ - unsigned short v = _inw(port); - delay(); - return (v); -} - -unsigned long _inl_p(unsigned long port) -{ - unsigned long v = _inl(port); - delay(); - return (v); -} - -void _outb(unsigned char b, unsigned long port) -{ - if (port >= LAN_IOSTART && port < LAN_IOEND) - _ne_outb(b, PORT2ADDR_NE(port)); - else - *(volatile unsigned char *)PORT2ADDR(port) = b; -} - -void _outw(unsigned short w, unsigned long port) -{ - if (port >= LAN_IOSTART && port < LAN_IOEND) - _ne_outw(w, PORT2ADDR_NE(port)); - else - *(volatile unsigned short *)PORT2ADDR(port) = w; -} - -void _outl(unsigned long l, unsigned long port) -{ - *(volatile unsigned long *)PORT2ADDR(port) = l; -} - -void _outb_p(unsigned char b, unsigned long port) -{ - _outb(b, port); - delay(); -} - -void _outw_p(unsigned short w, unsigned long port) -{ - _outw(w, port); - delay(); -} - -void _outl_p(unsigned long l, unsigned long port) -{ - _outl(l, port); - delay(); -} - -void _insb(unsigned int port, void *addr, unsigned long count) -{ - if (port >= LAN_IOSTART && port < LAN_IOEND) - _ne_insb(PORT2ADDR_NE(port), addr, count); - else { - unsigned char *buf = addr; - unsigned char *portp = PORT2ADDR(port); - while (count--) - *buf++ = *(volatile unsigned char *)portp; - } -} - -void _insw(unsigned int port, void *addr, unsigned long count) -{ - unsigned short *buf = addr; - unsigned short *portp; - - if (port >= LAN_IOSTART && port < LAN_IOEND) { - /* - * This portion is only used by smc91111.c to read data - * from the DATA_REG. Do not swap the data. - */ - portp = PORT2ADDR_NE(port); - while (count--) - *buf++ = *(volatile unsigned short *)portp; -#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) - } else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { - pcc_ioread_word(9, port, (void *)addr, sizeof(unsigned short), - count, 1); -#endif -#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) - } else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { - portp = __port2addr_ata(port); - while (count--) - *buf++ = *(volatile unsigned short *)portp; -#endif - } else { - portp = PORT2ADDR(port); - while (count--) - *buf++ = *(volatile unsigned short *)portp; - } -} - -void _insl(unsigned int port, void *addr, unsigned long count) -{ - unsigned long *buf = addr; - unsigned long *portp; - - portp = PORT2ADDR(port); - while (count--) - *buf++ = *(volatile unsigned long *)portp; -} - -void _outsb(unsigned int port, const void *addr, unsigned long count) -{ - const unsigned char *buf = addr; - unsigned char *portp; - - if (port >= LAN_IOSTART && port < LAN_IOEND) { - portp = PORT2ADDR_NE(port); - while (count--) - _ne_outb(*buf++, portp); - } else { - portp = PORT2ADDR(port); - while (count--) - *(volatile unsigned char *)portp = *buf++; - } -} - -void _outsw(unsigned int port, const void *addr, unsigned long count) -{ - const unsigned short *buf = addr; - unsigned short *portp; - - if (port >= LAN_IOSTART && port < LAN_IOEND) { - /* - * This portion is only used by smc91111.c to write data - * into the DATA_REG. Do not swap the data. - */ - portp = PORT2ADDR_NE(port); - while (count--) - *(volatile unsigned short *)portp = *buf++; -#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) - } else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { - portp = __port2addr_ata(port); - while (count--) - *(volatile unsigned short *)portp = *buf++; -#endif -#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) - } else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { - pcc_iowrite_word(9, port, (void *)addr, sizeof(unsigned short), - count, 1); -#endif - } else { - portp = PORT2ADDR(port); - while (count--) - *(volatile unsigned short *)portp = *buf++; - } -} - -void _outsl(unsigned int port, const void *addr, unsigned long count) -{ - const unsigned long *buf = addr; - unsigned char *portp; - - portp = PORT2ADDR(port); - while (count--) - *(volatile unsigned long *)portp = *buf++; -} diff --git a/arch/m32r/platforms/m32104ut/setup.c b/arch/m32r/platforms/m32104ut/setup.c deleted file mode 100644 index 297936003b1fc..0000000000000 --- a/arch/m32r/platforms/m32104ut/setup.c +++ /dev/null @@ -1,139 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * linux/arch/m32r/platforms/m32104ut/setup.c - * - * Setup routines for M32104UT Board - * - * Copyright (c) 2002-2005 Hiroyuki Kondo, Hirokazu Takata, - * Hitoshi Yamamoto, Mamoru Sakugawa, - * Naoto Sugai, Hayato Fujiwara - */ - -#include -#include -#include -#include - -#include -#include - -#define irq2port(x) (M32R_ICU_CR1_PORTL + ((x - 1) * sizeof(unsigned long))) - -icu_data_t icu_data[NR_IRQS]; - -static void disable_m32104ut_irq(unsigned int irq) -{ - unsigned long port, data; - - port = irq2port(irq); - data = icu_data[irq].icucr|M32R_ICUCR_ILEVEL7; - outl(data, port); -} - -static void enable_m32104ut_irq(unsigned int irq) -{ - unsigned long port, data; - - port = irq2port(irq); - data = icu_data[irq].icucr|M32R_ICUCR_IEN|M32R_ICUCR_ILEVEL6; - outl(data, port); -} - -static void mask_m32104ut_irq(struct irq_data *data) -{ - disable_m32104ut_irq(data->irq); -} - -static void unmask_m32104ut_irq(struct irq_data *data) -{ - enable_m32104ut_irq(data->irq); -} - -static void shutdown_m32104ut_irq(struct irq_data *data) -{ - unsigned int irq = data->irq; - unsigned long port = irq2port(irq); - - outl(M32R_ICUCR_ILEVEL7, port); -} - -static struct irq_chip m32104ut_irq_type = -{ - .name = "M32104UT-IRQ", - .irq_shutdown = shutdown_m32104ut_irq, - .irq_unmask = unmask_m32104ut_irq, - .irq_mask = mask_m32104ut_irq, -}; - -void __init init_IRQ(void) -{ - static int once = 0; - - if (once) - return; - else - once++; - -#if defined(CONFIG_SMC91X) - /* INT#0: LAN controller on M32104UT-LAN (SMC91C111)*/ - irq_set_chip_and_handler(M32R_IRQ_INT0, &m32104ut_irq_type, - handle_level_irq); - /* "H" level sense */ - cu_data[M32R_IRQ_INT0].icucr = M32R_ICUCR_IEN | M32R_ICUCR_ISMOD11; - disable_m32104ut_irq(M32R_IRQ_INT0); -#endif /* CONFIG_SMC91X */ - - /* MFT2 : system timer */ - irq_set_chip_and_handler(M32R_IRQ_MFT2, &m32104ut_irq_type, - handle_level_irq); - icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN; - disable_m32104ut_irq(M32R_IRQ_MFT2); - -#ifdef CONFIG_SERIAL_M32R_SIO - /* SIO0_R : uart receive data */ - irq_set_chip_and_handler(M32R_IRQ_SIO0_R, &m32104ut_irq_type, - handle_level_irq); - icu_data[M32R_IRQ_SIO0_R].icucr = M32R_ICUCR_IEN; - disable_m32104ut_irq(M32R_IRQ_SIO0_R); - - /* SIO0_S : uart send data */ - irq_set_chip_and_handler(M32R_IRQ_SIO0_S, &m32104ut_irq_type, - handle_level_irq); - icu_data[M32R_IRQ_SIO0_S].icucr = M32R_ICUCR_IEN; - disable_m32104ut_irq(M32R_IRQ_SIO0_S); -#endif /* CONFIG_SERIAL_M32R_SIO */ -} - -#if defined(CONFIG_SMC91X) - -#define LAN_IOSTART 0x300 -#define LAN_IOEND 0x320 -static struct resource smc91x_resources[] = { - [0] = { - .start = (LAN_IOSTART), - .end = (LAN_IOEND), - .flags = IORESOURCE_MEM, - }, - [1] = { - .start = M32R_IRQ_INT0, - .end = M32R_IRQ_INT0, - .flags = IORESOURCE_IRQ, - } -}; - -static struct platform_device smc91x_device = { - .name = "smc91x", - .id = 0, - .num_resources = ARRAY_SIZE(smc91x_resources), - .resource = smc91x_resources, -}; -#endif - -static int __init platform_init(void) -{ -#if defined(CONFIG_SMC91X) - platform_device_register(&smc91x_device); -#endif - return 0; -} -arch_initcall(platform_init); diff --git a/arch/m32r/platforms/m32700ut/Makefile b/arch/m32r/platforms/m32700ut/Makefile deleted file mode 100644 index 0de59084f21cb..0000000000000 --- a/arch/m32r/platforms/m32700ut/Makefile +++ /dev/null @@ -1 +0,0 @@ -obj-y := setup.o io.o diff --git a/arch/m32r/platforms/m32700ut/dot.gdbinit_200MHz_16MB b/arch/m32r/platforms/m32700ut/dot.gdbinit_200MHz_16MB deleted file mode 100644 index 525dab46982bb..0000000000000 --- a/arch/m32r/platforms/m32700ut/dot.gdbinit_200MHz_16MB +++ /dev/null @@ -1,249 +0,0 @@ -# .gdbinit file -# $Id: dot.gdbinit_200MHz_16MB,v 1.2 2004/10/20 03:02:27 fujiwara Exp $ -#----- -# NOTE: this file is generated by a script, "gen_gdbinit.pl". -# (Please type "gen_gdbinit.pl --help" and check the help message). -# $ Id: gen_gdbinit.pl,v 1.12 2004/07/26 09:56:10 takata Exp $ -#----- -# target platform: m32700ut - -# setting -set width 0d70 -set radix 0d16 - -debug_chaos - -# clk xin:cpu:bif:bus=25:200:50:50 -define clock_init - set *(unsigned long *)0x00ef4008 = 0x00000000 - set *(unsigned long *)0x00ef4004 = 0 - shell sleep 0.1 - # NOTE: Please change the master clock source from PLL-clock to Xin-clock - # and switch off PLL, before resetting the clock gear ratio. - - set *(unsigned long *)0x00ef4024 = 2 - set *(unsigned long *)0x00ef4020 = 2 - set *(unsigned long *)0x00ef4010 = 0 - set *(unsigned long *)0x00ef4014 = 0 - set *(unsigned long *)0x00ef4004 = 3 - shell sleep 0.1 - set *(unsigned long *)0x00ef4008 = 0x00000200 -end - -# Initialize SDRAM controller -define sdram_init - # SDIR0 - set *(unsigned long *)0x00ef6008 = 0x00000182 - # SDIR1 - set *(unsigned long *)0x00ef600c = 0x00000001 - # Initialize wait - shell sleep 0.1 - # Ch0-MOD - set *(unsigned long *)0x00ef602c = 0x00000020 - # Ch0-TR - set *(unsigned long *)0x00ef6028 = 0x00041302 - # Ch0-ADR (size:16MB) - set *(unsigned long *)0x00ef6020 = 0x08000002 - # AutoRef On - set *(unsigned long *)0x00ef6004 = 0x00010517 - # Access enable - set *(unsigned long *)0x00ef6024 = 0x00000001 -end -document sdram_init - SDRAM controller initialization - 0x08000000 - 0x08ffffff (16MB) -end - -# Initialize BSEL3 for UT-CFC -define cfc_init - set $sfrbase = 0xa0ef0000 -# too fast -# set *(unsigned long *)($sfrbase + 0x5300) = 0x0b0b8000 -# set *(unsigned long *)($sfrbase + 0x5304) = 0x00102204 -# set *(unsigned long *)($sfrbase + 0x5300) = 0x1f1f8000 -# set *(unsigned long *)($sfrbase + 0x5300) = 0x1f1f1fdf -# set *(unsigned long *)($sfrbase + 0x5304) = 0x0013220f -# set *(unsigned long *)($sfrbase + 0x5304) = 0x0013330f -end -document cfc_init - CF controller initialization -end - -# MMU enable -define mmu_enable - set $evb=0x88000000 - set *(unsigned long *)0xffff0024=1 -end - -# MMU disable -define mmu_disable - set $evb=0 - set *(unsigned long *)0xffff0024=0 -end - -# Show TLB entries -define show_tlb_entries - set $i = 0 - set $addr = $arg0 - set $nr_entries = $arg1 - use_mon_code - while ($i < $nr_entries) - set $tlb_tag = *(unsigned long*)$addr - set $tlb_data = *(unsigned long*)($addr + 4) - printf " [%2d] 0x%08lx : 0x%08lx - 0x%08lx\n", $i, $addr, $tlb_tag, $tlb_data - set $i = $i + 1 - set $addr = $addr + 8 - end - use_debug_dma -end -define itlb - set $itlb=0xfe000000 - show_tlb_entries $itlb 0d32 -end -define dtlb - set $dtlb=0xfe000800 - show_tlb_entries $dtlb 0d32 -end - -# Initialize TLB entries -define init_tlb_entries - set $i = 0 - set $addr = $arg0 - set $nr_entries = $arg1 - use_mon_code - while ($i < $nr_entries) - set *(unsigned long *)($addr + 0x4) = 0 - set $i = $i + 1 - set $addr = $addr + 8 - end - use_debug_dma -end -define tlb_init - set $itlb=0xfe000000 - init_tlb_entries $itlb 0d32 - set $dtlb=0xfe000800 - init_tlb_entries $dtlb 0d32 -end - -# Show current task structure -define show_current - set $current = $spi & 0xffffe000 - printf "$current=0x%08lX\n",$current - print *(struct task_struct *)$current -end - -# Show user assigned task structure -define show_task - set = $arg0 & 0xffffe000 - printf "$task=0x%08lX\n",$task - print *(struct task_struct *)$task -end -document show_task - Show user assigned task structure - arg0 : task structure address -end - -# Show M32R registers -define show_regs - printf " R0[0x%08lX] R1[0x%08lX] R2[0x%08lX] R3[0x%08lX]\n",$r0,$r1,$r2,$r3 - printf " R4[0x%08lX] R5[0x%08lX] R6[0x%08lX] R7[0x%08lX]\n",$r4,$r5,$r6,$r7 - printf " R8[0x%08lX] R9[0x%08lX] R10[0x%08lX] R11[0x%08lX]\n",$r8,$r9,$r10,$r11 - printf "R12[0x%08lX] FP[0x%08lX] LR[0x%08lX] SP[0x%08lX]\n",$r12,$fp,$lr,$sp - printf "PSW[0x%08lX] CBR[0x%08lX] SPI[0x%08lX] SPU[0x%08lX]\n",$psw,$cbr,$spi,$spu - printf "BPC[0x%08lX] PC[0x%08lX] ACCL[0x%08lX] ACCH[0x%08lX]\n",$bpc,$pc,$accl,$acch - printf "EVB[0x%08lX]\n",$evb -end - -# Setup all -define setup - use_mon_code - set *(unsigned int)0xfffffffc=0x60 - shell sleep 0.1 - clock_init - shell sleep 0.1 - # SDRAM: 16MB - set *(unsigned long *)0x00ef6020 = 0x08000002 - cfc_init - # USB - set *(unsigned short *)0xb0301000 = 0x100 - - set $evb=0x08000000 -end - -# Load modules -define load_modules - use_debug_dma - load -end - -# Set kernel parameters -define set_kernel_parameters - set $param = (void*)0x08001000 - # INITRD_START -# set *(unsigned long *)($param + 0x0010) = 0x08300000 - # INITRD_SIZE -# set *(unsigned long *)($param + 0x0014) = 0x00000000 - # M32R_CPUCLK - set *(unsigned long *)($param + 0x0018) = 0d200000000 - # M32R_BUSCLK - set *(unsigned long *)($param + 0x001c) = 0d50000000 - - # M32R_TIMER_DIVIDE - set *(unsigned long *)($param + 0x0020) = 0d128 - - set {char[0x200]}($param + 0x100) = "console=ttyS0,115200n8x console=tty1 root=/dev/nfsroot nfsroot=192.168.0.1:/project/m32r-linux/export/rootfs,rsize=1024,wsize=1024 nfsaddrs=192.168.0.101:192.168.0.1:192.168.0.1:255.255.255.0:mappi001 mem=16M \0" -end - -# Boot -define boot - set_kernel_parameters - set $fp = 0 - set $pc = 0x08002000 -# set *(unsigned char *)0xffffffff = 0x03 - si - c -end - -# Set breakpoints -define set_breakpoints - b *0x08000030 -end - -# Restart -define restart - sdireset - sdireset - set $pc = 0 - b *0x04001000 - b *0x08001000 - b *0x08002000 - si - c - tlb_init - del - setup - load_modules - boot -end - -define si - stepi - x/i $pc - show_reg -end - -sdireset -sdireset -file vmlinux -target m32rsdi -set $pc = 0 -b *0x04001000 -b *0x08001000 -b *0x08002000 -c -tlb_init -del -setup -load_modules -boot - diff --git a/arch/m32r/platforms/m32700ut/dot.gdbinit_300MHz_32MB b/arch/m32r/platforms/m32700ut/dot.gdbinit_300MHz_32MB deleted file mode 100644 index aa503657a49b0..0000000000000 --- a/arch/m32r/platforms/m32700ut/dot.gdbinit_300MHz_32MB +++ /dev/null @@ -1,249 +0,0 @@ -# .gdbinit file -# $Id: dot.gdbinit_300MHz_32MB,v 1.2 2004/10/20 03:02:27 fujiwara Exp $ -#----- -# NOTE: this file is generated by a script, "gen_gdbinit.pl". -# (Please type "gen_gdbinit.pl --help" and check the help message). -# $ Id: gen_gdbinit.pl,v 1.12 2004/07/26 09:56:10 takata Exp $ -#----- -# target platform: m32700ut - -# setting -set width 0d70 -set radix 0d16 - -debug_chaos - -# clk xin:cpu:bif:bus=25:300:75:75 -define clock_init - set *(unsigned long *)0x00ef4008 = 0x00000000 - set *(unsigned long *)0x00ef4004 = 0 - shell sleep 0.1 - # NOTE: Please change the master clock source from PLL-clock to Xin-clock - # and switch off PLL, before resetting the clock gear ratio. - - set *(unsigned long *)0x00ef4024 = 2 - set *(unsigned long *)0x00ef4020 = 2 - set *(unsigned long *)0x00ef4010 = 0 - set *(unsigned long *)0x00ef4014 = 0 - set *(unsigned long *)0x00ef4004 = 5 - shell sleep 0.1 - set *(unsigned long *)0x00ef4008 = 0x00000200 -end - -# Initialize SDRAM controller -define sdram_init - # SDIR0 - set *(unsigned long *)0x00ef6008 = 0x00000182 - # SDIR1 - set *(unsigned long *)0x00ef600c = 0x00000001 - # Initialize wait - shell sleep 0.1 - # Ch0-MOD - set *(unsigned long *)0x00ef602c = 0x00000020 - # Ch0-TR - set *(unsigned long *)0x00ef6028 = 0x00051502 - # Ch0-ADR (size:32MB) - set *(unsigned long *)0x00ef6020 = 0x08000003 - # AutoRef On - set *(unsigned long *)0x00ef6004 = 0x00010e24 - # Access enable - set *(unsigned long *)0x00ef6024 = 0x00000001 -end -document sdram_init - SDRAM controller initialization - 0x08000000 - 0x09ffffff (32MB) -end - -# Initialize BSEL3 for UT-CFC -define cfc_init - set $sfrbase = 0xa0ef0000 -# too fast -# set *(unsigned long *)($sfrbase + 0x5300) = 0x0b0b8000 -# set *(unsigned long *)($sfrbase + 0x5304) = 0x00102204 -# set *(unsigned long *)($sfrbase + 0x5300) = 0x1f1f8000 -# set *(unsigned long *)($sfrbase + 0x5300) = 0x1f1f1fdf -# set *(unsigned long *)($sfrbase + 0x5304) = 0x0013220f -# set *(unsigned long *)($sfrbase + 0x5304) = 0x0013330f -end -document cfc_init - CF controller initialization -end - -# MMU enable -define mmu_enable - set $evb=0x88000000 - set *(unsigned long *)0xffff0024=1 -end - -# MMU disable -define mmu_disable - set $evb=0 - set *(unsigned long *)0xffff0024=0 -end - -# Show TLB entries -define show_tlb_entries - set $i = 0 - set $addr = $arg0 - set $nr_entries = $arg1 - use_mon_code - while ($i < $nr_entries) - set $tlb_tag = *(unsigned long*)$addr - set $tlb_data = *(unsigned long*)($addr + 4) - printf " [%2d] 0x%08lx : 0x%08lx - 0x%08lx\n", $i, $addr, $tlb_tag, $tlb_data - set $i = $i + 1 - set $addr = $addr + 8 - end - use_debug_dma -end -define itlb - set $itlb=0xfe000000 - show_tlb_entries $itlb 0d32 -end -define dtlb - set $dtlb=0xfe000800 - show_tlb_entries $dtlb 0d32 -end - -# Initialize TLB entries -define init_tlb_entries - set $i = 0 - set $addr = $arg0 - set $nr_entries = $arg1 - use_mon_code - while ($i < $nr_entries) - set *(unsigned long *)($addr + 0x4) = 0 - set $i = $i + 1 - set $addr = $addr + 8 - end - use_debug_dma -end -define tlb_init - set $itlb=0xfe000000 - init_tlb_entries $itlb 0d32 - set $dtlb=0xfe000800 - init_tlb_entries $dtlb 0d32 -end - -# Show current task structure -define show_current - set $current = $spi & 0xffffe000 - printf "$current=0x%08lX\n",$current - print *(struct task_struct *)$current -end - -# Show user assigned task structure -define show_task - set = $arg0 & 0xffffe000 - printf "$task=0x%08lX\n",$task - print *(struct task_struct *)$task -end -document show_task - Show user assigned task structure - arg0 : task structure address -end - -# Show M32R registers -define show_regs - printf " R0[0x%08lX] R1[0x%08lX] R2[0x%08lX] R3[0x%08lX]\n",$r0,$r1,$r2,$r3 - printf " R4[0x%08lX] R5[0x%08lX] R6[0x%08lX] R7[0x%08lX]\n",$r4,$r5,$r6,$r7 - printf " R8[0x%08lX] R9[0x%08lX] R10[0x%08lX] R11[0x%08lX]\n",$r8,$r9,$r10,$r11 - printf "R12[0x%08lX] FP[0x%08lX] LR[0x%08lX] SP[0x%08lX]\n",$r12,$fp,$lr,$sp - printf "PSW[0x%08lX] CBR[0x%08lX] SPI[0x%08lX] SPU[0x%08lX]\n",$psw,$cbr,$spi,$spu - printf "BPC[0x%08lX] PC[0x%08lX] ACCL[0x%08lX] ACCH[0x%08lX]\n",$bpc,$pc,$accl,$acch - printf "EVB[0x%08lX]\n",$evb -end - -# Setup all -define setup - use_mon_code - set *(unsigned int)0xfffffffc=0x60 - shell sleep 0.1 - clock_init - shell sleep 0.1 - # SDRAM: 32MB - set *(unsigned long *)0x00ef6020 = 0x08000003 - cfc_init - # USB - set *(unsigned short *)0xb0301000 = 0x100 - - set $evb=0x08000000 -end - -# Load modules -define load_modules - use_debug_dma - load -end - -# Set kernel parameters -define set_kernel_parameters - set $param = (void*)0x08001000 - # INITRD_START -# set *(unsigned long *)($param + 0x0010) = 0x08300000 - # INITRD_SIZE -# set *(unsigned long *)($param + 0x0014) = 0x00000000 - # M32R_CPUCLK - set *(unsigned long *)($param + 0x0018) = 0d300000000 - # M32R_BUSCLK - set *(unsigned long *)($param + 0x001c) = 0d75000000 - - # M32R_TIMER_DIVIDE - set *(unsigned long *)($param + 0x0020) = 0d128 - - set {char[0x200]}($param + 0x100) = "console=ttyS0,115200n8x console=tty1 root=/dev/nfsroot nfsroot=192.168.0.1:/project/m32r-linux/export/rootfs,rsize=1024,wsize=1024 nfsaddrs=192.168.0.101:192.168.0.1:192.168.0.1:255.255.255.0:mappi001 mem=32M \0" -end - -# Boot -define boot - set_kernel_parameters - set $fp = 0 - set $pc = 0x08002000 -# set *(unsigned char *)0xffffffff = 0x03 - si - c -end - -# Set breakpoints -define set_breakpoints - b *0x08000030 -end - -# Restart -define restart - sdireset - sdireset - set $pc = 0 - b *0x04001000 - b *0x08001000 - b *0x08002000 - si - c - tlb_init - del - setup - load_modules - boot -end - -define si - stepi - x/i $pc - show_reg -end - -sdireset -sdireset -file vmlinux -target m32rsdi -set $pc = 0 -b *0x04001000 -b *0x08001000 -b *0x08002000 -c -tlb_init -del -setup -load_modules -boot - diff --git a/arch/m32r/platforms/m32700ut/dot.gdbinit_400MHz_32MB b/arch/m32r/platforms/m32700ut/dot.gdbinit_400MHz_32MB deleted file mode 100644 index adc608aab2feb..0000000000000 --- a/arch/m32r/platforms/m32700ut/dot.gdbinit_400MHz_32MB +++ /dev/null @@ -1,249 +0,0 @@ -# .gdbinit file -# $Id: dot.gdbinit_400MHz_32MB,v 1.1 2004/10/21 01:41:27 fujiwara Exp $ -#----- -# NOTE: this file is generated by a script, "gen_gdbinit.pl". -# (Please type "gen_gdbinit.pl --help" and check the help message). -# $ Id: gen_gdbinit.pl,v 1.12 2004/07/26 09:56:10 takata Exp $ -#----- -# target platform: m32700ut - -# setting -set width 0d70 -set radix 0d16 - -debug_chaos - -# clk xin:cpu:bif:bus=25:400:100:50 -define clock_init - set *(unsigned long *)0x00ef4008 = 0x00000000 - set *(unsigned long *)0x00ef4004 = 0 - shell sleep 0.1 - # NOTE: Please change the master clock source from PLL-clock to Xin-clock - # and switch off PLL, before resetting the clock gear ratio. - - set *(unsigned long *)0x00ef4024 = 3 - set *(unsigned long *)0x00ef4020 = 2 - set *(unsigned long *)0x00ef4010 = 0 - set *(unsigned long *)0x00ef4014 = 0 - set *(unsigned long *)0x00ef4004 = 7 - shell sleep 0.1 - set *(unsigned long *)0x00ef4008 = 0x00000200 -end - -# Initialize SDRAM controller -define sdram_init - # SDIR0 - set *(unsigned long *)0x00ef6008 = 0x00000182 - # SDIR1 - set *(unsigned long *)0x00ef600c = 0x00000001 - # Initialize wait - shell sleep 0.1 - # Ch0-MOD - set *(unsigned long *)0x00ef602c = 0x00000020 - # Ch0-TR - set *(unsigned long *)0x00ef6028 = 0x00041302 - # Ch0-ADR (size:32MB) - set *(unsigned long *)0x00ef6020 = 0x08000003 - # AutoRef On - set *(unsigned long *)0x00ef6004 = 0x00010517 - # Access enable - set *(unsigned long *)0x00ef6024 = 0x00000001 -end -document sdram_init - SDRAM controller initialization - 0x08000000 - 0x09ffffff (32MB) -end - -# Initialize BSEL3 for UT-CFC -define cfc_init - set $sfrbase = 0xa0ef0000 -# too fast -# set *(unsigned long *)($sfrbase + 0x5300) = 0x0b0b8000 -# set *(unsigned long *)($sfrbase + 0x5304) = 0x00102204 -# set *(unsigned long *)($sfrbase + 0x5300) = 0x1f1f8000 -# set *(unsigned long *)($sfrbase + 0x5300) = 0x1f1f1fdf -# set *(unsigned long *)($sfrbase + 0x5304) = 0x0013220f -# set *(unsigned long *)($sfrbase + 0x5304) = 0x0013330f -end -document cfc_init - CF controller initialization -end - -# MMU enable -define mmu_enable - set $evb=0x88000000 - set *(unsigned long *)0xffff0024=1 -end - -# MMU disable -define mmu_disable - set $evb=0 - set *(unsigned long *)0xffff0024=0 -end - -# Show TLB entries -define show_tlb_entries - set $i = 0 - set $addr = $arg0 - set $nr_entries = $arg1 - use_mon_code - while ($i < $nr_entries) - set $tlb_tag = *(unsigned long*)$addr - set $tlb_data = *(unsigned long*)($addr + 4) - printf " [%2d] 0x%08lx : 0x%08lx - 0x%08lx\n", $i, $addr, $tlb_tag, $tlb_data - set $i = $i + 1 - set $addr = $addr + 8 - end - use_debug_dma -end -define itlb - set $itlb=0xfe000000 - show_tlb_entries $itlb 0d32 -end -define dtlb - set $dtlb=0xfe000800 - show_tlb_entries $dtlb 0d32 -end - -# Initialize TLB entries -define init_tlb_entries - set $i = 0 - set $addr = $arg0 - set $nr_entries = $arg1 - use_mon_code - while ($i < $nr_entries) - set *(unsigned long *)($addr + 0x4) = 0 - set $i = $i + 1 - set $addr = $addr + 8 - end - use_debug_dma -end -define tlb_init - set $itlb=0xfe000000 - init_tlb_entries $itlb 0d32 - set $dtlb=0xfe000800 - init_tlb_entries $dtlb 0d32 -end - -# Show current task structure -define show_current - set $current = $spi & 0xffffe000 - printf "$current=0x%08lX\n",$current - print *(struct task_struct *)$current -end - -# Show user assigned task structure -define show_task - set = $arg0 & 0xffffe000 - printf "$task=0x%08lX\n",$task - print *(struct task_struct *)$task -end -document show_task - Show user assigned task structure - arg0 : task structure address -end - -# Show M32R registers -define show_regs - printf " R0[0x%08lX] R1[0x%08lX] R2[0x%08lX] R3[0x%08lX]\n",$r0,$r1,$r2,$r3 - printf " R4[0x%08lX] R5[0x%08lX] R6[0x%08lX] R7[0x%08lX]\n",$r4,$r5,$r6,$r7 - printf " R8[0x%08lX] R9[0x%08lX] R10[0x%08lX] R11[0x%08lX]\n",$r8,$r9,$r10,$r11 - printf "R12[0x%08lX] FP[0x%08lX] LR[0x%08lX] SP[0x%08lX]\n",$r12,$fp,$lr,$sp - printf "PSW[0x%08lX] CBR[0x%08lX] SPI[0x%08lX] SPU[0x%08lX]\n",$psw,$cbr,$spi,$spu - printf "BPC[0x%08lX] PC[0x%08lX] ACCL[0x%08lX] ACCH[0x%08lX]\n",$bpc,$pc,$accl,$acch - printf "EVB[0x%08lX]\n",$evb -end - -# Setup all -define setup - use_mon_code - set *(unsigned int)0xfffffffc=0x60 - shell sleep 0.1 - clock_init - shell sleep 0.1 - # SDRAM: 32MB - set *(unsigned long *)0x00ef6020 = 0x08000003 - cfc_init - # USB - set *(unsigned short *)0xb0301000 = 0x100 - - set $evb=0x08000000 -end - -# Load modules -define load_modules - use_debug_dma - load -end - -# Set kernel parameters -define set_kernel_parameters - set $param = (void*)0x08001000 - # INITRD_START -# set *(unsigned long *)($param + 0x0010) = 0x08300000 - # INITRD_SIZE -# set *(unsigned long *)($param + 0x0014) = 0x00000000 - # M32R_CPUCLK - set *(unsigned long *)($param + 0x0018) = 0d400000000 - # M32R_BUSCLK - set *(unsigned long *)($param + 0x001c) = 0d50000000 - - # M32R_TIMER_DIVIDE - set *(unsigned long *)($param + 0x0020) = 0d128 - - set {char[0x200]}($param + 0x100) = "console=ttyS0,115200n8x console=tty1 root=/dev/nfsroot nfsroot=192.168.0.1:/project/m32r-linux/export/rootfs,rsize=1024,wsize=1024 nfsaddrs=192.168.0.101:192.168.0.1:192.168.0.1:255.255.255.0:mappi001 mem=32M \0" -end - -# Boot -define boot - set_kernel_parameters - set $fp = 0 - set $pc = 0x08002000 -# set *(unsigned char *)0xffffffff = 0x03 - si - c -end - -# Set breakpoints -define set_breakpoints - b *0x08000030 -end - -# Restart -define restart - sdireset - sdireset - set $pc = 0 - b *0x04001000 - b *0x08001000 - b *0x08002000 - si - c - tlb_init - del - setup - load_modules - boot -end - -define si - stepi - x/i $pc - show_reg -end - -sdireset -sdireset -file vmlinux -target m32rsdi -set $pc = 0 -b *0x04001000 -b *0x08001000 -b *0x08002000 -c -tlb_init -del -setup -load_modules -boot - diff --git a/arch/m32r/platforms/m32700ut/io.c b/arch/m32r/platforms/m32700ut/io.c deleted file mode 100644 index 6862586e58dbd..0000000000000 --- a/arch/m32r/platforms/m32700ut/io.c +++ /dev/null @@ -1,395 +0,0 @@ -/* - * linux/arch/m32r/platforms/m32700ut/io.c - * - * Typical I/O routines for M32700UT board. - * - * Copyright (c) 2001-2005 Hiroyuki Kondo, Hirokazu Takata, - * Hitoshi Yamamoto, Takeo Takahashi - * - * This file is subject to 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 -#include -#include -#include - -#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) -#include - -#define M32R_PCC_IOMAP_SIZE 0x1000 - -#define M32R_PCC_IOSTART0 0x1000 -#define M32R_PCC_IOEND0 (M32R_PCC_IOSTART0 + M32R_PCC_IOMAP_SIZE - 1) - -extern void pcc_ioread_byte(int, unsigned long, void *, size_t, size_t, int); -extern void pcc_ioread_word(int, unsigned long, void *, size_t, size_t, int); -extern void pcc_iowrite_byte(int, unsigned long, void *, size_t, size_t, int); -extern void pcc_iowrite_word(int, unsigned long, void *, size_t, size_t, int); -#endif /* CONFIG_PCMCIA && CONFIG_M32R_CFC */ - -#define PORT2ADDR(port) _port2addr(port) -#define PORT2ADDR_USB(port) _port2addr_usb(port) - -static inline void *_port2addr(unsigned long port) -{ - return (void *)(port | NONCACHE_OFFSET); -} - -#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) -static inline void *__port2addr_ata(unsigned long port) -{ - static int dummy_reg; - - switch (port) { - case 0x1f0: return (void *)(0x0c002000 | NONCACHE_OFFSET); - case 0x1f1: return (void *)(0x0c012800 | NONCACHE_OFFSET); - case 0x1f2: return (void *)(0x0c012002 | NONCACHE_OFFSET); - case 0x1f3: return (void *)(0x0c012802 | NONCACHE_OFFSET); - case 0x1f4: return (void *)(0x0c012004 | NONCACHE_OFFSET); - case 0x1f5: return (void *)(0x0c012804 | NONCACHE_OFFSET); - case 0x1f6: return (void *)(0x0c012006 | NONCACHE_OFFSET); - case 0x1f7: return (void *)(0x0c012806 | NONCACHE_OFFSET); - case 0x3f6: return (void *)(0x0c01200e | NONCACHE_OFFSET); - default: return (void *)&dummy_reg; - } -} -#endif - -/* - * M32700UT-LAN is located in the extended bus space - * from 0x10000000 to 0x13ffffff on physical address. - * The base address of LAN controller(LAN91C111) is 0x300. - */ -#define LAN_IOSTART (0x300 | NONCACHE_OFFSET) -#define LAN_IOEND (0x320 | NONCACHE_OFFSET) -static inline void *_port2addr_ne(unsigned long port) -{ - return (void *)(port + 0x10000000); -} -static inline void *_port2addr_usb(unsigned long port) -{ - return (void *)((port & 0x0f) + NONCACHE_OFFSET + 0x10303000); -} - -static inline void delay(void) -{ - __asm__ __volatile__ ("push r0; \n\t pop r0;" : : :"memory"); -} - -/* - * NIC I/O function - */ - -#define PORT2ADDR_NE(port) _port2addr_ne(port) - -static inline unsigned char _ne_inb(void *portp) -{ - return *(volatile unsigned char *)portp; -} - -static inline unsigned short _ne_inw(void *portp) -{ - return (unsigned short)le16_to_cpu(*(volatile unsigned short *)portp); -} - -static inline void _ne_insb(void *portp, void *addr, unsigned long count) -{ - unsigned char *buf = (unsigned char *)addr; - - while (count--) - *buf++ = _ne_inb(portp); -} - -static inline void _ne_outb(unsigned char b, void *portp) -{ - *(volatile unsigned char *)portp = b; -} - -static inline void _ne_outw(unsigned short w, void *portp) -{ - *(volatile unsigned short *)portp = cpu_to_le16(w); -} - -unsigned char _inb(unsigned long port) -{ - if (port >= LAN_IOSTART && port < LAN_IOEND) - return _ne_inb(PORT2ADDR_NE(port)); - -#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) - else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { - return *(volatile unsigned char *)__port2addr_ata(port); - } -#endif -#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) - else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { - unsigned char b; - pcc_ioread_byte(0, port, &b, sizeof(b), 1, 0); - return b; - } else -#endif - - return *(volatile unsigned char *)PORT2ADDR(port); -} - -unsigned short _inw(unsigned long port) -{ - if (port >= LAN_IOSTART && port < LAN_IOEND) - return _ne_inw(PORT2ADDR_NE(port)); -#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) - else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { - return *(volatile unsigned short *)__port2addr_ata(port); - } -#endif -#if defined(CONFIG_USB) - else if(port >= 0x340 && port < 0x3a0) - return *(volatile unsigned short *)PORT2ADDR_USB(port); -#endif -#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) - else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { - unsigned short w; - pcc_ioread_word(0, port, &w, sizeof(w), 1, 0); - return w; - } else -#endif - return *(volatile unsigned short *)PORT2ADDR(port); -} - -unsigned long _inl(unsigned long port) -{ -#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) - if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { - unsigned long l; - pcc_ioread_word(0, port, &l, sizeof(l), 1, 0); - return l; - } else -#endif - return *(volatile unsigned long *)PORT2ADDR(port); -} - -unsigned char _inb_p(unsigned long port) -{ - unsigned char v = _inb(port); - delay(); - return (v); -} - -unsigned short _inw_p(unsigned long port) -{ - unsigned short v = _inw(port); - delay(); - return (v); -} - -unsigned long _inl_p(unsigned long port) -{ - unsigned long v = _inl(port); - delay(); - return (v); -} - -void _outb(unsigned char b, unsigned long port) -{ - if (port >= LAN_IOSTART && port < LAN_IOEND) - _ne_outb(b, PORT2ADDR_NE(port)); - else -#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) - if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { - *(volatile unsigned char *)__port2addr_ata(port) = b; - } else -#endif -#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) - if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { - pcc_iowrite_byte(0, port, &b, sizeof(b), 1, 0); - } else -#endif - *(volatile unsigned char *)PORT2ADDR(port) = b; -} - -void _outw(unsigned short w, unsigned long port) -{ - if (port >= LAN_IOSTART && port < LAN_IOEND) - _ne_outw(w, PORT2ADDR_NE(port)); - else -#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) - if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { - *(volatile unsigned short *)__port2addr_ata(port) = w; - } else -#endif -#if defined(CONFIG_USB) - if(port >= 0x340 && port < 0x3a0) - *(volatile unsigned short *)PORT2ADDR_USB(port) = w; - else -#endif -#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) - if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { - pcc_iowrite_word(0, port, &w, sizeof(w), 1, 0); - } else -#endif - *(volatile unsigned short *)PORT2ADDR(port) = w; -} - -void _outl(unsigned long l, unsigned long port) -{ -#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) - if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { - pcc_iowrite_word(0, port, &l, sizeof(l), 1, 0); - } else -#endif - *(volatile unsigned long *)PORT2ADDR(port) = l; -} - -void _outb_p(unsigned char b, unsigned long port) -{ - _outb(b, port); - delay(); -} - -void _outw_p(unsigned short w, unsigned long port) -{ - _outw(w, port); - delay(); -} - -void _outl_p(unsigned long l, unsigned long port) -{ - _outl(l, port); - delay(); -} - -void _insb(unsigned int port, void *addr, unsigned long count) -{ - if (port >= LAN_IOSTART && port < LAN_IOEND) - _ne_insb(PORT2ADDR_NE(port), addr, count); -#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) - else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { - unsigned char *buf = addr; - unsigned char *portp = __port2addr_ata(port); - while (count--) - *buf++ = *(volatile unsigned char *)portp; - } -#endif -#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) - else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { - pcc_ioread_byte(0, port, (void *)addr, sizeof(unsigned char), - count, 1); - } -#endif - else { - unsigned char *buf = addr; - unsigned char *portp = PORT2ADDR(port); - while (count--) - *buf++ = *(volatile unsigned char *)portp; - } -} - -void _insw(unsigned int port, void *addr, unsigned long count) -{ - unsigned short *buf = addr; - unsigned short *portp; - - if (port >= LAN_IOSTART && port < LAN_IOEND) { - /* - * This portion is only used by smc91111.c to read data - * from the DATA_REG. Do not swap the data. - */ - portp = PORT2ADDR_NE(port); - while (count--) - *buf++ = *(volatile unsigned short *)portp; -#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) - } else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { - pcc_ioread_word(9, port, (void *)addr, sizeof(unsigned short), - count, 1); -#endif -#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) - } else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { - portp = __port2addr_ata(port); - while (count--) - *buf++ = *(volatile unsigned short *)portp; -#endif - } else { - portp = PORT2ADDR(port); - while (count--) - *buf++ = *(volatile unsigned short *)portp; - } -} - -void _insl(unsigned int port, void *addr, unsigned long count) -{ - unsigned long *buf = addr; - unsigned long *portp; - - portp = PORT2ADDR(port); - while (count--) - *buf++ = *(volatile unsigned long *)portp; -} - -void _outsb(unsigned int port, const void *addr, unsigned long count) -{ - const unsigned char *buf = addr; - unsigned char *portp; - - if (port >= LAN_IOSTART && port < LAN_IOEND) { - portp = PORT2ADDR_NE(port); - while (count--) - _ne_outb(*buf++, portp); -#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) - } else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { - portp = __port2addr_ata(port); - while (count--) - *(volatile unsigned char *)portp = *buf++; -#endif -#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) - } else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { - pcc_iowrite_byte(0, port, (void *)addr, sizeof(unsigned char), - count, 1); -#endif - } else { - portp = PORT2ADDR(port); - while (count--) - *(volatile unsigned char *)portp = *buf++; - } -} - -void _outsw(unsigned int port, const void *addr, unsigned long count) -{ - const unsigned short *buf = addr; - unsigned short *portp; - - if (port >= LAN_IOSTART && port < LAN_IOEND) { - /* - * This portion is only used by smc91111.c to write data - * into the DATA_REG. Do not swap the data. - */ - portp = PORT2ADDR_NE(port); - while (count--) - *(volatile unsigned short *)portp = *buf++; -#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) - } else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) { - portp = __port2addr_ata(port); - while (count--) - *(volatile unsigned short *)portp = *buf++; -#endif -#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC) - } else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) { - pcc_iowrite_word(9, port, (void *)addr, sizeof(unsigned short), - count, 1); -#endif - } else { - portp = PORT2ADDR(port); - while (count--) - *(volatile unsigned short *)portp = *buf++; - } -} - -void _outsl(unsigned int port, const void *addr, unsigned long count) -{ - const unsigned long *buf = addr; - unsigned char *portp; - - portp = PORT2ADDR(port); - while (count--) - *(volatile unsigned long *)portp = *buf++; -} diff --git a/arch/m32r/platforms/m32700ut/setup.c b/arch/m32r/platforms/m32700ut/setup.c deleted file mode 100644 index 349eb341752c4..0000000000000 --- a/arch/m32r/platforms/m32700ut/setup.c +++ /dev/null @@ -1,451 +0,0 @@ -/* - * linux/arch/m32r/platforms/m32700ut/setup.c - * - * Setup routines for Renesas M32700UT Board - * - * Copyright (c) 2002-2005 Hiroyuki Kondo, Hirokazu Takata, - * Hitoshi Yamamoto, Takeo Takahashi - * - * This file is subject to 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 -#include -#include -#include - -#include -#include - -/* - * M32700 Interrupt Control Unit (Level 1) - */ -#define irq2port(x) (M32R_ICU_CR1_PORTL + ((x - 1) * sizeof(unsigned long))) - -icu_data_t icu_data[M32700UT_NUM_CPU_IRQ]; - -static void disable_m32700ut_irq(unsigned int irq) -{ - unsigned long port, data; - - port = irq2port(irq); - data = icu_data[irq].icucr|M32R_ICUCR_ILEVEL7; - outl(data, port); -} - -static void enable_m32700ut_irq(unsigned int irq) -{ - unsigned long port, data; - - port = irq2port(irq); - data = icu_data[irq].icucr|M32R_ICUCR_IEN|M32R_ICUCR_ILEVEL6; - outl(data, port); -} - -static void mask_m32700ut(struct irq_data *data) -{ - disable_m32700ut_irq(data->irq); -} - -static void unmask_m32700ut(struct irq_data *data) -{ - enable_m32700ut_irq(data->irq); -} - -static void shutdown_m32700ut(struct irq_data *data) -{ - unsigned long port; - - port = irq2port(data->irq); - outl(M32R_ICUCR_ILEVEL7, port); -} - -static struct irq_chip m32700ut_irq_type = -{ - .name = "M32700UT-IRQ", - .irq_shutdown = shutdown_m32700ut, - .irq_mask = mask_m32700ut, - .irq_unmask = unmask_m32700ut -}; - -/* - * Interrupt Control Unit of PLD on M32700UT (Level 2) - */ -#define irq2pldirq(x) ((x) - M32700UT_PLD_IRQ_BASE) -#define pldirq2port(x) (unsigned long)((int)PLD_ICUCR1 + \ - (((x) - 1) * sizeof(unsigned short))) - -typedef struct { - unsigned short icucr; /* ICU Control Register */ -} pld_icu_data_t; - -static pld_icu_data_t pld_icu_data[M32700UT_NUM_PLD_IRQ]; - -static void disable_m32700ut_pld_irq(unsigned int irq) -{ - unsigned long port, data; - unsigned int pldirq; - - pldirq = irq2pldirq(irq); - port = pldirq2port(pldirq); - data = pld_icu_data[pldirq].icucr|PLD_ICUCR_ILEVEL7; - outw(data, port); -} - -static void enable_m32700ut_pld_irq(unsigned int irq) -{ - unsigned long port, data; - unsigned int pldirq; - - pldirq = irq2pldirq(irq); - port = pldirq2port(pldirq); - data = pld_icu_data[pldirq].icucr|PLD_ICUCR_IEN|PLD_ICUCR_ILEVEL6; - outw(data, port); -} - -static void mask_m32700ut_pld(struct irq_data *data) -{ - disable_m32700ut_pld_irq(data->irq); -} - -static void unmask_m32700ut_pld(struct irq_data *data) -{ - enable_m32700ut_pld_irq(data->irq); - enable_m32700ut_irq(M32R_IRQ_INT1); -} - -static void shutdown_m32700ut_pld_irq(struct irq_data *data) -{ - unsigned long port; - unsigned int pldirq; - - pldirq = irq2pldirq(data->irq); - port = pldirq2port(pldirq); - outw(PLD_ICUCR_ILEVEL7, port); -} - -static struct irq_chip m32700ut_pld_irq_type = -{ - .name = "M32700UT-PLD-IRQ", - .irq_shutdown = shutdown_m32700ut_pld_irq, - .irq_mask = mask_m32700ut_pld, - .irq_unmask = unmask_m32700ut_pld, -}; - -/* - * Interrupt Control Unit of PLD on M32700UT-LAN (Level 2) - */ -#define irq2lanpldirq(x) ((x) - M32700UT_LAN_PLD_IRQ_BASE) -#define lanpldirq2port(x) (unsigned long)((int)M32700UT_LAN_ICUCR1 + \ - (((x) - 1) * sizeof(unsigned short))) - -static pld_icu_data_t lanpld_icu_data[M32700UT_NUM_LAN_PLD_IRQ]; - -static void disable_m32700ut_lanpld_irq(unsigned int irq) -{ - unsigned long port, data; - unsigned int pldirq; - - pldirq = irq2lanpldirq(irq); - port = lanpldirq2port(pldirq); - data = lanpld_icu_data[pldirq].icucr|PLD_ICUCR_ILEVEL7; - outw(data, port); -} - -static void enable_m32700ut_lanpld_irq(unsigned int irq) -{ - unsigned long port, data; - unsigned int pldirq; - - pldirq = irq2lanpldirq(irq); - port = lanpldirq2port(pldirq); - data = lanpld_icu_data[pldirq].icucr|PLD_ICUCR_IEN|PLD_ICUCR_ILEVEL6; - outw(data, port); -} - -static void mask_m32700ut_lanpld(struct irq_data *data) -{ - disable_m32700ut_lanpld_irq(data->irq); -} - -static void unmask_m32700ut_lanpld(struct irq_data *data) -{ - enable_m32700ut_lanpld_irq(data->irq); - enable_m32700ut_irq(M32R_IRQ_INT0); -} - -static void shutdown_m32700ut_lanpld(struct irq_data *data) -{ - unsigned long port; - unsigned int pldirq; - - pldirq = irq2lanpldirq(data->irq); - port = lanpldirq2port(pldirq); - outw(PLD_ICUCR_ILEVEL7, port); -} - -static struct irq_chip m32700ut_lanpld_irq_type = -{ - .name = "M32700UT-PLD-LAN-IRQ", - .irq_shutdown = shutdown_m32700ut_lanpld, - .irq_mask = mask_m32700ut_lanpld, - .irq_unmask = unmask_m32700ut_lanpld, -}; - -/* - * Interrupt Control Unit of PLD on M32700UT-LCD (Level 2) - */ -#define irq2lcdpldirq(x) ((x) - M32700UT_LCD_PLD_IRQ_BASE) -#define lcdpldirq2port(x) (unsigned long)((int)M32700UT_LCD_ICUCR1 + \ - (((x) - 1) * sizeof(unsigned short))) - -#ifdef CONFIG_USB -static pld_icu_data_t lcdpld_icu_data[M32700UT_NUM_LCD_PLD_IRQ]; - -static void disable_m32700ut_lcdpld_irq(unsigned int irq) -{ - unsigned long port, data; - unsigned int pldirq; - - pldirq = irq2lcdpldirq(irq); - port = lcdpldirq2port(pldirq); - data = lcdpld_icu_data[pldirq].icucr|PLD_ICUCR_ILEVEL7; - outw(data, port); -} - -static void enable_m32700ut_lcdpld_irq(unsigned int irq) -{ - unsigned long port, data; - unsigned int pldirq; - - pldirq = irq2lcdpldirq(irq); - port = lcdpldirq2port(pldirq); - data = lcdpld_icu_data[pldirq].icucr|PLD_ICUCR_IEN|PLD_ICUCR_ILEVEL6; - outw(data, port); -} - -static void mask_m32700ut_lcdpld(struct irq_data *data) -{ - disable_m32700ut_lcdpld_irq(data->irq); -} - -static void unmask_m32700ut_lcdpld(struct irq_data *data) -{ - enable_m32700ut_lcdpld_irq(data->irq); - enable_m32700ut_irq(M32R_IRQ_INT2); -} - -static void shutdown_m32700ut_lcdpld(struct irq_data *data) -{ - unsigned long port; - unsigned int pldirq; - - pldirq = irq2lcdpldirq(data->irq); - port = lcdpldirq2port(pldirq); - outw(PLD_ICUCR_ILEVEL7, port); -} - -static struct irq_chip m32700ut_lcdpld_irq_type = -{ - .name = "M32700UT-PLD-LCD-IRQ", - .irq_shutdown = shutdown_m32700ut_lcdpld, - .irq_mask = mask_m32700ut_lcdpld, - .irq_unmask = unmask_m32700ut_lcdpld, -}; -#endif - -void __init init_IRQ(void) -{ -#if defined(CONFIG_SMC91X) - /* INT#0: LAN controller on M32700UT-LAN (SMC91C111)*/ - irq_set_chip_and_handler(M32700UT_LAN_IRQ_LAN, - &m32700ut_lanpld_irq_type, handle_level_irq); - lanpld_icu_data[irq2lanpldirq(M32700UT_LAN_IRQ_LAN)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD02; /* "H" edge sense */ - disable_m32700ut_lanpld_irq(M32700UT_LAN_IRQ_LAN); -#endif /* CONFIG_SMC91X */ - - /* MFT2 : system timer */ - irq_set_chip_and_handler(M32R_IRQ_MFT2, &m32700ut_irq_type, - handle_level_irq); - icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN; - disable_m32700ut_irq(M32R_IRQ_MFT2); - - /* SIO0 : receive */ - irq_set_chip_and_handler(M32R_IRQ_SIO0_R, &m32700ut_irq_type, - handle_level_irq); - icu_data[M32R_IRQ_SIO0_R].icucr = 0; - disable_m32700ut_irq(M32R_IRQ_SIO0_R); - - /* SIO0 : send */ - irq_set_chip_and_handler(M32R_IRQ_SIO0_S, &m32700ut_irq_type, - handle_level_irq); - icu_data[M32R_IRQ_SIO0_S].icucr = 0; - disable_m32700ut_irq(M32R_IRQ_SIO0_S); - - /* SIO1 : receive */ - irq_set_chip_and_handler(M32R_IRQ_SIO1_R, &m32700ut_irq_type, - handle_level_irq); - icu_data[M32R_IRQ_SIO1_R].icucr = 0; - disable_m32700ut_irq(M32R_IRQ_SIO1_R); - - /* SIO1 : send */ - irq_set_chip_and_handler(M32R_IRQ_SIO1_S, &m32700ut_irq_type, - handle_level_irq); - icu_data[M32R_IRQ_SIO1_S].icucr = 0; - disable_m32700ut_irq(M32R_IRQ_SIO1_S); - - /* DMA1 : */ - irq_set_chip_and_handler(M32R_IRQ_DMA1, &m32700ut_irq_type, - handle_level_irq); - icu_data[M32R_IRQ_DMA1].icucr = 0; - disable_m32700ut_irq(M32R_IRQ_DMA1); - -#ifdef CONFIG_SERIAL_M32R_PLDSIO - /* INT#1: SIO0 Receive on PLD */ - irq_set_chip_and_handler(PLD_IRQ_SIO0_RCV, &m32700ut_pld_irq_type, - handle_level_irq); - pld_icu_data[irq2pldirq(PLD_IRQ_SIO0_RCV)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD03; - disable_m32700ut_pld_irq(PLD_IRQ_SIO0_RCV); - - /* INT#1: SIO0 Send on PLD */ - irq_set_chip_and_handler(PLD_IRQ_SIO0_SND, &m32700ut_pld_irq_type, - handle_level_irq); - pld_icu_data[irq2pldirq(PLD_IRQ_SIO0_SND)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD03; - disable_m32700ut_pld_irq(PLD_IRQ_SIO0_SND); -#endif /* CONFIG_SERIAL_M32R_PLDSIO */ - - /* INT#1: CFC IREQ on PLD */ - irq_set_chip_and_handler(PLD_IRQ_CFIREQ, &m32700ut_pld_irq_type, - handle_level_irq); - pld_icu_data[irq2pldirq(PLD_IRQ_CFIREQ)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD01; /* 'L' level sense */ - disable_m32700ut_pld_irq(PLD_IRQ_CFIREQ); - - /* INT#1: CFC Insert on PLD */ - irq_set_chip_and_handler(PLD_IRQ_CFC_INSERT, &m32700ut_pld_irq_type, - handle_level_irq); - pld_icu_data[irq2pldirq(PLD_IRQ_CFC_INSERT)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD00; /* 'L' edge sense */ - disable_m32700ut_pld_irq(PLD_IRQ_CFC_INSERT); - - /* INT#1: CFC Eject on PLD */ - irq_set_chip_and_handler(PLD_IRQ_CFC_EJECT, &m32700ut_pld_irq_type, - handle_level_irq); - pld_icu_data[irq2pldirq(PLD_IRQ_CFC_EJECT)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD02; /* 'H' edge sense */ - disable_m32700ut_pld_irq(PLD_IRQ_CFC_EJECT); - - /* - * INT0# is used for LAN, DIO - * We enable it here. - */ - icu_data[M32R_IRQ_INT0].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD11; - enable_m32700ut_irq(M32R_IRQ_INT0); - - /* - * INT1# is used for UART, MMC, CF Controller in FPGA. - * We enable it here. - */ - icu_data[M32R_IRQ_INT1].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD11; - enable_m32700ut_irq(M32R_IRQ_INT1); - -#if defined(CONFIG_USB) - outw(USBCR_OTGS, USBCR); /* USBCR: non-OTG */ - irq_set_chip_and_handler(M32700UT_LCD_IRQ_USB_INT1, - &m32700ut_lcdpld_irq_type, handle_level_irq); - - lcdpld_icu_data[irq2lcdpldirq(M32700UT_LCD_IRQ_USB_INT1)].icucr = PLD_ICUCR_IEN|PLD_ICUCR_ISMOD01; /* "L" level sense */ - disable_m32700ut_lcdpld_irq(M32700UT_LCD_IRQ_USB_INT1); -#endif - /* - * INT2# is used for BAT, USB, AUDIO - * We enable it here. - */ - icu_data[M32R_IRQ_INT2].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD01; - enable_m32700ut_irq(M32R_IRQ_INT2); - -#if defined(CONFIG_VIDEO_M32R_AR) - /* - * INT3# is used for AR - */ - irq_set_chip_and_handler(M32R_IRQ_INT3, &m32700ut_irq_type, - handle_level_irq); - icu_data[M32R_IRQ_INT3].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10; - disable_m32700ut_irq(M32R_IRQ_INT3); -#endif /* CONFIG_VIDEO_M32R_AR */ -} - -#if defined(CONFIG_SMC91X) - -#define LAN_IOSTART 0x300 -#define LAN_IOEND 0x320 -static struct resource smc91x_resources[] = { - [0] = { - .start = (LAN_IOSTART), - .end = (LAN_IOEND), - .flags = IORESOURCE_MEM, - }, - [1] = { - .start = M32700UT_LAN_IRQ_LAN, - .end = M32700UT_LAN_IRQ_LAN, - .flags = IORESOURCE_IRQ, - } -}; - -static struct platform_device smc91x_device = { - .name = "smc91x", - .id = 0, - .num_resources = ARRAY_SIZE(smc91x_resources), - .resource = smc91x_resources, -}; -#endif - -#if defined(CONFIG_FB_S1D13XXX) - -#include