1229997Sken/*-
2229997Sken * Copyright (c) 2003 Silicon Graphics International Corp.
3229997Sken * All rights reserved.
4229997Sken *
5229997Sken * Redistribution and use in source and binary forms, with or without
6229997Sken * modification, are permitted provided that the following conditions
7229997Sken * are met:
8229997Sken * 1. Redistributions of source code must retain the above copyright
9229997Sken *    notice, this list of conditions, and the following disclaimer,
10229997Sken *    without modification.
11229997Sken * 2. Redistributions in binary form must reproduce at minimum a disclaimer
12229997Sken *    substantially similar to the "NO WARRANTY" disclaimer below
13229997Sken *    ("Disclaimer") and any redistribution must be conditioned upon
14229997Sken *    including a substantially similar Disclaimer requirement for further
15229997Sken *    binary redistribution.
16229997Sken *
17229997Sken * NO WARRANTY
18229997Sken * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19229997Sken * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20229997Sken * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
21229997Sken * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22229997Sken * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23229997Sken * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24229997Sken * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25229997Sken * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26229997Sken * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
27229997Sken * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28229997Sken * POSSIBILITY OF SUCH DAMAGES.
29229997Sken *
30229997Sken * $Id: //depot/users/kenm/FreeBSD-test2/sys/cam/ctl/ctl_backend_block.h#1 $
31229997Sken * $FreeBSD$
32229997Sken */
33229997Sken/*
34229997Sken * CAM Target Layer driver backend interface for block devices.
35229997Sken *
36229997Sken * Author: Ken Merry <ken@FreeBSD.org>
37229997Sken */
38229997Sken
39229997Sken#ifndef	_CTL_BACKEND_BLOCK_H_
40229997Sken#define	_CTL_BACKEND_BLOCK_H_
41229997Sken
42229997Skenstruct ctl_block_disk {
43229997Sken	uint32_t   version;	/* interface version */
44229997Sken	uint32_t   disknum;	/* returned device number */
45229997Sken	STAILQ_ENTRY(ctl_block_disk) links;  /* linked list pointer */
46229997Sken	char	   disk_name[MAXPATHLEN]; /* name of this device */
47229997Sken	int        allocated;	/* disk is allocated to a LUN */
48229997Sken	uint64_t   size_blocks; /* disk size in blocks */
49229997Sken	uint64_t   size_bytes;  /* disk size in bytes */
50229997Sken};
51229997Sken
52229997Skentypedef enum {
53229997Sken	CTL_BLOCK_DEVLIST_MORE,
54229997Sken	CTL_BLOCK_DEVLIST_DONE
55229997Sken} ctl_block_devlist_status;
56229997Sken
57229997Skenstruct ctl_block_devlist {
58229997Sken	uint32_t		version;	/* interface version */
59229997Sken	uint32_t		buf_len;	/* passed in, buffer length */
60229997Sken	uint32_t		ctl_disk_size;	/* size of adddev, passed in */
61229997Sken	struct ctl_block_disk	*devbuf;	/* buffer passed in/filled out*/
62229997Sken	uint32_t		num_bufs;	/* number passed out */
63229997Sken	uint32_t		buf_used;	/* bytes passed out */
64229997Sken	uint32_t		total_disks;	/* number of disks in system */
65229997Sken	ctl_block_devlist_status status;	/* did we get the whole list? */
66229997Sken};
67229997Sken
68229997Sken#define	CTL_BLOCK_ADDDEV	_IOWR(COPAN_ARRAY_BE_BLOCK, 0x00, struct ctl_block_disk)
69229997Sken#define	CTL_BLOCK_DEVLIST	_IOWR(COPAN_ARRAY_BE_BLOCK, 0x01, struct ctl_block_devlist)
70229997Sken#define	CTL_BLOCK_RMDEV		_IOW(COPAN_ARRAY_BE_BLOCK, 0x02, struct ctl_block_disk)
71229997Sken
72229997Sken#endif	/* _CTL_BACKEND_BLOCK_H_ */
73