From a0e4c26aae1bc9f3a98440d787db8dec79bf1a47 Mon Sep 17 00:00:00 2001 From: Matt Jacob Date: Mon, 29 May 2006 20:20:45 +0000 Subject: [PATCH] Add a mpt_is_raid_volume function which will tell you whether the passed target id is one of the RAID VolumeID. This result is used to decide whether to try and do actual SPI negotiations on the real side of the raid/passthru bus pair. The reason we check this is that we can have both RAID volumes and real devices on the same bus. --- sys/dev/mpt/mpt_raid.c | 21 +++++++++++++++++++-- sys/dev/mpt/mpt_raid.h | 1 + 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/sys/dev/mpt/mpt_raid.c b/sys/dev/mpt/mpt_raid.c index 81c679757035..ed1700802408 100644 --- a/sys/dev/mpt/mpt_raid.c +++ b/sys/dev/mpt/mpt_raid.c @@ -226,7 +226,7 @@ mpt_raid_async(void *callback_arg, u_int32_t code, break; } - mpt_lprt(mpt, MPT_PRT_DEBUG, " Callback for %d\n", + mpt_lprt(mpt, MPT_PRT_DEBUG, "Callback for %d\n", cgd->ccb_h.target_id); RAID_VOL_FOREACH(mpt, mpt_vol) { @@ -779,11 +779,28 @@ mpt_map_physdisk(struct mpt_softc *mpt, union ccb *ccb, u_int *tgt) *tgt = mpt_disk->config_page.PhysDiskID; return (0); } - mpt_lprt(mpt, MPT_PRT_DEBUG, "mpt_map_physdisk(%d) - Not Active\n", + mpt_lprt(mpt, MPT_PRT_DEBUG1, "mpt_map_physdisk(%d) - Not Active\n", ccb->ccb_h.target_id); return (-1); } +/* XXX Ignores that there may be multiple busses/IOCs involved. */ +int +mpt_is_raid_volume(struct mpt_softc *mpt, int tgt) +{ + CONFIG_PAGE_IOC_2_RAID_VOL *ioc_vol; + CONFIG_PAGE_IOC_2_RAID_VOL *ioc_last_vol; + + ioc_vol = mpt->ioc_page2->RaidVolume; + ioc_last_vol = ioc_vol + mpt->ioc_page2->NumActiveVolumes; + for (;ioc_vol != ioc_last_vol; ioc_vol++) { + if (ioc_vol->VolumeID == tgt) { + return (1); + } + } + return (0); +} + #if 0 static void mpt_enable_vol(struct mpt_softc *mpt, struct mpt_raid_volume *mpt_vol, diff --git a/sys/dev/mpt/mpt_raid.h b/sys/dev/mpt/mpt_raid.h index c3f4b3f882ba..6ff4d8331874 100644 --- a/sys/dev/mpt/mpt_raid.h +++ b/sys/dev/mpt/mpt_raid.h @@ -60,6 +60,7 @@ mpt_issue_raid_req(struct mpt_softc *, struct mpt_raid_volume *, cam_status mpt_map_physdisk(struct mpt_softc *, union ccb *, target_id_t *); +int mpt_is_raid_volume(struct mpt_softc *, int); cam_status mpt_raid_quiesce_disk(struct mpt_softc *, struct mpt_raid_disk *, request_t *);