xref: /illumos-gate/usr/src/uts/sun4v/sys/cnex.h (revision 20ae46eb)
11ae08745Sheppo /*
21ae08745Sheppo  * CDDL HEADER START
31ae08745Sheppo  *
41ae08745Sheppo  * The contents of this file are subject to the terms of the
51ae08745Sheppo  * Common Development and Distribution License (the "License").
61ae08745Sheppo  * You may not use this file except in compliance with the License.
71ae08745Sheppo  *
81ae08745Sheppo  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
91ae08745Sheppo  * or http://www.opensolaris.org/os/licensing.
101ae08745Sheppo  * See the License for the specific language governing permissions
111ae08745Sheppo  * and limitations under the License.
121ae08745Sheppo  *
131ae08745Sheppo  * When distributing Covered Code, include this CDDL HEADER in each
141ae08745Sheppo  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
151ae08745Sheppo  * If applicable, add the following below this CDDL HEADER, with the
161ae08745Sheppo  * fields enclosed by brackets "[]" replaced with your own identifying
171ae08745Sheppo  * information: Portions Copyright [yyyy] [name of copyright owner]
181ae08745Sheppo  *
191ae08745Sheppo  * CDDL HEADER END
201ae08745Sheppo  */
211ae08745Sheppo 
221ae08745Sheppo /*
23*20ae46ebSha  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
241ae08745Sheppo  * Use is subject to license terms.
251ae08745Sheppo  */
261ae08745Sheppo 
271ae08745Sheppo #ifndef _CNEX_H
281ae08745Sheppo #define	_CNEX_H
291ae08745Sheppo 
301ae08745Sheppo #pragma ident	"%Z%%M%	%I%	%E% SMI"
311ae08745Sheppo 
321ae08745Sheppo #ifdef __cplusplus
331ae08745Sheppo extern "C" {
341ae08745Sheppo #endif
351ae08745Sheppo 
361ae08745Sheppo /*
371ae08745Sheppo  * Channel nexus "reg" spec
381ae08745Sheppo  */
391ae08745Sheppo typedef struct cnex_regspec {
401ae08745Sheppo 	uint64_t physaddr;
411ae08745Sheppo 	uint64_t size;
421ae08745Sheppo } cnex_regspec_t;
431ae08745Sheppo 
441ae08745Sheppo /*
451ae08745Sheppo  * Channel nexus interrupt map
461ae08745Sheppo  */
47*20ae46ebSha struct cnex_intr_map {
481ae08745Sheppo 	ldc_dev_t	devclass;	/* LDC device class */
491ae08745Sheppo 	uint32_t	pil;		/* PIL for device class */
50*20ae46ebSha 	int32_t		weight;		/* Interrupt weight for device class */
511ae08745Sheppo };
521ae08745Sheppo 
531ae08745Sheppo /*
541ae08745Sheppo  * Channel interrupt information
551ae08745Sheppo  */
561ae08745Sheppo typedef struct cnex_intr {
571ae08745Sheppo 	uint64_t	ino;		/* dev intr number */
580705ae3aSraghuram 	uint64_t	cpuid;		/* Target CPU */
591ae08745Sheppo 	uint64_t	icookie;	/* dev intr cookie */
60928da554Slm 	uint64_t	id;		/* LDC channel ID  */
61928da554Slm 	dev_info_t	*dip;		/* LDC channel devinfo */
621ae08745Sheppo 	uint_t		(*hdlr)();	/* intr handler */
631ae08745Sheppo 	caddr_t		arg1;		/* intr argument 1 */
641ae08745Sheppo 	caddr_t		arg2;		/* intr argument 2 */
65*20ae46ebSha 	int32_t		weight;		/* intr weight */
661ae08745Sheppo } cnex_intr_t;
671ae08745Sheppo 
681ae08745Sheppo /* cnex interrupt types */
691ae08745Sheppo typedef enum {
701ae08745Sheppo 	CNEX_TX_INTR = 1,		/* transmit interrupt */
711ae08745Sheppo 	CNEX_RX_INTR			/* receive interrupt */
721ae08745Sheppo } cnex_intrtype_t;
731ae08745Sheppo 
741ae08745Sheppo /*
751ae08745Sheppo  * Channel information
761ae08745Sheppo  */
771ae08745Sheppo typedef struct cnex_ldc {
781ae08745Sheppo 	kmutex_t	lock;		/* Channel lock */
791ae08745Sheppo 	struct cnex_ldc	*next;
801ae08745Sheppo 
811ae08745Sheppo 	uint64_t	id;
821ae08745Sheppo 	ldc_dev_t 	devclass;	/* Device class channel belongs to */
831ae08745Sheppo 
841ae08745Sheppo 	cnex_intr_t	tx;		/* Transmit interrupt */
851ae08745Sheppo 	cnex_intr_t	rx;		/* Receive interrupt */
860705ae3aSraghuram 	dev_info_t	*dip;		/* dip of the associated device */
871ae08745Sheppo } cnex_ldc_t;
881ae08745Sheppo 
891ae08745Sheppo /*
901ae08745Sheppo  * Channel nexus soft state pointer
911ae08745Sheppo  */
921ae08745Sheppo typedef struct cnex_soft_state {
931ae08745Sheppo 	dev_info_t 	*devi;
941ae08745Sheppo 	uint64_t	cfghdl;		/* cnex config handle */
951ae08745Sheppo 	kmutex_t	clist_lock;	/* lock to protect channel list */
961ae08745Sheppo 	cnex_ldc_t	*clist;		/* list of registered channels */
971ae08745Sheppo } cnex_soft_state_t;
981ae08745Sheppo 
991ae08745Sheppo #ifdef __cplusplus
1001ae08745Sheppo }
1011ae08745Sheppo #endif
1021ae08745Sheppo 
1031ae08745Sheppo #endif /* _CNEX_H */
104