1147883Sscottl/* $FreeBSD: releng/11.0/sys/dev/mpt/mpt_raid.h 224494 2011-07-29 18:38:31Z marius $ */
2147883Sscottl/*-
3147883Sscottl * Definitions for the integrated RAID features LSI MPT Fusion adapters.
4147883Sscottl *
5147883Sscottl * Copyright (c) 2005, WHEEL Sp. z o.o.
6147883Sscottl * Copyright (c) 2004, 2005 Justin T. Gibbs
7147883Sscottl * All rights reserved.
8147883Sscottl *
9147883Sscottl * Redistribution and use in source and binary forms, with or without
10147883Sscottl * modification, are permitted provided that the following conditions are
11147883Sscottl * met:
12147883Sscottl * 1. Redistributions of source code must retain the above copyright
13147883Sscottl *    notice, this list of conditions and the following disclaimer.
14147883Sscottl * 2. Redistributions in binary form must reproduce at minimum a disclaimer
15147883Sscottl *    substantially similar to the "NO WARRANTY" disclaimer below
16147883Sscottl *    ("Disclaimer") and any redistribution must be conditioned upon including
17147883Sscottl *    a substantially similar Disclaimer requirement for further binary
18147883Sscottl *    redistribution.
19148679Sgibbs * 3. Neither the names of the above listed copyright holders nor the names
20148679Sgibbs *    of any contributors may be used to endorse or promote products derived
21148679Sgibbs *    from this software without specific prior written permission.
22147883Sscottl *
23147883Sscottl * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24147883Sscottl * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25147883Sscottl * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26147883Sscottl * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27147883Sscottl * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28147883Sscottl * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29147883Sscottl * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30147883Sscottl * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31147883Sscottl * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32147883Sscottl * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT
33147883Sscottl * OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34147883Sscottl */
35159052Smjacob/*-
36159052Smjacob * Some Breakage and Bug Fixing added later.
37159052Smjacob * Copyright (c) 2006, by Matthew Jacob
38159052Smjacob * All Rights Reserved
39159052Smjacob *
40159052Smjacob * Support from LSI-Logic has also gone a great deal toward making this a
41159052Smjacob * workable subsystem and is gratefully acknowledged.
42159052Smjacob */
43147883Sscottl#ifndef  _MPT_RAID_H_
44147883Sscottl#define  _MPT_RAID_H_
45147883Sscottl
46147883Sscottl#include <cam/cam.h>
47147883Sscottlunion ccb;
48147883Sscottl
49147883Sscottltypedef enum {
50147883Sscottl	MPT_RAID_MWCE_ON,
51147883Sscottl	MPT_RAID_MWCE_OFF,
52147883Sscottl	MPT_RAID_MWCE_REBUILD_ONLY,
53147883Sscottl	MPT_RAID_MWCE_NC
54147883Sscottl} mpt_raid_mwce_t;
55147883Sscottl
56224493Smariuscam_status mpt_map_physdisk(struct mpt_softc *, union ccb *, target_id_t *);
57224494Smariusint mpt_is_raid_member(struct mpt_softc *, target_id_t);
58224493Smariusint mpt_is_raid_volume(struct mpt_softc *, target_id_t);
59160395Smjacob#if	0
60147883Sscottlcam_status
61158934Smjacobmpt_raid_quiesce_disk(struct mpt_softc *, struct mpt_raid_disk *, request_t *);
62160395Smjacob#endif
63147883Sscottl
64158982Smjacobvoid	mpt_raid_free_mem(struct mpt_softc *);
65158934Smjacob
66147883Sscottlstatic __inline void
67147883Sscottlmpt_raid_wakeup(struct mpt_softc *mpt)
68147883Sscottl{
69147883Sscottl	mpt->raid_wakeup++;
70147883Sscottl	wakeup(&mpt->raid_volumes);
71147883Sscottl}
72147883Sscottl
73147883Sscottl#define MPT_RAID_SYNC_REPORT_INTERVAL (15 * 60 * hz)
74147883Sscottl#define MPT_RAID_RESYNC_RATE_MAX (255)
75147883Sscottl#define MPT_RAID_RESYNC_RATE_MIN (1)
76147883Sscottl#define MPT_RAID_RESYNC_RATE_NC (0)
77147883Sscottl#define MPT_RAID_RESYNC_RATE_DEFAULT MPT_RAID_RESYNC_RATE_NC
78147883Sscottl
79147883Sscottl#define MPT_RAID_QUEUE_DEPTH_DEFAULT (128)
80147883Sscottl
81147883Sscottl#define MPT_RAID_MWCE_DEFAULT MPT_RAID_MWCE_NC
82147883Sscottl
83147883Sscottl#define RAID_VOL_FOREACH(mpt, mpt_vol)					\
84147883Sscottl	for (mpt_vol = (mpt)->raid_volumes;				\
85147883Sscottl	     mpt_vol != (mpt)->raid_volumes + (mpt)->raid_max_volumes;	\
86147883Sscottl	     mpt_vol++)
87147883Sscottl
88147883Sscottl#endif /*_MPT_RAID_H_ */
89