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