xref: /onnv-gate/usr/src/uts/sun4u/sys/sbd.h (revision 11651:b0aa8d9f0afd)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*11651SVijay.Balakrishna@Sun.COM  * Common Development and Distribution License (the "License").
6*11651SVijay.Balakrishna@Sun.COM  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*11651SVijay.Balakrishna@Sun.COM  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef	_SBD_H
270Sstevel@tonic-gate #define	_SBD_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #ifdef	__cplusplus
300Sstevel@tonic-gate extern "C" {
310Sstevel@tonic-gate #endif
320Sstevel@tonic-gate 
330Sstevel@tonic-gate #include <sys/dditypes.h>
340Sstevel@tonic-gate /*
350Sstevel@tonic-gate  * SBD LOWER STRUCTURES AND INTERFACES
360Sstevel@tonic-gate  */
370Sstevel@tonic-gate 
380Sstevel@tonic-gate typedef uint32_t	sbd_flags_t;
390Sstevel@tonic-gate 
400Sstevel@tonic-gate /*
410Sstevel@tonic-gate  * Flag definitions
420Sstevel@tonic-gate  */
430Sstevel@tonic-gate #define	SBDP_IOCTL_FLAG_FORCE	0x1
440Sstevel@tonic-gate 
450Sstevel@tonic-gate typedef struct {
460Sstevel@tonic-gate 	int		size;	/* length of the options */
470Sstevel@tonic-gate 	char		*copts;	/* pointer to the platform options */
480Sstevel@tonic-gate } sbdp_opts_t;
490Sstevel@tonic-gate 
500Sstevel@tonic-gate typedef struct {
510Sstevel@tonic-gate 	sbd_error_t	*h_err;		/* error reporting from lower layer */
520Sstevel@tonic-gate 	int		h_board;	/* board number */
530Sstevel@tonic-gate 	int		h_wnode;	/* node ID */
540Sstevel@tonic-gate 	sbd_flags_t	h_flags;
550Sstevel@tonic-gate 	sbdp_opts_t	*h_opts;	/* points to the platform options */
560Sstevel@tonic-gate } sbdp_handle_t;
570Sstevel@tonic-gate 
580Sstevel@tonic-gate /* struct for device name to type mapping */
590Sstevel@tonic-gate typedef struct {
600Sstevel@tonic-gate 	char		*s_devname;	/* OBP name */
610Sstevel@tonic-gate 	char		*s_obp_type;	/* OBP type */
620Sstevel@tonic-gate 	sbd_comp_type_t	s_dnodetype;	/* SBD type */
630Sstevel@tonic-gate } sbd_devattr_t;
640Sstevel@tonic-gate 
650Sstevel@tonic-gate typedef struct {
66789Sahrens 	pnode_t		dnodeid;
670Sstevel@tonic-gate 	uint64_t	*basepa;
680Sstevel@tonic-gate } sbd_basephys_t;
690Sstevel@tonic-gate 
700Sstevel@tonic-gate typedef struct {
710Sstevel@tonic-gate 	dev_t		h_dev;		/* dev_t of opened device */
720Sstevel@tonic-gate 	int		h_cmd;		/* ioctl argument */
730Sstevel@tonic-gate 	int		h_mode;
740Sstevel@tonic-gate 	intptr_t	h_iap;	/* points to kernel copy of ioargs */
750Sstevel@tonic-gate } sbdp_ioctl_arg_t;
760Sstevel@tonic-gate 
770Sstevel@tonic-gate 
780Sstevel@tonic-gate struct sbd_mem_unit;		/* forward decl */
790Sstevel@tonic-gate 
800Sstevel@tonic-gate int sbdp_setup_instance(caddr_t arg);
810Sstevel@tonic-gate int sbdp_teardown_instance(caddr_t arg);
820Sstevel@tonic-gate int sbdp_assign_board(sbdp_handle_t *hp);
830Sstevel@tonic-gate int sbdp_connect_board(sbdp_handle_t *hp);
840Sstevel@tonic-gate int sbdp_disconnect_board(sbdp_handle_t *hp);
850Sstevel@tonic-gate int sbdp_get_board_num(sbdp_handle_t *hp, dev_info_t *dip);
860Sstevel@tonic-gate int sbdp_get_board_status(sbdp_handle_t *, sbd_stat_t *);
870Sstevel@tonic-gate int sbdp_cancel_component_release(sbdp_handle_t *hp);
880Sstevel@tonic-gate processorid_t sbdp_get_cpuid(sbdp_handle_t *hp, dev_info_t *dip);
890Sstevel@tonic-gate int sbdp_connect_cpu(sbdp_handle_t *, dev_info_t *, processorid_t);
900Sstevel@tonic-gate int sbdp_disconnect_cpu(sbdp_handle_t *, dev_info_t *, processorid_t);
910Sstevel@tonic-gate sbd_devattr_t  *sbdp_get_devattr(void);
920Sstevel@tonic-gate int sbdp_get_mem_alignment(sbdp_handle_t *hp, dev_info_t *dip, uint64_t *align);
930Sstevel@tonic-gate struct memlist *sbdp_get_memlist(sbdp_handle_t *hp, dev_info_t *dip);
940Sstevel@tonic-gate int sbdp_del_memlist(sbdp_handle_t *hp, struct memlist *mlist);
950Sstevel@tonic-gate int sbdp_get_unit_num(sbdp_handle_t *hp, dev_info_t *dip);
960Sstevel@tonic-gate int sbdp_portid_to_cpu_unit(int cmp, int core);
970Sstevel@tonic-gate int sbdp_move_memory(sbdp_handle_t *, int t_bd);
980Sstevel@tonic-gate int sbdp_mem_add_span(sbdp_handle_t *hp, uint64_t address, uint64_t size);
990Sstevel@tonic-gate int sbdp_get_mem_size(sbdp_handle_t *hp);
1000Sstevel@tonic-gate int sbdp_mem_del_span(sbdp_handle_t *hp, uint64_t address, uint64_t size);
1010Sstevel@tonic-gate int sbdp_poweroff_board(sbdp_handle_t *hp);
1020Sstevel@tonic-gate int sbdp_poweron_board(sbdp_handle_t *hp);
1030Sstevel@tonic-gate int sbdp_release_component(sbdp_handle_t *hp, dev_info_t *dip);
1040Sstevel@tonic-gate int sbdp_test_board(sbdp_handle_t *hp, sbdp_opts_t *opts);
1050Sstevel@tonic-gate int sbdp_unassign_board(sbdp_handle_t *hp);
1060Sstevel@tonic-gate int sbdphw_disable_memctrl(sbdp_handle_t *hp, dev_info_t *dip);
1070Sstevel@tonic-gate int sbdphw_enable_memctrl(sbdp_handle_t *hp, dev_info_t *dip);
1080Sstevel@tonic-gate int sbdphw_get_base_physaddr(sbdp_handle_t *hp, dev_info_t *dip, uint64_t *pa);
1090Sstevel@tonic-gate int sbdp_isbootproc(processorid_t cpuid);
1100Sstevel@tonic-gate int sbdp_ioctl(sbdp_handle_t *, sbdp_ioctl_arg_t *);
1110Sstevel@tonic-gate int sbdp_isinterleaved(sbdp_handle_t *, dev_info_t *);
112*11651SVijay.Balakrishna@Sun.COM void sbdp_check_devices(dev_info_t *, int *refcount, sbd_error_t *, int *);
1130Sstevel@tonic-gate int sbdp_dr_avail(void);
1140Sstevel@tonic-gate 
1150Sstevel@tonic-gate extern int sbdp_cpu_get_impl(sbdp_handle_t *hp, dev_info_t *dip);
1160Sstevel@tonic-gate 
1170Sstevel@tonic-gate #ifdef	__cplusplus
1180Sstevel@tonic-gate }
1190Sstevel@tonic-gate #endif
1200Sstevel@tonic-gate 
1210Sstevel@tonic-gate #endif	/* _SBD_H */
122