cnex.h revision 20ae46ebaff1237662e05edf9db61538aa85d448
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy/*
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * CDDL HEADER START
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy *
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * The contents of this file are subject to the terms of the
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * Common Development and Distribution License (the "License").
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * You may not use this file except in compliance with the License.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy *
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * or http://www.opensolaris.org/os/licensing.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * See the License for the specific language governing permissions
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * and limitations under the License.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy *
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * When distributing Covered Code, include this CDDL HEADER in each
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * If applicable, add the following below this CDDL HEADER, with the
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * fields enclosed by brackets "[]" replaced with your own identifying
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * information: Portions Copyright [yyyy] [name of copyright owner]
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy *
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * CDDL HEADER END
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy */
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy/*
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * Use is subject to license terms.
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy */
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy#ifndef _CNEX_H
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedy#define _CNEX_H
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedy
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedy#pragma ident "%Z%%M% %I% %E% SMI"
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedy
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy#ifdef __cplusplus
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedyextern "C" {
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy#endif
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy/*
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * Channel nexus "reg" spec
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy */
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedytypedef struct cnex_regspec {
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy uint64_t physaddr;
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy uint64_t size;
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy} cnex_regspec_t;
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy/*
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * Channel nexus interrupt map
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy */
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedystruct cnex_intr_map {
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy ldc_dev_t devclass; /* LDC device class */
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy uint32_t pil; /* PIL for device class */
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy int32_t weight; /* Interrupt weight for device class */
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy};
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedy
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy/*
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy * Channel interrupt information
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy */
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedytypedef struct cnex_intr {
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedy uint64_t ino; /* dev intr number */
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy uint64_t cpuid; /* Target CPU */
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy uint64_t icookie; /* dev intr cookie */
d583b39bfb4e2571d3e41097c5c357ffe353ad45John Wren Kennedy uint64_t id; /* LDC channel ID */
dev_info_t *dip; /* LDC channel devinfo */
uint_t (*hdlr)(); /* intr handler */
caddr_t arg1; /* intr argument 1 */
caddr_t arg2; /* intr argument 2 */
int32_t weight; /* intr weight */
} cnex_intr_t;
/* cnex interrupt types */
typedef enum {
CNEX_TX_INTR = 1, /* transmit interrupt */
CNEX_RX_INTR /* receive interrupt */
} cnex_intrtype_t;
/*
* Channel information
*/
typedef struct cnex_ldc {
kmutex_t lock; /* Channel lock */
struct cnex_ldc *next;
uint64_t id;
ldc_dev_t devclass; /* Device class channel belongs to */
cnex_intr_t tx; /* Transmit interrupt */
cnex_intr_t rx; /* Receive interrupt */
dev_info_t *dip; /* dip of the associated device */
} cnex_ldc_t;
/*
* Channel nexus soft state pointer
*/
typedef struct cnex_soft_state {
dev_info_t *devi;
uint64_t cfghdl; /* cnex config handle */
kmutex_t clist_lock; /* lock to protect channel list */
cnex_ldc_t *clist; /* list of registered channels */
} cnex_soft_state_t;
#ifdef __cplusplus
}
#endif
#endif /* _CNEX_H */