From 1dad8bb0bafb06ba359ee58d6dc527cec04611cb Mon Sep 17 00:00:00 2001 From: Matt Jacob Date: Tue, 25 Jul 2006 00:59:54 +0000 Subject: [PATCH] When probing to attach the CAM functionality, check against desired role configuration instead of existing role. This gets us out of the mess where we configured a role of NONE (or were LAN only, for example), but didn't continue to attach the CAM module (because we had neither initiator nor target role set). Unfortunately, the code that rewrites NVRAM to match actual to desired role only works if the CAM module attaches. MFC after: 2 weeks --- sys/dev/mpt/mpt_cam.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/sys/dev/mpt/mpt_cam.c b/sys/dev/mpt/mpt_cam.c index 4762edb80bf..c460b28e779 100644 --- a/sys/dev/mpt/mpt_cam.c +++ b/sys/dev/mpt/mpt_cam.c @@ -181,13 +181,20 @@ DECLARE_MPT_PERSONALITY(mpt_cam, SI_ORDER_SECOND); int mpt_cam_probe(struct mpt_softc *mpt) { + int role; + /* - * Only attach to nodes that support the initiator or target - * role or have RAID physical devices that need CAM pass-thru support. + * Only attach to nodes that support the initiator or target role + * (or want to) or have RAID physical devices that need CAM pass-thru + * support. */ - if ((mpt->mpt_proto_flags & MPI_PORTFACTS_PROTOCOL_INITIATOR) != 0 - || (mpt->mpt_proto_flags & MPI_PORTFACTS_PROTOCOL_TARGET) != 0 - || (mpt->ioc_page2 != NULL && mpt->ioc_page2->MaxPhysDisks != 0)) { + if (mpt->do_cfg_role) { + role = mpt->cfg_role; + } else { + role = mpt->role; + } + if ((role & (MPT_ROLE_TARGET|MPT_ROLE_INITIATOR)) != 0 || + (mpt->ioc_page2 != NULL && mpt->ioc_page2->MaxPhysDisks != 0)) { return (0); } return (ENODEV); @@ -355,6 +362,7 @@ mpt_cam_attach(struct mpt_softc *mpt) goto cleanup; } CAMLOCK_2_MPTLOCK(mpt); + mpt_lprt(mpt, MPT_PRT_DEBUG, "attached cam\n"); return (0); cleanup: