import of upstream 2.4.34.4 from kernel.org
[linux-2.4.git] / arch / ia64 / sn / fakeprom / klgraph_init.c
1 /* $Id: klgraph_init.c,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-2003 Silicon Graphics, Inc.  All Rights Reserved.
8  */
9
10
11 /*
12  * This is a temporary file that statically initializes the expected 
13  * initial klgraph information that is normally provided by prom.
14  */
15
16 #include <linux/types.h>
17 #include <linux/config.h>
18 #include <linux/slab.h>
19 #include <linux/vmalloc.h>
20 #include <asm/sn/sgi.h>
21 #include <asm/sn/io.h>
22 #include <asm/sn/driver.h>
23 #include <asm/sn/iograph.h>
24 #include <asm/param.h>
25 #include <asm/sn/pio.h>
26 #include <asm/sn/xtalk/xwidget.h>
27 #include <asm/sn/sn_private.h>
28 #include <asm/sn/addrs.h>
29 #include <asm/sn/invent.h>
30 #include <asm/sn/hcl.h>
31 #include <asm/sn/hcl_util.h>
32 #include <asm/sn/intr.h>
33 #include <asm/sn/xtalk/xtalkaddrs.h>
34 #include <asm/sn/klconfig.h>
35
36 #define SYNERGY_WIDGET          ((char *)0xc0000e0000000000)
37 #define SYNERGY_SWIZZLE         ((char *)0xc0000e0000000400)
38 #define HUBREG                  ((char *)0xc0000a0001e00000)
39 #define WIDGET0                 ((char *)0xc0000a0000000000)
40 #define WIDGET4                 ((char *)0xc0000a0000000004)
41
42 #define SYNERGY_WIDGET          ((char *)0xc0000e0000000000)
43 #define SYNERGY_SWIZZLE         ((char *)0xc0000e0000000400)
44 #define HUBREG                  ((char *)0xc0000a0001e00000)
45 #define WIDGET0                 ((char *)0xc0000a0000000000)
46
47 #define convert(a,b,c) temp = (u64 *)a; *temp = b; temp++; *temp = c
48 void
49 klgraph_init(void)
50 {
51
52         u64 *temp;
53         /*
54          * Initialize some hub/xbow registers that allows access to 
55          * Xbridge etc.  These are normally done in PROM.
56          */
57
58         /* Write IOERR clear to clear the CRAZY bit in the status */
59         *(volatile uint64_t *)0xc000000801c001f8 = (uint64_t)0xffffffff;
60
61         /* set widget control register...setting bedrock widget id to a */
62         *(volatile uint64_t *)0xc000000801c00020 = (uint64_t)0x801a;
63
64         /* set io outbound widget access...allow all */
65         *(volatile uint64_t *)0xc000000801c00110 = (uint64_t)0xff01;
66
67         /* set io inbound widget access...allow all */
68         *(volatile uint64_t *)0xc000000801c00118 = (uint64_t)0xff01;
69
70         /* set io crb timeout to max */
71         *(volatile uint64_t *)0xc000000801c003c0 = (uint64_t)0xffffff;
72         *(volatile uint64_t *)0xc000000801c003c0 = (uint64_t)0xffffff;
73
74         /* set local block io permission...allow all */
75 // [LB]        *(volatile uint64_t *)0xc000000801e04010 = (uint64_t)0xfffffffffffffff;
76
77         /* clear any errors */
78         /* clear_ii_error(); medusa should have cleared these */
79
80         /* set default read response buffers in bridge */
81 // [PI]       *(volatile u32 *)0xc00000080f000280L = 0xba98;
82 // [PI]       *(volatile u32 *)0xc00000080f000288L = 0xba98;
83
84         /*
85          * klconfig entries initialization - mankato
86          */
87         convert(0xe000003000030000, 0x00000000beedbabe, 0x0000004800000000);
88         convert(0xe000003000030010, 0x0003007000000018, 0x800002000f820178);
89         convert(0xe000003000030020, 0x80000a000f024000, 0x800002000f800000);
90         convert(0xe000003000030030, 0x0300fafa00012580, 0x00000000040f0000);
91         convert(0xe000003000030040, 0x0000000000000000, 0x0003097000030070);
92         convert(0xe000003000030050, 0x00030970000303b0, 0x0003181000033f70);
93         convert(0xe000003000030060, 0x0003d51000037570, 0x0000000000038330);
94         convert(0xe000003000030070, 0x0203110100030140, 0x0001000000000101);
95         convert(0xe000003000030080, 0x0900000000000000, 0x000000004e465e67);
96         convert(0xe000003000030090, 0x0003097000000000, 0x00030b1000030a40);
97         convert(0xe0000030000300a0, 0x00030cb000030be0, 0x000315a0000314d0);
98         convert(0xe0000030000300b0, 0x0003174000031670, 0x0000000000000000);
99         convert(0xe000003000030100, 0x000000000000001a, 0x3350490000000000);
100         convert(0xe000003000030110, 0x0000000000000037, 0x0000000000000000);
101         convert(0xe000003000030140, 0x0002420100030210, 0x0001000000000101);
102         convert(0xe000003000030150, 0x0100000000000000, 0xffffffffffffffff);
103         convert(0xe000003000030160, 0x00030d8000000000, 0x0000000000030e50);
104         convert(0xe0000030000301c0, 0x0000000000000000, 0x0000000000030070);
105         convert(0xe0000030000301d0, 0x0000000000000025, 0x424f490000000000);
106         convert(0xe0000030000301e0, 0x000000004b434952, 0x0000000000000000);
107         convert(0xe000003000030210, 0x00027101000302e0, 0x00010000000e4101);
108         convert(0xe000003000030220, 0x0200000000000000, 0xffffffffffffffff);
109         convert(0xe000003000030230, 0x00030f2000000000, 0x0000000000030ff0);
110         convert(0xe000003000030290, 0x0000000000000000, 0x0000000000030140);
111         convert(0xe0000030000302a0, 0x0000000000000026, 0x7262490000000000);
112         convert(0xe0000030000302b0, 0x00000000006b6369, 0x0000000000000000);
113         convert(0xe0000030000302e0, 0x0002710100000000, 0x00010000000f3101);
114         convert(0xe0000030000302f0, 0x0500000000000000, 0xffffffffffffffff);
115         convert(0xe000003000030300, 0x000310c000000000, 0x0003126000031190);
116         convert(0xe000003000030310, 0x0003140000031330, 0x0000000000000000);
117         convert(0xe000003000030360, 0x0000000000000000, 0x0000000000030140);
118         convert(0xe000003000030370, 0x0000000000000029, 0x7262490000000000);
119         convert(0xe000003000030380, 0x00000000006b6369, 0x0000000000000000);
120         convert(0xe000003000030970, 0x0000000002010102, 0x0000000000000000);
121         convert(0xe000003000030980, 0x000000004e465e67, 0xffffffff00000000);
122         /* convert(0x00000000000309a0, 0x0000000000037570, 0x0000000100000000); */
123         convert(0xe0000030000309a0, 0x0000000000037570, 0xffffffff00000000);
124         convert(0xe0000030000309b0, 0x0000000000030070, 0x0000000000000000);
125         convert(0xe0000030000309c0, 0x000000000003f420, 0x0000000000000000);
126         convert(0xe000003000030a40, 0x0000000002010125, 0x0000000000000000);
127         convert(0xe000003000030a50, 0xffffffffffffffff, 0xffffffff00000000);
128         convert(0xe000003000030a70, 0x0000000000037b78, 0x0000000000000000);
129         convert(0xe000003000030b10, 0x0000000002010125, 0x0000000000000000);
130         convert(0xe000003000030b20, 0xffffffffffffffff, 0xffffffff00000000);
131         convert(0xe000003000030b40, 0x0000000000037d30, 0x0000000000000001);
132         convert(0xe000003000030be0, 0x00000000ff010203, 0x0000000000000000);
133         convert(0xe000003000030bf0, 0xffffffffffffffff, 0xffffffff000000ff);
134         convert(0xe000003000030c10, 0x0000000000037ee8, 0x0100010000000200);
135         convert(0xe000003000030cb0, 0x00000000ff310111, 0x0000000000000000);
136         convert(0xe000003000030cc0, 0xffffffffffffffff, 0x0000000000000000);
137         convert(0xe000003000030d80, 0x0000000002010104, 0x0000000000000000);
138         convert(0xe000003000030d90, 0xffffffffffffffff, 0x00000000000000ff);
139         convert(0xe000003000030db0, 0x0000000000037f18, 0x0000000000000000);
140         convert(0xe000003000030dc0, 0x0000000000000000, 0x0003007000060000);
141         convert(0xe000003000030de0, 0x0000000000000000, 0x0003021000050000);
142         convert(0xe000003000030df0, 0x000302e000050000, 0x0000000000000000);
143         convert(0xe000003000030e30, 0x0000000000000000, 0x000000000000000a);
144         convert(0xe000003000030e50, 0x00000000ff00011a, 0x0000000000000000);
145         convert(0xe000003000030e60, 0xffffffffffffffff, 0x0000000000000000);
146         convert(0xe000003000030e80, 0x0000000000037fe0, 0x9e6e9e9e9e9e9e9e);
147         convert(0xe000003000030e90, 0x000000000000bc6e, 0x0000000000000000);
148         convert(0xe000003000030f20, 0x0000000002010205, 0x00000000d0020000);
149         convert(0xe000003000030f30, 0xffffffffffffffff, 0x0000000e0000000e);
150         convert(0xe000003000030f40, 0x000000000000000e, 0x0000000000000000);
151         convert(0xe000003000030f50, 0x0000000000038010, 0x00000000000007ff);
152         convert(0xe000003000030f70, 0x0000000000000000, 0x0000000022001077);
153         convert(0xe000003000030fa0, 0x0000000000000000, 0x000000000003f4a8);
154         convert(0xe000003000030ff0, 0x0000000000310120, 0x0000000000000000);
155         convert(0xe000003000031000, 0xffffffffffffffff, 0xffffffff00000002);
156         convert(0xe000003000031010, 0x000000000000000e, 0x0000000000000000);
157         convert(0xe000003000031020, 0x0000000000038088, 0x0000000000000000);
158         convert(0xe0000030000310c0, 0x0000000002010205, 0x00000000d0020000);
159         convert(0xe0000030000310d0, 0xffffffffffffffff, 0x0000000f0000000f);
160         convert(0xe0000030000310e0, 0x000000000000000f, 0x0000000000000000);
161         convert(0xe0000030000310f0, 0x00000000000380b8, 0x00000000000007ff);
162         convert(0xe000003000031120, 0x0000000022001077, 0x00000000000310a9);
163         convert(0xe000003000031130, 0x00000000580211c1, 0x000000008009104c);
164         convert(0xe000003000031140, 0x0000000000000000, 0x000000000003f4c0);
165         convert(0xe000003000031190, 0x0000000000310120, 0x0000000000000000);
166         convert(0xe0000030000311a0, 0xffffffffffffffff, 0xffffffff00000003);
167         convert(0xe0000030000311b0, 0x000000000000000f, 0x0000000000000000);
168         convert(0xe0000030000311c0, 0x0000000000038130, 0x0000000000000000);
169         convert(0xe000003000031260, 0x0000000000110106, 0x0000000000000000);
170         convert(0xe000003000031270, 0xffffffffffffffff, 0xffffffff00000004);
171         convert(0xe000003000031270, 0xffffffffffffffff, 0xffffffff00000004);
172         convert(0xe000003000031280, 0x000000000000000f, 0x0000000000000000);
173         convert(0xe0000030000312a0, 0x00000000ff110013, 0x0000000000000000);
174         convert(0xe0000030000312b0, 0xffffffffffffffff, 0xffffffff00000000);
175         convert(0xe0000030000312c0, 0x000000000000000f, 0x0000000000000000);
176         convert(0xe0000030000312e0, 0x0000000000110012, 0x0000000000000000);
177         convert(0xe0000030000312f0, 0xffffffffffffffff, 0xffffffff00000000);
178         convert(0xe000003000031300, 0x000000000000000f, 0x0000000000000000);
179         convert(0xe000003000031310, 0x0000000000038160, 0x0000000000000000);
180         convert(0xe000003000031330, 0x00000000ff310122, 0x0000000000000000);
181         convert(0xe000003000031340, 0xffffffffffffffff, 0xffffffff00000005);
182         convert(0xe000003000031350, 0x000000000000000f, 0x0000000000000000);
183         convert(0xe000003000031360, 0x0000000000038190, 0x0000000000000000);
184         convert(0xe000003000031400, 0x0000000000310121, 0x0000000000000000);
185         convert(0xe000003000031400, 0x0000000000310121, 0x0000000000000000);
186         convert(0xe000003000031410, 0xffffffffffffffff, 0xffffffff00000006);
187         convert(0xe000003000031420, 0x000000000000000f, 0x0000000000000000);
188         convert(0xe000003000031430, 0x00000000000381c0, 0x0000000000000000);
189         convert(0xe0000030000314d0, 0x00000000ff010201, 0x0000000000000000);
190         convert(0xe0000030000314e0, 0xffffffffffffffff, 0xffffffff00000000);
191         convert(0xe000003000031500, 0x00000000000381f0, 0x000030430000ffff);
192         convert(0xe000003000031510, 0x000000000000ffff, 0x0000000000000000);
193         convert(0xe0000030000315a0, 0x00000020ff000201, 0x0000000000000000);
194         convert(0xe0000030000315b0, 0xffffffffffffffff, 0xffffffff00000001);
195         convert(0xe0000030000315d0, 0x0000000000038240, 0x00003f3f0000ffff);
196         convert(0xe0000030000315e0, 0x000000000000ffff, 0x0000000000000000);
197         convert(0xe000003000031670, 0x00000000ff010201, 0x0000000000000000);
198         convert(0xe000003000031680, 0xffffffffffffffff, 0x0000000100000002);
199         convert(0xe0000030000316a0, 0x0000000000038290, 0x000030430000ffff);
200         convert(0xe0000030000316b0, 0x000000000000ffff, 0x0000000000000000);
201         convert(0xe000003000031740, 0x00000020ff000201, 0x0000000000000000);
202         convert(0xe000003000031750, 0xffffffffffffffff, 0x0000000500000003);
203         convert(0xe000003000031770, 0x00000000000382e0, 0x00003f3f0000ffff);
204         convert(0xe000003000031780, 0x000000000000ffff, 0x0000000000000000);
205 }