3 * This file is subject to the terms and conditions of the GNU General Public
4 * License. See the file "COPYING" in the main directory of this archive
7 * Copyright (c) 2001-2003 Silicon Graphics, Inc. All rights reserved.
10 #ifndef _ASM_IA64_SN_FETCHOP_H
11 #define _ASM_IA64_SN_FETCHOP_H
13 #include <linux/config.h>
15 #define FETCHOP_BASENAME "sgi_fetchop"
16 #define FETCHOP_FULLNAME "/dev/sgi_fetchop"
20 #define FETCHOP_VAR_SIZE 64 /* 64 byte per fetchop variable */
22 #define FETCHOP_LOAD 0
23 #define FETCHOP_INCREMENT 8
24 #define FETCHOP_DECREMENT 16
25 #define FETCHOP_CLEAR 24
27 #define FETCHOP_STORE 0
28 #define FETCHOP_AND 24
31 #define FETCHOP_CLEAR_CACHE 56
33 #define FETCHOP_LOAD_OP(addr, op) ( \
34 *(volatile long *)((char*) (addr) + (op)))
36 #define FETCHOP_STORE_OP(addr, op, x) ( \
37 *(volatile long *)((char*) (addr) + (op)) = (long) (x))
42 * Convert a region 6 (kaddr) address to the address of the fetchop variable
44 #define FETCHOP_KADDR_TO_MSPEC_ADDR(kaddr) TO_MSPEC(kaddr)
48 * Each Atomic Memory Operation (AMO formerly known as fetchop)
49 * variable is 64 bytes long. The first 8 bytes are used. The
50 * remaining 56 bytes are unaddressable due to the operation taking
51 * that portion of the address.
53 * NOTE: The AMO_t _MUST_ be placed in either the first or second half
54 * of the cache line. The cache line _MUST NOT_ be used for anything
55 * other than additional AMO_t entries. This is because there are two
56 * addresses which reference the same physical cache line. One will
57 * be a cached entry with the memory type bits all set. This address
58 * may be loaded into processor cache. The AMO_t will be referenced
59 * uncached via the memory special memory type. If any portion of the
60 * cached cache-line is modified, when that line is flushed, it will
61 * overwrite the uncached value in physical memory and lead to
71 * The following APIs are externalized to the kernel to allocate/free pages of
73 * fetchop_kalloc_page - Allocate/initialize 1 fetchop page on the
75 * fetchop_kfree_page - Free a previously allocated fetchop page
78 unsigned long fetchop_kalloc_page(int nid);
79 void fetchop_kfree_page(unsigned long maddr);
82 #endif /* __KERNEL__ */
84 #endif /* _ASM_IA64_SN_FETCHOP_H */