patch-2_6_7-vs1_9_1_12
[linux-2.6.git] / include / asm-ia64 / sn / nodepda.h
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  * Copyright (C) 1992 - 1997, 2000-2003 Silicon Graphics, Inc. All rights reserved.
7  */
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/intr.h>
15 #include <asm/sn/router.h>
16 #include <asm/sn/pda.h>
17 #include <asm/sn/module.h>
18 #include <asm/sn/bte.h>
19 #include <asm/sn/sn2/arch.h>
20
21 /*
22  * NUMA Node-Specific Data structures are defined in this file.
23  * In particular, this is the location of the node PDA.
24  * A pointer to the right node PDA is saved in each CPU PDA.
25  */
26
27 /*
28  * Node-specific data structure.
29  *
30  * One of these structures is allocated on each node of a NUMA system.
31  *
32  * This structure provides a convenient way of keeping together 
33  * all per-node data structures. 
34  */
35
36
37
38 struct nodepda_s {
39         vertex_hdl_t    xbow_vhdl;
40         nasid_t         xbow_peer;      /* NASID of our peer hub on xbow */
41         struct semaphore xbow_sema;     /* Sema for xbow synchronization */
42         slotid_t        slotdesc;
43         geoid_t         geoid;
44         module_t        *module;        /* Pointer to containing module */
45         xwidgetnum_t    basew_id;
46         vertex_hdl_t    basew_xc;
47         int             hubticks;
48         int             num_routers;    /* XXX not setup! Total routers in the system */
49
50         
51         char            *hwg_node_name; /* hwgraph node name */
52         vertex_hdl_t    node_vertex;    /* Hwgraph vertex for this node */
53
54         void            *pdinfo;        /* Platform-dependent per-node info */
55
56
57         nodepda_router_info_t   *npda_rip_first;
58         nodepda_router_info_t   **npda_rip_last;
59
60
61         spinlock_t              bist_lock;
62
63         /*
64          * The BTEs on this node are shared by the local cpus
65          */
66         struct bteinfo_s        bte_if[BTES_PER_NODE];  /* Virtual Interface */
67         struct timer_list       bte_recovery_timer;
68         spinlock_t              bte_recovery_lock;
69
70         /* 
71          * Array of pointers to the nodepdas for each node.
72          */
73         struct nodepda_s        *pernode_pdaindr[MAX_COMPACT_NODES]; 
74
75 };
76
77 typedef struct nodepda_s nodepda_t;
78
79 struct irqpda_s {
80         int num_irq_used;
81         char irq_flags[NR_IRQS];
82         struct pci_dev *device_dev[NR_IRQS];
83         char share_count[NR_IRQS];
84         struct pci_dev *curr;
85 };
86
87 typedef struct irqpda_s irqpda_t;
88
89
90 /*
91  * Access Functions for node PDA.
92  * Since there is one nodepda for each node, we need a convenient mechanism
93  * to access these nodepdas without cluttering code with #ifdefs.
94  * The next set of definitions provides this.
95  * Routines are expected to use 
96  *
97  *      nodepda                 -> to access node PDA for the node on which code is running
98  *      subnodepda              -> to access subnode PDA for the subnode on which code is running
99  *
100  *      NODEPDA(cnode)          -> to access node PDA for cnodeid 
101  *      SUBNODEPDA(cnode,sn)    -> to access subnode PDA for cnodeid/subnode
102  */
103
104 #define nodepda         pda->p_nodepda          /* Ptr to this node's PDA */
105 #define NODEPDA(cnode)          (nodepda->pernode_pdaindr[cnode])
106
107
108 /*
109  * Macros to access data structures inside nodepda 
110  */
111 #define NODE_MODULEID(cnode)    geo_module((NODEPDA(cnode)->geoid))
112 #define NODE_SLOTID(cnode)      (NODEPDA(cnode)->slotdesc)
113
114
115 /*
116  * Quickly convert a compact node ID into a hwgraph vertex
117  */
118 #define cnodeid_to_vertex(cnodeid) (NODEPDA(cnodeid)->node_vertex)
119
120
121 /*
122  * Check if given a compact node id the corresponding node has all the
123  * cpus disabled. 
124  */
125 #define is_headless_node(cnode)         (nr_cpus_node(cnode) == 0)
126
127 /*
128  * Check if given a node vertex handle the corresponding node has all the
129  * cpus disabled. 
130  */
131 #define is_headless_node_vertex(_nodevhdl) \
132                         is_headless_node(nodevertex_to_cnodeid(_nodevhdl))
133
134
135 #endif /* _ASM_IA64_SN_NODEPDA_H */