xref: /titanic_44/usr/src/uts/sun4u/sys/sbd.h (revision fa9e4066f08beec538e775443c5be79dd423fcab)
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 /*
23*fa9e4066Sahrens  * 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	_SBD_H
287c478bd9Sstevel@tonic-gate #define	_SBD_H
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
337c478bd9Sstevel@tonic-gate extern "C" {
347c478bd9Sstevel@tonic-gate #endif
357c478bd9Sstevel@tonic-gate 
367c478bd9Sstevel@tonic-gate #include <sys/dditypes.h>
377c478bd9Sstevel@tonic-gate /*
387c478bd9Sstevel@tonic-gate  * SBD LOWER STRUCTURES AND INTERFACES
397c478bd9Sstevel@tonic-gate  */
407c478bd9Sstevel@tonic-gate 
417c478bd9Sstevel@tonic-gate typedef uint32_t	sbd_flags_t;
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate /*
447c478bd9Sstevel@tonic-gate  * Flag definitions
457c478bd9Sstevel@tonic-gate  */
467c478bd9Sstevel@tonic-gate #define	SBDP_IOCTL_FLAG_FORCE	0x1
477c478bd9Sstevel@tonic-gate 
487c478bd9Sstevel@tonic-gate typedef struct {
497c478bd9Sstevel@tonic-gate 	int		size;	/* length of the options */
507c478bd9Sstevel@tonic-gate 	char		*copts;	/* pointer to the platform options */
517c478bd9Sstevel@tonic-gate } sbdp_opts_t;
527c478bd9Sstevel@tonic-gate 
537c478bd9Sstevel@tonic-gate typedef struct {
547c478bd9Sstevel@tonic-gate 	sbd_error_t	*h_err;		/* error reporting from lower layer */
557c478bd9Sstevel@tonic-gate 	int		h_board;	/* board number */
567c478bd9Sstevel@tonic-gate 	int		h_wnode;	/* node ID */
577c478bd9Sstevel@tonic-gate 	sbd_flags_t	h_flags;
587c478bd9Sstevel@tonic-gate 	sbdp_opts_t	*h_opts;	/* points to the platform options */
597c478bd9Sstevel@tonic-gate } sbdp_handle_t;
607c478bd9Sstevel@tonic-gate 
617c478bd9Sstevel@tonic-gate /* struct for device name to type mapping */
627c478bd9Sstevel@tonic-gate typedef struct {
637c478bd9Sstevel@tonic-gate 	char		*s_devname;	/* OBP name */
647c478bd9Sstevel@tonic-gate 	char		*s_obp_type;	/* OBP type */
657c478bd9Sstevel@tonic-gate 	sbd_comp_type_t	s_dnodetype;	/* SBD type */
667c478bd9Sstevel@tonic-gate } sbd_devattr_t;
677c478bd9Sstevel@tonic-gate 
687c478bd9Sstevel@tonic-gate typedef struct {
69*fa9e4066Sahrens 	pnode_t		dnodeid;
707c478bd9Sstevel@tonic-gate 	uint64_t	*basepa;
717c478bd9Sstevel@tonic-gate } sbd_basephys_t;
727c478bd9Sstevel@tonic-gate 
737c478bd9Sstevel@tonic-gate typedef struct {
747c478bd9Sstevel@tonic-gate 	dev_t		h_dev;		/* dev_t of opened device */
757c478bd9Sstevel@tonic-gate 	int		h_cmd;		/* ioctl argument */
767c478bd9Sstevel@tonic-gate 	int		h_mode;
777c478bd9Sstevel@tonic-gate 	intptr_t	h_iap;	/* points to kernel copy of ioargs */
787c478bd9Sstevel@tonic-gate } sbdp_ioctl_arg_t;
797c478bd9Sstevel@tonic-gate 
807c478bd9Sstevel@tonic-gate 
817c478bd9Sstevel@tonic-gate struct sbd_mem_unit;		/* forward decl */
827c478bd9Sstevel@tonic-gate 
837c478bd9Sstevel@tonic-gate int sbdp_setup_instance(caddr_t arg);
847c478bd9Sstevel@tonic-gate int sbdp_teardown_instance(caddr_t arg);
857c478bd9Sstevel@tonic-gate int sbdp_assign_board(sbdp_handle_t *hp);
867c478bd9Sstevel@tonic-gate int sbdp_connect_board(sbdp_handle_t *hp);
877c478bd9Sstevel@tonic-gate int sbdp_disconnect_board(sbdp_handle_t *hp);
887c478bd9Sstevel@tonic-gate int sbdp_get_board_num(sbdp_handle_t *hp, dev_info_t *dip);
897c478bd9Sstevel@tonic-gate int sbdp_get_board_status(sbdp_handle_t *, sbd_stat_t *);
907c478bd9Sstevel@tonic-gate int sbdp_cancel_component_release(sbdp_handle_t *hp);
917c478bd9Sstevel@tonic-gate processorid_t sbdp_get_cpuid(sbdp_handle_t *hp, dev_info_t *dip);
927c478bd9Sstevel@tonic-gate int sbdp_connect_cpu(sbdp_handle_t *, dev_info_t *, processorid_t);
937c478bd9Sstevel@tonic-gate int sbdp_disconnect_cpu(sbdp_handle_t *, dev_info_t *, processorid_t);
947c478bd9Sstevel@tonic-gate sbd_devattr_t  *sbdp_get_devattr(void);
957c478bd9Sstevel@tonic-gate int sbdp_get_mem_alignment(sbdp_handle_t *hp, dev_info_t *dip, uint64_t *align);
967c478bd9Sstevel@tonic-gate struct memlist *sbdp_get_memlist(sbdp_handle_t *hp, dev_info_t *dip);
977c478bd9Sstevel@tonic-gate int sbdp_del_memlist(sbdp_handle_t *hp, struct memlist *mlist);
987c478bd9Sstevel@tonic-gate int sbdp_get_unit_num(sbdp_handle_t *hp, dev_info_t *dip);
997c478bd9Sstevel@tonic-gate int sbdp_portid_to_cpu_unit(int cmp, int core);
1007c478bd9Sstevel@tonic-gate int sbdp_move_memory(sbdp_handle_t *, int t_bd);
1017c478bd9Sstevel@tonic-gate int sbdp_mem_add_span(sbdp_handle_t *hp, uint64_t address, uint64_t size);
1027c478bd9Sstevel@tonic-gate int sbdp_get_mem_size(sbdp_handle_t *hp);
1037c478bd9Sstevel@tonic-gate int sbdp_mem_del_span(sbdp_handle_t *hp, uint64_t address, uint64_t size);
1047c478bd9Sstevel@tonic-gate int sbdp_poweroff_board(sbdp_handle_t *hp);
1057c478bd9Sstevel@tonic-gate int sbdp_poweron_board(sbdp_handle_t *hp);
1067c478bd9Sstevel@tonic-gate int sbdp_release_component(sbdp_handle_t *hp, dev_info_t *dip);
1077c478bd9Sstevel@tonic-gate int sbdp_test_board(sbdp_handle_t *hp, sbdp_opts_t *opts);
1087c478bd9Sstevel@tonic-gate int sbdp_unassign_board(sbdp_handle_t *hp);
1097c478bd9Sstevel@tonic-gate int sbdphw_disable_memctrl(sbdp_handle_t *hp, dev_info_t *dip);
1107c478bd9Sstevel@tonic-gate int sbdphw_enable_memctrl(sbdp_handle_t *hp, dev_info_t *dip);
1117c478bd9Sstevel@tonic-gate int sbdphw_get_base_physaddr(sbdp_handle_t *hp, dev_info_t *dip, uint64_t *pa);
1127c478bd9Sstevel@tonic-gate int sbdp_isbootproc(processorid_t cpuid);
1137c478bd9Sstevel@tonic-gate int sbdp_ioctl(sbdp_handle_t *, sbdp_ioctl_arg_t *);
1147c478bd9Sstevel@tonic-gate int sbdp_isinterleaved(sbdp_handle_t *, dev_info_t *);
1157c478bd9Sstevel@tonic-gate void sbdp_check_devices(dev_info_t *, int *refcount, sbd_error_t *);
1167c478bd9Sstevel@tonic-gate int sbdp_dr_avail(void);
1177c478bd9Sstevel@tonic-gate 
1187c478bd9Sstevel@tonic-gate extern int sbdp_cpu_get_impl(sbdp_handle_t *hp, dev_info_t *dip);
1197c478bd9Sstevel@tonic-gate 
1207c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1217c478bd9Sstevel@tonic-gate }
1227c478bd9Sstevel@tonic-gate #endif
1237c478bd9Sstevel@tonic-gate 
1247c478bd9Sstevel@tonic-gate #endif	/* _SBD_H */
125