1b0a2fdeeSScott Long /* $FreeBSD$ */ 2b0a2fdeeSScott Long /*- 3b0a2fdeeSScott Long * Definitions for the integrated RAID features LSI MPT Fusion adapters. 4b0a2fdeeSScott Long * 5b0a2fdeeSScott Long * Copyright (c) 2005, WHEEL Sp. z o.o. 6b0a2fdeeSScott Long * Copyright (c) 2004, 2005 Justin T. Gibbs 7b0a2fdeeSScott Long * All rights reserved. 8b0a2fdeeSScott Long * 9b0a2fdeeSScott Long * Redistribution and use in source and binary forms, with or without 10b0a2fdeeSScott Long * modification, are permitted provided that the following conditions are 11b0a2fdeeSScott Long * met: 12b0a2fdeeSScott Long * 1. Redistributions of source code must retain the above copyright 13b0a2fdeeSScott Long * notice, this list of conditions and the following disclaimer. 14b0a2fdeeSScott Long * 2. Redistributions in binary form must reproduce at minimum a disclaimer 15b0a2fdeeSScott Long * substantially similar to the "NO WARRANTY" disclaimer below 16b0a2fdeeSScott Long * ("Disclaimer") and any redistribution must be conditioned upon including 17b0a2fdeeSScott Long * a substantially similar Disclaimer requirement for further binary 18b0a2fdeeSScott Long * redistribution. 19286e947fSJustin T. Gibbs * 3. Neither the names of the above listed copyright holders nor the names 20286e947fSJustin T. Gibbs * of any contributors may be used to endorse or promote products derived 21286e947fSJustin T. Gibbs * from this software without specific prior written permission. 22b0a2fdeeSScott Long * 23b0a2fdeeSScott Long * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 24b0a2fdeeSScott Long * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25b0a2fdeeSScott Long * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26b0a2fdeeSScott Long * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 27b0a2fdeeSScott Long * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 28b0a2fdeeSScott Long * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 29b0a2fdeeSScott Long * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30b0a2fdeeSScott Long * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 31b0a2fdeeSScott Long * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32b0a2fdeeSScott Long * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF THE COPYRIGHT 33b0a2fdeeSScott Long * OWNER OR CONTRIBUTOR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34b0a2fdeeSScott Long */ 35ec5fe39dSMatt Jacob /*- 36ec5fe39dSMatt Jacob * Some Breakage and Bug Fixing added later. 37ec5fe39dSMatt Jacob * Copyright (c) 2006, by Matthew Jacob 38ec5fe39dSMatt Jacob * All Rights Reserved 39ec5fe39dSMatt Jacob * 40ec5fe39dSMatt Jacob * Support from LSI-Logic has also gone a great deal toward making this a 41ec5fe39dSMatt Jacob * workable subsystem and is gratefully acknowledged. 42ec5fe39dSMatt Jacob */ 43b0a2fdeeSScott Long #ifndef _MPT_RAID_H_ 44b0a2fdeeSScott Long #define _MPT_RAID_H_ 45b0a2fdeeSScott Long 46b0a2fdeeSScott Long #include <cam/cam.h> 47b0a2fdeeSScott Long union ccb; 48b0a2fdeeSScott Long 49b0a2fdeeSScott Long typedef enum { 50b0a2fdeeSScott Long MPT_RAID_MWCE_ON, 51b0a2fdeeSScott Long MPT_RAID_MWCE_OFF, 52b0a2fdeeSScott Long MPT_RAID_MWCE_REBUILD_ONLY, 53b0a2fdeeSScott Long MPT_RAID_MWCE_NC 54b0a2fdeeSScott Long } mpt_raid_mwce_t; 55b0a2fdeeSScott Long 568bf91348SMatt Jacob const char *mpt_vol_type(struct mpt_raid_volume *); 578bf91348SMatt Jacob const char *mpt_vol_state(struct mpt_raid_volume *); 588bf91348SMatt Jacob const char *mpt_disk_state(struct mpt_raid_disk *); 598bf91348SMatt Jacob void 608bf91348SMatt Jacob mpt_vol_prt(struct mpt_softc *, struct mpt_raid_volume *, const char *fmt, ...); 618bf91348SMatt Jacob void 628bf91348SMatt Jacob mpt_disk_prt(struct mpt_softc *, struct mpt_raid_disk *, const char *, ...); 63b0a2fdeeSScott Long 648bf91348SMatt Jacob int 658bf91348SMatt Jacob mpt_issue_raid_req(struct mpt_softc *, struct mpt_raid_volume *, 668bf91348SMatt Jacob struct mpt_raid_disk *, request_t *, u_int, uint32_t, bus_addr_t, 678bf91348SMatt Jacob bus_size_t, int, int); 688bf91348SMatt Jacob 69b0a2fdeeSScott Long cam_status 701d79ca0eSMatt Jacob mpt_map_physdisk(struct mpt_softc *, union ccb *, target_id_t *); 71a0e4c26aSMatt Jacob int mpt_is_raid_volume(struct mpt_softc *, int); 72784880dbSMatt Jacob #if 0 73b0a2fdeeSScott Long cam_status 748bf91348SMatt Jacob mpt_raid_quiesce_disk(struct mpt_softc *, struct mpt_raid_disk *, request_t *); 75784880dbSMatt Jacob #endif 768bf91348SMatt Jacob 778bf91348SMatt Jacob int mpt_refresh_raid_data(struct mpt_softc *); 788bf91348SMatt Jacob void mpt_schedule_raid_refresh(struct mpt_softc *); 791d79ca0eSMatt Jacob void mpt_raid_free_mem(struct mpt_softc *); 80b0a2fdeeSScott Long 81b0a2fdeeSScott Long static __inline void 82b0a2fdeeSScott Long mpt_raid_wakeup(struct mpt_softc *mpt) 83b0a2fdeeSScott Long { 84b0a2fdeeSScott Long mpt->raid_wakeup++; 85b0a2fdeeSScott Long wakeup(&mpt->raid_volumes); 86b0a2fdeeSScott Long } 87b0a2fdeeSScott Long 88b0a2fdeeSScott Long #define MPT_RAID_SYNC_REPORT_INTERVAL (15 * 60 * hz) 89b0a2fdeeSScott Long #define MPT_RAID_RESYNC_RATE_MAX (255) 90b0a2fdeeSScott Long #define MPT_RAID_RESYNC_RATE_MIN (1) 91b0a2fdeeSScott Long #define MPT_RAID_RESYNC_RATE_NC (0) 92b0a2fdeeSScott Long #define MPT_RAID_RESYNC_RATE_DEFAULT MPT_RAID_RESYNC_RATE_NC 93b0a2fdeeSScott Long 94b0a2fdeeSScott Long #define MPT_RAID_QUEUE_DEPTH_DEFAULT (128) 95b0a2fdeeSScott Long 96b0a2fdeeSScott Long #define MPT_RAID_MWCE_DEFAULT MPT_RAID_MWCE_NC 97b0a2fdeeSScott Long 98b0a2fdeeSScott Long #define RAID_VOL_FOREACH(mpt, mpt_vol) \ 99b0a2fdeeSScott Long for (mpt_vol = (mpt)->raid_volumes; \ 100b0a2fdeeSScott Long mpt_vol != (mpt)->raid_volumes + (mpt)->raid_max_volumes; \ 101b0a2fdeeSScott Long mpt_vol++) 102b0a2fdeeSScott Long 103b0a2fdeeSScott Long #endif /*_MPT_RAID_H_ */ 104