File: /usr/src/linux/arch/ia64/sn/io/cdl.c
1 /* $Id$
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 Silicon Graphics, Inc.
8 * Copyright (C) 2000 by Colin Ngam
9 */
10
11 #include <linux/types.h>
12 #include <asm/sn/sgi.h>
13 #include <asm/io.h>
14 #include <asm/sn/invent.h>
15 #include <asm/sn/hcl.h>
16 #include <asm/sn/pci/bridge.h>
17 #include "asm/sn/ioerror_handling.h"
18 #include <asm/sn/xtalk/xbow.h>
19
20 #ifdef BRINGUP
21 /* these get called directly in cdl_add_connpt in fops bypass hack */
22 extern int pcibr_attach(devfs_handle_t);
23 extern int xbow_attach(devfs_handle_t);
24 #endif /* BRINGUP */
25
26 /*
27 * cdl: Connection and Driver List
28 *
29 * We are not porting this to Linux. Devices are registered via
30 * the normal Linux PCI layer. This is a very simplified version
31 * of cdl that will allow us to register and call our very own
32 * IO Infrastructure Drivers e.g. pcibr.
33 */
34
35 struct cdl {
36 int part_num;
37 int mfg_num;
38 int (*attach) (devfs_handle_t);
39 } dummy_reg;
40
41 typedef struct cdl *cdl_p;
42
43 #define MAX_SGI_IO_INFRA_DRVR 4
44 struct cdl sgi_infrastructure_drivers[MAX_SGI_IO_INFRA_DRVR] =
45 {
46 { XBRIDGE_WIDGET_PART_NUM, XBRIDGE_WIDGET_MFGR_NUM, pcibr_attach /* &pcibr_fops */},
47 { BRIDGE_WIDGET_PART_NUM, BRIDGE_WIDGET_MFGR_NUM, pcibr_attach /* &pcibr_fops */},
48 { XXBOW_WIDGET_PART_NUM, XXBOW_WIDGET_MFGR_NUM, xbow_attach /* &xbow_fops */},
49 { XBOW_WIDGET_PART_NUM, XBOW_WIDGET_MFGR_NUM, xbow_attach /* &xbow_fops */},
50 };
51
52 /*
53 * cdl_new: Called by pciio and xtalk.
54 */
55 cdl_p
56 cdl_new(char *name, char *k1str, char *k2str)
57 {
58 /*
59 * Just return a dummy pointer.
60 */
61 return((cdl_p)&dummy_reg);
62 }
63
64 /*
65 * cdl_del: Do nothing.
66 */
67 void
68 cdl_del(cdl_p reg)
69 {
70 return;
71 }
72
73 /*
74 * cdl_add_driver: The driver part number and manufacturers number
75 * are statically initialized above.
76 *
77 Do nothing.
78 */
79 int
80 cdl_add_driver(cdl_p reg, int key1, int key2, char *prefix, int flags, cdl_drv_f *func)
81 {
82 return 0;
83 }
84
85 /*
86 * cdl_del_driver: Not supported.
87 */
88 void
89 cdl_del_driver(cdl_p reg, char *prefix, cdl_drv_f *func)
90 {
91 return;
92 }
93
94 /*
95 * cdl_add_connpt: We found a device and it's connect point. Call the
96 * attach routine of that driver.
97 *
98 * May need support for pciba registration here ...
99 *
100 * This routine use to create /hw/.id/pci/.../.. that links to
101 * /hw/module/006c06/Pbrick/xtalk/15/pci/<slotnum> .. do we still need
102 * it? The specified driver attach routine does not reference these
103 * vertices.
104 */
105 int
106 cdl_add_connpt(cdl_p reg, int part_num, int mfg_num,
107 devfs_handle_t connpt, int drv_flags)
108 {
109 int i;
110
111 /*
112 * Find the driver entry point and call the attach routine.
113 */
114 for (i = 0; i < MAX_SGI_IO_INFRA_DRVR; i++) {
115
116 if ( (part_num == sgi_infrastructure_drivers[i].part_num) &&
117 ( mfg_num == sgi_infrastructure_drivers[i].mfg_num) ) {
118 /*
119 * Call the device attach routines.
120 */
121 if (sgi_infrastructure_drivers[i].attach) {
122 return(sgi_infrastructure_drivers[i].attach(connpt));
123 }
124 } else {
125 continue;
126 }
127 }
128
129 /* printk("WARNING: cdl_add_connpt: Driver not found for part_num 0x%x mfg_num 0x%x\n", part_num, mfg_num); */
130
131 return (0);
132 }
133
134 /*
135 * cdl_del_connpt: Not implemented.
136 */
137 int
138 cdl_del_connpt(cdl_p reg, int key1, int key2, devfs_handle_t connpt, int drv_flags)
139 {
140
141 return(0);
142 }
143
144 /*
145 * cdl_iterate: Not Implemented.
146 */
147 void
148 cdl_iterate(cdl_p reg,
149 char *prefix,
150 cdl_iter_f * func)
151 {
152 return;
153 }
154
155 async_attach_t
156 async_attach_new(void)
157 {
158
159 return(0);
160 }
161
162 void
163 async_attach_free(async_attach_t aa)
164 {
165 return;
166 }
167
168 async_attach_t
169 async_attach_get_info(devfs_handle_t vhdl)
170 {
171
172 return(0);
173 }
174
175 void
176 async_attach_add_info(devfs_handle_t vhdl, async_attach_t aa)
177 {
178 return;
179
180 }
181
182 void
183 async_attach_del_info(devfs_handle_t vhdl)
184 {
185 return;
186 }
187
188 void async_attach_signal_start(async_attach_t aa)
189 {
190 return;
191 }
192
193 void async_attach_signal_done(async_attach_t aa)
194 {
195 return;
196 }
197
198 void async_attach_waitall(async_attach_t aa)
199 {
200 return;
201 }
202
203