1*f582582cSSascha Wildner /* $FreeBSD: head/sys/dev/mpt/mpt_raid.h 224494 2011-07-29 18:38:31Z marius $ */
22545bca0SMatthew Dillon /*-
32545bca0SMatthew Dillon * Definitions for the integrated RAID features LSI MPT Fusion adapters.
42545bca0SMatthew Dillon *
52545bca0SMatthew Dillon * Copyright (c) 2005, WHEEL Sp. z o.o.
62545bca0SMatthew Dillon * Copyright (c) 2004, 2005 Justin T. Gibbs
72545bca0SMatthew Dillon * All rights reserved.
82545bca0SMatthew Dillon *
92545bca0SMatthew Dillon * Redistribution and use in source and binary forms, with or without
102545bca0SMatthew Dillon * modification, are permitted provided that the following conditions are
112545bca0SMatthew Dillon * met:
122545bca0SMatthew Dillon * 1. Redistributions of source code must retain the above copyright
132545bca0SMatthew Dillon * notice, this list of conditions and the following disclaimer.
142545bca0SMatthew Dillon * 2. Redistributions in binary form must reproduce at minimum a disclaimer
152545bca0SMatthew Dillon * substantially similar to the "NO WARRANTY" disclaimer below
162545bca0SMatthew Dillon * ("Disclaimer") and any redistribution must be conditioned upon including
172545bca0SMatthew Dillon * a substantially similar Disclaimer requirement for further binary
182545bca0SMatthew Dillon * redistribution.
192545bca0SMatthew Dillon * 3. Neither the names of the above listed copyright holders nor the names
202545bca0SMatthew Dillon * of any contributors may be used to endorse or promote products derived
212545bca0SMatthew Dillon * from this software without specific prior written permission.
222545bca0SMatthew Dillon *
232545bca0SMatthew Dillon * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
242545bca0SMatthew Dillon * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
252545bca0SMatthew Dillon * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
262545bca0SMatthew Dillon * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
272545bca0SMatthew Dillon * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
282545bca0SMatthew Dillon * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
292545bca0SMatthew Dillon * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
302545bca0SMatthew Dillon * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
312545bca0SMatthew Dillon * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
322545bca0SMatthew Dillon * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT
332545bca0SMatthew Dillon * OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
342545bca0SMatthew Dillon */
352545bca0SMatthew Dillon /*-
362545bca0SMatthew Dillon * Some Breakage and Bug Fixing added later.
372545bca0SMatthew Dillon * Copyright (c) 2006, by Matthew Jacob
382545bca0SMatthew Dillon * All Rights Reserved
392545bca0SMatthew Dillon *
402545bca0SMatthew Dillon * Support from LSI-Logic has also gone a great deal toward making this a
412545bca0SMatthew Dillon * workable subsystem and is gratefully acknowledged.
422545bca0SMatthew Dillon */
432545bca0SMatthew Dillon #ifndef _MPT_RAID_H_
442545bca0SMatthew Dillon #define _MPT_RAID_H_
452545bca0SMatthew Dillon
462545bca0SMatthew Dillon #include <bus/cam/cam.h>
472545bca0SMatthew Dillon union ccb;
482545bca0SMatthew Dillon
492545bca0SMatthew Dillon typedef enum {
502545bca0SMatthew Dillon MPT_RAID_MWCE_ON,
512545bca0SMatthew Dillon MPT_RAID_MWCE_OFF,
522545bca0SMatthew Dillon MPT_RAID_MWCE_REBUILD_ONLY,
532545bca0SMatthew Dillon MPT_RAID_MWCE_NC
542545bca0SMatthew Dillon } mpt_raid_mwce_t;
552545bca0SMatthew Dillon
564c42baf4SSascha Wildner cam_status mpt_map_physdisk(struct mpt_softc *, union ccb *, target_id_t *);
574c42baf4SSascha Wildner int mpt_is_raid_member(struct mpt_softc *, target_id_t);
584c42baf4SSascha Wildner int mpt_is_raid_volume(struct mpt_softc *, target_id_t);
592545bca0SMatthew Dillon #if 0
602545bca0SMatthew Dillon cam_status
612545bca0SMatthew Dillon mpt_raid_quiesce_disk(struct mpt_softc *, struct mpt_raid_disk *, request_t *);
622545bca0SMatthew Dillon #endif
632545bca0SMatthew Dillon
642545bca0SMatthew Dillon void mpt_raid_free_mem(struct mpt_softc *);
652545bca0SMatthew Dillon
662545bca0SMatthew Dillon static __inline void
mpt_raid_wakeup(struct mpt_softc * mpt)672545bca0SMatthew Dillon mpt_raid_wakeup(struct mpt_softc *mpt)
682545bca0SMatthew Dillon {
692545bca0SMatthew Dillon mpt->raid_wakeup++;
702545bca0SMatthew Dillon wakeup(&mpt->raid_volumes);
712545bca0SMatthew Dillon }
722545bca0SMatthew Dillon
732545bca0SMatthew Dillon #define MPT_RAID_SYNC_REPORT_INTERVAL (15 * 60 * hz)
742545bca0SMatthew Dillon #define MPT_RAID_RESYNC_RATE_MAX (255)
752545bca0SMatthew Dillon #define MPT_RAID_RESYNC_RATE_MIN (1)
762545bca0SMatthew Dillon #define MPT_RAID_RESYNC_RATE_NC (0)
772545bca0SMatthew Dillon #define MPT_RAID_RESYNC_RATE_DEFAULT MPT_RAID_RESYNC_RATE_NC
782545bca0SMatthew Dillon
792545bca0SMatthew Dillon #define MPT_RAID_QUEUE_DEPTH_DEFAULT (128)
802545bca0SMatthew Dillon
812545bca0SMatthew Dillon #define MPT_RAID_MWCE_DEFAULT MPT_RAID_MWCE_NC
822545bca0SMatthew Dillon
832545bca0SMatthew Dillon #define RAID_VOL_FOREACH(mpt, mpt_vol) \
842545bca0SMatthew Dillon for (mpt_vol = (mpt)->raid_volumes; \
852545bca0SMatthew Dillon mpt_vol != (mpt)->raid_volumes + (mpt)->raid_max_volumes; \
862545bca0SMatthew Dillon mpt_vol++)
872545bca0SMatthew Dillon
882545bca0SMatthew Dillon #endif /*_MPT_RAID_H_ */
89