xref: /illumos-gate/usr/src/uts/sun4u/sys/sbd.h (revision c8d9a41c357577f316e58fb2603f85c598f01afb)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_SBD_H
27 #define	_SBD_H
28 
29 #ifdef	__cplusplus
30 extern "C" {
31 #endif
32 
33 #include <sys/dditypes.h>
34 /*
35  * SBD LOWER STRUCTURES AND INTERFACES
36  */
37 
38 typedef uint32_t	sbd_flags_t;
39 
40 /*
41  * Flag definitions
42  */
43 #define	SBDP_IOCTL_FLAG_FORCE	0x1
44 
45 typedef struct {
46 	int		size;	/* length of the options */
47 	char		*copts;	/* pointer to the platform options */
48 } sbdp_opts_t;
49 
50 typedef struct {
51 	sbd_error_t	*h_err;		/* error reporting from lower layer */
52 	int		h_board;	/* board number */
53 	int		h_wnode;	/* node ID */
54 	sbd_flags_t	h_flags;
55 	sbdp_opts_t	*h_opts;	/* points to the platform options */
56 } sbdp_handle_t;
57 
58 /* struct for device name to type mapping */
59 typedef struct {
60 	char		*s_devname;	/* OBP name */
61 	char		*s_obp_type;	/* OBP type */
62 	sbd_comp_type_t	s_dnodetype;	/* SBD type */
63 } sbd_devattr_t;
64 
65 typedef struct {
66 	pnode_t		dnodeid;
67 	uint64_t	*basepa;
68 } sbd_basephys_t;
69 
70 typedef struct {
71 	dev_t		h_dev;		/* dev_t of opened device */
72 	int		h_cmd;		/* ioctl argument */
73 	int		h_mode;
74 	intptr_t	h_iap;	/* points to kernel copy of ioargs */
75 } sbdp_ioctl_arg_t;
76 
77 
78 struct sbd_mem_unit;		/* forward decl */
79 
80 int sbdp_setup_instance(caddr_t arg);
81 int sbdp_teardown_instance(caddr_t arg);
82 int sbdp_assign_board(sbdp_handle_t *hp);
83 int sbdp_connect_board(sbdp_handle_t *hp);
84 int sbdp_disconnect_board(sbdp_handle_t *hp);
85 int sbdp_get_board_num(sbdp_handle_t *hp, dev_info_t *dip);
86 int sbdp_get_board_status(sbdp_handle_t *, sbd_stat_t *);
87 int sbdp_cancel_component_release(sbdp_handle_t *hp);
88 processorid_t sbdp_get_cpuid(sbdp_handle_t *hp, dev_info_t *dip);
89 int sbdp_connect_cpu(sbdp_handle_t *, dev_info_t *, processorid_t);
90 int sbdp_disconnect_cpu(sbdp_handle_t *, dev_info_t *, processorid_t);
91 sbd_devattr_t  *sbdp_get_devattr(void);
92 int sbdp_get_mem_alignment(sbdp_handle_t *hp, dev_info_t *dip, uint64_t *align);
93 struct memlist *sbdp_get_memlist(sbdp_handle_t *hp, dev_info_t *dip);
94 int sbdp_del_memlist(sbdp_handle_t *hp, struct memlist *mlist);
95 int sbdp_get_unit_num(sbdp_handle_t *hp, dev_info_t *dip);
96 int sbdp_portid_to_cpu_unit(int cmp, int core);
97 int sbdp_move_memory(sbdp_handle_t *, int t_bd);
98 int sbdp_mem_add_span(sbdp_handle_t *hp, uint64_t address, uint64_t size);
99 int sbdp_get_mem_size(sbdp_handle_t *hp);
100 int sbdp_mem_del_span(sbdp_handle_t *hp, uint64_t address, uint64_t size);
101 int sbdp_poweroff_board(sbdp_handle_t *hp);
102 int sbdp_poweron_board(sbdp_handle_t *hp);
103 int sbdp_release_component(sbdp_handle_t *hp, dev_info_t *dip);
104 int sbdp_test_board(sbdp_handle_t *hp, sbdp_opts_t *opts);
105 int sbdp_unassign_board(sbdp_handle_t *hp);
106 int sbdphw_disable_memctrl(sbdp_handle_t *hp, dev_info_t *dip);
107 int sbdphw_enable_memctrl(sbdp_handle_t *hp, dev_info_t *dip);
108 int sbdphw_get_base_physaddr(sbdp_handle_t *hp, dev_info_t *dip, uint64_t *pa);
109 int sbdp_isbootproc(processorid_t cpuid);
110 int sbdp_ioctl(sbdp_handle_t *, sbdp_ioctl_arg_t *);
111 int sbdp_isinterleaved(sbdp_handle_t *, dev_info_t *);
112 void sbdp_check_devices(dev_info_t *, int *refcount, sbd_error_t *, int *);
113 int sbdp_dr_avail(void);
114 
115 extern int sbdp_cpu_get_impl(sbdp_handle_t *hp, dev_info_t *dip);
116 
117 #ifdef	__cplusplus
118 }
119 #endif
120 
121 #endif	/* _SBD_H */
122