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
6 * Copyright (C) 1992 - 1997, 2000-2003 Silicon Graphics, Inc. All rights reserved.
9 #include <linux/types.h>
10 #include <linux/config.h>
11 #include <linux/slab.h>
12 #include <linux/smp.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/pda.h>
23 * This code is executed once for each Hub chip.
26 per_hub_init(cnodeid_t cnode)
32 ii_ilcsr_u_t ii_ilcsr;
34 nasid = COMPACT_TO_NASID_NODEID(cnode);
36 ASSERT(nasid != INVALID_NASID);
37 ASSERT(NASID_TO_COMPACT_NODEID(nasid) == cnode);
39 npdap = NODEPDA(cnode);
41 /* Disable the request and reply errors. */
42 REMOTE_HUB_S(nasid, IIO_IWEIM, 0xC000);
45 * Set the total number of CRBs that can be used.
47 ii_icmr.ii_icmr_regval= 0x0;
48 ii_icmr.ii_icmr_fld_s.i_c_cnt = 0xf;
49 if (enable_shub_wars_1_1() ) {
50 // Set bit one of ICMR to prevent II from sending interrupt for II bug.
51 ii_icmr.ii_icmr_regval |= 0x1;
53 REMOTE_HUB_S(nasid, IIO_ICMR, ii_icmr.ii_icmr_regval);
56 * Set the number of CRBs that both of the BTEs combined
59 ii_ibcr.ii_ibcr_regval= 0x0;
60 ii_ilcsr.ii_ilcsr_regval = REMOTE_HUB_L(nasid, IIO_LLP_CSR);
61 if (ii_ilcsr.ii_ilcsr_fld_s.i_llp_stat & LNK_STAT_WORKING) {
62 ii_ibcr.ii_ibcr_fld_s.i_count = 0x8;
65 * if the LLP is down, there is no attached I/O, so
66 * give BTE all the CRBs.
68 ii_ibcr.ii_ibcr_fld_s.i_count = 0x14;
70 REMOTE_HUB_S(nasid, IIO_IBCR, ii_ibcr.ii_ibcr_regval);
73 * Set CRB timeout to be 10ms.
75 REMOTE_HUB_S(nasid, IIO_ICTP, 0xffffff );
76 REMOTE_HUB_S(nasid, IIO_ICTO, 0xff);
78 /* Initialize error interrupts for this hub. */
79 hub_error_init(cnode);