8ffba2495eeb494289f625300d3f3d679dedcdc9
[linux-flexiantxendom0-3.2.10.git] / 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-2002 Silicon Graphics, Inc. All rights reserved.
8  */
9
10 #include <linux/config.h>
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 /* these get called directly in cdl_add_connpt in fops bypass hack */
21 extern int pcibr_attach(devfs_handle_t);
22 extern int xbow_attach(devfs_handle_t);
23 extern int pic_attach(devfs_handle_t);
24
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 #ifdef CONFIG_IA64_SGI_SN1
42 #define MAX_SGI_IO_INFRA_DRVR 4
43 #else
44 #define MAX_SGI_IO_INFRA_DRVR 7
45 #endif
46 static struct cdl sgi_infrastructure_drivers[MAX_SGI_IO_INFRA_DRVR] =
47 {
48         { XBRIDGE_WIDGET_PART_NUM, XBRIDGE_WIDGET_MFGR_NUM, pcibr_attach /* &pcibr_fops  */},
49         { BRIDGE_WIDGET_PART_NUM,  BRIDGE_WIDGET_MFGR_NUM,  pcibr_attach /* &pcibr_fops */},
50 #ifndef CONFIG_IA64_SGI_SN1
51         { PIC_WIDGET_PART_NUM_BUS0,  PIC_WIDGET_MFGR_NUM,   pic_attach /* &pic_fops */},
52         { PIC_WIDGET_PART_NUM_BUS1,  PIC_WIDGET_MFGR_NUM,   pic_attach /* &pic_fops */},
53 #endif
54         { XXBOW_WIDGET_PART_NUM,   XXBOW_WIDGET_MFGR_NUM,   xbow_attach /* &xbow_fops */},
55         { XBOW_WIDGET_PART_NUM,    XBOW_WIDGET_MFGR_NUM,    xbow_attach /* &xbow_fops */},
56 #ifndef CONFIG_IA64_SGI_SN1
57         { PXBOW_WIDGET_PART_NUM,   XXBOW_WIDGET_MFGR_NUM,   xbow_attach /* &xbow_fops */},
58 #endif
59 };
60
61 /*
62  * cdl_new:  Called by pciio and xtalk.
63  */
64 cdl_p
65 cdl_new(char *name, char *k1str, char *k2str)
66 {
67     /*
68      * Just return a dummy pointer.
69      */
70     return((cdl_p)&dummy_reg);
71 }
72
73 /*
74  * cdl_del: Do nothing.
75  */
76 void
77 cdl_del(cdl_p reg)
78 {
79         return;
80 }
81
82 /*
83  * cdl_add_driver: The driver part number and manufacturers number 
84  * are statically initialized above.
85  * 
86   Do nothing.
87  */
88 int
89 cdl_add_driver(cdl_p reg, int key1, int key2, char *prefix, int flags, cdl_drv_f *func)
90 {
91     return 0;
92 }
93
94 /*
95  * cdl_del_driver: Not supported.
96  */
97 void
98 cdl_del_driver(cdl_p reg, char *prefix, cdl_drv_f *func)
99 {
100         return;
101 }
102
103 /*
104  * cdl_add_connpt: We found a device and it's connect point.  Call the 
105  * attach routine of that driver.
106  *
107  * May need support for pciba registration here ...
108  *
109  * This routine use to create /hw/.id/pci/.../.. that links to 
110  * /hw/module/006c06/Pbrick/xtalk/15/pci/<slotnum> .. do we still need 
111  * it?  The specified driver attach routine does not reference these 
112  * vertices.
113  */
114 int
115 cdl_add_connpt(cdl_p reg, int part_num, int mfg_num, 
116                devfs_handle_t connpt, int drv_flags)
117 {
118         int i;
119         
120         /*
121          * Find the driver entry point and call the attach routine.
122          */
123         for (i = 0; i < MAX_SGI_IO_INFRA_DRVR; i++) {
124
125                 if ( (part_num == sgi_infrastructure_drivers[i].part_num) &&
126                    ( mfg_num == sgi_infrastructure_drivers[i].mfg_num) ) {
127                         /*
128                          * Call the device attach routines.
129                          */
130                         if (sgi_infrastructure_drivers[i].attach) {
131                             return(sgi_infrastructure_drivers[i].attach(connpt));
132                         }
133                 } else {
134                         continue;
135                 }
136         }       
137
138         /* printk("WARNING: cdl_add_connpt: Driver not found for part_num 0x%x mfg_num 0x%x\n", part_num, mfg_num); */
139
140         return (0);
141 }
142
143 /*
144  * cdl_del_connpt: Not implemented.
145  */
146 int
147 cdl_del_connpt(cdl_p reg, int key1, int key2, devfs_handle_t connpt, int drv_flags)
148 {
149
150         return(0);
151 }
152
153 /*
154  *    cdl_iterate: Not Implemented.
155  */
156 void
157 cdl_iterate(cdl_p reg,
158             char *prefix,
159             cdl_iter_f * func)
160 {
161         return;
162 }
163
164 async_attach_t 
165 async_attach_new(void)
166 {
167
168         return(0);
169 }
170
171 void 
172 async_attach_free(async_attach_t aa)
173 {
174         return;
175 }
176
177 async_attach_t 
178 async_attach_get_info(devfs_handle_t vhdl)
179 {
180
181         return(0);
182 }
183
184 void            
185 async_attach_add_info(devfs_handle_t vhdl, async_attach_t aa)
186 {
187         return;
188
189 }
190
191 void            
192 async_attach_del_info(devfs_handle_t vhdl)
193 {
194         return;
195 }
196
197 void async_attach_signal_start(async_attach_t aa)
198 {
199         return;
200 }
201
202 void async_attach_signal_done(async_attach_t aa)
203 {
204         return;
205 }
206
207 void async_attach_waitall(async_attach_t aa)
208 {
209         return;
210 }
211