commented early_printk patch because of rejects.
[linux-flexiantxendom0-3.2.10.git] / arch / ia64 / sn / io / platform_init / sgi_io_init.c
1 /*
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
4  * for more details.
5  *
6  * Copyright (C) 1992 - 1997, 2000-2003 Silicon Graphics, Inc. All rights reserved.
7  */
8
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>
19
20 /*
21  * per_hub_init
22  *
23  *      This code is executed once for each Hub chip.
24  */
25 void
26 per_hub_init(cnodeid_t cnode)
27 {
28         nasid_t         nasid;
29         nodepda_t       *npdap;
30         ii_icmr_u_t     ii_icmr;
31         ii_ibcr_u_t     ii_ibcr;
32         ii_ilcsr_u_t    ii_ilcsr;
33
34         nasid = COMPACT_TO_NASID_NODEID(cnode);
35
36         ASSERT(nasid != INVALID_NASID);
37         ASSERT(NASID_TO_COMPACT_NODEID(nasid) == cnode);
38
39         npdap = NODEPDA(cnode);
40
41         /* Disable the request and reply errors. */
42         REMOTE_HUB_S(nasid, IIO_IWEIM, 0xC000);
43
44         /*
45          * Set the total number of CRBs that can be used.
46          */
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; 
52         }
53         REMOTE_HUB_S(nasid, IIO_ICMR, ii_icmr.ii_icmr_regval);
54
55         /*
56          * Set the number of CRBs that both of the BTEs combined
57          * can use minus 1.
58          */
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;
63         } else {
64             /*
65              * if the LLP is down, there is no attached I/O, so
66             * give BTE all the CRBs.
67             */
68             ii_ibcr.ii_ibcr_fld_s.i_count = 0x14;
69         }
70         REMOTE_HUB_S(nasid, IIO_IBCR, ii_ibcr.ii_ibcr_regval);
71
72         /*
73          * Set CRB timeout to be 10ms.
74          */
75         REMOTE_HUB_S(nasid, IIO_ICTP, 0xffffff );
76         REMOTE_HUB_S(nasid, IIO_ICTO, 0xff);
77
78         /* Initialize error interrupts for this hub. */
79         hub_error_init(cnode);
80 }