Date: Thu, 13 Jul 2006 08:47:40 GMT From: Kip Macy <kmacy@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 101438 for review Message-ID: <200607130847.k6D8le7B087164@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=101438 Change 101438 by kmacy@kmacy_storage:sun4v_work_stable on 2006/07/13 08:47:02 Fix endian conversions in event messages, ioc page retrievals, and zero-data-length commands. This appears to be enough to make targets attach and do simple I/O. Affected files ... .. //depot/projects/kmacy_sun4v_stable/src/sys/dev/mpt/mpt.c#9 edit .. //depot/projects/kmacy_sun4v_stable/src/sys/dev/mpt/mpt_cam.c#5 edit .. //depot/projects/kmacy_sun4v_stable/src/sys/sun4v/conf/GENERIC#6 edit .. //depot/projects/kmacy_sun4v_stable/src/sys/sun4v/include/bus.h#2 edit .. //depot/projects/kmacy_sun4v_stable/src/sys/sun4v/sun4v/hviommu.c#2 edit .. //depot/projects/kmacy_sun4v_stable/src/sys/sun4v/sun4v/nexus.c#2 edit Differences ... ==== //depot/projects/kmacy_sun4v_stable/src/sys/dev/mpt/mpt.c#9 (text+ko) ==== @@ -516,6 +516,10 @@ handled = 0; msg = (MSG_EVENT_NOTIFY_REPLY *)reply_frame; + msg->EventDataLength = le16toh(msg->EventDataLength); + msg->IOCStatus = le16toh(msg->IOCStatus); + msg->IOCLogInfo = le32toh(msg->IOCLogInfo); + msg->Event = le32toh(msg->Event); MPT_PERS_FOREACH(mpt, pers) handled += pers->event(mpt, req, msg); @@ -1539,6 +1543,7 @@ ((Action == MPI_CONFIG_ACTION_PAGE_WRITE_CURRENT || Action == MPI_CONFIG_ACTION_PAGE_WRITE_NVRAM) ? MPI_SGE_FLAGS_HOST_TO_IOC : MPI_SGE_FLAGS_IOC_TO_HOST))); + se->FlagsLength = htole32(se->FlagsLength); cfgp->MsgContext = htole32(req->index | MPT_REPLY_HANDLER_CONFIG); mpt_check_doorbell(mpt); ==== //depot/projects/kmacy_sun4v_stable/src/sys/dev/mpt/mpt_cam.c#5 (text+ko) ==== @@ -961,6 +961,7 @@ MPI_pSGE_SET_FLAGS(se1, (MPI_SGE_FLAGS_LAST_ELEMENT | MPI_SGE_FLAGS_END_OF_BUFFER | MPI_SGE_FLAGS_SIMPLE_ELEMENT | MPI_SGE_FLAGS_END_OF_LIST)); + se1->FlagsLength = htole32(se1->FlagsLength); goto out; } @@ -1032,6 +1033,7 @@ MPI_SGE_FLAGS_END_OF_BUFFER; } MPI_pSGE_SET_FLAGS(se, tf); + se->FlagsLength = htole32(se->FlagsLength); } if (seg == nseg) { @@ -1149,6 +1151,7 @@ MPI_SGE_FLAGS_END_OF_BUFFER; } MPI_pSGE_SET_FLAGS(se, tf); + se->FlagsLength = htole32(se->FlagsLength); se++; seg++; dm_segs++; @@ -1362,6 +1365,7 @@ MPI_pSGE_SET_FLAGS(se1, (MPI_SGE_FLAGS_LAST_ELEMENT | MPI_SGE_FLAGS_END_OF_BUFFER | MPI_SGE_FLAGS_SIMPLE_ELEMENT | MPI_SGE_FLAGS_END_OF_LIST)); + se1->FlagsLength = htole32(se1->FlagsLength); goto out; } @@ -1433,6 +1437,7 @@ MPI_SGE_FLAGS_END_OF_BUFFER; } MPI_pSGE_SET_FLAGS(se, tf); + se->FlagsLength = htole32(se->FlagsLength); } if (seg == nseg) { @@ -1548,6 +1553,7 @@ MPI_SGE_FLAGS_END_OF_BUFFER; } MPI_pSGE_SET_FLAGS(se, tf); + se->FlagsLength = htole32(se->FlagsLength); se++; seg++; dm_segs++; @@ -1966,17 +1972,21 @@ mpt_cam_event(struct mpt_softc *mpt, request_t *req, MSG_EVENT_NOTIFY_REPLY *msg) { + uint32_t data0, data1; + + data0 = le32toh(msg->Data[0]); + data1 = le32toh(msg->Data[1]); printf("%s(%d): msg->Event 0x%x\n",__FUNCTION__,__LINE__,le32toh(msg->Event)); - switch(le32toh(msg->Event) & 0xFF) { + switch(msg->Event & 0xFF) { case MPI_EVENT_UNIT_ATTENTION: mpt_prt(mpt, "Bus: 0x%02x TargetID: 0x%02x\n", - (msg->Data[0] >> 8) & 0xff, msg->Data[0] & 0xff); + (data0 >> 8) & 0xff, data0 & 0xff); break; case MPI_EVENT_IOC_BUS_RESET: /* We generated a bus reset */ mpt_prt(mpt, "IOC Bus Reset Port: %d\n", - (msg->Data[0] >> 8) & 0xff); + (data0 >> 8) & 0xff); xpt_async(AC_BUS_RESET, mpt->path, NULL); break; @@ -1994,81 +2004,81 @@ /* * In general this means a device has been added to the loop. */ - mpt_prt(mpt, "Rescan Port: %d\n", (msg->Data[0] >> 8) & 0xff); + mpt_prt(mpt, "Rescan Port: %d\n", (data0 >> 8) & 0xff); /* xpt_async(AC_FOUND_DEVICE, path, NULL); */ break; case MPI_EVENT_LINK_STATUS_CHANGE: mpt_prt(mpt, "Port %d: LinkState: %s\n", - (msg->Data[1] >> 8) & 0xff, - ((msg->Data[0] & 0xff) == 0)? "Failed" : "Active"); + (data1 >> 8) & 0xff, + ((data0 & 0xff) == 0)? "Failed" : "Active"); break; case MPI_EVENT_LOOP_STATE_CHANGE: - switch ((msg->Data[0] >> 16) & 0xff) { + switch ((data0 >> 16) & 0xff) { case 0x01: mpt_prt(mpt, "Port 0x%x: FC LinkEvent: LIP(%02x,%02x) " "(Loop Initialization)\n", - (msg->Data[1] >> 8) & 0xff, - (msg->Data[0] >> 8) & 0xff, - (msg->Data[0] ) & 0xff); - switch ((msg->Data[0] >> 8) & 0xff) { + (data1 >> 8) & 0xff, + (data0 >> 8) & 0xff, + (data0 ) & 0xff); + switch ((data0 >> 8) & 0xff) { case 0xF7: - if ((msg->Data[0] & 0xff) == 0xF7) { + if ((data0 & 0xff) == 0xF7) { mpt_prt(mpt, "Device needs AL_PA\n"); } else { mpt_prt(mpt, "Device %02x doesn't like " "FC performance\n", - msg->Data[0] & 0xFF); + data0 & 0xFF); } break; case 0xF8: - if ((msg->Data[0] & 0xff) == 0xF7) { + if ((data0 & 0xff) == 0xF7) { mpt_prt(mpt, "Device had loop failure " "at its receiver prior to acquiring" " AL_PA\n"); } else { mpt_prt(mpt, "Device %02x detected loop" " failure at its receiver\n", - msg->Data[0] & 0xFF); + data0 & 0xFF); } break; default: mpt_prt(mpt, "Device %02x requests that device " "%02x reset itself\n", - msg->Data[0] & 0xFF, - (msg->Data[0] >> 8) & 0xFF); + data0 & 0xFF, + (data0 >> 8) & 0xFF); break; } break; case 0x02: mpt_prt(mpt, "Port 0x%x: FC LinkEvent: " "LPE(%02x,%02x) (Loop Port Enable)\n", - (msg->Data[1] >> 8) & 0xff, /* Port */ - (msg->Data[0] >> 8) & 0xff, /* Character 3 */ - (msg->Data[0] ) & 0xff /* Character 4 */); + (data1 >> 8) & 0xff, /* Port */ + (data0 >> 8) & 0xff, /* Character 3 */ + (data0 ) & 0xff /* Character 4 */); break; case 0x03: mpt_prt(mpt, "Port 0x%x: FC LinkEvent: " "LPB(%02x,%02x) (Loop Port Bypass)\n", - (msg->Data[1] >> 8) & 0xff, /* Port */ - (msg->Data[0] >> 8) & 0xff, /* Character 3 */ - (msg->Data[0] ) & 0xff /* Character 4 */); + (data1 >> 8) & 0xff, /* Port */ + (data0 >> 8) & 0xff, /* Character 3 */ + (data0 ) & 0xff /* Character 4 */); break; default: mpt_prt(mpt, "Port 0x%x: FC LinkEvent: Unknown " "FC event (%02x %02x %02x)\n", - (msg->Data[1] >> 8) & 0xff, /* Port */ - (msg->Data[0] >> 16) & 0xff, /* Event */ - (msg->Data[0] >> 8) & 0xff, /* Character 3 */ - (msg->Data[0] ) & 0xff /* Character 4 */); + (data1 >> 8) & 0xff, /* Port */ + (data0 >> 16) & 0xff, /* Event */ + (data0 >> 8) & 0xff, /* Character 3 */ + (data0 ) & 0xff /* Character 4 */); } break; case MPI_EVENT_LOGOUT: mpt_prt(mpt, "FC Logout Port: %d N_PortID: %02x\n", - (msg->Data[1] >> 8) & 0xff, msg->Data[0]); + (data1 >> 8) & 0xff, data0); break; case MPI_EVENT_EVENT_CHANGE: mpt_lprt(mpt, MPT_PRT_DEBUG, ==== //depot/projects/kmacy_sun4v_stable/src/sys/sun4v/conf/GENERIC#6 (text+ko) ==== @@ -98,7 +98,7 @@ #device ahc # AHA2940 and onboard AIC7xxx devices #device isp # Qlogic family #device ispfw # Firmware module for Qlogic host adapters -#device mpt # LSI-Logic MPT-Fusion (not yet) +device mpt # LSI-Logic MPT-Fusion (not yet) #device ncr # NCR/Symbios Logic #device sym # NCR/Symbios Logic (newer chipsets + those of `ncr') #device esp # NCR53c9x (FEPS/FAS366) ==== //depot/projects/kmacy_sun4v_stable/src/sys/sun4v/include/bus.h#2 (text+ko) ==== ==== //depot/projects/kmacy_sun4v_stable/src/sys/sun4v/sun4v/hviommu.c#2 (text+ko) ==== ==== //depot/projects/kmacy_sun4v_stable/src/sys/sun4v/sun4v/nexus.c#2 (text+ko) ==== @@ -329,32 +329,30 @@ goto fail; } + if ((rman_get_flags(res) & RF_SHAREABLE) == 0) + flags |= INTR_EXCL; + + /* We depend here on rman_activate_resource() being idempotent. */ + if ((error = rman_activate_resource(res))) + goto fail; + + error = inthand_add(device_get_nameunit(child), ihdl, + intr, arg, flags, cookiep); + cpuid = 0; - if (hvio_intr_settarget(ihdl, cpuid) != H_EOK) { error = ENXIO; goto fail; } - if (hvio_intr_setstate(ihdl, HV_INTR_IDLE_STATE) != H_EOK) { error = ENXIO; goto fail; } - if (hvio_intr_setvalid(ihdl, HV_INTR_VALID) != H_EOK) { error = ENXIO; goto fail; } - if ((rman_get_flags(res) & RF_SHAREABLE) == 0) - flags |= INTR_EXCL; - - /* We depend here on rman_activate_resource() being idempotent. */ - if ((error = rman_activate_resource(res))) - goto fail; - - error = inthand_add(device_get_nameunit(child), ihdl, - intr, arg, flags, cookiep); fail:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200607130847.k6D8le7B087164>