xref: /titanic_51/usr/src/uts/sun4u/sys/sbd.h (revision df3cd224ef765c29101e4110546062199562f757)
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
5*df3cd224SVijay S Balakrishna  * Common Development and Distribution License (the "License").
6*df3cd224SVijay S Balakrishna  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*df3cd224SVijay S Balakrishna  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef	_SBD_H
277c478bd9Sstevel@tonic-gate #define	_SBD_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
307c478bd9Sstevel@tonic-gate extern "C" {
317c478bd9Sstevel@tonic-gate #endif
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate #include <sys/dditypes.h>
347c478bd9Sstevel@tonic-gate /*
357c478bd9Sstevel@tonic-gate  * SBD LOWER STRUCTURES AND INTERFACES
367c478bd9Sstevel@tonic-gate  */
377c478bd9Sstevel@tonic-gate 
387c478bd9Sstevel@tonic-gate typedef uint32_t	sbd_flags_t;
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate /*
417c478bd9Sstevel@tonic-gate  * Flag definitions
427c478bd9Sstevel@tonic-gate  */
437c478bd9Sstevel@tonic-gate #define	SBDP_IOCTL_FLAG_FORCE	0x1
447c478bd9Sstevel@tonic-gate 
457c478bd9Sstevel@tonic-gate typedef struct {
467c478bd9Sstevel@tonic-gate 	int		size;	/* length of the options */
477c478bd9Sstevel@tonic-gate 	char		*copts;	/* pointer to the platform options */
487c478bd9Sstevel@tonic-gate } sbdp_opts_t;
497c478bd9Sstevel@tonic-gate 
507c478bd9Sstevel@tonic-gate typedef struct {
517c478bd9Sstevel@tonic-gate 	sbd_error_t	*h_err;		/* error reporting from lower layer */
527c478bd9Sstevel@tonic-gate 	int		h_board;	/* board number */
537c478bd9Sstevel@tonic-gate 	int		h_wnode;	/* node ID */
547c478bd9Sstevel@tonic-gate 	sbd_flags_t	h_flags;
557c478bd9Sstevel@tonic-gate 	sbdp_opts_t	*h_opts;	/* points to the platform options */
567c478bd9Sstevel@tonic-gate } sbdp_handle_t;
577c478bd9Sstevel@tonic-gate 
587c478bd9Sstevel@tonic-gate /* struct for device name to type mapping */
597c478bd9Sstevel@tonic-gate typedef struct {
607c478bd9Sstevel@tonic-gate 	char		*s_devname;	/* OBP name */
617c478bd9Sstevel@tonic-gate 	char		*s_obp_type;	/* OBP type */
627c478bd9Sstevel@tonic-gate 	sbd_comp_type_t	s_dnodetype;	/* SBD type */
637c478bd9Sstevel@tonic-gate } sbd_devattr_t;
647c478bd9Sstevel@tonic-gate 
657c478bd9Sstevel@tonic-gate typedef struct {
66fa9e4066Sahrens 	pnode_t		dnodeid;
677c478bd9Sstevel@tonic-gate 	uint64_t	*basepa;
687c478bd9Sstevel@tonic-gate } sbd_basephys_t;
697c478bd9Sstevel@tonic-gate 
707c478bd9Sstevel@tonic-gate typedef struct {
717c478bd9Sstevel@tonic-gate 	dev_t		h_dev;		/* dev_t of opened device */
727c478bd9Sstevel@tonic-gate 	int		h_cmd;		/* ioctl argument */
737c478bd9Sstevel@tonic-gate 	int		h_mode;
747c478bd9Sstevel@tonic-gate 	intptr_t	h_iap;	/* points to kernel copy of ioargs */
757c478bd9Sstevel@tonic-gate } sbdp_ioctl_arg_t;
767c478bd9Sstevel@tonic-gate 
777c478bd9Sstevel@tonic-gate 
787c478bd9Sstevel@tonic-gate struct sbd_mem_unit;		/* forward decl */
797c478bd9Sstevel@tonic-gate 
807c478bd9Sstevel@tonic-gate int sbdp_setup_instance(caddr_t arg);
817c478bd9Sstevel@tonic-gate int sbdp_teardown_instance(caddr_t arg);
827c478bd9Sstevel@tonic-gate int sbdp_assign_board(sbdp_handle_t *hp);
837c478bd9Sstevel@tonic-gate int sbdp_connect_board(sbdp_handle_t *hp);
847c478bd9Sstevel@tonic-gate int sbdp_disconnect_board(sbdp_handle_t *hp);
857c478bd9Sstevel@tonic-gate int sbdp_get_board_num(sbdp_handle_t *hp, dev_info_t *dip);
867c478bd9Sstevel@tonic-gate int sbdp_get_board_status(sbdp_handle_t *, sbd_stat_t *);
877c478bd9Sstevel@tonic-gate int sbdp_cancel_component_release(sbdp_handle_t *hp);
887c478bd9Sstevel@tonic-gate processorid_t sbdp_get_cpuid(sbdp_handle_t *hp, dev_info_t *dip);
897c478bd9Sstevel@tonic-gate int sbdp_connect_cpu(sbdp_handle_t *, dev_info_t *, processorid_t);
907c478bd9Sstevel@tonic-gate int sbdp_disconnect_cpu(sbdp_handle_t *, dev_info_t *, processorid_t);
917c478bd9Sstevel@tonic-gate sbd_devattr_t  *sbdp_get_devattr(void);
927c478bd9Sstevel@tonic-gate int sbdp_get_mem_alignment(sbdp_handle_t *hp, dev_info_t *dip, uint64_t *align);
937c478bd9Sstevel@tonic-gate struct memlist *sbdp_get_memlist(sbdp_handle_t *hp, dev_info_t *dip);
947c478bd9Sstevel@tonic-gate int sbdp_del_memlist(sbdp_handle_t *hp, struct memlist *mlist);
957c478bd9Sstevel@tonic-gate int sbdp_get_unit_num(sbdp_handle_t *hp, dev_info_t *dip);
967c478bd9Sstevel@tonic-gate int sbdp_portid_to_cpu_unit(int cmp, int core);
977c478bd9Sstevel@tonic-gate int sbdp_move_memory(sbdp_handle_t *, int t_bd);
987c478bd9Sstevel@tonic-gate int sbdp_mem_add_span(sbdp_handle_t *hp, uint64_t address, uint64_t size);
997c478bd9Sstevel@tonic-gate int sbdp_get_mem_size(sbdp_handle_t *hp);
1007c478bd9Sstevel@tonic-gate int sbdp_mem_del_span(sbdp_handle_t *hp, uint64_t address, uint64_t size);
1017c478bd9Sstevel@tonic-gate int sbdp_poweroff_board(sbdp_handle_t *hp);
1027c478bd9Sstevel@tonic-gate int sbdp_poweron_board(sbdp_handle_t *hp);
1037c478bd9Sstevel@tonic-gate int sbdp_release_component(sbdp_handle_t *hp, dev_info_t *dip);
1047c478bd9Sstevel@tonic-gate int sbdp_test_board(sbdp_handle_t *hp, sbdp_opts_t *opts);
1057c478bd9Sstevel@tonic-gate int sbdp_unassign_board(sbdp_handle_t *hp);
1067c478bd9Sstevel@tonic-gate int sbdphw_disable_memctrl(sbdp_handle_t *hp, dev_info_t *dip);
1077c478bd9Sstevel@tonic-gate int sbdphw_enable_memctrl(sbdp_handle_t *hp, dev_info_t *dip);
1087c478bd9Sstevel@tonic-gate int sbdphw_get_base_physaddr(sbdp_handle_t *hp, dev_info_t *dip, uint64_t *pa);
1097c478bd9Sstevel@tonic-gate int sbdp_isbootproc(processorid_t cpuid);
1107c478bd9Sstevel@tonic-gate int sbdp_ioctl(sbdp_handle_t *, sbdp_ioctl_arg_t *);
1117c478bd9Sstevel@tonic-gate int sbdp_isinterleaved(sbdp_handle_t *, dev_info_t *);
112*df3cd224SVijay S Balakrishna void sbdp_check_devices(dev_info_t *, int *refcount, sbd_error_t *, int *);
1137c478bd9Sstevel@tonic-gate int sbdp_dr_avail(void);
1147c478bd9Sstevel@tonic-gate 
1157c478bd9Sstevel@tonic-gate extern int sbdp_cpu_get_impl(sbdp_handle_t *hp, dev_info_t *dip);
1167c478bd9Sstevel@tonic-gate 
1177c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1187c478bd9Sstevel@tonic-gate }
1197c478bd9Sstevel@tonic-gate #endif
1207c478bd9Sstevel@tonic-gate 
1217c478bd9Sstevel@tonic-gate #endif	/* _SBD_H */
122