xref: /illumos-gate/usr/src/uts/sun4u/sys/sbd.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 2002-2003 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	_SBD_H
28*7c478bd9Sstevel@tonic-gate #define	_SBD_H
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*7c478bd9Sstevel@tonic-gate 
32*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
33*7c478bd9Sstevel@tonic-gate extern "C" {
34*7c478bd9Sstevel@tonic-gate #endif
35*7c478bd9Sstevel@tonic-gate 
36*7c478bd9Sstevel@tonic-gate #include <sys/dditypes.h>
37*7c478bd9Sstevel@tonic-gate /*
38*7c478bd9Sstevel@tonic-gate  * SBD LOWER STRUCTURES AND INTERFACES
39*7c478bd9Sstevel@tonic-gate  */
40*7c478bd9Sstevel@tonic-gate 
41*7c478bd9Sstevel@tonic-gate typedef uint32_t	sbd_flags_t;
42*7c478bd9Sstevel@tonic-gate 
43*7c478bd9Sstevel@tonic-gate /*
44*7c478bd9Sstevel@tonic-gate  * Flag definitions
45*7c478bd9Sstevel@tonic-gate  */
46*7c478bd9Sstevel@tonic-gate #define	SBDP_IOCTL_FLAG_FORCE	0x1
47*7c478bd9Sstevel@tonic-gate 
48*7c478bd9Sstevel@tonic-gate typedef struct {
49*7c478bd9Sstevel@tonic-gate 	int		size;	/* length of the options */
50*7c478bd9Sstevel@tonic-gate 	char		*copts;	/* pointer to the platform options */
51*7c478bd9Sstevel@tonic-gate } sbdp_opts_t;
52*7c478bd9Sstevel@tonic-gate 
53*7c478bd9Sstevel@tonic-gate typedef struct {
54*7c478bd9Sstevel@tonic-gate 	sbd_error_t	*h_err;		/* error reporting from lower layer */
55*7c478bd9Sstevel@tonic-gate 	int		h_board;	/* board number */
56*7c478bd9Sstevel@tonic-gate 	int		h_wnode;	/* node ID */
57*7c478bd9Sstevel@tonic-gate 	sbd_flags_t	h_flags;
58*7c478bd9Sstevel@tonic-gate 	sbdp_opts_t	*h_opts;	/* points to the platform options */
59*7c478bd9Sstevel@tonic-gate } sbdp_handle_t;
60*7c478bd9Sstevel@tonic-gate 
61*7c478bd9Sstevel@tonic-gate /* struct for device name to type mapping */
62*7c478bd9Sstevel@tonic-gate typedef struct {
63*7c478bd9Sstevel@tonic-gate 	char		*s_devname;	/* OBP name */
64*7c478bd9Sstevel@tonic-gate 	char		*s_obp_type;	/* OBP type */
65*7c478bd9Sstevel@tonic-gate 	sbd_comp_type_t	s_dnodetype;	/* SBD type */
66*7c478bd9Sstevel@tonic-gate } sbd_devattr_t;
67*7c478bd9Sstevel@tonic-gate 
68*7c478bd9Sstevel@tonic-gate typedef struct {
69*7c478bd9Sstevel@tonic-gate 	dnode_t		dnodeid;
70*7c478bd9Sstevel@tonic-gate 	uint64_t	*basepa;
71*7c478bd9Sstevel@tonic-gate } sbd_basephys_t;
72*7c478bd9Sstevel@tonic-gate 
73*7c478bd9Sstevel@tonic-gate typedef struct {
74*7c478bd9Sstevel@tonic-gate 	dev_t		h_dev;		/* dev_t of opened device */
75*7c478bd9Sstevel@tonic-gate 	int		h_cmd;		/* ioctl argument */
76*7c478bd9Sstevel@tonic-gate 	int		h_mode;
77*7c478bd9Sstevel@tonic-gate 	intptr_t	h_iap;	/* points to kernel copy of ioargs */
78*7c478bd9Sstevel@tonic-gate } sbdp_ioctl_arg_t;
79*7c478bd9Sstevel@tonic-gate 
80*7c478bd9Sstevel@tonic-gate 
81*7c478bd9Sstevel@tonic-gate struct sbd_mem_unit;		/* forward decl */
82*7c478bd9Sstevel@tonic-gate 
83*7c478bd9Sstevel@tonic-gate int sbdp_setup_instance(caddr_t arg);
84*7c478bd9Sstevel@tonic-gate int sbdp_teardown_instance(caddr_t arg);
85*7c478bd9Sstevel@tonic-gate int sbdp_assign_board(sbdp_handle_t *hp);
86*7c478bd9Sstevel@tonic-gate int sbdp_connect_board(sbdp_handle_t *hp);
87*7c478bd9Sstevel@tonic-gate int sbdp_disconnect_board(sbdp_handle_t *hp);
88*7c478bd9Sstevel@tonic-gate int sbdp_get_board_num(sbdp_handle_t *hp, dev_info_t *dip);
89*7c478bd9Sstevel@tonic-gate int sbdp_get_board_status(sbdp_handle_t *, sbd_stat_t *);
90*7c478bd9Sstevel@tonic-gate int sbdp_cancel_component_release(sbdp_handle_t *hp);
91*7c478bd9Sstevel@tonic-gate processorid_t sbdp_get_cpuid(sbdp_handle_t *hp, dev_info_t *dip);
92*7c478bd9Sstevel@tonic-gate int sbdp_connect_cpu(sbdp_handle_t *, dev_info_t *, processorid_t);
93*7c478bd9Sstevel@tonic-gate int sbdp_disconnect_cpu(sbdp_handle_t *, dev_info_t *, processorid_t);
94*7c478bd9Sstevel@tonic-gate sbd_devattr_t  *sbdp_get_devattr(void);
95*7c478bd9Sstevel@tonic-gate int sbdp_get_mem_alignment(sbdp_handle_t *hp, dev_info_t *dip, uint64_t *align);
96*7c478bd9Sstevel@tonic-gate struct memlist *sbdp_get_memlist(sbdp_handle_t *hp, dev_info_t *dip);
97*7c478bd9Sstevel@tonic-gate int sbdp_del_memlist(sbdp_handle_t *hp, struct memlist *mlist);
98*7c478bd9Sstevel@tonic-gate int sbdp_get_unit_num(sbdp_handle_t *hp, dev_info_t *dip);
99*7c478bd9Sstevel@tonic-gate int sbdp_portid_to_cpu_unit(int cmp, int core);
100*7c478bd9Sstevel@tonic-gate int sbdp_move_memory(sbdp_handle_t *, int t_bd);
101*7c478bd9Sstevel@tonic-gate int sbdp_mem_add_span(sbdp_handle_t *hp, uint64_t address, uint64_t size);
102*7c478bd9Sstevel@tonic-gate int sbdp_get_mem_size(sbdp_handle_t *hp);
103*7c478bd9Sstevel@tonic-gate int sbdp_mem_del_span(sbdp_handle_t *hp, uint64_t address, uint64_t size);
104*7c478bd9Sstevel@tonic-gate int sbdp_poweroff_board(sbdp_handle_t *hp);
105*7c478bd9Sstevel@tonic-gate int sbdp_poweron_board(sbdp_handle_t *hp);
106*7c478bd9Sstevel@tonic-gate int sbdp_release_component(sbdp_handle_t *hp, dev_info_t *dip);
107*7c478bd9Sstevel@tonic-gate int sbdp_test_board(sbdp_handle_t *hp, sbdp_opts_t *opts);
108*7c478bd9Sstevel@tonic-gate int sbdp_unassign_board(sbdp_handle_t *hp);
109*7c478bd9Sstevel@tonic-gate int sbdphw_disable_memctrl(sbdp_handle_t *hp, dev_info_t *dip);
110*7c478bd9Sstevel@tonic-gate int sbdphw_enable_memctrl(sbdp_handle_t *hp, dev_info_t *dip);
111*7c478bd9Sstevel@tonic-gate int sbdphw_get_base_physaddr(sbdp_handle_t *hp, dev_info_t *dip, uint64_t *pa);
112*7c478bd9Sstevel@tonic-gate int sbdp_isbootproc(processorid_t cpuid);
113*7c478bd9Sstevel@tonic-gate int sbdp_ioctl(sbdp_handle_t *, sbdp_ioctl_arg_t *);
114*7c478bd9Sstevel@tonic-gate int sbdp_isinterleaved(sbdp_handle_t *, dev_info_t *);
115*7c478bd9Sstevel@tonic-gate void sbdp_check_devices(dev_info_t *, int *refcount, sbd_error_t *);
116*7c478bd9Sstevel@tonic-gate int sbdp_dr_avail(void);
117*7c478bd9Sstevel@tonic-gate 
118*7c478bd9Sstevel@tonic-gate extern int sbdp_cpu_get_impl(sbdp_handle_t *hp, dev_info_t *dip);
119*7c478bd9Sstevel@tonic-gate 
120*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
121*7c478bd9Sstevel@tonic-gate }
122*7c478bd9Sstevel@tonic-gate #endif
123*7c478bd9Sstevel@tonic-gate 
124*7c478bd9Sstevel@tonic-gate #endif	/* _SBD_H */
125