ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / arch / ia64 / sn / io / cdl.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/config.h>
10 #include <linux/types.h>
11 #include <asm/sn/sgi.h>
12 #include <asm/io.h>
13 #include <asm/sn/hcl.h>
14 #include <asm/sn/pci/pic.h>
15 #include "asm/sn/ioerror_handling.h"
16 #include <asm/sn/xtalk/xbow.h>
17
18 /* these get called directly in cdl_add_connpt in fops bypass hack */
19 extern int xbow_attach(vertex_hdl_t);
20 extern int pic_attach(vertex_hdl_t);
21
22 /*
23  *    cdl: Connection and Driver List
24  *
25  *      We are not porting this to Linux.  Devices are registered via 
26  *      the normal Linux PCI layer.  This is a very simplified version 
27  *      of cdl that will allow us to register and call our very own 
28  *      IO Infrastructure Drivers e.g. pcibr.
29  */
30
31 #define MAX_SGI_IO_INFRA_DRVR 5
32
33 static struct cdl sgi_infrastructure_drivers[MAX_SGI_IO_INFRA_DRVR] =
34 {
35         { PIC_WIDGET_PART_NUM_BUS0,  PIC_WIDGET_MFGR_NUM,   pic_attach /* &pcibr_fops */},
36         { PIC_WIDGET_PART_NUM_BUS1,  PIC_WIDGET_MFGR_NUM,   pic_attach /* &pcibr_fops */},
37         { XXBOW_WIDGET_PART_NUM,   XXBOW_WIDGET_MFGR_NUM,   xbow_attach /* &xbow_fops */},
38         { XBOW_WIDGET_PART_NUM,    XBOW_WIDGET_MFGR_NUM,    xbow_attach /* &xbow_fops */},
39         { PXBOW_WIDGET_PART_NUM,   XXBOW_WIDGET_MFGR_NUM,   xbow_attach /* &xbow_fops */},
40 };
41
42 /*
43  * cdl_add_connpt: We found a device and it's connect point.  Call the 
44  * attach routine of that driver.
45  *
46  * May need support for pciba registration here ...
47  *
48  * This routine use to create /hw/.id/pci/.../.. that links to 
49  * /hw/module/006c06/Pbrick/xtalk/15/pci/<slotnum> .. do we still need 
50  * it?  The specified driver attach routine does not reference these 
51  * vertices.
52  */
53 int
54 cdl_add_connpt(int part_num, int mfg_num, 
55                vertex_hdl_t connpt, int drv_flags)
56 {
57         int i;
58         
59         /*
60          * Find the driver entry point and call the attach routine.
61          */
62         for (i = 0; i < MAX_SGI_IO_INFRA_DRVR; i++) {
63                 if ( (part_num == sgi_infrastructure_drivers[i].part_num) &&
64                    ( mfg_num == sgi_infrastructure_drivers[i].mfg_num) ) {
65                         /*
66                          * Call the device attach routines.
67                          */
68                         if (sgi_infrastructure_drivers[i].attach) {
69                             return(sgi_infrastructure_drivers[i].attach(connpt));
70                         }
71                 } else {
72                         continue;
73                 }
74         }       
75
76         /* printk("WARNING: cdl_add_connpt: Driver not found for part_num 0x%x mfg_num 0x%x\n", part_num, mfg_num); */
77
78         return (0);
79 }