patch-2_6_7-vs1_9_1_12
[linux-2.6.git] / include / asm-ia64 / sn / sn2 / sn_private.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_SN2_SN_PRIVATE_H
9 #define _ASM_IA64_SN_SN2_SN_PRIVATE_H
10
11 #include <linux/wait.h>
12 #include <asm/sn/nodepda.h>
13 #include <asm/sn/io.h>
14 #include <asm/sn/iograph.h>
15 #include <asm/sn/xtalk/xwidget.h>
16 #include <asm/sn/xtalk/xtalk_private.h>
17
18 extern nasid_t master_nasid;
19
20 /* promif.c */
21 extern void he_arcs_set_vectors(void);
22 extern void mem_init(void);
23 extern void cpu_unenable(cpuid_t);
24 extern nasid_t get_lowest_nasid(void);
25 extern unsigned long get_master_bridge_base(void);
26 extern int check_nasid_equiv(nasid_t, nasid_t);
27 extern char get_console_pcislot(void);
28
29 extern int is_master_baseio_nasid_widget(nasid_t test_nasid,
30                                          xwidgetnum_t test_wid);
31
32 /* memsupport.c */
33 extern void poison_state_alter_range(unsigned long start, int len, int poison);
34 extern int memory_present(paddr_t);
35 extern int memory_read_accessible(paddr_t);
36 extern int memory_write_accessible(paddr_t);
37 extern void memory_set_access(paddr_t, int, int);
38 extern void show_dir_state(paddr_t, void (*)(char *, ...));
39 extern void check_dir_state(nasid_t, int, void (*)(char *, ...));
40 extern void set_dir_owner(paddr_t, int);
41 extern void set_dir_state(paddr_t, int);
42 extern void set_dir_state_POISONED(paddr_t);
43 extern void set_dir_state_UNOWNED(paddr_t);
44 extern int is_POISONED_dir_state(paddr_t);
45 extern int is_UNOWNED_dir_state(paddr_t);
46 #ifdef LATER
47 extern void get_dir_ent(paddr_t paddr, int *state,
48                         uint64_t * vec_ptr, hubreg_t * elo);
49 #endif
50
51 /* intr.c */
52 extern void intr_unreserve_level(cpuid_t cpu, int level);
53 extern int intr_connect_level(cpuid_t cpu, int bit);
54 extern int intr_disconnect_level(cpuid_t cpu, int bit);
55 extern cpuid_t intr_heuristic(vertex_hdl_t dev, int req_bit, int *resp_bit);
56 extern void intr_block_bit(cpuid_t cpu, int bit);
57 extern void intr_unblock_bit(cpuid_t cpu, int bit);
58 extern void setrtvector(intr_func_t);
59 extern void install_cpuintr(cpuid_t cpu);
60 extern void install_dbgintr(cpuid_t cpu);
61 extern void install_tlbintr(cpuid_t cpu);
62 extern void hub_migrintr_init(cnodeid_t /*cnode */ );
63 extern int cause_intr_connect(int level, intr_func_t handler,
64                               unsigned int intr_spl_mask);
65 extern int cause_intr_disconnect(int level);
66 extern void intr_dumpvec(cnodeid_t cnode, void (*pf) (char *, ...));
67
68 /* error_dump.c */
69 extern char *hub_rrb_err_type[];
70 extern char *hub_wrb_err_type[];
71
72 void nmi_dump(void);
73 void install_cpu_nmi_handler(int slice);
74
75 /* klclock.c */
76 extern void hub_rtc_init(cnodeid_t);
77
78 /* bte.c */
79 void bte_lateinit(void);
80 void bte_wait_for_xfer_completion(void *);
81
82 /* klgraph.c */
83 void klhwg_add_all_nodes(vertex_hdl_t);
84 void klhwg_add_all_modules(vertex_hdl_t);
85
86 /* klidbg.c */
87 void install_klidbg_functions(void);
88
89 /* klnuma.c */
90 extern void replicate_kernel_text(int numnodes);
91 extern unsigned long get_freemem_start(cnodeid_t cnode);
92 extern void setup_replication_mask(int maxnodes);
93
94 /* init.c */
95 extern cnodeid_t get_compact_nodeid(void);      /* get compact node id */
96 extern void init_platform_nodepda(nodepda_t * npda, cnodeid_t node);
97 extern int is_fine_dirmode(void);
98 extern void update_node_information(cnodeid_t);
99
100 /* shubio.c */
101 extern void hubio_init(void);
102 extern void hub_merge_clean(nasid_t nasid);
103 extern void hub_set_piomode(nasid_t nasid, int conveyor);
104
105 /* shuberror.c */
106 extern void hub_error_init(cnodeid_t);
107 extern void dump_error_spool(cpuid_t cpu, void (*pf) (char *, ...));
108 extern void hubni_error_handler(char *, int);
109 extern int check_ni_errors(void);
110
111 /* Used for debugger to signal upper software a breakpoint has taken place */
112
113 extern void *debugger_update;
114 extern unsigned long debugger_stopped;
115
116 /* 
117  * piomap, created by shub_pio_alloc.
118  * xtalk_info MUST BE FIRST, since this structure is cast to a
119  * xtalk_piomap_s by generic xtalk routines.
120  */
121 struct hub_piomap_s {
122         struct xtalk_piomap_s hpio_xtalk_info;  /* standard crosstalk pio info */
123         vertex_hdl_t hpio_hub;  /* which shub's mapping registers are set up */
124         short hpio_holdcnt;     /* count of current users of bigwin mapping */
125         char hpio_bigwin_num;   /* if big window map, which one */
126         int hpio_flags;         /* defined below */
127 };
128 /* hub_piomap flags */
129 #define HUB_PIOMAP_IS_VALID             0x1
130 #define HUB_PIOMAP_IS_BIGWINDOW         0x2
131 #define HUB_PIOMAP_IS_FIXED             0x4
132
133 #define hub_piomap_xt_piomap(hp)        (&hp->hpio_xtalk_info)
134 #define hub_piomap_hub_v(hp)    (hp->hpio_hub)
135 #define hub_piomap_winnum(hp)   (hp->hpio_bigwin_num)
136
137 /* 
138  * dmamap, created by shub_pio_alloc.
139  * xtalk_info MUST BE FIRST, since this structure is cast to a
140  * xtalk_dmamap_s by generic xtalk routines.
141  */
142 struct hub_dmamap_s {
143         struct xtalk_dmamap_s hdma_xtalk_info;  /* standard crosstalk dma info */
144         vertex_hdl_t hdma_hub;  /* which shub we go through */
145         int hdma_flags;         /* defined below */
146 };
147 /* shub_dmamap flags */
148 #define HUB_DMAMAP_IS_VALID             0x1
149 #define HUB_DMAMAP_USED                 0x2
150 #define HUB_DMAMAP_IS_FIXED             0x4
151
152 /* 
153  * interrupt handle, created by shub_intr_alloc.
154  * xtalk_info MUST BE FIRST, since this structure is cast to a
155  * xtalk_intr_s by generic xtalk routines.
156  */
157 struct hub_intr_s {
158         struct xtalk_intr_s i_xtalk_info;       /* standard crosstalk intr info */
159         cpuid_t i_cpuid;        /* which cpu */
160         int i_bit;              /* which bit */
161         int i_flags;
162 };
163 /* flag values */
164 #define HUB_INTR_IS_ALLOCED     0x1     /* for debug: allocated */
165 #define HUB_INTR_IS_CONNECTED   0x4     /* for debug: connected to a software driver */
166
167 typedef struct hubinfo_s {
168         nodepda_t *h_nodepda;   /* pointer to node's private data area */
169         cnodeid_t h_cnodeid;    /* compact nodeid */
170         nasid_t h_nasid;        /* nasid */
171
172         /* structures for PIO management */
173         xwidgetnum_t h_widgetid;        /* my widget # (as viewed from xbow) */
174         struct hub_piomap_s h_small_window_piomap[HUB_WIDGET_ID_MAX + 1];
175         wait_queue_head_t h_bwwait;     /* wait for big window to free */
176         spinlock_t h_bwlock;            /* guard big window piomap's */
177         spinlock_t h_crblock;           /* gaurd CRB error handling */
178         int h_num_big_window_fixed;     /* count number of FIXED maps */
179         struct hub_piomap_s h_big_window_piomap[HUB_NUM_BIG_WINDOW];
180         hub_intr_t hub_ii_errintr;
181 } *hubinfo_t;
182
183 #define hubinfo_get(vhdl, infoptr) ((void)hwgraph_info_get_LBL \
184         (vhdl, INFO_LBL_NODE_INFO, (arbitrary_info_t *)infoptr))
185
186 #define hubinfo_set(vhdl, infoptr) (void)hwgraph_info_add_LBL \
187         (vhdl, INFO_LBL_NODE_INFO, (arbitrary_info_t)infoptr)
188
189 #define hubinfo_to_hubv(hinfo, hub_v)   (hinfo->h_nodepda->node_vertex)
190
191 /*
192  * Hub info PIO map access functions.
193  */
194 #define hubinfo_bwin_piomap_get(hinfo, win)     \
195                         (&hinfo->h_big_window_piomap[win])
196 #define hubinfo_swin_piomap_get(hinfo, win)     \
197                         (&hinfo->h_small_window_piomap[win])
198
199 /* cpu-specific information stored under INFO_LBL_CPU_INFO */
200 typedef struct cpuinfo_s {
201         cpuid_t ci_cpuid;       /* CPU ID */
202 } *cpuinfo_t;
203
204 #define cpuinfo_get(vhdl, infoptr) ((void)hwgraph_info_get_LBL \
205         (vhdl, INFO_LBL_CPU_INFO, (arbitrary_info_t *)infoptr))
206
207 #define cpuinfo_set(vhdl, infoptr) (void)hwgraph_info_add_LBL \
208         (vhdl, INFO_LBL_CPU_INFO, (arbitrary_info_t)infoptr)
209
210 /* Special initialization function for xswitch vertices created during startup. */
211 extern void xswitch_vertex_init(vertex_hdl_t xswitch);
212
213 extern xtalk_provider_t hub_provider;
214 extern int numionodes;
215
216 /* du.c */
217 int ducons_write(char *buf, int len);
218
219 /* memerror.c */
220
221 extern void install_eccintr(cpuid_t cpu);
222 extern void memerror_get_stats(cnodeid_t cnode,
223                                int *bank_stats, int *bank_stats_max);
224 extern void probe_md_errors(nasid_t);
225 /* sysctlr.c */
226 extern void sysctlr_init(void);
227 extern void sysctlr_power_off(int sdonly);
228 extern void sysctlr_keepalive(void);
229
230 #define valid_cpuid(_x)         (((_x) >= 0) && ((_x) < maxcpus))
231
232 /* Useful definitions to get the memory dimm given a physical
233  * address.
234  */
235 #define paddr_dimm(_pa)         ((_pa & MD_BANK_MASK) >> MD_BANK_SHFT)
236 #define paddr_cnode(_pa)        (nasid_to_cnodeid(NASID_GET(_pa)))
237 extern void membank_pathname_get(paddr_t, char *);
238
239 extern void crbx(nasid_t nasid, void (*pf) (char *, ...));
240 void bootstrap(void);
241
242 /* sndrv.c */
243 extern int sndrv_attach(vertex_hdl_t vertex);
244
245 #endif                          /* _ASM_IA64_SN_SN2_SN_PRIVATE_H */