PERFORCE change 101597 for review
John Birrell
jb at FreeBSD.org
Fri Jul 14 20:25:37 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=101597
Change 101597 by jb at jb_freebsd2 on 2006/07/14 20:25:16
IFsun4v_stable.
These are the changes that make mpt work on big endian architectures
like sun4v.
Affected files ...
.. //depot/projects/dtrace/src/sys/dev/mpt/mpilib/mpi.h#3 integrate
.. //depot/projects/dtrace/src/sys/dev/mpt/mpilib/mpi_cnfg.h#3 integrate
.. //depot/projects/dtrace/src/sys/dev/mpt/mpilib/mpi_fc.h#3 integrate
.. //depot/projects/dtrace/src/sys/dev/mpt/mpilib/mpi_inb.h#3 integrate
.. //depot/projects/dtrace/src/sys/dev/mpt/mpilib/mpi_init.h#3 integrate
.. //depot/projects/dtrace/src/sys/dev/mpt/mpilib/mpi_ioc.h#3 integrate
.. //depot/projects/dtrace/src/sys/dev/mpt/mpilib/mpi_lan.h#3 integrate
.. //depot/projects/dtrace/src/sys/dev/mpt/mpilib/mpi_log_fc.h#3 integrate
.. //depot/projects/dtrace/src/sys/dev/mpt/mpilib/mpi_log_sas.h#3 integrate
.. //depot/projects/dtrace/src/sys/dev/mpt/mpilib/mpi_raid.h#3 integrate
.. //depot/projects/dtrace/src/sys/dev/mpt/mpilib/mpi_sas.h#3 integrate
.. //depot/projects/dtrace/src/sys/dev/mpt/mpilib/mpi_targ.h#3 integrate
.. //depot/projects/dtrace/src/sys/dev/mpt/mpilib/mpi_tool.h#3 integrate
.. //depot/projects/dtrace/src/sys/dev/mpt/mpilib/mpi_type.h#3 integrate
.. //depot/projects/dtrace/src/sys/dev/mpt/mpt.c#9 integrate
.. //depot/projects/dtrace/src/sys/dev/mpt/mpt.h#11 integrate
.. //depot/projects/dtrace/src/sys/dev/mpt/mpt_cam.c#11 integrate
.. //depot/projects/dtrace/src/sys/dev/mpt/mpt_cam.h#3 integrate
.. //depot/projects/dtrace/src/sys/dev/mpt/mpt_debug.c#5 integrate
.. //depot/projects/dtrace/src/sys/dev/mpt/mpt_pci.c#10 integrate
.. //depot/projects/dtrace/src/sys/dev/mpt/mpt_raid.c#5 integrate
.. //depot/projects/dtrace/src/sys/dev/mpt/mpt_raid.h#4 integrate
.. //depot/projects/dtrace/src/sys/dev/mpt/mpt_reg.h#3 integrate
Differences ...
==== //depot/projects/dtrace/src/sys/dev/mpt/mpilib/mpi.h#3 (text+ko) ====
==== //depot/projects/dtrace/src/sys/dev/mpt/mpilib/mpi_cnfg.h#3 (text+ko) ====
==== //depot/projects/dtrace/src/sys/dev/mpt/mpilib/mpi_fc.h#3 (text+ko) ====
==== //depot/projects/dtrace/src/sys/dev/mpt/mpilib/mpi_inb.h#3 (text+ko) ====
==== //depot/projects/dtrace/src/sys/dev/mpt/mpilib/mpi_init.h#3 (text+ko) ====
==== //depot/projects/dtrace/src/sys/dev/mpt/mpilib/mpi_ioc.h#3 (text+ko) ====
==== //depot/projects/dtrace/src/sys/dev/mpt/mpilib/mpi_lan.h#3 (text+ko) ====
==== //depot/projects/dtrace/src/sys/dev/mpt/mpilib/mpi_log_fc.h#3 (text+ko) ====
==== //depot/projects/dtrace/src/sys/dev/mpt/mpilib/mpi_log_sas.h#3 (text+ko) ====
==== //depot/projects/dtrace/src/sys/dev/mpt/mpilib/mpi_raid.h#3 (text+ko) ====
==== //depot/projects/dtrace/src/sys/dev/mpt/mpilib/mpi_sas.h#3 (text+ko) ====
==== //depot/projects/dtrace/src/sys/dev/mpt/mpilib/mpi_targ.h#3 (text+ko) ====
==== //depot/projects/dtrace/src/sys/dev/mpt/mpilib/mpi_tool.h#3 (text+ko) ====
==== //depot/projects/dtrace/src/sys/dev/mpt/mpilib/mpi_type.h#3 (text+ko) ====
==== //depot/projects/dtrace/src/sys/dev/mpt/mpt.c#9 (text+ko) ====
@@ -516,11 +516,15 @@
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);
if (handled == 0 && mpt->mpt_pers_mask == 0) {
- mpt_lprt(mpt, MPT_PRT_INFO,
+ mpt_lprt(mpt, MPT_PRT_INFO,
"No Handlers For Any Event Notify Frames. "
"Event %#x (ACK %sequired).\n",
msg->Event, msg->AckRequired? "r" : "not r");
@@ -535,7 +539,7 @@
request_t *ack_req;
uint32_t context;
- context = htole32(req->index|MPT_REPLY_HANDLER_EVENTS);
+ context = req->index | MPT_REPLY_HANDLER_EVENTS;
ack_req = mpt_get_request(mpt, FALSE);
if (ack_req == NULL) {
struct mpt_evtf_record *evtf;
@@ -652,9 +656,9 @@
ackp = (MSG_EVENT_ACK *)ack_req->req_vbuf;
memset(ackp, 0, sizeof (*ackp));
ackp->Function = MPI_FUNCTION_EVENT_ACK;
- ackp->Event = msg->Event;
- ackp->EventContext = msg->EventContext;
- ackp->MsgContext = context;
+ ackp->Event = htole32(msg->Event);
+ ackp->EventContext = htole32(msg->EventContext);
+ ackp->MsgContext = htole32(context);
mpt_check_doorbell(mpt);
mpt_send_cmd(mpt, ack_req);
}
@@ -825,7 +829,7 @@
/******************************* Doorbell Access ******************************/
static __inline uint32_t mpt_rd_db(struct mpt_softc *mpt);
-static __inline uint32_t mpt_rd_intr(struct mpt_softc *mpt);
+static __inline uint32_t mpt_rd_intr(struct mpt_softc *mpt);
static __inline uint32_t
mpt_rd_db(struct mpt_softc *mpt)
@@ -1343,7 +1347,7 @@
/* Send the command */
for (i = 0; i < len; i++) {
- mpt_write(mpt, MPT_OFFSET_DOORBELL, *data32++);
+ mpt_write(mpt, MPT_OFFSET_DOORBELL, htole32(*data32++));
if (mpt_wait_db_ack(mpt) != MPT_OK) {
mpt_prt(mpt,
"mpt_send_handshake_cmd timeout! index = %d\n",
@@ -1359,12 +1363,13 @@
mpt_recv_handshake_reply(struct mpt_softc *mpt, size_t reply_len, void *reply)
{
int left, reply_left;
- u_int16_t *data16;
+ uint16_t *data16;
+ uint32_t data;
MSG_DEFAULT_REPLY *hdr;
/* We move things out in 16 bit chunks */
reply_len >>= 1;
- data16 = (u_int16_t *)reply;
+ data16 = (uint16_t *)reply;
hdr = (MSG_DEFAULT_REPLY *)reply;
@@ -1373,7 +1378,9 @@
mpt_prt(mpt, "mpt_recv_handshake_cmd timeout1\n");
return ETIMEDOUT;
}
- *data16++ = mpt_read(mpt, MPT_OFFSET_DOORBELL) & MPT_DB_DATA_MASK;
+ data = mpt_read(mpt, MPT_OFFSET_DOORBELL);
+
+ *data16++ = le16toh(data & MPT_DB_DATA_MASK);
mpt_write(mpt, MPT_OFFSET_INTR_STATUS, 0);
/* Get Second Word */
@@ -1381,15 +1388,16 @@
mpt_prt(mpt, "mpt_recv_handshake_cmd timeout2\n");
return ETIMEDOUT;
}
- *data16++ = mpt_read(mpt, MPT_OFFSET_DOORBELL) & MPT_DB_DATA_MASK;
+ data = mpt_read(mpt, MPT_OFFSET_DOORBELL);
+ *data16++ = le16toh(data & MPT_DB_DATA_MASK);
mpt_write(mpt, MPT_OFFSET_INTR_STATUS, 0);
/*
* With the second word, we can now look at the length.
* Warn about a reply that's too short (except for IOC FACTS REPLY)
*/
- if ((reply_len >> 1) != hdr->MsgLength &&
- (hdr->Function != MPI_FUNCTION_IOC_FACTS)){
+ if ((reply_len >> 1) != hdr->MsgLength &&
+ (hdr->Function != MPI_FUNCTION_IOC_FACTS)) {
#if __FreeBSD_version >= 500000
mpt_prt(mpt, "reply length does not match message length: "
"got %x; expected %zx for function %x\n",
@@ -1411,10 +1419,11 @@
mpt_prt(mpt, "mpt_recv_handshake_cmd timeout3\n");
return ETIMEDOUT;
}
- datum = mpt_read(mpt, MPT_OFFSET_DOORBELL);
+ data = mpt_read(mpt, MPT_OFFSET_DOORBELL);
+ datum = le16toh(data & MPT_DB_DATA_MASK);
if (reply_left-- > 0)
- *data16++ = datum & MPT_DB_DATA_MASK;
+ *data16++ = datum;
mpt_write(mpt, MPT_OFFSET_INTR_STATUS, 0);
}
@@ -1456,7 +1465,6 @@
{
MSG_PORT_FACTS f_req;
int error;
-
/* XXX: Only getting PORT FACTS for Port 0 */
memset(&f_req, 0, sizeof f_req);
f_req.Function = MPI_FUNCTION_PORT_FACTS;
@@ -1521,9 +1529,9 @@
cfgp->Header.PageLength = PageLength;
cfgp->Header.PageNumber = PageNumber;
cfgp->Header.PageType = PageType;
- cfgp->PageAddress = PageAddress;
+ cfgp->PageAddress = htole32(PageAddress);
se = (SGE_SIMPLE32 *)&cfgp->PageBufferSGE;
- se->Address = addr;
+ se->Address = htole32(addr);
MPI_pSGE_SET_LENGTH(se, len);
MPI_pSGE_SET_FLAGS(se, (MPI_SGE_FLAGS_SIMPLE_ELEMENT |
MPI_SGE_FLAGS_LAST_ELEMENT | MPI_SGE_FLAGS_END_OF_BUFFER |
@@ -1531,6 +1539,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);
@@ -2450,7 +2459,7 @@
pfp.MaxDevices);
mpt->mpt_port_type = pfp.PortType;
- mpt->mpt_proto_flags = pfp.ProtocolFlags;
+ mpt->mpt_proto_flags = le16toh(pfp.ProtocolFlags);
if (pfp.PortType != MPI_PORTFACTS_PORTTYPE_SCSI &&
pfp.PortType != MPI_PORTFACTS_PORTTYPE_SAS &&
pfp.PortType != MPI_PORTFACTS_PORTTYPE_FC) {
@@ -2483,10 +2492,10 @@
* if this is different from what is wanted.
*/
mpt->role = MPT_ROLE_NONE;
- if (pfp.ProtocolFlags & MPI_PORTFACTS_PROTOCOL_INITIATOR) {
+ if (mpt->mpt_proto_flags & MPI_PORTFACTS_PROTOCOL_INITIATOR) {
mpt->role |= MPT_ROLE_INITIATOR;
}
- if (pfp.ProtocolFlags & MPI_PORTFACTS_PROTOCOL_TARGET) {
+ if (mpt->mpt_proto_flags & MPI_PORTFACTS_PROTOCOL_TARGET) {
mpt->role |= MPT_ROLE_TARGET;
}
if (mpt_enable_ioc(mpt, 0) != MPT_OK) {
==== //depot/projects/dtrace/src/sys/dev/mpt/mpt.h#11 (text+ko) ====
@@ -120,6 +120,7 @@
#include <sys/proc.h>
#include <sys/bus.h>
#include <sys/module.h>
+#include <sys/taskqueue.h>
#include <machine/cpu.h>
#include <machine/resource.h>
@@ -625,6 +626,8 @@
struct req_queue request_pending_list;
struct req_queue request_timeout_list;
+ struct task intr_task;
+ struct taskqueue *tq;
struct cam_sim *sim;
struct cam_path *path;
@@ -841,13 +844,15 @@
static __inline void
mpt_pio_write(struct mpt_softc *mpt, size_t offset, uint32_t val)
{
- bus_space_write_4(mpt->pci_pio_st, mpt->pci_pio_sh, offset, val);
+ bus_space_write_4(mpt->pci_pio_st, mpt->pci_pio_sh, offset,
+ val);
}
static __inline uint32_t
mpt_pio_read(struct mpt_softc *mpt, int offset)
{
- return (bus_space_read_4(mpt->pci_pio_st, mpt->pci_pio_sh, offset));
+ return (bus_space_read_4(mpt->pci_pio_st, mpt->pci_pio_sh,
+ offset));
}
/*********************** Reply Frame/Request Management ***********************/
/* Max MPT Reply we are willing to accept (must be power of 2) */
@@ -1008,7 +1013,7 @@
static __inline request_t *
mpt_tag_2_req(struct mpt_softc *mpt, uint32_t tag)
{
- uint16_t rtg = (tag >> 18);
+ uint16_t rtg = tag >> 18;
KASSERT(rtg < mpt->tgt_cmds_allocated, ("bad tag %d\n", tag));
KASSERT(mpt->tgt_cmd_ptrs, ("no cmd backpointer array"));
KASSERT(mpt->tgt_cmd_ptrs[rtg], ("no cmd backpointer"));
==== //depot/projects/dtrace/src/sys/dev/mpt/mpt_cam.c#11 (text+ko) ====
@@ -982,6 +982,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;
}
@@ -1039,9 +1040,9 @@
uint32_t tf;
memset(se, 0, sizeof (*se));
- se->Address.Low = dm_segs->ds_addr;
+ se->Address.Low = htole32(dm_segs->ds_addr & 0xffffffff);
if (sizeof(bus_addr_t) > 4) {
- se->Address.High = ((uint64_t) dm_segs->ds_addr) >> 32;
+ se->Address.High = ((uint64_t)dm_segs->ds_addr) >> 32;
}
MPI_pSGE_SET_LENGTH(se, dm_segs->ds_len);
tf = flags;
@@ -1053,6 +1054,7 @@
MPI_SGE_FLAGS_END_OF_BUFFER;
}
MPI_pSGE_SET_FLAGS(se, tf);
+ se->FlagsLength = htole32(se->FlagsLength);
}
if (seg == nseg) {
@@ -1115,9 +1117,9 @@
chain_list_addr += cur_off;
if (sizeof (bus_addr_t) > 4) {
ce->Address.High =
- (uint32_t) ((uint64_t)chain_list_addr >> 32);
+ htole32((uint64_t)chain_list_addr >> 32);
}
- ce->Address.Low = (uint32_t) chain_list_addr;
+ ce->Address.Low = htole32(chain_list_addr & 0xffffffff);
ce->Flags = MPI_SGE_FLAGS_CHAIN_ELEMENT |
MPI_SGE_FLAGS_64_BIT_ADDRESSING;
@@ -1154,10 +1156,11 @@
*/
while (seg < this_seg_lim) {
memset(se, 0, sizeof (*se));
- se->Address.Low = dm_segs->ds_addr;
+ se->Address.Low =
+ htole32(dm_segs->ds_addr & 0xffffffff);
if (sizeof (bus_addr_t) > 4) {
se->Address.High =
- ((uint64_t)dm_segs->ds_addr) >> 32;
+ htole32(((uint64_t)dm_segs->ds_addr) >>32);
}
MPI_pSGE_SET_LENGTH(se, dm_segs->ds_len);
tf = flags;
@@ -1169,6 +1172,7 @@
MPI_SGE_FLAGS_END_OF_BUFFER;
}
MPI_pSGE_SET_FLAGS(se, tf);
+ se->FlagsLength = htole32(se->FlagsLength);
se++;
seg++;
dm_segs++;
@@ -1382,6 +1386,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;
}
@@ -1453,6 +1458,7 @@
MPI_SGE_FLAGS_END_OF_BUFFER;
}
MPI_pSGE_SET_FLAGS(se, tf);
+ se->FlagsLength = htole32(se->FlagsLength);
}
if (seg == nseg) {
@@ -1568,6 +1574,7 @@
MPI_SGE_FLAGS_END_OF_BUFFER;
}
MPI_pSGE_SET_FLAGS(se, tf);
+ se->FlagsLength = htole32(se->FlagsLength);
se++;
seg++;
dm_segs++;
@@ -1812,8 +1819,8 @@
}
mpt_req->CDBLength = csio->cdb_len;
- mpt_req->DataLength = csio->dxfer_len;
- mpt_req->SenseBufferLowAddr = req->sense_pbuf;
+ mpt_req->DataLength = htole32((uint32_t)csio->dxfer_len);
+ mpt_req->SenseBufferLowAddr = htole32(req->sense_pbuf & 0xffffffff);
/*
* Do a *short* print here if we're set to MPT_PRT_DEBUG
@@ -1984,16 +1991,20 @@
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]);
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;
@@ -2011,81 +2022,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,
@@ -2100,7 +2111,7 @@
break;
default:
mpt_lprt(mpt, MPT_PRT_WARN, "mpt_cam_event: 0x%x\n",
- msg->Event & 0xFF);
+ le32toh(msg->Event) & 0xFF);
return (0);
}
return (1);
@@ -2256,6 +2267,7 @@
{
MSG_LINK_SERVICE_RSP_REQUEST tmp;
PTR_MSG_LINK_SERVICE_RSP_REQUEST rsp;
+ uint32_t fl;
/*
* We are going to reuse the ELS request to send this response back.
@@ -2293,15 +2305,16 @@
bus_addr_t paddr = req->req_pbuf;
paddr += MPT_RQSL(mpt);
- se->FlagsLength =
+ fl =
MPI_SGE_FLAGS_HOST_TO_IOC |
MPI_SGE_FLAGS_SIMPLE_ELEMENT |
MPI_SGE_FLAGS_LAST_ELEMENT |
MPI_SGE_FLAGS_END_OF_LIST |
MPI_SGE_FLAGS_END_OF_BUFFER;
- se->FlagsLength <<= MPI_SGE_FLAGS_SHIFT;
- se->FlagsLength |= (length);
- se->Address = (uint32_t) paddr;
+ fl <<= MPI_SGE_FLAGS_SHIFT;
+ fl |= (length);
+ se->FlagsLength = htole32(fl);
+ se->Address = htole32(paddr & 0xffffffff);
}
#endif
@@ -3660,6 +3673,7 @@
PTR_SGE_TRANSACTION32 tep;
PTR_SGE_SIMPLE32 se;
bus_addr_t paddr;
+ uint32_t fl;
paddr = req->req_pbuf;
paddr += MPT_RQSL(mpt);
@@ -3684,15 +3698,16 @@
tep->TransactionContext[0] = htole32(ioindex);
se = (PTR_SGE_SIMPLE32) &tep->TransactionDetails[0];
- se->FlagsLength =
+ fl =
MPI_SGE_FLAGS_HOST_TO_IOC |
MPI_SGE_FLAGS_SIMPLE_ELEMENT |
MPI_SGE_FLAGS_LAST_ELEMENT |
MPI_SGE_FLAGS_END_OF_LIST |
MPI_SGE_FLAGS_END_OF_BUFFER;
- se->FlagsLength <<= MPI_SGE_FLAGS_SHIFT;
- se->FlagsLength |= (MPT_NRFM(mpt) - MPT_RQSL(mpt));
- se->Address = (uint32_t) paddr;
+ fl <<= MPI_SGE_FLAGS_SHIFT;
+ fl |= (MPT_NRFM(mpt) - MPT_RQSL(mpt));
+ se->FlagsLength = htole32(fl);
+ se->Address = htole32(paddr & 0xffffffff);
mpt_lprt(mpt, MPT_PRT_DEBUG,
"add ELS index %d ioindex %d for %p:%u\n",
req->index, ioindex, req, req->serno);
@@ -3720,7 +3735,7 @@
cb = &fc->Buffer[0];
cb->IoIndex = htole16(ioindex);
- cb->u.PhysicalAddress32 = (U32) paddr;
+ cb->u.PhysicalAddress32 = htole32(paddr & 0xffffffff);
mpt_check_doorbell(mpt);
mpt_send_cmd(mpt, req);
@@ -4190,6 +4205,7 @@
PTR_MSG_TARGET_STATUS_SEND_REQUEST tp;
request_t *req;
bus_addr_t paddr;
+ uint32_t fl;
int resplen = 0;
cmd_vbuf = cmd_req->req_vbuf;
@@ -4310,15 +4326,16 @@
if (status == SCSI_STATUS_OK && resplen == 0) {
tp->MsgFlags |= TARGET_STATUS_SEND_FLAGS_AUTO_GOOD_STATUS;
} else {
- tp->StatusDataSGE.u.Address32 = (uint32_t) paddr;
- tp->StatusDataSGE.FlagsLength =
+ tp->StatusDataSGE.u.Address32 = htole32(paddr & 0xffffffff);
+ fl =
MPI_SGE_FLAGS_HOST_TO_IOC |
MPI_SGE_FLAGS_SIMPLE_ELEMENT |
MPI_SGE_FLAGS_LAST_ELEMENT |
MPI_SGE_FLAGS_END_OF_LIST |
MPI_SGE_FLAGS_END_OF_BUFFER;
- tp->StatusDataSGE.FlagsLength <<= MPI_SGE_FLAGS_SHIFT;
- tp->StatusDataSGE.FlagsLength |= resplen;
+ fl <<= MPI_SGE_FLAGS_SHIFT;
+ fl |= resplen;
+ tp->StatusDataSGE.FlagsLength = htole32(fl);
}
mpt_lprt(mpt, MPT_PRT_DEBUG,
==== //depot/projects/dtrace/src/sys/dev/mpt/mpt_cam.h#3 (text+ko) ====
==== //depot/projects/dtrace/src/sys/dev/mpt/mpt_debug.c#5 (text+ko) ====
==== //depot/projects/dtrace/src/sys/dev/mpt/mpt_pci.c#10 (text+ko) ====
@@ -190,7 +190,8 @@
static int mpt_dma_mem_alloc(struct mpt_softc *mpt);
static void mpt_dma_mem_free(struct mpt_softc *mpt);
static void mpt_read_config_regs(struct mpt_softc *mpt);
-static void mpt_pci_intr(void *);
+static void mpt_pci_fastintr(void *);
+static void mpt_pci_handle_intr(void *, int);
static device_method_t mpt_methods[] = {
/* Device interface */
@@ -243,14 +244,28 @@
desc = "LSILogic 1030 Ultra4 Adapter";
break;
case PCI_PRODUCT_LSI_SAS1064:
+ desc = "LSILogic SAS1064 Adapter";
+ break;
case PCI_PRODUCT_LSI_SAS1064A:
+ desc = "LSILogic SAS1064A Adapter";
+ break;
case PCI_PRODUCT_LSI_SAS1064E:
+ desc = "LSILogic SAS1064E Adapter";
+ break;
case PCI_PRODUCT_LSI_SAS1066:
+ desc = "LSILogic SAS1066 Adapter";
+ break;
case PCI_PRODUCT_LSI_SAS1066E:
+ desc = "LSILogic SAS1066E Adapter";
+ break;
case PCI_PRODUCT_LSI_SAS1068:
+ desc = "LSILogic SAS1068 Adapter";
+ break;
case PCI_PRODUCT_LSI_SAS1068E:
+ desc = "LSILogic SAS1068E Adapter";
+ break;
case PCI_PRODUCT_LSI_SAS1078:
- desc = "LSILogic SAS Adapter";
+ desc = "LSILogic SAS1078 Adapter";
break;
default:
return (ENXIO);
@@ -521,8 +536,13 @@
mpt_disable_ints(mpt);
/* Register the interrupt handler */
- if (bus_setup_intr(dev, mpt->pci_irq, MPT_IFLAGS, mpt_pci_intr,
- mpt, &mpt->ih)) {
+ TASK_INIT(&mpt->intr_task, 0, mpt_pci_handle_intr, mpt);
+ mpt->tq = taskqueue_create_fast("mpt_taskq", M_NOWAIT,
+ taskqueue_thread_enqueue, &mpt->tq);
+ taskqueue_start_threads(&mpt->tq, 1, PI_DISK, "%s taskq",
+ device_get_nameunit(dev));
+ if (bus_setup_intr(dev, mpt->pci_irq, INTR_TYPE_CAM|INTR_FAST,
+ mpt_pci_fastintr, mpt, &mpt->ih)) {
device_printf(dev, "could not setup interrupt\n");
goto bad;
}
@@ -704,7 +724,7 @@
* Align at byte boundaries,
* Limit to 32-bit addressing for request/reply queues.
*/
- if (mpt_dma_tag_create(mpt, /*parent*/ NULL /* XXX bus_get_dma_tag(dev) */,
+ if (mpt_dma_tag_create(mpt, /*parent*/bus_get_dma_tag(mpt->dev),
/*alignment*/1, /*boundary*/0, /*lowaddr*/BUS_SPACE_MAXADDR,
/*highaddr*/BUS_SPACE_MAXADDR, /*filter*/NULL, /*filterarg*/NULL,
/*maxsize*/BUS_SPACE_MAXSIZE_32BIT,
@@ -918,12 +938,26 @@
}
static void
-mpt_pci_intr(void *arg)
+mpt_pci_fastintr(void *arg)
+{
+ struct mpt_softc *mpt;
+
+ mpt = (struct mpt_softc *)arg;
+ mpt_disable_ints(mpt);
+ taskqueue_enqueue(mpt->tq, &mpt->intr_task);
+ return;
+}
+
+static void
+mpt_pci_handle_intr(void *arg, int pending)
{
struct mpt_softc *mpt;
mpt = (struct mpt_softc *)arg;
+ mtx_lock(&Giant);
MPT_LOCK(mpt);
mpt_intr(mpt);
MPT_UNLOCK(mpt);
+ mtx_unlock(&Giant);
+ mpt_enable_ints(mpt);
}
==== //depot/projects/dtrace/src/sys/dev/mpt/mpt_raid.c#5 (text+ko) ====
==== //depot/projects/dtrace/src/sys/dev/mpt/mpt_raid.h#4 (text+ko) ====
==== //depot/projects/dtrace/src/sys/dev/mpt/mpt_reg.h#3 (text+ko) ====
More information about the p4-projects
mailing list