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