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