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