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*7bd3a2e2SSriharsha Basavapatna * Copyright 2010 Sun Microsystems, Inc. All rights reserved. 241ae08745Sheppo * Use is subject to license terms. 251ae08745Sheppo */ 261ae08745Sheppo 271ae08745Sheppo #ifndef _SYS_VIO_COMMON_H 281ae08745Sheppo #define _SYS_VIO_COMMON_H 291ae08745Sheppo 301ae08745Sheppo #ifdef __cplusplus 311ae08745Sheppo extern "C" { 321ae08745Sheppo #endif 331ae08745Sheppo 34bbfa0259Sha137994 #include <sys/ldc.h> 351ae08745Sheppo 361ae08745Sheppo /* 371ae08745Sheppo * Common header for VIO descriptor ring entries 381ae08745Sheppo */ 391ae08745Sheppo typedef struct vio_dring_entry_hdr { 401ae08745Sheppo uint8_t dstate; /* Current state of Dring entry */ 411ae08745Sheppo uint8_t ack:1; /* 1 => receiver must ACK when DONE */ 421ae08745Sheppo 431ae08745Sheppo /* 441ae08745Sheppo * Padding. 451ae08745Sheppo */ 461ae08745Sheppo uint16_t resv[3]; 471ae08745Sheppo } vio_dring_entry_hdr_t; 481ae08745Sheppo 49bbfa0259Sha137994 /* 50bbfa0259Sha137994 * Common macros for acquiring and releasing VIO descriptor ring entries 51bbfa0259Sha137994 */ 52bbfa0259Sha137994 #define VIO_DRING_ACQUIRE(otd, mtype, handle, start, stop) \ 53bbfa0259Sha137994 ((mtype) == LDC_DIRECT_MAP ? \ 54*7bd3a2e2SSriharsha Basavapatna LDC_ON_TRAP((otd)) : \ 55bbfa0259Sha137994 ldc_mem_dring_acquire((handle), (start), (stop))) 56bbfa0259Sha137994 57bbfa0259Sha137994 #define VIO_DRING_ACQUIRE_NOCOPYIN(otd, mtype) \ 58bbfa0259Sha137994 ((mtype) == LDC_DIRECT_MAP ? \ 59*7bd3a2e2SSriharsha Basavapatna LDC_ON_TRAP((otd)) : 0) 60bbfa0259Sha137994 61bbfa0259Sha137994 #define VIO_DRING_RELEASE(mtype, handle, start, stop) \ 62bbfa0259Sha137994 ((mtype) == LDC_DIRECT_MAP ? \ 63*7bd3a2e2SSriharsha Basavapatna LDC_NO_TRAP() : \ 64bbfa0259Sha137994 ldc_mem_dring_release((handle), (start), (stop))) 65bbfa0259Sha137994 66bbfa0259Sha137994 #define VIO_DRING_RELEASE_NOCOPYOUT(mtype) \ 67bbfa0259Sha137994 ((mtype) == LDC_DIRECT_MAP ? \ 68*7bd3a2e2SSriharsha Basavapatna LDC_NO_TRAP() : 0) 691ae08745Sheppo 701ae08745Sheppo #ifdef __cplusplus 711ae08745Sheppo } 721ae08745Sheppo #endif 731ae08745Sheppo 741ae08745Sheppo #endif /* _SYS_VIO_COMMON_H */ 75