File: /usr/src/linux/include/asm-ia64/sn/sn_private.h
1 /* $Id$
2 *
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
5 * for more details.
6 *
7 * Copyright (C) 1992 - 1997, 2000 Silicon Graphics, Inc.
8 * Copyright (C) 2000 by Colin Ngam
9 */
10 #ifndef _ASM_SN_PRIVATE_H
11 #define _ASM_SN_PRIVATE_H
12
13 #include <asm/sn/nodepda.h>
14 #include <asm/sn/xtalk/xwidget.h>
15 #include <asm/sn/xtalk/xtalk_private.h>
16
17 extern nasid_t master_nasid;
18
19 extern hubreg_t get_region(cnodeid_t);
20 extern hubreg_t nasid_to_region(nasid_t);
21 /* promif.c */
22 #ifdef LATER
23 extern cpuid_t cpu_node_probe(cpumask_t *cpumask, int *numnodes);
24 #endif
25 extern void he_arcs_set_vectors(void);
26 extern void mem_init(void);
27 #ifdef LATER
28 extern int cpu_enabled(cpuid_t);
29 #endif
30 extern void cpu_unenable(cpuid_t);
31 extern nasid_t get_lowest_nasid(void);
32 extern __psunsigned_t get_master_bridge_base(void);
33 extern void set_master_bridge_base(void);
34 extern int check_nasid_equiv(nasid_t, nasid_t);
35 extern nasid_t get_console_nasid(void);
36 extern char get_console_pcislot(void);
37 #ifdef LATER
38 extern void intr_init_vecblk(nodepda_t *npda, cnodeid_t, int);
39 #endif
40
41 extern int is_master_nasid_widget(nasid_t test_nasid, xwidgetnum_t test_wid);
42
43 /* memsupport.c */
44 extern void poison_state_alter_range(__psunsigned_t start, int len, int poison);
45 extern int memory_present(paddr_t);
46 extern int memory_read_accessible(paddr_t);
47 extern int memory_write_accessible(paddr_t);
48 extern void memory_set_access(paddr_t, int, int);
49 extern void show_dir_state(paddr_t, void (*)(char *, ...));
50 extern void check_dir_state(nasid_t, int, void (*)(char *, ...));
51 extern void set_dir_owner(paddr_t, int);
52 extern void set_dir_state(paddr_t, int);
53 extern void set_dir_state_POISONED(paddr_t);
54 extern void set_dir_state_UNOWNED(paddr_t);
55 extern int is_POISONED_dir_state(paddr_t);
56 extern int is_UNOWNED_dir_state(paddr_t);
57 extern void get_dir_ent(paddr_t paddr, int *state,
58 uint64_t *vec_ptr, hubreg_t *elo);
59
60 /* intr.c */
61 #if defined(NEW_INTERRUPTS)
62 extern int intr_reserve_level(cpuid_t cpu, int level, int err, devfs_handle_t owner_dev, char *name);
63 extern void intr_unreserve_level(cpuid_t cpu, int level);
64 extern int intr_connect_level(cpuid_t cpu, int bit, ilvl_t mask_no,
65 intr_func_t intr_func, void *intr_arg,
66 intr_func_t intr_prefunc);
67 extern int intr_disconnect_level(cpuid_t cpu, int bit);
68 extern cpuid_t intr_heuristic(devfs_handle_t dev, device_desc_t dev_desc,
69 int req_bit,int intr_resflags,devfs_handle_t owner_dev,
70 char *intr_name,int *resp_bit);
71 #endif /* NEW_INTERRUPTS */
72 extern void intr_block_bit(cpuid_t cpu, int bit);
73 extern void intr_unblock_bit(cpuid_t cpu, int bit);
74 extern void setrtvector(intr_func_t);
75 extern void install_cpuintr(cpuid_t cpu);
76 extern void install_dbgintr(cpuid_t cpu);
77 extern void install_tlbintr(cpuid_t cpu);
78 extern void hub_migrintr_init(cnodeid_t /*cnode*/);
79 extern int cause_intr_connect(int level, intr_func_t handler, uint intr_spl_mask);
80 extern int cause_intr_disconnect(int level);
81 extern void intr_reserve_hardwired(cnodeid_t);
82 extern void intr_clear_all(nasid_t);
83 extern void intr_dumpvec(cnodeid_t cnode, void (*pf)(char *, ...));
84 extern int protected_broadcast(hubreg_t intrbit);
85
86 /* error_dump.c */
87 extern char *hub_rrb_err_type[];
88 extern char *hub_wrb_err_type[];
89
90 void nmi_dump(void);
91 void install_cpu_nmi_handler(int slice);
92
93 /* klclock.c */
94 extern void hub_rtc_init(cnodeid_t);
95
96 /* bte.c */
97 void bte_lateinit(void);
98 void bte_wait_for_xfer_completion(void *);
99
100 /* klgraph.c */
101 void klhwg_add_all_nodes(devfs_handle_t);
102 void klhwg_add_all_modules(devfs_handle_t);
103
104 /* klidbg.c */
105 void install_klidbg_functions(void);
106
107 /* klnuma.c */
108 extern void replicate_kernel_text(int numnodes);
109 extern __psunsigned_t get_freemem_start(cnodeid_t cnode);
110 extern void setup_replication_mask(int maxnodes);
111
112 /* init.c */
113 extern cnodeid_t get_compact_nodeid(void); /* get compact node id */
114 #ifdef LATER
115 extern void init_platform_nodepda(nodepda_t *npda, cnodeid_t node);
116 extern void init_platform_pda(pda_t *ppda, cpuid_t cpu);
117 #endif
118 extern void per_cpu_init(void);
119 extern void per_hub_init(cnodeid_t);
120 #ifdef LATER
121 extern cpumask_t boot_cpumask;
122 #endif
123 extern int is_fine_dirmode(void);
124 extern void update_node_information(cnodeid_t);
125
126 #ifdef LATER
127 /* clksupport.c */
128 extern void early_counter_intr(eframe_t *);
129 #endif
130
131 /* hubio.c */
132 extern void hubio_init(void);
133 extern void hub_merge_clean(nasid_t nasid);
134 extern void hub_set_piomode(nasid_t nasid, int conveyor);
135
136 /* huberror.c */
137 extern void hub_error_init(cnodeid_t);
138 extern void dump_error_spool(cpuid_t cpu, void (*pf)(char *, ...));
139 extern void hubni_error_handler(char *, int);
140 extern int check_ni_errors(void);
141
142 /* Used for debugger to signal upper software a breakpoint has taken place */
143
144 extern void *debugger_update;
145 extern __psunsigned_t debugger_stopped;
146
147 /*
148 * IP27 piomap, created by hub_pio_alloc.
149 * xtalk_info MUST BE FIRST, since this structure is cast to a
150 * xtalk_piomap_s by generic xtalk routines.
151 */
152 struct hub_piomap_s {
153 struct xtalk_piomap_s hpio_xtalk_info;/* standard crosstalk pio info */
154 devfs_handle_t hpio_hub; /* which hub's mapping registers are set up */
155 short hpio_holdcnt; /* count of current users of bigwin mapping */
156 char hpio_bigwin_num;/* if big window map, which one */
157 int hpio_flags; /* defined below */
158 };
159 /* hub_piomap flags */
160 #define HUB_PIOMAP_IS_VALID 0x1
161 #define HUB_PIOMAP_IS_BIGWINDOW 0x2
162 #define HUB_PIOMAP_IS_FIXED 0x4
163
164 #define hub_piomap_xt_piomap(hp) (&hp->hpio_xtalk_info)
165 #define hub_piomap_hub_v(hp) (hp->hpio_hub)
166 #define hub_piomap_winnum(hp) (hp->hpio_bigwin_num)
167
168 #if TBD
169 /* Ensure that hpio_xtalk_info is first */
170 #assert (&(((struct hub_piomap_s *)0)->hpio_xtalk_info) == 0)
171 #endif
172
173
174 /*
175 * IP27 dmamap, created by hub_pio_alloc.
176 * xtalk_info MUST BE FIRST, since this structure is cast to a
177 * xtalk_dmamap_s by generic xtalk routines.
178 */
179 struct hub_dmamap_s {
180 struct xtalk_dmamap_s hdma_xtalk_info;/* standard crosstalk dma info */
181 devfs_handle_t hdma_hub; /* which hub we go through */
182 int hdma_flags; /* defined below */
183 };
184 /* hub_dmamap flags */
185 #define HUB_DMAMAP_IS_VALID 0x1
186 #define HUB_DMAMAP_USED 0x2
187 #define HUB_DMAMAP_IS_FIXED 0x4
188
189 #if TBD
190 /* Ensure that hdma_xtalk_info is first */
191 #assert (&(((struct hub_dmamap_s *)0)->hdma_xtalk_info) == 0)
192 #endif
193
194 /*
195 * IP27 interrupt handle, created by hub_intr_alloc.
196 * xtalk_info MUST BE FIRST, since this structure is cast to a
197 * xtalk_intr_s by generic xtalk routines.
198 */
199 struct hub_intr_s {
200 struct xtalk_intr_s i_xtalk_info; /* standard crosstalk intr info */
201 ilvl_t i_swlevel; /* software level for blocking intr */
202 cpuid_t i_cpuid; /* which cpu */
203 int i_bit; /* which bit */
204 int i_flags;
205 };
206 /* flag values */
207 #define HUB_INTR_IS_ALLOCED 0x1 /* for debug: allocated */
208 #define HUB_INTR_IS_CONNECTED 0x4 /* for debug: connected to a software driver */
209
210 #if TBD
211 /* Ensure that i_xtalk_info is first */
212 #assert (&(((struct hub_intr_s *)0)->i_xtalk_info) == 0)
213 #endif
214
215
216 /* IP27 hub-specific information stored under INFO_LBL_HUB_INFO */
217 /* TBD: IP27-dependent stuff currently in nodepda.h should be here */
218 typedef struct hubinfo_s {
219 nodepda_t *h_nodepda; /* pointer to node's private data area */
220 cnodeid_t h_cnodeid; /* compact nodeid */
221 nasid_t h_nasid; /* nasid */
222
223 /* structures for PIO management */
224 xwidgetnum_t h_widgetid; /* my widget # (as viewed from xbow) */
225 struct hub_piomap_s h_small_window_piomap[HUB_WIDGET_ID_MAX+1];
226 sv_t h_bwwait; /* wait for big window to free */
227 spinlock_t h_bwlock; /* guard big window piomap's */
228 spinlock_t h_crblock; /* gaurd CRB error handling */
229 int h_num_big_window_fixed; /* count number of FIXED maps */
230 struct hub_piomap_s h_big_window_piomap[HUB_NUM_BIG_WINDOW];
231 hub_intr_t hub_ii_errintr;
232 } *hubinfo_t;
233
234 #define hubinfo_get(vhdl, infoptr) ((void)hwgraph_info_get_LBL \
235 (vhdl, INFO_LBL_NODE_INFO, (arbitrary_info_t *)infoptr))
236
237 #define hubinfo_set(vhdl, infoptr) (void)hwgraph_info_add_LBL \
238 (vhdl, INFO_LBL_NODE_INFO, (arbitrary_info_t)infoptr)
239
240 #define hubinfo_to_hubv(hinfo, hub_v) (hinfo->h_nodepda->node_vertex)
241
242 /*
243 * Hub info PIO map access functions.
244 */
245 #define hubinfo_bwin_piomap_get(hinfo, win) \
246 (&hinfo->h_big_window_piomap[win])
247 #define hubinfo_swin_piomap_get(hinfo, win) \
248 (&hinfo->h_small_window_piomap[win])
249
250 /* IP27 cpu-specific information stored under INFO_LBL_CPU_INFO */
251 /* TBD: IP27-dependent stuff currently in pda.h should be here */
252 typedef struct cpuinfo_s {
253 #ifdef LATER
254 pda_t *ci_cpupda; /* pointer to CPU's private data area */
255 #endif
256 cpuid_t ci_cpuid; /* CPU ID */
257 } *cpuinfo_t;
258
259 #define cpuinfo_get(vhdl, infoptr) ((void)hwgraph_info_get_LBL \
260 (vhdl, INFO_LBL_CPU_INFO, (arbitrary_info_t *)infoptr))
261
262 #define cpuinfo_set(vhdl, infoptr) (void)hwgraph_info_add_LBL \
263 (vhdl, INFO_LBL_CPU_INFO, (arbitrary_info_t)infoptr)
264
265 /* Special initialization function for xswitch vertices created during startup. */
266 extern void xswitch_vertex_init(devfs_handle_t xswitch);
267
268 extern xtalk_provider_t hub_provider;
269
270 /* du.c */
271 int ducons_write(char *buf, int len);
272
273 /* memerror.c */
274
275 extern void install_eccintr(cpuid_t cpu);
276 extern void memerror_get_stats(cnodeid_t cnode,
277 int *bank_stats, int *bank_stats_max);
278 extern void probe_md_errors(nasid_t);
279 /* sysctlr.c */
280 extern void sysctlr_init(void);
281 extern void sysctlr_power_off(int sdonly);
282 extern void sysctlr_keepalive(void);
283
284 #define valid_cpuid(_x) (((_x) >= 0) && ((_x) < maxcpus))
285
286 /* Useful definitions to get the memory dimm given a physical
287 * address.
288 */
289 #define paddr_dimm(_pa) ((_pa & MD_BANK_MASK) >> MD_BANK_SHFT)
290 #define paddr_cnode(_pa) (NASID_TO_COMPACT_NODEID(NASID_GET(_pa)))
291 extern void membank_pathname_get(paddr_t,char *);
292
293 /* To redirect the output into the error buffer */
294 #define errbuf_print(_s) printf("#%s",_s)
295
296 extern void crbx(nasid_t nasid, void (*pf)(char *, ...));
297 void bootstrap(void);
298
299 /* sndrv.c */
300 extern int sndrv_attach(devfs_handle_t vertex);
301
302 #endif /* _ASM_SN_PRIVATE_H */
303