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