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