xref: /titanic_52/usr/src/uts/common/xen/io/blk_common.h (revision 7eea693d6b672899726e75993fddc4e95b52647f)
1*7eea693dSMark Johnson /*
2*7eea693dSMark Johnson  * CDDL HEADER START
3*7eea693dSMark Johnson  *
4*7eea693dSMark Johnson  * The contents of this file are subject to the terms of the
5*7eea693dSMark Johnson  * Common Development and Distribution License (the "License").
6*7eea693dSMark Johnson  * You may not use this file except in compliance with the License.
7*7eea693dSMark Johnson  *
8*7eea693dSMark Johnson  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*7eea693dSMark Johnson  * or http://www.opensolaris.org/os/licensing.
10*7eea693dSMark Johnson  * See the License for the specific language governing permissions
11*7eea693dSMark Johnson  * and limitations under the License.
12*7eea693dSMark Johnson  *
13*7eea693dSMark Johnson  * When distributing Covered Code, include this CDDL HEADER in each
14*7eea693dSMark Johnson  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*7eea693dSMark Johnson  * If applicable, add the following below this CDDL HEADER, with the
16*7eea693dSMark Johnson  * fields enclosed by brackets "[]" replaced with your own identifying
17*7eea693dSMark Johnson  * information: Portions Copyright [yyyy] [name of copyright owner]
18*7eea693dSMark Johnson  *
19*7eea693dSMark Johnson  * CDDL HEADER END
20*7eea693dSMark Johnson  */
21*7eea693dSMark Johnson 
22*7eea693dSMark Johnson /*
23*7eea693dSMark Johnson  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24*7eea693dSMark Johnson  * Use is subject to license terms.
25*7eea693dSMark Johnson  */
26*7eea693dSMark Johnson 
27*7eea693dSMark Johnson #ifndef _SYS_BLK_COMMON_H
28*7eea693dSMark Johnson #define	_SYS_BLK_COMMON_H
29*7eea693dSMark Johnson 
30*7eea693dSMark Johnson 
31*7eea693dSMark Johnson #ifdef __cplusplus
32*7eea693dSMark Johnson extern "C" {
33*7eea693dSMark Johnson #endif
34*7eea693dSMark Johnson 
35*7eea693dSMark Johnson #include <sys/types.h>
36*7eea693dSMark Johnson #include <sys/xendev.h>
37*7eea693dSMark Johnson 
38*7eea693dSMark Johnson 
39*7eea693dSMark Johnson typedef uint_t (*blk_intr_t)(caddr_t arg);
40*7eea693dSMark Johnson typedef void (*blk_ring_cb_t)(caddr_t arg);
41*7eea693dSMark Johnson 
42*7eea693dSMark Johnson typedef struct blk_ringinit_args_s {
43*7eea693dSMark Johnson 	dev_info_t	*ar_dip;
44*7eea693dSMark Johnson 
45*7eea693dSMark Johnson 	/* callbacks */
46*7eea693dSMark Johnson 	blk_intr_t	ar_intr;
47*7eea693dSMark Johnson 	caddr_t		ar_intr_arg;
48*7eea693dSMark Johnson 	blk_ring_cb_t	ar_ringup;
49*7eea693dSMark Johnson 	caddr_t		ar_ringup_arg;
50*7eea693dSMark Johnson 	blk_ring_cb_t	ar_ringdown;
51*7eea693dSMark Johnson 	caddr_t		ar_ringdown_arg;
52*7eea693dSMark Johnson } blk_ringinit_args_t;
53*7eea693dSMark Johnson 
54*7eea693dSMark Johnson typedef struct blk_ring_s *blk_ring_t;
55*7eea693dSMark Johnson 
56*7eea693dSMark Johnson int blk_ring_init(blk_ringinit_args_t *args, blk_ring_t *ring);
57*7eea693dSMark Johnson void blk_ring_fini(blk_ring_t *ring);
58*7eea693dSMark Johnson 
59*7eea693dSMark Johnson boolean_t blk_ring_request_get(blk_ring_t ring, blkif_request_t *req);
60*7eea693dSMark Johnson void blk_ring_request_requeue(blk_ring_t ring);
61*7eea693dSMark Johnson void blk_ring_request_dump(blkif_request_t *req);
62*7eea693dSMark Johnson 
63*7eea693dSMark Johnson void blk_ring_response_put(blk_ring_t ring, blkif_response_t *resp);
64*7eea693dSMark Johnson void blk_ring_response_dump(blkif_response_t *req);
65*7eea693dSMark Johnson 
66*7eea693dSMark Johnson #ifdef __cplusplus
67*7eea693dSMark Johnson }
68*7eea693dSMark Johnson #endif
69*7eea693dSMark Johnson 
70*7eea693dSMark Johnson #endif /* _SYS_BLK_COMMON_H */
71