mirror of
https://github.com/ukui/kernel.git
synced 2026-03-09 10:07:04 -07:00
arch/tile: core support for Tilera 32-bit chips.
This change is the core kernel support for TILEPro and TILE64 chips. No driver support (except the console driver) is included yet. This includes the relevant Linux headers in asm/; the low-level low-level "Tile architecture" headers in arch/, which are shared with the hypervisor, etc., and are build-system agnostic; and the relevant hypervisor headers in hv/. Signed-off-by: Chris Metcalf <cmetcalf@tilera.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Acked-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Reviewed-by: Paul Mundt <lethal@linux-sh.org>
This commit is contained in:
@@ -5572,6 +5572,12 @@ F: include/linux/tipc*.h
|
||||
F: include/net/tipc/
|
||||
F: net/tipc/
|
||||
|
||||
TILE ARCHITECTURE
|
||||
M: Chris Metcalf <cmetcalf@tilera.com>
|
||||
W: http://www.tilera.com/scm/
|
||||
S: Supported
|
||||
F: arch/tile/
|
||||
|
||||
TLAN NETWORK DRIVER
|
||||
M: Samuel Chessman <chessman@tux.org>
|
||||
L: tlan-devel@lists.sourceforge.net (subscribers-only)
|
||||
|
||||
3
arch/tile/Kbuild
Normal file
3
arch/tile/Kbuild
Normal file
@@ -0,0 +1,3 @@
|
||||
|
||||
obj-y += kernel/
|
||||
obj-y += mm/
|
||||
352
arch/tile/Kconfig
Normal file
352
arch/tile/Kconfig
Normal file
@@ -0,0 +1,352 @@
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see Documentation/kbuild/config-language.txt.
|
||||
|
||||
config MMU
|
||||
def_bool y
|
||||
|
||||
config GENERIC_CSUM
|
||||
def_bool y
|
||||
|
||||
config GENERIC_HARDIRQS
|
||||
def_bool y
|
||||
|
||||
config GENERIC_HARDIRQS_NO__DO_IRQ
|
||||
def_bool y
|
||||
|
||||
config GENERIC_IRQ_PROBE
|
||||
def_bool y
|
||||
|
||||
config GENERIC_PENDING_IRQ
|
||||
def_bool y
|
||||
depends on GENERIC_HARDIRQS && SMP
|
||||
|
||||
config SEMAPHORE_SLEEPERS
|
||||
def_bool y
|
||||
|
||||
config HAVE_ARCH_ALLOC_REMAP
|
||||
def_bool y
|
||||
|
||||
config HAVE_SETUP_PER_CPU_AREA
|
||||
def_bool y
|
||||
|
||||
config NEED_PER_CPU_PAGE_FIRST_CHUNK
|
||||
def_bool y
|
||||
|
||||
config SYS_SUPPORTS_HUGETLBFS
|
||||
def_bool y
|
||||
|
||||
config GENERIC_TIME
|
||||
def_bool y
|
||||
|
||||
config GENERIC_CLOCKEVENTS
|
||||
def_bool y
|
||||
|
||||
# FIXME: tilegx can implement a more efficent rwsem.
|
||||
config RWSEM_GENERIC_SPINLOCK
|
||||
def_bool y
|
||||
|
||||
# We have a very flat architecture from a migration point of view,
|
||||
# so save boot time by presetting this (particularly useful on tile-sim).
|
||||
config DEFAULT_MIGRATION_COST
|
||||
int
|
||||
default "10000000"
|
||||
|
||||
# We only support gcc 4.4 and above, so this should work.
|
||||
config ARCH_SUPPORTS_OPTIMIZED_INLINING
|
||||
def_bool y
|
||||
|
||||
config ARCH_PHYS_ADDR_T_64BIT
|
||||
def_bool y
|
||||
|
||||
config LOCKDEP_SUPPORT
|
||||
def_bool y
|
||||
|
||||
config STACKTRACE_SUPPORT
|
||||
def_bool y
|
||||
select STACKTRACE
|
||||
|
||||
# We use discontigmem for now; at some point we may want to switch
|
||||
# to sparsemem (Tilera bug 7996).
|
||||
config ARCH_DISCONTIGMEM_ENABLE
|
||||
def_bool y
|
||||
|
||||
config ARCH_DISCONTIGMEM_DEFAULT
|
||||
def_bool y
|
||||
|
||||
config TRACE_IRQFLAGS_SUPPORT
|
||||
def_bool y
|
||||
|
||||
config STRICT_DEVMEM
|
||||
def_bool y
|
||||
|
||||
# SMP is required for Tilera Linux.
|
||||
config SMP
|
||||
def_bool y
|
||||
|
||||
# Allow checking for compile-time determined overflow errors in
|
||||
# copy_from_user(). There are still unprovable places in the
|
||||
# generic code as of 2.6.34, so this option is not really compatible
|
||||
# with -Werror, which is more useful in general.
|
||||
config DEBUG_COPY_FROM_USER
|
||||
def_bool n
|
||||
|
||||
config HVC_TILE
|
||||
select HVC_DRIVER
|
||||
def_bool y
|
||||
|
||||
config TILE
|
||||
def_bool y
|
||||
select GENERIC_FIND_FIRST_BIT
|
||||
select GENERIC_FIND_NEXT_BIT
|
||||
select USE_GENERIC_SMP_HELPERS
|
||||
select CC_OPTIMIZE_FOR_SIZE
|
||||
|
||||
# FIXME: investigate whether we need/want these options.
|
||||
# select HAVE_IOREMAP_PROT
|
||||
# select HAVE_OPTPROBES
|
||||
# select HAVE_REGS_AND_STACK_ACCESS_API
|
||||
# select HAVE_HW_BREAKPOINT
|
||||
# select PERF_EVENTS
|
||||
# select HAVE_USER_RETURN_NOTIFIER
|
||||
# config NO_BOOTMEM
|
||||
# config ARCH_SUPPORTS_DEBUG_PAGEALLOC
|
||||
# config HUGETLB_PAGE_SIZE_VARIABLE
|
||||
|
||||
|
||||
mainmenu "Linux/TILE Kernel Configuration"
|
||||
|
||||
# Please note: TILE-Gx support is not yet finalized; this is
|
||||
# the preliminary support. TILE-Gx drivers are only provided
|
||||
# with the alpha or beta test versions for Tilera customers.
|
||||
config TILEGX
|
||||
depends on EXPERIMENTAL
|
||||
bool "Building with TILE-Gx (64-bit) compiler and toolchain"
|
||||
|
||||
config 64BIT
|
||||
depends on TILEGX
|
||||
def_bool y
|
||||
|
||||
config ARCH_DEFCONFIG
|
||||
string
|
||||
default "arch/tile/configs/tile_defconfig" if !TILEGX
|
||||
default "arch/tile/configs/tilegx_defconfig" if TILEGX
|
||||
|
||||
source "init/Kconfig"
|
||||
|
||||
menu "Tilera-specific configuration"
|
||||
|
||||
config NR_CPUS
|
||||
int "Maximum number of tiles (2-255)"
|
||||
range 2 255
|
||||
depends on SMP
|
||||
default "64"
|
||||
---help---
|
||||
Building with 64 is the recommended value, but a slightly
|
||||
smaller kernel memory footprint results from using a smaller
|
||||
value on chips with fewer tiles.
|
||||
|
||||
source "kernel/time/Kconfig"
|
||||
|
||||
source "kernel/Kconfig.hz"
|
||||
|
||||
config KEXEC
|
||||
bool "kexec system call"
|
||||
---help---
|
||||
kexec is a system call that implements the ability to shutdown your
|
||||
current kernel, and to start another kernel. It is like a reboot
|
||||
but it is independent of the system firmware. It is used
|
||||
to implement the "mboot" Tilera booter.
|
||||
|
||||
The name comes from the similarity to the exec system call.
|
||||
|
||||
config COMPAT
|
||||
bool "Support 32-bit TILE-Gx binaries in addition to 64-bit"
|
||||
depends on TILEGX
|
||||
select COMPAT_BINFMT_ELF
|
||||
default y
|
||||
---help---
|
||||
If enabled, the kernel will support running TILE-Gx binaries
|
||||
that were built with the -m32 option.
|
||||
|
||||
config SYSVIPC_COMPAT
|
||||
def_bool y
|
||||
depends on COMPAT && SYSVIPC
|
||||
|
||||
# We do not currently support disabling HIGHMEM on tile64 and tilepro.
|
||||
config HIGHMEM
|
||||
bool # "Support for more than 512 MB of RAM"
|
||||
default !TILEGX
|
||||
---help---
|
||||
Linux can use the full amount of RAM in the system by
|
||||
default. However, the address space of TILE processors is
|
||||
only 4 Gigabytes large. That means that, if you have a large
|
||||
amount of physical memory, not all of it can be "permanently
|
||||
mapped" by the kernel. The physical memory that's not
|
||||
permanently mapped is called "high memory".
|
||||
|
||||
If you are compiling a kernel which will never run on a
|
||||
machine with more than 512 MB total physical RAM, answer
|
||||
"false" here. This will result in the kernel mapping all of
|
||||
physical memory into the top 1 GB of virtual memory space.
|
||||
|
||||
If unsure, say "true".
|
||||
|
||||
# We do not currently support disabling NUMA.
|
||||
config NUMA
|
||||
bool # "NUMA Memory Allocation and Scheduler Support"
|
||||
depends on SMP && DISCONTIGMEM
|
||||
default y
|
||||
---help---
|
||||
NUMA memory allocation is required for TILE processors
|
||||
unless booting with memory striping enabled in the
|
||||
hypervisor, or with only a single memory controller.
|
||||
It is recommended that this option always be enabled.
|
||||
|
||||
config NODES_SHIFT
|
||||
int "Log base 2 of the max number of memory controllers"
|
||||
default 2
|
||||
depends on NEED_MULTIPLE_NODES
|
||||
---help---
|
||||
By default, 2, i.e. 2^2 == 4 DDR2 controllers.
|
||||
In a system with more controllers, this value should be raised.
|
||||
|
||||
# Need 16MB areas to enable hugetlb
|
||||
# See build-time check in arch/tile/mm/init.c.
|
||||
config FORCE_MAX_ZONEORDER
|
||||
int
|
||||
default 9
|
||||
|
||||
choice
|
||||
depends on !TILEGX
|
||||
prompt "Memory split" if EMBEDDED
|
||||
default VMSPLIT_3G
|
||||
---help---
|
||||
Select the desired split between kernel and user memory.
|
||||
|
||||
If the address range available to the kernel is less than the
|
||||
physical memory installed, the remaining memory will be available
|
||||
as "high memory". Accessing high memory is a little more costly
|
||||
than low memory, as it needs to be mapped into the kernel first.
|
||||
Note that increasing the kernel address space limits the range
|
||||
available to user programs, making the address space there
|
||||
tighter. Selecting anything other than the default 3G/1G split
|
||||
will also likely make your kernel incompatible with binary-only
|
||||
kernel modules.
|
||||
|
||||
If you are not absolutely sure what you are doing, leave this
|
||||
option alone!
|
||||
|
||||
config VMSPLIT_375G
|
||||
bool "3.75G/0.25G user/kernel split (no kernel networking)"
|
||||
config VMSPLIT_35G
|
||||
bool "3.5G/0.5G user/kernel split"
|
||||
config VMSPLIT_3G
|
||||
bool "3G/1G user/kernel split"
|
||||
config VMSPLIT_3G_OPT
|
||||
bool "3G/1G user/kernel split (for full 1G low memory)"
|
||||
config VMSPLIT_2G
|
||||
bool "2G/2G user/kernel split"
|
||||
config VMSPLIT_1G
|
||||
bool "1G/3G user/kernel split"
|
||||
endchoice
|
||||
|
||||
config PAGE_OFFSET
|
||||
hex
|
||||
default 0xF0000000 if VMSPLIT_375G
|
||||
default 0xE0000000 if VMSPLIT_35G
|
||||
default 0xB0000000 if VMSPLIT_3G_OPT
|
||||
default 0x80000000 if VMSPLIT_2G
|
||||
default 0x40000000 if VMSPLIT_1G
|
||||
default 0xC0000000
|
||||
|
||||
source "mm/Kconfig"
|
||||
|
||||
config CMDLINE_BOOL
|
||||
bool "Built-in kernel command line"
|
||||
default n
|
||||
---help---
|
||||
Allow for specifying boot arguments to the kernel at
|
||||
build time. On some systems (e.g. embedded ones), it is
|
||||
necessary or convenient to provide some or all of the
|
||||
kernel boot arguments with the kernel itself (that is,
|
||||
to not rely on the boot loader to provide them.)
|
||||
|
||||
To compile command line arguments into the kernel,
|
||||
set this option to 'Y', then fill in the
|
||||
the boot arguments in CONFIG_CMDLINE.
|
||||
|
||||
Systems with fully functional boot loaders (e.g. mboot, or
|
||||
if booting over PCI) should leave this option set to 'N'.
|
||||
|
||||
config CMDLINE
|
||||
string "Built-in kernel command string"
|
||||
depends on CMDLINE_BOOL
|
||||
default ""
|
||||
---help---
|
||||
Enter arguments here that should be compiled into the kernel
|
||||
image and used at boot time. If the boot loader provides a
|
||||
command line at boot time, it is appended to this string to
|
||||
form the full kernel command line, when the system boots.
|
||||
|
||||
However, you can use the CONFIG_CMDLINE_OVERRIDE option to
|
||||
change this behavior.
|
||||
|
||||
In most cases, the command line (whether built-in or provided
|
||||
by the boot loader) should specify the device for the root
|
||||
file system.
|
||||
|
||||
config CMDLINE_OVERRIDE
|
||||
bool "Built-in command line overrides boot loader arguments"
|
||||
default n
|
||||
depends on CMDLINE_BOOL
|
||||
---help---
|
||||
Set this option to 'Y' to have the kernel ignore the boot loader
|
||||
command line, and use ONLY the built-in command line.
|
||||
|
||||
This is used to work around broken boot loaders. This should
|
||||
be set to 'N' under normal conditions.
|
||||
|
||||
config VMALLOC_RESERVE
|
||||
hex
|
||||
default 0x1000000
|
||||
|
||||
endmenu # Tilera-specific configuration
|
||||
|
||||
menu "Bus options"
|
||||
|
||||
config NO_IOMEM
|
||||
def_bool !PCI
|
||||
|
||||
config NO_IOPORT
|
||||
def_bool !PCI
|
||||
|
||||
source "drivers/pci/Kconfig"
|
||||
|
||||
source "drivers/pci/hotplug/Kconfig"
|
||||
|
||||
endmenu
|
||||
|
||||
menu "Executable file formats"
|
||||
|
||||
# only elf supported
|
||||
config KCORE_ELF
|
||||
def_bool y
|
||||
depends on PROC_FS
|
||||
|
||||
source "fs/Kconfig.binfmt"
|
||||
|
||||
endmenu
|
||||
|
||||
source "net/Kconfig"
|
||||
|
||||
source "drivers/Kconfig"
|
||||
|
||||
source "fs/Kconfig"
|
||||
|
||||
source "arch/tile/Kconfig.debug"
|
||||
|
||||
source "security/Kconfig"
|
||||
|
||||
source "crypto/Kconfig"
|
||||
|
||||
source "lib/Kconfig"
|
||||
43
arch/tile/Kconfig.debug
Normal file
43
arch/tile/Kconfig.debug
Normal file
@@ -0,0 +1,43 @@
|
||||
menu "Kernel hacking"
|
||||
|
||||
source "lib/Kconfig.debug"
|
||||
|
||||
config EARLY_PRINTK
|
||||
bool "Early printk" if EMBEDDED && DEBUG_KERNEL
|
||||
default y
|
||||
help
|
||||
Write kernel log output directly via the hypervisor console.
|
||||
|
||||
This is useful for kernel debugging when your machine crashes very
|
||||
early before the console code is initialized. For normal operation
|
||||
it is not recommended because it looks ugly and doesn't cooperate
|
||||
with klogd/syslogd. You should normally N here,
|
||||
unless you want to debug such a crash.
|
||||
|
||||
config DEBUG_STACKOVERFLOW
|
||||
bool "Check for stack overflows"
|
||||
depends on DEBUG_KERNEL
|
||||
help
|
||||
This option will cause messages to be printed if free stack space
|
||||
drops below a certain limit.
|
||||
|
||||
config DEBUG_STACK_USAGE
|
||||
bool "Stack utilization instrumentation"
|
||||
depends on DEBUG_KERNEL
|
||||
help
|
||||
Enables the display of the minimum amount of free stack which each
|
||||
task has ever had available in the sysrq-T and sysrq-P debug output.
|
||||
|
||||
This option will slow down process creation somewhat.
|
||||
|
||||
config DEBUG_EXTRA_FLAGS
|
||||
string "Additional compiler arguments when building with '-g'"
|
||||
depends on DEBUG_INFO
|
||||
default ""
|
||||
help
|
||||
Debug info can be large, and flags like
|
||||
`-femit-struct-debug-baseonly' can reduce the kernel file
|
||||
size and build time noticeably. Such flags are often
|
||||
helpful if the main use of debug info is line number info.
|
||||
|
||||
endmenu
|
||||
52
arch/tile/Makefile
Normal file
52
arch/tile/Makefile
Normal file
@@ -0,0 +1,52 @@
|
||||
#
|
||||
# This file is subject to the terms and conditions of the GNU General Public
|
||||
# License. See the file "COPYING" in the main directory of this archive
|
||||
# for more details.
|
||||
#
|
||||
# This file is included by the global makefile so that you can add your own
|
||||
# architecture-specific flags and dependencies. Remember to do have actions
|
||||
# for "archclean" and "archdep" for cleaning up and making dependencies for
|
||||
# this architecture
|
||||
|
||||
ifeq ($(CROSS_COMPILE),)
|
||||
# If building with TILERA_ROOT set (i.e. using the Tilera Multicore
|
||||
# Development Environment) we can set CROSS_COMPILE based on that.
|
||||
ifdef TILERA_ROOT
|
||||
CROSS_COMPILE = $(TILERA_ROOT)/bin/tile-
|
||||
endif
|
||||
endif
|
||||
|
||||
# If we're not cross-compiling, make sure we're on the right architecture.
|
||||
ifeq ($(CROSS_COMPILE),)
|
||||
HOST_ARCH = $(shell uname -m)
|
||||
ifneq ($(HOST_ARCH),$(ARCH))
|
||||
$(error Set TILERA_ROOT or CROSS_COMPILE when building $(ARCH) on $(HOST_ARCH))
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
KBUILD_CFLAGS += $(CONFIG_DEBUG_EXTRA_FLAGS)
|
||||
|
||||
LIBGCC_PATH := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
|
||||
|
||||
# Provide the path to use for "make defconfig".
|
||||
KBUILD_DEFCONFIG := $(ARCH)_defconfig
|
||||
|
||||
# Used as a file extension when useful, e.g. head_$(BITS).o
|
||||
# Not needed for (e.g.) "$(CC) -m32" since the compiler automatically
|
||||
# uses the right default anyway.
|
||||
export BITS
|
||||
ifeq ($(CONFIG_TILEGX),y)
|
||||
BITS := 64
|
||||
else
|
||||
BITS := 32
|
||||
endif
|
||||
|
||||
head-y := arch/tile/kernel/head_$(BITS).o
|
||||
|
||||
libs-y += arch/tile/lib/
|
||||
libs-y += $(LIBGCC_PATH)
|
||||
|
||||
|
||||
# See arch/tile/Kbuild for content of core part of the kernel
|
||||
core-y += arch/tile/
|
||||
1289
arch/tile/configs/tile_defconfig
Normal file
1289
arch/tile/configs/tile_defconfig
Normal file
File diff suppressed because it is too large
Load Diff
93
arch/tile/include/arch/abi.h
Normal file
93
arch/tile/include/arch/abi.h
Normal file
@@ -0,0 +1,93 @@
|
||||
// Copyright 2010 Tilera Corporation. All Rights Reserved.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation, version 2.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but
|
||||
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
|
||||
// NON INFRINGEMENT. See the GNU General Public License for
|
||||
// more details.
|
||||
|
||||
//! @file
|
||||
//!
|
||||
//! ABI-related register definitions helpful when writing assembly code.
|
||||
//!
|
||||
|
||||
#ifndef __ARCH_ABI_H__
|
||||
#define __ARCH_ABI_H__
|
||||
|
||||
#include <arch/chip.h>
|
||||
|
||||
// Registers 0 - 55 are "normal", but some perform special roles.
|
||||
|
||||
#define TREG_FP 52 /**< Frame pointer. */
|
||||
#define TREG_TP 53 /**< Thread pointer. */
|
||||
#define TREG_SP 54 /**< Stack pointer. */
|
||||
#define TREG_LR 55 /**< Link to calling function PC. */
|
||||
|
||||
/** Index of last normal general-purpose register. */
|
||||
#define TREG_LAST_GPR 55
|
||||
|
||||
// Registers 56 - 62 are "special" network registers.
|
||||
|
||||
#define TREG_SN 56 /**< Static network access. */
|
||||
#define TREG_IDN0 57 /**< IDN demux 0 access. */
|
||||
#define TREG_IDN1 58 /**< IDN demux 1 access. */
|
||||
#define TREG_UDN0 59 /**< UDN demux 0 access. */
|
||||
#define TREG_UDN1 60 /**< UDN demux 1 access. */
|
||||
#define TREG_UDN2 61 /**< UDN demux 2 access. */
|
||||
#define TREG_UDN3 62 /**< UDN demux 3 access. */
|
||||
|
||||
// Register 63 is the "special" zero register.
|
||||
|
||||
#define TREG_ZERO 63 /**< "Zero" register; always reads as "0". */
|
||||
|
||||
|
||||
/** By convention, this register is used to hold the syscall number. */
|
||||
#define TREG_SYSCALL_NR 10
|
||||
|
||||
/** Name of register that holds the syscall number, for use in assembly. */
|
||||
#define TREG_SYSCALL_NR_NAME r10
|
||||
|
||||
|
||||
//! The ABI requires callers to allocate a caller state save area of
|
||||
//! this many bytes at the bottom of each stack frame.
|
||||
//!
|
||||
#ifdef __tile__
|
||||
#define C_ABI_SAVE_AREA_SIZE (2 * __SIZEOF_POINTER__)
|
||||
#endif
|
||||
|
||||
//! The operand to an 'info' opcode directing the backtracer to not
|
||||
//! try to find the calling frame.
|
||||
//!
|
||||
#define INFO_OP_CANNOT_BACKTRACE 2
|
||||
|
||||
#ifndef __ASSEMBLER__
|
||||
#if CHIP_WORD_SIZE() > 32
|
||||
|
||||
//! Unsigned type that can hold a register.
|
||||
typedef unsigned long long uint_reg_t;
|
||||
|
||||
//! Signed type that can hold a register.
|
||||
typedef long long int_reg_t;
|
||||
|
||||
//! String prefix to use for printf().
|
||||
#define INT_REG_FMT "ll"
|
||||
|
||||
#elif !defined(__LP64__) /* avoid confusion with LP64 cross-build tools */
|
||||
|
||||
//! Unsigned type that can hold a register.
|
||||
typedef unsigned long uint_reg_t;
|
||||
|
||||
//! Signed type that can hold a register.
|
||||
typedef long int_reg_t;
|
||||
|
||||
//! String prefix to use for printf().
|
||||
#define INT_REG_FMT "l"
|
||||
|
||||
#endif
|
||||
#endif /* __ASSEMBLER__ */
|
||||
|
||||
#endif // !__ARCH_ABI_H__
|
||||
23
arch/tile/include/arch/chip.h
Normal file
23
arch/tile/include/arch/chip.h
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright 2010 Tilera Corporation. All Rights Reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, version 2.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
|
||||
* NON INFRINGEMENT. See the GNU General Public License for
|
||||
* more details.
|
||||
*/
|
||||
|
||||
#if __tile_chip__ == 0
|
||||
#include <arch/chip_tile64.h>
|
||||
#elif __tile_chip__ == 1
|
||||
#include <arch/chip_tilepro.h>
|
||||
#elif defined(__tilegx__)
|
||||
#include <arch/chip_tilegx.h>
|
||||
#else
|
||||
#error Unexpected Tilera chip type
|
||||
#endif
|
||||
252
arch/tile/include/arch/chip_tile64.h
Normal file
252
arch/tile/include/arch/chip_tile64.h
Normal file
@@ -0,0 +1,252 @@
|
||||
/*
|
||||
* Copyright 2010 Tilera Corporation. All Rights Reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, version 2.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
|
||||
* NON INFRINGEMENT. See the GNU General Public License for
|
||||
* more details.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @file
|
||||
* Global header file.
|
||||
* This header file specifies defines for TILE64.
|
||||
*/
|
||||
|
||||
#ifndef __ARCH_CHIP_H__
|
||||
#define __ARCH_CHIP_H__
|
||||
|
||||
/** Specify chip version.
|
||||
* When possible, prefer the CHIP_xxx symbols below for future-proofing.
|
||||
* This is intended for cross-compiling; native compilation should
|
||||
* use the predefined __tile_chip__ symbol.
|
||||
*/
|
||||
#define TILE_CHIP 0
|
||||
|
||||
/** Specify chip revision.
|
||||
* This provides for the case of a respin of a particular chip type;
|
||||
* the normal value for this symbol is "0".
|
||||
* This is intended for cross-compiling; native compilation should
|
||||
* use the predefined __tile_chip_rev__ symbol.
|
||||
*/
|
||||
#define TILE_CHIP_REV 0
|
||||
|
||||
/** The name of this architecture. */
|
||||
#define CHIP_ARCH_NAME "tile64"
|
||||
|
||||
/** The ELF e_machine type for binaries for this chip. */
|
||||
#define CHIP_ELF_TYPE() EM_TILE64
|
||||
|
||||
/** The alternate ELF e_machine type for binaries for this chip. */
|
||||
#define CHIP_COMPAT_ELF_TYPE() 0x2506
|
||||
|
||||
/** What is the native word size of the machine? */
|
||||
#define CHIP_WORD_SIZE() 32
|
||||
|
||||
/** How many bits of a virtual address are used. Extra bits must be
|
||||
* the sign extension of the low bits.
|
||||
*/
|
||||
#define CHIP_VA_WIDTH() 32
|
||||
|
||||
/** How many bits are in a physical address? */
|
||||
#define CHIP_PA_WIDTH() 36
|
||||
|
||||
/** Size of the L2 cache, in bytes. */
|
||||
#define CHIP_L2_CACHE_SIZE() 65536
|
||||
|
||||
/** Log size of an L2 cache line in bytes. */
|
||||
#define CHIP_L2_LOG_LINE_SIZE() 6
|
||||
|
||||
/** Size of an L2 cache line, in bytes. */
|
||||
#define CHIP_L2_LINE_SIZE() (1 << CHIP_L2_LOG_LINE_SIZE())
|
||||
|
||||
/** Associativity of the L2 cache. */
|
||||
#define CHIP_L2_ASSOC() 2
|
||||
|
||||
/** Size of the L1 data cache, in bytes. */
|
||||
#define CHIP_L1D_CACHE_SIZE() 8192
|
||||
|
||||
/** Log size of an L1 data cache line in bytes. */
|
||||
#define CHIP_L1D_LOG_LINE_SIZE() 4
|
||||
|
||||
/** Size of an L1 data cache line, in bytes. */
|
||||
#define CHIP_L1D_LINE_SIZE() (1 << CHIP_L1D_LOG_LINE_SIZE())
|
||||
|
||||
/** Associativity of the L1 data cache. */
|
||||
#define CHIP_L1D_ASSOC() 2
|
||||
|
||||
/** Size of the L1 instruction cache, in bytes. */
|
||||
#define CHIP_L1I_CACHE_SIZE() 8192
|
||||
|
||||
/** Log size of an L1 instruction cache line in bytes. */
|
||||
#define CHIP_L1I_LOG_LINE_SIZE() 6
|
||||
|
||||
/** Size of an L1 instruction cache line, in bytes. */
|
||||
#define CHIP_L1I_LINE_SIZE() (1 << CHIP_L1I_LOG_LINE_SIZE())
|
||||
|
||||
/** Associativity of the L1 instruction cache. */
|
||||
#define CHIP_L1I_ASSOC() 1
|
||||
|
||||
/** Stride with which flush instructions must be issued. */
|
||||
#define CHIP_FLUSH_STRIDE() CHIP_L2_LINE_SIZE()
|
||||
|
||||
/** Stride with which inv instructions must be issued. */
|
||||
#define CHIP_INV_STRIDE() CHIP_L1D_LINE_SIZE()
|
||||
|
||||
/** Stride with which finv instructions must be issued. */
|
||||
#define CHIP_FINV_STRIDE() CHIP_L1D_LINE_SIZE()
|
||||
|
||||
/** Can the local cache coherently cache data that is homed elsewhere? */
|
||||
#define CHIP_HAS_COHERENT_LOCAL_CACHE() 0
|
||||
|
||||
/** How many simultaneous outstanding victims can the L2 cache have? */
|
||||
#define CHIP_MAX_OUTSTANDING_VICTIMS() 2
|
||||
|
||||
/** Does the TLB support the NC and NOALLOC bits? */
|
||||
#define CHIP_HAS_NC_AND_NOALLOC_BITS() 0
|
||||
|
||||
/** Does the chip support hash-for-home caching? */
|
||||
#define CHIP_HAS_CBOX_HOME_MAP() 0
|
||||
|
||||
/** Number of entries in the chip's home map tables. */
|
||||
/* #define CHIP_CBOX_HOME_MAP_SIZE() -- does not apply to chip 0 */
|
||||
|
||||
/** Do uncacheable requests miss in the cache regardless of whether
|
||||
* there is matching data? */
|
||||
#define CHIP_HAS_ENFORCED_UNCACHEABLE_REQUESTS() 0
|
||||
|
||||
/** Does the mf instruction wait for victims? */
|
||||
#define CHIP_HAS_MF_WAITS_FOR_VICTIMS() 1
|
||||
|
||||
/** Does the chip have an "inv" instruction that doesn't also flush? */
|
||||
#define CHIP_HAS_INV() 0
|
||||
|
||||
/** Does the chip have a "wh64" instruction? */
|
||||
#define CHIP_HAS_WH64() 0
|
||||
|
||||
/** Does this chip have a 'dword_align' instruction? */
|
||||
#define CHIP_HAS_DWORD_ALIGN() 0
|
||||
|
||||
/** Number of performance counters. */
|
||||
#define CHIP_PERFORMANCE_COUNTERS() 2
|
||||
|
||||
/** Does this chip have auxiliary performance counters? */
|
||||
#define CHIP_HAS_AUX_PERF_COUNTERS() 0
|
||||
|
||||
/** Is the CBOX_MSR1 SPR supported? */
|
||||
#define CHIP_HAS_CBOX_MSR1() 0
|
||||
|
||||
/** Is the TILE_RTF_HWM SPR supported? */
|
||||
#define CHIP_HAS_TILE_RTF_HWM() 0
|
||||
|
||||
/** Is the TILE_WRITE_PENDING SPR supported? */
|
||||
#define CHIP_HAS_TILE_WRITE_PENDING() 0
|
||||
|
||||
/** Is the PROC_STATUS SPR supported? */
|
||||
#define CHIP_HAS_PROC_STATUS_SPR() 0
|
||||
|
||||
/** Log of the number of mshims we have. */
|
||||
#define CHIP_LOG_NUM_MSHIMS() 2
|
||||
|
||||
/** Are the bases of the interrupt vector areas fixed? */
|
||||
#define CHIP_HAS_FIXED_INTVEC_BASE() 1
|
||||
|
||||
/** Are the interrupt masks split up into 2 SPRs? */
|
||||
#define CHIP_HAS_SPLIT_INTR_MASK() 1
|
||||
|
||||
/** Is the cycle count split up into 2 SPRs? */
|
||||
#define CHIP_HAS_SPLIT_CYCLE() 1
|
||||
|
||||
/** Does the chip have a static network? */
|
||||
#define CHIP_HAS_SN() 1
|
||||
|
||||
/** Does the chip have a static network processor? */
|
||||
#define CHIP_HAS_SN_PROC() 1
|
||||
|
||||
/** Size of the L1 static network processor instruction cache, in bytes. */
|
||||
#define CHIP_L1SNI_CACHE_SIZE() 2048
|
||||
|
||||
/** Does the chip have DMA support in each tile? */
|
||||
#define CHIP_HAS_TILE_DMA() 1
|
||||
|
||||
/** Does the chip have the second revision of the directly accessible
|
||||
* dynamic networks? This encapsulates a number of characteristics,
|
||||
* including the absence of the catch-all, the absence of inline message
|
||||
* tags, the absence of support for network context-switching, and so on.
|
||||
*/
|
||||
#define CHIP_HAS_REV1_XDN() 0
|
||||
|
||||
/** Does the chip have cmpexch and similar (fetchadd, exch, etc.)? */
|
||||
#define CHIP_HAS_CMPEXCH() 0
|
||||
|
||||
/** Does the chip have memory-mapped I/O support? */
|
||||
#define CHIP_HAS_MMIO() 0
|
||||
|
||||
/** Does the chip have post-completion interrupts? */
|
||||
#define CHIP_HAS_POST_COMPLETION_INTERRUPTS() 0
|
||||
|
||||
/** Does the chip have native single step support? */
|
||||
#define CHIP_HAS_SINGLE_STEP() 0
|
||||
|
||||
#ifndef __OPEN_SOURCE__ /* features only relevant to hypervisor-level code */
|
||||
|
||||
/** How many entries are present in the instruction TLB? */
|
||||
#define CHIP_ITLB_ENTRIES() 8
|
||||
|
||||
/** How many entries are present in the data TLB? */
|
||||
#define CHIP_DTLB_ENTRIES() 16
|
||||
|
||||
/** How many MAF entries does the XAUI shim have? */
|
||||
#define CHIP_XAUI_MAF_ENTRIES() 16
|
||||
|
||||
/** Does the memory shim have a source-id table? */
|
||||
#define CHIP_HAS_MSHIM_SRCID_TABLE() 1
|
||||
|
||||
/** Does the L1 instruction cache clear on reset? */
|
||||
#define CHIP_HAS_L1I_CLEAR_ON_RESET() 0
|
||||
|
||||
/** Does the chip come out of reset with valid coordinates on all tiles?
|
||||
* Note that if defined, this also implies that the upper left is 1,1.
|
||||
*/
|
||||
#define CHIP_HAS_VALID_TILE_COORD_RESET() 0
|
||||
|
||||
/** Does the chip have unified packet formats? */
|
||||
#define CHIP_HAS_UNIFIED_PACKET_FORMATS() 0
|
||||
|
||||
/** Does the chip support write reordering? */
|
||||
#define CHIP_HAS_WRITE_REORDERING() 0
|
||||
|
||||
/** Does the chip support Y-X routing as well as X-Y? */
|
||||
#define CHIP_HAS_Y_X_ROUTING() 0
|
||||
|
||||
/** Is INTCTRL_3 managed with the correct MPL? */
|
||||
#define CHIP_HAS_INTCTRL_3_STATUS_FIX() 0
|
||||
|
||||
/** Is it possible to configure the chip to be big-endian? */
|
||||
#define CHIP_HAS_BIG_ENDIAN_CONFIG() 0
|
||||
|
||||
/** Is the CACHE_RED_WAY_OVERRIDDEN SPR supported? */
|
||||
#define CHIP_HAS_CACHE_RED_WAY_OVERRIDDEN() 0
|
||||
|
||||
/** Is the DIAG_TRACE_WAY SPR supported? */
|
||||
#define CHIP_HAS_DIAG_TRACE_WAY() 0
|
||||
|
||||
/** Is the MEM_STRIPE_CONFIG SPR supported? */
|
||||
#define CHIP_HAS_MEM_STRIPE_CONFIG() 0
|
||||
|
||||
/** Are the TLB_PERF SPRs supported? */
|
||||
#define CHIP_HAS_TLB_PERF() 0
|
||||
|
||||
/** Is the VDN_SNOOP_SHIM_CTL SPR supported? */
|
||||
#define CHIP_HAS_VDN_SNOOP_SHIM_CTL() 0
|
||||
|
||||
/** Does the chip support rev1 DMA packets? */
|
||||
#define CHIP_HAS_REV1_DMA_PACKETS() 0
|
||||
|
||||
#endif /* !__OPEN_SOURCE__ */
|
||||
#endif /* __ARCH_CHIP_H__ */
|
||||
252
arch/tile/include/arch/chip_tilepro.h
Normal file
252
arch/tile/include/arch/chip_tilepro.h
Normal file
@@ -0,0 +1,252 @@
|
||||
/*
|
||||
* Copyright 2010 Tilera Corporation. All Rights Reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, version 2.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
|
||||
* NON INFRINGEMENT. See the GNU General Public License for
|
||||
* more details.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @file
|
||||
* Global header file.
|
||||
* This header file specifies defines for TILEPro.
|
||||
*/
|
||||
|
||||
#ifndef __ARCH_CHIP_H__
|
||||
#define __ARCH_CHIP_H__
|
||||
|
||||
/** Specify chip version.
|
||||
* When possible, prefer the CHIP_xxx symbols below for future-proofing.
|
||||
* This is intended for cross-compiling; native compilation should
|
||||
* use the predefined __tile_chip__ symbol.
|
||||
*/
|
||||
#define TILE_CHIP 1
|
||||
|
||||
/** Specify chip revision.
|
||||
* This provides for the case of a respin of a particular chip type;
|
||||
* the normal value for this symbol is "0".
|
||||
* This is intended for cross-compiling; native compilation should
|
||||
* use the predefined __tile_chip_rev__ symbol.
|
||||
*/
|
||||
#define TILE_CHIP_REV 0
|
||||
|
||||
/** The name of this architecture. */
|
||||
#define CHIP_ARCH_NAME "tilepro"
|
||||
|
||||
/** The ELF e_machine type for binaries for this chip. */
|
||||
#define CHIP_ELF_TYPE() EM_TILEPRO
|
||||
|
||||
/** The alternate ELF e_machine type for binaries for this chip. */
|
||||
#define CHIP_COMPAT_ELF_TYPE() 0x2507
|
||||
|
||||
/** What is the native word size of the machine? */
|
||||
#define CHIP_WORD_SIZE() 32
|
||||
|
||||
/** How many bits of a virtual address are used. Extra bits must be
|
||||
* the sign extension of the low bits.
|
||||
*/
|
||||
#define CHIP_VA_WIDTH() 32
|
||||
|
||||
/** How many bits are in a physical address? */
|
||||
#define CHIP_PA_WIDTH() 36
|
||||
|
||||
/** Size of the L2 cache, in bytes. */
|
||||
#define CHIP_L2_CACHE_SIZE() 65536
|
||||
|
||||
/** Log size of an L2 cache line in bytes. */
|
||||
#define CHIP_L2_LOG_LINE_SIZE() 6
|
||||
|
||||
/** Size of an L2 cache line, in bytes. */
|
||||
#define CHIP_L2_LINE_SIZE() (1 << CHIP_L2_LOG_LINE_SIZE())
|
||||
|
||||
/** Associativity of the L2 cache. */
|
||||
#define CHIP_L2_ASSOC() 4
|
||||
|
||||
/** Size of the L1 data cache, in bytes. */
|
||||
#define CHIP_L1D_CACHE_SIZE() 8192
|
||||
|
||||
/** Log size of an L1 data cache line in bytes. */
|
||||
#define CHIP_L1D_LOG_LINE_SIZE() 4
|
||||
|
||||
/** Size of an L1 data cache line, in bytes. */
|
||||
#define CHIP_L1D_LINE_SIZE() (1 << CHIP_L1D_LOG_LINE_SIZE())
|
||||
|
||||
/** Associativity of the L1 data cache. */
|
||||
#define CHIP_L1D_ASSOC() 2
|
||||
|
||||
/** Size of the L1 instruction cache, in bytes. */
|
||||
#define CHIP_L1I_CACHE_SIZE() 16384
|
||||
|
||||
/** Log size of an L1 instruction cache line in bytes. */
|
||||
#define CHIP_L1I_LOG_LINE_SIZE() 6
|
||||
|
||||
/** Size of an L1 instruction cache line, in bytes. */
|
||||
#define CHIP_L1I_LINE_SIZE() (1 << CHIP_L1I_LOG_LINE_SIZE())
|
||||
|
||||
/** Associativity of the L1 instruction cache. */
|
||||
#define CHIP_L1I_ASSOC() 1
|
||||
|
||||
/** Stride with which flush instructions must be issued. */
|
||||
#define CHIP_FLUSH_STRIDE() CHIP_L2_LINE_SIZE()
|
||||
|
||||
/** Stride with which inv instructions must be issued. */
|
||||
#define CHIP_INV_STRIDE() CHIP_L2_LINE_SIZE()
|
||||
|
||||
/** Stride with which finv instructions must be issued. */
|
||||
#define CHIP_FINV_STRIDE() CHIP_L2_LINE_SIZE()
|
||||
|
||||
/** Can the local cache coherently cache data that is homed elsewhere? */
|
||||
#define CHIP_HAS_COHERENT_LOCAL_CACHE() 1
|
||||
|
||||
/** How many simultaneous outstanding victims can the L2 cache have? */
|
||||
#define CHIP_MAX_OUTSTANDING_VICTIMS() 4
|
||||
|
||||
/** Does the TLB support the NC and NOALLOC bits? */
|
||||
#define CHIP_HAS_NC_AND_NOALLOC_BITS() 1
|
||||
|
||||
/** Does the chip support hash-for-home caching? */
|
||||
#define CHIP_HAS_CBOX_HOME_MAP() 1
|
||||
|
||||
/** Number of entries in the chip's home map tables. */
|
||||
#define CHIP_CBOX_HOME_MAP_SIZE() 64
|
||||
|
||||
/** Do uncacheable requests miss in the cache regardless of whether
|
||||
* there is matching data? */
|
||||
#define CHIP_HAS_ENFORCED_UNCACHEABLE_REQUESTS() 1
|
||||
|
||||
/** Does the mf instruction wait for victims? */
|
||||
#define CHIP_HAS_MF_WAITS_FOR_VICTIMS() 0
|
||||
|
||||
/** Does the chip have an "inv" instruction that doesn't also flush? */
|
||||
#define CHIP_HAS_INV() 1
|
||||
|
||||
/** Does the chip have a "wh64" instruction? */
|
||||
#define CHIP_HAS_WH64() 1
|
||||
|
||||
/** Does this chip have a 'dword_align' instruction? */
|
||||
#define CHIP_HAS_DWORD_ALIGN() 1
|
||||
|
||||
/** Number of performance counters. */
|
||||
#define CHIP_PERFORMANCE_COUNTERS() 4
|
||||
|
||||
/** Does this chip have auxiliary performance counters? */
|
||||
#define CHIP_HAS_AUX_PERF_COUNTERS() 1
|
||||
|
||||
/** Is the CBOX_MSR1 SPR supported? */
|
||||
#define CHIP_HAS_CBOX_MSR1() 1
|
||||
|
||||
/** Is the TILE_RTF_HWM SPR supported? */
|
||||
#define CHIP_HAS_TILE_RTF_HWM() 1
|
||||
|
||||
/** Is the TILE_WRITE_PENDING SPR supported? */
|
||||
#define CHIP_HAS_TILE_WRITE_PENDING() 1
|
||||
|
||||
/** Is the PROC_STATUS SPR supported? */
|
||||
#define CHIP_HAS_PROC_STATUS_SPR() 1
|
||||
|
||||
/** Log of the number of mshims we have. */
|
||||
#define CHIP_LOG_NUM_MSHIMS() 2
|
||||
|
||||
/** Are the bases of the interrupt vector areas fixed? */
|
||||
#define CHIP_HAS_FIXED_INTVEC_BASE() 1
|
||||
|
||||
/** Are the interrupt masks split up into 2 SPRs? */
|
||||
#define CHIP_HAS_SPLIT_INTR_MASK() 1
|
||||
|
||||
/** Is the cycle count split up into 2 SPRs? */
|
||||
#define CHIP_HAS_SPLIT_CYCLE() 1
|
||||
|
||||
/** Does the chip have a static network? */
|
||||
#define CHIP_HAS_SN() 1
|
||||
|
||||
/** Does the chip have a static network processor? */
|
||||
#define CHIP_HAS_SN_PROC() 0
|
||||
|
||||
/** Size of the L1 static network processor instruction cache, in bytes. */
|
||||
/* #define CHIP_L1SNI_CACHE_SIZE() -- does not apply to chip 1 */
|
||||
|
||||
/** Does the chip have DMA support in each tile? */
|
||||
#define CHIP_HAS_TILE_DMA() 1
|
||||
|
||||
/** Does the chip have the second revision of the directly accessible
|
||||
* dynamic networks? This encapsulates a number of characteristics,
|
||||
* including the absence of the catch-all, the absence of inline message
|
||||
* tags, the absence of support for network context-switching, and so on.
|
||||
*/
|
||||
#define CHIP_HAS_REV1_XDN() 0
|
||||
|
||||
/** Does the chip have cmpexch and similar (fetchadd, exch, etc.)? */
|
||||
#define CHIP_HAS_CMPEXCH() 0
|
||||
|
||||
/** Does the chip have memory-mapped I/O support? */
|
||||
#define CHIP_HAS_MMIO() 0
|
||||
|
||||
/** Does the chip have post-completion interrupts? */
|
||||
#define CHIP_HAS_POST_COMPLETION_INTERRUPTS() 0
|
||||
|
||||
/** Does the chip have native single step support? */
|
||||
#define CHIP_HAS_SINGLE_STEP() 0
|
||||
|
||||
#ifndef __OPEN_SOURCE__ /* features only relevant to hypervisor-level code */
|
||||
|
||||
/** How many entries are present in the instruction TLB? */
|
||||
#define CHIP_ITLB_ENTRIES() 16
|
||||
|
||||
/** How many entries are present in the data TLB? */
|
||||
#define CHIP_DTLB_ENTRIES() 16
|
||||
|
||||
/** How many MAF entries does the XAUI shim have? */
|
||||
#define CHIP_XAUI_MAF_ENTRIES() 32
|
||||
|
||||
/** Does the memory shim have a source-id table? */
|
||||
#define CHIP_HAS_MSHIM_SRCID_TABLE() 0
|
||||
|
||||
/** Does the L1 instruction cache clear on reset? */
|
||||
#define CHIP_HAS_L1I_CLEAR_ON_RESET() 1
|
||||
|
||||
/** Does the chip come out of reset with valid coordinates on all tiles?
|
||||
* Note that if defined, this also implies that the upper left is 1,1.
|
||||
*/
|
||||
#define CHIP_HAS_VALID_TILE_COORD_RESET() 1
|
||||
|
||||
/** Does the chip have unified packet formats? */
|
||||
#define CHIP_HAS_UNIFIED_PACKET_FORMATS() 1
|
||||
|
||||
/** Does the chip support write reordering? */
|
||||
#define CHIP_HAS_WRITE_REORDERING() 1
|
||||
|
||||
/** Does the chip support Y-X routing as well as X-Y? */
|
||||
#define CHIP_HAS_Y_X_ROUTING() 1
|
||||
|
||||
/** Is INTCTRL_3 managed with the correct MPL? */
|
||||
#define CHIP_HAS_INTCTRL_3_STATUS_FIX() 1
|
||||
|
||||
/** Is it possible to configure the chip to be big-endian? */
|
||||
#define CHIP_HAS_BIG_ENDIAN_CONFIG() 1
|
||||
|
||||
/** Is the CACHE_RED_WAY_OVERRIDDEN SPR supported? */
|
||||
#define CHIP_HAS_CACHE_RED_WAY_OVERRIDDEN() 1
|
||||
|
||||
/** Is the DIAG_TRACE_WAY SPR supported? */
|
||||
#define CHIP_HAS_DIAG_TRACE_WAY() 1
|
||||
|
||||
/** Is the MEM_STRIPE_CONFIG SPR supported? */
|
||||
#define CHIP_HAS_MEM_STRIPE_CONFIG() 1
|
||||
|
||||
/** Are the TLB_PERF SPRs supported? */
|
||||
#define CHIP_HAS_TLB_PERF() 1
|
||||
|
||||
/** Is the VDN_SNOOP_SHIM_CTL SPR supported? */
|
||||
#define CHIP_HAS_VDN_SNOOP_SHIM_CTL() 1
|
||||
|
||||
/** Does the chip support rev1 DMA packets? */
|
||||
#define CHIP_HAS_REV1_DMA_PACKETS() 1
|
||||
|
||||
#endif /* !__OPEN_SOURCE__ */
|
||||
#endif /* __ARCH_CHIP_H__ */
|
||||
19
arch/tile/include/arch/interrupts.h
Normal file
19
arch/tile/include/arch/interrupts.h
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright 2010 Tilera Corporation. All Rights Reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, version 2.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
|
||||
* NON INFRINGEMENT. See the GNU General Public License for
|
||||
* more details.
|
||||
*/
|
||||
|
||||
#ifdef __tilegx__
|
||||
#include <arch/interrupts_64.h>
|
||||
#else
|
||||
#include <arch/interrupts_32.h>
|
||||
#endif
|
||||
304
arch/tile/include/arch/interrupts_32.h
Normal file
304
arch/tile/include/arch/interrupts_32.h
Normal file
@@ -0,0 +1,304 @@
|
||||
/*
|
||||
* Copyright 2010 Tilera Corporation. All Rights Reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, version 2.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
|
||||
* NON INFRINGEMENT. See the GNU General Public License for
|
||||
* more details.
|
||||
*/
|
||||
|
||||
#ifndef __ARCH_INTERRUPTS_H__
|
||||
#define __ARCH_INTERRUPTS_H__
|
||||
|
||||
/** Mask for an interrupt. */
|
||||
#ifdef __ASSEMBLER__
|
||||
/* Note: must handle breaking interrupts into high and low words manually. */
|
||||
#define INT_MASK(intno) (1 << (intno))
|
||||
#else
|
||||
#define INT_MASK(intno) (1ULL << (intno))
|
||||
#endif
|
||||
|
||||
|
||||
/** Where a given interrupt executes */
|
||||
#define INTERRUPT_VECTOR(i, pl) (0xFC000000 + ((pl) << 24) + ((i) << 8))
|
||||
|
||||
/** Where to store a vector for a given interrupt. */
|
||||
#define USER_INTERRUPT_VECTOR(i) INTERRUPT_VECTOR(i, 0)
|
||||
|
||||
/** The base address of user-level interrupts. */
|
||||
#define USER_INTERRUPT_VECTOR_BASE INTERRUPT_VECTOR(0, 0)
|
||||
|
||||
|
||||
/** Additional synthetic interrupt. */
|
||||
#define INT_BREAKPOINT (63)
|
||||
|
||||
#define INT_ITLB_MISS 0
|
||||
#define INT_MEM_ERROR 1
|
||||
#define INT_ILL 2
|
||||
#define INT_GPV 3
|
||||
#define INT_SN_ACCESS 4
|
||||
#define INT_IDN_ACCESS 5
|
||||
#define INT_UDN_ACCESS 6
|
||||
#define INT_IDN_REFILL 7
|
||||
#define INT_UDN_REFILL 8
|
||||
#define INT_IDN_COMPLETE 9
|
||||
#define INT_UDN_COMPLETE 10
|
||||
#define INT_SWINT_3 11
|
||||
#define INT_SWINT_2 12
|
||||
#define INT_SWINT_1 13
|
||||
#define INT_SWINT_0 14
|
||||
#define INT_UNALIGN_DATA 15
|
||||
#define INT_DTLB_MISS 16
|
||||
#define INT_DTLB_ACCESS 17
|
||||
#define INT_DMATLB_MISS 18
|
||||
#define INT_DMATLB_ACCESS 19
|
||||
#define INT_SNITLB_MISS 20
|
||||
#define INT_SN_NOTIFY 21
|
||||
#define INT_SN_FIREWALL 22
|
||||
#define INT_IDN_FIREWALL 23
|
||||
#define INT_UDN_FIREWALL 24
|
||||
#define INT_TILE_TIMER 25
|
||||
#define INT_IDN_TIMER 26
|
||||
#define INT_UDN_TIMER 27
|
||||
#define INT_DMA_NOTIFY 28
|
||||
#define INT_IDN_CA 29
|
||||
#define INT_UDN_CA 30
|
||||
#define INT_IDN_AVAIL 31
|
||||
#define INT_UDN_AVAIL 32
|
||||
#define INT_PERF_COUNT 33
|
||||
#define INT_INTCTRL_3 34
|
||||
#define INT_INTCTRL_2 35
|
||||
#define INT_INTCTRL_1 36
|
||||
#define INT_INTCTRL_0 37
|
||||
#define INT_BOOT_ACCESS 38
|
||||
#define INT_WORLD_ACCESS 39
|
||||
#define INT_I_ASID 40
|
||||
#define INT_D_ASID 41
|
||||
#define INT_DMA_ASID 42
|
||||
#define INT_SNI_ASID 43
|
||||
#define INT_DMA_CPL 44
|
||||
#define INT_SN_CPL 45
|
||||
#define INT_DOUBLE_FAULT 46
|
||||
#define INT_SN_STATIC_ACCESS 47
|
||||
#define INT_AUX_PERF_COUNT 48
|
||||
|
||||
#define NUM_INTERRUPTS 49
|
||||
|
||||
#define QUEUED_INTERRUPTS ( \
|
||||
INT_MASK(INT_MEM_ERROR) | \
|
||||
INT_MASK(INT_DMATLB_MISS) | \
|
||||
INT_MASK(INT_DMATLB_ACCESS) | \
|
||||
INT_MASK(INT_SNITLB_MISS) | \
|
||||
INT_MASK(INT_SN_NOTIFY) | \
|
||||
INT_MASK(INT_SN_FIREWALL) | \
|
||||
INT_MASK(INT_IDN_FIREWALL) | \
|
||||
INT_MASK(INT_UDN_FIREWALL) | \
|
||||
INT_MASK(INT_TILE_TIMER) | \
|
||||
INT_MASK(INT_IDN_TIMER) | \
|
||||
INT_MASK(INT_UDN_TIMER) | \
|
||||
INT_MASK(INT_DMA_NOTIFY) | \
|
||||
INT_MASK(INT_IDN_CA) | \
|
||||
INT_MASK(INT_UDN_CA) | \
|
||||
INT_MASK(INT_IDN_AVAIL) | \
|
||||
INT_MASK(INT_UDN_AVAIL) | \
|
||||
INT_MASK(INT_PERF_COUNT) | \
|
||||
INT_MASK(INT_INTCTRL_3) | \
|
||||
INT_MASK(INT_INTCTRL_2) | \
|
||||
INT_MASK(INT_INTCTRL_1) | \
|
||||
INT_MASK(INT_INTCTRL_0) | \
|
||||
INT_MASK(INT_BOOT_ACCESS) | \
|
||||
INT_MASK(INT_WORLD_ACCESS) | \
|
||||
INT_MASK(INT_I_ASID) | \
|
||||
INT_MASK(INT_D_ASID) | \
|
||||
INT_MASK(INT_DMA_ASID) | \
|
||||
INT_MASK(INT_SNI_ASID) | \
|
||||
INT_MASK(INT_DMA_CPL) | \
|
||||
INT_MASK(INT_SN_CPL) | \
|
||||
INT_MASK(INT_DOUBLE_FAULT) | \
|
||||
INT_MASK(INT_AUX_PERF_COUNT) | \
|
||||
0)
|
||||
#define NONQUEUED_INTERRUPTS ( \
|
||||
INT_MASK(INT_ITLB_MISS) | \
|
||||
INT_MASK(INT_ILL) | \
|
||||
INT_MASK(INT_GPV) | \
|
||||
INT_MASK(INT_SN_ACCESS) | \
|
||||
INT_MASK(INT_IDN_ACCESS) | \
|
||||
INT_MASK(INT_UDN_ACCESS) | \
|
||||
INT_MASK(INT_IDN_REFILL) | \
|
||||
INT_MASK(INT_UDN_REFILL) | \
|
||||
INT_MASK(INT_IDN_COMPLETE) | \
|
||||
INT_MASK(INT_UDN_COMPLETE) | \
|
||||
INT_MASK(INT_SWINT_3) | \
|
||||
INT_MASK(INT_SWINT_2) | \
|
||||
INT_MASK(INT_SWINT_1) | \
|
||||
INT_MASK(INT_SWINT_0) | \
|
||||
INT_MASK(INT_UNALIGN_DATA) | \
|
||||
INT_MASK(INT_DTLB_MISS) | \
|
||||
INT_MASK(INT_DTLB_ACCESS) | \
|
||||
INT_MASK(INT_SN_STATIC_ACCESS) | \
|
||||
0)
|
||||
#define CRITICAL_MASKED_INTERRUPTS ( \
|
||||
INT_MASK(INT_MEM_ERROR) | \
|
||||
INT_MASK(INT_DMATLB_MISS) | \
|
||||
INT_MASK(INT_DMATLB_ACCESS) | \
|
||||
INT_MASK(INT_SNITLB_MISS) | \
|
||||
INT_MASK(INT_SN_NOTIFY) | \
|
||||
INT_MASK(INT_SN_FIREWALL) | \
|
||||
INT_MASK(INT_IDN_FIREWALL) | \
|
||||
INT_MASK(INT_UDN_FIREWALL) | \
|
||||
INT_MASK(INT_TILE_TIMER) | \
|
||||
INT_MASK(INT_IDN_TIMER) | \
|
||||
INT_MASK(INT_UDN_TIMER) | \
|
||||
INT_MASK(INT_DMA_NOTIFY) | \
|
||||
INT_MASK(INT_IDN_CA) | \
|
||||
INT_MASK(INT_UDN_CA) | \
|
||||
INT_MASK(INT_IDN_AVAIL) | \
|
||||
INT_MASK(INT_UDN_AVAIL) | \
|
||||
INT_MASK(INT_PERF_COUNT) | \
|
||||
INT_MASK(INT_INTCTRL_3) | \
|
||||
INT_MASK(INT_INTCTRL_2) | \
|
||||
INT_MASK(INT_INTCTRL_1) | \
|
||||
INT_MASK(INT_INTCTRL_0) | \
|
||||
INT_MASK(INT_AUX_PERF_COUNT) | \
|
||||
0)
|
||||
#define CRITICAL_UNMASKED_INTERRUPTS ( \
|
||||
INT_MASK(INT_ITLB_MISS) | \
|
||||
INT_MASK(INT_ILL) | \
|
||||
INT_MASK(INT_GPV) | \
|
||||
INT_MASK(INT_SN_ACCESS) | \
|
||||
INT_MASK(INT_IDN_ACCESS) | \
|
||||
INT_MASK(INT_UDN_ACCESS) | \
|
||||
INT_MASK(INT_IDN_REFILL) | \
|
||||
INT_MASK(INT_UDN_REFILL) | \
|
||||
INT_MASK(INT_IDN_COMPLETE) | \
|
||||
INT_MASK(INT_UDN_COMPLETE) | \
|
||||
INT_MASK(INT_SWINT_3) | \
|
||||
INT_MASK(INT_SWINT_2) | \
|
||||
INT_MASK(INT_SWINT_1) | \
|
||||
INT_MASK(INT_SWINT_0) | \
|
||||
INT_MASK(INT_UNALIGN_DATA) | \
|
||||
INT_MASK(INT_DTLB_MISS) | \
|
||||
INT_MASK(INT_DTLB_ACCESS) | \
|
||||
INT_MASK(INT_BOOT_ACCESS) | \
|
||||
INT_MASK(INT_WORLD_ACCESS) | \
|
||||
INT_MASK(INT_I_ASID) | \
|
||||
INT_MASK(INT_D_ASID) | \
|
||||
INT_MASK(INT_DMA_ASID) | \
|
||||
INT_MASK(INT_SNI_ASID) | \
|
||||
INT_MASK(INT_DMA_CPL) | \
|
||||
INT_MASK(INT_SN_CPL) | \
|
||||
INT_MASK(INT_DOUBLE_FAULT) | \
|
||||
INT_MASK(INT_SN_STATIC_ACCESS) | \
|
||||
0)
|
||||
#define MASKABLE_INTERRUPTS ( \
|
||||
INT_MASK(INT_MEM_ERROR) | \
|
||||
INT_MASK(INT_IDN_REFILL) | \
|
||||
INT_MASK(INT_UDN_REFILL) | \
|
||||
INT_MASK(INT_IDN_COMPLETE) | \
|
||||
INT_MASK(INT_UDN_COMPLETE) | \
|
||||
INT_MASK(INT_DMATLB_MISS) | \
|
||||
INT_MASK(INT_DMATLB_ACCESS) | \
|
||||
INT_MASK(INT_SNITLB_MISS) | \
|
||||
INT_MASK(INT_SN_NOTIFY) | \
|
||||
INT_MASK(INT_SN_FIREWALL) | \
|
||||
INT_MASK(INT_IDN_FIREWALL) | \
|
||||
INT_MASK(INT_UDN_FIREWALL) | \
|
||||
INT_MASK(INT_TILE_TIMER) | \
|
||||
INT_MASK(INT_IDN_TIMER) | \
|
||||
INT_MASK(INT_UDN_TIMER) | \
|
||||
INT_MASK(INT_DMA_NOTIFY) | \
|
||||
INT_MASK(INT_IDN_CA) | \
|
||||
INT_MASK(INT_UDN_CA) | \
|
||||
INT_MASK(INT_IDN_AVAIL) | \
|
||||
INT_MASK(INT_UDN_AVAIL) | \
|
||||
INT_MASK(INT_PERF_COUNT) | \
|
||||
INT_MASK(INT_INTCTRL_3) | \
|
||||
INT_MASK(INT_INTCTRL_2) | \
|
||||
INT_MASK(INT_INTCTRL_1) | \
|
||||
INT_MASK(INT_INTCTRL_0) | \
|
||||
INT_MASK(INT_AUX_PERF_COUNT) | \
|
||||
0)
|
||||
#define UNMASKABLE_INTERRUPTS ( \
|
||||
INT_MASK(INT_ITLB_MISS) | \
|
||||
INT_MASK(INT_ILL) | \
|
||||
INT_MASK(INT_GPV) | \
|
||||
INT_MASK(INT_SN_ACCESS) | \
|
||||
INT_MASK(INT_IDN_ACCESS) | \
|
||||
INT_MASK(INT_UDN_ACCESS) | \
|
||||
INT_MASK(INT_SWINT_3) | \
|
||||
INT_MASK(INT_SWINT_2) | \
|
||||
INT_MASK(INT_SWINT_1) | \
|
||||
INT_MASK(INT_SWINT_0) | \
|
||||
INT_MASK(INT_UNALIGN_DATA) | \
|
||||
INT_MASK(INT_DTLB_MISS) | \
|
||||
INT_MASK(INT_DTLB_ACCESS) | \
|
||||
INT_MASK(INT_BOOT_ACCESS) | \
|
||||
INT_MASK(INT_WORLD_ACCESS) | \
|
||||
INT_MASK(INT_I_ASID) | \
|
||||
INT_MASK(INT_D_ASID) | \
|
||||
INT_MASK(INT_DMA_ASID) | \
|
||||
INT_MASK(INT_SNI_ASID) | \
|
||||
INT_MASK(INT_DMA_CPL) | \
|
||||
INT_MASK(INT_SN_CPL) | \
|
||||
INT_MASK(INT_DOUBLE_FAULT) | \
|
||||
INT_MASK(INT_SN_STATIC_ACCESS) | \
|
||||
0)
|
||||
#define SYNC_INTERRUPTS ( \
|
||||
INT_MASK(INT_ITLB_MISS) | \
|
||||
INT_MASK(INT_ILL) | \
|
||||
INT_MASK(INT_GPV) | \
|
||||
INT_MASK(INT_SN_ACCESS) | \
|
||||
INT_MASK(INT_IDN_ACCESS) | \
|
||||
INT_MASK(INT_UDN_ACCESS) | \
|
||||
INT_MASK(INT_IDN_REFILL) | \
|
||||
INT_MASK(INT_UDN_REFILL) | \
|
||||
INT_MASK(INT_IDN_COMPLETE) | \
|
||||
INT_MASK(INT_UDN_COMPLETE) | \
|
||||
INT_MASK(INT_SWINT_3) | \
|
||||
INT_MASK(INT_SWINT_2) | \
|
||||
INT_MASK(INT_SWINT_1) | \
|
||||
INT_MASK(INT_SWINT_0) | \
|
||||
INT_MASK(INT_UNALIGN_DATA) | \
|
||||
INT_MASK(INT_DTLB_MISS) | \
|
||||
INT_MASK(INT_DTLB_ACCESS) | \
|
||||
INT_MASK(INT_SN_STATIC_ACCESS) | \
|
||||
0)
|
||||
#define NON_SYNC_INTERRUPTS ( \
|
||||
INT_MASK(INT_MEM_ERROR) | \
|
||||
INT_MASK(INT_DMATLB_MISS) | \
|
||||
INT_MASK(INT_DMATLB_ACCESS) | \
|
||||
INT_MASK(INT_SNITLB_MISS) | \
|
||||
INT_MASK(INT_SN_NOTIFY) | \
|
||||
INT_MASK(INT_SN_FIREWALL) | \
|
||||
INT_MASK(INT_IDN_FIREWALL) | \
|
||||
INT_MASK(INT_UDN_FIREWALL) | \
|
||||
INT_MASK(INT_TILE_TIMER) | \
|
||||
INT_MASK(INT_IDN_TIMER) | \
|
||||
INT_MASK(INT_UDN_TIMER) | \
|
||||
INT_MASK(INT_DMA_NOTIFY) | \
|
||||
INT_MASK(INT_IDN_CA) | \
|
||||
INT_MASK(INT_UDN_CA) | \
|
||||
INT_MASK(INT_IDN_AVAIL) | \
|
||||
INT_MASK(INT_UDN_AVAIL) | \
|
||||
INT_MASK(INT_PERF_COUNT) | \
|
||||
INT_MASK(INT_INTCTRL_3) | \
|
||||
INT_MASK(INT_INTCTRL_2) | \
|
||||
INT_MASK(INT_INTCTRL_1) | \
|
||||
INT_MASK(INT_INTCTRL_0) | \
|
||||
INT_MASK(INT_BOOT_ACCESS) | \
|
||||
INT_MASK(INT_WORLD_ACCESS) | \
|
||||
INT_MASK(INT_I_ASID) | \
|
||||
INT_MASK(INT_D_ASID) | \
|
||||
INT_MASK(INT_DMA_ASID) | \
|
||||
INT_MASK(INT_SNI_ASID) | \
|
||||
INT_MASK(INT_DMA_CPL) | \
|
||||
INT_MASK(INT_SN_CPL) | \
|
||||
INT_MASK(INT_DOUBLE_FAULT) | \
|
||||
INT_MASK(INT_AUX_PERF_COUNT) | \
|
||||
0)
|
||||
#endif // !__ARCH_INTERRUPTS_H__
|
||||
512
arch/tile/include/arch/sim_def.h
Normal file
512
arch/tile/include/arch/sim_def.h
Normal file
File diff suppressed because it is too large
Load Diff
19
arch/tile/include/arch/spr_def.h
Normal file
19
arch/tile/include/arch/spr_def.h
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright 2010 Tilera Corporation. All Rights Reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, version 2.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
|
||||
* NON INFRINGEMENT. See the GNU General Public License for
|
||||
* more details.
|
||||
*/
|
||||
|
||||
#ifdef __tilegx__
|
||||
#include <arch/spr_def_64.h>
|
||||
#else
|
||||
#include <arch/spr_def_32.h>
|
||||
#endif
|
||||
162
arch/tile/include/arch/spr_def_32.h
Normal file
162
arch/tile/include/arch/spr_def_32.h
Normal file
@@ -0,0 +1,162 @@
|
||||
/*
|
||||
* Copyright 2010 Tilera Corporation. All Rights Reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, version 2.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
|
||||
* NON INFRINGEMENT. See the GNU General Public License for
|
||||
* more details.
|
||||
*/
|
||||
|
||||
#ifndef __DOXYGEN__
|
||||
|
||||
#ifndef __ARCH_SPR_DEF_H__
|
||||
#define __ARCH_SPR_DEF_H__
|
||||
|
||||
#define SPR_AUX_PERF_COUNT_0 0x6005
|
||||
#define SPR_AUX_PERF_COUNT_1 0x6006
|
||||
#define SPR_AUX_PERF_COUNT_CTL 0x6007
|
||||
#define SPR_AUX_PERF_COUNT_STS 0x6008
|
||||
#define SPR_CYCLE_HIGH 0x4e06
|
||||
#define SPR_CYCLE_LOW 0x4e07
|
||||
#define SPR_DMA_BYTE 0x3900
|
||||
#define SPR_DMA_CHUNK_SIZE 0x3901
|
||||
#define SPR_DMA_CTR 0x3902
|
||||
#define SPR_DMA_CTR__REQUEST_MASK 0x1
|
||||
#define SPR_DMA_CTR__SUSPEND_MASK 0x2
|
||||
#define SPR_DMA_DST_ADDR 0x3903
|
||||
#define SPR_DMA_DST_CHUNK_ADDR 0x3904
|
||||
#define SPR_DMA_SRC_ADDR 0x3905
|
||||
#define SPR_DMA_SRC_CHUNK_ADDR 0x3906
|
||||
#define SPR_DMA_STATUS__DONE_MASK 0x1
|
||||
#define SPR_DMA_STATUS__BUSY_MASK 0x2
|
||||
#define SPR_DMA_STATUS__RUNNING_MASK 0x10
|
||||
#define SPR_DMA_STRIDE 0x3907
|
||||
#define SPR_DMA_USER_STATUS 0x3908
|
||||
#define SPR_DONE 0x4e08
|
||||
#define SPR_EVENT_BEGIN 0x4e0d
|
||||
#define SPR_EVENT_END 0x4e0e
|
||||
#define SPR_EX_CONTEXT_0_0 0x4a05
|
||||
#define SPR_EX_CONTEXT_0_1 0x4a06
|
||||
#define SPR_EX_CONTEXT_0_1__PL_SHIFT 0
|
||||
#define SPR_EX_CONTEXT_0_1__PL_RMASK 0x3
|
||||
#define SPR_EX_CONTEXT_0_1__PL_MASK 0x3
|
||||
#define SPR_EX_CONTEXT_0_1__ICS_SHIFT 2
|
||||
#define SPR_EX_CONTEXT_0_1__ICS_RMASK 0x1
|
||||
#define SPR_EX_CONTEXT_0_1__ICS_MASK 0x4
|
||||
#define SPR_EX_CONTEXT_1_0 0x4805
|
||||
#define SPR_EX_CONTEXT_1_1 0x4806
|
||||
#define SPR_EX_CONTEXT_1_1__PL_SHIFT 0
|
||||
#define SPR_EX_CONTEXT_1_1__PL_RMASK 0x3
|
||||
#define SPR_EX_CONTEXT_1_1__PL_MASK 0x3
|
||||
#define SPR_EX_CONTEXT_1_1__ICS_SHIFT 2
|
||||
#define SPR_EX_CONTEXT_1_1__ICS_RMASK 0x1
|
||||
#define SPR_EX_CONTEXT_1_1__ICS_MASK 0x4
|
||||
#define SPR_FAIL 0x4e09
|
||||
#define SPR_INTCTRL_0_STATUS 0x4a07
|
||||
#define SPR_INTCTRL_1_STATUS 0x4807
|
||||
#define SPR_INTERRUPT_CRITICAL_SECTION 0x4e0a
|
||||
#define SPR_INTERRUPT_MASK_0_0 0x4a08
|
||||
#define SPR_INTERRUPT_MASK_0_1 0x4a09
|
||||
#define SPR_INTERRUPT_MASK_1_0 0x4809
|
||||
#define SPR_INTERRUPT_MASK_1_1 0x480a
|
||||
#define SPR_INTERRUPT_MASK_RESET_0_0 0x4a0a
|
||||
#define SPR_INTERRUPT_MASK_RESET_0_1 0x4a0b
|
||||
#define SPR_INTERRUPT_MASK_RESET_1_0 0x480b
|
||||
#define SPR_INTERRUPT_MASK_RESET_1_1 0x480c
|
||||
#define SPR_INTERRUPT_MASK_SET_0_0 0x4a0c
|
||||
#define SPR_INTERRUPT_MASK_SET_0_1 0x4a0d
|
||||
#define SPR_INTERRUPT_MASK_SET_1_0 0x480d
|
||||
#define SPR_INTERRUPT_MASK_SET_1_1 0x480e
|
||||
#define SPR_MPL_DMA_CPL_SET_0 0x5800
|
||||
#define SPR_MPL_DMA_CPL_SET_1 0x5801
|
||||
#define SPR_MPL_DMA_NOTIFY_SET_0 0x3800
|
||||
#define SPR_MPL_DMA_NOTIFY_SET_1 0x3801
|
||||
#define SPR_MPL_INTCTRL_0_SET_0 0x4a00
|
||||
#define SPR_MPL_INTCTRL_0_SET_1 0x4a01
|
||||
#define SPR_MPL_INTCTRL_1_SET_0 0x4800
|
||||
#define SPR_MPL_INTCTRL_1_SET_1 0x4801
|
||||
#define SPR_MPL_SN_ACCESS_SET_0 0x0800
|
||||
#define SPR_MPL_SN_ACCESS_SET_1 0x0801
|
||||
#define SPR_MPL_SN_CPL_SET_0 0x5a00
|
||||
#define SPR_MPL_SN_CPL_SET_1 0x5a01
|
||||
#define SPR_MPL_SN_FIREWALL_SET_0 0x2c00
|
||||
#define SPR_MPL_SN_FIREWALL_SET_1 0x2c01
|
||||
#define SPR_MPL_SN_NOTIFY_SET_0 0x2a00
|
||||
#define SPR_MPL_SN_NOTIFY_SET_1 0x2a01
|
||||
#define SPR_MPL_UDN_ACCESS_SET_0 0x0c00
|
||||
#define SPR_MPL_UDN_ACCESS_SET_1 0x0c01
|
||||
#define SPR_MPL_UDN_AVAIL_SET_0 0x4000
|
||||
#define SPR_MPL_UDN_AVAIL_SET_1 0x4001
|
||||
#define SPR_MPL_UDN_CA_SET_0 0x3c00
|
||||
#define SPR_MPL_UDN_CA_SET_1 0x3c01
|
||||
#define SPR_MPL_UDN_COMPLETE_SET_0 0x1400
|
||||
#define SPR_MPL_UDN_COMPLETE_SET_1 0x1401
|
||||
#define SPR_MPL_UDN_FIREWALL_SET_0 0x3000
|
||||
#define SPR_MPL_UDN_FIREWALL_SET_1 0x3001
|
||||
#define SPR_MPL_UDN_REFILL_SET_0 0x1000
|
||||
#define SPR_MPL_UDN_REFILL_SET_1 0x1001
|
||||
#define SPR_MPL_UDN_TIMER_SET_0 0x3600
|
||||
#define SPR_MPL_UDN_TIMER_SET_1 0x3601
|
||||
#define SPR_MPL_WORLD_ACCESS_SET_0 0x4e00
|
||||
#define SPR_MPL_WORLD_ACCESS_SET_1 0x4e01
|
||||
#define SPR_PASS 0x4e0b
|
||||
#define SPR_PERF_COUNT_0 0x4205
|
||||
#define SPR_PERF_COUNT_1 0x4206
|
||||
#define SPR_PERF_COUNT_CTL 0x4207
|
||||
#define SPR_PERF_COUNT_STS 0x4208
|
||||
#define SPR_PROC_STATUS 0x4f00
|
||||
#define SPR_SIM_CONTROL 0x4e0c
|
||||
#define SPR_SNCTL 0x0805
|
||||
#define SPR_SNCTL__FRZFABRIC_MASK 0x1
|
||||
#define SPR_SNCTL__FRZPROC_MASK 0x2
|
||||
#define SPR_SNPC 0x080b
|
||||
#define SPR_SNSTATIC 0x080c
|
||||
#define SPR_SYSTEM_SAVE_0_0 0x4b00
|
||||
#define SPR_SYSTEM_SAVE_0_1 0x4b01
|
||||
#define SPR_SYSTEM_SAVE_0_2 0x4b02
|
||||
#define SPR_SYSTEM_SAVE_0_3 0x4b03
|
||||
#define SPR_SYSTEM_SAVE_1_0 0x4900
|
||||
#define SPR_SYSTEM_SAVE_1_1 0x4901
|
||||
#define SPR_SYSTEM_SAVE_1_2 0x4902
|
||||
#define SPR_SYSTEM_SAVE_1_3 0x4903
|
||||
#define SPR_TILE_COORD 0x4c17
|
||||
#define SPR_TILE_RTF_HWM 0x4e10
|
||||
#define SPR_TILE_TIMER_CONTROL 0x3205
|
||||
#define SPR_TILE_WRITE_PENDING 0x4e0f
|
||||
#define SPR_UDN_AVAIL_EN 0x4005
|
||||
#define SPR_UDN_CA_DATA 0x0d00
|
||||
#define SPR_UDN_DATA_AVAIL 0x0d03
|
||||
#define SPR_UDN_DEADLOCK_TIMEOUT 0x3606
|
||||
#define SPR_UDN_DEMUX_CA_COUNT 0x0c05
|
||||
#define SPR_UDN_DEMUX_COUNT_0 0x0c06
|
||||
#define SPR_UDN_DEMUX_COUNT_1 0x0c07
|
||||
#define SPR_UDN_DEMUX_COUNT_2 0x0c08
|
||||
#define SPR_UDN_DEMUX_COUNT_3 0x0c09
|
||||
#define SPR_UDN_DEMUX_CTL 0x0c0a
|
||||
#define SPR_UDN_DEMUX_QUEUE_SEL 0x0c0c
|
||||
#define SPR_UDN_DEMUX_STATUS 0x0c0d
|
||||
#define SPR_UDN_DEMUX_WRITE_FIFO 0x0c0e
|
||||
#define SPR_UDN_DIRECTION_PROTECT 0x3005
|
||||
#define SPR_UDN_REFILL_EN 0x1005
|
||||
#define SPR_UDN_SP_FIFO_DATA 0x0c11
|
||||
#define SPR_UDN_SP_FIFO_SEL 0x0c12
|
||||
#define SPR_UDN_SP_FREEZE 0x0c13
|
||||
#define SPR_UDN_SP_FREEZE__SP_FRZ_MASK 0x1
|
||||
#define SPR_UDN_SP_FREEZE__DEMUX_FRZ_MASK 0x2
|
||||
#define SPR_UDN_SP_FREEZE__NON_DEST_EXT_MASK 0x4
|
||||
#define SPR_UDN_SP_STATE 0x0c14
|
||||
#define SPR_UDN_TAG_0 0x0c15
|
||||
#define SPR_UDN_TAG_1 0x0c16
|
||||
#define SPR_UDN_TAG_2 0x0c17
|
||||
#define SPR_UDN_TAG_3 0x0c18
|
||||
#define SPR_UDN_TAG_VALID 0x0c19
|
||||
#define SPR_UDN_TILE_COORD 0x0c1a
|
||||
|
||||
#endif /* !defined(__ARCH_SPR_DEF_H__) */
|
||||
|
||||
#endif /* !defined(__DOXYGEN__) */
|
||||
3
arch/tile/include/asm/Kbuild
Normal file
3
arch/tile/include/asm/Kbuild
Normal file
@@ -0,0 +1,3 @@
|
||||
include include/asm-generic/Kbuild.asm
|
||||
|
||||
header-y += ucontext.h
|
||||
1
arch/tile/include/asm/asm-offsets.h
Normal file
1
arch/tile/include/asm/asm-offsets.h
Normal file
@@ -0,0 +1 @@
|
||||
#include <generated/asm-offsets.h>
|
||||
159
arch/tile/include/asm/atomic.h
Normal file
159
arch/tile/include/asm/atomic.h
Normal file
@@ -0,0 +1,159 @@
|
||||
/*
|
||||
* Copyright 2010 Tilera Corporation. All Rights Reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, version 2.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
|
||||
* NON INFRINGEMENT. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* Atomic primitives.
|
||||
*/
|
||||
|
||||
#ifndef _ASM_TILE_ATOMIC_H
|
||||
#define _ASM_TILE_ATOMIC_H
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#include <linux/compiler.h>
|
||||
#include <asm/system.h>
|
||||
|
||||
#define ATOMIC_INIT(i) { (i) }
|
||||
|
||||
/**
|
||||
* atomic_read - read atomic variable
|
||||
* @v: pointer of type atomic_t
|
||||
*
|
||||
* Atomically reads the value of @v.
|
||||
*/
|
||||
static inline int atomic_read(const atomic_t *v)
|
||||
{
|
||||
return v->counter;
|
||||
}
|
||||
|
||||
/**
|
||||
* atomic_sub_return - subtract integer and return
|
||||
* @v: pointer of type atomic_t
|
||||
* @i: integer value to subtract
|
||||
*
|
||||
* Atomically subtracts @i from @v and returns @v - @i
|
||||
*/
|
||||
#define atomic_sub_return(i, v) atomic_add_return((int)(-(i)), (v))
|
||||
|
||||
/**
|
||||
* atomic_sub - subtract integer from atomic variable
|
||||
* @i: integer value to subtract
|
||||
* @v: pointer of type atomic_t
|
||||
*
|
||||
* Atomically subtracts @i from @v.
|
||||
*/
|
||||
#define atomic_sub(i, v) atomic_add((int)(-(i)), (v))
|
||||
|
||||
/**
|
||||
* atomic_sub_and_test - subtract value from variable and test result
|
||||
* @i: integer value to subtract
|
||||
* @v: pointer of type atomic_t
|
||||
*
|
||||
* Atomically subtracts @i from @v and returns true if the result is
|
||||
* zero, or false for all other cases.
|
||||
*/
|
||||
#define atomic_sub_and_test(i, v) (atomic_sub_return((i), (v)) == 0)
|
||||
|
||||
/**
|
||||
* atomic_inc_return - increment memory and return
|
||||
* @v: pointer of type atomic_t
|
||||
*
|
||||
* Atomically increments @v by 1 and returns the new value.
|
||||
*/
|
||||
#define atomic_inc_return(v) atomic_add_return(1, (v))
|
||||
|
||||
/**
|
||||
* atomic_dec_return - decrement memory and return
|
||||
* @v: pointer of type atomic_t
|
||||
*
|
||||
* Atomically decrements @v by 1 and returns the new value.
|
||||
*/
|
||||
#define atomic_dec_return(v) atomic_sub_return(1, (v))
|
||||
|
||||
/**
|
||||
* atomic_inc - increment atomic variable
|
||||
* @v: pointer of type atomic_t
|
||||
*
|
||||
* Atomically increments @v by 1.
|
||||
*/
|
||||
#define atomic_inc(v) atomic_add(1, (v))
|
||||
|
||||
/**
|
||||
* atomic_dec - decrement atomic variable
|
||||
* @v: pointer of type atomic_t
|
||||
*
|
||||
* Atomically decrements @v by 1.
|
||||
*/
|
||||
#define atomic_dec(v) atomic_sub(1, (v))
|
||||
|
||||
/**
|
||||
* atomic_dec_and_test - decrement and test
|
||||
* @v: pointer of type atomic_t
|
||||
*
|
||||
* Atomically decrements @v by 1 and returns true if the result is 0.
|
||||
*/
|
||||
#define atomic_dec_and_test(v) (atomic_dec_return(v) == 0)
|
||||
|
||||
/**
|
||||
* atomic_inc_and_test - increment and test
|
||||
* @v: pointer of type atomic_t
|
||||
*
|
||||
* Atomically increments @v by 1 and returns true if the result is 0.
|
||||
*/
|
||||
#define atomic_inc_and_test(v) (atomic_inc_return(v) == 0)
|
||||
|
||||
/**
|
||||
* atomic_add_negative - add and test if negative
|
||||
* @v: pointer of type atomic_t
|
||||
* @i: integer value to add
|
||||
*
|
||||
* Atomically adds @i to @v and returns true if the result is
|
||||
* negative, or false when result is greater than or equal to zero.
|
||||
*/
|
||||
#define atomic_add_negative(i, v) (atomic_add_return((i), (v)) < 0)
|
||||
|
||||
/**
|
||||
* atomic_inc_not_zero - increment unless the number is zero
|
||||
* @v: pointer of type atomic_t
|
||||
*
|
||||
* Atomically increments @v by 1, so long as @v is non-zero.
|
||||
* Returns non-zero if @v was non-zero, and zero otherwise.
|
||||
*/
|
||||
#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
|
||||
|
||||
|
||||
/*
|
||||
* We define xchg() and cmpxchg() in the included headers.
|
||||
* Note that we do not define __HAVE_ARCH_CMPXCHG, since that would imply
|
||||
* that cmpxchg() is an efficient operation, which is not particularly true.
|
||||
*/
|
||||
|
||||
/* Nonexistent functions intended to cause link errors. */
|
||||
extern unsigned long __xchg_called_with_bad_pointer(void);
|
||||
extern unsigned long __cmpxchg_called_with_bad_pointer(void);
|
||||
|
||||
#define tas(ptr) (xchg((ptr), 1))
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
||||
#ifndef __tilegx__
|
||||
#include <asm/atomic_32.h>
|
||||
#else
|
||||
#include <asm/atomic_64.h>
|
||||
#endif
|
||||
|
||||
/* Provide the appropriate atomic_long_t definitions. */
|
||||
#ifndef __ASSEMBLY__
|
||||
#include <asm-generic/atomic-long.h>
|
||||
#endif
|
||||
|
||||
#endif /* _ASM_TILE_ATOMIC_H */
|
||||
353
arch/tile/include/asm/atomic_32.h
Normal file
353
arch/tile/include/asm/atomic_32.h
Normal file
@@ -0,0 +1,353 @@
|
||||
/*
|
||||
* Copyright 2010 Tilera Corporation. All Rights Reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, version 2.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
|
||||
* NON INFRINGEMENT. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* Do not include directly; use <asm/atomic.h>.
|
||||
*/
|
||||
|
||||
#ifndef _ASM_TILE_ATOMIC_32_H
|
||||
#define _ASM_TILE_ATOMIC_32_H
|
||||
|
||||
#include <arch/chip.h>
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
/* Tile-specific routines to support <asm/atomic.h>. */
|
||||
int _atomic_xchg(atomic_t *v, int n);
|
||||
int _atomic_xchg_add(atomic_t *v, int i);
|
||||
int _atomic_xchg_add_unless(atomic_t *v, int a, int u);
|
||||
int _atomic_cmpxchg(atomic_t *v, int o, int n);
|
||||
|
||||
/**
|
||||
* atomic_xchg - atomically exchange contents of memory with a new value
|
||||
* @v: pointer of type atomic_t
|
||||
* @i: integer value to store in memory
|
||||
*
|
||||
* Atomically sets @v to @i and returns old @v
|
||||
*/
|
||||
static inline int atomic_xchg(atomic_t *v, int n)
|
||||
{
|
||||
smp_mb(); /* barrier for proper semantics */
|
||||
return _atomic_xchg(v, n);
|
||||
}
|
||||
|
||||
/**
|
||||
* atomic_cmpxchg - atomically exchange contents of memory if it matches
|
||||
* @v: pointer of type atomic_t
|
||||
* @o: old value that memory should have
|
||||
* @n: new value to write to memory if it matches
|
||||
*
|
||||
* Atomically checks if @v holds @o and replaces it with @n if so.
|
||||
* Returns the old value at @v.
|
||||
*/
|
||||
static inline int atomic_cmpxchg(atomic_t *v, int o, int n)
|
||||
{
|
||||
smp_mb(); /* barrier for proper semantics */
|
||||
return _atomic_cmpxchg(v, o, n);
|
||||
}
|
||||
|
||||
/**
|
||||
* atomic_add - add integer to atomic variable
|
||||
* @i: integer value to add
|
||||
* @v: pointer of type atomic_t
|
||||
*
|
||||
* Atomically adds @i to @v.
|
||||
*/
|
||||
static inline void atomic_add(int i, atomic_t *v)
|
||||
{
|
||||
_atomic_xchg_add(v, i);
|
||||
}
|
||||
|
||||
/**
|
||||
* atomic_add_return - add integer and return
|
||||
* @v: pointer of type atomic_t
|
||||
* @i: integer value to add
|
||||
*
|
||||
* Atomically adds @i to @v and returns @i + @v
|
||||
*/
|
||||
static inline int atomic_add_return(int i, atomic_t *v)
|
||||
{
|
||||
smp_mb(); /* barrier for proper semantics */
|
||||
return _atomic_xchg_add(v, i) + i;
|
||||
}
|
||||
|
||||
/**
|
||||
* atomic_add_unless - add unless the number is already a given value
|
||||
* @v: pointer of type atomic_t
|
||||
* @a: the amount to add to v...
|
||||
* @u: ...unless v is equal to u.
|
||||
*
|
||||
* Atomically adds @a to @v, so long as @v was not already @u.
|
||||
* Returns non-zero if @v was not @u, and zero otherwise.
|
||||
*/
|
||||
static inline int atomic_add_unless(atomic_t *v, int a, int u)
|
||||
{
|
||||
smp_mb(); /* barrier for proper semantics */
|
||||
return _atomic_xchg_add_unless(v, a, u) != u;
|
||||
}
|
||||
|
||||
/**
|
||||
* atomic_set - set atomic variable
|
||||
* @v: pointer of type atomic_t
|
||||
* @i: required value
|
||||
*
|
||||
* Atomically sets the value of @v to @i.
|
||||
*
|
||||
* atomic_set() can't be just a raw store, since it would be lost if it
|
||||
* fell between the load and store of one of the other atomic ops.
|
||||
*/
|
||||
static inline void atomic_set(atomic_t *v, int n)
|
||||
{
|
||||
_atomic_xchg(v, n);
|
||||
}
|
||||
|
||||
#define xchg(ptr, x) ((typeof(*(ptr))) \
|
||||
((sizeof(*(ptr)) == sizeof(atomic_t)) ? \
|
||||
atomic_xchg((atomic_t *)(ptr), (long)(x)) : \
|
||||
__xchg_called_with_bad_pointer()))
|
||||
|
||||
#define cmpxchg(ptr, o, n) ((typeof(*(ptr))) \
|
||||
((sizeof(*(ptr)) == sizeof(atomic_t)) ? \
|
||||
atomic_cmpxchg((atomic_t *)(ptr), (long)(o), (long)(n)) : \
|
||||
__cmpxchg_called_with_bad_pointer()))
|
||||
|
||||
/* A 64bit atomic type */
|
||||
|
||||
typedef struct {
|
||||
u64 __aligned(8) counter;
|
||||
} atomic64_t;
|
||||
|
||||
#define ATOMIC64_INIT(val) { (val) }
|
||||
|
||||
u64 _atomic64_xchg(atomic64_t *v, u64 n);
|
||||
u64 _atomic64_xchg_add(atomic64_t *v, u64 i);
|
||||
u64 _atomic64_xchg_add_unless(atomic64_t *v, u64 a, u64 u);
|
||||
u64 _atomic64_cmpxchg(atomic64_t *v, u64 o, u64 n);
|
||||
|
||||
/**
|
||||
* atomic64_read - read atomic variable
|
||||
* @v: pointer of type atomic64_t
|
||||
*
|
||||
* Atomically reads the value of @v.
|
||||
*/
|
||||
static inline u64 atomic64_read(const atomic64_t *v)
|
||||
{
|
||||
/*
|
||||
* Requires an atomic op to read both 32-bit parts consistently.
|
||||
* Casting away const is safe since the atomic support routines
|
||||
* do not write to memory if the value has not been modified.
|
||||
*/
|
||||
return _atomic64_xchg_add((atomic64_t *)v, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* atomic64_xchg - atomically exchange contents of memory with a new value
|
||||
* @v: pointer of type atomic64_t
|
||||
* @i: integer value to store in memory
|
||||
*
|
||||
* Atomically sets @v to @i and returns old @v
|
||||
*/
|
||||
static inline u64 atomic64_xchg(atomic64_t *v, u64 n)
|
||||
{
|
||||
smp_mb(); /* barrier for proper semantics */
|
||||
return _atomic64_xchg(v, n);
|
||||
}
|
||||
|
||||
/**
|
||||
* atomic64_cmpxchg - atomically exchange contents of memory if it matches
|
||||
* @v: pointer of type atomic64_t
|
||||
* @o: old value that memory should have
|
||||
* @n: new value to write to memory if it matches
|
||||
*
|
||||
* Atomically checks if @v holds @o and replaces it with @n if so.
|
||||
* Returns the old value at @v.
|
||||
*/
|
||||
static inline u64 atomic64_cmpxchg(atomic64_t *v, u64 o, u64 n)
|
||||
{
|
||||
smp_mb(); /* barrier for proper semantics */
|
||||
return _atomic64_cmpxchg(v, o, n);
|
||||
}
|
||||
|
||||
/**
|
||||
* atomic64_add - add integer to atomic variable
|
||||
* @i: integer value to add
|
||||
* @v: pointer of type atomic64_t
|
||||
*
|
||||
* Atomically adds @i to @v.
|
||||
*/
|
||||
static inline void atomic64_add(u64 i, atomic64_t *v)
|
||||
{
|
||||
_atomic64_xchg_add(v, i);
|
||||
}
|
||||
|
||||
/**
|
||||
* atomic64_add_return - add integer and return
|
||||
* @v: pointer of type atomic64_t
|
||||
* @i: integer value to add
|
||||
*
|
||||
* Atomically adds @i to @v and returns @i + @v
|
||||
*/
|
||||
static inline u64 atomic64_add_return(u64 i, atomic64_t *v)
|
||||
{
|
||||
smp_mb(); /* barrier for proper semantics */
|
||||
return _atomic64_xchg_add(v, i) + i;
|
||||
}
|
||||
|
||||
/**
|
||||
* atomic64_add_unless - add unless the number is already a given value
|
||||
* @v: pointer of type atomic64_t
|
||||
* @a: the amount to add to v...
|
||||
* @u: ...unless v is equal to u.
|
||||
*
|
||||
* Atomically adds @a to @v, so long as @v was not already @u.
|
||||
* Returns non-zero if @v was not @u, and zero otherwise.
|
||||
*/
|
||||
static inline u64 atomic64_add_unless(atomic64_t *v, u64 a, u64 u)
|
||||
{
|
||||
smp_mb(); /* barrier for proper semantics */
|
||||
return _atomic64_xchg_add_unless(v, a, u) != u;
|
||||
}
|
||||
|
||||
/**
|
||||
* atomic64_set - set atomic variable
|
||||
* @v: pointer of type atomic64_t
|
||||
* @i: required value
|
||||
*
|
||||
* Atomically sets the value of @v to @i.
|
||||
*
|
||||
* atomic64_set() can't be just a raw store, since it would be lost if it
|
||||
* fell between the load and store of one of the other atomic ops.
|
||||
*/
|
||||
static inline void atomic64_set(atomic64_t *v, u64 n)
|
||||
{
|
||||
_atomic64_xchg(v, n);
|
||||
}
|
||||
|
||||
#define atomic64_add_negative(a, v) (atomic64_add_return((a), (v)) < 0)
|
||||
#define atomic64_inc(v) atomic64_add(1LL, (v))
|
||||
#define atomic64_inc_return(v) atomic64_add_return(1LL, (v))
|
||||
#define atomic64_inc_and_test(v) (atomic64_inc_return(v) == 0)
|
||||
#define atomic64_sub_return(i, v) atomic64_add_return(-(i), (v))
|
||||
#define atomic64_sub_and_test(a, v) (atomic64_sub_return((a), (v)) == 0)
|
||||
#define atomic64_sub(i, v) atomic64_add(-(i), (v))
|
||||
#define atomic64_dec(v) atomic64_sub(1LL, (v))
|
||||
#define atomic64_dec_return(v) atomic64_sub_return(1LL, (v))
|
||||
#define atomic64_dec_and_test(v) (atomic64_dec_return((v)) == 0)
|
||||
#define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1LL, 0LL)
|
||||
|
||||
/*
|
||||
* We need to barrier before modifying the word, since the _atomic_xxx()
|
||||
* routines just tns the lock and then read/modify/write of the word.
|
||||
* But after the word is updated, the routine issues an "mf" before returning,
|
||||
* and since it's a function call, we don't even need a compiler barrier.
|
||||
*/
|
||||
#define smp_mb__before_atomic_dec() smp_mb()
|
||||
#define smp_mb__before_atomic_inc() smp_mb()
|
||||
#define smp_mb__after_atomic_dec() do { } while (0)
|
||||
#define smp_mb__after_atomic_inc() do { } while (0)
|
||||
|
||||
|
||||
/*
|
||||
* Support "tns" atomic integers. These are atomic integers that can
|
||||
* hold any value but "1". They are more efficient than regular atomic
|
||||
* operations because the "lock" (aka acquire) step is a single "tns"
|
||||
* in the uncontended case, and the "unlock" (aka release) step is a
|
||||
* single "store" without an mf. (However, note that on tilepro the
|
||||
* "tns" will evict the local cache line, so it's not all upside.)
|
||||
*
|
||||
* Note that you can ONLY observe the value stored in the pointer
|
||||
* using these operations; a direct read of the value may confusingly
|
||||
* return the special value "1".
|
||||
*/
|
||||
|
||||
int __tns_atomic_acquire(atomic_t *);
|
||||
void __tns_atomic_release(atomic_t *p, int v);
|
||||
|
||||
static inline void tns_atomic_set(atomic_t *v, int i)
|
||||
{
|
||||
__tns_atomic_acquire(v);
|
||||
__tns_atomic_release(v, i);
|
||||
}
|
||||
|
||||
static inline int tns_atomic_cmpxchg(atomic_t *v, int o, int n)
|
||||
{
|
||||
int ret = __tns_atomic_acquire(v);
|
||||
__tns_atomic_release(v, (ret == o) ? n : ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline int tns_atomic_xchg(atomic_t *v, int n)
|
||||
{
|
||||
int ret = __tns_atomic_acquire(v);
|
||||
__tns_atomic_release(v, n);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
|
||||
/*
|
||||
* Internal definitions only beyond this point.
|
||||
*/
|
||||
|
||||
#define ATOMIC_LOCKS_FOUND_VIA_TABLE() \
|
||||
(!CHIP_HAS_CBOX_HOME_MAP() && defined(CONFIG_SMP))
|
||||
|
||||
#if ATOMIC_LOCKS_FOUND_VIA_TABLE()
|
||||
|
||||
/* Number of entries in atomic_lock_ptr[]. */
|
||||
#define ATOMIC_HASH_L1_SHIFT 6
|
||||
#define ATOMIC_HASH_L1_SIZE (1 << ATOMIC_HASH_L1_SHIFT)
|
||||
|
||||
/* Number of locks in each struct pointed to by atomic_lock_ptr[]. */
|
||||
#define ATOMIC_HASH_L2_SHIFT (CHIP_L2_LOG_LINE_SIZE() - 2)
|
||||
#define ATOMIC_HASH_L2_SIZE (1 << ATOMIC_HASH_L2_SHIFT)
|
||||
|
||||
#else /* ATOMIC_LOCKS_FOUND_VIA_TABLE() */
|
||||
|
||||
/*
|
||||
* Number of atomic locks in atomic_locks[]. Must be a power of two.
|
||||
* There is no reason for more than PAGE_SIZE / 8 entries, since that
|
||||
* is the maximum number of pointer bits we can use to index this.
|
||||
* And we cannot have more than PAGE_SIZE / 4, since this has to
|
||||
* fit on a single page and each entry takes 4 bytes.
|
||||
*/
|
||||
#define ATOMIC_HASH_SHIFT (PAGE_SHIFT - 3)
|
||||
#define ATOMIC_HASH_SIZE (1 << ATOMIC_HASH_SHIFT)
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
extern int atomic_locks[];
|
||||
#endif
|
||||
|
||||
#endif /* ATOMIC_LOCKS_FOUND_VIA_TABLE() */
|
||||
|
||||
/*
|
||||
* All the code that may fault while holding an atomic lock must
|
||||
* place the pointer to the lock in ATOMIC_LOCK_REG so the fault code
|
||||
* can correctly release and reacquire the lock. Note that we
|
||||
* mention the register number in a comment in "lib/atomic_asm.S" to help
|
||||
* assembly coders from using this register by mistake, so if it
|
||||
* is changed here, change that comment as well.
|
||||
*/
|
||||
#define ATOMIC_LOCK_REG 20
|
||||
#define ATOMIC_LOCK_REG_NAME r20
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
/* Called from setup to initialize a hash table to point to per_cpu locks. */
|
||||
void __init_atomic_per_cpu(void);
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
/* Support releasing the atomic lock in do_page_fault_ics(). */
|
||||
void __atomic_fault_unlock(int *lock_ptr);
|
||||
#endif
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
|
||||
#endif /* _ASM_TILE_ATOMIC_32_H */
|
||||
20
arch/tile/include/asm/auxvec.h
Normal file
20
arch/tile/include/asm/auxvec.h
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright 2010 Tilera Corporation. All Rights Reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, version 2.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
|
||||
* NON INFRINGEMENT. See the GNU General Public License for
|
||||
* more details.
|
||||
*/
|
||||
|
||||
#ifndef _ASM_TILE_AUXVEC_H
|
||||
#define _ASM_TILE_AUXVEC_H
|
||||
|
||||
/* No extensions to auxvec */
|
||||
|
||||
#endif /* _ASM_TILE_AUXVEC_H */
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user