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
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.
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]
23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #ifndef _SYS_DRMACH_H_
28 #define _SYS_DRMACH_H_
30 #pragma ident "%Z%%M% %I% %E% SMI"
32 #include <sys/types.h>
33 #include <sys/memlist.h>
34 #include <sys/processor.h>
35 #include <sys/sbd_ioctl.h>
36 #include <sys/sysevent.h>
43 * Starcat platform specific routines currently only defined
44 * in starcat.c and referenced by DR.
46 extern int plat_max_boards();
47 extern int plat_max_cpu_units_per_board();
48 extern int plat_max_io_units_per_board();
50 #define MAX_BOARDS plat_max_boards()
51 #define MAX_CPU_UNITS_PER_BOARD plat_max_cpu_units_per_board()
52 #define MAX_MEM_UNITS_PER_BOARD 1
53 #define MAX_IO_UNITS_PER_BOARD plat_max_io_units_per_board()
54 #define MAX_CMP_UNITS_PER_BOARD 4
55 #define MAX_CORES_PER_CMP 2
57 /* flags for drmach_configure() and drmach_unconfigure() */
58 #define DRMACH_DEVI_FORCE 1
59 #define DRMACH_DEVI_REMOVE 2
61 /* returned with drmach_board_find_devices callback */
62 #define DRMACH_DEVTYPE_CMP "cmp"
63 #define DRMACH_DEVTYPE_CPU "cpu"
64 #define DRMACH_DEVTYPE_MEM "memory"
65 #define DRMACH_DEVTYPE_PCI "pci"
66 #define DRMACH_DEVTYPE_SBUS "sbus"
67 #define DRMACH_DEVTYPE_WCI "wci"
69 /* number of bytes in smallest coherency unit of this machine */
70 #define DRMACH_COHERENCY_UNIT 64
72 typedef void *drmachid_t
;
81 char type
[MAXNAMELEN
];
82 char info
[MAXPATHLEN
]; /* TODO: what size? */
90 extern sbd_error_t
*drmach_copy_rename_init(
91 drmachid_t dst_id
, uint64_t dst_slice_offset
,
92 drmachid_t src_id
, struct memlist
*src_copy_ml
,
94 extern sbd_error_t
*drmach_copy_rename_fini(drmachid_t id
);
95 extern void drmach_copy_rename(drmachid_t id
);
97 extern sbd_error_t
*drmach_pre_op(int cmd
, drmachid_t id
,
99 extern sbd_error_t
*drmach_post_op(int cmd
, drmachid_t id
,
100 drmach_opts_t
*opts
);
102 extern sbd_error_t
*drmach_board_assign(int bnum
, drmachid_t
*id
);
103 extern sbd_error_t
*drmach_board_connect(drmachid_t id
,
104 drmach_opts_t
*opts
);
105 extern sbd_error_t
*drmach_board_deprobe(drmachid_t id
);
106 extern sbd_error_t
*drmach_board_disconnect(drmachid_t id
,
107 drmach_opts_t
*opts
);
108 extern sbd_error_t
*drmach_board_find_devices(drmachid_t id
, void *a
,
109 sbd_error_t
*(*found
)(void *a
, const char *, int, drmachid_t
));
110 extern int drmach_board_lookup(int bnum
, drmachid_t
*id
);
111 extern sbd_error_t
*drmach_passthru(drmachid_t id
,
112 drmach_opts_t
*opts
);
114 extern sbd_error_t
*drmach_board_name(int bnum
, char *buf
, int buflen
);
116 extern sbd_error_t
*drmach_board_poweroff(drmachid_t id
);
117 extern sbd_error_t
*drmach_board_poweron(drmachid_t id
);
118 extern sbd_error_t
*drmach_board_test(drmachid_t id
, drmach_opts_t
*opts
,
121 extern sbd_error_t
*drmach_board_unassign(drmachid_t id
);
123 extern sbd_error_t
*drmach_configure(drmachid_t id
, int flags
);
125 extern sbd_error_t
*drmach_cpu_disconnect(drmachid_t id
);
126 extern sbd_error_t
*drmach_cpu_get_id(drmachid_t id
, processorid_t
*cpuid
);
127 extern sbd_error_t
*drmach_cpu_get_impl(drmachid_t id
, int *ip
);
128 extern void drmach_cpu_flush_ecache_sync(void);
130 extern sbd_error_t
*drmach_get_dip(drmachid_t id
, dev_info_t
**dip
);
132 extern sbd_error_t
*drmach_io_is_attached(drmachid_t id
, int *yes
);
133 extern sbd_error_t
*drmach_io_post_attach(drmachid_t id
);
134 extern sbd_error_t
*drmach_io_post_release(drmachid_t id
);
135 extern sbd_error_t
*drmach_io_pre_release(drmachid_t id
);
136 extern sbd_error_t
*drmach_io_unrelease(drmachid_t id
);
138 extern sbd_error_t
*drmach_mem_add_span(drmachid_t id
,
139 uint64_t basepa
, uint64_t size
);
140 extern sbd_error_t
*drmach_mem_del_span(drmachid_t id
,
141 uint64_t basepa
, uint64_t size
);
142 extern sbd_error_t
*drmach_mem_disable(drmachid_t id
);
143 extern sbd_error_t
*drmach_mem_enable(drmachid_t id
);
144 extern sbd_error_t
*drmach_mem_get_alignment(drmachid_t id
, uint64_t *pa
);
145 extern sbd_error_t
*drmach_mem_get_base_physaddr(drmachid_t id
,
147 extern sbd_error_t
*drmach_mem_get_memlist(drmachid_t id
,
148 struct memlist
**ml
);
149 extern sbd_error_t
*drmach_mem_get_size(drmachid_t id
, uint64_t *bytes
);
150 extern sbd_error_t
*drmach_mem_get_slice_size(drmachid_t id
,
152 extern processorid_t
drmach_mem_cpu_affinity(drmachid_t id
);
153 extern int drmach_allow_memrange_modify(drmachid_t id
);
155 extern sbd_error_t
*drmach_release(drmachid_t id
);
156 extern sbd_error_t
*drmach_status(drmachid_t id
, drmach_status_t
*stat
);
157 extern sbd_error_t
*drmach_unconfigure(drmachid_t id
, int flags
);
158 extern int drmach_log_sysevent(int board
, char *hint
, int flag
,
161 extern int drmach_verify_sr(dev_info_t
*dip
, int sflag
);
162 extern void drmach_suspend_last();
163 extern void drmach_resume_first();
169 #endif /* _SYS_DRMACH_H_ */