xref: /titanic_44/usr/src/uts/sun4u/starcat/sys/drmach.h (revision 8fabb5d7aaaa6f5d6e0fce4d27e0347860320f6b)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
227c478bd9Sstevel@tonic-gate /*
237c478bd9Sstevel@tonic-gate  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate #ifndef _SYS_DRMACH_H_
287c478bd9Sstevel@tonic-gate #define	_SYS_DRMACH_H_
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate #include <sys/types.h>
337c478bd9Sstevel@tonic-gate #include <sys/memlist.h>
347c478bd9Sstevel@tonic-gate #include <sys/processor.h>
357c478bd9Sstevel@tonic-gate #include <sys/sbd_ioctl.h>
367c478bd9Sstevel@tonic-gate #include <sys/sysevent.h>
377c478bd9Sstevel@tonic-gate 
387c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
397c478bd9Sstevel@tonic-gate extern "C" {
407c478bd9Sstevel@tonic-gate #endif
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate /*
437c478bd9Sstevel@tonic-gate  * Starcat platform specific routines currently only defined
447c478bd9Sstevel@tonic-gate  * in starcat.c and referenced by DR.
457c478bd9Sstevel@tonic-gate  */
467c478bd9Sstevel@tonic-gate extern int	plat_max_boards();
477c478bd9Sstevel@tonic-gate extern int	plat_max_cpu_units_per_board();
487c478bd9Sstevel@tonic-gate extern int	plat_max_io_units_per_board();
497c478bd9Sstevel@tonic-gate 
507c478bd9Sstevel@tonic-gate #define	MAX_BOARDS		plat_max_boards()
517c478bd9Sstevel@tonic-gate #define	MAX_CPU_UNITS_PER_BOARD	plat_max_cpu_units_per_board()
527c478bd9Sstevel@tonic-gate #define	MAX_MEM_UNITS_PER_BOARD	1
537c478bd9Sstevel@tonic-gate #define	MAX_IO_UNITS_PER_BOARD	plat_max_io_units_per_board()
547c478bd9Sstevel@tonic-gate #define	MAX_CMP_UNITS_PER_BOARD	4
557c478bd9Sstevel@tonic-gate #define	MAX_CORES_PER_CMP	2
567c478bd9Sstevel@tonic-gate 
577c478bd9Sstevel@tonic-gate /* flags for drmach_configure() and drmach_unconfigure() */
587c478bd9Sstevel@tonic-gate #define	DRMACH_DEVI_FORCE	1
597c478bd9Sstevel@tonic-gate #define	DRMACH_DEVI_REMOVE	2
607c478bd9Sstevel@tonic-gate 
617c478bd9Sstevel@tonic-gate /* returned with drmach_board_find_devices callback */
62*8fabb5d7Svb70745 #define	DRMACH_DEVTYPE_CMP	"cmp"
637c478bd9Sstevel@tonic-gate #define	DRMACH_DEVTYPE_CPU	"cpu"
647c478bd9Sstevel@tonic-gate #define	DRMACH_DEVTYPE_MEM	"memory"
657c478bd9Sstevel@tonic-gate #define	DRMACH_DEVTYPE_PCI	"pci"
667c478bd9Sstevel@tonic-gate #define	DRMACH_DEVTYPE_SBUS	"sbus"
677c478bd9Sstevel@tonic-gate #define	DRMACH_DEVTYPE_WCI	"wci"
687c478bd9Sstevel@tonic-gate 
697c478bd9Sstevel@tonic-gate /* number of bytes in smallest coherency unit of this machine */
707c478bd9Sstevel@tonic-gate #define	DRMACH_COHERENCY_UNIT	64
717c478bd9Sstevel@tonic-gate 
727c478bd9Sstevel@tonic-gate typedef void *drmachid_t;
737c478bd9Sstevel@tonic-gate 
747c478bd9Sstevel@tonic-gate typedef struct {
757c478bd9Sstevel@tonic-gate 	boolean_t	assigned;
767c478bd9Sstevel@tonic-gate 	boolean_t	powered;
777c478bd9Sstevel@tonic-gate 	boolean_t	configured;
787c478bd9Sstevel@tonic-gate 	boolean_t	busy;
797c478bd9Sstevel@tonic-gate 	boolean_t	empty;
807c478bd9Sstevel@tonic-gate 	sbd_cond_t	cond;
817c478bd9Sstevel@tonic-gate 	char		type[MAXNAMELEN];
827c478bd9Sstevel@tonic-gate 	char		info[MAXPATHLEN];	/* TODO: what size? */
837c478bd9Sstevel@tonic-gate } drmach_status_t;
847c478bd9Sstevel@tonic-gate 
857c478bd9Sstevel@tonic-gate typedef struct {
867c478bd9Sstevel@tonic-gate 	int	size;
877c478bd9Sstevel@tonic-gate 	char	*copts;
887c478bd9Sstevel@tonic-gate } drmach_opts_t;
897c478bd9Sstevel@tonic-gate 
907c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_copy_rename_init(
917c478bd9Sstevel@tonic-gate 				drmachid_t dst_id, uint64_t dst_slice_offset,
927c478bd9Sstevel@tonic-gate 				drmachid_t src_id, struct memlist *src_copy_ml,
937c478bd9Sstevel@tonic-gate 				drmachid_t *pgm_id);
947c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_copy_rename_fini(drmachid_t id);
957c478bd9Sstevel@tonic-gate extern void		 drmach_copy_rename(drmachid_t id);
967c478bd9Sstevel@tonic-gate 
977c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_pre_op(int cmd, drmachid_t id,
987c478bd9Sstevel@tonic-gate 						drmach_opts_t *opts);
997c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_post_op(int cmd, drmachid_t id,
1007c478bd9Sstevel@tonic-gate 						drmach_opts_t *opts);
1017c478bd9Sstevel@tonic-gate 
1027c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_board_assign(int bnum, drmachid_t *id);
1037c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_board_connect(drmachid_t id,
1047c478bd9Sstevel@tonic-gate 						drmach_opts_t *opts);
1057c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_board_deprobe(drmachid_t id);
1067c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_board_disconnect(drmachid_t id,
1077c478bd9Sstevel@tonic-gate 						drmach_opts_t *opts);
1087c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_board_find_devices(drmachid_t id, void *a,
1097c478bd9Sstevel@tonic-gate 		sbd_error_t *(*found)(void *a, const char *, int, drmachid_t));
1107c478bd9Sstevel@tonic-gate extern int		drmach_board_lookup(int bnum, drmachid_t *id);
1117c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_passthru(drmachid_t id,
1127c478bd9Sstevel@tonic-gate 						drmach_opts_t *opts);
1137c478bd9Sstevel@tonic-gate 
1147c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_board_name(int bnum, char *buf, int buflen);
1157c478bd9Sstevel@tonic-gate 
1167c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_board_poweroff(drmachid_t id);
1177c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_board_poweron(drmachid_t id);
1187c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_board_test(drmachid_t id, drmach_opts_t *opts,
1197c478bd9Sstevel@tonic-gate 				int force);
1207c478bd9Sstevel@tonic-gate 
1217c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_board_unassign(drmachid_t id);
1227c478bd9Sstevel@tonic-gate 
1237c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_configure(drmachid_t id, int flags);
1247c478bd9Sstevel@tonic-gate 
1257c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_cpu_disconnect(drmachid_t id);
1267c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_cpu_get_id(drmachid_t id, processorid_t *cpuid);
1277c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_cpu_get_impl(drmachid_t id, int *ip);
1287c478bd9Sstevel@tonic-gate extern void		 drmach_cpu_flush_ecache_sync(void);
1297c478bd9Sstevel@tonic-gate 
1307c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_get_dip(drmachid_t id, dev_info_t **dip);
1317c478bd9Sstevel@tonic-gate 
1327c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_io_is_attached(drmachid_t id, int *yes);
1337c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_io_post_attach(drmachid_t id);
1347c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_io_post_release(drmachid_t id);
1357c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_io_pre_release(drmachid_t id);
1367c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_io_unrelease(drmachid_t id);
1377c478bd9Sstevel@tonic-gate 
1387c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_mem_add_span(drmachid_t id,
1397c478bd9Sstevel@tonic-gate 				uint64_t basepa, uint64_t size);
1407c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_mem_del_span(drmachid_t id,
1417c478bd9Sstevel@tonic-gate 				uint64_t basepa, uint64_t size);
1427c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_mem_disable(drmachid_t id);
1437c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_mem_enable(drmachid_t id);
1447c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_mem_get_alignment(drmachid_t id, uint64_t *pa);
1457c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_mem_get_base_physaddr(drmachid_t id,
1467c478bd9Sstevel@tonic-gate 				uint64_t *pa);
1477c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_mem_get_memlist(drmachid_t id,
1487c478bd9Sstevel@tonic-gate 				struct memlist **ml);
1497c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_mem_get_size(drmachid_t id, uint64_t *bytes);
1507c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_mem_get_slice_size(drmachid_t id,
1517c478bd9Sstevel@tonic-gate 				uint64_t *bytes);
1527c478bd9Sstevel@tonic-gate extern processorid_t	 drmach_mem_cpu_affinity(drmachid_t id);
1537c478bd9Sstevel@tonic-gate extern int		 drmach_allow_memrange_modify(drmachid_t id);
1547c478bd9Sstevel@tonic-gate 
1557c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_release(drmachid_t id);
1567c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_status(drmachid_t id, drmach_status_t *stat);
1577c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_unconfigure(drmachid_t id, int flags);
1587c478bd9Sstevel@tonic-gate extern int		drmach_log_sysevent(int board, char *hint, int flag,
1597c478bd9Sstevel@tonic-gate 					    int verbose);
1607c478bd9Sstevel@tonic-gate 
1617c478bd9Sstevel@tonic-gate extern int		drmach_verify_sr(dev_info_t *dip, int sflag);
1627c478bd9Sstevel@tonic-gate extern void		drmach_suspend_last();
1637c478bd9Sstevel@tonic-gate extern void		drmach_resume_first();
1647c478bd9Sstevel@tonic-gate 
1657c478bd9Sstevel@tonic-gate #ifdef __cplusplus
1667c478bd9Sstevel@tonic-gate }
1677c478bd9Sstevel@tonic-gate #endif
1687c478bd9Sstevel@tonic-gate 
1697c478bd9Sstevel@tonic-gate #endif /* _SYS_DRMACH_H_ */
170