treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152
[linux-2.6-block.git] / arch / mips / include / asm / sn / arch.h
CommitLineData
1da177e4
LT
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * SGI specific setup.
7 *
8 * Copyright (C) 1995 - 1997, 1999 Silcon Graphics, Inc.
9 * Copyright (C) 1999 Ralf Baechle (ralf@gnu.org)
10 */
11#ifndef _ASM_SN_ARCH_H
12#define _ASM_SN_ARCH_H
13
1da177e4
LT
14#include <linux/types.h>
15#include <asm/sn/types.h>
16#ifdef CONFIG_SGI_IP27
17#include <asm/sn/sn0/arch.h>
18#endif
19
cc6e8e08
RB
20#define cputonasid(cpu) (sn_cpu_info[(cpu)].p_nasid)
21#define cputoslice(cpu) (sn_cpu_info[(cpu)].p_slice)
1da177e4
LT
22#define makespnum(_nasid, _slice) \
23 (((_nasid) << CPUS_PER_NODE_SHFT) | (_slice))
24
25#define INVALID_NASID (nasid_t)-1
26#define INVALID_CNODEID (cnodeid_t)-1
27#define INVALID_PNODEID (pnodeid_t)-1
28#define INVALID_MODULE (moduleid_t)-1
70342287 29#define INVALID_PARTID (partid_t)-1
1da177e4
LT
30
31extern nasid_t get_nasid(void);
32extern cnodeid_t get_cpu_cnode(cpuid_t);
33extern int get_cpu_slice(cpuid_t);
34
35/*
70342287 36 * NO ONE should access these arrays directly. The only reason we refer to
1da177e4
LT
37 * them here is to avoid the procedure call that would be required in the
38 * macros below. (Really want private data members here :-)
39 */
40extern cnodeid_t nasid_to_compact_node[MAX_NASIDS];
41extern nasid_t compact_to_nasid_node[MAX_COMPACT_NODES];
42
43/*
44 * These macros are used by various parts of the kernel to convert
70342287 45 * between the three different kinds of node numbering. At least some
1da177e4
LT
46 * of them may change to procedure calls in the future, but the macros
47 * will continue to work. Don't use the arrays above directly.
48 */
49
70342287 50#define NASID_TO_REGION(nnode) \
1da177e4
LT
51 ((nnode) >> \
52 (is_fine_dirmode() ? NASID_TO_FINEREG_SHFT : NASID_TO_COARSEREG_SHFT))
53
54extern cnodeid_t nasid_to_compact_node[MAX_NASIDS];
55extern nasid_t compact_to_nasid_node[MAX_COMPACT_NODES];
56extern cnodeid_t cpuid_to_compact_node[MAXCPUS];
57
58#define NASID_TO_COMPACT_NODEID(nnode) (nasid_to_compact_node[nnode])
59#define COMPACT_TO_NASID_NODEID(cnode) (compact_to_nasid_node[cnode])
60#define CPUID_TO_COMPACT_NODEID(cpu) (cpuid_to_compact_node[(cpu)])
61
62#endif /* _ASM_SN_ARCH_H */