Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'asm-generic-5.19' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic

Pull asm-generic updates from Arnd Bergmann:
"The asm-generic tree contains three separate changes for linux-5.19:

- The h8300 architecture is retired after it has been effectively
unmaintained for a number of years. This is the last architecture
we supported that has no MMU implementation, but there are still a
few architectures (arm, m68k, riscv, sh and xtensa) that support
CPUs with and without an MMU.

- A series to add a generic ticket spinlock that can be shared by
most architectures with a working cmpxchg or ll/sc type atomic,
including the conversion of riscv, csky and openrisc. This series
is also a prerequisite for the loongarch64 architecture port that
will come as a separate pull request.

- A cleanup of some exported uapi header files to ensure they can be
included from user space without relying on other kernel headers"

* tag 'asm-generic-5.19' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic:
h8300: remove stale bindings and symlink
sparc: add asm/stat.h to UAPI compile-test coverage
powerpc: add asm/stat.h to UAPI compile-test coverage
mips: add asm/stat.h to UAPI compile-test coverage
riscv: add linux/bpf_perf_event.h to UAPI compile-test coverage
kbuild: prevent exported headers from including <stdlib.h>, <stdbool.h>
agpgart.h: do not include <stdlib.h> from exported header
csky: Move to generic ticket-spinlock
RISC-V: Move to queued RW locks
RISC-V: Move to generic spinlocks
openrisc: Move to ticket-spinlock
asm-generic: qrwlock: Document the spinlock fairness requirements
asm-generic: qspinlock: Indicate the use of mixed-size atomics
asm-generic: ticket-lock: New generic ticket-based spinlock
remove the h8300 architecture

+192 -7353
-24
Documentation/devicetree/bindings/clock/renesas,h8300-div-clock.txt
··· 1 - * Renesas H8/300 divider clock 2 - 3 - Required Properties: 4 - 5 - - compatible: Must be "renesas,h8300-div-clock" 6 - 7 - - clocks: Reference to the parent clocks ("extal1" and "extal2") 8 - 9 - - #clock-cells: Must be 1 10 - 11 - - reg: Base address and length of the divide rate selector 12 - 13 - - renesas,width: bit width of selector 14 - 15 - Example 16 - ------- 17 - 18 - cclk: cclk { 19 - compatible = "renesas,h8300-div-clock"; 20 - clocks = <&xclk>; 21 - #clock-cells = <0>; 22 - reg = <0xfee01b 2>; 23 - renesas,width = <2>; 24 - };
-23
Documentation/devicetree/bindings/clock/renesas,h8s2678-pll-clock.txt
··· 1 - Renesas H8S2678 PLL clock 2 - 3 - This device is Clock multiplyer 4 - 5 - Required Properties: 6 - 7 - - compatible: Must be "renesas,h8s2678-pll-clock" 8 - 9 - - clocks: Reference to the parent clocks 10 - 11 - - #clock-cells: Must be 0 12 - 13 - - reg: Two rate selector (Multiply / Divide) register address 14 - 15 - Example 16 - ------- 17 - 18 - pllclk: pllclk { 19 - compatible = "renesas,h8s2678-pll-clock"; 20 - clocks = <&xclk>; 21 - #clock-cells = <0>; 22 - reg = <0xfee03b 2>, <0xfee045 2>; 23 - };
-13
Documentation/devicetree/bindings/h8300/cpu.txt
··· 1 - * H8/300 CPU bindings 2 - 3 - Required properties: 4 - 5 - - compatible: Compatible property value should be "renesas,h8300". 6 - - clock-frequency: Contains the clock frequency for CPU, in Hz. 7 - 8 - Example: 9 - 10 - cpu@0 { 11 - compatible = "renesas,h8300"; 12 - clock-frequency = <20000000>; 13 - };
-22
Documentation/devicetree/bindings/interrupt-controller/renesas,h8300h-intc.txt
··· 1 - * H8/300H Interrupt controller 2 - 3 - Required properties: 4 - 5 - - compatible: has to be "renesas,h8300h-intc", "renesas,h8300-intc" as fallback. 6 - - #interrupt-cells: has to be <2>: an interrupt index and flags, as defined in 7 - interrupts.txt in this directory 8 - - regs: Base address of interrupt controller registers. 9 - 10 - Optional properties: 11 - 12 - - any properties, listed in interrupts.txt, and any standard resource allocation 13 - properties 14 - 15 - Example: 16 - 17 - h8intc: interrupt-controller@fee012 { 18 - compatible = "renesas,h8300h-intc", "renesas,h8300-intc"; 19 - #interrupt-cells = <2>; 20 - interrupt-controller; 21 - reg = <0xfee012 7>; 22 - };
-22
Documentation/devicetree/bindings/interrupt-controller/renesas,h8s-intc.txt
··· 1 - * H8S Interrupt controller 2 - 3 - Required properties: 4 - 5 - - compatible: has to be "renesas,h8s-intc", "renesas,h8300-intc" as fallback. 6 - - #interrupt-cells: has to be <2>: an interrupt index and flags, as defined in 7 - interrupts.txt in this directory 8 - - regs: Base address of interrupt controller registers. 9 - 10 - Optional properties: 11 - 12 - - any properties, listed in interrupts.txt, and any standard resource allocation 13 - properties 14 - 15 - Example: 16 - 17 - h8intc: interrupt-controller@fffe00 { 18 - compatible = "renesas,h8s-intc", "renesas,h8300-intc"; 19 - #interrupt-cells = <2>; 20 - interrupt-controller; 21 - reg = <0xfffe00 24>; 22 - };
-35
Documentation/devicetree/bindings/memory-controllers/renesas,h8300-bsc.yaml
··· 1 - # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 - %YAML 1.2 3 - --- 4 - $id: http://devicetree.org/schemas/memory-controllers/renesas,h8300-bsc.yaml# 5 - $schema: http://devicetree.org/meta-schemas/core.yaml# 6 - 7 - title: H8/300 bus controller 8 - 9 - maintainers: 10 - - Krzysztof Kozlowski <krzk@kernel.org> 11 - - Yoshinori Sato <ysato@users.sourceforge.jp> 12 - 13 - properties: 14 - compatible: 15 - items: 16 - - enum: 17 - - renesas,h8300h-bsc 18 - - renesas,h8s-bsc 19 - - const: renesas,h8300-bsc 20 - 21 - reg: 22 - maxItems: 1 23 - 24 - required: 25 - - compatible 26 - - reg 27 - 28 - additionalProperties: false 29 - 30 - examples: 31 - - | 32 - memory-controller@fee01e { 33 - compatible = "renesas,h8300h-bsc", "renesas,h8300-bsc"; 34 - reg = <0xfee01e 8>; 35 - };
-25
Documentation/devicetree/bindings/timer/renesas,16bit-timer.txt
··· 1 - * Renesas H8/300 16bit timer 2 - 3 - The 16bit timer is a 16bit timer/counter with configurable clock inputs and 4 - programmable compare match. 5 - 6 - Required Properties: 7 - 8 - - compatible: must contain "renesas,16bit-timer" 9 - - reg: base address and length of the registers block for the timer module. 10 - - interrupts: interrupt-specifier for the timer, IMIA 11 - - clocks: a list of phandle, one for each entry in clock-names. 12 - - clock-names: must contain "peripheral_clk" for the functional clock. 13 - - renesas,channel: timer channel number. 14 - 15 - Example: 16 - 17 - timer16: timer@ffff68 { 18 - compatible = "reneas,16bit-timer"; 19 - reg = <0xffff68 8>, <0xffff60 8>; 20 - interrupts = <24>; 21 - renesas,channel = <0>; 22 - clocks = <&pclk>; 23 - clock-names = "peripheral_clk"; 24 - }; 25 -
-25
Documentation/devicetree/bindings/timer/renesas,8bit-timer.txt
··· 1 - * Renesas H8/300 8bit timer 2 - 3 - The 8bit timer is a 8bit timer/counter with configurable clock inputs and 4 - programmable compare match. 5 - 6 - This implement only supported cascade mode. 7 - 8 - Required Properties: 9 - 10 - - compatible: must contain "renesas,8bit-timer" 11 - - reg: base address and length of the registers block for the timer module. 12 - - interrupts: interrupt-specifier for the timer, CMIA and TOVI 13 - - clocks: a list of phandle, one for each entry in clock-names. 14 - - clock-names: must contain "fck" for the functional clock. 15 - 16 - Example: 17 - 18 - timer8_0: timer@ffff80 { 19 - compatible = "renesas,8bit-timer"; 20 - reg = <0xffff80 10>; 21 - interrupts = <36>; 22 - clocks = <&fclk>; 23 - clock-names = "fck"; 24 - }; 25 -
-1
Documentation/features/core/cBPF-JIT/arch-support.txt
··· 11 11 | arm: | TODO | 12 12 | arm64: | TODO | 13 13 | csky: | TODO | 14 - | h8300: | TODO | 15 14 | hexagon: | TODO | 16 15 | ia64: | TODO | 17 16 | m68k: | TODO |
-1
Documentation/features/core/eBPF-JIT/arch-support.txt
··· 11 11 | arm: | ok | 12 12 | arm64: | ok | 13 13 | csky: | TODO | 14 - | h8300: | TODO | 15 14 | hexagon: | TODO | 16 15 | ia64: | TODO | 17 16 | m68k: | TODO |
-1
Documentation/features/core/generic-idle-thread/arch-support.txt
··· 11 11 | arm: | ok | 12 12 | arm64: | ok | 13 13 | csky: | ok | 14 - | h8300: | TODO | 15 14 | hexagon: | ok | 16 15 | ia64: | ok | 17 16 | m68k: | TODO |
-1
Documentation/features/core/jump-labels/arch-support.txt
··· 11 11 | arm: | ok | 12 12 | arm64: | ok | 13 13 | csky: | TODO | 14 - | h8300: | TODO | 15 14 | hexagon: | TODO | 16 15 | ia64: | TODO | 17 16 | m68k: | TODO |
-1
Documentation/features/core/thread-info-in-task/arch-support.txt
··· 11 11 | arm: | ok | 12 12 | arm64: | ok | 13 13 | csky: | TODO | 14 - | h8300: | TODO | 15 14 | hexagon: | TODO | 16 15 | ia64: | TODO | 17 16 | m68k: | TODO |
-1
Documentation/features/core/tracehook/arch-support.txt
··· 11 11 | arm: | ok | 12 12 | arm64: | ok | 13 13 | csky: | ok | 14 - | h8300: | TODO | 15 14 | hexagon: | ok | 16 15 | ia64: | ok | 17 16 | m68k: | TODO |
-1
Documentation/features/debug/KASAN/arch-support.txt
··· 11 11 | arm: | ok | 12 12 | arm64: | ok | 13 13 | csky: | TODO | 14 - | h8300: | TODO | 15 14 | hexagon: | TODO | 16 15 | ia64: | TODO | 17 16 | m68k: | TODO |
-1
Documentation/features/debug/debug-vm-pgtable/arch-support.txt
··· 11 11 | arm: | TODO | 12 12 | arm64: | ok | 13 13 | csky: | TODO | 14 - | h8300: | TODO | 15 14 | hexagon: | TODO | 16 15 | ia64: | TODO | 17 16 | m68k: | TODO |
-1
Documentation/features/debug/gcov-profile-all/arch-support.txt
··· 11 11 | arm: | ok | 12 12 | arm64: | ok | 13 13 | csky: | ok | 14 - | h8300: | TODO | 15 14 | hexagon: | TODO | 16 15 | ia64: | TODO | 17 16 | m68k: | TODO |
-1
Documentation/features/debug/kcov/arch-support.txt
··· 11 11 | arm: | ok | 12 12 | arm64: | ok | 13 13 | csky: | TODO | 14 - | h8300: | TODO | 15 14 | hexagon: | TODO | 16 15 | ia64: | TODO | 17 16 | m68k: | TODO |
-1
Documentation/features/debug/kgdb/arch-support.txt
··· 11 11 | arm: | ok | 12 12 | arm64: | ok | 13 13 | csky: | TODO | 14 - | h8300: | ok | 15 14 | hexagon: | ok | 16 15 | ia64: | TODO | 17 16 | m68k: | TODO |
-1
Documentation/features/debug/kmemleak/arch-support.txt
··· 11 11 | arm: | ok | 12 12 | arm64: | ok | 13 13 | csky: | ok | 14 - | h8300: | TODO | 15 14 | hexagon: | TODO | 16 15 | ia64: | TODO | 17 16 | m68k: | TODO |
-1
Documentation/features/debug/kprobes-on-ftrace/arch-support.txt
··· 11 11 | arm: | TODO | 12 12 | arm64: | TODO | 13 13 | csky: | ok | 14 - | h8300: | TODO | 15 14 | hexagon: | TODO | 16 15 | ia64: | TODO | 17 16 | m68k: | TODO |
-1
Documentation/features/debug/kprobes/arch-support.txt
··· 11 11 | arm: | ok | 12 12 | arm64: | ok | 13 13 | csky: | ok | 14 - | h8300: | TODO | 15 14 | hexagon: | TODO | 16 15 | ia64: | ok | 17 16 | m68k: | TODO |
-1
Documentation/features/debug/kretprobes/arch-support.txt
··· 11 11 | arm: | ok | 12 12 | arm64: | ok | 13 13 | csky: | ok | 14 - | h8300: | TODO | 15 14 | hexagon: | TODO | 16 15 | ia64: | ok | 17 16 | m68k: | TODO |
-1
Documentation/features/debug/optprobes/arch-support.txt
··· 11 11 | arm: | ok | 12 12 | arm64: | TODO | 13 13 | csky: | TODO | 14 - | h8300: | TODO | 15 14 | hexagon: | TODO | 16 15 | ia64: | TODO | 17 16 | m68k: | TODO |
-1
Documentation/features/debug/stackprotector/arch-support.txt
··· 11 11 | arm: | ok | 12 12 | arm64: | ok | 13 13 | csky: | ok | 14 - | h8300: | TODO | 15 14 | hexagon: | TODO | 16 15 | ia64: | TODO | 17 16 | m68k: | TODO |
-1
Documentation/features/debug/uprobes/arch-support.txt
··· 11 11 | arm: | ok | 12 12 | arm64: | ok | 13 13 | csky: | ok | 14 - | h8300: | TODO | 15 14 | hexagon: | TODO | 16 15 | ia64: | TODO | 17 16 | m68k: | TODO |
-1
Documentation/features/debug/user-ret-profiler/arch-support.txt
··· 11 11 | arm: | TODO | 12 12 | arm64: | TODO | 13 13 | csky: | TODO | 14 - | h8300: | TODO | 15 14 | hexagon: | TODO | 16 15 | ia64: | TODO | 17 16 | m68k: | TODO |
-1
Documentation/features/io/dma-contiguous/arch-support.txt
··· 11 11 | arm: | ok | 12 12 | arm64: | ok | 13 13 | csky: | ok | 14 - | h8300: | TODO | 15 14 | hexagon: | TODO | 16 15 | ia64: | TODO | 17 16 | m68k: | TODO |
-1
Documentation/features/locking/cmpxchg-local/arch-support.txt
··· 11 11 | arm: | TODO | 12 12 | arm64: | ok | 13 13 | csky: | TODO | 14 - | h8300: | TODO | 15 14 | hexagon: | TODO | 16 15 | ia64: | TODO | 17 16 | m68k: | TODO |
-1
Documentation/features/locking/lockdep/arch-support.txt
··· 11 11 | arm: | ok | 12 12 | arm64: | ok | 13 13 | csky: | ok | 14 - | h8300: | TODO | 15 14 | hexagon: | ok | 16 15 | ia64: | TODO | 17 16 | m68k: | TODO |
-1
Documentation/features/locking/queued-rwlocks/arch-support.txt
··· 11 11 | arm: | TODO | 12 12 | arm64: | ok | 13 13 | csky: | ok | 14 - | h8300: | TODO | 15 14 | hexagon: | TODO | 16 15 | ia64: | TODO | 17 16 | m68k: | TODO |
-1
Documentation/features/locking/queued-spinlocks/arch-support.txt
··· 11 11 | arm: | TODO | 12 12 | arm64: | ok | 13 13 | csky: | TODO | 14 - | h8300: | TODO | 15 14 | hexagon: | TODO | 16 15 | ia64: | TODO | 17 16 | m68k: | TODO |
-1
Documentation/features/perf/kprobes-event/arch-support.txt
··· 11 11 | arm: | ok | 12 12 | arm64: | ok | 13 13 | csky: | ok | 14 - | h8300: | TODO | 15 14 | hexagon: | ok | 16 15 | ia64: | TODO | 17 16 | m68k: | TODO |
-1
Documentation/features/perf/perf-regs/arch-support.txt
··· 11 11 | arm: | ok | 12 12 | arm64: | ok | 13 13 | csky: | ok | 14 - | h8300: | TODO | 15 14 | hexagon: | TODO | 16 15 | ia64: | TODO | 17 16 | m68k: | TODO |
-1
Documentation/features/perf/perf-stackdump/arch-support.txt
··· 11 11 | arm: | ok | 12 12 | arm64: | ok | 13 13 | csky: | ok | 14 - | h8300: | TODO | 15 14 | hexagon: | TODO | 16 15 | ia64: | TODO | 17 16 | m68k: | TODO |
-1
Documentation/features/sched/membarrier-sync-core/arch-support.txt
··· 34 34 | arm: | ok | 35 35 | arm64: | ok | 36 36 | csky: | TODO | 37 - | h8300: | TODO | 38 37 | hexagon: | TODO | 39 38 | ia64: | TODO | 40 39 | m68k: | TODO |
-1
Documentation/features/sched/numa-balancing/arch-support.txt
··· 11 11 | arm: | .. | 12 12 | arm64: | ok | 13 13 | csky: | .. | 14 - | h8300: | .. | 15 14 | hexagon: | .. | 16 15 | ia64: | TODO | 17 16 | m68k: | .. |
-1
Documentation/features/seccomp/seccomp-filter/arch-support.txt
··· 11 11 | arm: | ok | 12 12 | arm64: | ok | 13 13 | csky: | ok | 14 - | h8300: | TODO | 15 14 | hexagon: | TODO | 16 15 | ia64: | TODO | 17 16 | m68k: | TODO |
-1
Documentation/features/time/arch-tick-broadcast/arch-support.txt
··· 11 11 | arm: | ok | 12 12 | arm64: | ok | 13 13 | csky: | TODO | 14 - | h8300: | TODO | 15 14 | hexagon: | TODO | 16 15 | ia64: | TODO | 17 16 | m68k: | TODO |
-1
Documentation/features/time/clockevents/arch-support.txt
··· 11 11 | arm: | TODO | 12 12 | arm64: | ok | 13 13 | csky: | ok | 14 - | h8300: | ok | 15 14 | hexagon: | ok | 16 15 | ia64: | TODO | 17 16 | m68k: | TODO |
-1
Documentation/features/time/context-tracking/arch-support.txt
··· 11 11 | arm: | ok | 12 12 | arm64: | ok | 13 13 | csky: | ok | 14 - | h8300: | TODO | 15 14 | hexagon: | TODO | 16 15 | ia64: | TODO | 17 16 | m68k: | TODO |
-1
Documentation/features/time/irq-time-acct/arch-support.txt
··· 11 11 | arm: | ok | 12 12 | arm64: | ok | 13 13 | csky: | TODO | 14 - | h8300: | TODO | 15 14 | hexagon: | TODO | 16 15 | ia64: | .. | 17 16 | m68k: | TODO |
-1
Documentation/features/time/virt-cpuacct/arch-support.txt
··· 11 11 | arm: | ok | 12 12 | arm64: | ok | 13 13 | csky: | ok | 14 - | h8300: | TODO | 15 14 | hexagon: | TODO | 16 15 | ia64: | ok | 17 16 | m68k: | TODO |
-1
Documentation/features/vm/ELF-ASLR/arch-support.txt
··· 11 11 | arm: | ok | 12 12 | arm64: | ok | 13 13 | csky: | TODO | 14 - | h8300: | TODO | 15 14 | hexagon: | TODO | 16 15 | ia64: | TODO | 17 16 | m68k: | TODO |
-1
Documentation/features/vm/PG_uncached/arch-support.txt
··· 11 11 | arm: | TODO | 12 12 | arm64: | TODO | 13 13 | csky: | TODO | 14 - | h8300: | TODO | 15 14 | hexagon: | TODO | 16 15 | ia64: | ok | 17 16 | m68k: | TODO |
-1
Documentation/features/vm/THP/arch-support.txt
··· 11 11 | arm: | ok | 12 12 | arm64: | ok | 13 13 | csky: | .. | 14 - | h8300: | .. | 15 14 | hexagon: | .. | 16 15 | ia64: | TODO | 17 16 | m68k: | .. |
-1
Documentation/features/vm/TLB/arch-support.txt
··· 11 11 | arm: | TODO | 12 12 | arm64: | N/A | 13 13 | csky: | TODO | 14 - | h8300: | .. | 15 14 | hexagon: | TODO | 16 15 | ia64: | TODO | 17 16 | m68k: | .. |
-1
Documentation/features/vm/huge-vmap/arch-support.txt
··· 11 11 | arm: | TODO | 12 12 | arm64: | ok | 13 13 | csky: | TODO | 14 - | h8300: | TODO | 15 14 | hexagon: | TODO | 16 15 | ia64: | TODO | 17 16 | m68k: | TODO |
-1
Documentation/features/vm/ioremap_prot/arch-support.txt
··· 11 11 | arm: | TODO | 12 12 | arm64: | TODO | 13 13 | csky: | TODO | 14 - | h8300: | TODO | 15 14 | hexagon: | TODO | 16 15 | ia64: | TODO | 17 16 | m68k: | TODO |
-1
Documentation/features/vm/pte_special/arch-support.txt
··· 11 11 | arm: | ok | 12 12 | arm64: | ok | 13 13 | csky: | TODO | 14 - | h8300: | TODO | 15 14 | hexagon: | TODO | 16 15 | ia64: | TODO | 17 16 | m68k: | TODO |
-11
MAINTAINERS
··· 8607 8607 S: Maintained 8608 8608 F: block/partitions/efi.* 8609 8609 8610 - H8/300 ARCHITECTURE 8611 - M: Yoshinori Sato <ysato@users.sourceforge.jp> 8612 - L: uclinux-h8-devel@lists.sourceforge.jp (moderated for non-subscribers) 8613 - S: Maintained 8614 - W: http://uclinux-h8.sourceforge.jp 8615 - T: git git://git.sourceforge.jp/gitroot/uclinux-h8/linux.git 8616 - F: arch/h8300/ 8617 - F: drivers/clk/h8300/ 8618 - F: drivers/clocksource/h8300_*.c 8619 - F: drivers/irqchip/irq-renesas-h8*.c 8620 - 8621 8610 HABANALABS PCI DRIVER 8622 8611 M: Oded Gabbay <ogabbay@kernel.org> 8623 8612 S: Supported
+3
arch/csky/include/asm/Kbuild
··· 3 3 generic-y += extable.h 4 4 generic-y += gpio.h 5 5 generic-y += kvm_para.h 6 + generic-y += spinlock.h 7 + generic-y += spinlock_types.h 6 8 generic-y += qrwlock.h 9 + generic-y += qrwlock_types.h 7 10 generic-y += parport.h 8 11 generic-y += user.h 9 12 generic-y += vmlinux.lds.h
-89
arch/csky/include/asm/spinlock.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - 3 - #ifndef __ASM_CSKY_SPINLOCK_H 4 - #define __ASM_CSKY_SPINLOCK_H 5 - 6 - #include <linux/spinlock_types.h> 7 - #include <asm/barrier.h> 8 - 9 - /* 10 - * Ticket-based spin-locking. 11 - */ 12 - static inline void arch_spin_lock(arch_spinlock_t *lock) 13 - { 14 - arch_spinlock_t lockval; 15 - u32 ticket_next = 1 << TICKET_NEXT; 16 - u32 *p = &lock->lock; 17 - u32 tmp; 18 - 19 - asm volatile ( 20 - "1: ldex.w %0, (%2) \n" 21 - " mov %1, %0 \n" 22 - " add %0, %3 \n" 23 - " stex.w %0, (%2) \n" 24 - " bez %0, 1b \n" 25 - : "=&r" (tmp), "=&r" (lockval) 26 - : "r"(p), "r"(ticket_next) 27 - : "cc"); 28 - 29 - while (lockval.tickets.next != lockval.tickets.owner) 30 - lockval.tickets.owner = READ_ONCE(lock->tickets.owner); 31 - 32 - smp_mb(); 33 - } 34 - 35 - static inline int arch_spin_trylock(arch_spinlock_t *lock) 36 - { 37 - u32 tmp, contended, res; 38 - u32 ticket_next = 1 << TICKET_NEXT; 39 - u32 *p = &lock->lock; 40 - 41 - do { 42 - asm volatile ( 43 - " ldex.w %0, (%3) \n" 44 - " movi %2, 1 \n" 45 - " rotli %1, %0, 16 \n" 46 - " cmpne %1, %0 \n" 47 - " bt 1f \n" 48 - " movi %2, 0 \n" 49 - " add %0, %0, %4 \n" 50 - " stex.w %0, (%3) \n" 51 - "1: \n" 52 - : "=&r" (res), "=&r" (tmp), "=&r" (contended) 53 - : "r"(p), "r"(ticket_next) 54 - : "cc"); 55 - } while (!res); 56 - 57 - if (!contended) 58 - smp_mb(); 59 - 60 - return !contended; 61 - } 62 - 63 - static inline void arch_spin_unlock(arch_spinlock_t *lock) 64 - { 65 - smp_mb(); 66 - WRITE_ONCE(lock->tickets.owner, lock->tickets.owner + 1); 67 - } 68 - 69 - static inline int arch_spin_value_unlocked(arch_spinlock_t lock) 70 - { 71 - return lock.tickets.owner == lock.tickets.next; 72 - } 73 - 74 - static inline int arch_spin_is_locked(arch_spinlock_t *lock) 75 - { 76 - return !arch_spin_value_unlocked(READ_ONCE(*lock)); 77 - } 78 - 79 - static inline int arch_spin_is_contended(arch_spinlock_t *lock) 80 - { 81 - struct __raw_tickets tickets = READ_ONCE(lock->tickets); 82 - 83 - return (tickets.next - tickets.owner) > 1; 84 - } 85 - #define arch_spin_is_contended arch_spin_is_contended 86 - 87 - #include <asm/qrwlock.h> 88 - 89 - #endif /* __ASM_CSKY_SPINLOCK_H */
-27
arch/csky/include/asm/spinlock_types.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - 3 - #ifndef __ASM_CSKY_SPINLOCK_TYPES_H 4 - #define __ASM_CSKY_SPINLOCK_TYPES_H 5 - 6 - #ifndef __LINUX_SPINLOCK_TYPES_RAW_H 7 - # error "please don't include this file directly" 8 - #endif 9 - 10 - #define TICKET_NEXT 16 11 - 12 - typedef struct { 13 - union { 14 - u32 lock; 15 - struct __raw_tickets { 16 - /* little endian */ 17 - u16 owner; 18 - u16 next; 19 - } tickets; 20 - }; 21 - } arch_spinlock_t; 22 - 23 - #define __ARCH_SPIN_LOCK_UNLOCKED { { 0 } } 24 - 25 - #include <asm-generic/qrwlock_types.h> 26 - 27 - #endif /* __ASM_CSKY_SPINLOCK_TYPES_H */
-5
arch/h8300/Kbuild
··· 1 - # SPDX-License-Identifier: GPL-2.0-only 2 - obj-y += kernel/ mm/ boot/dts/ 3 - 4 - # for cleaning 5 - subdir- += boot
-49
arch/h8300/Kconfig
··· 1 - # SPDX-License-Identifier: GPL-2.0 2 - config H8300 3 - def_bool y 4 - select ARCH_32BIT_OFF_T 5 - select ARCH_HAS_BINFMT_FLAT 6 - select BINFMT_FLAT_ARGVP_ENVP_ON_STACK 7 - select BINFMT_FLAT_OLD_ALWAYS_RAM 8 - select GENERIC_ATOMIC64 9 - select HAVE_UID16 10 - select VIRT_TO_BUS 11 - select GENERIC_IRQ_SHOW 12 - select FRAME_POINTER 13 - select GENERIC_CPU_DEVICES 14 - select MODULES_USE_ELF_RELA 15 - select COMMON_CLK 16 - select ARCH_WANT_FRAME_POINTERS 17 - select OF 18 - select OF_IRQ 19 - select OF_EARLY_FLATTREE 20 - select TIMER_OF 21 - select H8300_TMR8 22 - select HAVE_KERNEL_GZIP 23 - select HAVE_KERNEL_LZO 24 - select HAVE_ARCH_KGDB 25 - select HAVE_ARCH_HASH 26 - select CPU_NO_EFFICIENT_FFS 27 - select UACCESS_MEMCPY 28 - 29 - config CPU_BIG_ENDIAN 30 - def_bool y 31 - 32 - config GENERIC_HWEIGHT 33 - def_bool y 34 - 35 - config NO_IOPORT_MAP 36 - def_bool y 37 - 38 - config GENERIC_CSUM 39 - def_bool y 40 - 41 - config HZ 42 - int 43 - default 100 44 - 45 - config NR_CPUS 46 - int 47 - default 1 48 - 49 - source "arch/h8300/Kconfig.cpu"
-99
arch/h8300/Kconfig.cpu
··· 1 - # SPDX-License-Identifier: GPL-2.0 2 - config CPU_H8300H 3 - bool 4 - 5 - config CPU_H8S 6 - bool 7 - 8 - config H83069 9 - bool 10 - select CPU_H8300H 11 - select H8300_TMR16 12 - select RENESAS_H8300H_INTC 13 - 14 - config H8S2678 15 - bool 16 - select CPU_H8S 17 - select H8300_TPU 18 - select RENESAS_H8S_INTC 19 - 20 - config RAMKERNEL 21 - bool 22 - 23 - config ROMKERNEL 24 - bool 25 - 26 - menu "Processor type and features" 27 - 28 - choice 29 - prompt "H8/300 platform" 30 - 31 - config H8300_AE3068 32 - bool "AE-3068/69" 33 - select H83069 34 - select RAMKERNEL 35 - help 36 - AKI-H8/3068F / AKI-H8/3069F Flashmicom LAN Board Support 37 - More Information. (Japanese Only) 38 - <http://akizukidenshi.com/catalog/default.aspx> 39 - AE-3068/69 Evaluation Board Support 40 - More Information. 41 - <http://www.microtronique.com/ae3069lan.htm> 42 - 43 - config H8300_H8MAX 44 - bool "H8MAX" 45 - select H83069 46 - select RAMKERNEL 47 - help 48 - H8MAX Evaluation Board Support 49 - More Information. (Japanese Only) 50 - <http://strawberry-linux.com/h8/index.html> 51 - 52 - config H8300_KANEBEBE 53 - bool "KaneBebe" 54 - select H83069 55 - select RAMKERNEL 56 - help 57 - KaneBebe Evalition Board Support 58 - More Information. (Japanese Only) 59 - <http://www.nissin-tech.com/2009/10/uclinuxkane-bebe-h83069f.html> 60 - 61 - config H8300H_SIM 62 - bool "H8/300H GDB Simulator" 63 - select H83069 64 - select ROMKERNEL 65 - help 66 - GDB Simulator Support 67 - More Information. 68 - <http://sourceware.org/sid/> 69 - 70 - config H8S_EDOSK2674 71 - bool "EDOSK-2674" 72 - select H8S2678 73 - select RAMKERNEL 74 - help 75 - Renesas EDOSK-2674 Evaluation Board Support 76 - More Information. 77 - <http://www.azpower.com/H8-uClinux/index.html> 78 - <http://www.renesas.eu/products/tools/introductory_evaluation_tools/evaluation_development_os_kits/edosk2674r/edosk2674r_software_tools_root.jsp> 79 - 80 - config H8S_SIM 81 - bool "H8S GDB Simulator" 82 - select H8S2678 83 - select ROMKERNEL 84 - help 85 - GDB Simulator Support 86 - More Information. 87 - <http://sourceware.org/sid/> 88 - 89 - endchoice 90 - 91 - config H8300_BUILTIN_DTB 92 - string "Builtin DTB" 93 - default "" 94 - 95 - config OFFSET 96 - hex "Load offset" 97 - default 0 98 - 99 - endmenu
-2
arch/h8300/Kconfig.debug
··· 1 - # SPDX-License-Identifier: GPL-2.0-only 2 - # dummy file, do not delete
-44
arch/h8300/Makefile
··· 1 - # 2 - # arch/h8300/Makefile 3 - # 4 - # This file is subject to the terms and conditions of the GNU General Public 5 - # License. See the file "COPYING" in the main directory of this archive 6 - # for more details. 7 - # 8 - # (C) Copyright 2002-2015 Yoshinori Sato <ysato@users.sourceforge.jp> 9 - # 10 - 11 - KBUILD_DEFCONFIG := edosk2674_defconfig 12 - 13 - cflags-$(CONFIG_CPU_H8300H) := -mh 14 - aflags-$(CONFIG_CPU_H8300H) := -mh -Wa,--mach=h8300h 15 - ldflags-$(CONFIG_CPU_H8300H) := -mh8300helf_linux 16 - cflags-$(CONFIG_CPU_H8S) := -ms 17 - aflags-$(CONFIG_CPU_H8S) := -ms -Wa,--mach=h8300s 18 - ldflags-$(CONFIG_CPU_H8S) := -mh8300self_linux 19 - 20 - KBUILD_CFLAGS += $(cflags-y) 21 - KBUILD_CFLAGS += -mint32 -fno-builtin 22 - KBUILD_CFLAGS += -D__linux__ 23 - KBUILD_CFLAGS += -DUTS_SYSNAME=\"uClinux\" 24 - KBUILD_AFLAGS += $(aflags-y) 25 - KBUILD_LDFLAGS += $(ldflags-y) 26 - 27 - CHECKFLAGS += -msize-long 28 - 29 - ifeq ($(CROSS_COMPILE),) 30 - CROSS_COMPILE := $(call cc-cross-prefix, h8300-unknown-linux- h8300-linux-) 31 - endif 32 - 33 - libs-y += arch/$(ARCH)/lib/ 34 - 35 - boot := arch/h8300/boot 36 - 37 - vmlinux.srec vmlinux.bin zImage uImage.bin: vmlinux 38 - $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ 39 - 40 - define archhelp 41 - @echo 'vmlinux.bin - Create raw binary' 42 - @echo 'vmlinux.srec - Create srec binary' 43 - @echo 'zImage - Compressed kernel image' 44 - endef
-27
arch/h8300/boot/Makefile
··· 1 - # SPDX-License-Identifier: GPL-2.0 2 - # arch/h8300/boot/Makefile 3 - 4 - targets := vmlinux.srec vmlinux.bin zImage 5 - subdir- := compressed 6 - 7 - OBJCOPYFLAGS_vmlinux.srec := -Osrec 8 - OBJCOPYFLAGS_vmlinux.bin := -Obinary 9 - OBJCOPYFLAGS_zImage := -O binary -R .note -R .comment -R .stab -R .stabstr -S 10 - 11 - UIMAGE_LOADADDR = $(CONFIG_RAMBASE) 12 - UIMAGE_ENTRYADDR = $(shell /bin/bash -c 'printf "0x%08x" \ 13 - $$[$(CONFIG_RAMBASE) + $(CONFIG_OFFSET)]') 14 - 15 - $(obj)/vmlinux.srec $(obj)/vmlinux.bin: vmlinux FORCE 16 - $(call if_changed,objcopy) 17 - 18 - $(obj)/zImage: $(obj)/compressed/vmlinux FORCE 19 - $(call if_changed,objcopy) 20 - 21 - $(obj)/compressed/vmlinux: FORCE 22 - $(Q)$(MAKE) $(build)=$(obj)/compressed $@ 23 - 24 - $(obj)/uImage.bin: $(obj)/vmlinux.bin 25 - $(call if_changed,uimage,none) 26 - 27 - CLEAN_FILES += arch/$(ARCH)/vmlinux.bin arch/$(ARCH)/vmlinux.srec arch/$(ARCH)/uImage.bin
-45
arch/h8300/boot/compressed/Makefile
··· 1 - # SPDX-License-Identifier: GPL-2.0 2 - # 3 - # linux/arch/sh/boot/compressed/Makefile 4 - # 5 - # create a compressed vmlinux image from the original vmlinux 6 - # 7 - 8 - targets := vmlinux vmlinux.bin vmlinux.bin.gz head.o misc.o piggy.o 9 - 10 - OBJECTS = $(obj)/head.o $(obj)/misc.o 11 - 12 - # 13 - # IMAGE_OFFSET is the load offset of the compression loader 14 - # Assign dummy values if these 2 variables are not defined, 15 - # in order to suppress error message. 16 - # 17 - CONFIG_MEMORY_START ?= 0x00400000 18 - CONFIG_BOOT_LINK_OFFSET ?= 0x00280000 19 - IMAGE_OFFSET := $(shell printf "0x%08x" $$(($(CONFIG_MEMORY_START)+$(CONFIG_BOOT_LINK_OFFSET)))) 20 - 21 - LIBGCC := $(shell $(CROSS-COMPILE)$(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name 2>/dev/null) 22 - LDFLAGS_vmlinux := -Ttext $(IMAGE_OFFSET) -estartup -T $(obj)/vmlinux.lds \ 23 - --defsym output=$(CONFIG_MEMORY_START) 24 - 25 - $(obj)/vmlinux: $(OBJECTS) $(obj)/piggy.o $(LIBGCC) FORCE 26 - $(call if_changed,ld) 27 - 28 - $(obj)/vmlinux.bin: vmlinux FORCE 29 - $(call if_changed,objcopy) 30 - 31 - suffix-$(CONFIG_KERNEL_GZIP) := gzip 32 - suffix-$(CONFIG_KERNEL_LZO) := lzo 33 - compress-$(CONFIG_KERNEL_GZIP) := gzip 34 - compress-$(CONFIG_KERNEL_LZO) := lzo_with_size 35 - 36 - $(obj)/vmlinux.bin.$(suffix-y): $(obj)/vmlinux.bin FORCE 37 - $(call if_changed,$(compress-y)) 38 - 39 - LDFLAGS_piggy.o := -r --format binary --oformat elf32-h8300-linux -T 40 - OBJCOPYFLAGS := -O binary 41 - 42 - $(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.$(suffix-y) FORCE 43 - $(call if_changed,ld) 44 - 45 - CFLAGS_misc.o = -O0
-49
arch/h8300/boot/compressed/head.S
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - /* 3 - * linux/arch/h8300/boot/compressed/head.S 4 - * 5 - * Copyright (C) 2006 Yoshinori Sato 6 - */ 7 - 8 - #include <linux/linkage.h> 9 - 10 - .section .text..startup,"ax" 11 - .global startup 12 - startup: 13 - mov.l #startup, sp 14 - mov.l er0, er4 15 - mov.l #__sbss, er0 16 - mov.l #__ebss, er1 17 - sub.l er0, er1 18 - shlr er1 19 - shlr er1 20 - sub.l er2, er2 21 - 1: 22 - mov.l er2, @er0 23 - adds #4, er0 24 - dec.l #1, er1 25 - bne 1b 26 - jsr @decompress_kernel 27 - mov.l er4, er0 28 - jmp @output 29 - 30 - .align 9 31 - fake_headers_as_bzImage: 32 - .word 0 33 - .ascii "HdrS" ; header signature 34 - .word 0x0202 ; header version number (>= 0x0105) 35 - ; or else old loadlin-1.5 will fail) 36 - .word 0 ; default_switch 37 - .word 0 ; SETUPSEG 38 - .word 0x1000 39 - .word 0 ; pointing to kernel version string 40 - .byte 0 ; = 0, old one (LILO, Loadlin, 41 - ; 0xTV: T=0 for LILO 42 - ; V = version 43 - .byte 1 ; Load flags bzImage=1 44 - .word 0x8000 ; size to move, when setup is not 45 - .long 0x100000 ; 0x100000 = default for big kernel 46 - .long 0 ; address of loaded ramdisk image 47 - .long 0 ; its size in bytes 48 - 49 - .end
-76
arch/h8300/boot/compressed/misc.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /* 3 - * arch/h8300/boot/compressed/misc.c 4 - * 5 - * This is a collection of several routines from gzip-1.0.3 6 - * adapted for Linux. 7 - * 8 - * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994 9 - * 10 - * Adapted for h8300 by Yoshinori Sato 2006 11 - */ 12 - 13 - #include <linux/uaccess.h> 14 - 15 - /* 16 - * gzip declarations 17 - */ 18 - 19 - #define OF(args) args 20 - #define STATIC static 21 - 22 - #undef memset 23 - #undef memcpy 24 - #define memzero(s, n) memset((s), (0), (n)) 25 - 26 - extern int _end; 27 - static unsigned long free_mem_ptr; 28 - static unsigned long free_mem_end_ptr; 29 - 30 - extern char input_data[]; 31 - extern int input_len; 32 - extern char output[]; 33 - 34 - #define HEAP_SIZE 0x10000 35 - 36 - #ifdef CONFIG_KERNEL_GZIP 37 - #include "../../../../lib/decompress_inflate.c" 38 - #endif 39 - 40 - #ifdef CONFIG_KERNEL_LZO 41 - #include "../../../../lib/decompress_unlzo.c" 42 - #endif 43 - 44 - void *memset(void *s, int c, size_t n) 45 - { 46 - int i; 47 - char *ss = (char *)s; 48 - 49 - for (i = 0; i < n; i++) 50 - ss[i] = c; 51 - return s; 52 - } 53 - 54 - void *memcpy(void *dest, const void *src, size_t n) 55 - { 56 - int i; 57 - char *d = (char *)dest, *s = (char *)src; 58 - 59 - for (i = 0; i < n; i++) 60 - d[i] = s[i]; 61 - return dest; 62 - } 63 - 64 - static void error(char *x) 65 - { 66 - while (1) 67 - ; /* Halt */ 68 - } 69 - 70 - void decompress_kernel(void) 71 - { 72 - free_mem_ptr = (unsigned long)&_end; 73 - free_mem_end_ptr = free_mem_ptr + HEAP_SIZE; 74 - 75 - __decompress(input_data, input_len, NULL, NULL, output, 0, NULL, error); 76 - }
-35
arch/h8300/boot/compressed/vmlinux.lds
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - SECTIONS 3 - { 4 - .text : 5 - { 6 - __stext = . ; 7 - __text = .; 8 - *(.text..startup) 9 - *(.text) 10 - __etext = . ; 11 - } 12 - 13 - .rodata : 14 - { 15 - *(.rodata) 16 - } 17 - . = ALIGN(0x4) ; 18 - .data : 19 - 20 - { 21 - . = ALIGN(0x4) ; 22 - __sdata = . ; 23 - ___data_start = . ; 24 - *(.data.*) 25 - } 26 - . = ALIGN(0x4) ; 27 - .bss : 28 - { 29 - __sbss = . ; 30 - *(.bss*) 31 - . = ALIGN(0x4) ; 32 - __ebss = . ; 33 - } 34 - _end = . ; 35 - }
-9
arch/h8300/boot/compressed/vmlinux.scr
··· 1 - SECTIONS 2 - { 3 - .data : { 4 - input_len = .; 5 - LONG(input_data_end - input_data) input_data = .; 6 - *(.data) 7 - input_data_end = .; 8 - } 9 - }
-6
arch/h8300/boot/dts/Makefile
··· 1 - # SPDX-License-Identifier: GPL-2.0 2 - obj-y += $(addsuffix .dtb.o, $(CONFIG_H8300_BUILTIN_DTB)) 3 - 4 - dtb-$(CONFIG_H8300H_SIM) := h8300h_sim.dtb 5 - dtb-$(CONFIG_H8S_SIM) := h8s_sim.dtb 6 - dtb-$(CONFIG_H8S_EDOSK2674) := edosk2674.dtb
-108
arch/h8300/boot/dts/edosk2674.dts
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /dts-v1/; 3 - / { 4 - compatible = "renesas,edosk2674"; 5 - #address-cells = <1>; 6 - #size-cells = <1>; 7 - interrupt-parent = <&h8intc>; 8 - 9 - chosen { 10 - bootargs = "console=ttySC2,38400"; 11 - stdout-path = &sci2; 12 - }; 13 - aliases { 14 - serial0 = &sci0; 15 - serial1 = &sci1; 16 - serial2 = &sci2; 17 - }; 18 - 19 - xclk: oscillator { 20 - #clock-cells = <0>; 21 - compatible = "fixed-clock"; 22 - clock-frequency = <33333333>; 23 - clock-output-names = "xtal"; 24 - }; 25 - pllclk: pllclk { 26 - compatible = "renesas,h8s2678-pll-clock"; 27 - clocks = <&xclk>; 28 - #clock-cells = <0>; 29 - reg = <0xffff3b 1>, <0xffff45 1>; 30 - }; 31 - core_clk: core_clk { 32 - compatible = "renesas,h8300-div-clock"; 33 - clocks = <&pllclk>; 34 - #clock-cells = <0>; 35 - reg = <0xffff3b 1>; 36 - renesas,width = <3>; 37 - }; 38 - fclk: fclk { 39 - compatible = "fixed-factor-clock"; 40 - clocks = <&core_clk>; 41 - #clock-cells = <0>; 42 - clock-div = <1>; 43 - clock-mult = <1>; 44 - }; 45 - 46 - memory@400000 { 47 - device_type = "memory"; 48 - reg = <0x400000 0x800000>; 49 - }; 50 - 51 - cpus { 52 - #address-cells = <1>; 53 - #size-cells = <0>; 54 - cpu@0 { 55 - compatible = "renesas,h8300"; 56 - clock-frequency = <33333333>; 57 - }; 58 - }; 59 - 60 - h8intc: interrupt-controller@fffe00 { 61 - compatible = "renesas,h8s-intc", "renesas,h8300-intc"; 62 - #interrupt-cells = <2>; 63 - interrupt-controller; 64 - reg = <0xfffe00 24>; 65 - }; 66 - 67 - bsc: memory-controller@fffec0 { 68 - compatible = "renesas,h8s-bsc", "renesas,h8300-bsc"; 69 - reg = <0xfffec0 24>; 70 - }; 71 - 72 - tpu: timer@ffffe0 { 73 - compatible = "renesas,tpu"; 74 - reg = <0xffffe0 16>, <0xfffff0 12>; 75 - clocks = <&fclk>; 76 - clock-names = "fck"; 77 - }; 78 - 79 - timer8: timer@ffffb0 { 80 - compatible = "renesas,8bit-timer"; 81 - reg = <0xffffb0 10>; 82 - interrupts = <72 0>; 83 - clocks = <&fclk>; 84 - clock-names = "fck"; 85 - }; 86 - 87 - sci0: serial@ffff78 { 88 - compatible = "renesas,sci"; 89 - reg = <0xffff78 8>; 90 - interrupts = <88 0>, <89 0>, <90 0>, <91 0>; 91 - clocks = <&fclk>; 92 - clock-names = "fck"; 93 - }; 94 - sci1: serial@ffff80 { 95 - compatible = "renesas,sci"; 96 - reg = <0xffff80 8>; 97 - interrupts = <92 0>, <93 0>, <94 0>, <95 0>; 98 - clocks = <&fclk>; 99 - clock-names = "fck"; 100 - }; 101 - sci2: serial@ffff88 { 102 - compatible = "renesas,sci"; 103 - reg = <0xffff88 8>; 104 - interrupts = <96 0>, <97 0>, <98 0>, <99 0>; 105 - clocks = <&fclk>; 106 - clock-names = "fck"; 107 - }; 108 - };
-97
arch/h8300/boot/dts/h8300h_sim.dts
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /dts-v1/; 3 - / { 4 - compatible = "gnu,gdbsim"; 5 - #address-cells = <1>; 6 - #size-cells = <1>; 7 - interrupt-parent = <&h8intc>; 8 - 9 - chosen { 10 - bootargs = "earlyprintk=h8300-sim"; 11 - stdout-path = <&sci0>; 12 - }; 13 - aliases { 14 - serial0 = &sci0; 15 - serial1 = &sci1; 16 - }; 17 - 18 - xclk: oscillator { 19 - #clock-cells = <0>; 20 - compatible = "fixed-clock"; 21 - clock-frequency = <20000000>; 22 - clock-output-names = "xtal"; 23 - }; 24 - core_clk: core_clk { 25 - compatible = "renesas,h8300-div-clock"; 26 - clocks = <&xclk>; 27 - #clock-cells = <0>; 28 - reg = <0xfee01b 2>; 29 - renesas,width = <2>; 30 - }; 31 - fclk: fclk { 32 - compatible = "fixed-factor-clock"; 33 - clocks = <&core_clk>; 34 - #clock-cells = <0>; 35 - clock-div = <1>; 36 - clock-mult = <1>; 37 - }; 38 - 39 - memory@400000 { 40 - device_type = "memory"; 41 - reg = <0x400000 0x400000>; 42 - }; 43 - 44 - cpus { 45 - #address-cells = <1>; 46 - #size-cells = <0>; 47 - cpu@0 { 48 - compatible = "renesas,h8300"; 49 - clock-frequency = <20000000>; 50 - }; 51 - }; 52 - 53 - h8intc: interrupt-controller@fee012 { 54 - compatible = "renesas,h8300h-intc", "renesas,h8300-intc"; 55 - #interrupt-cells = <2>; 56 - interrupt-controller; 57 - reg = <0xfee012 7>; 58 - }; 59 - 60 - bsc: memory-controller@fee01e { 61 - compatible = "renesas,h8300h-bsc", "renesas,h8300-bsc"; 62 - reg = <0xfee01e 8>; 63 - }; 64 - 65 - timer8: timer@ffff80 { 66 - compatible = "renesas,8bit-timer"; 67 - reg = <0xffff80 10>; 68 - interrupts = <36 0>; 69 - clocks = <&fclk>; 70 - clock-names = "fck"; 71 - }; 72 - 73 - timer16: timer@ffff68 { 74 - compatible = "renesas,16bit-timer"; 75 - reg = <0xffff68 8>, <0xffff60 8>; 76 - interrupts = <26 0>; 77 - renesas,channel = <0>; 78 - clocks = <&fclk>; 79 - clock-names = "fck"; 80 - }; 81 - 82 - sci0: serial@ffffb0 { 83 - compatible = "renesas,sci"; 84 - reg = <0xffffb0 8>; 85 - interrupts = <52 0>, <53 0>, <54 0>, <55 0>; 86 - clocks = <&fclk>; 87 - clock-names = "fck"; 88 - }; 89 - 90 - sci1: serial@ffffb8 { 91 - compatible = "renesas,sci"; 92 - reg = <0xffffb8 8>; 93 - interrupts = <56 0>, <57 0>, <58 0>, <59 0>; 94 - clocks = <&fclk>; 95 - clock-names = "fck"; 96 - }; 97 - };
-100
arch/h8300/boot/dts/h8s_sim.dts
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /dts-v1/; 3 - / { 4 - compatible = "gnu,gdbsim"; 5 - #address-cells = <1>; 6 - #size-cells = <1>; 7 - interrupt-parent = <&h8intc>; 8 - 9 - chosen { 10 - bootargs = "earlyprintk=h8300-sim"; 11 - stdout-path = <&sci0>; 12 - }; 13 - aliases { 14 - serial0 = &sci0; 15 - serial1 = &sci1; 16 - }; 17 - 18 - xclk: oscillator { 19 - #clock-cells = <0>; 20 - compatible = "fixed-clock"; 21 - clock-frequency = <33333333>; 22 - clock-output-names = "xtal"; 23 - }; 24 - pllclk: pllclk { 25 - compatible = "renesas,h8s2678-pll-clock"; 26 - clocks = <&xclk>; 27 - #clock-cells = <0>; 28 - reg = <0xfee03b 2>, <0xfee045 2>; 29 - }; 30 - core_clk: core_clk { 31 - compatible = "renesas,h8300-div-clock"; 32 - clocks = <&pllclk>; 33 - #clock-cells = <0>; 34 - reg = <0xfee03b 2>; 35 - renesas,width = <3>; 36 - }; 37 - fclk: fclk { 38 - compatible = "fixed-factor-clock"; 39 - clocks = <&core_clk>; 40 - #clock-cells = <0>; 41 - clock-div = <1>; 42 - clock-mult = <1>; 43 - }; 44 - 45 - memory@400000 { 46 - device_type = "memory"; 47 - reg = <0x400000 0x800000>; 48 - }; 49 - 50 - cpus { 51 - #address-cells = <1>; 52 - #size-cells = <0>; 53 - cpu@0 { 54 - compatible = "renesas,h8300"; 55 - clock-frequency = <33333333>; 56 - }; 57 - }; 58 - 59 - h8intc: interrupt-controller@fffe00 { 60 - compatible = "renesas,h8s-intc", "renesas,h8300-intc"; 61 - #interrupt-cells = <2>; 62 - interrupt-controller; 63 - reg = <0xfffe00 24>; 64 - }; 65 - 66 - bsc: memory-controller@fffec0 { 67 - compatible = "renesas,h8s-bsc", "renesas,h8300-bsc"; 68 - reg = <0xfffec0 24>; 69 - }; 70 - 71 - tpu: timer@ffffe0 { 72 - compatible = "renesas,tpu"; 73 - reg = <0xffffe0 16>, <0xfffff0 12>; 74 - clocks = <&fclk>; 75 - clock-names = "fck"; 76 - }; 77 - 78 - timer8: timer@ffffb0 { 79 - compatible = "renesas,8bit-timer"; 80 - reg = <0xffffb0 10>; 81 - interrupts = <72 0>; 82 - clocks = <&fclk>; 83 - clock-names = "fck"; 84 - }; 85 - 86 - sci0: serial@ffff78 { 87 - compatible = "renesas,sci"; 88 - reg = <0xffff78 8>; 89 - interrupts = <88 0>, <89 0>, <90 0>, <91 0>; 90 - clocks = <&fclk>; 91 - clock-names = "fck"; 92 - }; 93 - sci1: serial@ffff80 { 94 - compatible = "renesas,sci"; 95 - reg = <0xffff80 8>; 96 - interrupts = <92 0>, <93 0>, <94 0>, <95 0>; 97 - clocks = <&fclk>; 98 - clock-names = "fck"; 99 - }; 100 - };
-48
arch/h8300/configs/edosk2674_defconfig
··· 1 - # CONFIG_LOCALVERSION_AUTO is not set 2 - # CONFIG_USELIB is not set 3 - CONFIG_CC_OPTIMIZE_FOR_SIZE=y 4 - # CONFIG_UID16 is not set 5 - # CONFIG_SYSFS_SYSCALL is not set 6 - # CONFIG_KALLSYMS is not set 7 - # CONFIG_BASE_FULL is not set 8 - # CONFIG_FUTEX is not set 9 - # CONFIG_EPOLL is not set 10 - # CONFIG_SIGNALFD is not set 11 - # CONFIG_TIMERFD is not set 12 - # CONFIG_EVENTFD is not set 13 - # CONFIG_AIO is not set 14 - # CONFIG_ADVISE_SYSCALLS is not set 15 - CONFIG_EMBEDDED=y 16 - # CONFIG_VM_EVENT_COUNTERS is not set 17 - # CONFIG_COMPAT_BRK is not set 18 - CONFIG_SLOB=y 19 - # CONFIG_BLOCK is not set 20 - CONFIG_H8S_SIM=y 21 - CONFIG_H8300_BUILTIN_DTB="h8s_sim" 22 - # CONFIG_BINFMT_SCRIPT is not set 23 - CONFIG_BINFMT_FLAT=y 24 - # CONFIG_COREDUMP is not set 25 - # CONFIG_UEVENT_HELPER is not set 26 - # CONFIG_STANDALONE is not set 27 - # CONFIG_PREVENT_FIRMWARE_BUILD is not set 28 - # CONFIG_FW_LOADER is not set 29 - # CONFIG_ALLOW_DEV_COREDUMP is not set 30 - # CONFIG_INPUT is not set 31 - # CONFIG_SERIO is not set 32 - # CONFIG_VT is not set 33 - # CONFIG_UNIX98_PTYS is not set 34 - # CONFIG_LEGACY_PTYS is not set 35 - # CONFIG_DEVKMEM is not set 36 - CONFIG_SERIAL_SH_SCI=y 37 - CONFIG_SERIAL_SH_SCI_CONSOLE=y 38 - # CONFIG_HW_RANDOM is not set 39 - # CONFIG_HWMON is not set 40 - # CONFIG_USB_SUPPORT is not set 41 - # CONFIG_FILE_LOCKING is not set 42 - # CONFIG_DNOTIFY is not set 43 - # CONFIG_INOTIFY_USER is not set 44 - # CONFIG_PROC_FS is not set 45 - # CONFIG_SYSFS is not set 46 - # CONFIG_MISC_FILESYSTEMS is not set 47 - CONFIG_DEBUG_INFO=y 48 - # CONFIG_ENABLE_MUST_CHECK is not set
-48
arch/h8300/configs/h8300h-sim_defconfig
··· 1 - # CONFIG_LOCALVERSION_AUTO is not set 2 - # CONFIG_USELIB is not set 3 - CONFIG_CC_OPTIMIZE_FOR_SIZE=y 4 - # CONFIG_UID16 is not set 5 - # CONFIG_SYSFS_SYSCALL is not set 6 - # CONFIG_KALLSYMS is not set 7 - # CONFIG_BASE_FULL is not set 8 - # CONFIG_FUTEX is not set 9 - # CONFIG_EPOLL is not set 10 - # CONFIG_SIGNALFD is not set 11 - # CONFIG_TIMERFD is not set 12 - # CONFIG_EVENTFD is not set 13 - # CONFIG_AIO is not set 14 - # CONFIG_ADVISE_SYSCALLS is not set 15 - CONFIG_EMBEDDED=y 16 - # CONFIG_VM_EVENT_COUNTERS is not set 17 - # CONFIG_COMPAT_BRK is not set 18 - CONFIG_SLOB=y 19 - # CONFIG_BLOCK is not set 20 - CONFIG_H8300H_SIM=y 21 - CONFIG_H8300_BUILTIN_DTB="h8300h_sim" 22 - # CONFIG_BINFMT_SCRIPT is not set 23 - CONFIG_BINFMT_FLAT=y 24 - # CONFIG_COREDUMP is not set 25 - # CONFIG_UEVENT_HELPER is not set 26 - # CONFIG_STANDALONE is not set 27 - # CONFIG_PREVENT_FIRMWARE_BUILD is not set 28 - # CONFIG_FW_LOADER is not set 29 - # CONFIG_ALLOW_DEV_COREDUMP is not set 30 - # CONFIG_INPUT is not set 31 - # CONFIG_SERIO is not set 32 - # CONFIG_VT is not set 33 - # CONFIG_UNIX98_PTYS is not set 34 - # CONFIG_LEGACY_PTYS is not set 35 - # CONFIG_DEVKMEM is not set 36 - CONFIG_SERIAL_SH_SCI=y 37 - CONFIG_SERIAL_SH_SCI_EARLYCON=y 38 - # CONFIG_HW_RANDOM is not set 39 - # CONFIG_HWMON is not set 40 - # CONFIG_USB_SUPPORT is not set 41 - # CONFIG_FILE_LOCKING is not set 42 - # CONFIG_DNOTIFY is not set 43 - # CONFIG_INOTIFY_USER is not set 44 - # CONFIG_PROC_FS is not set 45 - # CONFIG_SYSFS is not set 46 - # CONFIG_MISC_FILESYSTEMS is not set 47 - CONFIG_DEBUG_INFO=y 48 - # CONFIG_ENABLE_MUST_CHECK is not set
-48
arch/h8300/configs/h8s-sim_defconfig
··· 1 - # CONFIG_LOCALVERSION_AUTO is not set 2 - # CONFIG_USELIB is not set 3 - CONFIG_CC_OPTIMIZE_FOR_SIZE=y 4 - # CONFIG_UID16 is not set 5 - # CONFIG_SYSFS_SYSCALL is not set 6 - # CONFIG_KALLSYMS is not set 7 - # CONFIG_BASE_FULL is not set 8 - # CONFIG_FUTEX is not set 9 - # CONFIG_EPOLL is not set 10 - # CONFIG_SIGNALFD is not set 11 - # CONFIG_TIMERFD is not set 12 - # CONFIG_EVENTFD is not set 13 - # CONFIG_AIO is not set 14 - # CONFIG_ADVISE_SYSCALLS is not set 15 - CONFIG_EMBEDDED=y 16 - # CONFIG_VM_EVENT_COUNTERS is not set 17 - # CONFIG_COMPAT_BRK is not set 18 - CONFIG_SLOB=y 19 - # CONFIG_BLOCK is not set 20 - CONFIG_H8S_SIM=y 21 - CONFIG_H8300_BUILTIN_DTB="h8s_sim" 22 - # CONFIG_BINFMT_SCRIPT is not set 23 - CONFIG_BINFMT_FLAT=y 24 - # CONFIG_COREDUMP is not set 25 - # CONFIG_UEVENT_HELPER is not set 26 - # CONFIG_STANDALONE is not set 27 - # CONFIG_PREVENT_FIRMWARE_BUILD is not set 28 - # CONFIG_FW_LOADER is not set 29 - # CONFIG_ALLOW_DEV_COREDUMP is not set 30 - # CONFIG_INPUT is not set 31 - # CONFIG_SERIO is not set 32 - # CONFIG_VT is not set 33 - # CONFIG_UNIX98_PTYS is not set 34 - # CONFIG_LEGACY_PTYS is not set 35 - # CONFIG_DEVKMEM is not set 36 - CONFIG_SERIAL_SH_SCI=y 37 - CONFIG_SERIAL_SH_SCI_CONSOLE=y 38 - # CONFIG_HW_RANDOM is not set 39 - # CONFIG_HWMON is not set 40 - # CONFIG_USB_SUPPORT is not set 41 - # CONFIG_FILE_LOCKING is not set 42 - # CONFIG_DNOTIFY is not set 43 - # CONFIG_INOTIFY_USER is not set 44 - # CONFIG_PROC_FS is not set 45 - # CONFIG_SYSFS is not set 46 - # CONFIG_MISC_FILESYSTEMS is not set 47 - CONFIG_DEBUG_INFO=y 48 - # CONFIG_ENABLE_MUST_CHECK is not set
-8
arch/h8300/include/asm/Kbuild
··· 1 - # SPDX-License-Identifier: GPL-2.0 2 - generic-y += asm-offsets.h 3 - generic-y += cmpxchg.h 4 - generic-y += extable.h 5 - generic-y += kvm_para.h 6 - generic-y += mcs_spinlock.h 7 - generic-y += parport.h 8 - generic-y += spinlock.h
-179
arch/h8300/include/asm/bitops.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef _H8300_BITOPS_H 3 - #define _H8300_BITOPS_H 4 - 5 - /* 6 - * Copyright 1992, Linus Torvalds. 7 - * Copyright 2002, Yoshinori Sato 8 - */ 9 - 10 - #include <linux/compiler.h> 11 - 12 - #include <asm-generic/bitops/fls.h> 13 - #include <asm-generic/bitops/__fls.h> 14 - #include <asm-generic/bitops/fls64.h> 15 - 16 - #ifdef __KERNEL__ 17 - 18 - #ifndef _LINUX_BITOPS_H 19 - #error only <linux/bitops.h> can be included directly 20 - #endif 21 - 22 - /* 23 - * Function prototypes to keep gcc -Wall happy 24 - */ 25 - 26 - /* 27 - * ffz = Find First Zero in word. Undefined if no zero exists, 28 - * so code should check against ~0UL first.. 29 - */ 30 - static inline unsigned long ffz(unsigned long word) 31 - { 32 - unsigned long result; 33 - 34 - result = -1; 35 - __asm__("1:\n\t" 36 - "shlr.l %1\n\t" 37 - "adds #1,%0\n\t" 38 - "bcs 1b" 39 - : "=r"(result),"=r"(word) 40 - : "0"(result), "1"(word)); 41 - return result; 42 - } 43 - 44 - #define H8300_GEN_BITOP(FNAME, OP) \ 45 - static inline void FNAME(int nr, volatile unsigned long *addr) \ 46 - { \ 47 - unsigned char *b_addr; \ 48 - unsigned char bit = nr & 7; \ 49 - \ 50 - b_addr = (unsigned char *)addr + ((nr >> 3) ^ 3); \ 51 - if (__builtin_constant_p(nr)) { \ 52 - __asm__(OP " %1,%0" : "+WU"(*b_addr) : "i"(nr & 7)); \ 53 - } else { \ 54 - __asm__(OP " %s1,%0" : "+WU"(*b_addr) : "r"(bit)); \ 55 - } \ 56 - } 57 - 58 - H8300_GEN_BITOP(set_bit, "bset") 59 - H8300_GEN_BITOP(clear_bit, "bclr") 60 - H8300_GEN_BITOP(change_bit, "bnot") 61 - #define __set_bit(nr, addr) set_bit((nr), (addr)) 62 - #define __clear_bit(nr, addr) clear_bit((nr), (addr)) 63 - #define __change_bit(nr, addr) change_bit((nr), (addr)) 64 - 65 - #undef H8300_GEN_BITOP 66 - 67 - static inline int test_bit(int nr, const volatile unsigned long *addr) 68 - { 69 - int ret = 0; 70 - unsigned char *b_addr; 71 - unsigned char bit = nr & 7; 72 - 73 - b_addr = (unsigned char *)addr + ((nr >> 3) ^ 3); 74 - if (__builtin_constant_p(nr)) { 75 - __asm__("bld %Z2,%1\n\t" 76 - "rotxl %0\n\t" 77 - : "=r"(ret) 78 - : "WU"(*b_addr), "i"(nr & 7), "0"(ret) : "cc"); 79 - } else { 80 - __asm__("btst %w2,%1\n\t" 81 - "beq 1f\n\t" 82 - "inc.l #1,%0\n" 83 - "1:" 84 - : "=r"(ret) 85 - : "WU"(*b_addr), "r"(bit), "0"(ret) : "cc"); 86 - } 87 - return ret; 88 - } 89 - 90 - #define __test_bit(nr, addr) test_bit(nr, addr) 91 - 92 - #define H8300_GEN_TEST_BITOP(FNNAME, OP) \ 93 - static inline int FNNAME(int nr, void *addr) \ 94 - { \ 95 - int retval = 0; \ 96 - char ccrsave; \ 97 - unsigned char *b_addr; \ 98 - unsigned char bit = nr & 7; \ 99 - \ 100 - b_addr = (unsigned char *)addr + ((nr >> 3) ^ 3); \ 101 - if (__builtin_constant_p(nr)) { \ 102 - __asm__("stc ccr,%s2\n\t" \ 103 - "orc #0x80,ccr\n\t" \ 104 - "bld %4,%1\n\t" \ 105 - OP " %4,%1\n\t" \ 106 - "rotxl.l %0\n\t" \ 107 - "ldc %s2,ccr" \ 108 - : "=r"(retval), "+WU" (*b_addr), "=&r"(ccrsave) \ 109 - : "0"(retval), "i"(nr & 7) : "cc"); \ 110 - } else { \ 111 - __asm__("stc ccr,%t3\n\t" \ 112 - "orc #0x80,ccr\n\t" \ 113 - "btst %s3,%1\n\t" \ 114 - OP " %s3,%1\n\t" \ 115 - "beq 1f\n\t" \ 116 - "inc.l #1,%0\n\t" \ 117 - "1:\n" \ 118 - "ldc %t3,ccr" \ 119 - : "=r"(retval), "+WU" (*b_addr) \ 120 - : "0" (retval), "r"(bit) : "cc"); \ 121 - } \ 122 - return retval; \ 123 - } \ 124 - \ 125 - static inline int __ ## FNNAME(int nr, void *addr) \ 126 - { \ 127 - int retval = 0; \ 128 - unsigned char *b_addr; \ 129 - unsigned char bit = nr & 7; \ 130 - \ 131 - b_addr = (unsigned char *)addr + ((nr >> 3) ^ 3); \ 132 - if (__builtin_constant_p(nr)) { \ 133 - __asm__("bld %3,%1\n\t" \ 134 - OP " %3,%1\n\t" \ 135 - "rotxl.l %0\n\t" \ 136 - : "=r"(retval), "+WU"(*b_addr) \ 137 - : "0" (retval), "i"(nr & 7)); \ 138 - } else { \ 139 - __asm__("btst %s3,%1\n\t" \ 140 - OP " %s3,%1\n\t" \ 141 - "beq 1f\n\t" \ 142 - "inc.l #1,%0\n\t" \ 143 - "1:" \ 144 - : "=r"(retval), "+WU"(*b_addr) \ 145 - : "0" (retval), "r"(bit)); \ 146 - } \ 147 - return retval; \ 148 - } 149 - 150 - H8300_GEN_TEST_BITOP(test_and_set_bit, "bset") 151 - H8300_GEN_TEST_BITOP(test_and_clear_bit, "bclr") 152 - H8300_GEN_TEST_BITOP(test_and_change_bit, "bnot") 153 - #undef H8300_GEN_TEST_BITOP 154 - 155 - #include <asm-generic/bitops/ffs.h> 156 - 157 - static inline unsigned long __ffs(unsigned long word) 158 - { 159 - unsigned long result; 160 - 161 - result = -1; 162 - __asm__("1:\n\t" 163 - "shlr.l %1\n\t" 164 - "adds #1,%0\n\t" 165 - "bcc 1b" 166 - : "=r" (result),"=r"(word) 167 - : "0"(result), "1"(word)); 168 - return result; 169 - } 170 - 171 - #include <asm-generic/bitops/sched.h> 172 - #include <asm-generic/bitops/hweight.h> 173 - #include <asm-generic/bitops/lock.h> 174 - #include <asm-generic/bitops/le.h> 175 - #include <asm-generic/bitops/ext2-atomic.h> 176 - 177 - #endif /* __KERNEL__ */ 178 - 179 - #endif /* _H8300_BITOPS_H */
-13
arch/h8300/include/asm/bug.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef _H8300_BUG_H 3 - #define _H8300_BUG_H 4 - 5 - /* always true */ 6 - #define is_valid_bugaddr(addr) (1) 7 - 8 - #include <asm-generic/bug.h> 9 - 10 - struct pt_regs; 11 - extern void die(const char *str, struct pt_regs *fp, unsigned long err); 12 - 13 - #endif
-7
arch/h8300/include/asm/byteorder.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef __H8300_BYTEORDER_H__ 3 - #define __H8300_BYTEORDER_H__ 4 - 5 - #include <linux/byteorder/big_endian.h> 6 - 7 - #endif
-12
arch/h8300/include/asm/cache.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef __ARCH_H8300_CACHE_H 3 - #define __ARCH_H8300_CACHE_H 4 - 5 - /* bytes per L1 cache line */ 6 - #define L1_CACHE_SHIFT 2 7 - #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) 8 - 9 - #define __cacheline_aligned 10 - #define ____cacheline_aligned 11 - 12 - #endif
-102
arch/h8300/include/asm/elf.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef __ASM_H8300_ELF_H 3 - #define __ASM_H8300_ELF_H 4 - 5 - /* 6 - * ELF register definitions.. 7 - */ 8 - 9 - #include <asm/ptrace.h> 10 - #include <asm/user.h> 11 - 12 - typedef unsigned long elf_greg_t; 13 - 14 - #define ELF_NGREG (sizeof(struct user_regs_struct) / sizeof(elf_greg_t)) 15 - typedef elf_greg_t elf_gregset_t[ELF_NGREG]; 16 - typedef unsigned long elf_fpregset_t; 17 - 18 - /* 19 - * This is used to ensure we don't load something for the wrong architecture. 20 - */ 21 - #define elf_check_arch(x) ((x)->e_machine == EM_H8_300) 22 - 23 - /* 24 - * These are used to set parameters in the core dumps. 25 - */ 26 - #define ELF_CLASS ELFCLASS32 27 - #define ELF_DATA ELFDATA2MSB 28 - #define ELF_ARCH EM_H8_300 29 - #if defined(CONFIG_CPU_H8300H) 30 - #define ELF_CORE_EFLAGS 0x810000 31 - #endif 32 - #if defined(CONFIG_CPU_H8S) 33 - #define ELF_CORE_EFLAGS 0x820000 34 - #endif 35 - 36 - #define ELF_PLAT_INIT(_r) do { (_r)->er1 = 0; } while (0) 37 - 38 - #define ELF_EXEC_PAGESIZE 4096 39 - 40 - /* This is the location that an ET_DYN program is loaded if exec'ed. Typical 41 - use of this is to invoke "./ld.so someprog" to test out a new version of 42 - the loader. We need to make sure that it is out of the way of the program 43 - that it will "exec", and that there is sufficient room for the brk. */ 44 - 45 - #define ELF_ET_DYN_BASE 0xD0000000UL 46 - 47 - /* This yields a mask that user programs can use to figure out what 48 - instruction set this cpu supports. */ 49 - 50 - #define ELF_HWCAP (0) 51 - 52 - /* This yields a string that ld.so will use to load implementation 53 - specific libraries for optimization. This is more specific in 54 - intent than poking at uname or /proc/cpuinfo. */ 55 - 56 - #define ELF_PLATFORM (NULL) 57 - 58 - #define R_H8_NONE 0 59 - #define R_H8_DIR32 1 60 - #define R_H8_DIR32_28 2 61 - #define R_H8_DIR32_24 3 62 - #define R_H8_DIR32_16 4 63 - #define R_H8_DIR32U 6 64 - #define R_H8_DIR32U_28 7 65 - #define R_H8_DIR32U_24 8 66 - #define R_H8_DIR32U_20 9 67 - #define R_H8_DIR32U_16 10 68 - #define R_H8_DIR24 11 69 - #define R_H8_DIR24_20 12 70 - #define R_H8_DIR24_16 13 71 - #define R_H8_DIR24U 14 72 - #define R_H8_DIR24U_20 15 73 - #define R_H8_DIR24U_16 16 74 - #define R_H8_DIR16 17 75 - #define R_H8_DIR16U 18 76 - #define R_H8_DIR16S_32 19 77 - #define R_H8_DIR16S_28 20 78 - #define R_H8_DIR16S_24 21 79 - #define R_H8_DIR16S_20 22 80 - #define R_H8_DIR16S 23 81 - #define R_H8_DIR8 24 82 - #define R_H8_DIR8U 25 83 - #define R_H8_DIR8Z_32 26 84 - #define R_H8_DIR8Z_28 27 85 - #define R_H8_DIR8Z_24 28 86 - #define R_H8_DIR8Z_20 29 87 - #define R_H8_DIR8Z_16 30 88 - #define R_H8_PCREL16 31 89 - #define R_H8_PCREL8 32 90 - #define R_H8_BPOS 33 91 - #define R_H8_PCREL32 34 92 - #define R_H8_GOT32O 35 93 - #define R_H8_GOT16O 36 94 - #define R_H8_DIR16A8 59 95 - #define R_H8_DIR16R8 60 96 - #define R_H8_DIR24A8 61 97 - #define R_H8_DIR24R8 62 98 - #define R_H8_DIR32A16 63 99 - #define R_H8_ABS32 65 100 - #define R_H8_ABS32A16 127 101 - 102 - #endif
-36
arch/h8300/include/asm/flat.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - /* 3 - * arch/h8300/asm/include/flat.h -- uClinux flat-format executables 4 - */ 5 - 6 - #ifndef __H8300_FLAT_H__ 7 - #define __H8300_FLAT_H__ 8 - 9 - #include <asm/unaligned.h> 10 - 11 - /* 12 - * on the H8 a couple of the relocations have an instruction in the 13 - * top byte. As there can only be 24bits of address space, we just 14 - * always preserve that 8bits at the top, when it isn't an instruction 15 - * is is 0 (davidm@snapgear.com) 16 - */ 17 - 18 - #define flat_get_relocate_addr(rel) (rel & ~0x00000001) 19 - static inline int flat_get_addr_from_rp(u32 __user *rp, u32 relval, u32 flags, 20 - u32 *addr) 21 - { 22 - u32 val = get_unaligned((__force u32 *)rp); 23 - if (!(flags & FLAT_FLAG_GOTPIC)) 24 - val &= 0x00ffffff; 25 - *addr = val; 26 - return 0; 27 - } 28 - 29 - static inline int flat_put_addr_at_rp(u32 __user *rp, u32 addr, u32 rel) 30 - { 31 - u32 *p = (__force u32 *)rp; 32 - put_unaligned((addr & 0x00ffffff) | (*(char *)p << 24), p); 33 - return 0; 34 - } 35 - 36 - #endif /* __H8300_FLAT_H__ */
-54
arch/h8300/include/asm/hash.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef _ASM_HASH_H 3 - #define _ASM_HASH_H 4 - 5 - /* 6 - * The later H8SX models have a 32x32-bit multiply, but the H8/300H 7 - * and H8S have only 16x16->32. Since it's tolerably compact, this is 8 - * basically an inlined version of the __mulsi3 code. Since the inputs 9 - * are not expected to be small, it's also simplfied by skipping the 10 - * early-out checks. 11 - * 12 - * (Since neither CPU has any multi-bit shift instructions, a 13 - * shift-and-add version is a non-starter.) 14 - * 15 - * TODO: come up with an arch-specific version of the hashing in fs/namei.c, 16 - * since that is heavily dependent on rotates. Which, as mentioned, suck 17 - * horribly on H8. 18 - */ 19 - 20 - #if defined(CONFIG_CPU_H300H) || defined(CONFIG_CPU_H8S) 21 - 22 - #define HAVE_ARCH__HASH_32 1 23 - 24 - /* 25 - * Multiply by k = 0x61C88647. Fitting this into three registers requires 26 - * one extra instruction, but reducing register pressure will probably 27 - * make that back and then some. 28 - * 29 - * GCC asm note: %e1 is the high half of operand %1, while %f1 is the 30 - * low half. So if %1 is er4, then %e1 is e4 and %f1 is r4. 31 - * 32 - * This has been designed to modify x in place, since that's the most 33 - * common usage, but preserve k, since hash_64() makes two calls in 34 - * quick succession. 35 - */ 36 - static inline u32 __attribute_const__ __hash_32(u32 x) 37 - { 38 - u32 temp; 39 - 40 - asm( "mov.w %e1,%f0" 41 - "\n mulxu.w %f2,%0" /* klow * xhigh */ 42 - "\n mov.w %f0,%e1" /* The extra instruction */ 43 - "\n mov.w %f1,%f0" 44 - "\n mulxu.w %e2,%0" /* khigh * xlow */ 45 - "\n add.w %e1,%f0" 46 - "\n mulxu.w %f2,%1" /* klow * xlow */ 47 - "\n add.w %f0,%e1" 48 - : "=&r" (temp), "=r" (x) 49 - : "%r" (GOLDEN_RATIO_32), "1" (x)); 50 - return x; 51 - } 52 - 53 - #endif 54 - #endif /* _ASM_HASH_H */
-67
arch/h8300/include/asm/io.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef _H8300_IO_H 3 - #define _H8300_IO_H 4 - 5 - #ifdef __KERNEL__ 6 - 7 - #include <linux/types.h> 8 - 9 - /* H8/300 internal I/O functions */ 10 - 11 - #define __raw_readb __raw_readb 12 - static inline u8 __raw_readb(const volatile void __iomem *addr) 13 - { 14 - return *(volatile u8 *)addr; 15 - } 16 - 17 - #define __raw_readw __raw_readw 18 - static inline u16 __raw_readw(const volatile void __iomem *addr) 19 - { 20 - return *(volatile u16 *)addr; 21 - } 22 - 23 - #define __raw_readl __raw_readl 24 - static inline u32 __raw_readl(const volatile void __iomem *addr) 25 - { 26 - return *(volatile u32 *)addr; 27 - } 28 - 29 - #define __raw_writeb __raw_writeb 30 - static inline void __raw_writeb(u8 b, const volatile void __iomem *addr) 31 - { 32 - *(volatile u8 *)addr = b; 33 - } 34 - 35 - #define __raw_writew __raw_writew 36 - static inline void __raw_writew(u16 b, const volatile void __iomem *addr) 37 - { 38 - *(volatile u16 *)addr = b; 39 - } 40 - 41 - #define __raw_writel __raw_writel 42 - static inline void __raw_writel(u32 b, const volatile void __iomem *addr) 43 - { 44 - *(volatile u32 *)addr = b; 45 - } 46 - 47 - static inline void ctrl_bclr(int b, void __iomem *addr) 48 - { 49 - if (__builtin_constant_p(b)) 50 - __asm__("bclr %1,%0" : "+WU"(*(u8 *)addr): "i"(b)); 51 - else 52 - __asm__("bclr %w1,%0" : "+WU"(*(u8 *)addr): "r"(b)); 53 - } 54 - 55 - static inline void ctrl_bset(int b, void __iomem *addr) 56 - { 57 - if (__builtin_constant_p(b)) 58 - __asm__("bset %1,%0" : "+WU"(*(u8 *)addr): "i"(b)); 59 - else 60 - __asm__("bset %w1,%0" : "+WU"(*(u8 *)addr): "r"(b)); 61 - } 62 - 63 - #include <asm-generic/io.h> 64 - 65 - #endif /* __KERNEL__ */ 66 - 67 - #endif /* _H8300_IO_H */
-25
arch/h8300/include/asm/irq.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef _H8300_IRQ_H_ 3 - #define _H8300_IRQ_H_ 4 - 5 - #if defined(CONFIG_CPU_H8300H) 6 - #define NR_IRQS 64 7 - #define IRQ_CHIP h8300h_irq_chip 8 - #define EXT_IRQ0 12 9 - #define EXT_IRQS 6 10 - #elif defined(CONFIG_CPU_H8S) 11 - #define NR_IRQS 128 12 - #define IRQ_CHIP h8s_irq_chip 13 - #define EXT_IRQ0 16 14 - #define EXT_IRQS 16 15 - #endif 16 - 17 - static inline int irq_canonicalize(int irq) 18 - { 19 - return irq; 20 - } 21 - 22 - void h8300_init_ipr(void); 23 - extern struct irq_chip h8300h_irq_chip; 24 - extern struct irq_chip h8s_irq_chip; 25 - #endif /* _H8300_IRQ_H_ */
-97
arch/h8300/include/asm/irqflags.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef _H8300_IRQFLAGS_H 3 - #define _H8300_IRQFLAGS_H 4 - 5 - #ifdef CONFIG_CPU_H8300H 6 - typedef unsigned char h8300flags; 7 - 8 - static inline h8300flags arch_local_save_flags(void) 9 - { 10 - h8300flags flags; 11 - 12 - __asm__ volatile ("stc ccr,%w0" : "=r" (flags)); 13 - return flags; 14 - } 15 - 16 - static inline void arch_local_irq_disable(void) 17 - { 18 - __asm__ volatile ("orc #0xc0,ccr"); 19 - } 20 - 21 - static inline void arch_local_irq_enable(void) 22 - { 23 - __asm__ volatile ("andc #0x3f,ccr"); 24 - } 25 - 26 - static inline h8300flags arch_local_irq_save(void) 27 - { 28 - h8300flags flags; 29 - 30 - __asm__ volatile ("stc ccr,%w0\n\t" 31 - "orc #0xc0,ccr" : "=r" (flags)); 32 - return flags; 33 - } 34 - 35 - static inline void arch_local_irq_restore(h8300flags flags) 36 - { 37 - __asm__ volatile ("ldc %w0,ccr" : : "r" (flags) : "cc"); 38 - } 39 - 40 - static inline int arch_irqs_disabled_flags(unsigned long flags) 41 - { 42 - return (flags & 0xc0) == 0xc0; 43 - } 44 - #endif 45 - #ifdef CONFIG_CPU_H8S 46 - typedef unsigned short h8300flags; 47 - 48 - static inline h8300flags arch_local_save_flags(void) 49 - { 50 - h8300flags flags; 51 - 52 - __asm__ volatile ("stc ccr,%w0\n\tstc exr,%x0" : "=r" (flags)); 53 - return flags; 54 - } 55 - 56 - static inline void arch_local_irq_disable(void) 57 - { 58 - __asm__ volatile ("orc #0x80,ccr\n\t"); 59 - } 60 - 61 - static inline void arch_local_irq_enable(void) 62 - { 63 - __asm__ volatile ("andc #0x7f,ccr\n\t" 64 - "andc #0xf0,exr\n\t"); 65 - } 66 - 67 - static inline h8300flags arch_local_irq_save(void) 68 - { 69 - h8300flags flags; 70 - 71 - __asm__ volatile ("stc ccr,%w0\n\t" 72 - "stc exr,%x0\n\t" 73 - "orc #0x80,ccr\n\t" 74 - : "=r" (flags)); 75 - return flags; 76 - } 77 - 78 - static inline void arch_local_irq_restore(h8300flags flags) 79 - { 80 - __asm__ volatile ("ldc %w0,ccr\n\t" 81 - "ldc %x0,exr" 82 - : : "r" (flags) : "cc"); 83 - } 84 - 85 - static inline int arch_irqs_disabled_flags(h8300flags flags) 86 - { 87 - return (flags & 0x0080) == 0x0080; 88 - } 89 - 90 - #endif 91 - 92 - static inline int arch_irqs_disabled(void) 93 - { 94 - return arch_irqs_disabled_flags(arch_local_save_flags()); 95 - } 96 - 97 - #endif /* _H8300_IRQFLAGS_H */
-45
arch/h8300/include/asm/kgdb.h
··· 1 - /* 2 - * Copyright (C) 2015 Yoshinori Sato <ysato@users.sourceforge.jp> 3 - * 4 - * This file is subject to the terms and conditions of the GNU General Public 5 - * License. See the file "COPYING" in the main directory of this archive 6 - * for more details. 7 - */ 8 - 9 - #ifndef _ASM_H8300_KGDB_H 10 - #define _ASM_H8300_KGDB_H 11 - 12 - #define CACHE_FLUSH_IS_SAFE 1 13 - #define BUFMAX 2048 14 - 15 - enum regnames { 16 - GDB_ER0, GDB_ER1, GDB_ER2, GDB_ER3, 17 - GDB_ER4, GDB_ER5, GDB_ER6, GDB_SP, 18 - GDB_CCR, GDB_PC, 19 - GDB_CYCLLE, 20 - #if defined(CONFIG_CPU_H8S) 21 - GDB_EXR, 22 - #endif 23 - GDB_TICK, GDB_INST, 24 - #if defined(CONFIG_CPU_H8S) 25 - GDB_MACH, GDB_MACL, 26 - #endif 27 - /* do not change the last entry or anything below! */ 28 - GDB_NUMREGBYTES, /* number of registers */ 29 - }; 30 - 31 - #define GDB_SIZEOF_REG sizeof(u32) 32 - #if defined(CONFIG_CPU_H8300H) 33 - #define DBG_MAX_REG_NUM (13) 34 - #elif defined(CONFIG_CPU_H8S) 35 - #define DBG_MAX_REG_NUM (14) 36 - #endif 37 - #define NUMREGBYTES (DBG_MAX_REG_NUM * GDB_SIZEOF_REG) 38 - 39 - #define BREAK_INSTR_SIZE 2 40 - static inline void arch_kgdb_breakpoint(void) 41 - { 42 - __asm__ __volatile__("trapa #2"); 43 - } 44 - 45 - #endif /* _ASM_H8300_KGDB_H */
-6
arch/h8300/include/asm/mmu_context.h
··· 1 - #ifndef _ASM_H8300_MMU_CONTEXT_H 2 - #define _ASM_H8300_MMU_CONTEXT_H 3 - 4 - #include <asm-generic/nommu_context.h> 5 - 6 - #endif /* _ASM_H8300_MMU_CONTEXT_H */
-17
arch/h8300/include/asm/page.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef _H8300_PAGE_H 3 - #define _H8300_PAGE_H 4 - 5 - #include <asm-generic/page.h> 6 - #include <linux/types.h> 7 - 8 - #define MAP_NR(addr) (((uintptr_t)(addr)-PAGE_OFFSET) >> PAGE_SHIFT) 9 - 10 - #ifndef __ASSEMBLY__ 11 - extern unsigned long rom_length; 12 - extern unsigned long memory_start; 13 - extern unsigned long memory_end; 14 - extern unsigned long _ramend; 15 - #endif 16 - 17 - #endif
-2
arch/h8300/include/asm/page_offset.h
··· 1 - 2 - #define PAGE_OFFSET_RAW 0x00000000
-43
arch/h8300/include/asm/pgtable.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef _H8300_PGTABLE_H 3 - #define _H8300_PGTABLE_H 4 - #include <asm-generic/pgtable-nopud.h> 5 - extern void paging_init(void); 6 - #define PAGE_NONE __pgprot(0) /* these mean nothing to NO_MM */ 7 - #define PAGE_SHARED __pgprot(0) /* these mean nothing to NO_MM */ 8 - #define PAGE_COPY __pgprot(0) /* these mean nothing to NO_MM */ 9 - #define PAGE_READONLY __pgprot(0) /* these mean nothing to NO_MM */ 10 - #define PAGE_KERNEL __pgprot(0) /* these mean nothing to NO_MM */ 11 - #define __swp_type(x) (0) 12 - #define __swp_offset(x) (0) 13 - #define __swp_entry(typ, off) ((swp_entry_t) { ((typ) | ((off) << 7)) }) 14 - #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) 15 - #define __swp_entry_to_pte(x) ((pte_t) { (x).val }) 16 - #define kern_addr_valid(addr) (1) 17 - #define pgprot_writecombine(prot) (prot) 18 - #define pgprot_noncached pgprot_writecombine 19 - 20 - static inline int pte_file(pte_t pte) { return 0; } 21 - #define swapper_pg_dir ((pgd_t *) 0) 22 - /* 23 - * ZERO_PAGE is a global shared page that is always zero: used 24 - * for zero-mapped memory areas etc.. 25 - */ 26 - #define ZERO_PAGE(vaddr) (virt_to_page(0)) 27 - 28 - /* 29 - * These would be in other places but having them here reduces the diffs. 30 - */ 31 - extern unsigned int kobjsize(const void *objp); 32 - extern int is_in_rom(unsigned long); 33 - 34 - /* 35 - * All 32bit addresses are effectively valid for vmalloc... 36 - * Sort of meaningless for non-VM targets. 37 - */ 38 - #define VMALLOC_START 0 39 - #define VMALLOC_END 0xffffffff 40 - 41 - #define arch_enter_lazy_cpu_mode() do {} while (0) 42 - 43 - #endif /* _H8300_PGTABLE_H */
-126
arch/h8300/include/asm/processor.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - /* 3 - * include/asm-h8300/processor.h 4 - * 5 - * Copyright (C) 2002 Yoshinori Sato 6 - * 7 - * Based on: linux/asm-m68nommu/processor.h 8 - * 9 - * Copyright (C) 1995 Hamish Macdonald 10 - */ 11 - 12 - #ifndef __ASM_H8300_PROCESSOR_H 13 - #define __ASM_H8300_PROCESSOR_H 14 - 15 - #include <linux/compiler.h> 16 - #include <asm/ptrace.h> 17 - #include <asm/current.h> 18 - 19 - static inline unsigned long rdusp(void) 20 - { 21 - extern unsigned int _sw_usp; 22 - 23 - return _sw_usp; 24 - } 25 - 26 - static inline void wrusp(unsigned long usp) 27 - { 28 - extern unsigned int _sw_usp; 29 - 30 - _sw_usp = usp; 31 - } 32 - 33 - /* 34 - * User space process size: 3.75GB. This is hardcoded into a few places, 35 - * so don't change it unless you know what you are doing. 36 - */ 37 - #define TASK_SIZE (0xFFFFFFFFUL) 38 - 39 - #ifdef __KERNEL__ 40 - #define STACK_TOP TASK_SIZE 41 - #define STACK_TOP_MAX STACK_TOP 42 - #endif 43 - 44 - /* 45 - * This decides where the kernel will search for a free chunk of vm 46 - * space during mmap's. We won't be using it 47 - */ 48 - #define TASK_UNMAPPED_BASE 0 49 - 50 - struct thread_struct { 51 - unsigned long ksp; /* kernel stack pointer */ 52 - unsigned long usp; /* user stack pointer */ 53 - unsigned long ccr; /* saved status register */ 54 - unsigned long esp0; /* points to SR of stack frame */ 55 - struct { 56 - unsigned short *addr; 57 - unsigned short inst; 58 - } breakinfo; 59 - }; 60 - 61 - #define INIT_THREAD { \ 62 - .ksp = sizeof(init_stack) + (unsigned long)init_stack, \ 63 - .usp = 0, \ 64 - .ccr = PS_S, \ 65 - .esp0 = 0, \ 66 - .breakinfo = { \ 67 - .addr = (unsigned short *)-1, \ 68 - .inst = 0 \ 69 - } \ 70 - } 71 - 72 - /* 73 - * Do necessary setup to start up a newly executed thread. 74 - * 75 - * pass the data segment into user programs if it exists, 76 - * it can't hurt anything as far as I can tell 77 - */ 78 - #if defined(CONFIG_CPU_H8300H) 79 - #define start_thread(_regs, _pc, _usp) \ 80 - do { \ 81 - (_regs)->pc = (_pc); \ 82 - (_regs)->ccr = 0x00; /* clear all flags */ \ 83 - (_regs)->er5 = current->mm->start_data; /* GOT base */ \ 84 - (_regs)->sp = ((unsigned long)(_usp)) - sizeof(unsigned long) * 3; \ 85 - } while (0) 86 - #endif 87 - #if defined(CONFIG_CPU_H8S) 88 - #define start_thread(_regs, _pc, _usp) \ 89 - do { \ 90 - (_regs)->pc = (_pc); \ 91 - (_regs)->ccr = 0x00; /* clear kernel flag */ \ 92 - (_regs)->exr = 0x78; /* enable all interrupts */ \ 93 - (_regs)->er5 = current->mm->start_data; /* GOT base */ \ 94 - /* 14 = space for retaddr(4), vector(4), er0(4) and exr(2) on stack */ \ 95 - (_regs)->sp = ((unsigned long)(_usp)) - 14; \ 96 - } while (0) 97 - #endif 98 - 99 - /* Forward declaration, a strange C thing */ 100 - struct task_struct; 101 - 102 - /* Free all resources held by a thread. */ 103 - static inline void release_thread(struct task_struct *dead_task) 104 - { 105 - } 106 - 107 - unsigned long __get_wchan(struct task_struct *p); 108 - 109 - #define KSTK_EIP(tsk) \ 110 - ({ \ 111 - unsigned long eip = 0; \ 112 - if ((tsk)->thread.esp0 > PAGE_SIZE && \ 113 - MAP_NR((tsk)->thread.esp0) < max_mapnr) \ 114 - eip = ((struct pt_regs *) (tsk)->thread.esp0)->pc; \ 115 - eip; }) 116 - 117 - #define KSTK_ESP(tsk) ((tsk) == current ? rdusp() : (tsk)->thread.usp) 118 - 119 - #define cpu_relax() barrier() 120 - 121 - #define HARD_RESET_NOW() ({ \ 122 - local_irq_disable(); \ 123 - asm("jmp @@0"); \ 124 - }) 125 - 126 - #endif
-39
arch/h8300/include/asm/ptrace.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef _H8300_PTRACE_H 3 - #define _H8300_PTRACE_H 4 - 5 - #include <uapi/asm/ptrace.h> 6 - 7 - struct task_struct; 8 - 9 - #ifndef __ASSEMBLY__ 10 - #ifndef PS_S 11 - #define PS_S (0x10) 12 - #endif 13 - 14 - #if defined(CONFIG_CPU_H8300H) 15 - #define H8300_REGS_NO 11 16 - #endif 17 - #if defined(CONFIG_CPU_H8S) 18 - #define H8300_REGS_NO 12 19 - #endif 20 - 21 - #define arch_has_single_step() (1) 22 - 23 - #define user_mode(regs) (!((regs)->ccr & PS_S)) 24 - #define instruction_pointer(regs) ((regs)->pc) 25 - #define profile_pc(regs) instruction_pointer(regs) 26 - #define user_stack_pointer(regs) ((regs)->sp) 27 - #define current_pt_regs() ((struct pt_regs *) \ 28 - (THREAD_SIZE + (unsigned long)current_thread_info()) - 1) 29 - #define signal_pt_regs() ((struct pt_regs *)current->thread.esp0) 30 - #define current_user_stack_pointer() rdusp() 31 - #define task_pt_regs(task) \ 32 - ((struct pt_regs *) (task_stack_page(task) + THREAD_SIZE) - 1) 33 - 34 - extern long h8300_get_reg(struct task_struct *task, int regno); 35 - extern int h8300_put_reg(struct task_struct *task, int regno, 36 - unsigned long data); 37 - 38 - #endif /* __ASSEMBLY__ */ 39 - #endif /* _H8300_PTRACE_H */
-23
arch/h8300/include/asm/signal.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef _H8300_SIGNAL_H 3 - #define _H8300_SIGNAL_H 4 - 5 - #include <uapi/asm/signal.h> 6 - 7 - /* Most things should be clean enough to redefine this at will, if care 8 - is taken to make libc match. */ 9 - 10 - #define _NSIG 64 11 - #define _NSIG_BPW 32 12 - #define _NSIG_WORDS (_NSIG / _NSIG_BPW) 13 - 14 - typedef unsigned long old_sigset_t; /* at least 32 bits */ 15 - 16 - typedef struct { 17 - unsigned long sig[_NSIG_WORDS]; 18 - } sigset_t; 19 - 20 - #define __ARCH_HAS_SA_RESTORER 21 - #include <asm/sigcontext.h> 22 - 23 - #endif /* _H8300_SIGNAL_H */
-1
arch/h8300/include/asm/smp.h
··· 1 - /* nothing required here yet */
-18
arch/h8300/include/asm/string.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef _H8300_STRING_H_ 3 - #define _H8300_STRING_H_ 4 - 5 - #ifdef __KERNEL__ /* only set these up for kernel code */ 6 - 7 - #include <asm/setup.h> 8 - #include <asm/page.h> 9 - 10 - #define __HAVE_ARCH_MEMSET 11 - extern void *memset(void *s, int c, size_t count); 12 - 13 - #define __HAVE_ARCH_MEMCPY 14 - extern void *memcpy(void *d, const void *s, size_t count); 15 - 16 - #endif /* KERNEL */ 17 - 18 - #endif
-52
arch/h8300/include/asm/switch_to.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef _H8300_SWITCH_TO_H 3 - #define _H8300_SWITCH_TO_H 4 - 5 - /* 6 - * switch_to(n) should switch tasks to task ptr, first checking that 7 - * ptr isn't the current task, in which case it does nothing. This 8 - * also clears the TS-flag if the task we switched to has used the 9 - * math co-processor latest. 10 - */ 11 - /* 12 - * switch_to() saves the extra registers, that are not saved 13 - * automatically by SAVE_SWITCH_STACK in resume(), ie. d0-d5 and 14 - * a0-a1. Some of these are used by schedule() and its predecessors 15 - * and so we might get see unexpected behaviors when a task returns 16 - * with unexpected register values. 17 - * 18 - * syscall stores these registers itself and none of them are used 19 - * by syscall after the function in the syscall has been called. 20 - * 21 - * Beware that resume now expects *next to be in d1 and the offset of 22 - * tss to be in a1. This saves a few instructions as we no longer have 23 - * to push them onto the stack and read them back right after. 24 - * 25 - * 02/17/96 - Jes Sorensen (jds@kom.auc.dk) 26 - * 27 - * Changed 96/09/19 by Andreas Schwab 28 - * pass prev in a0, next in a1, offset of tss in d1, and whether 29 - * the mm structures are shared in d2 (to avoid atc flushing). 30 - * 31 - * H8/300 Porting 2002/09/04 Yoshinori Sato 32 - */ 33 - 34 - asmlinkage void resume(void); 35 - #define switch_to(prev, next, last) \ 36 - do { \ 37 - void *_last; \ 38 - __asm__ __volatile__( \ 39 - "mov.l %1, er0\n\t" \ 40 - "mov.l %2, er1\n\t" \ 41 - "mov.l %3, er2\n\t" \ 42 - "jsr @_resume\n\t" \ 43 - "mov.l er2,%0\n\t" \ 44 - : "=r" (_last) \ 45 - : "r" (&(prev->thread)), \ 46 - "r" (&(next->thread)), \ 47 - "g" (prev) \ 48 - : "cc", "er0", "er1", "er2", "er3"); \ 49 - (last) = _last; \ 50 - } while (0) 51 - 52 - #endif /* _H8300_SWITCH_TO_H */
-43
arch/h8300/include/asm/syscall.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef __ASM_H8300_SYSCALLS_32_H 3 - #define __ASM_H8300_SYSCALLS_32_H 4 - 5 - #ifdef __KERNEL__ 6 - 7 - #include <linux/compiler.h> 8 - #include <linux/linkage.h> 9 - #include <linux/types.h> 10 - #include <linux/ptrace.h> 11 - #include <uapi/linux/audit.h> 12 - 13 - static inline int 14 - syscall_get_nr(struct task_struct *task, struct pt_regs *regs) 15 - { 16 - return regs->orig_er0; 17 - } 18 - 19 - static inline void 20 - syscall_get_arguments(struct task_struct *task, struct pt_regs *regs, 21 - unsigned long *args) 22 - { 23 - *args++ = regs->er1; 24 - *args++ = regs->er2; 25 - *args++ = regs->er3; 26 - *args++ = regs->er4; 27 - *args++ = regs->er5; 28 - *args = regs->er6; 29 - } 30 - 31 - static inline int 32 - syscall_get_arch(struct task_struct *task) 33 - { 34 - return AUDIT_ARCH_H8300; 35 - } 36 - 37 - 38 - /* Misc syscall related bits */ 39 - asmlinkage long do_syscall_trace_enter(struct pt_regs *regs); 40 - asmlinkage void do_syscall_trace_leave(struct pt_regs *regs); 41 - 42 - #endif /* __KERNEL__ */ 43 - #endif /* __ASM_H8300_SYSCALLS_32_H */
-102
arch/h8300/include/asm/thread_info.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - /* thread_info.h: h8300 low-level thread information 3 - * adapted from the i386 and PPC versions by Yoshinori Sato <ysato@users.sourceforge.jp> 4 - * 5 - * Copyright (C) 2002 David Howells (dhowells@redhat.com) 6 - * - Incorporating suggestions made by Linus Torvalds and Dave Miller 7 - */ 8 - 9 - #ifndef _ASM_THREAD_INFO_H 10 - #define _ASM_THREAD_INFO_H 11 - 12 - #include <asm/page.h> 13 - 14 - #ifdef __KERNEL__ 15 - 16 - /* 17 - * Size of kernel stack for each process. This must be a power of 2... 18 - */ 19 - #define THREAD_SIZE_ORDER 1 20 - #define THREAD_SIZE 8192 /* 2 pages */ 21 - 22 - #ifndef __ASSEMBLY__ 23 - 24 - /* 25 - * low level task data. 26 - * If you change this, change the TI_* offsets below to match. 27 - */ 28 - struct thread_info { 29 - struct task_struct *task; /* main task structure */ 30 - unsigned long flags; /* low level flags */ 31 - int cpu; /* cpu we're on */ 32 - int preempt_count; /* 0 => preemptable, <0 => BUG */ 33 - }; 34 - 35 - /* 36 - * macros/functions for gaining access to the thread information structure 37 - */ 38 - #define INIT_THREAD_INFO(tsk) \ 39 - { \ 40 - .task = &tsk, \ 41 - .flags = 0, \ 42 - .cpu = 0, \ 43 - .preempt_count = INIT_PREEMPT_COUNT, \ 44 - } 45 - 46 - /* how to get the thread information struct from C */ 47 - static inline struct thread_info *current_thread_info(void) 48 - { 49 - struct thread_info *ti; 50 - 51 - __asm__("mov.l sp, %0\n\t" 52 - "and.w %1, %T0" 53 - : "=&r"(ti) 54 - : "i" (~(THREAD_SIZE-1) & 0xffff)); 55 - return ti; 56 - } 57 - 58 - #endif /* __ASSEMBLY__ */ 59 - 60 - /* 61 - * thread information flag bit numbers 62 - */ 63 - #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ 64 - #define TIF_SIGPENDING 1 /* signal pending */ 65 - #define TIF_NEED_RESCHED 2 /* rescheduling necessary */ 66 - #define TIF_SINGLESTEP 3 /* singlestepping active */ 67 - #define TIF_MEMDIE 4 /* is terminating due to OOM killer */ 68 - #define TIF_RESTORE_SIGMASK 5 /* restore signal mask in do_signal() */ 69 - #define TIF_NOTIFY_RESUME 6 /* callback before returning to user */ 70 - #define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */ 71 - #define TIF_SYSCALL_TRACEPOINT 8 /* for ftrace syscall instrumentation */ 72 - #define TIF_POLLING_NRFLAG 9 /* true if poll_idle() is polling TIF_NEED_RESCHED */ 73 - #define TIF_NOTIFY_SIGNAL 10 /* signal notifications exist */ 74 - 75 - /* as above, but as bit values */ 76 - #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) 77 - #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) 78 - #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) 79 - #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) 80 - #define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP) 81 - #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) 82 - #define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT) 83 - #define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) 84 - #define _TIF_NOTIFY_SIGNAL (1 << TIF_NOTIFY_SIGNAL) 85 - 86 - /* work to do in syscall trace */ 87 - #define _TIF_WORK_SYSCALL_MASK (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | \ 88 - _TIF_SYSCALL_AUDIT | _TIF_SYSCALL_TRACEPOINT) 89 - 90 - /* work to do on any return to u-space */ 91 - #define _TIF_ALLWORK_MASK (_TIF_SYSCALL_TRACE | _TIF_SIGPENDING | \ 92 - _TIF_NEED_RESCHED | _TIF_SYSCALL_AUDIT | \ 93 - _TIF_SINGLESTEP | _TIF_NOTIFY_RESUME | \ 94 - _TIF_SYSCALL_TRACEPOINT | _TIF_NOTIFY_SIGNAL) 95 - 96 - /* work to do on interrupt/exception return */ 97 - #define _TIF_WORK_MASK (_TIF_ALLWORK_MASK & ~(_TIF_SYSCALL_TRACE | \ 98 - _TIF_SYSCALL_AUDIT | _TIF_SINGLESTEP)) 99 - 100 - #endif /* __KERNEL__ */ 101 - 102 - #endif /* _ASM_THREAD_INFO_H */
-7
arch/h8300/include/asm/tlb.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef __H8300_TLB_H__ 3 - #define __H8300_TLB_H__ 4 - 5 - #include <asm-generic/tlb.h> 6 - 7 - #endif
-41
arch/h8300/include/asm/traps.h
··· 1 - /* 2 - * linux/include/asm-h8300/traps.h 3 - * 4 - * Copyright (C) 2003 Yoshinori Sato <ysato@users.sourceforge.jp> 5 - * 6 - * This file is subject to the terms and conditions of the GNU General Public 7 - * License. See the file COPYING in the main directory of this archive 8 - * for more details. 9 - */ 10 - 11 - #ifndef _H8300_TRAPS_H 12 - #define _H8300_TRAPS_H 13 - 14 - extern void _system_call(void); 15 - extern void _interrupt_entry(void); 16 - extern void _trace_break(void); 17 - extern void _nmi(void); 18 - extern void _interrupt_entry(void); 19 - 20 - extern unsigned long *_interrupt_redirect_table; 21 - 22 - #define JMP_OP 0x5a000000 23 - #define JSR_OP 0x5e000000 24 - #define VECTOR(address) ((JMP_OP)|((unsigned long)address)) 25 - #define REDIRECT(address) ((JSR_OP)|((unsigned long)address)) 26 - #define CPU_VECTOR ((unsigned long *)0x000000) 27 - #define ADDR_MASK (0xffffff) 28 - 29 - #define TRACE_VEC 5 30 - 31 - #define TRAP0_VEC 8 32 - #define TRAP1_VEC 9 33 - #define TRAP2_VEC 10 34 - #define TRAP3_VEC 11 35 - 36 - extern char _start[], _etext[]; 37 - #define check_kernel_text(addr) \ 38 - ((addr >= (unsigned long)(_start)) && \ 39 - (addr < (unsigned long)(_etext)) && !(addr & 1)) 40 - 41 - #endif /* _H8300_TRAPS_H */
-71
arch/h8300/include/asm/user.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef _H8300_USER_H 3 - #define _H8300_USER_H 4 - 5 - #include <asm/page.h> 6 - 7 - /* Core file format: The core file is written in such a way that gdb 8 - can understand it and provide useful information to the user (under 9 - linux we use the 'trad-core' bfd). There are quite a number of 10 - obstacles to being able to view the contents of the floating point 11 - registers, and until these are solved you will not be able to view the 12 - contents of them. Actually, you can read in the core file and look at 13 - the contents of the user struct to find out what the floating point 14 - registers contain. 15 - The actual file contents are as follows: 16 - UPAGE: 1 page consisting of a user struct that tells gdb what is present 17 - in the file. Directly after this is a copy of the task_struct, which 18 - is currently not used by gdb, but it may come in useful at some point. 19 - All of the registers are stored as part of the upage. The upage should 20 - always be only one page. 21 - DATA: The data area is stored. We use current->end_text to 22 - current->brk to pick up all of the user variables, plus any memory 23 - that may have been malloced. No attempt is made to determine if a page 24 - is demand-zero or if a page is totally unused, we just cover the entire 25 - range. All of the addresses are rounded in such a way that an integral 26 - number of pages is written. 27 - STACK: We need the stack information in order to get a meaningful 28 - backtrace. We need to write the data from (esp) to 29 - current->start_stack, so we round each of these off in order to be able 30 - to write an integer number of pages. 31 - The minimum core file size is 3 pages, or 12288 bytes. 32 - */ 33 - 34 - /* This is the old layout of "struct pt_regs" as of Linux 1.x, and 35 - is still the layout used by user (the new pt_regs doesn't have 36 - all registers). */ 37 - struct user_regs_struct { 38 - long er1, er2, er3, er4, er5, er6; 39 - long er0; 40 - long usp; 41 - long orig_er0; 42 - long ccr; 43 - long pc; 44 - }; 45 - 46 - /* When the kernel dumps core, it starts by dumping the user struct - 47 - this will be used by gdb to figure out where the data and stack segments 48 - are within the file, and what virtual addresses to use. */ 49 - struct user { 50 - /* We start with the registers, to mimic the way that "memory" is returned 51 - from the ptrace(3,...) function. */ 52 - struct user_regs_struct regs; /* Where the registers are actually stored */ 53 - /* ptrace does not yet supply these. Someday.... */ 54 - /* The rest of this junk is to help gdb figure out what goes where */ 55 - unsigned long int u_tsize; /* Text segment size (pages). */ 56 - unsigned long int u_dsize; /* Data segment size (pages). */ 57 - unsigned long int u_ssize; /* Stack segment size (pages). */ 58 - unsigned long start_code; /* Starting virtual address of text. */ 59 - unsigned long start_stack; /* Starting virtual address of stack area. 60 - This is actually the bottom of the stack, 61 - the top of the stack is always found in the 62 - esp register. */ 63 - long int signal; /* Signal that caused the core dump. */ 64 - int reserved; /* No longer used */ 65 - unsigned long u_ar0; /* Used by gdb to help find the values for */ 66 - /* the registers. */ 67 - unsigned long magic; /* To uniquely identify a core file */ 68 - char u_comm[32]; /* User command that was responsible */ 69 - }; 70 - 71 - #endif
-4
arch/h8300/include/asm/vmalloc.h
··· 1 - #ifndef _ASM_H8300_VMALLOC_H 2 - #define _ASM_H8300_VMALLOC_H 3 - 4 - #endif /* _ASM_H8300_VMALLOC_H */
-2
arch/h8300/include/uapi/asm/Kbuild
··· 1 - # SPDX-License-Identifier: GPL-2.0 2 - generic-y += ucontext.h
-7
arch/h8300/include/uapi/asm/byteorder.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 - #ifndef _H8300_BYTEORDER_H 3 - #define _H8300_BYTEORDER_H 4 - 5 - #include <linux/byteorder/big_endian.h> 6 - 7 - #endif /* _H8300_BYTEORDER_H */
-13
arch/h8300/include/uapi/asm/posix_types.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */ 2 - #ifndef _UAPI_ASM_POSIX_TYPES_H 3 - #define _UAPI_ASM_POSIX_TYPES_H 4 - 5 - /* h8300-unknown-linux required long */ 6 - #define __kernel_size_t __kernel_size_t 7 - typedef unsigned long __kernel_size_t; 8 - typedef long __kernel_ssize_t; 9 - typedef long __kernel_ptrdiff_t; 10 - 11 - #include <asm-generic/posix_types.h> 12 - 13 - #endif /* _UAPI_ASM_POSIX_TYPES_H */
-43
arch/h8300/include/uapi/asm/ptrace.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 - #ifndef _UAPI_H8300_PTRACE_H 3 - #define _UAPI_H8300_PTRACE_H 4 - 5 - #ifndef __ASSEMBLY__ 6 - 7 - #define PT_ER1 0 8 - #define PT_ER2 1 9 - #define PT_ER3 2 10 - #define PT_ER4 3 11 - #define PT_ER5 4 12 - #define PT_ER6 5 13 - #define PT_ER0 6 14 - #define PT_USP 7 15 - #define PT_ORIG_ER0 8 16 - #define PT_CCR 9 17 - #define PT_PC 10 18 - #define PT_EXR 11 19 - 20 - /* this struct defines the way the registers are stored on the 21 - stack during a system call. */ 22 - 23 - struct pt_regs { 24 - long retpc; 25 - long er4; 26 - long er5; 27 - long er6; 28 - long er3; 29 - long er2; 30 - long er1; 31 - long orig_er0; 32 - long sp; 33 - unsigned short ccr; 34 - long er0; 35 - long vector; 36 - #if defined(__H8300S__) 37 - unsigned short exr; 38 - #endif 39 - unsigned long pc; 40 - } __attribute__((aligned(2), packed)); 41 - 42 - #endif /* __ASSEMBLY__ */ 43 - #endif /* _UAPI_H8300_PTRACE_H */
-19
arch/h8300/include/uapi/asm/sigcontext.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 - #ifndef _ASM_H8300_SIGCONTEXT_H 3 - #define _ASM_H8300_SIGCONTEXT_H 4 - 5 - struct sigcontext { 6 - unsigned long sc_mask; /* old sigmask */ 7 - unsigned long sc_usp; /* old user stack pointer */ 8 - unsigned long sc_er0; 9 - unsigned long sc_er1; 10 - unsigned long sc_er2; 11 - unsigned long sc_er3; 12 - unsigned long sc_er4; 13 - unsigned long sc_er5; 14 - unsigned long sc_er6; 15 - unsigned short sc_ccr; 16 - unsigned long sc_pc; 17 - }; 18 - 19 - #endif
-92
arch/h8300/include/uapi/asm/signal.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 - #ifndef _UAPI_H8300_SIGNAL_H 3 - #define _UAPI_H8300_SIGNAL_H 4 - 5 - #include <linux/types.h> 6 - 7 - /* Avoid too many header ordering problems. */ 8 - struct siginfo; 9 - 10 - #ifndef __KERNEL__ 11 - /* Here we must cater to libcs that poke about in kernel headers. */ 12 - 13 - #define NSIG 32 14 - typedef unsigned long sigset_t; 15 - 16 - #endif /* __KERNEL__ */ 17 - 18 - #define SIGHUP 1 19 - #define SIGINT 2 20 - #define SIGQUIT 3 21 - #define SIGILL 4 22 - #define SIGTRAP 5 23 - #define SIGABRT 6 24 - #define SIGIOT 6 25 - #define SIGBUS 7 26 - #define SIGFPE 8 27 - #define SIGKILL 9 28 - #define SIGUSR1 10 29 - #define SIGSEGV 11 30 - #define SIGUSR2 12 31 - #define SIGPIPE 13 32 - #define SIGALRM 14 33 - #define SIGTERM 15 34 - #define SIGSTKFLT 16 35 - #define SIGCHLD 17 36 - #define SIGCONT 18 37 - #define SIGSTOP 19 38 - #define SIGTSTP 20 39 - #define SIGTTIN 21 40 - #define SIGTTOU 22 41 - #define SIGURG 23 42 - #define SIGXCPU 24 43 - #define SIGXFSZ 25 44 - #define SIGVTALRM 26 45 - #define SIGPROF 27 46 - #define SIGWINCH 28 47 - #define SIGIO 29 48 - #define SIGPOLL SIGIO 49 - /* 50 - #define SIGLOST 29 51 - */ 52 - #define SIGPWR 30 53 - #define SIGSYS 31 54 - #define SIGUNUSED 31 55 - 56 - /* These should not be considered constants from userland. */ 57 - #define SIGRTMIN 32 58 - #define SIGRTMAX _NSIG 59 - 60 - #define SA_RESTORER 0x04000000 61 - 62 - #define MINSIGSTKSZ 2048 63 - #define SIGSTKSZ 8192 64 - 65 - #include <asm-generic/signal-defs.h> 66 - 67 - #ifndef __KERNEL__ 68 - /* Here we must cater to libcs that poke about in kernel headers. */ 69 - 70 - struct sigaction { 71 - union { 72 - __sighandler_t _sa_handler; 73 - void (*_sa_sigaction)(int, struct siginfo *, void *); 74 - } _u; 75 - sigset_t sa_mask; 76 - unsigned long sa_flags; 77 - void (*sa_restorer)(void); 78 - }; 79 - 80 - #define sa_handler _u._sa_handler 81 - #define sa_sigaction _u._sa_sigaction 82 - 83 - #endif /* __KERNEL__ */ 84 - 85 - typedef struct sigaltstack { 86 - void *ss_sp; 87 - int ss_flags; 88 - __kernel_size_t ss_size; 89 - } stack_t; 90 - 91 - 92 - #endif /* _UAPI_H8300_SIGNAL_H */
-8
arch/h8300/include/uapi/asm/unistd.h
··· 1 - #define __ARCH_NOMMU 2 - 3 - #define __ARCH_WANT_RENAMEAT 4 - #define __ARCH_WANT_STAT64 5 - #define __ARCH_WANT_SET_GET_RLIMIT 6 - #define __ARCH_WANT_TIME32_SYSCALLS 7 - 8 - #include <asm-generic/unistd.h>
-2
arch/h8300/kernel/.gitignore
··· 1 - # SPDX-License-Identifier: GPL-2.0-only 2 - vmlinux.lds
-22
arch/h8300/kernel/Makefile
··· 1 - # SPDX-License-Identifier: GPL-2.0 2 - # 3 - # Makefile for the linux kernel. 4 - # 5 - 6 - extra-y := vmlinux.lds 7 - 8 - obj-y := process.o traps.o ptrace.o \ 9 - signal.o setup.o syscalls.o \ 10 - irq.o entry.o 11 - 12 - obj-$(CONFIG_ROMKERNEL) += head_rom.o 13 - obj-$(CONFIG_RAMKERNEL) += head_ram.o 14 - 15 - obj-$(CONFIG_MODULES) += module.o h8300_ksyms.o 16 - obj-$(CONFIG_H8300H_SIM) += sim-console.o 17 - obj-$(CONFIG_H8S_SIM) += sim-console.o 18 - 19 - obj-$(CONFIG_CPU_H8300H) += ptrace_h.o 20 - obj-$(CONFIG_CPU_H8S) += ptrace_s.o 21 - 22 - obj-$(CONFIG_KGDB) += kgdb.o
-70
arch/h8300/kernel/asm-offsets.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /* 3 - * This program is used to generate definitions needed by 4 - * assembly language modules. 5 - * 6 - * We use the technique used in the OSF Mach kernel code: 7 - * generate asm statements containing #defines, 8 - * compile this file to assembler, and then extract the 9 - * #defines from the assembly-language output. 10 - */ 11 - 12 - #include <linux/stddef.h> 13 - #include <linux/sched.h> 14 - #include <linux/kernel_stat.h> 15 - #include <linux/ptrace.h> 16 - #include <linux/hardirq.h> 17 - #include <linux/kbuild.h> 18 - #include <asm/irq.h> 19 - #include <asm/ptrace.h> 20 - 21 - int main(void) 22 - { 23 - /* offsets into the task struct */ 24 - OFFSET(TASK_FLAGS, task_struct, flags); 25 - OFFSET(TASK_PTRACE, task_struct, ptrace); 26 - OFFSET(TASK_BLOCKED, task_struct, blocked); 27 - OFFSET(TASK_THREAD, task_struct, thread); 28 - OFFSET(TASK_THREAD_INFO, task_struct, stack); 29 - OFFSET(TASK_MM, task_struct, mm); 30 - OFFSET(TASK_ACTIVE_MM, task_struct, active_mm); 31 - 32 - /* offsets into the irq_cpustat_t struct */ 33 - DEFINE(CPUSTAT_SOFTIRQ_PENDING, offsetof(irq_cpustat_t, 34 - __softirq_pending)); 35 - 36 - /* offsets into the thread struct */ 37 - OFFSET(THREAD_KSP, thread_struct, ksp); 38 - OFFSET(THREAD_USP, thread_struct, usp); 39 - OFFSET(THREAD_CCR, thread_struct, ccr); 40 - 41 - /* offsets into the pt_regs struct */ 42 - DEFINE(LER0, offsetof(struct pt_regs, er0) - sizeof(long)); 43 - DEFINE(LER1, offsetof(struct pt_regs, er1) - sizeof(long)); 44 - DEFINE(LER2, offsetof(struct pt_regs, er2) - sizeof(long)); 45 - DEFINE(LER3, offsetof(struct pt_regs, er3) - sizeof(long)); 46 - DEFINE(LER4, offsetof(struct pt_regs, er4) - sizeof(long)); 47 - DEFINE(LER5, offsetof(struct pt_regs, er5) - sizeof(long)); 48 - DEFINE(LER6, offsetof(struct pt_regs, er6) - sizeof(long)); 49 - DEFINE(LORIG, offsetof(struct pt_regs, orig_er0) - sizeof(long)); 50 - DEFINE(LSP, offsetof(struct pt_regs, sp) - sizeof(long)); 51 - DEFINE(LCCR, offsetof(struct pt_regs, ccr) - sizeof(long)); 52 - DEFINE(LVEC, offsetof(struct pt_regs, vector) - sizeof(long)); 53 - #if defined(CONFIG_CPU_H8S) 54 - DEFINE(LEXR, offsetof(struct pt_regs, exr) - sizeof(long)); 55 - #endif 56 - DEFINE(LRET, offsetof(struct pt_regs, pc) - sizeof(long)); 57 - 58 - DEFINE(PT_PTRACED, PT_PTRACED); 59 - 60 - /* offsets in thread_info structure */ 61 - OFFSET(TI_TASK, thread_info, task); 62 - OFFSET(TI_FLAGS, thread_info, flags); 63 - OFFSET(TI_CPU, thread_info, cpu); 64 - OFFSET(TI_PRE, thread_info, preempt_count); 65 - #ifdef CONFIG_PREEMPTION 66 - DEFINE(TI_PRE_COUNT, offsetof(struct thread_info, preempt_count)); 67 - #endif 68 - 69 - return 0; 70 - }
-433
arch/h8300/kernel/entry.S
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - /* 3 - * 4 - * linux/arch/h8300/kernel/entry.S 5 - * 6 - * Yoshinori Sato <ysato@users.sourceforge.jp> 7 - * David McCullough <davidm@snapgear.com> 8 - * 9 - */ 10 - 11 - /* 12 - * entry.S 13 - * include exception/interrupt gateway 14 - * system call entry 15 - */ 16 - 17 - #include <linux/sys.h> 18 - #include <asm/unistd.h> 19 - #include <asm/setup.h> 20 - #include <asm/linkage.h> 21 - #include <asm/asm-offsets.h> 22 - #include <asm/thread_info.h> 23 - #include <asm/errno.h> 24 - 25 - #if defined(CONFIG_CPU_H8300H) 26 - #define USERRET 8 27 - INTERRUPTS = 64 28 - .h8300h 29 - .macro SHLL2 reg 30 - shll.l \reg 31 - shll.l \reg 32 - .endm 33 - .macro SHLR2 reg 34 - shlr.l \reg 35 - shlr.l \reg 36 - .endm 37 - .macro SAVEREGS 38 - mov.l er0,@-sp 39 - mov.l er1,@-sp 40 - mov.l er2,@-sp 41 - mov.l er3,@-sp 42 - .endm 43 - .macro RESTOREREGS 44 - mov.l @sp+,er3 45 - mov.l @sp+,er2 46 - .endm 47 - .macro SAVEEXR 48 - .endm 49 - .macro RESTOREEXR 50 - .endm 51 - #endif 52 - #if defined(CONFIG_CPU_H8S) 53 - #define USERRET 10 54 - #define USEREXR 8 55 - INTERRUPTS = 128 56 - .h8300s 57 - .macro SHLL2 reg 58 - shll.l #2,\reg 59 - .endm 60 - .macro SHLR2 reg 61 - shlr.l #2,\reg 62 - .endm 63 - .macro SAVEREGS 64 - stm.l er0-er3,@-sp 65 - .endm 66 - .macro RESTOREREGS 67 - ldm.l @sp+,er2-er3 68 - .endm 69 - .macro SAVEEXR 70 - mov.w @(USEREXR:16,er0),r1 71 - mov.w r1,@(LEXR-LER3:16,sp) /* copy EXR */ 72 - .endm 73 - .macro RESTOREEXR 74 - mov.w @(LEXR-LER1:16,sp),r1 /* restore EXR */ 75 - mov.b r1l,r1h 76 - mov.w r1,@(USEREXR:16,er0) 77 - .endm 78 - #endif 79 - 80 - 81 - /* CPU context save/restore macros. */ 82 - 83 - .macro SAVE_ALL 84 - mov.l er0,@-sp 85 - stc ccr,r0l /* check kernel mode */ 86 - btst #4,r0l 87 - bne 5f 88 - 89 - /* user mode */ 90 - mov.l sp,@_sw_usp 91 - mov.l @sp,er0 /* restore saved er0 */ 92 - orc #0x10,ccr /* switch kernel stack */ 93 - mov.l @_sw_ksp,sp 94 - sub.l #(LRET-LORIG),sp /* allocate LORIG - LRET */ 95 - SAVEREGS 96 - mov.l @_sw_usp,er0 97 - mov.l @(USERRET:16,er0),er1 /* copy the RET addr */ 98 - mov.l er1,@(LRET-LER3:16,sp) 99 - SAVEEXR 100 - 101 - mov.l @(LORIG-LER3:16,sp),er0 102 - mov.l er0,@(LER0-LER3:16,sp) /* copy ER0 */ 103 - mov.w e1,r1 /* e1 highbyte = ccr */ 104 - and #0xef,r1h /* mask mode? flag */ 105 - bra 6f 106 - 5: 107 - /* kernel mode */ 108 - mov.l @sp,er0 /* restore saved er0 */ 109 - subs #2,sp /* set dummy ccr */ 110 - subs #4,sp /* set dummp sp */ 111 - SAVEREGS 112 - mov.w @(LRET-LER3:16,sp),r1 /* copy old ccr */ 113 - 6: 114 - mov.b r1h,r1l 115 - mov.b #0,r1h 116 - mov.w r1,@(LCCR-LER3:16,sp) /* set ccr */ 117 - mov.l @_sw_usp,er2 118 - mov.l er2,@(LSP-LER3:16,sp) /* set usp */ 119 - mov.l er6,@-sp /* syscall arg #6 */ 120 - mov.l er5,@-sp /* syscall arg #5 */ 121 - mov.l er4,@-sp /* syscall arg #4 */ 122 - .endm /* r1 = ccr */ 123 - 124 - .macro RESTORE_ALL 125 - mov.l @sp+,er4 126 - mov.l @sp+,er5 127 - mov.l @sp+,er6 128 - RESTOREREGS 129 - mov.w @(LCCR-LER1:16,sp),r0 /* check kernel mode */ 130 - btst #4,r0l 131 - bne 7f 132 - 133 - orc #0xc0,ccr 134 - mov.l @(LSP-LER1:16,sp),er0 135 - mov.l @(LER0-LER1:16,sp),er1 /* restore ER0 */ 136 - mov.l er1,@er0 137 - RESTOREEXR 138 - mov.w @(LCCR-LER1:16,sp),r1 /* restore the RET addr */ 139 - mov.b r1l,r1h 140 - mov.b @(LRET+1-LER1:16,sp),r1l 141 - mov.w r1,e1 142 - mov.w @(LRET+2-LER1:16,sp),r1 143 - mov.l er1,@(USERRET:16,er0) 144 - 145 - mov.l @sp+,er1 146 - add.l #(LRET-LER1),sp /* remove LORIG - LRET */ 147 - mov.l sp,@_sw_ksp 148 - andc #0xef,ccr /* switch to user mode */ 149 - mov.l er0,sp 150 - bra 8f 151 - 7: 152 - mov.l @sp+,er1 153 - add.l #10,sp 154 - 8: 155 - mov.l @sp+,er0 156 - adds #4,sp /* remove the sw created LVEC */ 157 - rte 158 - .endm 159 - 160 - .globl _system_call 161 - .globl ret_from_exception 162 - .globl ret_from_fork 163 - .globl ret_from_kernel_thread 164 - .globl ret_from_interrupt 165 - .globl _interrupt_redirect_table 166 - .globl _sw_ksp,_sw_usp 167 - .globl _resume 168 - .globl _interrupt_entry 169 - .globl _trace_break 170 - .globl _nmi 171 - 172 - #if defined(CONFIG_ROMKERNEL) 173 - .section .int_redirect,"ax" 174 - _interrupt_redirect_table: 175 - #if defined(CONFIG_CPU_H8300H) 176 - .rept 7 177 - .long 0 178 - .endr 179 - #endif 180 - #if defined(CONFIG_CPU_H8S) 181 - .rept 5 182 - .long 0 183 - .endr 184 - jmp @_trace_break 185 - .long 0 186 - #endif 187 - 188 - jsr @_interrupt_entry /* NMI */ 189 - jmp @_system_call /* TRAPA #0 (System call) */ 190 - .long 0 191 - #if defined(CONFIG_KGDB) 192 - jmp @_kgdb_trap 193 - #else 194 - .long 0 195 - #endif 196 - jmp @_trace_break /* TRAPA #3 (breakpoint) */ 197 - .rept INTERRUPTS-12 198 - jsr @_interrupt_entry 199 - .endr 200 - #endif 201 - #if defined(CONFIG_RAMKERNEL) 202 - .globl _interrupt_redirect_table 203 - .section .bss 204 - _interrupt_redirect_table: 205 - .space 4 206 - #endif 207 - 208 - .section .text 209 - .align 2 210 - _interrupt_entry: 211 - SAVE_ALL 212 - /* r1l is saved ccr */ 213 - mov.l sp,er0 214 - add.l #LVEC,er0 215 - btst #4,r1l 216 - bne 1f 217 - /* user LVEC */ 218 - mov.l @_sw_usp,er0 219 - adds #4,er0 220 - 1: 221 - mov.l @er0,er0 /* LVEC address */ 222 - #if defined(CONFIG_ROMKERNEL) 223 - sub.l #_interrupt_redirect_table,er0 224 - #endif 225 - #if defined(CONFIG_RAMKERNEL) 226 - mov.l @_interrupt_redirect_table,er1 227 - sub.l er1,er0 228 - #endif 229 - SHLR2 er0 230 - dec.l #1,er0 231 - mov.l sp,er1 232 - subs #4,er1 /* adjust ret_pc */ 233 - #if defined(CONFIG_CPU_H8S) 234 - orc #7,exr 235 - #endif 236 - jsr @do_IRQ 237 - jmp @ret_from_interrupt 238 - 239 - _system_call: 240 - subs #4,sp /* dummy LVEC */ 241 - SAVE_ALL 242 - /* er0: syscall nr */ 243 - andc #0xbf,ccr 244 - mov.l er0,er4 245 - 246 - /* save top of frame */ 247 - mov.l sp,er0 248 - jsr @set_esp0 249 - andc #0x3f,ccr 250 - mov.l sp,er2 251 - and.w #0xe000,r2 252 - mov.l @(TI_FLAGS:16,er2),er2 253 - and.w #_TIF_WORK_SYSCALL_MASK,r2 254 - beq 1f 255 - mov.l sp,er0 256 - jsr @do_syscall_trace_enter 257 - 1: 258 - cmp.l #__NR_syscalls,er4 259 - bcc badsys 260 - SHLL2 er4 261 - mov.l #_sys_call_table,er0 262 - add.l er4,er0 263 - mov.l @er0,er4 264 - beq ret_from_exception:16 265 - mov.l @(LER1:16,sp),er0 266 - mov.l @(LER2:16,sp),er1 267 - mov.l @(LER3:16,sp),er2 268 - jsr @er4 269 - mov.l er0,@(LER0:16,sp) /* save the return value */ 270 - mov.l sp,er2 271 - and.w #0xe000,r2 272 - mov.l @(TI_FLAGS:16,er2),er2 273 - and.w #_TIF_WORK_SYSCALL_MASK,r2 274 - beq 2f 275 - mov.l sp,er0 276 - jsr @do_syscall_trace_leave 277 - 2: 278 - orc #0xc0,ccr 279 - bra resume_userspace 280 - 281 - badsys: 282 - mov.l #-ENOSYS,er0 283 - mov.l er0,@(LER0:16,sp) 284 - bra resume_userspace 285 - 286 - #if !defined(CONFIG_PREEMPTION) 287 - #define resume_kernel restore_all 288 - #endif 289 - 290 - ret_from_exception: 291 - #if defined(CONFIG_PREEMPTION) 292 - orc #0xc0,ccr 293 - #endif 294 - ret_from_interrupt: 295 - mov.b @(LCCR+1:16,sp),r0l 296 - btst #4,r0l 297 - bne resume_kernel:16 /* return from kernel */ 298 - resume_userspace: 299 - andc #0xbf,ccr 300 - mov.l sp,er4 301 - and.w #0xe000,r4 /* er4 <- current thread info */ 302 - mov.l @(TI_FLAGS:16,er4),er1 303 - and.l #_TIF_WORK_MASK,er1 304 - beq restore_all:8 305 - work_pending: 306 - btst #TIF_NEED_RESCHED,r1l 307 - bne work_resched:8 308 - /* work notifysig */ 309 - mov.l sp,er0 310 - subs #4,er0 /* er0: pt_regs */ 311 - jsr @do_notify_resume 312 - bra resume_userspace:8 313 - work_resched: 314 - mov.l sp,er0 315 - jsr @set_esp0 316 - jsr @schedule 317 - bra resume_userspace:8 318 - restore_all: 319 - RESTORE_ALL /* Does RTE */ 320 - 321 - #if defined(CONFIG_PREEMPTION) 322 - resume_kernel: 323 - mov.l @(TI_PRE_COUNT:16,er4),er0 324 - bne restore_all:8 325 - need_resched: 326 - mov.l @(TI_FLAGS:16,er4),er0 327 - btst #TIF_NEED_RESCHED,r0l 328 - beq restore_all:8 329 - mov.b @(LCCR+1:16,sp),r0l /* Interrupt Enabled? */ 330 - bmi restore_all:8 331 - mov.l sp,er0 332 - jsr @set_esp0 333 - jsr @preempt_schedule_irq 334 - bra need_resched:8 335 - #endif 336 - 337 - ret_from_fork: 338 - mov.l er2,er0 339 - jsr @schedule_tail 340 - jmp @ret_from_exception 341 - 342 - ret_from_kernel_thread: 343 - mov.l er2,er0 344 - jsr @schedule_tail 345 - mov.l @(LER4:16,sp),er0 346 - mov.l @(LER5:16,sp),er1 347 - jsr @er1 348 - jmp @ret_from_exception 349 - 350 - _resume: 351 - /* 352 - * Beware - when entering resume, offset of tss is in d1, 353 - * prev (the current task) is in a0, next (the new task) 354 - * is in a1 and d2.b is non-zero if the mm structure is 355 - * shared between the tasks, so don't change these 356 - * registers until their contents are no longer needed. 357 - */ 358 - 359 - /* save sr */ 360 - sub.w r3,r3 361 - stc ccr,r3l 362 - mov.w r3,@(THREAD_CCR+2:16,er0) 363 - 364 - /* disable interrupts */ 365 - orc #0xc0,ccr 366 - mov.l @_sw_usp,er3 367 - mov.l er3,@(THREAD_USP:16,er0) 368 - mov.l sp,@(THREAD_KSP:16,er0) 369 - 370 - /* Skip address space switching if they are the same. */ 371 - /* FIXME: what did we hack out of here, this does nothing! */ 372 - 373 - mov.l @(THREAD_USP:16,er1),er0 374 - mov.l er0,@_sw_usp 375 - mov.l @(THREAD_KSP:16,er1),sp 376 - 377 - /* restore status register */ 378 - mov.w @(THREAD_CCR+2:16,er1),r3 379 - 380 - ldc r3l,ccr 381 - rts 382 - 383 - _trace_break: 384 - subs #4,sp 385 - SAVE_ALL 386 - sub.l er1,er1 387 - dec.l #1,er1 388 - mov.l er1,@(LORIG,sp) 389 - mov.l sp,er0 390 - jsr @set_esp0 391 - mov.l @_sw_usp,er0 392 - mov.l @er0,er1 393 - mov.w @(-2:16,er1),r2 394 - cmp.w #0x5730,r2 395 - beq 1f 396 - subs #2,er1 397 - mov.l er1,@er0 398 - 1: 399 - and.w #0xff,e1 400 - mov.l er1,er0 401 - jsr @trace_trap 402 - jmp @ret_from_exception 403 - 404 - _nmi: 405 - subs #4, sp 406 - mov.l er0, @-sp 407 - mov.l @_interrupt_redirect_table, er0 408 - add.l #8*4, er0 409 - mov.l er0, @(4,sp) 410 - mov.l @sp+, er0 411 - jmp @_interrupt_entry 412 - 413 - #if defined(CONFIG_KGDB) 414 - _kgdb_trap: 415 - subs #4,sp 416 - SAVE_ALL 417 - mov.l sp,er0 418 - add.l #LRET,er0 419 - mov.l er0,@(LSP,sp) 420 - jsr @set_esp0 421 - mov.l sp,er0 422 - subs #4,er0 423 - jsr @h8300_kgdb_trap 424 - jmp @ret_from_exception 425 - #endif 426 - 427 - .section .bss 428 - _sw_ksp: 429 - .space 4 430 - _sw_usp: 431 - .space 4 432 - 433 - .end
-35
arch/h8300/kernel/h8300_ksyms.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - #include <linux/module.h> 3 - #include <linux/linkage.h> 4 - 5 - /* 6 - * libgcc functions - functions that are used internally by the 7 - * compiler... (prototypes are not correct though, but that 8 - * doesn't really matter since they're not versioned). 9 - */ 10 - asmlinkage long __ucmpdi2(long long, long long); 11 - asmlinkage long long __ashldi3(long long, int); 12 - asmlinkage long long __ashrdi3(long long, int); 13 - asmlinkage long long __lshrdi3(long long, int); 14 - asmlinkage long __divsi3(long, long); 15 - asmlinkage long __modsi3(long, long); 16 - asmlinkage unsigned long __umodsi3(unsigned long, unsigned long); 17 - asmlinkage long long __muldi3(long long, long long); 18 - asmlinkage long __mulsi3(long, long); 19 - asmlinkage long __udivsi3(long, long); 20 - asmlinkage void *memcpy(void *, const void *, size_t); 21 - asmlinkage void *memset(void *, int, size_t); 22 - 23 - /* gcc lib functions */ 24 - EXPORT_SYMBOL(__ucmpdi2); 25 - EXPORT_SYMBOL(__ashldi3); 26 - EXPORT_SYMBOL(__ashrdi3); 27 - EXPORT_SYMBOL(__lshrdi3); 28 - EXPORT_SYMBOL(__divsi3); 29 - EXPORT_SYMBOL(__modsi3); 30 - EXPORT_SYMBOL(__umodsi3); 31 - EXPORT_SYMBOL(__muldi3); 32 - EXPORT_SYMBOL(__mulsi3); 33 - EXPORT_SYMBOL(__udivsi3); 34 - EXPORT_SYMBOL(memcpy); 35 - EXPORT_SYMBOL(memset);
-60
arch/h8300/kernel/head_ram.S
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - 3 - #include <linux/sys.h> 4 - #include <linux/init.h> 5 - #include <asm/unistd.h> 6 - #include <asm/setup.h> 7 - #include <asm/linkage.h> 8 - #include <asm/asm-offsets.h> 9 - #include <asm/thread_info.h> 10 - #include <asm/errno.h> 11 - 12 - #if defined(CONFIG_CPU_H8300H) 13 - .h8300h 14 - #define SYSCR 0xfee012 15 - #define IRAMTOP 0xffff20 16 - #endif 17 - #if defined(CONFIG_CPU_H8S) 18 - .h8300s 19 - #define INTCR 0xffff31 20 - #define IRAMTOP 0xffc000 21 - #endif 22 - 23 - __HEAD 24 - .global _start 25 - _start: 26 - mov.l #IRAMTOP,sp 27 - /* .bss clear */ 28 - mov.l #_sbss,er5 29 - mov.l #_ebss,er4 30 - sub.l er5,er4 31 - shlr er4 32 - shlr er4 33 - sub.l er2,er2 34 - 1: 35 - mov.l er2,@er5 36 - adds #4,er5 37 - dec.l #1,er4 38 - bne 1b 39 - jsr @h8300_fdt_init 40 - 41 - /* linux kernel start */ 42 - #if defined(CONFIG_CPU_H8300H) 43 - ldc #0xd0,ccr /* running kernel */ 44 - mov.l #SYSCR,er0 45 - bclr #3,@er0 46 - #endif 47 - #if defined(CONFIG_CPU_H8S) 48 - ldc #0x07,exr 49 - bclr #4,@INTCR:8 50 - bset #5,@INTCR:8 /* Interrupt mode 2 */ 51 - ldc #0x90,ccr /* running kernel */ 52 - #endif 53 - mov.l #init_thread_union,sp 54 - add.l #0x2000,sp 55 - jsr @start_kernel 56 - 57 - 1: 58 - bra 1b 59 - 60 - .end
-111
arch/h8300/kernel/head_rom.S
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #include <linux/init.h> 3 - #include <asm/thread_info.h> 4 - 5 - #if defined(CONFIG_CPU_H8300H) 6 - .h8300h 7 - #define SYSCR 0xfee012 8 - #define IRAMTOP 0xffff20 9 - #define NR_INT 64 10 - #endif 11 - #if defined(CONFIG_CPU_H8S) 12 - .h8300s 13 - #define INTCR 0xffff31 14 - #define IRAMTOP 0xffc000 15 - #define NR_INT 128 16 - #endif 17 - 18 - __HEAD 19 - .global _start 20 - _start: 21 - mov.l #IRAMTOP,sp 22 - #if !defined(CONFIG_H8300H_SIM) && \ 23 - !defined(CONFIG_H8S_SIM) 24 - jsr @lowlevel_init 25 - 26 - /* copy .data */ 27 - mov.l #_begin_data,er5 28 - mov.l #_sdata,er6 29 - mov.l #_edata,er4 30 - sub.l er6,er4 31 - shlr.l er4 32 - shlr.l er4 33 - 1: 34 - mov.l @er5+,er0 35 - mov.l er0,@er6 36 - adds #4,er6 37 - dec.l #1,er4 38 - bne 1b 39 - /* .bss clear */ 40 - mov.l #_sbss,er5 41 - mov.l #_ebss,er4 42 - sub.l er5,er4 43 - shlr er4 44 - shlr er4 45 - sub.l er0,er0 46 - 1: 47 - mov.l er0,@er5 48 - adds #4,er5 49 - dec.l #1,er4 50 - bne 1b 51 - #else 52 - /* get cmdline from gdb */ 53 - jsr @0xcc 54 - ;; er0 - argc 55 - ;; er1 - argv 56 - mov.l #command_line,er3 57 - adds #4,er1 58 - dec.l #1,er0 59 - beq 4f 60 - 1: 61 - mov.l @er1+,er2 62 - 2: 63 - mov.b @er2+,r4l 64 - beq 3f 65 - mov.b r4l,@er3 66 - adds #1,er3 67 - bra 2b 68 - 3: 69 - mov.b #' ',r4l 70 - mov.b r4l,@er3 71 - adds #1,er3 72 - dec.l #1,er0 73 - bne 1b 74 - subs #1,er3 75 - mov.b #0,r4l 76 - mov.b r4l,@er3 77 - 4: 78 - #endif 79 - sub.l er0,er0 80 - jsr @h8300_fdt_init 81 - /* linux kernel start */ 82 - #if defined(CONFIG_CPU_H8300H) 83 - ldc #0xd0,ccr /* running kernel */ 84 - mov.l #SYSCR,er0 85 - bclr #3,@er0 86 - #endif 87 - #if defined(CONFIG_CPU_H8S) 88 - ldc #0x07,exr 89 - bclr #4,@INTCR:8 90 - bset #5,@INTCR:8 /* Interrupt mode 2 */ 91 - ldc #0x90,ccr /* running kernel */ 92 - #endif 93 - mov.l #init_thread_union,sp 94 - add.l #0x2000,sp 95 - jsr @start_kernel 96 - 97 - 1: 98 - bra 1b 99 - 100 - #if defined(CONFIG_ROMKERNEL) 101 - /* interrupt vector */ 102 - .section .vectors,"ax" 103 - .long _start 104 - .long _start 105 - vector = 2 106 - .rept NR_INT - 2 107 - .long _interrupt_redirect_table+vector*4 108 - vector = vector + 1 109 - .endr 110 - #endif 111 - .end
-99
arch/h8300/kernel/irq.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /* 3 - * linux/arch/h8300/kernel/irq.c 4 - * 5 - * Copyright 2014-2015 Yoshinori Sato <ysato@users.sourceforge.jp> 6 - */ 7 - 8 - #include <linux/init.h> 9 - #include <linux/interrupt.h> 10 - #include <linux/irq.h> 11 - #include <linux/irqchip.h> 12 - #include <linux/irqdomain.h> 13 - #include <linux/of_irq.h> 14 - #include <asm/traps.h> 15 - 16 - #ifdef CONFIG_RAMKERNEL 17 - typedef void (*h8300_vector)(void); 18 - 19 - static const h8300_vector __initconst trap_table[] = { 20 - 0, 0, 0, 0, 21 - _trace_break, 22 - 0, 0, 23 - _nmi, 24 - _system_call, 25 - 0, 0, 26 - _trace_break, 27 - }; 28 - 29 - static unsigned long __init *get_vector_address(void) 30 - { 31 - unsigned long *rom_vector = CPU_VECTOR; 32 - unsigned long base, tmp; 33 - int vec_no; 34 - 35 - base = rom_vector[EXT_IRQ0] & ADDR_MASK; 36 - 37 - /* check romvector format */ 38 - for (vec_no = EXT_IRQ0 + 1; vec_no <= EXT_IRQ0+EXT_IRQS; vec_no++) { 39 - if ((base+(vec_no - EXT_IRQ0)*4) != 40 - (rom_vector[vec_no] & ADDR_MASK)) 41 - return NULL; 42 - } 43 - 44 - /* ramvector base address */ 45 - base -= EXT_IRQ0*4; 46 - 47 - /* writerble? */ 48 - tmp = ~(*(volatile unsigned long *)base); 49 - (*(volatile unsigned long *)base) = tmp; 50 - if ((*(volatile unsigned long *)base) != tmp) 51 - return NULL; 52 - return (unsigned long *)base; 53 - } 54 - 55 - static void __init setup_vector(void) 56 - { 57 - int i; 58 - unsigned long *ramvec, *ramvec_p; 59 - const h8300_vector *trap_entry; 60 - 61 - ramvec = get_vector_address(); 62 - if (ramvec == NULL) 63 - panic("interrupt vector serup failed."); 64 - else 65 - pr_debug("virtual vector at 0x%p\n", ramvec); 66 - 67 - /* create redirect table */ 68 - ramvec_p = ramvec; 69 - trap_entry = trap_table; 70 - for (i = 0; i < NR_IRQS; i++) { 71 - if (i < 12) { 72 - if (*trap_entry) 73 - *ramvec_p = VECTOR(*trap_entry); 74 - ramvec_p++; 75 - trap_entry++; 76 - } else 77 - *ramvec_p++ = REDIRECT(_interrupt_entry); 78 - } 79 - _interrupt_redirect_table = ramvec; 80 - } 81 - #else 82 - void setup_vector(void) 83 - { 84 - /* noting do */ 85 - } 86 - #endif 87 - 88 - void __init init_IRQ(void) 89 - { 90 - setup_vector(); 91 - irqchip_init(); 92 - } 93 - 94 - asmlinkage void do_IRQ(int irq) 95 - { 96 - irq_enter(); 97 - generic_handle_irq(irq); 98 - irq_exit(); 99 - }
-135
arch/h8300/kernel/kgdb.c
··· 1 - /* 2 - * H8/300 KGDB support 3 - * 4 - * Copyright (C) 2015 Yoshinori Sato <ysato@users.sourceforge.jp> 5 - * 6 - * This file is subject to the terms and conditions of the GNU General Public 7 - * License. See the file "COPYING" in the main directory of this archive 8 - * for more details. 9 - */ 10 - 11 - #include <linux/ptrace.h> 12 - #include <linux/kgdb.h> 13 - #include <linux/kdebug.h> 14 - #include <linux/io.h> 15 - 16 - struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] = { 17 - { "er0", GDB_SIZEOF_REG, offsetof(struct pt_regs, er0) }, 18 - { "er1", GDB_SIZEOF_REG, offsetof(struct pt_regs, er1) }, 19 - { "er2", GDB_SIZEOF_REG, offsetof(struct pt_regs, er2) }, 20 - { "er3", GDB_SIZEOF_REG, offsetof(struct pt_regs, er3) }, 21 - { "er4", GDB_SIZEOF_REG, offsetof(struct pt_regs, er4) }, 22 - { "er5", GDB_SIZEOF_REG, offsetof(struct pt_regs, er5) }, 23 - { "er6", GDB_SIZEOF_REG, offsetof(struct pt_regs, er6) }, 24 - { "sp", GDB_SIZEOF_REG, offsetof(struct pt_regs, sp) }, 25 - { "ccr", GDB_SIZEOF_REG, offsetof(struct pt_regs, ccr) }, 26 - { "pc", GDB_SIZEOF_REG, offsetof(struct pt_regs, pc) }, 27 - { "cycles", GDB_SIZEOF_REG, -1 }, 28 - #if defined(CONFIG_CPU_H8S) 29 - { "exr", GDB_SIZEOF_REG, offsetof(struct pt_regs, exr) }, 30 - #endif 31 - { "tick", GDB_SIZEOF_REG, -1 }, 32 - { "inst", GDB_SIZEOF_REG, -1 }, 33 - }; 34 - 35 - char *dbg_get_reg(int regno, void *mem, struct pt_regs *regs) 36 - { 37 - if (regno >= DBG_MAX_REG_NUM || regno < 0) 38 - return NULL; 39 - 40 - switch (regno) { 41 - case GDB_CCR: 42 - #if defined(CONFIG_CPU_H8S) 43 - case GDB_EXR: 44 - #endif 45 - *(u32 *)mem = *(u16 *)((void *)regs + 46 - dbg_reg_def[regno].offset); 47 - break; 48 - default: 49 - if (dbg_reg_def[regno].offset >= 0) 50 - memcpy(mem, (void *)regs + dbg_reg_def[regno].offset, 51 - dbg_reg_def[regno].size); 52 - else 53 - memset(mem, 0, dbg_reg_def[regno].size); 54 - break; 55 - } 56 - return dbg_reg_def[regno].name; 57 - } 58 - 59 - int dbg_set_reg(int regno, void *mem, struct pt_regs *regs) 60 - { 61 - if (regno >= DBG_MAX_REG_NUM || regno < 0) 62 - return -EINVAL; 63 - 64 - switch (regno) { 65 - case GDB_CCR: 66 - #if defined(CONFIG_CPU_H8S) 67 - case GDB_EXR: 68 - #endif 69 - *(u16 *)((void *)regs + 70 - dbg_reg_def[regno].offset) = *(u32 *)mem; 71 - break; 72 - default: 73 - memcpy((void *)regs + dbg_reg_def[regno].offset, mem, 74 - dbg_reg_def[regno].size); 75 - } 76 - return 0; 77 - } 78 - 79 - asmlinkage void h8300_kgdb_trap(struct pt_regs *regs) 80 - { 81 - regs->pc &= 0x00ffffff; 82 - if (kgdb_handle_exception(10, SIGTRAP, 0, regs)) 83 - return; 84 - if (*(u16 *)(regs->pc) == *(u16 *)&arch_kgdb_ops.gdb_bpt_instr) 85 - regs->pc += BREAK_INSTR_SIZE; 86 - regs->pc |= regs->ccr << 24; 87 - } 88 - 89 - void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p) 90 - { 91 - memset((char *)gdb_regs, 0, NUMREGBYTES); 92 - gdb_regs[GDB_SP] = p->thread.ksp; 93 - gdb_regs[GDB_PC] = KSTK_EIP(p); 94 - } 95 - 96 - void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long pc) 97 - { 98 - regs->pc = pc; 99 - } 100 - 101 - int kgdb_arch_handle_exception(int vector, int signo, int err_code, 102 - char *remcom_in_buffer, char *remcom_out_buffer, 103 - struct pt_regs *regs) 104 - { 105 - char *ptr; 106 - unsigned long addr; 107 - 108 - switch (remcom_in_buffer[0]) { 109 - case 's': 110 - case 'c': 111 - /* handle the optional parameters */ 112 - ptr = &remcom_in_buffer[1]; 113 - if (kgdb_hex2long(&ptr, &addr)) 114 - regs->pc = addr; 115 - 116 - return 0; 117 - } 118 - 119 - return -1; /* this means that we do not want to exit from the handler */ 120 - } 121 - 122 - int kgdb_arch_init(void) 123 - { 124 - return 0; 125 - } 126 - 127 - void kgdb_arch_exit(void) 128 - { 129 - /* Nothing to do */ 130 - } 131 - 132 - const struct kgdb_arch arch_kgdb_ops = { 133 - /* Breakpoint instruction: trapa #2 */ 134 - .gdb_bpt_instr = { 0x57, 0x20 }, 135 - };
-71
arch/h8300/kernel/module.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - #include <linux/moduleloader.h> 3 - #include <linux/elf.h> 4 - #include <linux/vmalloc.h> 5 - #include <linux/fs.h> 6 - #include <linux/string.h> 7 - #include <linux/kernel.h> 8 - 9 - int apply_relocate_add(Elf32_Shdr *sechdrs, 10 - const char *strtab, 11 - unsigned int symindex, 12 - unsigned int relsec, 13 - struct module *me) 14 - { 15 - unsigned int i; 16 - Elf32_Rela *rela = (void *)sechdrs[relsec].sh_addr; 17 - 18 - pr_debug("Applying relocate section %u to %u\n", relsec, 19 - sechdrs[relsec].sh_info); 20 - for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rela); i++) { 21 - /* This is where to make the change */ 22 - uint32_t *loc = 23 - (uint32_t *)(sechdrs[sechdrs[relsec].sh_info].sh_addr 24 - + rela[i].r_offset); 25 - /* This is the symbol it is referring to. Note that all 26 - undefined symbols have been resolved. */ 27 - Elf32_Sym *sym = (Elf32_Sym *)sechdrs[symindex].sh_addr 28 - + ELF32_R_SYM(rela[i].r_info); 29 - uint32_t v = sym->st_value + rela[i].r_addend; 30 - 31 - switch (ELF32_R_TYPE(rela[i].r_info)) { 32 - case R_H8_DIR24R8: 33 - loc = (uint32_t *)((uint32_t)loc - 1); 34 - *loc = (*loc & 0xff000000) | ((*loc & 0xffffff) + v); 35 - break; 36 - case R_H8_DIR24A8: 37 - if (ELF32_R_SYM(rela[i].r_info)) 38 - *loc += v; 39 - break; 40 - case R_H8_DIR32: 41 - case R_H8_DIR32A16: 42 - *loc += v; 43 - break; 44 - case R_H8_PCREL16: 45 - v -= (unsigned long)loc + 2; 46 - if ((Elf32_Sword)v > 0x7fff || 47 - (Elf32_Sword)v < -(Elf32_Sword)0x8000) 48 - goto overflow; 49 - else 50 - *(unsigned short *)loc = v; 51 - break; 52 - case R_H8_PCREL8: 53 - v -= (unsigned long)loc + 1; 54 - if ((Elf32_Sword)v > 0x7f || 55 - (Elf32_Sword)v < -(Elf32_Sword)0x80) 56 - goto overflow; 57 - else 58 - *(unsigned char *)loc = v; 59 - break; 60 - default: 61 - pr_err("module %s: Unknown relocation: %u\n", 62 - me->name, ELF32_R_TYPE(rela[i].r_info)); 63 - return -ENOEXEC; 64 - } 65 - } 66 - return 0; 67 - overflow: 68 - pr_err("module %s: relocation offset overflow: %08x\n", 69 - me->name, rela[i].r_offset); 70 - return -ENOEXEC; 71 - }
-173
arch/h8300/kernel/process.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /* 3 - * linux/arch/h8300/kernel/process.c 4 - * 5 - * Yoshinori Sato <ysato@users.sourceforge.jp> 6 - * 7 - * Based on: 8 - * 9 - * linux/arch/m68knommu/kernel/process.c 10 - * 11 - * Copyright (C) 1998 D. Jeff Dionne <jeff@ryeham.ee.ryerson.ca>, 12 - * Kenneth Albanowski <kjahds@kjahds.com>, 13 - * The Silver Hammer Group, Ltd. 14 - * 15 - * linux/arch/m68k/kernel/process.c 16 - * 17 - * Copyright (C) 1995 Hamish Macdonald 18 - * 19 - * 68060 fixes by Jesper Skov 20 - */ 21 - 22 - /* 23 - * This file handles the architecture-dependent parts of process handling.. 24 - */ 25 - 26 - #include <linux/errno.h> 27 - #include <linux/module.h> 28 - #include <linux/sched.h> 29 - #include <linux/sched/debug.h> 30 - #include <linux/sched/task.h> 31 - #include <linux/sched/task_stack.h> 32 - #include <linux/kernel.h> 33 - #include <linux/mm.h> 34 - #include <linux/smp.h> 35 - #include <linux/stddef.h> 36 - #include <linux/unistd.h> 37 - #include <linux/ptrace.h> 38 - #include <linux/user.h> 39 - #include <linux/interrupt.h> 40 - #include <linux/reboot.h> 41 - #include <linux/fs.h> 42 - #include <linux/slab.h> 43 - #include <linux/rcupdate.h> 44 - 45 - #include <linux/uaccess.h> 46 - #include <asm/traps.h> 47 - #include <asm/setup.h> 48 - 49 - void (*pm_power_off)(void) = NULL; 50 - EXPORT_SYMBOL(pm_power_off); 51 - 52 - asmlinkage void ret_from_fork(void); 53 - asmlinkage void ret_from_kernel_thread(void); 54 - 55 - /* 56 - * The idle loop on an H8/300.. 57 - */ 58 - void arch_cpu_idle(void) 59 - { 60 - raw_local_irq_enable(); 61 - __asm__("sleep"); 62 - } 63 - 64 - void machine_restart(char *__unused) 65 - { 66 - local_irq_disable(); 67 - __asm__("jmp @@0"); 68 - } 69 - 70 - void machine_halt(void) 71 - { 72 - local_irq_disable(); 73 - __asm__("sleep"); 74 - for (;;) 75 - ; 76 - } 77 - 78 - void machine_power_off(void) 79 - { 80 - local_irq_disable(); 81 - __asm__("sleep"); 82 - for (;;) 83 - ; 84 - } 85 - 86 - void show_regs(struct pt_regs *regs) 87 - { 88 - show_regs_print_info(KERN_DEFAULT); 89 - 90 - pr_notice("\n"); 91 - pr_notice("PC: %08lx Status: %02x\n", 92 - regs->pc, regs->ccr); 93 - pr_notice("ORIG_ER0: %08lx ER0: %08lx ER1: %08lx\n", 94 - regs->orig_er0, regs->er0, regs->er1); 95 - pr_notice("ER2: %08lx ER3: %08lx ER4: %08lx ER5: %08lx\n", 96 - regs->er2, regs->er3, regs->er4, regs->er5); 97 - pr_notice("ER6' %08lx ", regs->er6); 98 - if (user_mode(regs)) 99 - printk("USP: %08lx\n", rdusp()); 100 - else 101 - printk("\n"); 102 - } 103 - 104 - void flush_thread(void) 105 - { 106 - } 107 - 108 - int copy_thread(unsigned long clone_flags, unsigned long usp, 109 - unsigned long topstk, struct task_struct *p, unsigned long tls) 110 - { 111 - struct pt_regs *childregs; 112 - 113 - childregs = (struct pt_regs *) (THREAD_SIZE + task_stack_page(p)) - 1; 114 - 115 - if (unlikely(p->flags & (PF_KTHREAD | PF_IO_WORKER))) { 116 - memset(childregs, 0, sizeof(struct pt_regs)); 117 - childregs->retpc = (unsigned long) ret_from_kernel_thread; 118 - childregs->er4 = topstk; /* arg */ 119 - childregs->er5 = usp; /* fn */ 120 - } else { 121 - *childregs = *current_pt_regs(); 122 - childregs->er0 = 0; 123 - childregs->retpc = (unsigned long) ret_from_fork; 124 - p->thread.usp = usp ?: rdusp(); 125 - } 126 - p->thread.ksp = (unsigned long)childregs; 127 - 128 - return 0; 129 - } 130 - 131 - unsigned long __get_wchan(struct task_struct *p) 132 - { 133 - unsigned long fp, pc; 134 - unsigned long stack_page; 135 - int count = 0; 136 - 137 - stack_page = (unsigned long)p; 138 - fp = ((struct pt_regs *)p->thread.ksp)->er6; 139 - do { 140 - if (fp < stack_page+sizeof(struct thread_info) || 141 - fp >= 8184+stack_page) 142 - return 0; 143 - pc = ((unsigned long *)fp)[1]; 144 - if (!in_sched_functions(pc)) 145 - return pc; 146 - fp = *(unsigned long *) fp; 147 - } while (count++ < 16); 148 - return 0; 149 - } 150 - 151 - /* generic sys_clone is not enough registers */ 152 - asmlinkage int sys_clone(unsigned long __user *args) 153 - { 154 - unsigned long clone_flags; 155 - unsigned long newsp; 156 - uintptr_t parent_tidptr; 157 - uintptr_t child_tidptr; 158 - struct kernel_clone_args kargs = {}; 159 - 160 - get_user(clone_flags, &args[0]); 161 - get_user(newsp, &args[1]); 162 - get_user(parent_tidptr, &args[2]); 163 - get_user(child_tidptr, &args[3]); 164 - 165 - kargs.flags = (lower_32_bits(clone_flags) & ~CSIGNAL); 166 - kargs.pidfd = (int __user *)parent_tidptr; 167 - kargs.child_tid = (int __user *)child_tidptr; 168 - kargs.parent_tid = (int __user *)parent_tidptr; 169 - kargs.exit_signal = (lower_32_bits(clone_flags) & CSIGNAL); 170 - kargs.stack = newsp; 171 - 172 - return kernel_clone(&kargs); 173 - }
-199
arch/h8300/kernel/ptrace.c
··· 1 - /* 2 - * linux/arch/h8300/kernel/ptrace.c 3 - * 4 - * Copyright 2015 Yoshinori Sato <ysato@users.sourceforge.jp> 5 - * 6 - * This file is subject to the terms and conditions of the GNU General 7 - * Public License. See the file COPYING in the main directory of 8 - * this archive for more details. 9 - */ 10 - 11 - #include <linux/kernel.h> 12 - #include <linux/errno.h> 13 - #include <linux/ptrace.h> 14 - #include <linux/audit.h> 15 - #include <linux/regset.h> 16 - #include <linux/elf.h> 17 - 18 - #define CCR_MASK 0x6f /* mode/imask not set */ 19 - #define EXR_MASK 0x80 /* modify only T */ 20 - 21 - #define PT_REG(r) offsetof(struct pt_regs, r) 22 - 23 - extern void user_disable_single_step(struct task_struct *child); 24 - 25 - /* Mapping from PT_xxx to the stack offset at which the register is 26 - saved. Notice that usp has no stack-slot and needs to be treated 27 - specially (see get_reg/put_reg below). */ 28 - static const int register_offset[] = { 29 - PT_REG(er1), PT_REG(er2), PT_REG(er3), PT_REG(er4), 30 - PT_REG(er5), PT_REG(er6), PT_REG(er0), -1, 31 - PT_REG(orig_er0), PT_REG(ccr), PT_REG(pc), 32 - #if defined(CONFIG_CPU_H8S) 33 - PT_REG(exr), 34 - #endif 35 - }; 36 - 37 - /* read register */ 38 - long h8300_get_reg(struct task_struct *task, int regno) 39 - { 40 - switch (regno) { 41 - case PT_USP: 42 - return task->thread.usp + sizeof(long)*2; 43 - case PT_CCR: 44 - case PT_EXR: 45 - return *(unsigned short *)(task->thread.esp0 + 46 - register_offset[regno]); 47 - default: 48 - return *(unsigned long *)(task->thread.esp0 + 49 - register_offset[regno]); 50 - } 51 - } 52 - 53 - int h8300_put_reg(struct task_struct *task, int regno, unsigned long data) 54 - { 55 - unsigned short oldccr; 56 - unsigned short oldexr; 57 - 58 - switch (regno) { 59 - case PT_USP: 60 - task->thread.usp = data - sizeof(long)*2; 61 - case PT_CCR: 62 - oldccr = *(unsigned short *)(task->thread.esp0 + 63 - register_offset[regno]); 64 - oldccr &= ~CCR_MASK; 65 - data &= CCR_MASK; 66 - data |= oldccr; 67 - *(unsigned short *)(task->thread.esp0 + 68 - register_offset[regno]) = data; 69 - break; 70 - case PT_EXR: 71 - oldexr = *(unsigned short *)(task->thread.esp0 + 72 - register_offset[regno]); 73 - oldccr &= ~EXR_MASK; 74 - data &= EXR_MASK; 75 - data |= oldexr; 76 - *(unsigned short *)(task->thread.esp0 + 77 - register_offset[regno]) = data; 78 - break; 79 - default: 80 - *(unsigned long *)(task->thread.esp0 + 81 - register_offset[regno]) = data; 82 - break; 83 - } 84 - return 0; 85 - } 86 - 87 - static int regs_get(struct task_struct *target, 88 - const struct user_regset *regset, 89 - struct membuf to) 90 - { 91 - int r; 92 - 93 - BUILD_BUG_ON(sizeof(struct user_regs_struct) % sizeof(long) != 0); 94 - for (r = 0; r < ELF_NGREG; r++) 95 - membuf_store(&to, h8300_get_reg(target, r)); 96 - 97 - return 0; 98 - } 99 - 100 - static int regs_set(struct task_struct *target, 101 - const struct user_regset *regset, 102 - unsigned int pos, unsigned int count, 103 - const void *kbuf, const void __user *ubuf) 104 - { 105 - int r; 106 - int ret; 107 - struct user_regs_struct regs; 108 - long *reg; 109 - 110 - /* build user regs in buffer */ 111 - BUILD_BUG_ON(sizeof(regs) % sizeof(long) != 0); 112 - for (reg = (long *)&regs, r = 0; r < sizeof(regs) / sizeof(long); r++) 113 - *reg++ = h8300_get_reg(target, r); 114 - 115 - ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, 116 - &regs, 0, sizeof(regs)); 117 - if (ret) 118 - return ret; 119 - 120 - /* write back to pt_regs */ 121 - for (reg = (long *)&regs, r = 0; r < sizeof(regs) / sizeof(long); r++) 122 - h8300_put_reg(target, r, *reg++); 123 - return 0; 124 - } 125 - 126 - enum h8300_regset { 127 - REGSET_GENERAL, 128 - }; 129 - 130 - static const struct user_regset h8300_regsets[] = { 131 - [REGSET_GENERAL] = { 132 - .core_note_type = NT_PRSTATUS, 133 - .n = ELF_NGREG, 134 - .size = sizeof(long), 135 - .align = sizeof(long), 136 - .regset_get = regs_get, 137 - .set = regs_set, 138 - }, 139 - }; 140 - 141 - static const struct user_regset_view user_h8300_native_view = { 142 - .name = "h8300", 143 - .e_machine = EM_H8_300, 144 - .regsets = h8300_regsets, 145 - .n = ARRAY_SIZE(h8300_regsets), 146 - }; 147 - 148 - const struct user_regset_view *task_user_regset_view(struct task_struct *task) 149 - { 150 - return &user_h8300_native_view; 151 - } 152 - 153 - void ptrace_disable(struct task_struct *child) 154 - { 155 - user_disable_single_step(child); 156 - } 157 - 158 - long arch_ptrace(struct task_struct *child, long request, 159 - unsigned long addr, unsigned long data) 160 - { 161 - int ret; 162 - 163 - switch (request) { 164 - default: 165 - ret = ptrace_request(child, request, addr, data); 166 - break; 167 - } 168 - return ret; 169 - } 170 - 171 - asmlinkage long do_syscall_trace_enter(struct pt_regs *regs) 172 - { 173 - long ret = 0; 174 - 175 - if (test_thread_flag(TIF_SYSCALL_TRACE) && 176 - ptrace_report_syscall_entry(regs)) 177 - /* 178 - * Tracing decided this syscall should not happen. 179 - * We'll return a bogus call number to get an ENOSYS 180 - * error, but leave the original number in regs->regs[0]. 181 - */ 182 - ret = -1L; 183 - 184 - audit_syscall_entry(regs->er1, regs->er2, regs->er3, 185 - regs->er4, regs->er5); 186 - 187 - return ret ?: regs->er0; 188 - } 189 - 190 - asmlinkage void do_syscall_trace_leave(struct pt_regs *regs) 191 - { 192 - int step; 193 - 194 - audit_syscall_exit(regs); 195 - 196 - step = test_thread_flag(TIF_SINGLESTEP); 197 - if (step || test_thread_flag(TIF_SYSCALL_TRACE)) 198 - ptrace_report_syscall_exit(regs, step); 199 - }
-256
arch/h8300/kernel/ptrace_h.c
··· 1 - /* 2 - * ptrace cpu depend helper functions 3 - * 4 - * Copyright 2003, 2015 Yoshinori Sato <ysato@users.sourceforge.jp> 5 - * 6 - * This file is subject to the terms and conditions of the GNU General 7 - * Public License. See the file COPYING in the main directory of 8 - * this archive for more details. 9 - */ 10 - 11 - #include <linux/linkage.h> 12 - #include <linux/sched/signal.h> 13 - #include <asm/ptrace.h> 14 - 15 - #define BREAKINST 0x5730 /* trapa #3 */ 16 - 17 - /* disable singlestep */ 18 - void user_disable_single_step(struct task_struct *child) 19 - { 20 - if ((long)child->thread.breakinfo.addr != -1L) { 21 - *(child->thread.breakinfo.addr) = child->thread.breakinfo.inst; 22 - child->thread.breakinfo.addr = (unsigned short *)-1L; 23 - } 24 - } 25 - 26 - /* calculate next pc */ 27 - enum jump_type {none, /* normal instruction */ 28 - jabs, /* absolute address jump */ 29 - ind, /* indirect address jump */ 30 - ret, /* return to subrutine */ 31 - reg, /* register indexed jump */ 32 - relb, /* pc relative jump (byte offset) */ 33 - relw, /* pc relative jump (word offset) */ 34 - }; 35 - 36 - /* opcode decode table define 37 - ptn: opcode pattern 38 - msk: opcode bitmask 39 - len: instruction length (<0 next table index) 40 - jmp: jump operation mode */ 41 - struct optable { 42 - unsigned char bitpattern; 43 - unsigned char bitmask; 44 - signed char length; 45 - signed char type; 46 - } __packed __aligned(1); 47 - 48 - #define OPTABLE(ptn, msk, len, jmp) \ 49 - { \ 50 - .bitpattern = ptn, \ 51 - .bitmask = msk, \ 52 - .length = len, \ 53 - .type = jmp, \ 54 - } 55 - 56 - static const struct optable optable_0[] = { 57 - OPTABLE(0x00, 0xff, 1, none), /* 0x00 */ 58 - OPTABLE(0x01, 0xff, -1, none), /* 0x01 */ 59 - OPTABLE(0x02, 0xfe, 1, none), /* 0x02-0x03 */ 60 - OPTABLE(0x04, 0xee, 1, none), /* 0x04-0x05/0x14-0x15 */ 61 - OPTABLE(0x06, 0xfe, 1, none), /* 0x06-0x07 */ 62 - OPTABLE(0x08, 0xea, 1, none), /* 0x08-0x09/0x0c-0x0d/0x18-0x19/0x1c-0x1d */ 63 - OPTABLE(0x0a, 0xee, 1, none), /* 0x0a-0x0b/0x1a-0x1b */ 64 - OPTABLE(0x0e, 0xee, 1, none), /* 0x0e-0x0f/0x1e-0x1f */ 65 - OPTABLE(0x10, 0xfc, 1, none), /* 0x10-0x13 */ 66 - OPTABLE(0x16, 0xfe, 1, none), /* 0x16-0x17 */ 67 - OPTABLE(0x20, 0xe0, 1, none), /* 0x20-0x3f */ 68 - OPTABLE(0x40, 0xf0, 1, relb), /* 0x40-0x4f */ 69 - OPTABLE(0x50, 0xfc, 1, none), /* 0x50-0x53 */ 70 - OPTABLE(0x54, 0xfd, 1, ret), /* 0x54/0x56 */ 71 - OPTABLE(0x55, 0xff, 1, relb), /* 0x55 */ 72 - OPTABLE(0x57, 0xff, 1, none), /* 0x57 */ 73 - OPTABLE(0x58, 0xfb, 2, relw), /* 0x58/0x5c */ 74 - OPTABLE(0x59, 0xfb, 1, reg), /* 0x59/0x5b */ 75 - OPTABLE(0x5a, 0xfb, 2, jabs), /* 0x5a/0x5e */ 76 - OPTABLE(0x5b, 0xfb, 2, ind), /* 0x5b/0x5f */ 77 - OPTABLE(0x60, 0xe8, 1, none), /* 0x60-0x67/0x70-0x77 */ 78 - OPTABLE(0x68, 0xfa, 1, none), /* 0x68-0x69/0x6c-0x6d */ 79 - OPTABLE(0x6a, 0xfe, -2, none), /* 0x6a-0x6b */ 80 - OPTABLE(0x6e, 0xfe, 2, none), /* 0x6e-0x6f */ 81 - OPTABLE(0x78, 0xff, 4, none), /* 0x78 */ 82 - OPTABLE(0x79, 0xff, 2, none), /* 0x79 */ 83 - OPTABLE(0x7a, 0xff, 3, none), /* 0x7a */ 84 - OPTABLE(0x7b, 0xff, 2, none), /* 0x7b */ 85 - OPTABLE(0x7c, 0xfc, 2, none), /* 0x7c-0x7f */ 86 - OPTABLE(0x80, 0x80, 1, none), /* 0x80-0xff */ 87 - }; 88 - 89 - static const struct optable optable_1[] = { 90 - OPTABLE(0x00, 0xff, -3, none), /* 0x0100 */ 91 - OPTABLE(0x40, 0xf0, -3, none), /* 0x0140-0x14f */ 92 - OPTABLE(0x80, 0xf0, 1, none), /* 0x0180-0x018f */ 93 - OPTABLE(0xc0, 0xc0, 2, none), /* 0x01c0-0x01ff */ 94 - }; 95 - 96 - static const struct optable optable_2[] = { 97 - OPTABLE(0x00, 0x20, 2, none), /* 0x6a0?/0x6a8?/0x6b0?/0x6b8? */ 98 - OPTABLE(0x20, 0x20, 3, none), /* 0x6a2?/0x6aa?/0x6b2?/0x6ba? */ 99 - }; 100 - 101 - static const struct optable optable_3[] = { 102 - OPTABLE(0x69, 0xfb, 2, none), /* 0x010069/0x01006d/014069/0x01406d */ 103 - OPTABLE(0x6b, 0xff, -4, none), /* 0x01006b/0x01406b */ 104 - OPTABLE(0x6f, 0xff, 3, none), /* 0x01006f/0x01406f */ 105 - OPTABLE(0x78, 0xff, 5, none), /* 0x010078/0x014078 */ 106 - }; 107 - 108 - static const struct optable optable_4[] = { 109 - /* 0x0100690?/0x01006d0?/0140690?/0x01406d0?/ 110 - 0x0100698?/0x01006d8?/0140698?/0x01406d8? */ 111 - OPTABLE(0x00, 0x78, 3, none), 112 - /* 0x0100692?/0x01006d2?/0140692?/0x01406d2?/ 113 - 0x010069a?/0x01006da?/014069a?/0x01406da? */ 114 - OPTABLE(0x20, 0x78, 4, none), 115 - }; 116 - 117 - static const struct optables_list { 118 - const struct optable *ptr; 119 - int size; 120 - } optables[] = { 121 - #define OPTABLES(no) \ 122 - { \ 123 - .ptr = optable_##no, \ 124 - .size = sizeof(optable_##no) / sizeof(struct optable), \ 125 - } 126 - OPTABLES(0), 127 - OPTABLES(1), 128 - OPTABLES(2), 129 - OPTABLES(3), 130 - OPTABLES(4), 131 - 132 - }; 133 - 134 - const unsigned char condmask[] = { 135 - 0x00, 0x40, 0x01, 0x04, 0x02, 0x08, 0x10, 0x20 136 - }; 137 - 138 - static int isbranch(struct task_struct *task, int reson) 139 - { 140 - unsigned char cond = h8300_get_reg(task, PT_CCR); 141 - 142 - /* encode complex conditions */ 143 - /* B4: N^V 144 - B5: Z|(N^V) 145 - B6: C|Z */ 146 - __asm__("bld #3,%w0\n\t" 147 - "bxor #1,%w0\n\t" 148 - "bst #4,%w0\n\t" 149 - "bor #2,%w0\n\t" 150 - "bst #5,%w0\n\t" 151 - "bld #2,%w0\n\t" 152 - "bor #0,%w0\n\t" 153 - "bst #6,%w0\n\t" 154 - : "=&r"(cond) : "0"(cond) : "cc"); 155 - cond &= condmask[reson >> 1]; 156 - if (!(reson & 1)) 157 - return cond == 0; 158 - else 159 - return cond != 0; 160 - } 161 - 162 - static unsigned short *decode(struct task_struct *child, 163 - const struct optable *op, 164 - char *fetch_p, unsigned short *pc, 165 - unsigned char inst) 166 - { 167 - unsigned long addr; 168 - unsigned long *sp; 169 - int regno; 170 - 171 - switch (op->type) { 172 - case none: 173 - return (unsigned short *)pc + op->length; 174 - case jabs: 175 - addr = *(unsigned long *)pc; 176 - return (unsigned short *)(addr & 0x00ffffff); 177 - case ind: 178 - addr = *pc & 0xff; 179 - return (unsigned short *)(*(unsigned long *)addr); 180 - case ret: 181 - sp = (unsigned long *)h8300_get_reg(child, PT_USP); 182 - /* user stack frames 183 - | er0 | temporary saved 184 - +--------+ 185 - | exp | exception stack frames 186 - +--------+ 187 - | ret pc | userspace return address 188 - */ 189 - return (unsigned short *)(*(sp+2) & 0x00ffffff); 190 - case reg: 191 - regno = (*pc >> 4) & 0x07; 192 - if (regno == 0) 193 - addr = h8300_get_reg(child, PT_ER0); 194 - else 195 - addr = h8300_get_reg(child, regno-1 + PT_ER1); 196 - return (unsigned short *)addr; 197 - case relb: 198 - if (inst == 0x55 || isbranch(child, inst & 0x0f)) 199 - pc = (unsigned short *)((unsigned long)pc + 200 - ((signed char)(*fetch_p))); 201 - return pc+1; /* skip myself */ 202 - case relw: 203 - if (inst == 0x5c || isbranch(child, (*fetch_p & 0xf0) >> 4)) 204 - pc = (unsigned short *)((unsigned long)pc + 205 - ((signed short)(*(pc+1)))); 206 - return pc+2; /* skip myself */ 207 - default: 208 - return NULL; 209 - } 210 - } 211 - 212 - static unsigned short *nextpc(struct task_struct *child, unsigned short *pc) 213 - { 214 - const struct optable *op; 215 - unsigned char *fetch_p; 216 - int op_len; 217 - unsigned char inst; 218 - 219 - op = optables[0].ptr; 220 - op_len = optables[0].size; 221 - fetch_p = (unsigned char *)pc; 222 - inst = *fetch_p++; 223 - do { 224 - if ((inst & op->bitmask) == op->bitpattern) { 225 - if (op->length < 0) { 226 - op = optables[-op->length].ptr; 227 - op_len = optables[-op->length].size + 1; 228 - inst = *fetch_p++; 229 - } else 230 - return decode(child, op, fetch_p, pc, inst); 231 - } else 232 - op++; 233 - } while (--op_len > 0); 234 - return NULL; 235 - } 236 - 237 - /* Set breakpoint(s) to simulate a single step from the current PC. */ 238 - 239 - void user_enable_single_step(struct task_struct *child) 240 - { 241 - unsigned short *next; 242 - 243 - next = nextpc(child, (unsigned short *)h8300_get_reg(child, PT_PC)); 244 - child->thread.breakinfo.addr = next; 245 - child->thread.breakinfo.inst = *next; 246 - *next = BREAKINST; 247 - } 248 - 249 - asmlinkage void trace_trap(unsigned long bp) 250 - { 251 - if ((unsigned long)current->thread.breakinfo.addr == bp) { 252 - user_disable_single_step(current); 253 - force_sig(SIGTRAP); 254 - } else 255 - force_sig(SIGILL); 256 - }
-44
arch/h8300/kernel/ptrace_s.c
··· 1 - /* 2 - * linux/arch/h8300/kernel/ptrace_h8s.c 3 - * ptrace cpu depend helper functions 4 - * 5 - * Yoshinori Sato <ysato@users.sourceforge.jp> 6 - * 7 - * This file is subject to the terms and conditions of the GNU General 8 - * Public License. See the file COPYING in the main directory of 9 - * this archive for more details. 10 - */ 11 - 12 - #include <linux/linkage.h> 13 - #include <linux/sched/signal.h> 14 - #include <linux/errno.h> 15 - #include <asm/ptrace.h> 16 - 17 - #define CCR_MASK 0x6f 18 - #define EXR_TRACE 0x80 19 - 20 - /* disable singlestep */ 21 - void user_disable_single_step(struct task_struct *child) 22 - { 23 - unsigned char exr; 24 - 25 - exr = h8300_get_reg(child, PT_EXR); 26 - exr &= ~EXR_TRACE; 27 - h8300_put_reg(child, PT_EXR, exr); 28 - } 29 - 30 - /* enable singlestep */ 31 - void user_enable_single_step(struct task_struct *child) 32 - { 33 - unsigned char exr; 34 - 35 - exr = h8300_get_reg(child, PT_EXR); 36 - exr |= EXR_TRACE; 37 - h8300_put_reg(child, PT_EXR, exr); 38 - } 39 - 40 - asmlinkage void trace_trap(unsigned long bp) 41 - { 42 - (void)bp; 43 - force_sig(SIGTRAP); 44 - }
-213
arch/h8300/kernel/setup.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /* 3 - * linux/arch/h8300/kernel/setup.c 4 - * 5 - * Copyright (C) 2001-2014 Yoshinori Sato <ysato@users.sourceforge.jp> 6 - */ 7 - 8 - /* 9 - * This file handles the architecture-dependent parts of system setup 10 - */ 11 - 12 - #include <linux/kernel.h> 13 - #include <linux/sched.h> 14 - #include <linux/delay.h> 15 - #include <linux/interrupt.h> 16 - #include <linux/io.h> 17 - #include <linux/mm.h> 18 - #include <linux/fs.h> 19 - #include <linux/console.h> 20 - #include <linux/errno.h> 21 - #include <linux/string.h> 22 - #include <linux/seq_file.h> 23 - #include <linux/init.h> 24 - #include <linux/of.h> 25 - #include <linux/of_fdt.h> 26 - #include <linux/of_address.h> 27 - #include <linux/clk-provider.h> 28 - #include <linux/memblock.h> 29 - #include <linux/screen_info.h> 30 - #include <linux/clocksource.h> 31 - 32 - #include <asm/setup.h> 33 - #include <asm/irq.h> 34 - #include <asm/sections.h> 35 - #include <asm/page.h> 36 - 37 - #if defined(CONFIG_CPU_H8300H) 38 - #define CPU "H8/300H" 39 - #elif defined(CONFIG_CPU_H8S) 40 - #define CPU "H8S" 41 - #else 42 - #define CPU "Unknown" 43 - #endif 44 - 45 - unsigned long memory_start; 46 - unsigned long memory_end; 47 - EXPORT_SYMBOL(memory_end); 48 - static unsigned long freq; 49 - extern char __dtb_start[]; 50 - 51 - #ifdef CONFIG_VT 52 - struct screen_info screen_info; 53 - #endif 54 - 55 - char __initdata command_line[COMMAND_LINE_SIZE]; 56 - 57 - void sim_console_register(void); 58 - 59 - void __init h8300_fdt_init(void *fdt, char *bootargs) 60 - { 61 - if (!fdt) 62 - fdt = __dtb_start; 63 - else 64 - strcpy(command_line, bootargs); 65 - 66 - early_init_dt_scan(fdt); 67 - memblock_allow_resize(); 68 - } 69 - 70 - static void __init bootmem_init(void) 71 - { 72 - memory_end = memory_start = 0; 73 - 74 - /* Find main memory where is the kernel */ 75 - memory_start = memblock_start_of_DRAM(); 76 - memory_end = memblock_end_of_DRAM(); 77 - 78 - if (!memory_end) 79 - panic("No memory!"); 80 - 81 - /* setup bootmem globals (we use no_bootmem, but mm still depends on this) */ 82 - min_low_pfn = PFN_UP(memory_start); 83 - max_low_pfn = PFN_DOWN(memory_end); 84 - max_pfn = max_low_pfn; 85 - 86 - memblock_reserve(__pa(_stext), _end - _stext); 87 - 88 - early_init_fdt_reserve_self(); 89 - early_init_fdt_scan_reserved_mem(); 90 - 91 - memblock_dump_all(); 92 - } 93 - 94 - void __init setup_arch(char **cmdline_p) 95 - { 96 - unflatten_and_copy_device_tree(); 97 - 98 - setup_initial_init_mm(_stext, _etext, _edata, NULL); 99 - 100 - pr_notice("\r\n\nuClinux " CPU "\n"); 101 - pr_notice("Flat model support (C) 1998,1999 Kenneth Albanowski, D. Jeff Dionne\n"); 102 - 103 - if (*command_line) 104 - strcpy(boot_command_line, command_line); 105 - *cmdline_p = boot_command_line; 106 - 107 - parse_early_param(); 108 - 109 - bootmem_init(); 110 - /* 111 - * get kmalloc into gear 112 - */ 113 - paging_init(); 114 - } 115 - 116 - /* 117 - * Get CPU information for use by the procfs. 118 - */ 119 - 120 - static int show_cpuinfo(struct seq_file *m, void *v) 121 - { 122 - char *cpu; 123 - 124 - cpu = CPU; 125 - 126 - seq_printf(m, "CPU:\t\t%s\n" 127 - "Clock:\t\t%lu.%1luMHz\n" 128 - "BogoMips:\t%lu.%02lu\n" 129 - "Calibration:\t%lu loops\n", 130 - cpu, 131 - freq/1000, freq%1000, 132 - (loops_per_jiffy*HZ)/500000, 133 - ((loops_per_jiffy*HZ)/5000)%100, 134 - (loops_per_jiffy*HZ)); 135 - 136 - return 0; 137 - } 138 - 139 - static void *c_start(struct seq_file *m, loff_t *pos) 140 - { 141 - return *pos < num_possible_cpus() ? 142 - ((void *) 0x12345678) : NULL; 143 - } 144 - 145 - static void *c_next(struct seq_file *m, void *v, loff_t *pos) 146 - { 147 - ++*pos; 148 - return c_start(m, pos); 149 - } 150 - 151 - static void c_stop(struct seq_file *m, void *v) 152 - { 153 - } 154 - 155 - const struct seq_operations cpuinfo_op = { 156 - .start = c_start, 157 - .next = c_next, 158 - .stop = c_stop, 159 - .show = show_cpuinfo, 160 - }; 161 - 162 - #if defined(CONFIG_CPU_H8300H) 163 - #define get_wait(base, addr) ({ \ 164 - int baddr; \ 165 - baddr = ((addr) / 0x200000 * 2); \ 166 - w *= (readw((base) + 2) & (3 << baddr)) + 1; \ 167 - }) 168 - #endif 169 - #if defined(CONFIG_CPU_H8S) 170 - #define get_wait(base, addr) ({ \ 171 - int baddr; \ 172 - baddr = ((addr) / 0x200000 * 16); \ 173 - w *= (readl((base) + 2) & (7 << baddr)) + 1; \ 174 - }) 175 - #endif 176 - 177 - static __init int access_timing(void) 178 - { 179 - struct device_node *bsc; 180 - void __iomem *base; 181 - unsigned long addr = (unsigned long)&__delay; 182 - int bit = 1 << (addr / 0x200000); 183 - int w; 184 - 185 - bsc = of_find_compatible_node(NULL, NULL, "renesas,h8300-bsc"); 186 - base = of_iomap(bsc, 0); 187 - w = (readb(base + 0) & bit)?2:1; 188 - if (readb(base + 1) & bit) 189 - w *= get_wait(base, addr); 190 - else 191 - w *= 2; 192 - return w * 3 / 2; 193 - } 194 - 195 - void __init calibrate_delay(void) 196 - { 197 - struct device_node *cpu; 198 - int freq; 199 - 200 - cpu = of_find_compatible_node(NULL, NULL, "renesas,h8300"); 201 - of_property_read_s32(cpu, "clock-frequency", &freq); 202 - loops_per_jiffy = freq / HZ / (access_timing() * 2); 203 - pr_cont("%lu.%02lu BogoMIPS (lpj=%lu)\n", 204 - loops_per_jiffy / (500000 / HZ), 205 - (loops_per_jiffy / (5000 / HZ)) % 100, loops_per_jiffy); 206 - } 207 - 208 - 209 - void __init time_init(void) 210 - { 211 - of_clk_init(NULL); 212 - timer_probe(); 213 - }
-287
arch/h8300/kernel/signal.c
··· 1 - /* 2 - * linux/arch/h8300/kernel/signal.c 3 - * 4 - * Copyright (C) 1991, 1992 Linus Torvalds 5 - * 6 - * This file is subject to the terms and conditions of the GNU General Public 7 - * License. See the file COPYING in the main directory of this archive 8 - * for more details. 9 - */ 10 - 11 - /* 12 - * uClinux H8/300 support by Yoshinori Sato <ysato@users.sourceforge.jp> 13 - * and David McCullough <davidm@snapgear.com> 14 - * 15 - * Based on 16 - * Linux/m68k by Hamish Macdonald 17 - */ 18 - 19 - /* 20 - * ++roman (07/09/96): implemented signal stacks (specially for tosemu on 21 - * Atari :-) Current limitation: Only one sigstack can be active at one time. 22 - * If a second signal with SA_ONSTACK set arrives while working on a sigstack, 23 - * SA_ONSTACK is ignored. This behaviour avoids lots of trouble with nested 24 - * signal handlers! 25 - */ 26 - 27 - #include <linux/sched.h> 28 - #include <linux/sched/task_stack.h> 29 - #include <linux/mm.h> 30 - #include <linux/kernel.h> 31 - #include <linux/signal.h> 32 - #include <linux/syscalls.h> 33 - #include <linux/errno.h> 34 - #include <linux/wait.h> 35 - #include <linux/ptrace.h> 36 - #include <linux/unistd.h> 37 - #include <linux/stddef.h> 38 - #include <linux/highuid.h> 39 - #include <linux/personality.h> 40 - #include <linux/tty.h> 41 - #include <linux/binfmts.h> 42 - #include <linux/resume_user_mode.h> 43 - 44 - #include <asm/setup.h> 45 - #include <linux/uaccess.h> 46 - #include <asm/traps.h> 47 - #include <asm/ucontext.h> 48 - 49 - /* 50 - * Do a signal return; undo the signal stack. 51 - * 52 - * Keep the return code on the stack quadword aligned! 53 - * That makes the cache flush below easier. 54 - */ 55 - 56 - struct rt_sigframe { 57 - long dummy_er0; 58 - long dummy_vector; 59 - #if defined(CONFIG_CPU_H8S) 60 - short dummy_exr; 61 - #endif 62 - long dummy_pc; 63 - char *pretcode; 64 - struct siginfo *pinfo; 65 - void *puc; 66 - unsigned char retcode[8]; 67 - struct siginfo info; 68 - struct ucontext uc; 69 - int sig; 70 - } __packed __aligned(2); 71 - 72 - static inline int 73 - restore_sigcontext(struct sigcontext *usc, int *pd0) 74 - { 75 - struct pt_regs *regs = current_pt_regs(); 76 - int err = 0; 77 - unsigned int ccr; 78 - unsigned int usp; 79 - unsigned int er0; 80 - 81 - /* Always make any pending restarted system calls return -EINTR */ 82 - current->restart_block.fn = do_no_restart_syscall; 83 - 84 - /* restore passed registers */ 85 - #define COPY(r) do { err |= get_user(regs->r, &usc->sc_##r); } while (0) 86 - COPY(er1); 87 - COPY(er2); 88 - COPY(er3); 89 - COPY(er5); 90 - COPY(pc); 91 - ccr = regs->ccr & 0x10; 92 - COPY(ccr); 93 - #undef COPY 94 - regs->ccr &= 0xef; 95 - regs->ccr |= ccr; 96 - regs->orig_er0 = -1; /* disable syscall checks */ 97 - err |= __get_user(usp, &usc->sc_usp); 98 - regs->sp = usp; 99 - 100 - err |= __get_user(er0, &usc->sc_er0); 101 - *pd0 = er0; 102 - return err; 103 - } 104 - 105 - asmlinkage int sys_rt_sigreturn(void) 106 - { 107 - unsigned long usp = rdusp(); 108 - struct rt_sigframe *frame = (struct rt_sigframe *)(usp - 4); 109 - sigset_t set; 110 - int er0; 111 - 112 - if (!access_ok(frame, sizeof(*frame))) 113 - goto badframe; 114 - if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set))) 115 - goto badframe; 116 - 117 - set_current_blocked(&set); 118 - 119 - if (restore_sigcontext(&frame->uc.uc_mcontext, &er0)) 120 - goto badframe; 121 - 122 - if (restore_altstack(&frame->uc.uc_stack)) 123 - goto badframe; 124 - 125 - return er0; 126 - 127 - badframe: 128 - force_sig(SIGSEGV); 129 - return 0; 130 - } 131 - 132 - static int setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, 133 - unsigned long mask) 134 - { 135 - int err = 0; 136 - 137 - err |= __put_user(regs->er0, &sc->sc_er0); 138 - err |= __put_user(regs->er1, &sc->sc_er1); 139 - err |= __put_user(regs->er2, &sc->sc_er2); 140 - err |= __put_user(regs->er3, &sc->sc_er3); 141 - err |= __put_user(regs->er4, &sc->sc_er4); 142 - err |= __put_user(regs->er5, &sc->sc_er5); 143 - err |= __put_user(regs->er6, &sc->sc_er6); 144 - err |= __put_user(rdusp(), &sc->sc_usp); 145 - err |= __put_user(regs->pc, &sc->sc_pc); 146 - err |= __put_user(regs->ccr, &sc->sc_ccr); 147 - err |= __put_user(mask, &sc->sc_mask); 148 - 149 - return err; 150 - } 151 - 152 - static inline void __user * 153 - get_sigframe(struct ksignal *ksig, struct pt_regs *regs, size_t frame_size) 154 - { 155 - return (void __user *)((sigsp(rdusp(), ksig) - frame_size) & -8UL); 156 - } 157 - 158 - static int setup_rt_frame(struct ksignal *ksig, sigset_t *set, 159 - struct pt_regs *regs) 160 - { 161 - struct rt_sigframe *frame; 162 - int err = 0; 163 - unsigned char *ret; 164 - 165 - frame = get_sigframe(ksig, regs, sizeof(*frame)); 166 - 167 - if (!access_ok(frame, sizeof(*frame))) 168 - return -EFAULT; 169 - 170 - if (ksig->ka.sa.sa_flags & SA_SIGINFO) 171 - err |= copy_siginfo_to_user(&frame->info, &ksig->info); 172 - 173 - /* Create the ucontext. */ 174 - err |= __put_user(0, &frame->uc.uc_flags); 175 - err |= __put_user(0, &frame->uc.uc_link); 176 - err |= __save_altstack(&frame->uc.uc_stack, rdusp()); 177 - err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, set->sig[0]); 178 - err |= copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); 179 - if (err) 180 - return -EFAULT; 181 - 182 - /* Set up to return from userspace. */ 183 - ret = (unsigned char *)&frame->retcode; 184 - if (ksig->ka.sa.sa_flags & SA_RESTORER) 185 - ret = (unsigned char *)(ksig->ka.sa.sa_restorer); 186 - else { 187 - /* sub.l er0,er0; mov.b #__NR_rt_sigreturn,r0l; trapa #0 */ 188 - err |= __put_user(0x1a80f800 + (__NR_rt_sigreturn & 0xff), 189 - (unsigned long *)(frame->retcode + 0)); 190 - err |= __put_user(0x5700, 191 - (unsigned short *)(frame->retcode + 4)); 192 - } 193 - err |= __put_user(ret, &frame->pretcode); 194 - 195 - if (err) 196 - return -EFAULT; 197 - 198 - /* Set up registers for signal handler */ 199 - regs->sp = (unsigned long)frame; 200 - regs->pc = (unsigned long)ksig->ka.sa.sa_handler; 201 - regs->er0 = ksig->sig; 202 - regs->er1 = (unsigned long)&(frame->info); 203 - regs->er2 = (unsigned long)&frame->uc; 204 - regs->er5 = current->mm->start_data; /* GOT base */ 205 - 206 - return 0; 207 - } 208 - 209 - static void 210 - handle_restart(struct pt_regs *regs, struct k_sigaction *ka) 211 - { 212 - switch (regs->er0) { 213 - case -ERESTARTNOHAND: 214 - if (!ka) 215 - goto do_restart; 216 - regs->er0 = -EINTR; 217 - break; 218 - case -ERESTART_RESTARTBLOCK: 219 - if (!ka) { 220 - regs->er0 = __NR_restart_syscall; 221 - regs->pc -= 2; 222 - } else 223 - regs->er0 = -EINTR; 224 - break; 225 - case -ERESTARTSYS: 226 - if (!(ka->sa.sa_flags & SA_RESTART)) { 227 - regs->er0 = -EINTR; 228 - break; 229 - } 230 - fallthrough; 231 - case -ERESTARTNOINTR: 232 - do_restart: 233 - regs->er0 = regs->orig_er0; 234 - regs->pc -= 2; 235 - break; 236 - } 237 - } 238 - 239 - /* 240 - * OK, we're invoking a handler 241 - */ 242 - static void 243 - handle_signal(struct ksignal *ksig, struct pt_regs *regs) 244 - { 245 - sigset_t *oldset = sigmask_to_save(); 246 - int ret; 247 - /* are we from a system call? */ 248 - if (regs->orig_er0 >= 0) 249 - handle_restart(regs, &ksig->ka); 250 - 251 - ret = setup_rt_frame(ksig, oldset, regs); 252 - 253 - signal_setup_done(ret, ksig, 0); 254 - } 255 - 256 - /* 257 - * Note that 'init' is a special process: it doesn't get signals it doesn't 258 - * want to handle. Thus you cannot kill init even with a SIGKILL even by 259 - * mistake. 260 - */ 261 - static void do_signal(struct pt_regs *regs) 262 - { 263 - struct ksignal ksig; 264 - 265 - current->thread.esp0 = (unsigned long) regs; 266 - 267 - if (get_signal(&ksig)) { 268 - /* Whee! Actually deliver the signal. */ 269 - handle_signal(&ksig, regs); 270 - return; 271 - } 272 - /* Did we come from a system call? */ 273 - if (regs->orig_er0 >= 0) 274 - handle_restart(regs, NULL); 275 - 276 - /* If there's no signal to deliver, we just restore the saved mask. */ 277 - restore_saved_sigmask(); 278 - } 279 - 280 - asmlinkage void do_notify_resume(struct pt_regs *regs, u32 thread_info_flags) 281 - { 282 - if (thread_info_flags & (_TIF_SIGPENDING | _TIF_NOTIFY_SIGNAL)) 283 - do_signal(regs); 284 - 285 - if (thread_info_flags & _TIF_NOTIFY_RESUME) 286 - resume_user_mode_work(regs); 287 - }
-31
arch/h8300/kernel/sim-console.c
··· 1 - /* 2 - * arch/h8300/kernel/sim-console.c 3 - * 4 - * Copyright (C) 2015 Yoshinori Sato <ysato@users.sourceforge.jp> 5 - * 6 - * This file is subject to the terms and conditions of the GNU General Public 7 - * License. See the file "COPYING" in the main directory of this archive 8 - * for more details. 9 - */ 10 - #include <linux/console.h> 11 - #include <linux/init.h> 12 - #include <linux/serial_core.h> 13 - 14 - static void sim_write(struct console *con, const char *s, unsigned n) 15 - { 16 - register const char *_ptr __asm__("er1") = s; 17 - register const unsigned _len __asm__("er2") = n; 18 - 19 - __asm__("sub.l er0,er0\n\t" /* er0 = 1 (stdout) */ 20 - "inc.l #1,er0\n\t" 21 - ".byte 0x5e,0x00,0x00,0xc7\n\t" /* jsr @0xc7 (sys_write) */ 22 - : : "g"(_ptr), "g"(_len):"er0"); 23 - } 24 - 25 - static int __init sim_setup(struct earlycon_device *device, const char *opt) 26 - { 27 - device->con->write = sim_write; 28 - return 0; 29 - } 30 - 31 - EARLYCON_DECLARE(h8sim, sim_setup);
-15
arch/h8300/kernel/syscalls.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - #include <linux/syscalls.h> 3 - #include <linux/signal.h> 4 - #include <linux/unistd.h> 5 - 6 - #undef __SYSCALL 7 - #define __SYSCALL(nr, call) [nr] = (call), 8 - 9 - #define sys_mmap2 sys_mmap_pgoff 10 - 11 - asmlinkage int sys_rt_sigreturn(void); 12 - 13 - void *_sys_call_table[__NR_syscalls] = { 14 - #include <asm/unistd.h> 15 - };
-156
arch/h8300/kernel/traps.c
··· 1 - /* 2 - * linux/arch/h8300/boot/traps.c -- general exception handling code 3 - * H8/300 support Yoshinori Sato <ysato@users.sourceforge.jp> 4 - * 5 - * Cloned from Linux/m68k. 6 - * 7 - * No original Copyright holder listed, 8 - * Probable original (C) Roman Zippel (assigned DJD, 1999) 9 - * 10 - * Copyright 1999-2000 D. Jeff Dionne, <jeff@rt-control.com> 11 - * 12 - * This file is subject to the terms and conditions of the GNU General Public 13 - * License. See the file COPYING in the main directory of this archive 14 - * for more details. 15 - */ 16 - 17 - #include <linux/types.h> 18 - #include <linux/sched.h> 19 - #include <linux/sched/debug.h> 20 - #include <linux/sched/task.h> 21 - #include <linux/mm_types.h> 22 - #include <linux/kernel.h> 23 - #include <linux/errno.h> 24 - #include <linux/init.h> 25 - #include <linux/module.h> 26 - #include <linux/bug.h> 27 - 28 - #include <asm/irq.h> 29 - #include <asm/traps.h> 30 - #include <asm/page.h> 31 - 32 - static DEFINE_SPINLOCK(die_lock); 33 - 34 - /* 35 - * this must be called very early as the kernel might 36 - * use some instruction that are emulated on the 060 37 - */ 38 - 39 - void __init base_trap_init(void) 40 - { 41 - } 42 - 43 - asmlinkage void set_esp0(unsigned long ssp) 44 - { 45 - current->thread.esp0 = ssp; 46 - } 47 - 48 - /* 49 - * Generic dumping code. Used for panic and debug. 50 - */ 51 - 52 - static void dump(struct pt_regs *fp) 53 - { 54 - unsigned long *sp; 55 - unsigned char *tp; 56 - int i; 57 - 58 - pr_info("\nCURRENT PROCESS:\n\n"); 59 - pr_info("COMM=%s PID=%d\n", current->comm, current->pid); 60 - if (current->mm) { 61 - pr_info("TEXT=%08x-%08x DATA=%08x-%08x BSS=%08x-%08x\n", 62 - (int) current->mm->start_code, 63 - (int) current->mm->end_code, 64 - (int) current->mm->start_data, 65 - (int) current->mm->end_data, 66 - (int) current->mm->end_data, 67 - (int) current->mm->brk); 68 - pr_info("USER-STACK=%08x KERNEL-STACK=%08lx\n\n", 69 - (int) current->mm->start_stack, 70 - (int) PAGE_SIZE+(unsigned long)current); 71 - } 72 - 73 - show_regs(fp); 74 - pr_info("\nCODE:"); 75 - tp = ((unsigned char *) fp->pc) - 0x20; 76 - for (sp = (unsigned long *) tp, i = 0; (i < 0x40); i += 4) { 77 - if ((i % 0x10) == 0) 78 - pr_info("\n%08x: ", (int) (tp + i)); 79 - pr_info("%08x ", (int) *sp++); 80 - } 81 - pr_info("\n"); 82 - 83 - pr_info("\nKERNEL STACK:"); 84 - tp = ((unsigned char *) fp) - 0x40; 85 - for (sp = (unsigned long *) tp, i = 0; (i < 0xc0); i += 4) { 86 - if ((i % 0x10) == 0) 87 - pr_info("\n%08x: ", (int) (tp + i)); 88 - pr_info("%08x ", (int) *sp++); 89 - } 90 - pr_info("\n"); 91 - if (STACK_MAGIC != *(unsigned long *)((unsigned long)current+PAGE_SIZE)) 92 - pr_info("(Possibly corrupted stack page??)\n"); 93 - 94 - pr_info("\n\n"); 95 - } 96 - 97 - void die(const char *str, struct pt_regs *fp, unsigned long err) 98 - { 99 - static int diecount; 100 - 101 - oops_enter(); 102 - 103 - console_verbose(); 104 - spin_lock_irq(&die_lock); 105 - report_bug(fp->pc, fp); 106 - pr_crit("%s: %04lx [#%d] ", str, err & 0xffff, ++diecount); 107 - dump(fp); 108 - 109 - spin_unlock_irq(&die_lock); 110 - make_task_dead(SIGSEGV); 111 - } 112 - 113 - static int kstack_depth_to_print = 24; 114 - 115 - void show_stack(struct task_struct *task, unsigned long *esp, const char *loglvl) 116 - { 117 - unsigned long *stack, addr; 118 - int i; 119 - 120 - if (esp == NULL) 121 - esp = (unsigned long *) &esp; 122 - 123 - stack = esp; 124 - 125 - printk("%sStack from %08lx:", loglvl, (unsigned long)stack); 126 - for (i = 0; i < kstack_depth_to_print; i++) { 127 - if (((unsigned long)stack & (THREAD_SIZE - 1)) >= 128 - THREAD_SIZE-4) 129 - break; 130 - if (i % 8 == 0) 131 - printk("%s ", loglvl); 132 - pr_cont(" %08lx", *stack++); 133 - } 134 - 135 - printk("%s\nCall Trace:\n", loglvl); 136 - i = 0; 137 - stack = esp; 138 - while (((unsigned long)stack & (THREAD_SIZE - 1)) < THREAD_SIZE-4) { 139 - addr = *stack++; 140 - /* 141 - * If the address is either in the text segment of the 142 - * kernel, or in the region which contains vmalloc'ed 143 - * memory, it *may* be the address of a calling 144 - * routine; if so, print it so that someone tracing 145 - * down the cause of the crash will be able to figure 146 - * out the call path that was taken. 147 - */ 148 - if (check_kernel_text(addr)) { 149 - if (i % 4 == 0) 150 - printk("%s ", loglvl); 151 - pr_cont(" [<%08lx>]", addr); 152 - i++; 153 - } 154 - } 155 - printk("%s\n", loglvl); 156 - }
-69
arch/h8300/kernel/vmlinux.lds.S
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - 3 - #define RO_EXCEPTION_TABLE_ALIGN 16 4 - 5 - #include <asm-generic/vmlinux.lds.h> 6 - #include <asm/page.h> 7 - #include <asm/thread_info.h> 8 - 9 - #define ROMTOP 0x000000 10 - #define RAMTOP 0x400000 11 - 12 - jiffies = jiffies_64 + 4; 13 - 14 - ENTRY(_start) 15 - 16 - SECTIONS 17 - { 18 - #if defined(CONFIG_ROMKERNEL) 19 - . = ROMTOP; 20 - .vectors : 21 - { 22 - _vector = . ; 23 - *(.vector*) 24 - } 25 - #else 26 - . = RAMTOP; 27 - _ramstart = .; 28 - . = . + CONFIG_OFFSET; 29 - #endif 30 - _text = .; 31 - HEAD_TEXT_SECTION 32 - .text : { 33 - _stext = . ; 34 - TEXT_TEXT 35 - SCHED_TEXT 36 - CPUIDLE_TEXT 37 - LOCK_TEXT 38 - #if defined(CONFIG_ROMKERNEL) 39 - *(.int_redirect) 40 - #endif 41 - _etext = . ; 42 - } 43 - RO_DATA(4) 44 - ROMEND = .; 45 - #if defined(CONFIG_ROMKERNEL) 46 - . = RAMTOP; 47 - _ramstart = .; 48 - #define ADDR(x) ROMEND 49 - #endif 50 - _sdata = . ; 51 - __data_start = . ; 52 - RW_DATA(0, PAGE_SIZE, THREAD_SIZE) 53 - #if defined(CONFIG_ROMKERNEL) 54 - #undef ADDR 55 - #endif 56 - . = ALIGN(0x4) ; 57 - __init_begin = .; 58 - INIT_TEXT_SECTION(4) 59 - INIT_DATA_SECTION(4) 60 - __init_end = .; 61 - _edata = . ; 62 - _begin_data = LOADADDR(.data); 63 - _sbss =.; 64 - BSS_SECTION(0, 0 ,0) 65 - _ebss =.; 66 - _ramend = .; 67 - _end = .; 68 - DISCARDS 69 - }
-9
arch/h8300/lib/Makefile
··· 1 - # SPDX-License-Identifier: GPL-2.0-only 2 - # 3 - # Makefile for H8/300-specific library files.. 4 - # 5 - 6 - lib-y = memcpy.o memset.o abs.o \ 7 - mulsi3.o udivsi3.o muldi3.o moddivsi3.o \ 8 - ashldi3.o lshrdi3.o ashrdi3.o ucmpdi2.o \ 9 - delay.o
-21
arch/h8300/lib/abs.S
··· 1 - ;;; SPDX-License-Identifier: GPL-2.0 2 - ;;; abs.S 3 - 4 - #include <asm/linkage.h> 5 - 6 - #if defined(CONFIG_CPU_H8300H) 7 - .h8300h 8 - #endif 9 - #if defined(CONFIG_CPU_H8S) 10 - .h8300s 11 - #endif 12 - .text 13 - .global _abs 14 - 15 - ;;; int abs(int n) 16 - _abs: 17 - mov.l er0,er0 18 - bpl 1f 19 - neg.l er0 20 - 1: 21 - rts
-25
arch/h8300/lib/ashldi3.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - #include "libgcc.h" 3 - 4 - DWtype 5 - __ashldi3(DWtype u, word_type b) 6 - { 7 - const DWunion uu = {.ll = u}; 8 - const word_type bm = (sizeof (Wtype) * BITS_PER_UNIT) - b; 9 - DWunion w; 10 - 11 - if (b == 0) 12 - return u; 13 - 14 - if (bm <= 0) { 15 - w.s.low = 0; 16 - w.s.high = (UWtype) uu.s.low << -bm; 17 - } else { 18 - const UWtype carries = (UWtype) uu.s.low >> bm; 19 - 20 - w.s.low = (UWtype) uu.s.low << b; 21 - w.s.high = ((UWtype) uu.s.high << b) | carries; 22 - } 23 - 24 - return w.ll; 25 - }
-25
arch/h8300/lib/ashrdi3.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - #include "libgcc.h" 3 - 4 - DWtype __ashrdi3(DWtype u, word_type b) 5 - { 6 - const DWunion uu = {.ll = u}; 7 - const word_type bm = (sizeof (Wtype) * BITS_PER_UNIT) - b; 8 - DWunion w; 9 - 10 - if (b == 0) 11 - return u; 12 - 13 - if (bm <= 0) { 14 - /* w.s.high = 1..1 or 0..0 */ 15 - w.s.high = uu.s.high >> (sizeof (Wtype) * BITS_PER_UNIT - 1); 16 - w.s.low = uu.s.high >> -bm; 17 - } else { 18 - const UWtype carries = (UWtype) uu.s.high << bm; 19 - 20 - w.s.high = uu.s.high >> b; 21 - w.s.low = ((UWtype) uu.s.low >> b) | carries; 22 - } 23 - 24 - return w.ll; 25 - }
-41
arch/h8300/lib/delay.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /* 3 - * delay loops 4 - * 5 - * Copyright (C) 2015 Yoshinori Sato 6 - */ 7 - 8 - #include <linux/module.h> 9 - #include <linux/delay.h> 10 - #include <asm/param.h> 11 - #include <asm/processor.h> 12 - #include <asm/timex.h> 13 - 14 - void __delay(unsigned long cycles) 15 - { 16 - __asm__ volatile ("1: dec.l #1,%0\n\t" 17 - "bne 1b":"=r"(cycles):"0"(cycles)); 18 - } 19 - EXPORT_SYMBOL(__delay); 20 - 21 - void __const_udelay(unsigned long xloops) 22 - { 23 - u64 loops; 24 - 25 - loops = (u64)xloops * loops_per_jiffy * HZ; 26 - 27 - __delay(loops >> 32); 28 - } 29 - EXPORT_SYMBOL(__const_udelay); 30 - 31 - void __udelay(unsigned long usecs) 32 - { 33 - __const_udelay(usecs * 0x10C7UL); /* 2**32 / 1000000 (rounded up) */ 34 - } 35 - EXPORT_SYMBOL(__udelay); 36 - 37 - void __ndelay(unsigned long nsecs) 38 - { 39 - __const_udelay(nsecs * 0x5UL); /* 2**32 / 1000000000 (rounded up) */ 40 - } 41 - EXPORT_SYMBOL(__ndelay);
-78
arch/h8300/lib/libgcc.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef __H8300_LIBGCC_H__ 3 - #define __H8300_LIBGCC_H__ 4 - 5 - #ifdef __ASSEMBLY__ 6 - #define A0 r0 7 - #define A0L r0l 8 - #define A0H r0h 9 - 10 - #define A1 r1 11 - #define A1L r1l 12 - #define A1H r1h 13 - 14 - #define A2 r2 15 - #define A2L r2l 16 - #define A2H r2h 17 - 18 - #define A3 r3 19 - #define A3L r3l 20 - #define A3H r3h 21 - 22 - #define S0 r4 23 - #define S0L r4l 24 - #define S0H r4h 25 - 26 - #define S1 r5 27 - #define S1L r5l 28 - #define S1H r5h 29 - 30 - #define S2 r6 31 - #define S2L r6l 32 - #define S2H r6h 33 - 34 - #define PUSHP push.l 35 - #define POPP pop.l 36 - 37 - #define A0P er0 38 - #define A1P er1 39 - #define A2P er2 40 - #define A3P er3 41 - #define S0P er4 42 - #define S1P er5 43 - #define S2P er6 44 - 45 - #define A0E e0 46 - #define A1E e1 47 - #define A2E e2 48 - #define A3E e3 49 - #else 50 - #define Wtype SItype 51 - #define UWtype USItype 52 - #define HWtype SItype 53 - #define UHWtype USItype 54 - #define DWtype DItype 55 - #define UDWtype UDItype 56 - #define UWtype USItype 57 - #define Wtype SItype 58 - #define UWtype USItype 59 - #define W_TYPE_SIZE (4 * BITS_PER_UNIT) 60 - #define BITS_PER_UNIT (8) 61 - 62 - typedef int SItype __attribute__ ((mode (SI))); 63 - typedef unsigned int USItype __attribute__ ((mode (SI))); 64 - typedef int DItype __attribute__ ((mode (DI))); 65 - typedef unsigned int UDItype __attribute__ ((mode (DI))); 66 - struct DWstruct { 67 - Wtype high, low; 68 - }; 69 - typedef union { 70 - struct DWstruct s; 71 - DWtype ll; 72 - } DWunion; 73 - 74 - typedef int word_type __attribute__ ((mode (__word__))); 75 - 76 - #endif 77 - 78 - #endif
-24
arch/h8300/lib/lshrdi3.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - #include "libgcc.h" 3 - 4 - DWtype __lshrdi3(DWtype u, word_type b) 5 - { 6 - const DWunion uu = {.ll = u}; 7 - const word_type bm = (sizeof (Wtype) * BITS_PER_UNIT) - b; 8 - DWunion w; 9 - 10 - if (b == 0) 11 - return u; 12 - 13 - if (bm <= 0) { 14 - w.s.high = 0; 15 - w.s.low = (UWtype) uu.s.high >> -bm; 16 - } else { 17 - const UWtype carries = (UWtype) uu.s.high << bm; 18 - 19 - w.s.high = (UWtype) uu.s.high >> b; 20 - w.s.low = ((UWtype) uu.s.low >> b) | carries; 21 - } 22 - 23 - return w.ll; 24 - }
-86
arch/h8300/lib/memcpy.S
··· 1 - ;;; SPDX-License-Identifier: GPL-2.0 2 - ;;; memcpy.S 3 - 4 - #include <asm/linkage.h> 5 - 6 - #if defined(CONFIG_CPU_H8300H) 7 - .h8300h 8 - #endif 9 - #if defined(CONFIG_CPU_H8S) 10 - .h8300s 11 - #endif 12 - .text 13 - .global memcpy 14 - 15 - ;;; void *memcpy(void *to, void *from, size_t n) 16 - memcpy: 17 - mov.l er2,er2 18 - bne 1f 19 - rts 20 - 1: 21 - ;; address check 22 - bld #0,r0l 23 - bxor #0,r1l 24 - bcs 4f 25 - mov.l er4,@-sp 26 - mov.l er0,@-sp 27 - btst #0,r0l 28 - beq 1f 29 - ;; (aligned even) odd address 30 - mov.b @er1,r3l 31 - mov.b r3l,@er0 32 - adds #1,er1 33 - adds #1,er0 34 - dec.l #1,er2 35 - beq 3f 36 - 1: 37 - ;; n < sizeof(unsigned long) check 38 - sub.l er4,er4 39 - adds #4,er4 ; loop count check value 40 - cmp.l er4,er2 41 - blo 2f 42 - ;; unsigned long copy 43 - 1: 44 - mov.l @er1,er3 45 - mov.l er3,@er0 46 - adds #4,er0 47 - adds #4,er1 48 - subs #4,er2 49 - cmp.l er4,er2 50 - bcc 1b 51 - ;; rest 52 - 2: 53 - mov.l er2,er2 54 - beq 3f 55 - 1: 56 - mov.b @er1,r3l 57 - mov.b r3l,@er0 58 - adds #1,er1 59 - adds #1,er0 60 - dec.l #1,er2 61 - bne 1b 62 - 3: 63 - mov.l @sp+,er0 64 - mov.l @sp+,er4 65 - rts 66 - 67 - ;; odd <- even / even <- odd 68 - 4: 69 - mov.l er4,er3 70 - mov.l er2,er4 71 - mov.l er5,er2 72 - mov.l er1,er5 73 - mov.l er6,er1 74 - mov.l er0,er6 75 - 1: 76 - eepmov.w 77 - mov.w r4,r4 78 - bne 1b 79 - dec.w #1,e4 80 - bpl 1b 81 - mov.l er1,er6 82 - mov.l er2,er5 83 - mov.l er3,er4 84 - rts 85 - 86 - .end
-70
arch/h8300/lib/memset.S
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - /* memset.S */ 3 - 4 - #include <asm/linkage.h> 5 - 6 - #if defined(CONFIG_CPU_H8300H) 7 - .h8300h 8 - #endif 9 - #if defined(CONFIG_CPU_H8S) 10 - .h8300s 11 - #endif 12 - .text 13 - 14 - .global memset 15 - .global clear_user 16 - 17 - ;;void *memset(*ptr, int c, size_t count) 18 - ;; ptr = er0 19 - ;; c = er1(r1l) 20 - ;; count = er2 21 - memset: 22 - btst #0,r0l 23 - beq 2f 24 - 25 - ;; odd address 26 - 1: 27 - mov.b r1l,@er0 28 - adds #1,er0 29 - dec.l #1,er2 30 - beq 6f 31 - 32 - ;; even address 33 - 2: 34 - mov.l er2,er3 35 - cmp.l #4,er2 36 - blo 4f 37 - ;; count>=4 -> count/4 38 - #if defined(CONFIG_CPU_H8300H) 39 - shlr.l er2 40 - shlr.l er2 41 - #endif 42 - #if defined(CONFIG_CPU_H8S) 43 - shlr.l #2,er2 44 - #endif 45 - ;; byte -> long 46 - mov.b r1l,r1h 47 - mov.w r1,e1 48 - 3: 49 - mov.l er1,@er0 50 - adds #4,er0 51 - dec.l #1,er2 52 - bne 3b 53 - 4: 54 - ;; count % 4 55 - and.b #3,r3l 56 - beq 6f 57 - 5: 58 - mov.b r1l,@er0 59 - adds #1,er0 60 - dec.b r3l 61 - bne 5b 62 - 6: 63 - rts 64 - 65 - clear_user: 66 - mov.l er1, er2 67 - sub.l er1, er1 68 - bra memset 69 - 70 - .end
-73
arch/h8300/lib/moddivsi3.S
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #include "libgcc.h" 3 - 4 - ; numerator in A0/A1 5 - ; denominator in A2/A3 6 - .global __modsi3 7 - __modsi3: 8 - PUSHP S2P 9 - bsr modnorm 10 - bsr __divsi3 11 - mov.l er3,er0 12 - bra exitdiv 13 - 14 - .global __umodsi3 15 - __umodsi3: 16 - bsr __udivsi3:16 17 - mov.l er3,er0 18 - rts 19 - 20 - .global __divsi3 21 - __divsi3: 22 - PUSHP S2P 23 - bsr divnorm 24 - bsr __udivsi3:16 25 - 26 - ; examine what the sign should be 27 - exitdiv: 28 - btst #3,S2L 29 - beq reti 30 - 31 - ; should be -ve 32 - neg.l A0P 33 - 34 - reti: 35 - POPP S2P 36 - rts 37 - 38 - divnorm: 39 - mov.l A0P,A0P ; is the numerator -ve 40 - stc ccr,S2L ; keep the sign in bit 3 of S2L 41 - bge postive 42 - 43 - neg.l A0P ; negate arg 44 - 45 - postive: 46 - mov.l A1P,A1P ; is the denominator -ve 47 - bge postive2 48 - 49 - neg.l A1P ; negate arg 50 - xor.b #0x08,S2L ; toggle the result sign 51 - 52 - postive2: 53 - rts 54 - 55 - ;; Basically the same, except that the sign of the divisor determines 56 - ;; the sign. 57 - modnorm: 58 - mov.l A0P,A0P ; is the numerator -ve 59 - stc ccr,S2L ; keep the sign in bit 3 of S2L 60 - bge mpostive 61 - 62 - neg.l A0P ; negate arg 63 - 64 - mpostive: 65 - mov.l A1P,A1P ; is the denominator -ve 66 - bge mpostive2 67 - 68 - neg.l A1P ; negate arg 69 - 70 - mpostive2: 71 - rts 72 - 73 - .end
-73
arch/h8300/lib/modsi3.S
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #include "libgcc.h" 3 - 4 - ; numerator in A0/A1 5 - ; denominator in A2/A3 6 - .global __modsi3 7 - __modsi3: 8 - PUSHP S2P 9 - bsr modnorm 10 - bsr __divsi3 11 - mov.l er3,er0 12 - bra exitdiv 13 - 14 - .global __umodsi3 15 - __umodsi3: 16 - bsr __udivsi3 17 - mov.l er3,er0 18 - rts 19 - 20 - .global __divsi3 21 - __divsi3: 22 - PUSHP S2P 23 - jsr divnorm 24 - bsr __udivsi3 25 - 26 - ; examine what the sign should be 27 - exitdiv: 28 - btst #3,S2L 29 - beq reti 30 - 31 - ; should be -ve 32 - neg.l A0P 33 - 34 - reti: 35 - POPP S2P 36 - rts 37 - 38 - divnorm: 39 - mov.l A0P,A0P ; is the numerator -ve 40 - stc ccr,S2L ; keep the sign in bit 3 of S2L 41 - bge postive 42 - 43 - neg.l A0P ; negate arg 44 - 45 - postive: 46 - mov.l A1P,A1P ; is the denominator -ve 47 - bge postive2 48 - 49 - neg.l A1P ; negate arg 50 - xor.b #0x08,S2L ; toggle the result sign 51 - 52 - postive2: 53 - rts 54 - 55 - ;; Basically the same, except that the sign of the divisor determines 56 - ;; the sign. 57 - modnorm: 58 - mov.l A0P,A0P ; is the numerator -ve 59 - stc ccr,S2L ; keep the sign in bit 3 of S2L 60 - bge mpostive 61 - 62 - neg.l A0P ; negate arg 63 - 64 - mpostive: 65 - mov.l A1P,A1P ; is the denominator -ve 66 - bge mpostive2 67 - 68 - neg.l A1P ; negate arg 69 - 70 - mpostive2: 71 - rts 72 - 73 - .end
-45
arch/h8300/lib/muldi3.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - #include "libgcc.h" 3 - 4 - #define __ll_B ((UWtype) 1 << (W_TYPE_SIZE / 2)) 5 - #define __ll_lowpart(t) ((UWtype) (t) & (__ll_B - 1)) 6 - #define __ll_highpart(t) ((UWtype) (t) >> (W_TYPE_SIZE / 2)) 7 - 8 - #define umul_ppmm(w1, w0, u, v) \ 9 - do { \ 10 - UWtype __x0, __x1, __x2, __x3; \ 11 - UHWtype __ul, __vl, __uh, __vh; \ 12 - __ul = __ll_lowpart(u); \ 13 - __uh = __ll_highpart(u); \ 14 - __vl = __ll_lowpart(v); \ 15 - __vh = __ll_highpart(v); \ 16 - __x0 = (UWtype) __ul * __vl; \ 17 - __x1 = (UWtype) __ul * __vh; \ 18 - __x2 = (UWtype) __uh * __vl; \ 19 - __x3 = (UWtype) __uh * __vh; \ 20 - __x1 += __ll_highpart(__x0); \ 21 - __x1 += __x2; \ 22 - if (__x1 < __x2) \ 23 - __x3 += __ll_B; \ 24 - (w1) = __x3 + __ll_highpart(__x1); \ 25 - (w0) = __ll_lowpart(__x1) * __ll_B + __ll_lowpart(__x0); \ 26 - } while (0) 27 - 28 - #define __umulsidi3(u, v) ( \ 29 - { \ 30 - DWunion __w; \ 31 - umul_ppmm(__w.s.high, __w.s.low, u, v); \ 32 - __w.ll; } \ 33 - ) 34 - 35 - DWtype __muldi3(DWtype u, DWtype v) 36 - { 37 - const DWunion uu = {.ll = u}; 38 - const DWunion vv = {.ll = v}; 39 - DWunion w = {.ll = __umulsidi3(uu.s.low, vv.s.low)}; 40 - 41 - w.s.high += ((UWtype) uu.s.low * (UWtype) vv.s.high 42 - + (UWtype) uu.s.high * (UWtype) vv.s.low); 43 - 44 - return w.ll; 45 - }
-39
arch/h8300/lib/mulsi3.S
··· 1 - ; SPDX-License-Identifier: GPL-2.0 2 - ; 3 - ; mulsi3 for H8/300H - based on Renesas SH implementation 4 - ; 5 - ; by Toshiyasu Morita 6 - ; 7 - ; Old code: 8 - ; 9 - ; 16b * 16b = 372 states (worst case) 10 - ; 32b * 32b = 724 states (worst case) 11 - ; 12 - ; New code: 13 - ; 14 - ; 16b * 16b = 48 states 15 - ; 16b * 32b = 72 states 16 - ; 32b * 32b = 92 states 17 - ; 18 - 19 - .global __mulsi3 20 - __mulsi3: 21 - mov.w r1,r2 ; ( 2 states) b * d 22 - mulxu r0,er2 ; (22 states) 23 - 24 - mov.w e0,r3 ; ( 2 states) a * d 25 - beq L_skip1 ; ( 4 states) 26 - mulxu r1,er3 ; (22 states) 27 - add.w r3,e2 ; ( 2 states) 28 - 29 - L_skip1: 30 - mov.w e1,r3 ; ( 2 states) c * b 31 - beq L_skip2 ; ( 4 states) 32 - mulxu r0,er3 ; (22 states) 33 - add.w r3,e2 ; ( 2 states) 34 - 35 - L_skip2: 36 - mov.l er2,er0 ; ( 2 states) 37 - rts ; (10 states) 38 - 39 - .end
-18
arch/h8300/lib/ucmpdi2.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - #include "libgcc.h" 3 - 4 - word_type __ucmpdi2(DWtype a, DWtype b) 5 - { 6 - const DWunion au = {.ll = a}; 7 - const DWunion bu = {.ll = b}; 8 - 9 - if ((UWtype) au.s.high < (UWtype) bu.s.high) 10 - return 0; 11 - else if ((UWtype) au.s.high > (UWtype) bu.s.high) 12 - return 2; 13 - if ((UWtype) au.s.low < (UWtype) bu.s.low) 14 - return 0; 15 - else if ((UWtype) au.s.low > (UWtype) bu.s.low) 16 - return 2; 17 - return 1; 18 - }
-77
arch/h8300/lib/udivsi3.S
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #include "libgcc.h" 3 - 4 - ;; This function also computes the remainder and stores it in er3. 5 - .global __udivsi3 6 - __udivsi3: 7 - mov.w A1E,A1E ; denominator top word 0? 8 - bne DenHighNonZero 9 - 10 - ; do it the easy way, see page 107 in manual 11 - mov.w A0E,A2 12 - extu.l A2P 13 - divxu.w A1,A2P 14 - mov.w A2E,A0E 15 - divxu.w A1,A0P 16 - mov.w A0E,A3 17 - mov.w A2,A0E 18 - extu.l A3P 19 - rts 20 - 21 - ; er0 = er0 / er1 22 - ; er3 = er0 % er1 23 - ; trashes er1 er2 24 - ; expects er1 >= 2^16 25 - DenHighNonZero: 26 - mov.l er0,er3 27 - mov.l er1,er2 28 - #ifdef CONFIG_CPU_H8300H 29 - divmod_L21: 30 - shlr.l er0 31 - shlr.l er2 ; make divisor < 2^16 32 - mov.w e2,e2 33 - bne divmod_L21 34 - #else 35 - shlr.l #2,er2 ; make divisor < 2^16 36 - mov.w e2,e2 37 - beq divmod_L22A 38 - divmod_L21: 39 - shlr.l #2,er0 40 - divmod_L22: 41 - shlr.l #2,er2 ; make divisor < 2^16 42 - mov.w e2,e2 43 - bne divmod_L21 44 - divmod_L22A: 45 - rotxl.w r2 46 - bcs divmod_L23 47 - shlr.l er0 48 - bra divmod_L24 49 - divmod_L23: 50 - rotxr.w r2 51 - shlr.l #2,er0 52 - divmod_L24: 53 - #endif 54 - ;; At this point, 55 - ;; er0 contains shifted dividend 56 - ;; er1 contains divisor 57 - ;; er2 contains shifted divisor 58 - ;; er3 contains dividend, later remainder 59 - divxu.w r2,er0 ; r0 now contains the approximate quotient (AQ) 60 - extu.l er0 61 - beq divmod_L25 62 - subs #1,er0 ; er0 = AQ - 1 63 - mov.w e1,r2 64 - mulxu.w r0,er2 ; er2 = upper (AQ - 1) * divisor 65 - sub.w r2,e3 ; dividend - 65536 * er2 66 - mov.w r1,r2 67 - mulxu.w r0,er2 ; compute er3 = remainder (tentative) 68 - sub.l er2,er3 ; er3 = dividend - (AQ - 1) * divisor 69 - divmod_L25: 70 - cmp.l er1,er3 ; is divisor < remainder? 71 - blo divmod_L26 72 - adds #1,er0 73 - sub.l er1,er3 ; correct the remainder 74 - divmod_L26: 75 - rts 76 - 77 - .end
-6
arch/h8300/mm/Makefile
··· 1 - # SPDX-License-Identifier: GPL-2.0-only 2 - # 3 - # Makefile for the linux h8300-specific parts of the memory manager. 4 - # 5 - 6 - obj-y := init.o fault.o memory.o
-57
arch/h8300/mm/fault.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /* 3 - * linux/arch/h8300/mm/fault.c 4 - * 5 - * Copyright (C) 1998 D. Jeff Dionne <jeff@lineo.ca>, 6 - * Copyright (C) 2000 Lineo, Inc. (www.lineo.com) 7 - * 8 - * Based on: 9 - * 10 - * linux/arch/m68knommu/mm/fault.c 11 - * linux/arch/m68k/mm/fault.c 12 - * 13 - * Copyright (C) 1995 Hamish Macdonald 14 - */ 15 - 16 - #include <linux/mman.h> 17 - #include <linux/mm.h> 18 - #include <linux/kernel.h> 19 - #include <linux/ptrace.h> 20 - 21 - 22 - void die(const char *str, struct pt_regs *fp, unsigned long err); 23 - 24 - /* 25 - * This routine handles page faults. It determines the problem, and 26 - * then passes it off to one of the appropriate routines. 27 - * 28 - * error_code: 29 - * bit 0 == 0 means no page found, 1 means protection fault 30 - * bit 1 == 0 means read, 1 means write 31 - * 32 - * If this routine detects a bad access, it returns 1, otherwise it 33 - * returns 0. 34 - */ 35 - asmlinkage int do_page_fault(struct pt_regs *regs, unsigned long address, 36 - unsigned long error_code) 37 - { 38 - #ifdef DEBUG 39 - pr_debug("regs->sr=%#x, regs->pc=%#lx, address=%#lx, %ld\n", 40 - regs->sr, regs->pc, address, error_code); 41 - #endif 42 - 43 - /* 44 - * Oops. The kernel tried to access some bad page. We'll have to 45 - * terminate things with extreme prejudice. 46 - */ 47 - if ((unsigned long) address < PAGE_SIZE) 48 - pr_alert("Unable to handle kernel NULL pointer dereference"); 49 - else 50 - pr_alert("Unable to handle kernel access"); 51 - printk(" at virtual address %08lx\n", address); 52 - if (!user_mode(regs)) 53 - die("Oops", regs, error_code); 54 - make_task_dead(SIGKILL); 55 - 56 - return 1; 57 - }
-95
arch/h8300/mm/init.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /* 3 - * linux/arch/h8300/mm/init.c 4 - * 5 - * Copyright (C) 1998 D. Jeff Dionne <jeff@lineo.ca>, 6 - * Kenneth Albanowski <kjahds@kjahds.com>, 7 - * Copyright (C) 2000 Lineo, Inc. (www.lineo.com) 8 - * 9 - * Based on: 10 - * 11 - * linux/arch/m68knommu/mm/init.c 12 - * linux/arch/m68k/mm/init.c 13 - * 14 - * Copyright (C) 1995 Hamish Macdonald 15 - * 16 - * JAN/1999 -- hacked to support ColdFire (gerg@snapgear.com) 17 - * DEC/2000 -- linux 2.4 support <davidm@snapgear.com> 18 - */ 19 - 20 - #include <linux/signal.h> 21 - #include <linux/sched.h> 22 - #include <linux/kernel.h> 23 - #include <linux/errno.h> 24 - #include <linux/string.h> 25 - #include <linux/types.h> 26 - #include <linux/ptrace.h> 27 - #include <linux/mman.h> 28 - #include <linux/mm.h> 29 - #include <linux/swap.h> 30 - #include <linux/init.h> 31 - #include <linux/highmem.h> 32 - #include <linux/pagemap.h> 33 - #include <linux/memblock.h> 34 - #include <linux/gfp.h> 35 - 36 - #include <asm/setup.h> 37 - #include <asm/page.h> 38 - #include <asm/sections.h> 39 - 40 - /* 41 - * ZERO_PAGE is a special page that is used for zero-initialized 42 - * data and COW. 43 - */ 44 - unsigned long empty_zero_page; 45 - 46 - /* 47 - * paging_init() continues the virtual memory environment setup which 48 - * was begun by the code in arch/head.S. 49 - * The parameters are pointers to where to stick the starting and ending 50 - * addresses of available kernel virtual memory. 51 - */ 52 - void __init paging_init(void) 53 - { 54 - /* 55 - * Make sure start_mem is page aligned, otherwise bootmem and 56 - * page_alloc get different views og the world. 57 - */ 58 - unsigned long start_mem = PAGE_ALIGN(memory_start); 59 - unsigned long end_mem = memory_end & PAGE_MASK; 60 - 61 - pr_debug("start_mem is %#lx\nvirtual_end is %#lx\n", 62 - start_mem, end_mem); 63 - 64 - /* 65 - * Initialize the bad page table and bad page to point 66 - * to a couple of allocated pages. 67 - */ 68 - empty_zero_page = (unsigned long)memblock_alloc(PAGE_SIZE, PAGE_SIZE); 69 - if (!empty_zero_page) 70 - panic("%s: Failed to allocate %lu bytes align=0x%lx\n", 71 - __func__, PAGE_SIZE, PAGE_SIZE); 72 - 73 - pr_debug("before free_area_init\n"); 74 - 75 - pr_debug("free_area_init -> start_mem is %#lx\nvirtual_end is %#lx\n", 76 - start_mem, end_mem); 77 - 78 - { 79 - unsigned long max_zone_pfn[MAX_NR_ZONES] = {0, }; 80 - 81 - max_zone_pfn[ZONE_NORMAL] = end_mem >> PAGE_SHIFT; 82 - free_area_init(max_zone_pfn); 83 - } 84 - } 85 - 86 - void __init mem_init(void) 87 - { 88 - pr_devel("Mem_init: start=%lx, end=%lx\n", memory_start, memory_end); 89 - 90 - high_memory = (void *) (memory_end & PAGE_MASK); 91 - max_mapnr = MAP_NR(high_memory); 92 - 93 - /* this will put all low memory onto the freelists */ 94 - memblock_free_all(); 95 - }
-52
arch/h8300/mm/memory.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /* 3 - * linux/arch/h8300/mm/memory.c 4 - * 5 - * Copyright (C) 2002 Yoshinori Sato <ysato@users.sourceforge.jp>, 6 - * 7 - * Based on: 8 - * 9 - * linux/arch/m68knommu/mm/memory.c 10 - * 11 - * Copyright (C) 1998 Kenneth Albanowski <kjahds@kjahds.com>, 12 - * Copyright (C) 1999-2002, Greg Ungerer (gerg@snapgear.com) 13 - * 14 - * Based on: 15 - * 16 - * linux/arch/m68k/mm/memory.c 17 - * 18 - * Copyright (C) 1995 Hamish Macdonald 19 - */ 20 - 21 - #include <linux/mm.h> 22 - #include <linux/kernel.h> 23 - #include <linux/string.h> 24 - #include <linux/types.h> 25 - 26 - #include <asm/setup.h> 27 - #include <asm/page.h> 28 - #include <asm/traps.h> 29 - #include <asm/io.h> 30 - 31 - void cache_clear(unsigned long paddr, int len) 32 - { 33 - } 34 - 35 - 36 - void cache_push(unsigned long paddr, int len) 37 - { 38 - } 39 - 40 - void cache_push_v(unsigned long vaddr, int len) 41 - { 42 - } 43 - 44 - /* 45 - * Map some physical address range into the kernel address space. 46 - */ 47 - 48 - unsigned long kernel_map(unsigned long paddr, unsigned long size, 49 - int nocacheflag, unsigned long *memavailp) 50 - { 51 - return paddr; 52 - }
+10 -10
arch/mips/include/uapi/asm/stat.h
··· 19 19 struct stat { 20 20 unsigned st_dev; 21 21 long st_pad1[3]; /* Reserved for network id */ 22 - ino_t st_ino; 23 - mode_t st_mode; 22 + __kernel_ino_t st_ino; 23 + __kernel_mode_t st_mode; 24 24 __u32 st_nlink; 25 - uid_t st_uid; 26 - gid_t st_gid; 25 + __kernel_uid_t st_uid; 26 + __kernel_gid_t st_gid; 27 27 unsigned st_rdev; 28 28 long st_pad2[2]; 29 29 long st_size; ··· 55 55 56 56 unsigned long long st_ino; 57 57 58 - mode_t st_mode; 58 + __kernel_mode_t st_mode; 59 59 __u32 st_nlink; 60 60 61 - uid_t st_uid; 62 - gid_t st_gid; 61 + __kernel_uid_t st_uid; 62 + __kernel_gid_t st_gid; 63 63 64 64 unsigned long st_rdev; 65 65 unsigned long st_pad1[3]; /* Reserved for st_rdev expansion */ ··· 96 96 97 97 unsigned long st_ino; 98 98 99 - mode_t st_mode; 99 + __kernel_mode_t st_mode; 100 100 __u32 st_nlink; 101 101 102 - uid_t st_uid; 103 - gid_t st_gid; 102 + __kernel_uid_t st_uid; 103 + __kernel_gid_t st_gid; 104 104 105 105 unsigned int st_rdev; 106 106 unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */
-1
arch/openrisc/Kconfig
··· 30 30 select HAVE_DEBUG_STACKOVERFLOW 31 31 select OR1K_PIC 32 32 select CPU_NO_EFFICIENT_FFS if !OPENRISC_HAVE_INST_FF1 33 - select ARCH_USE_QUEUED_SPINLOCKS 34 33 select ARCH_USE_QUEUED_RWLOCKS 35 34 select OMPIC if SMP 36 35 select ARCH_WANT_FRAME_POINTERS
+2 -3
arch/openrisc/include/asm/Kbuild
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 generic-y += extable.h 3 3 generic-y += kvm_para.h 4 - generic-y += mcs_spinlock.h 5 - generic-y += qspinlock_types.h 6 - generic-y += qspinlock.h 4 + generic-y += spinlock_types.h 5 + generic-y += spinlock.h 7 6 generic-y += qrwlock_types.h 8 7 generic-y += qrwlock.h 9 8 generic-y += user.h
-27
arch/openrisc/include/asm/spinlock.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 - /* 3 - * OpenRISC Linux 4 - * 5 - * Linux architectural port borrowing liberally from similar works of 6 - * others. All original copyrights apply as per the original source 7 - * declaration. 8 - * 9 - * OpenRISC implementation: 10 - * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com> 11 - * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se> 12 - * et al. 13 - */ 14 - 15 - #ifndef __ASM_OPENRISC_SPINLOCK_H 16 - #define __ASM_OPENRISC_SPINLOCK_H 17 - 18 - #include <asm/qspinlock.h> 19 - 20 - #include <asm/qrwlock.h> 21 - 22 - #define arch_spin_relax(lock) cpu_relax() 23 - #define arch_read_relax(lock) cpu_relax() 24 - #define arch_write_relax(lock) cpu_relax() 25 - 26 - 27 - #endif
-7
arch/openrisc/include/asm/spinlock_types.h
··· 1 - #ifndef _ASM_OPENRISC_SPINLOCK_TYPES_H 2 - #define _ASM_OPENRISC_SPINLOCK_TYPES_H 3 - 4 - #include <asm/qspinlock_types.h> 5 - #include <asm/qrwlock_types.h> 6 - 7 - #endif /* _ASM_OPENRISC_SPINLOCK_TYPES_H */
+5 -5
arch/powerpc/include/uapi/asm/stat.h
··· 29 29 30 30 struct stat { 31 31 unsigned long st_dev; 32 - ino_t st_ino; 32 + __kernel_ino_t st_ino; 33 33 #ifdef __powerpc64__ 34 34 unsigned long st_nlink; 35 - mode_t st_mode; 35 + __kernel_mode_t st_mode; 36 36 #else 37 - mode_t st_mode; 37 + __kernel_mode_t st_mode; 38 38 unsigned short st_nlink; 39 39 #endif 40 - uid_t st_uid; 41 - gid_t st_gid; 40 + __kernel_uid_t st_uid; 41 + __kernel_gid_t st_gid; 42 42 unsigned long st_rdev; 43 43 long st_size; 44 44 unsigned long st_blksize;
+1
arch/riscv/Kconfig
··· 39 39 select ARCH_SUPPORTS_DEBUG_PAGEALLOC if MMU 40 40 select ARCH_SUPPORTS_HUGETLBFS if MMU 41 41 select ARCH_USE_MEMTEST 42 + select ARCH_USE_QUEUED_RWLOCKS 42 43 select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT if MMU 43 44 select ARCH_WANT_FRAME_POINTERS 44 45 select ARCH_WANT_GENERAL_HUGETLB
+4
arch/riscv/include/asm/Kbuild
··· 3 3 generic-y += flat.h 4 4 generic-y += kvm_para.h 5 5 generic-y += parport.h 6 + generic-y += spinlock.h 7 + generic-y += spinlock_types.h 8 + generic-y += qrwlock.h 9 + generic-y += qrwlock_types.h 6 10 generic-y += user.h 7 11 generic-y += vmlinux.lds.h
-135
arch/riscv/include/asm/spinlock.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-only */ 2 - /* 3 - * Copyright (C) 2015 Regents of the University of California 4 - * Copyright (C) 2017 SiFive 5 - */ 6 - 7 - #ifndef _ASM_RISCV_SPINLOCK_H 8 - #define _ASM_RISCV_SPINLOCK_H 9 - 10 - #include <linux/kernel.h> 11 - #include <asm/current.h> 12 - #include <asm/fence.h> 13 - 14 - /* 15 - * Simple spin lock operations. These provide no fairness guarantees. 16 - */ 17 - 18 - /* FIXME: Replace this with a ticket lock, like MIPS. */ 19 - 20 - #define arch_spin_is_locked(x) (READ_ONCE((x)->lock) != 0) 21 - 22 - static inline void arch_spin_unlock(arch_spinlock_t *lock) 23 - { 24 - smp_store_release(&lock->lock, 0); 25 - } 26 - 27 - static inline int arch_spin_trylock(arch_spinlock_t *lock) 28 - { 29 - int tmp = 1, busy; 30 - 31 - __asm__ __volatile__ ( 32 - " amoswap.w %0, %2, %1\n" 33 - RISCV_ACQUIRE_BARRIER 34 - : "=r" (busy), "+A" (lock->lock) 35 - : "r" (tmp) 36 - : "memory"); 37 - 38 - return !busy; 39 - } 40 - 41 - static inline void arch_spin_lock(arch_spinlock_t *lock) 42 - { 43 - while (1) { 44 - if (arch_spin_is_locked(lock)) 45 - continue; 46 - 47 - if (arch_spin_trylock(lock)) 48 - break; 49 - } 50 - } 51 - 52 - /***********************************************************/ 53 - 54 - static inline void arch_read_lock(arch_rwlock_t *lock) 55 - { 56 - int tmp; 57 - 58 - __asm__ __volatile__( 59 - "1: lr.w %1, %0\n" 60 - " bltz %1, 1b\n" 61 - " addi %1, %1, 1\n" 62 - " sc.w %1, %1, %0\n" 63 - " bnez %1, 1b\n" 64 - RISCV_ACQUIRE_BARRIER 65 - : "+A" (lock->lock), "=&r" (tmp) 66 - :: "memory"); 67 - } 68 - 69 - static inline void arch_write_lock(arch_rwlock_t *lock) 70 - { 71 - int tmp; 72 - 73 - __asm__ __volatile__( 74 - "1: lr.w %1, %0\n" 75 - " bnez %1, 1b\n" 76 - " li %1, -1\n" 77 - " sc.w %1, %1, %0\n" 78 - " bnez %1, 1b\n" 79 - RISCV_ACQUIRE_BARRIER 80 - : "+A" (lock->lock), "=&r" (tmp) 81 - :: "memory"); 82 - } 83 - 84 - static inline int arch_read_trylock(arch_rwlock_t *lock) 85 - { 86 - int busy; 87 - 88 - __asm__ __volatile__( 89 - "1: lr.w %1, %0\n" 90 - " bltz %1, 1f\n" 91 - " addi %1, %1, 1\n" 92 - " sc.w %1, %1, %0\n" 93 - " bnez %1, 1b\n" 94 - RISCV_ACQUIRE_BARRIER 95 - "1:\n" 96 - : "+A" (lock->lock), "=&r" (busy) 97 - :: "memory"); 98 - 99 - return !busy; 100 - } 101 - 102 - static inline int arch_write_trylock(arch_rwlock_t *lock) 103 - { 104 - int busy; 105 - 106 - __asm__ __volatile__( 107 - "1: lr.w %1, %0\n" 108 - " bnez %1, 1f\n" 109 - " li %1, -1\n" 110 - " sc.w %1, %1, %0\n" 111 - " bnez %1, 1b\n" 112 - RISCV_ACQUIRE_BARRIER 113 - "1:\n" 114 - : "+A" (lock->lock), "=&r" (busy) 115 - :: "memory"); 116 - 117 - return !busy; 118 - } 119 - 120 - static inline void arch_read_unlock(arch_rwlock_t *lock) 121 - { 122 - __asm__ __volatile__( 123 - RISCV_RELEASE_BARRIER 124 - " amoadd.w x0, %1, %0\n" 125 - : "+A" (lock->lock) 126 - : "r" (-1) 127 - : "memory"); 128 - } 129 - 130 - static inline void arch_write_unlock(arch_rwlock_t *lock) 131 - { 132 - smp_store_release(&lock->lock, 0); 133 - } 134 - 135 - #endif /* _ASM_RISCV_SPINLOCK_H */
-25
arch/riscv/include/asm/spinlock_types.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-only */ 2 - /* 3 - * Copyright (C) 2015 Regents of the University of California 4 - */ 5 - 6 - #ifndef _ASM_RISCV_SPINLOCK_TYPES_H 7 - #define _ASM_RISCV_SPINLOCK_TYPES_H 8 - 9 - #ifndef __LINUX_SPINLOCK_TYPES_RAW_H 10 - # error "please don't include this file directly" 11 - #endif 12 - 13 - typedef struct { 14 - volatile unsigned int lock; 15 - } arch_spinlock_t; 16 - 17 - #define __ARCH_SPIN_LOCK_UNLOCKED { 0 } 18 - 19 - typedef struct { 20 - volatile unsigned int lock; 21 - } arch_rwlock_t; 22 - 23 - #define __ARCH_RW_LOCK_UNLOCKED { 0 } 24 - 25 - #endif /* _ASM_RISCV_SPINLOCK_TYPES_H */
+6 -6
arch/sparc/include/uapi/asm/stat.h
··· 8 8 /* 64 bit sparc */ 9 9 struct stat { 10 10 unsigned int st_dev; 11 - ino_t st_ino; 12 - mode_t st_mode; 11 + __kernel_ino_t st_ino; 12 + __kernel_mode_t st_mode; 13 13 short st_nlink; 14 - uid_t st_uid; 15 - gid_t st_gid; 14 + __kernel_uid_t st_uid; 15 + __kernel_gid_t st_gid; 16 16 unsigned int st_rdev; 17 17 long st_size; 18 18 long st_atime; ··· 51 51 /* 32 bit sparc */ 52 52 struct stat { 53 53 unsigned short st_dev; 54 - ino_t st_ino; 55 - mode_t st_mode; 54 + __kernel_ino_t st_ino; 55 + __kernel_mode_t st_mode; 56 56 short st_nlink; 57 57 unsigned short st_uid; 58 58 unsigned short st_gid;
-1
drivers/clk/Makefile
··· 85 85 obj-y += bcm/ 86 86 obj-$(CONFIG_ARCH_BERLIN) += berlin/ 87 87 obj-$(CONFIG_ARCH_DAVINCI) += davinci/ 88 - obj-$(CONFIG_H8300) += h8300/ 89 88 obj-$(CONFIG_ARCH_HISI) += hisilicon/ 90 89 obj-y += imgtec/ 91 90 obj-y += imx/
-3
drivers/clk/h8300/Makefile
··· 1 - # SPDX-License-Identifier: GPL-2.0-only 2 - obj-y += clk-div.o 3 - obj-$(CONFIG_H8S2678) += clk-h8s2678.o
-57
drivers/clk/h8300/clk-div.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /* 3 - * H8/300 divide clock driver 4 - * 5 - * Copyright 2015 Yoshinori Sato <ysato@users.sourceforge.jp> 6 - */ 7 - 8 - #include <linux/clk-provider.h> 9 - #include <linux/err.h> 10 - #include <linux/io.h> 11 - #include <linux/of.h> 12 - #include <linux/of_address.h> 13 - 14 - static DEFINE_SPINLOCK(clklock); 15 - 16 - static void __init h8300_div_clk_setup(struct device_node *node) 17 - { 18 - unsigned int num_parents; 19 - struct clk_hw *hw; 20 - const char *clk_name = node->name; 21 - const char *parent_name; 22 - void __iomem *divcr = NULL; 23 - int width; 24 - int offset; 25 - 26 - num_parents = of_clk_get_parent_count(node); 27 - if (!num_parents) { 28 - pr_err("%s: no parent found\n", clk_name); 29 - return; 30 - } 31 - 32 - divcr = of_iomap(node, 0); 33 - if (divcr == NULL) { 34 - pr_err("%s: failed to map divide register\n", clk_name); 35 - goto error; 36 - } 37 - offset = (unsigned long)divcr & 3; 38 - offset = (3 - offset) * 8; 39 - divcr = (void __iomem *)((unsigned long)divcr & ~3); 40 - 41 - parent_name = of_clk_get_parent_name(node, 0); 42 - of_property_read_u32(node, "renesas,width", &width); 43 - hw = clk_hw_register_divider(NULL, clk_name, parent_name, 44 - CLK_SET_RATE_GATE, divcr, offset, width, 45 - CLK_DIVIDER_POWER_OF_TWO, &clklock); 46 - if (!IS_ERR(hw)) { 47 - of_clk_add_hw_provider(node, of_clk_hw_simple_get, hw); 48 - return; 49 - } 50 - pr_err("%s: failed to register %s div clock (%ld)\n", 51 - __func__, clk_name, PTR_ERR(hw)); 52 - error: 53 - if (divcr) 54 - iounmap(divcr); 55 - } 56 - 57 - CLK_OF_DECLARE(h8300_div_clk, "renesas,h8300-div-clock", h8300_div_clk_setup);
-145
drivers/clk/h8300/clk-h8s2678.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /* 3 - * H8S2678 clock driver 4 - * 5 - * Copyright 2015 Yoshinori Sato <ysato@users.sourceforge.jp> 6 - */ 7 - 8 - #include <linux/clk-provider.h> 9 - #include <linux/device.h> 10 - #include <linux/io.h> 11 - #include <linux/err.h> 12 - #include <linux/of_address.h> 13 - #include <linux/slab.h> 14 - 15 - static DEFINE_SPINLOCK(clklock); 16 - 17 - #define MAX_FREQ 33333333 18 - #define MIN_FREQ 8000000 19 - 20 - struct pll_clock { 21 - struct clk_hw hw; 22 - void __iomem *sckcr; 23 - void __iomem *pllcr; 24 - }; 25 - 26 - #define to_pll_clock(_hw) container_of(_hw, struct pll_clock, hw) 27 - 28 - static unsigned long pll_recalc_rate(struct clk_hw *hw, 29 - unsigned long parent_rate) 30 - { 31 - struct pll_clock *pll_clock = to_pll_clock(hw); 32 - int mul = 1 << (readb(pll_clock->pllcr) & 3); 33 - 34 - return parent_rate * mul; 35 - } 36 - 37 - static long pll_round_rate(struct clk_hw *hw, unsigned long rate, 38 - unsigned long *prate) 39 - { 40 - int i, m = -1; 41 - long offset[3]; 42 - 43 - if (rate > MAX_FREQ) 44 - rate = MAX_FREQ; 45 - if (rate < MIN_FREQ) 46 - rate = MIN_FREQ; 47 - 48 - for (i = 0; i < 3; i++) 49 - offset[i] = abs(rate - (*prate * (1 << i))); 50 - for (i = 0; i < 3; i++) 51 - if (m < 0) 52 - m = i; 53 - else 54 - m = (offset[i] < offset[m])?i:m; 55 - 56 - return *prate * (1 << m); 57 - } 58 - 59 - static int pll_set_rate(struct clk_hw *hw, unsigned long rate, 60 - unsigned long parent_rate) 61 - { 62 - int pll; 63 - unsigned char val; 64 - unsigned long flags; 65 - struct pll_clock *pll_clock = to_pll_clock(hw); 66 - 67 - pll = ((rate / parent_rate) / 2) & 0x03; 68 - spin_lock_irqsave(&clklock, flags); 69 - val = readb(pll_clock->sckcr); 70 - val |= 0x08; 71 - writeb(val, pll_clock->sckcr); 72 - val = readb(pll_clock->pllcr); 73 - val &= ~0x03; 74 - val |= pll; 75 - writeb(val, pll_clock->pllcr); 76 - spin_unlock_irqrestore(&clklock, flags); 77 - return 0; 78 - } 79 - 80 - static const struct clk_ops pll_ops = { 81 - .recalc_rate = pll_recalc_rate, 82 - .round_rate = pll_round_rate, 83 - .set_rate = pll_set_rate, 84 - }; 85 - 86 - static void __init h8s2678_pll_clk_setup(struct device_node *node) 87 - { 88 - unsigned int num_parents; 89 - const char *clk_name = node->name; 90 - const char *parent_name; 91 - struct pll_clock *pll_clock; 92 - struct clk_init_data init; 93 - int ret; 94 - 95 - num_parents = of_clk_get_parent_count(node); 96 - if (!num_parents) { 97 - pr_err("%s: no parent found\n", clk_name); 98 - return; 99 - } 100 - 101 - 102 - pll_clock = kzalloc(sizeof(*pll_clock), GFP_KERNEL); 103 - if (!pll_clock) 104 - return; 105 - 106 - pll_clock->sckcr = of_iomap(node, 0); 107 - if (pll_clock->sckcr == NULL) { 108 - pr_err("%s: failed to map divide register\n", clk_name); 109 - goto free_clock; 110 - } 111 - 112 - pll_clock->pllcr = of_iomap(node, 1); 113 - if (pll_clock->pllcr == NULL) { 114 - pr_err("%s: failed to map multiply register\n", clk_name); 115 - goto unmap_sckcr; 116 - } 117 - 118 - parent_name = of_clk_get_parent_name(node, 0); 119 - init.name = clk_name; 120 - init.ops = &pll_ops; 121 - init.flags = 0; 122 - init.parent_names = &parent_name; 123 - init.num_parents = 1; 124 - pll_clock->hw.init = &init; 125 - 126 - ret = clk_hw_register(NULL, &pll_clock->hw); 127 - if (ret) { 128 - pr_err("%s: failed to register %s div clock (%d)\n", 129 - __func__, clk_name, ret); 130 - goto unmap_pllcr; 131 - } 132 - 133 - of_clk_add_hw_provider(node, of_clk_hw_simple_get, &pll_clock->hw); 134 - return; 135 - 136 - unmap_pllcr: 137 - iounmap(pll_clock->pllcr); 138 - unmap_sckcr: 139 - iounmap(pll_clock->sckcr); 140 - free_clock: 141 - kfree(pll_clock); 142 - } 143 - 144 - CLK_OF_DECLARE(h8s2678_div_clk, "renesas,h8s2678-pll-clock", 145 - h8s2678_pll_clk_setup);
-20
drivers/clocksource/Kconfig
··· 567 567 This enables OST0 support available on PXA and SA-11x0 568 568 platforms. 569 569 570 - config H8300_TMR8 571 - bool "Clockevent timer for the H8300 platform" if COMPILE_TEST 572 - depends on HAS_IOMEM 573 - help 574 - This enables the 8 bits timer for the H8300 platform. 575 - 576 - config H8300_TMR16 577 - bool "Clockevent timer for the H83069 platform" if COMPILE_TEST 578 - depends on HAS_IOMEM 579 - help 580 - This enables the 16 bits timer for the H8300 platform with the 581 - H83069 CPU. 582 - 583 - config H8300_TPU 584 - bool "Clocksource for the H8300 platform" if COMPILE_TEST 585 - depends on HAS_IOMEM 586 - help 587 - This enables the clocksource for the H8300 platform with the 588 - H8S2678 CPU. 589 - 590 570 config CLKSRC_IMX_GPT 591 571 bool "Clocksource using i.MX GPT" if COMPILE_TEST 592 572 depends on (ARM || ARM64) && HAVE_CLK
-3
drivers/clocksource/Makefile
··· 73 73 obj-$(CONFIG_CLKSRC_IMX_TPM) += timer-imx-tpm.o 74 74 obj-$(CONFIG_TIMER_IMX_SYS_CTR) += timer-imx-sysctr.o 75 75 obj-$(CONFIG_ASM9260_TIMER) += asm9260_timer.o 76 - obj-$(CONFIG_H8300_TMR8) += h8300_timer8.o 77 - obj-$(CONFIG_H8300_TMR16) += h8300_timer16.o 78 - obj-$(CONFIG_H8300_TPU) += h8300_tpu.o 79 76 obj-$(CONFIG_INGENIC_OST) += ingenic-ost.o 80 77 obj-$(CONFIG_INGENIC_SYSOST) += ingenic-sysost.o 81 78 obj-$(CONFIG_INGENIC_TIMER) += ingenic-timer.o
-192
drivers/clocksource/h8300_timer16.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /* 3 - * H8/300 16bit Timer driver 4 - * 5 - * Copyright 2015 Yoshinori Sato <ysato@users.sourcefoge.jp> 6 - */ 7 - 8 - #include <linux/interrupt.h> 9 - #include <linux/init.h> 10 - #include <linux/clocksource.h> 11 - #include <linux/clk.h> 12 - #include <linux/io.h> 13 - #include <linux/of.h> 14 - #include <linux/of_address.h> 15 - #include <linux/of_irq.h> 16 - 17 - #define TSTR 0 18 - #define TISRC 6 19 - 20 - #define TCR 0 21 - #define TCNT 2 22 - 23 - #define bset(b, a) iowrite8(ioread8(a) | (1 << (b)), (a)) 24 - #define bclr(b, a) iowrite8(ioread8(a) & ~(1 << (b)), (a)) 25 - 26 - struct timer16_priv { 27 - struct clocksource cs; 28 - unsigned long total_cycles; 29 - void __iomem *mapbase; 30 - void __iomem *mapcommon; 31 - unsigned short cs_enabled; 32 - unsigned char enb; 33 - unsigned char ovf; 34 - unsigned char ovie; 35 - }; 36 - 37 - static unsigned long timer16_get_counter(struct timer16_priv *p) 38 - { 39 - unsigned short v1, v2, v3; 40 - unsigned char o1, o2; 41 - 42 - o1 = ioread8(p->mapcommon + TISRC) & p->ovf; 43 - 44 - /* Make sure the timer value is stable. Stolen from acpi_pm.c */ 45 - do { 46 - o2 = o1; 47 - v1 = ioread16be(p->mapbase + TCNT); 48 - v2 = ioread16be(p->mapbase + TCNT); 49 - v3 = ioread16be(p->mapbase + TCNT); 50 - o1 = ioread8(p->mapcommon + TISRC) & p->ovf; 51 - } while (unlikely((o1 != o2) || (v1 > v2 && v1 < v3) 52 - || (v2 > v3 && v2 < v1) || (v3 > v1 && v3 < v2))); 53 - 54 - if (likely(!o1)) 55 - return v2; 56 - else 57 - return v2 + 0x10000; 58 - } 59 - 60 - 61 - static irqreturn_t timer16_interrupt(int irq, void *dev_id) 62 - { 63 - struct timer16_priv *p = (struct timer16_priv *)dev_id; 64 - 65 - bclr(p->ovf, p->mapcommon + TISRC); 66 - p->total_cycles += 0x10000; 67 - 68 - return IRQ_HANDLED; 69 - } 70 - 71 - static inline struct timer16_priv *cs_to_priv(struct clocksource *cs) 72 - { 73 - return container_of(cs, struct timer16_priv, cs); 74 - } 75 - 76 - static u64 timer16_clocksource_read(struct clocksource *cs) 77 - { 78 - struct timer16_priv *p = cs_to_priv(cs); 79 - unsigned long raw, value; 80 - 81 - value = p->total_cycles; 82 - raw = timer16_get_counter(p); 83 - 84 - return value + raw; 85 - } 86 - 87 - static int timer16_enable(struct clocksource *cs) 88 - { 89 - struct timer16_priv *p = cs_to_priv(cs); 90 - 91 - WARN_ON(p->cs_enabled); 92 - 93 - p->total_cycles = 0; 94 - iowrite16be(0x0000, p->mapbase + TCNT); 95 - iowrite8(0x83, p->mapbase + TCR); 96 - bset(p->ovie, p->mapcommon + TISRC); 97 - bset(p->enb, p->mapcommon + TSTR); 98 - 99 - p->cs_enabled = true; 100 - return 0; 101 - } 102 - 103 - static void timer16_disable(struct clocksource *cs) 104 - { 105 - struct timer16_priv *p = cs_to_priv(cs); 106 - 107 - WARN_ON(!p->cs_enabled); 108 - 109 - bclr(p->ovie, p->mapcommon + TISRC); 110 - bclr(p->enb, p->mapcommon + TSTR); 111 - 112 - p->cs_enabled = false; 113 - } 114 - 115 - static struct timer16_priv timer16_priv = { 116 - .cs = { 117 - .name = "h8300_16timer", 118 - .rating = 200, 119 - .read = timer16_clocksource_read, 120 - .enable = timer16_enable, 121 - .disable = timer16_disable, 122 - .mask = CLOCKSOURCE_MASK(sizeof(unsigned long) * 8), 123 - .flags = CLOCK_SOURCE_IS_CONTINUOUS, 124 - }, 125 - }; 126 - 127 - #define REG_CH 0 128 - #define REG_COMM 1 129 - 130 - static int __init h8300_16timer_init(struct device_node *node) 131 - { 132 - void __iomem *base[2]; 133 - int ret, irq; 134 - unsigned int ch; 135 - struct clk *clk; 136 - 137 - clk = of_clk_get(node, 0); 138 - if (IS_ERR(clk)) { 139 - pr_err("failed to get clock for clocksource\n"); 140 - return PTR_ERR(clk); 141 - } 142 - 143 - ret = -ENXIO; 144 - base[REG_CH] = of_iomap(node, 0); 145 - if (!base[REG_CH]) { 146 - pr_err("failed to map registers for clocksource\n"); 147 - goto free_clk; 148 - } 149 - 150 - base[REG_COMM] = of_iomap(node, 1); 151 - if (!base[REG_COMM]) { 152 - pr_err("failed to map registers for clocksource\n"); 153 - goto unmap_ch; 154 - } 155 - 156 - ret = -EINVAL; 157 - irq = irq_of_parse_and_map(node, 0); 158 - if (!irq) { 159 - pr_err("failed to get irq for clockevent\n"); 160 - goto unmap_comm; 161 - } 162 - 163 - of_property_read_u32(node, "renesas,channel", &ch); 164 - 165 - timer16_priv.mapbase = base[REG_CH]; 166 - timer16_priv.mapcommon = base[REG_COMM]; 167 - timer16_priv.enb = ch; 168 - timer16_priv.ovf = ch; 169 - timer16_priv.ovie = 4 + ch; 170 - 171 - ret = request_irq(irq, timer16_interrupt, 172 - IRQF_TIMER, timer16_priv.cs.name, &timer16_priv); 173 - if (ret < 0) { 174 - pr_err("failed to request irq %d of clocksource\n", irq); 175 - goto unmap_comm; 176 - } 177 - 178 - clocksource_register_hz(&timer16_priv.cs, 179 - clk_get_rate(clk) / 8); 180 - return 0; 181 - 182 - unmap_comm: 183 - iounmap(base[REG_COMM]); 184 - unmap_ch: 185 - iounmap(base[REG_CH]); 186 - free_clk: 187 - clk_put(clk); 188 - return ret; 189 - } 190 - 191 - TIMER_OF_DECLARE(h8300_16bit, "renesas,16bit-timer", 192 - h8300_16timer_init);
-211
drivers/clocksource/h8300_timer8.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /* 3 - * linux/arch/h8300/kernel/cpu/timer/timer8.c 4 - * 5 - * Yoshinori Sato <ysato@users.sourcefoge.jp> 6 - * 7 - * 8bit Timer driver 8 - * 9 - */ 10 - 11 - #include <linux/errno.h> 12 - #include <linux/kernel.h> 13 - #include <linux/interrupt.h> 14 - #include <linux/init.h> 15 - #include <linux/clockchips.h> 16 - #include <linux/clk.h> 17 - #include <linux/io.h> 18 - #include <linux/of.h> 19 - #include <linux/of_address.h> 20 - #include <linux/of_irq.h> 21 - 22 - #define _8TCR 0 23 - #define _8TCSR 2 24 - #define TCORA 4 25 - #define TCORB 6 26 - #define _8TCNT 8 27 - 28 - #define CMIEA 6 29 - #define CMFA 6 30 - 31 - #define FLAG_STARTED (1 << 3) 32 - 33 - #define SCALE 64 34 - 35 - #define bset(b, a) iowrite8(ioread8(a) | (1 << (b)), (a)) 36 - #define bclr(b, a) iowrite8(ioread8(a) & ~(1 << (b)), (a)) 37 - 38 - struct timer8_priv { 39 - struct clock_event_device ced; 40 - void __iomem *mapbase; 41 - unsigned long flags; 42 - unsigned int rate; 43 - }; 44 - 45 - static irqreturn_t timer8_interrupt(int irq, void *dev_id) 46 - { 47 - struct timer8_priv *p = dev_id; 48 - 49 - if (clockevent_state_oneshot(&p->ced)) 50 - iowrite16be(0x0000, p->mapbase + _8TCR); 51 - 52 - p->ced.event_handler(&p->ced); 53 - 54 - bclr(CMFA, p->mapbase + _8TCSR); 55 - 56 - return IRQ_HANDLED; 57 - } 58 - 59 - static void timer8_set_next(struct timer8_priv *p, unsigned long delta) 60 - { 61 - if (delta >= 0x10000) 62 - pr_warn("delta out of range\n"); 63 - bclr(CMIEA, p->mapbase + _8TCR); 64 - iowrite16be(delta, p->mapbase + TCORA); 65 - iowrite16be(0x0000, p->mapbase + _8TCNT); 66 - bclr(CMFA, p->mapbase + _8TCSR); 67 - bset(CMIEA, p->mapbase + _8TCR); 68 - } 69 - 70 - static int timer8_enable(struct timer8_priv *p) 71 - { 72 - iowrite16be(0xffff, p->mapbase + TCORA); 73 - iowrite16be(0x0000, p->mapbase + _8TCNT); 74 - iowrite16be(0x0c02, p->mapbase + _8TCR); 75 - 76 - return 0; 77 - } 78 - 79 - static int timer8_start(struct timer8_priv *p) 80 - { 81 - int ret; 82 - 83 - if ((p->flags & FLAG_STARTED)) 84 - return 0; 85 - 86 - ret = timer8_enable(p); 87 - if (!ret) 88 - p->flags |= FLAG_STARTED; 89 - 90 - return ret; 91 - } 92 - 93 - static void timer8_stop(struct timer8_priv *p) 94 - { 95 - iowrite16be(0x0000, p->mapbase + _8TCR); 96 - } 97 - 98 - static inline struct timer8_priv *ced_to_priv(struct clock_event_device *ced) 99 - { 100 - return container_of(ced, struct timer8_priv, ced); 101 - } 102 - 103 - static void timer8_clock_event_start(struct timer8_priv *p, unsigned long delta) 104 - { 105 - timer8_start(p); 106 - timer8_set_next(p, delta); 107 - } 108 - 109 - static int timer8_clock_event_shutdown(struct clock_event_device *ced) 110 - { 111 - timer8_stop(ced_to_priv(ced)); 112 - return 0; 113 - } 114 - 115 - static int timer8_clock_event_periodic(struct clock_event_device *ced) 116 - { 117 - struct timer8_priv *p = ced_to_priv(ced); 118 - 119 - pr_info("%s: used for periodic clock events\n", ced->name); 120 - timer8_stop(p); 121 - timer8_clock_event_start(p, (p->rate + HZ/2) / HZ); 122 - 123 - return 0; 124 - } 125 - 126 - static int timer8_clock_event_oneshot(struct clock_event_device *ced) 127 - { 128 - struct timer8_priv *p = ced_to_priv(ced); 129 - 130 - pr_info("%s: used for oneshot clock events\n", ced->name); 131 - timer8_stop(p); 132 - timer8_clock_event_start(p, 0x10000); 133 - 134 - return 0; 135 - } 136 - 137 - static int timer8_clock_event_next(unsigned long delta, 138 - struct clock_event_device *ced) 139 - { 140 - struct timer8_priv *p = ced_to_priv(ced); 141 - 142 - BUG_ON(!clockevent_state_oneshot(ced)); 143 - timer8_set_next(p, delta - 1); 144 - 145 - return 0; 146 - } 147 - 148 - static struct timer8_priv timer8_priv = { 149 - .ced = { 150 - .name = "h8300_8timer", 151 - .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, 152 - .rating = 200, 153 - .set_next_event = timer8_clock_event_next, 154 - .set_state_shutdown = timer8_clock_event_shutdown, 155 - .set_state_periodic = timer8_clock_event_periodic, 156 - .set_state_oneshot = timer8_clock_event_oneshot, 157 - }, 158 - }; 159 - 160 - static int __init h8300_8timer_init(struct device_node *node) 161 - { 162 - void __iomem *base; 163 - int irq, ret; 164 - struct clk *clk; 165 - 166 - clk = of_clk_get(node, 0); 167 - if (IS_ERR(clk)) { 168 - pr_err("failed to get clock for clockevent\n"); 169 - return PTR_ERR(clk); 170 - } 171 - 172 - ret = -ENXIO; 173 - base = of_iomap(node, 0); 174 - if (!base) { 175 - pr_err("failed to map registers for clockevent\n"); 176 - goto free_clk; 177 - } 178 - 179 - ret = -EINVAL; 180 - irq = irq_of_parse_and_map(node, 0); 181 - if (!irq) { 182 - pr_err("failed to get irq for clockevent\n"); 183 - goto unmap_reg; 184 - } 185 - 186 - timer8_priv.mapbase = base; 187 - 188 - timer8_priv.rate = clk_get_rate(clk) / SCALE; 189 - if (!timer8_priv.rate) { 190 - pr_err("Failed to get rate for the clocksource\n"); 191 - goto unmap_reg; 192 - } 193 - 194 - if (request_irq(irq, timer8_interrupt, IRQF_TIMER, 195 - timer8_priv.ced.name, &timer8_priv) < 0) { 196 - pr_err("failed to request irq %d for clockevent\n", irq); 197 - goto unmap_reg; 198 - } 199 - 200 - clockevents_config_and_register(&timer8_priv.ced, 201 - timer8_priv.rate, 1, 0x0000ffff); 202 - 203 - return 0; 204 - unmap_reg: 205 - iounmap(base); 206 - free_clk: 207 - clk_put(clk); 208 - return ret; 209 - } 210 - 211 - TIMER_OF_DECLARE(h8300_8bit, "renesas,8bit-timer", h8300_8timer_init);
-158
drivers/clocksource/h8300_tpu.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /* 3 - * H8S TPU Driver 4 - * 5 - * Copyright 2015 Yoshinori Sato <ysato@users.sourcefoge.jp> 6 - * 7 - */ 8 - 9 - #include <linux/errno.h> 10 - #include <linux/kernel.h> 11 - #include <linux/init.h> 12 - #include <linux/clocksource.h> 13 - #include <linux/clk.h> 14 - #include <linux/io.h> 15 - #include <linux/of.h> 16 - #include <linux/of_address.h> 17 - #include <linux/of_irq.h> 18 - 19 - #define TCR 0x0 20 - #define TSR 0x5 21 - #define TCNT 0x6 22 - 23 - #define TCFV 0x10 24 - 25 - struct tpu_priv { 26 - struct clocksource cs; 27 - void __iomem *mapbase1; 28 - void __iomem *mapbase2; 29 - raw_spinlock_t lock; 30 - unsigned int cs_enabled; 31 - }; 32 - 33 - static inline unsigned long read_tcnt32(struct tpu_priv *p) 34 - { 35 - unsigned long tcnt; 36 - 37 - tcnt = ioread16be(p->mapbase1 + TCNT) << 16; 38 - tcnt |= ioread16be(p->mapbase2 + TCNT); 39 - return tcnt; 40 - } 41 - 42 - static int tpu_get_counter(struct tpu_priv *p, unsigned long long *val) 43 - { 44 - unsigned long v1, v2, v3; 45 - int o1, o2; 46 - 47 - o1 = ioread8(p->mapbase1 + TSR) & TCFV; 48 - 49 - /* Make sure the timer value is stable. Stolen from acpi_pm.c */ 50 - do { 51 - o2 = o1; 52 - v1 = read_tcnt32(p); 53 - v2 = read_tcnt32(p); 54 - v3 = read_tcnt32(p); 55 - o1 = ioread8(p->mapbase1 + TSR) & TCFV; 56 - } while (unlikely((o1 != o2) || (v1 > v2 && v1 < v3) 57 - || (v2 > v3 && v2 < v1) || (v3 > v1 && v3 < v2))); 58 - 59 - *val = v2; 60 - return o1; 61 - } 62 - 63 - static inline struct tpu_priv *cs_to_priv(struct clocksource *cs) 64 - { 65 - return container_of(cs, struct tpu_priv, cs); 66 - } 67 - 68 - static u64 tpu_clocksource_read(struct clocksource *cs) 69 - { 70 - struct tpu_priv *p = cs_to_priv(cs); 71 - unsigned long flags; 72 - unsigned long long value; 73 - 74 - raw_spin_lock_irqsave(&p->lock, flags); 75 - if (tpu_get_counter(p, &value)) 76 - value += 0x100000000; 77 - raw_spin_unlock_irqrestore(&p->lock, flags); 78 - 79 - return value; 80 - } 81 - 82 - static int tpu_clocksource_enable(struct clocksource *cs) 83 - { 84 - struct tpu_priv *p = cs_to_priv(cs); 85 - 86 - WARN_ON(p->cs_enabled); 87 - 88 - iowrite16be(0, p->mapbase1 + TCNT); 89 - iowrite16be(0, p->mapbase2 + TCNT); 90 - iowrite8(0x0f, p->mapbase1 + TCR); 91 - iowrite8(0x03, p->mapbase2 + TCR); 92 - 93 - p->cs_enabled = true; 94 - return 0; 95 - } 96 - 97 - static void tpu_clocksource_disable(struct clocksource *cs) 98 - { 99 - struct tpu_priv *p = cs_to_priv(cs); 100 - 101 - WARN_ON(!p->cs_enabled); 102 - 103 - iowrite8(0, p->mapbase1 + TCR); 104 - iowrite8(0, p->mapbase2 + TCR); 105 - p->cs_enabled = false; 106 - } 107 - 108 - static struct tpu_priv tpu_priv = { 109 - .cs = { 110 - .name = "H8S_TPU", 111 - .rating = 200, 112 - .read = tpu_clocksource_read, 113 - .enable = tpu_clocksource_enable, 114 - .disable = tpu_clocksource_disable, 115 - .mask = CLOCKSOURCE_MASK(sizeof(unsigned long) * 8), 116 - .flags = CLOCK_SOURCE_IS_CONTINUOUS, 117 - }, 118 - }; 119 - 120 - #define CH_L 0 121 - #define CH_H 1 122 - 123 - static int __init h8300_tpu_init(struct device_node *node) 124 - { 125 - void __iomem *base[2]; 126 - struct clk *clk; 127 - int ret = -ENXIO; 128 - 129 - clk = of_clk_get(node, 0); 130 - if (IS_ERR(clk)) { 131 - pr_err("failed to get clock for clocksource\n"); 132 - return PTR_ERR(clk); 133 - } 134 - 135 - base[CH_L] = of_iomap(node, CH_L); 136 - if (!base[CH_L]) { 137 - pr_err("failed to map registers for clocksource\n"); 138 - goto free_clk; 139 - } 140 - base[CH_H] = of_iomap(node, CH_H); 141 - if (!base[CH_H]) { 142 - pr_err("failed to map registers for clocksource\n"); 143 - goto unmap_L; 144 - } 145 - 146 - tpu_priv.mapbase1 = base[CH_L]; 147 - tpu_priv.mapbase2 = base[CH_H]; 148 - 149 - return clocksource_register_hz(&tpu_priv.cs, clk_get_rate(clk) / 64); 150 - 151 - unmap_L: 152 - iounmap(base[CH_H]); 153 - free_clk: 154 - clk_put(clk); 155 - return ret; 156 - } 157 - 158 - TIMER_OF_DECLARE(h8300_tpu, "renesas,tpu", h8300_tpu_init);
-11
drivers/irqchip/Kconfig
··· 342 342 343 343 If unsure, say N. 344 344 345 - config RENESAS_H8300H_INTC 346 - bool 347 - select IRQ_DOMAIN 348 - 349 - config RENESAS_H8S_INTC 350 - bool "Renesas H8S Interrupt Controller Support" if COMPILE_TEST 351 - select IRQ_DOMAIN 352 - help 353 - Enable support for the Renesas H8/300 Interrupt Controller, as found 354 - on Renesas H8S SoCs. 355 - 356 345 config IMX_GPCV2 357 346 bool 358 347 select IRQ_DOMAIN
-2
drivers/irqchip/Makefile
··· 70 70 obj-$(CONFIG_MIPS_GIC) += irq-mips-gic.o 71 71 obj-$(CONFIG_ARCH_MEDIATEK) += irq-mtk-sysirq.o irq-mtk-cirq.o 72 72 obj-$(CONFIG_ARCH_DIGICOLOR) += irq-digicolor.o 73 - obj-$(CONFIG_RENESAS_H8300H_INTC) += irq-renesas-h8300h.o 74 - obj-$(CONFIG_RENESAS_H8S_INTC) += irq-renesas-h8s.o 75 73 obj-$(CONFIG_ARCH_SA1100) += irq-sa11x0.o 76 74 obj-$(CONFIG_INGENIC_IRQ) += irq-ingenic.o 77 75 obj-$(CONFIG_INGENIC_TCU_IRQ) += irq-ingenic-tcu.o
-94
drivers/irqchip/irq-renesas-h8300h.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /* 3 - * H8/300H interrupt controller driver 4 - * 5 - * Copyright 2015 Yoshinori Sato <ysato@users.sourceforge.jp> 6 - */ 7 - 8 - #include <linux/init.h> 9 - #include <linux/irq.h> 10 - #include <linux/irqchip.h> 11 - #include <linux/of_address.h> 12 - #include <linux/of_irq.h> 13 - #include <asm/io.h> 14 - 15 - static const char ipr_bit[] = { 16 - 7, 6, 5, 5, 17 - 4, 4, 4, 4, 3, 3, 3, 3, 18 - 2, 2, 2, 2, 1, 1, 1, 1, 19 - 0, 0, 0, 0, 15, 15, 15, 15, 20 - 14, 14, 14, 14, 13, 13, 13, 13, 21 - -1, -1, -1, -1, 11, 11, 11, 11, 22 - 10, 10, 10, 10, 9, 9, 9, 9, 23 - }; 24 - 25 - static void __iomem *intc_baseaddr; 26 - 27 - #define IPR (intc_baseaddr + 6) 28 - 29 - static void h8300h_disable_irq(struct irq_data *data) 30 - { 31 - int bit; 32 - int irq = data->irq - 12; 33 - 34 - bit = ipr_bit[irq]; 35 - if (bit >= 0) { 36 - if (bit < 8) 37 - ctrl_bclr(bit & 7, IPR); 38 - else 39 - ctrl_bclr(bit & 7, (IPR+1)); 40 - } 41 - } 42 - 43 - static void h8300h_enable_irq(struct irq_data *data) 44 - { 45 - int bit; 46 - int irq = data->irq - 12; 47 - 48 - bit = ipr_bit[irq]; 49 - if (bit >= 0) { 50 - if (bit < 8) 51 - ctrl_bset(bit & 7, IPR); 52 - else 53 - ctrl_bset(bit & 7, (IPR+1)); 54 - } 55 - } 56 - 57 - struct irq_chip h8300h_irq_chip = { 58 - .name = "H8/300H-INTC", 59 - .irq_enable = h8300h_enable_irq, 60 - .irq_disable = h8300h_disable_irq, 61 - }; 62 - 63 - static int irq_map(struct irq_domain *h, unsigned int virq, 64 - irq_hw_number_t hw_irq_num) 65 - { 66 - irq_set_chip_and_handler(virq, &h8300h_irq_chip, handle_simple_irq); 67 - 68 - return 0; 69 - } 70 - 71 - static const struct irq_domain_ops irq_ops = { 72 - .map = irq_map, 73 - .xlate = irq_domain_xlate_onecell, 74 - }; 75 - 76 - static int __init h8300h_intc_of_init(struct device_node *intc, 77 - struct device_node *parent) 78 - { 79 - struct irq_domain *domain; 80 - 81 - intc_baseaddr = of_iomap(intc, 0); 82 - BUG_ON(!intc_baseaddr); 83 - 84 - /* All interrupt priority low */ 85 - writeb(0x00, IPR + 0); 86 - writeb(0x00, IPR + 1); 87 - 88 - domain = irq_domain_add_linear(intc, NR_IRQS, &irq_ops, NULL); 89 - BUG_ON(!domain); 90 - irq_set_default_host(domain); 91 - return 0; 92 - } 93 - 94 - IRQCHIP_DECLARE(h8300h_intc, "renesas,h8300h-intc", h8300h_intc_of_init);
-102
drivers/irqchip/irq-renesas-h8s.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /* 3 - * H8S interrupt controller driver 4 - * 5 - * Copyright 2015 Yoshinori Sato <ysato@users.sourceforge.jp> 6 - */ 7 - 8 - #include <linux/irq.h> 9 - #include <linux/irqchip.h> 10 - #include <linux/of_address.h> 11 - #include <linux/of_irq.h> 12 - #include <asm/io.h> 13 - 14 - static void *intc_baseaddr; 15 - #define IPRA (intc_baseaddr) 16 - 17 - static const unsigned char ipr_table[] = { 18 - 0x03, 0x02, 0x01, 0x00, 0x13, 0x12, 0x11, 0x10, /* 16 - 23 */ 19 - 0x23, 0x22, 0x21, 0x20, 0x33, 0x32, 0x31, 0x30, /* 24 - 31 */ 20 - 0x43, 0x42, 0x41, 0x40, 0x53, 0x53, 0x52, 0x52, /* 32 - 39 */ 21 - 0x51, 0x51, 0x51, 0x51, 0x51, 0x51, 0x51, 0x51, /* 40 - 47 */ 22 - 0x50, 0x50, 0x50, 0x50, 0x63, 0x63, 0x63, 0x63, /* 48 - 55 */ 23 - 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, /* 56 - 63 */ 24 - 0x61, 0x61, 0x61, 0x61, 0x60, 0x60, 0x60, 0x60, /* 64 - 71 */ 25 - 0x73, 0x73, 0x73, 0x73, 0x72, 0x72, 0x72, 0x72, /* 72 - 79 */ 26 - 0x71, 0x71, 0x71, 0x71, 0x70, 0x83, 0x82, 0x81, /* 80 - 87 */ 27 - 0x80, 0x80, 0x80, 0x80, 0x93, 0x93, 0x93, 0x93, /* 88 - 95 */ 28 - 0x92, 0x92, 0x92, 0x92, 0x91, 0x91, 0x91, 0x91, /* 96 - 103 */ 29 - 0x90, 0x90, 0x90, 0x90, 0xa3, 0xa3, 0xa3, 0xa3, /* 104 - 111 */ 30 - 0xa2, 0xa2, 0xa2, 0xa2, 0xa1, 0xa1, 0xa1, 0xa1, /* 112 - 119 */ 31 - 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, /* 120 - 127 */ 32 - }; 33 - 34 - static void h8s_disable_irq(struct irq_data *data) 35 - { 36 - int pos; 37 - void __iomem *addr; 38 - unsigned short pri; 39 - int irq = data->irq; 40 - 41 - addr = IPRA + ((ipr_table[irq - 16] & 0xf0) >> 3); 42 - pos = (ipr_table[irq - 16] & 0x0f) * 4; 43 - pri = ~(0x000f << pos); 44 - pri &= readw(addr); 45 - writew(pri, addr); 46 - } 47 - 48 - static void h8s_enable_irq(struct irq_data *data) 49 - { 50 - int pos; 51 - void __iomem *addr; 52 - unsigned short pri; 53 - int irq = data->irq; 54 - 55 - addr = IPRA + ((ipr_table[irq - 16] & 0xf0) >> 3); 56 - pos = (ipr_table[irq - 16] & 0x0f) * 4; 57 - pri = ~(0x000f << pos); 58 - pri &= readw(addr); 59 - pri |= 1 << pos; 60 - writew(pri, addr); 61 - } 62 - 63 - struct irq_chip h8s_irq_chip = { 64 - .name = "H8S-INTC", 65 - .irq_enable = h8s_enable_irq, 66 - .irq_disable = h8s_disable_irq, 67 - }; 68 - 69 - static __init int irq_map(struct irq_domain *h, unsigned int virq, 70 - irq_hw_number_t hw_irq_num) 71 - { 72 - irq_set_chip_and_handler(virq, &h8s_irq_chip, handle_simple_irq); 73 - 74 - return 0; 75 - } 76 - 77 - static const struct irq_domain_ops irq_ops = { 78 - .map = irq_map, 79 - .xlate = irq_domain_xlate_onecell, 80 - }; 81 - 82 - static int __init h8s_intc_of_init(struct device_node *intc, 83 - struct device_node *parent) 84 - { 85 - struct irq_domain *domain; 86 - int n; 87 - 88 - intc_baseaddr = of_iomap(intc, 0); 89 - BUG_ON(!intc_baseaddr); 90 - 91 - /* All interrupt priority is 0 (disable) */ 92 - /* IPRA to IPRK */ 93 - for (n = 0; n <= 'k' - 'a'; n++) 94 - writew(0x0000, IPRA + (n * 2)); 95 - 96 - domain = irq_domain_add_linear(intc, NR_IRQS, &irq_ops, NULL); 97 - BUG_ON(!domain); 98 - irq_set_default_host(domain); 99 - return 0; 100 - } 101 - 102 - IRQCHIP_DECLARE(h8s_intc, "renesas,h8s-intc", h8s_intc_of_init);
+2 -2
drivers/net/ethernet/smsc/Kconfig
··· 8 8 default y 9 9 depends on ARM || ARM64 || ATARI_ETHERNAT || COLDFIRE || \ 10 10 ISA || MAC || MIPS || NIOS2 || PCI || \ 11 - PCMCIA || SUPERH || XTENSA || H8300 || COMPILE_TEST 11 + PCMCIA || SUPERH || XTENSA || COMPILE_TEST 12 12 help 13 13 If you have a network (Ethernet) card belonging to this class, say Y. 14 14 ··· 40 40 select MII 41 41 depends on !OF || GPIOLIB 42 42 depends on ARM || ARM64 || ATARI_ETHERNAT || COLDFIRE || \ 43 - MIPS || NIOS2 || SUPERH || XTENSA || H8300 || COMPILE_TEST 43 + MIPS || NIOS2 || SUPERH || XTENSA || COMPILE_TEST 44 44 help 45 45 This is a driver for SMC's 91x series of Ethernet chipsets, 46 46 including the SMC91C94 and the SMC91C111. Say Y if you want it
-11
drivers/net/ethernet/smsc/smc91x.h
··· 182 182 183 183 #define SMC_IRQ_FLAGS 0 184 184 185 - #elif defined(CONFIG_H8300) 186 - #define SMC_CAN_USE_8BIT 1 187 - #define SMC_CAN_USE_16BIT 0 188 - #define SMC_CAN_USE_32BIT 0 189 - #define SMC_NOWAIT 0 190 - 191 - #define SMC_inb(a, r) ioread8((a) + (r)) 192 - #define SMC_outb(v, a, r) iowrite8(v, (a) + (r)) 193 - #define SMC_insb(a, r, p, l) ioread8_rep((a) + (r), p, l) 194 - #define SMC_outsb(a, r, p, l) iowrite8_rep((a) + (r), p, l) 195 - 196 185 #else 197 186 198 187 /*
+2 -3
drivers/tty/serial/Kconfig
··· 654 654 655 655 config SERIAL_SH_SCI 656 656 tristate "SuperH SCI(F) serial port support" 657 - depends on SUPERH || ARCH_RENESAS || H8300 || COMPILE_TEST 657 + depends on SUPERH || ARCH_RENESAS || COMPILE_TEST 658 658 select SERIAL_CORE 659 659 select SERIAL_MCTRL_GPIO if GPIOLIB 660 660 ··· 663 663 range 1 64 if 64BIT 664 664 range 1 32 if !64BIT 665 665 depends on SERIAL_SH_SCI 666 - default "3" if H8300 667 666 default "10" if SUPERH 668 667 default "18" if ARCH_RENESAS 669 668 default "2" ··· 678 679 depends on SERIAL_SH_SCI=y 679 680 select SERIAL_CORE_CONSOLE 680 681 select SERIAL_EARLYCON 681 - default ARCH_RENESAS || H8300 682 + default ARCH_RENESAS 682 683 683 684 config SERIAL_SH_SCI_DMA 684 685 bool "DMA support" if EXPERT
+4
include/asm-generic/qrwlock.h
··· 2 2 /* 3 3 * Queue read/write lock 4 4 * 5 + * These use generic atomic and locking routines, but depend on a fair spinlock 6 + * implementation in order to be fair themselves. The implementation in 7 + * asm-generic/spinlock.h meets these requirements. 8 + * 5 9 * (C) Copyright 2013-2014 Hewlett-Packard Development Company, L.P. 6 10 * 7 11 * Authors: Waiman Long <waiman.long@hp.com>
+29
include/asm-generic/qspinlock.h
··· 2 2 /* 3 3 * Queued spinlock 4 4 * 5 + * A 'generic' spinlock implementation that is based on MCS locks. For an 6 + * architecture that's looking for a 'generic' spinlock, please first consider 7 + * ticket-lock.h and only come looking here when you've considered all the 8 + * constraints below and can show your hardware does actually perform better 9 + * with qspinlock. 10 + * 11 + * qspinlock relies on atomic_*_release()/atomic_*_acquire() to be RCsc (or no 12 + * weaker than RCtso if you're power), where regular code only expects atomic_t 13 + * to be RCpc. 14 + * 15 + * qspinlock relies on a far greater (compared to asm-generic/spinlock.h) set 16 + * of atomic operations to behave well together, please audit them carefully to 17 + * ensure they all have forward progress. Many atomic operations may default to 18 + * cmpxchg() loops which will not have good forward progress properties on 19 + * LL/SC architectures. 20 + * 21 + * One notable example is atomic_fetch_or_acquire(), which x86 cannot (cheaply) 22 + * do. Carefully read the patches that introduced 23 + * queued_fetch_set_pending_acquire(). 24 + * 25 + * qspinlock also heavily relies on mixed size atomic operations, in specific 26 + * it requires architectures to have xchg16; something which many LL/SC 27 + * architectures need to implement as a 32bit and+or in order to satisfy the 28 + * forward progress guarantees mentioned above. 29 + * 30 + * Further reading on mixed size atomics that might be relevant: 31 + * 32 + * http://www.cl.cam.ac.uk/~pes20/popl17/mixed-size.pdf 33 + * 5 34 * (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P. 6 35 * (C) Copyright 2015 Hewlett-Packard Enterprise Development LP 7 36 *
+87 -7
include/asm-generic/spinlock.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 + 3 + /* 4 + * 'Generic' ticket-lock implementation. 5 + * 6 + * It relies on atomic_fetch_add() having well defined forward progress 7 + * guarantees under contention. If your architecture cannot provide this, stick 8 + * to a test-and-set lock. 9 + * 10 + * It also relies on atomic_fetch_add() being safe vs smp_store_release() on a 11 + * sub-word of the value. This is generally true for anything LL/SC although 12 + * you'd be hard pressed to find anything useful in architecture specifications 13 + * about this. If your architecture cannot do this you might be better off with 14 + * a test-and-set. 15 + * 16 + * It further assumes atomic_*_release() + atomic_*_acquire() is RCpc and hence 17 + * uses atomic_fetch_add() which is RCsc to create an RCsc hot path, along with 18 + * a full fence after the spin to upgrade the otherwise-RCpc 19 + * atomic_cond_read_acquire(). 20 + * 21 + * The implementation uses smp_cond_load_acquire() to spin, so if the 22 + * architecture has WFE like instructions to sleep instead of poll for word 23 + * modifications be sure to implement that (see ARM64 for example). 24 + * 25 + */ 26 + 2 27 #ifndef __ASM_GENERIC_SPINLOCK_H 3 28 #define __ASM_GENERIC_SPINLOCK_H 4 - /* 5 - * You need to implement asm/spinlock.h for SMP support. The generic 6 - * version does not handle SMP. 7 - */ 8 - #ifdef CONFIG_SMP 9 - #error need an architecture specific asm/spinlock.h 10 - #endif 29 + 30 + #include <linux/atomic.h> 31 + #include <asm-generic/spinlock_types.h> 32 + 33 + static __always_inline void arch_spin_lock(arch_spinlock_t *lock) 34 + { 35 + u32 val = atomic_fetch_add(1<<16, lock); 36 + u16 ticket = val >> 16; 37 + 38 + if (ticket == (u16)val) 39 + return; 40 + 41 + /* 42 + * atomic_cond_read_acquire() is RCpc, but rather than defining a 43 + * custom cond_read_rcsc() here we just emit a full fence. We only 44 + * need the prior reads before subsequent writes ordering from 45 + * smb_mb(), but as atomic_cond_read_acquire() just emits reads and we 46 + * have no outstanding writes due to the atomic_fetch_add() the extra 47 + * orderings are free. 48 + */ 49 + atomic_cond_read_acquire(lock, ticket == (u16)VAL); 50 + smp_mb(); 51 + } 52 + 53 + static __always_inline bool arch_spin_trylock(arch_spinlock_t *lock) 54 + { 55 + u32 old = atomic_read(lock); 56 + 57 + if ((old >> 16) != (old & 0xffff)) 58 + return false; 59 + 60 + return atomic_try_cmpxchg(lock, &old, old + (1<<16)); /* SC, for RCsc */ 61 + } 62 + 63 + static __always_inline void arch_spin_unlock(arch_spinlock_t *lock) 64 + { 65 + u16 *ptr = (u16 *)lock + IS_ENABLED(CONFIG_CPU_BIG_ENDIAN); 66 + u32 val = atomic_read(lock); 67 + 68 + smp_store_release(ptr, (u16)val + 1); 69 + } 70 + 71 + static __always_inline int arch_spin_is_locked(arch_spinlock_t *lock) 72 + { 73 + u32 val = atomic_read(lock); 74 + 75 + return ((val >> 16) != (val & 0xffff)); 76 + } 77 + 78 + static __always_inline int arch_spin_is_contended(arch_spinlock_t *lock) 79 + { 80 + u32 val = atomic_read(lock); 81 + 82 + return (s16)((val >> 16) - (val & 0xffff)) > 1; 83 + } 84 + 85 + static __always_inline int arch_spin_value_unlocked(arch_spinlock_t lock) 86 + { 87 + return !arch_spin_is_locked(&lock); 88 + } 89 + 90 + #include <asm/qrwlock.h> 11 91 12 92 #endif /* __ASM_GENERIC_SPINLOCK_H */
+17
include/asm-generic/spinlock_types.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + 3 + #ifndef __ASM_GENERIC_SPINLOCK_TYPES_H 4 + #define __ASM_GENERIC_SPINLOCK_TYPES_H 5 + 6 + #include <linux/types.h> 7 + typedef atomic_t arch_spinlock_t; 8 + 9 + /* 10 + * qrwlock_types depends on arch_spinlock_t, so we must typedef that before the 11 + * include. 12 + */ 13 + #include <asm/qrwlock_types.h> 14 + 15 + #define __ARCH_SPIN_LOCK_UNLOCKED ATOMIC_INIT(0) 16 + 17 + #endif /* __ASM_GENERIC_SPINLOCK_TYPES_H */
+4 -5
include/uapi/linux/agpgart.h
··· 52 52 53 53 #ifndef __KERNEL__ 54 54 #include <linux/types.h> 55 - #include <stdlib.h> 56 55 57 56 struct agp_version { 58 57 __u16 major; ··· 63 64 __u32 bridge_id; /* bridge vendor/device */ 64 65 __u32 agp_mode; /* mode info of bridge */ 65 66 unsigned long aper_base;/* base of aperture */ 66 - size_t aper_size; /* size of aperture */ 67 - size_t pg_total; /* max pages (swap + system) */ 68 - size_t pg_system; /* max pages (system) */ 69 - size_t pg_used; /* current pages used */ 67 + __kernel_size_t aper_size; /* size of aperture */ 68 + __kernel_size_t pg_total; /* max pages (swap + system) */ 69 + __kernel_size_t pg_system; /* max pages (system) */ 70 + __kernel_size_t pg_used; /* current pages used */ 70 71 } agp_info; 71 72 72 73 typedef struct _agp_setup {
+1 -2
init/Kconfig
··· 715 715 716 716 config LOG_BUF_SHIFT 717 717 int "Kernel log buffer size (16 => 64KB, 17 => 128KB)" 718 - range 12 25 if !H8300 719 - range 12 19 if H8300 718 + range 12 25 720 719 default 17 721 720 depends on PRINTK 722 721 help
-15
tools/arch/h8300/include/asm/bitsperlong.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef __ASM_H8300_BITS_PER_LONG 3 - #define __ASM_H8300_BITS_PER_LONG 4 - 5 - #include <asm-generic/bitsperlong.h> 6 - 7 - #if !defined(__ASSEMBLY__) 8 - /* h8300-unknown-linux required long */ 9 - #define __kernel_size_t __kernel_size_t 10 - typedef unsigned long __kernel_size_t; 11 - typedef long __kernel_ssize_t; 12 - typedef long __kernel_ptrdiff_t; 13 - #endif 14 - 15 - #endif /* __ASM_H8300_BITS_PER_LONG */
-7
tools/arch/h8300/include/uapi/asm/mman.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 - #ifndef TOOLS_ARCH_H8300_UAPI_ASM_MMAN_FIX_H 3 - #define TOOLS_ARCH_H8300_UAPI_ASM_MMAN_FIX_H 4 - #include <uapi/asm-generic/mman.h> 5 - /* MAP_32BIT is undefined on h8300, fix it for perf */ 6 - #define MAP_32BIT 0 7 - #endif
+7
usr/dummy-include/stdbool.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0-only */ 2 + #ifndef _STDBOOL_H 3 + #define _STDBOOL_H 4 + 5 + #error "Please do not include <stdbool.h> from exported headers" 6 + 7 + #endif /* _STDBOOL_H */
+7
usr/dummy-include/stdlib.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0-only */ 2 + #ifndef _STDLIB_H 3 + #define _STDLIB_H 4 + 5 + #error "Please do not include <stdlib.h> from exported headers" 6 + 7 + #endif /* _STDLIB_H */
+1 -11
usr/include/Makefile
··· 15 15 # USERCFLAGS might contain sysroot location for CC. 16 16 UAPI_CFLAGS += $(USERCFLAGS) 17 17 18 - override c_flags = $(UAPI_CFLAGS) -Wp,-MMD,$(depfile) -I$(objtree)/usr/include 18 + override c_flags = $(UAPI_CFLAGS) -Wp,-MMD,$(depfile) -I $(obj) -I $(srctree)/usr/dummy-include 19 19 20 20 # The following are excluded for now because they fail to build. 21 21 # ··· 65 65 no-header-test += linux/if_bonding.h 66 66 endif 67 67 68 - ifeq ($(SRCARCH),mips) 69 - no-header-test += asm/stat.h 70 - endif 71 - 72 68 ifeq ($(SRCARCH),powerpc) 73 - no-header-test += asm/stat.h 74 - no-header-test += linux/bpf_perf_event.h 75 - endif 76 - 77 - ifeq ($(SRCARCH),riscv) 78 69 no-header-test += linux/bpf_perf_event.h 79 70 endif 80 71 81 72 ifeq ($(SRCARCH),sparc) 82 - no-header-test += asm/stat.h 83 73 no-header-test += asm/uctx.h 84 74 no-header-test += asm/fbio.h 85 75 endif