Deleted Added
full compact
isp.c (292715) isp.c (292725)
1/*-
2 * Copyright (c) 1997-2009 by Matthew Jacob
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *

--- 33 unchanged lines hidden (view full) ---

42 */
43#ifdef __NetBSD__
44#include <sys/cdefs.h>
45__KERNEL_RCSID(0, "$NetBSD$");
46#include <dev/ic/isp_netbsd.h>
47#endif
48#ifdef __FreeBSD__
49#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1997-2009 by Matthew Jacob
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *

--- 33 unchanged lines hidden (view full) ---

42 */
43#ifdef __NetBSD__
44#include <sys/cdefs.h>
45__KERNEL_RCSID(0, "$NetBSD$");
46#include <dev/ic/isp_netbsd.h>
47#endif
48#ifdef __FreeBSD__
49#include <sys/cdefs.h>
50__FBSDID("$FreeBSD: head/sys/dev/isp/isp.c 292715 2015-12-25 03:44:29Z mav $");
50__FBSDID("$FreeBSD: head/sys/dev/isp/isp.c 292725 2015-12-25 13:03:18Z mav $");
51#include <dev/isp/isp_freebsd.h>
52#endif
53#ifdef __OpenBSD__
54#include <dev/ic/isp_openbsd.h>
55#endif
56#ifdef __linux__
57#include "isp_linux.h"
58#endif

--- 4205 unchanged lines hidden (view full) ---

4264/*
4265 * Start a command. Locking is assumed done in the caller.
4266 */
4267
4268int
4269isp_start(XS_T *xs)
4270{
4271 ispsoftc_t *isp;
51#include <dev/isp/isp_freebsd.h>
52#endif
53#ifdef __OpenBSD__
54#include <dev/ic/isp_openbsd.h>
55#endif
56#ifdef __linux__
57#include "isp_linux.h"
58#endif

--- 4205 unchanged lines hidden (view full) ---

4264/*
4265 * Start a command. Locking is assumed done in the caller.
4266 */
4267
4268int
4269isp_start(XS_T *xs)
4270{
4271 ispsoftc_t *isp;
4272 uint32_t handle, cdblen;
4272 uint32_t cdblen;
4273 uint8_t local[QENTRY_LEN];
4274 ispreq_t *reqp;
4275 void *cdbp, *qep;
4276 uint16_t *tptr;
4277 fcportdb_t *lp;
4278 int target, dmaresult;
4279
4280 XS_INITERR(xs);

--- 279 unchanged lines hidden (view full) ---

4560 }
4561 ISP_MEMCPY(cdbp, XS_CDBP(xs), cdblen);
4562
4563 *tptr = (XS_TIME(xs) + 999) / 1000;
4564 if (IS_24XX(isp) && *tptr > 0x1999) {
4565 *tptr = 0x1999;
4566 }
4567
4273 uint8_t local[QENTRY_LEN];
4274 ispreq_t *reqp;
4275 void *cdbp, *qep;
4276 uint16_t *tptr;
4277 fcportdb_t *lp;
4278 int target, dmaresult;
4279
4280 XS_INITERR(xs);

--- 279 unchanged lines hidden (view full) ---

4560 }
4561 ISP_MEMCPY(cdbp, XS_CDBP(xs), cdblen);
4562
4563 *tptr = (XS_TIME(xs) + 999) / 1000;
4564 if (IS_24XX(isp) && *tptr > 0x1999) {
4565 *tptr = 0x1999;
4566 }
4567
4568 if (isp_allocate_xs(isp, xs, &handle)) {
4568 /* Whew. Thankfully the same for type 7 requests */
4569 reqp->req_handle = isp_allocate_handle(isp, xs, ISP_HANDLE_INITIATOR);
4570 if (reqp->req_handle == 0) {
4569 isp_prt(isp, ISP_LOG_WARN1, "out of xflist pointers");
4570 XS_SETERR(xs, HBA_BOTCH);
4571 return (CMD_EAGAIN);
4572 }
4571 isp_prt(isp, ISP_LOG_WARN1, "out of xflist pointers");
4572 XS_SETERR(xs, HBA_BOTCH);
4573 return (CMD_EAGAIN);
4574 }
4573 /* Whew. Thankfully the same for type 7 requests */
4574 reqp->req_handle = handle;
4575
4576 /*
4577 * Set up DMA and/or do any platform dependent swizzling of the request entry
4578 * so that the Qlogic F/W understands what is being asked of it.
4579 *
4580 * The callee is responsible for adding all requests at this point.
4581 */
4582 dmaresult = ISP_DMASETUP(isp, xs, reqp);
4583 if (dmaresult != CMD_QUEUED) {
4575
4576 /*
4577 * Set up DMA and/or do any platform dependent swizzling of the request entry
4578 * so that the Qlogic F/W understands what is being asked of it.
4579 *
4580 * The callee is responsible for adding all requests at this point.
4581 */
4582 dmaresult = ISP_DMASETUP(isp, xs, reqp);
4583 if (dmaresult != CMD_QUEUED) {
4584 isp_destroy_handle(isp, handle);
4584 isp_destroy_handle(isp, reqp->req_handle);
4585 /*
4586 * dmasetup sets actual error in packet, and
4587 * return what we were given to return.
4588 */
4589 return (dmaresult);
4590 }
4591 isp_xs_prt(isp, xs, ISP_LOGDEBUG0, "START cmd cdb[0]=0x%x datalen %ld", XS_CDBP(xs)[0], (long) XS_XFRLEN(xs));
4592 isp->isp_nactive++;

--- 712 unchanged lines hidden (view full) ---

5305 }
5306 if (sp->req_header.rqs_flags & RQSFLAG_BADORDER) {
5307 isp_print_bytes(isp, "invalid IOCB ordering", QENTRY_LEN, sp);
5308 last_etype = etype;
5309 continue;
5310 }
5311 }
5312
4585 /*
4586 * dmasetup sets actual error in packet, and
4587 * return what we were given to return.
4588 */
4589 return (dmaresult);
4590 }
4591 isp_xs_prt(isp, xs, ISP_LOGDEBUG0, "START cmd cdb[0]=0x%x datalen %ld", XS_CDBP(xs)[0], (long) XS_XFRLEN(xs));
4592 isp->isp_nactive++;

--- 712 unchanged lines hidden (view full) ---

5305 }
5306 if (sp->req_header.rqs_flags & RQSFLAG_BADORDER) {
5307 isp_print_bytes(isp, "invalid IOCB ordering", QENTRY_LEN, sp);
5308 last_etype = etype;
5309 continue;
5310 }
5311 }
5312
5313 if (!ISP_VALID_HANDLE(isp, sp->req_handle)) {
5314 isp_prt(isp, ISP_LOGERR, "bad request handle 0x%x (iocb type 0x%x)", sp->req_handle, etype);
5315 ISP_MEMZERO(hp, QENTRY_LEN); /* PERF */
5316 last_etype = etype;
5317 continue;
5318 }
5319 xs = isp_find_xs(isp, sp->req_handle);
5320 if (xs == NULL) {
5321 uint8_t ts = completion_status & 0xff;
5322 /*
5323 * Only whine if this isn't the expected fallout of
5324 * aborting the command or resetting the target.
5325 */
5326 if (etype != RQSTYPE_RESPONSE) {

--- 3191 unchanged lines hidden ---
5313 xs = isp_find_xs(isp, sp->req_handle);
5314 if (xs == NULL) {
5315 uint8_t ts = completion_status & 0xff;
5316 /*
5317 * Only whine if this isn't the expected fallout of
5318 * aborting the command or resetting the target.
5319 */
5320 if (etype != RQSTYPE_RESPONSE) {

--- 3191 unchanged lines hidden ---