1241675Suqs/*-
2241675Suqs * Copyright (c) 2003 Silicon Graphics International Corp.
3241675Suqs * All rights reserved.
4241675Suqs *
5241675Suqs * Redistribution and use in source and binary forms, with or without
6241675Suqs * modification, are permitted provided that the following conditions
7241675Suqs * are met:
8241675Suqs * 1. Redistributions of source code must retain the above copyright
9241675Suqs *    notice, this list of conditions, and the following disclaimer,
10241675Suqs *    without modification.
11241675Suqs * 2. Redistributions in binary form must reproduce at minimum a disclaimer
12241675Suqs *    substantially similar to the "NO WARRANTY" disclaimer below
13241675Suqs *    ("Disclaimer") and any redistribution must be conditioned upon
14241675Suqs *    including a substantially similar Disclaimer requirement for further
15241675Suqs *    binary redistribution.
16241675Suqs *
17241675Suqs * NO WARRANTY
18241675Suqs * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19241675Suqs * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20241675Suqs * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
21241675Suqs * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22241675Suqs * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23241675Suqs * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24241675Suqs * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25241675Suqs * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26241675Suqs * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
27241675Suqs * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28241675Suqs * POSSIBILITY OF SUCH DAMAGES.
29241675Suqs *
30241675Suqs * $Id: //depot/users/kenm/FreeBSD-test2/sys/cam/ctl/ctl_backend_block.h#1 $
31241675Suqs * $FreeBSD$
32241675Suqs */
33241675Suqs/*
34241675Suqs * CAM Target Layer driver backend interface for block devices.
35241675Suqs *
36241675Suqs * Author: Ken Merry <ken@FreeBSD.org>
37241675Suqs */
38241675Suqs
39241675Suqs#ifndef	_CTL_BACKEND_BLOCK_H_
40241675Suqs#define	_CTL_BACKEND_BLOCK_H_
41241675Suqs
42241675Suqsstruct ctl_block_disk {
43241675Suqs	uint32_t   version;	/* interface version */
44241675Suqs	uint32_t   disknum;	/* returned device number */
45241675Suqs	STAILQ_ENTRY(ctl_block_disk) links;  /* linked list pointer */
46241675Suqs	char	   disk_name[MAXPATHLEN]; /* name of this device */
47241675Suqs	int        allocated;	/* disk is allocated to a LUN */
48241675Suqs	uint64_t   size_blocks; /* disk size in blocks */
49241675Suqs	uint64_t   size_bytes;  /* disk size in bytes */
50241675Suqs};
51241675Suqs
52241675Suqstypedef enum {
53241675Suqs	CTL_BLOCK_DEVLIST_MORE,
54241675Suqs	CTL_BLOCK_DEVLIST_DONE
55241675Suqs} ctl_block_devlist_status;
56241675Suqs
57241675Suqsstruct ctl_block_devlist {
58241675Suqs	uint32_t		version;	/* interface version */
59241675Suqs	uint32_t		buf_len;	/* passed in, buffer length */
60241675Suqs	uint32_t		ctl_disk_size;	/* size of adddev, passed in */
61241675Suqs	struct ctl_block_disk	*devbuf;	/* buffer passed in/filled out*/
62241675Suqs	uint32_t		num_bufs;	/* number passed out */
63241675Suqs	uint32_t		buf_used;	/* bytes passed out */
64241675Suqs	uint32_t		total_disks;	/* number of disks in system */
65241675Suqs	ctl_block_devlist_status status;	/* did we get the whole list? */
66241675Suqs};
67241675Suqs
68241675Suqs#define	CTL_BLOCK_ADDDEV	_IOWR(COPAN_ARRAY_BE_BLOCK, 0x00, struct ctl_block_disk)
69241675Suqs#define	CTL_BLOCK_DEVLIST	_IOWR(COPAN_ARRAY_BE_BLOCK, 0x01, struct ctl_block_devlist)
70241675Suqs#define	CTL_BLOCK_RMDEV		_IOW(COPAN_ARRAY_BE_BLOCK, 0x02, struct ctl_block_disk)
71241675Suqs
72241675Suqs#endif	/* _CTL_BACKEND_BLOCK_H_ */
73241675Suqs