drm/rockchip: vop2: Fix the windows switch between different layers
[drm/drm-misc.git] / arch / mips / include / asm / octeon / cvmx-scratch.h
blob8d21cc5e4e40bfa11df90d7c3a457e8f294989e2
1 /***********************license start***************
2 * Author: Cavium Networks
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
7 * Copyright (c) 2003-2008 Cavium Networks
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
28 /**
30 * This file provides support for the processor local scratch memory.
31 * Scratch memory is byte addressable - all addresses are byte addresses.
35 #ifndef __CVMX_SCRATCH_H__
36 #define __CVMX_SCRATCH_H__
39 * Note: This define must be a long, not a long long in order to
40 * compile without warnings for both 32bit and 64bit.
42 #define CVMX_SCRATCH_BASE (-32768l) /* 0xffffffffffff8000 */
44 /**
45 * Reads an 8 bit value from the processor local scratchpad memory.
47 * @address: byte address to read from
49 * Returns value read
51 static inline uint8_t cvmx_scratch_read8(uint64_t address)
53 return *CASTPTR(volatile uint8_t, CVMX_SCRATCH_BASE + address);
56 /**
57 * Reads a 16 bit value from the processor local scratchpad memory.
59 * @address: byte address to read from
61 * Returns value read
63 static inline uint16_t cvmx_scratch_read16(uint64_t address)
65 return *CASTPTR(volatile uint16_t, CVMX_SCRATCH_BASE + address);
68 /**
69 * Reads a 32 bit value from the processor local scratchpad memory.
71 * @address: byte address to read from
73 * Returns value read
75 static inline uint32_t cvmx_scratch_read32(uint64_t address)
77 return *CASTPTR(volatile uint32_t, CVMX_SCRATCH_BASE + address);
80 /**
81 * Reads a 64 bit value from the processor local scratchpad memory.
83 * @address: byte address to read from
85 * Returns value read
87 static inline uint64_t cvmx_scratch_read64(uint64_t address)
89 return *CASTPTR(volatile uint64_t, CVMX_SCRATCH_BASE + address);
92 /**
93 * Writes an 8 bit value to the processor local scratchpad memory.
95 * @address: byte address to write to
96 * @value: value to write
98 static inline void cvmx_scratch_write8(uint64_t address, uint64_t value)
100 *CASTPTR(volatile uint8_t, CVMX_SCRATCH_BASE + address) =
101 (uint8_t) value;
105 * Writes a 32 bit value to the processor local scratchpad memory.
107 * @address: byte address to write to
108 * @value: value to write
110 static inline void cvmx_scratch_write16(uint64_t address, uint64_t value)
112 *CASTPTR(volatile uint16_t, CVMX_SCRATCH_BASE + address) =
113 (uint16_t) value;
117 * Writes a 16 bit value to the processor local scratchpad memory.
119 * @address: byte address to write to
120 * @value: value to write
122 static inline void cvmx_scratch_write32(uint64_t address, uint64_t value)
124 *CASTPTR(volatile uint32_t, CVMX_SCRATCH_BASE + address) =
125 (uint32_t) value;
129 * Writes a 64 bit value to the processor local scratchpad memory.
131 * @address: byte address to write to
132 * @value: value to write
134 static inline void cvmx_scratch_write64(uint64_t address, uint64_t value)
136 *CASTPTR(volatile uint64_t, CVMX_SCRATCH_BASE + address) = value;
139 #endif /* __CVMX_SCRATCH_H__ */