blob: 6f6d69e39ff59075af1637eb986ae1aefb855bc9 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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 *
Russ Anderson95ff4392005-04-25 13:19:11 -07006 * Copyright (C) 1992 - 1997, 2000-2005 Silicon Graphics, Inc. All rights reserved.
Linus Torvalds1da177e2005-04-16 15:20:36 -07007 */
8#ifndef _ASM_IA64_SN_NODEPDA_H
9#define _ASM_IA64_SN_NODEPDA_H
10
11
12#include <asm/semaphore.h>
13#include <asm/irq.h>
14#include <asm/sn/arch.h>
15#include <asm/sn/intr.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070016#include <asm/sn/bte.h>
17
18/*
19 * NUMA Node-Specific Data structures are defined in this file.
20 * In particular, this is the location of the node PDA.
21 * A pointer to the right node PDA is saved in each CPU PDA.
22 */
23
24/*
25 * Node-specific data structure.
26 *
27 * One of these structures is allocated on each node of a NUMA system.
28 *
29 * This structure provides a convenient way of keeping together
30 * all per-node data structures.
31 */
32struct phys_cpuid {
33 short nasid;
34 char subnode;
35 char slice;
36};
37
38struct nodepda_s {
39 void *pdinfo; /* Platform-dependent per-node info */
Linus Torvalds1da177e2005-04-16 15:20:36 -070040
41 /*
42 * The BTEs on this node are shared by the local cpus
43 */
Russ Anderson95ff4392005-04-25 13:19:11 -070044 struct bteinfo_s bte_if[MAX_BTES_PER_NODE]; /* Virtual Interface */
Linus Torvalds1da177e2005-04-16 15:20:36 -070045 struct timer_list bte_recovery_timer;
46 spinlock_t bte_recovery_lock;
47
48 /*
49 * Array of pointers to the nodepdas for each node.
50 */
51 struct nodepda_s *pernode_pdaindr[MAX_COMPACT_NODES];
52
53 /*
54 * Array of physical cpu identifiers. Indexed by cpuid.
55 */
56 struct phys_cpuid phys_cpuid[NR_CPUS];
Jack Steiner470ceb02005-08-11 10:28:00 -070057 spinlock_t ptc_lock ____cacheline_aligned_in_smp;
Linus Torvalds1da177e2005-04-16 15:20:36 -070058};
59
60typedef struct nodepda_s nodepda_t;
61
62/*
63 * Access Functions for node PDA.
64 * Since there is one nodepda for each node, we need a convenient mechanism
65 * to access these nodepdas without cluttering code with #ifdefs.
66 * The next set of definitions provides this.
67 * Routines are expected to use
68 *
Dean Nelson9b48b462005-03-22 16:00:00 -070069 * sn_nodepda - to access node PDA for the node on which code is running
70 * NODEPDA(cnodeid) - to access node PDA for cnodeid
Linus Torvalds1da177e2005-04-16 15:20:36 -070071 */
72
Dean Nelson9b48b462005-03-22 16:00:00 -070073DECLARE_PER_CPU(struct nodepda_s *, __sn_nodepda);
74#define sn_nodepda (__get_cpu_var(__sn_nodepda))
75#define NODEPDA(cnodeid) (sn_nodepda->pernode_pdaindr[cnodeid])
Linus Torvalds1da177e2005-04-16 15:20:36 -070076
77/*
78 * Check if given a compact node id the corresponding node has all the
79 * cpus disabled.
80 */
Dean Nelson9b48b462005-03-22 16:00:00 -070081#define is_headless_node(cnodeid) (nr_cpus_node(cnodeid) == 0)
Linus Torvalds1da177e2005-04-16 15:20:36 -070082
83#endif /* _ASM_IA64_SN_NODEPDA_H */