190075Sobrien/* $FreeBSD: releng/10.3/sys/dev/mpt/mpt_raid.h 224494 2011-07-29 18:38:31Z marius $ */
2169689Skan/*-
3169689Skan * Definitions for the integrated RAID features LSI MPT Fusion adapters.
490075Sobrien *
590075Sobrien * Copyright (c) 2005, WHEEL Sp. z o.o.
690075Sobrien * Copyright (c) 2004, 2005 Justin T. Gibbs
790075Sobrien * All rights reserved.
890075Sobrien *
990075Sobrien * Redistribution and use in source and binary forms, with or without
1090075Sobrien * modification, are permitted provided that the following conditions are
1190075Sobrien * met:
1290075Sobrien * 1. Redistributions of source code must retain the above copyright
1390075Sobrien *    notice, this list of conditions and the following disclaimer.
1490075Sobrien * 2. Redistributions in binary form must reproduce at minimum a disclaimer
1590075Sobrien *    substantially similar to the "NO WARRANTY" disclaimer below
1690075Sobrien *    ("Disclaimer") and any redistribution must be conditioned upon including
1790075Sobrien *    a substantially similar Disclaimer requirement for further binary
1890075Sobrien *    redistribution.
1990075Sobrien * 3. Neither the names of the above listed copyright holders nor the names
20169689Skan *    of any contributors may be used to endorse or promote products derived
21169689Skan *    from this software without specific prior written permission.
2290075Sobrien *
2390075Sobrien * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
2490075Sobrien * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25132718Skan * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26132718Skan * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
2790075Sobrien * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2890075Sobrien * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2990075Sobrien * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
3090075Sobrien * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
3190075Sobrien * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32169689Skan * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT
3390075Sobrien * OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34169689Skan */
35169689Skan/*-
3690075Sobrien * Some Breakage and Bug Fixing added later.
37132718Skan * Copyright (c) 2006, by Matthew Jacob
38132718Skan * All Rights Reserved
39132718Skan *
40132718Skan * Support from LSI-Logic has also gone a great deal toward making this a
41132718Skan * workable subsystem and is gratefully acknowledged.
42169689Skan */
4390075Sobrien#ifndef  _MPT_RAID_H_
4490075Sobrien#define  _MPT_RAID_H_
4590075Sobrien
4690075Sobrien#include <cam/cam.h>
4790075Sobrienunion ccb;
48132718Skan
4990075Sobrientypedef enum {
5090075Sobrien	MPT_RAID_MWCE_ON,
5190075Sobrien	MPT_RAID_MWCE_OFF,
5290075Sobrien	MPT_RAID_MWCE_REBUILD_ONLY,
5390075Sobrien	MPT_RAID_MWCE_NC
5490075Sobrien} mpt_raid_mwce_t;
5590075Sobrien
5690075Sobriencam_status mpt_map_physdisk(struct mpt_softc *, union ccb *, target_id_t *);
5790075Sobrienint mpt_is_raid_member(struct mpt_softc *, target_id_t);
5890075Sobrienint mpt_is_raid_volume(struct mpt_softc *, target_id_t);
5990075Sobrien#if	0
6090075Sobriencam_status
6190075Sobrienmpt_raid_quiesce_disk(struct mpt_softc *, struct mpt_raid_disk *, request_t *);
6290075Sobrien#endif
6390075Sobrien
64169689Skanvoid	mpt_raid_free_mem(struct mpt_softc *);
6590075Sobrien
6690075Sobrienstatic __inline void
67169689Skanmpt_raid_wakeup(struct mpt_softc *mpt)
6890075Sobrien{
6990075Sobrien	mpt->raid_wakeup++;
70117395Skan	wakeup(&mpt->raid_volumes);
7190075Sobrien}
7290075Sobrien
7390075Sobrien#define MPT_RAID_SYNC_REPORT_INTERVAL (15 * 60 * hz)
7490075Sobrien#define MPT_RAID_RESYNC_RATE_MAX (255)
7590075Sobrien#define MPT_RAID_RESYNC_RATE_MIN (1)
7690075Sobrien#define MPT_RAID_RESYNC_RATE_NC (0)
7790075Sobrien#define MPT_RAID_RESYNC_RATE_DEFAULT MPT_RAID_RESYNC_RATE_NC
7890075Sobrien
7990075Sobrien#define MPT_RAID_QUEUE_DEPTH_DEFAULT (128)
8090075Sobrien
8190075Sobrien#define MPT_RAID_MWCE_DEFAULT MPT_RAID_MWCE_NC
8290075Sobrien
8390075Sobrien#define RAID_VOL_FOREACH(mpt, mpt_vol)					\
8490075Sobrien	for (mpt_vol = (mpt)->raid_volumes;				\
8590075Sobrien	     mpt_vol != (mpt)->raid_volumes + (mpt)->raid_max_volumes;	\
86132718Skan	     mpt_vol++)
8790075Sobrien
8890075Sobrien#endif /*_MPT_RAID_H_ */
8990075Sobrien