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
7 * Copyright (C) 1992 - 1997, 2000-2003 Silicon Graphics, Inc. All rights reserved.
10 #include <linux/types.h>
11 #include <linux/config.h>
12 #include <linux/slab.h>
13 #include <asm/sn/sgi.h>
14 #include <asm/sn/io.h>
15 #include <asm/sn/sn_cpuid.h>
16 #include <asm/sn/klconfig.h>
17 #include <asm/sn/sn_private.h>
18 #include <asm/sn/pci/pciba.h>
19 #include <linux/smp.h>
21 extern void mlreset(void);
22 extern int init_hcl(void);
23 extern void klgraph_hack_init(void);
24 extern void hubspc_init(void);
25 extern void pciio_init(void);
26 extern void pcibr_init(void);
27 extern void xtalk_init(void);
28 extern void xbow_init(void);
29 extern void xbmon_init(void);
30 extern void pciiox_init(void);
31 extern void pic_init(void);
32 extern void usrpci_init(void);
33 extern void ioc3_init(void);
34 extern void initialize_io(void);
35 extern void klhwg_add_all_modules(devfs_handle_t);
36 extern void klhwg_add_all_nodes(devfs_handle_t);
38 void sn_mp_setup(void);
39 extern devfs_handle_t hwgraph_root;
40 extern void io_module_init(void);
41 extern void pci_bus_cvlink_init(void);
42 extern void temp_hack(void);
44 extern int pci_bus_to_hcl_cvlink(void);
46 /* #define DEBUG_IO_INIT 1 */
48 #define DBG(x...) printk(x)
51 #endif /* DEBUG_IO_INIT */
56 * This code is executed once for each Hub chip.
59 per_hub_init(cnodeid_t cnode)
66 nasid = COMPACT_TO_NASID_NODEID(cnode);
68 ASSERT(nasid != INVALID_NASID);
69 ASSERT(NASID_TO_COMPACT_NODEID(nasid) == cnode);
71 npdap = NODEPDA(cnode);
73 REMOTE_HUB_S(nasid, IIO_IWEIM, 0x8000);
76 * Set the total number of CRBs that can be used.
78 ii_icmr.ii_icmr_regval= 0x0;
79 ii_icmr.ii_icmr_fld_s.i_c_cnt = 0xf;
80 REMOTE_HUB_S(nasid, IIO_ICMR, ii_icmr.ii_icmr_regval);
83 * Set the number of CRBs that both of the BTEs combined
86 ii_ibcr.ii_ibcr_regval= 0x0;
87 ii_ibcr.ii_ibcr_fld_s.i_count = 0x8;
88 REMOTE_HUB_S(nasid, IIO_IBCR, ii_ibcr.ii_ibcr_regval);
91 * Set CRB timeout to be 10ms.
94 REMOTE_HUB_S(nasid, IIO_ICTP, 0xffffff );
95 REMOTE_HUB_S(nasid, IIO_ICTO, 0xff);
96 //REMOTE_HUB_S(nasid, IIO_IWI, 0x00FF00FF00FFFFFF);
99 /* Initialize error interrupts for this hub. */
100 hub_error_init(cnode);
104 * This routine is responsible for the setup of all the IRIX hwgraph style
105 * stuff that's been pulled into linux. It's called by sn_pci_find_bios which
106 * is called just before the generic Linux PCI layer does its probing (by
107 * platform_pci_fixup aka sn_pci_fixup).
109 * It is very IMPORTANT that this call is only made by the Master CPU!
114 sgi_master_io_infr_init(void)
117 extern void kdba_io_init();
120 * Do any early init stuff .. einit_tbl[] etc.
122 init_hcl(); /* Sets up the hwgraph compatibility layer with devfs */
125 * initialize the Linux PCI to xwidget vertexes ..
127 pci_bus_cvlink_init();
133 * Hack to provide statically initialzed klgraph entries.
135 DBG("--> sgi_master_io_infr_init: calling klgraph_hack_init()\n");
140 * This is the Master CPU. Emulate mlsetup and main.c in Irix.
145 * allowboot() is called by kern/os/main.c in main()
146 * Emulate allowboot() ...
147 * per_cpu_init() - only need per_hub_init()
148 * cpu_io_setup() - Nothing to do.
153 for (cnode = 0; cnode < numnodes; cnode++) {
157 /* We can do headless hub cnodes here .. */
162 * Get SGI IO Infrastructure drivers to init and register with
179 * Our IO Infrastructure drivers are in place ..
180 * Initialize the whole IO Infrastructure .. xwidget/device probes.
184 pci_bus_to_hcl_cvlink();
187 DBG("--> sgi_master_io_infr_init: calling pciba_init()\n");
195 * One-time setup for MP SN.
196 * Allocate per-node data, slurp prom klconfig information and
197 * convert it to hwgraph information.
204 for (cpu = 0; cpu < NR_CPUS; cpu++) {
205 /* Skip holes in CPU space */
206 if (cpu_enabled(cpu)) {
207 init_platform_pda(cpu);
212 * Initialize platform-dependent vertices in the hwgraph:
223 io_module_init(); /* Use to be called module_init() .. */
224 klhwg_add_all_modules(hwgraph_root);
225 klhwg_add_all_nodes(hwgraph_root);