xref: /titanic_50/usr/src/uts/sun4u/sys/gp2cfg.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2000-2002 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_SYS_GP2CFG_H
28 #define	_SYS_GP2CFG_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 /*
33  * Header file for the Safari Configurator (gptwocfg).
34  */
35 
36 #ifdef	__cplusplus
37 extern "C" {
38 #endif
39 
40 #include <sys/safari_pcd.h>
41 #include <sys/fcode.h>
42 #include <sys/fcgp2.h>
43 
44 /*
45  * Interfaces exported by Safari Configurator module, kernel/misc/gp2cfg.
46  */
47 
48 typedef void *gptwocfg_cookie_t;
49 typedef void *gptwocfg_ops_cookie_t;
50 typedef uint32_t gptwo_aid_t;
51 
52 gptwocfg_cookie_t gptwocfg_configure(dev_info_t *, spcd_t *, uint_t);
53 gptwocfg_cookie_t gptwocfg_unconfigure(dev_info_t *, gptwo_aid_t);
54 int gptwocfg_next_node(gptwocfg_cookie_t, dev_info_t *, dev_info_t **);
55 void gptwocfg_save_handle(dev_info_t *, fco_handle_t);
56 fco_handle_t gptwocfg_get_handle(dev_info_t *);
57 
58 
59 /*
60  * Prototypes for the platform specific functions.
61  */
62 
63 #define	GP2CFG_SUCCESS	0x00
64 #define	GP2CFG_FAILURE	0x01
65 
66 struct gptwo_phys_spec {
67 	uint_t gptwo_phys_hi;	/* child's address, hi word */
68 	uint_t gptwo_phys_low;	/* child's address, low word */
69 	uint_t gptwo_size_hi;	/* high word of size field */
70 	uint_t gptwo_size_low;	/* low word of size field */
71 };
72 
73 typedef struct gptwo_phys_spec gptwo_regspec_t;
74 
75 
76 #define	GP2_VERSION		0
77 
78 struct gptwo_new_nodes {
79 	uint_t		gptwo_version;
80 	uint_t		gptwo_number_of_nodes;
81 	dev_info_t	*gptwo_nodes[1];
82 		/* actual size is gptwo_number_of_nodes */
83 };
84 
85 typedef struct gptwo_new_nodes gptwo_new_nodes_t;
86 
87 typedef struct gptwocfg_config {
88 	uint_t			gptwo_version;
89 	dev_info_t		*gptwo_ap;
90 	struct gptwocfg_ops	*gptwo_ops;
91 	gptwo_aid_t		gptwo_portid;
92 	gptwo_new_nodes_t	*gptwo_nodes;
93 	struct gptwocfg_config	*gptwo_next;
94 } gptwocfg_config_t;
95 
96 typedef struct gptwocfg_handle_list {
97 	dev_info_t			*dip;
98 	fco_handle_t			fco_handle;
99 	struct gptwocfg_handle_list	*next;
100 } gptwocfg_handle_list_t;
101 
102 #define	GPTWOCFG_OPS_VERSION	0
103 
104 typedef struct gptwocfg_ops {
105 	int	gptwocfg_version;	/* GPTWOCFG_OPS_VERSION */
106 	int	gptwocfg_type;		/* SAFPTYPE_xxx */
107 	gptwo_new_nodes_t *(*gptwocfg_configure)
108 	    (dev_info_t *ap, spcd_t *pcd, gptwo_aid_t id);
109 	dev_info_t *(*gptwocfg_unconfigure)
110 	    (dev_info_t *dip);
111 } gptwocfg_ops_t;
112 
113 typedef gptwo_new_nodes_t *gptwo_cfgfunc_t(dev_info_t *, spcd_t *, gptwo_aid_t);
114 typedef dev_info_t *gptwo_uncfgfunc_t(dev_info_t *);
115 void gptwocfg_register_ops(uint_t, gptwo_cfgfunc_t *, gptwo_uncfgfunc_t *);
116 void gptwocfg_unregister_ops(uint_t);
117 gptwo_new_nodes_t *gptwocfg_allocate_node_list(int);
118 void gptwocfg_free_node_list(gptwo_new_nodes_t *);
119 void gptwocfg_devi_attach_to_parent(dev_info_t *);
120 
121 struct gfc_ops_v {
122 	char *svc_name;
123 	fc_ops_t *f;
124 };
125 
126 extern struct gfc_ops_v gptwo_pov[];
127 
128 #ifdef	__cplusplus
129 }
130 #endif
131 
132 #endif	/* _SYS_GP2CFG_H */
133