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-2003 Silicon Graphics, Inc.  All Rights Reserved.
8  */
9 #ifndef _ASM_SN_XTALK_XTALK_PRIVATE_H
10 #define _ASM_SN_XTALK_XTALK_PRIVATE_H
11 
12 #include <asm/sn/ioerror.h>        /* for error function and arg types */
13 #include <linux/devfs_fs_kernel.h>
14 #include <asm/sn/xtalk/xwidget.h>
15 #include <asm/sn/xtalk/xtalk.h>
16 
17 /*
18  * xtalk_private.h -- private definitions for xtalk
19  * crosstalk drivers should NOT include this file.
20  */
21 
22 /*
23  * All Crosstalk providers set up PIO using this information.
24  */
25 struct xtalk_piomap_s {
26     vertex_hdl_t            xp_dev;	/* a requestor of this mapping */
27     xwidgetnum_t            xp_target;	/* target (node's widget number) */
28     iopaddr_t               xp_xtalk_addr;	/* which crosstalk addr is mapped */
29     size_t                  xp_mapsz;	/* size of this mapping */
30     caddr_t                 xp_kvaddr;	/* kernel virtual address to use */
31 };
32 
33 /*
34  * All Crosstalk providers set up DMA using this information.
35  */
36 struct xtalk_dmamap_s {
37     vertex_hdl_t            xd_dev;	/* a requestor of this mapping */
38     xwidgetnum_t            xd_target;	/* target (node's widget number) */
39 };
40 
41 /*
42  * All Crosstalk providers set up interrupts using this information.
43  */
44 struct xtalk_intr_s {
45     vertex_hdl_t            xi_dev;	/* requestor of this intr */
46     xwidgetnum_t            xi_target;	/* master's widget number */
47     xtalk_intr_vector_t     xi_vector;	/* 8-bit interrupt vector */
48     iopaddr_t               xi_addr;	/* xtalk address to generate intr */
49     void                   *xi_sfarg;	/* argument for setfunc */
50     xtalk_intr_setfunc_t    xi_setfunc;		/* device's setfunc routine */
51 };
52 
53 /*
54  * Xtalk interrupt handler structure access functions
55  */
56 #define	xtalk_intr_arg(xt)	((xt)->xi_sfarg)
57 
58 #define	xwidget_hwid_is_sn0_xswitch(_hwid)	\
59 		(((_hwid)->part_num == XBOW_WIDGET_PART_NUM ) &&  	\
60 		 ((_hwid)->mfg_num == XBOW_WIDGET_MFGR_NUM ))
61 
62 #define	xwidget_hwid_is_sn1_xswitch(_hwid)	\
63 		(((_hwid)->part_num == XXBOW_WIDGET_PART_NUM ||		\
64 		  (_hwid)->part_num == PXBOW_WIDGET_PART_NUM) &&  	\
65 		 ((_hwid)->mfg_num == XXBOW_WIDGET_MFGR_NUM ))
66 
67 #define	xwidget_hwid_is_xswitch(_hwid)	\
68 			xwidget_hwid_is_sn1_xswitch(_hwid)
69 
70 /* common iograph info for all widgets,
71  * stashed in FASTINFO of widget connection points.
72  */
73 struct xwidget_info_s {
74     char                   *w_fingerprint;
75     vertex_hdl_t            w_vertex;	/* back pointer to vertex */
76     xwidgetnum_t            w_id;	/* widget id */
77     struct xwidget_hwid_s   w_hwid;	/* hardware identification (part/rev/mfg) */
78     vertex_hdl_t            w_master;	/* CACHED widget's master */
79     xwidgetnum_t            w_masterid;		/* CACHED widget's master's widgetnum */
80     error_handler_f        *w_efunc;	/* error handling function */
81     error_handler_arg_t     w_einfo;	/* first parameter for efunc */
82     char		   *w_name;	/* canonical hwgraph name */
83 };
84 
85 extern char             widget_info_fingerprint[];
86 
87 #endif				/* _ASM_SN_XTALK_XTALK_PRIVATE_H */
88