Deleted Added
full compact
isp_freebsd.c (290779) isp_freebsd.c (290785)
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 * 1. Redistributions of source code must retain the above copyright

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

23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27/*
28 * Platform (FreeBSD) dependent common attachment code for Qlogic adapters.
29 */
30#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 * 1. Redistributions of source code must retain the above copyright

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

23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27/*
28 * Platform (FreeBSD) dependent common attachment code for Qlogic adapters.
29 */
30#include <sys/cdefs.h>
31__FBSDID("$FreeBSD: stable/10/sys/dev/isp/isp_freebsd.c 290779 2015-11-13 19:32:17Z mav $");
31__FBSDID("$FreeBSD: stable/10/sys/dev/isp/isp_freebsd.c 290785 2015-11-13 19:42:55Z mav $");
32
33#include <dev/isp/isp_freebsd.h>
34#include <sys/unistd.h>
35#include <sys/kthread.h>
36#include <sys/conf.h>
37#include <sys/module.h>
38#include <sys/ioccom.h>
39#include <dev/isp/isp_ioctl.h>

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

4515 break;
4516 }
4517}
4518
4519static void
4520isp_poll(struct cam_sim *sim)
4521{
4522 ispsoftc_t *isp = cam_sim_softc(sim);
32
33#include <dev/isp/isp_freebsd.h>
34#include <sys/unistd.h>
35#include <sys/kthread.h>
36#include <sys/conf.h>
37#include <sys/module.h>
38#include <sys/ioccom.h>
39#include <dev/isp/isp_ioctl.h>

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

4515 break;
4516 }
4517}
4518
4519static void
4520isp_poll(struct cam_sim *sim)
4521{
4522 ispsoftc_t *isp = cam_sim_softc(sim);
4523 uint32_t isr;
4524 uint16_t sema, mbox;
4523 uint16_t isr, sema, info;
4525
4524
4526 if (ISP_READ_ISR(isp, &isr, &sema, &mbox)) {
4527 isp_intr(isp, isr, sema, mbox);
4528 }
4525 if (ISP_READ_ISR(isp, &isr, &sema, &info))
4526 isp_intr(isp, isr, sema, info);
4529}
4530
4531
4532static void
4533isp_watchdog(void *arg)
4534{
4535 struct ccb_scsiio *xs = arg;
4536 ispsoftc_t *isp;
4537 uint32_t ohandle = ISP_HANDLE_FREE, handle;
4538
4539 isp = XS_ISP(xs);
4540
4541 handle = isp_find_handle(isp, xs);
4542
4543 /*
4544 * Hand crank the interrupt code just to be sure the command isn't stuck somewhere.
4545 */
4546 if (handle != ISP_HANDLE_FREE) {
4527}
4528
4529
4530static void
4531isp_watchdog(void *arg)
4532{
4533 struct ccb_scsiio *xs = arg;
4534 ispsoftc_t *isp;
4535 uint32_t ohandle = ISP_HANDLE_FREE, handle;
4536
4537 isp = XS_ISP(xs);
4538
4539 handle = isp_find_handle(isp, xs);
4540
4541 /*
4542 * Hand crank the interrupt code just to be sure the command isn't stuck somewhere.
4543 */
4544 if (handle != ISP_HANDLE_FREE) {
4547 uint32_t isr;
4548 uint16_t sema, mbox;
4549 if (ISP_READ_ISR(isp, &isr, &sema, &mbox) != 0) {
4550 isp_intr(isp, isr, sema, mbox);
4551 }
4545 uint16_t isr, sema, info;
4546 if (ISP_READ_ISR(isp, &isr, &sema, &info) != 0)
4547 isp_intr(isp, isr, sema, info);
4552 ohandle = handle;
4553 handle = isp_find_handle(isp, xs);
4554 }
4555 if (handle != ISP_HANDLE_FREE) {
4556 /*
4557 * Try and make sure the command is really dead before
4558 * we release the handle (and DMA resources) for reuse.
4559 *

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

6272 break;
6273 }
6274 }
6275 isp->isp_osinfo.mbox_sleep_ok = 1;
6276 isp->isp_osinfo.mbox_sleeping = 0;
6277 } else {
6278 for (olim = 0; olim < max; olim++) {
6279 for (ilim = 0; ilim < usecs; ilim += 100) {
4548 ohandle = handle;
4549 handle = isp_find_handle(isp, xs);
4550 }
4551 if (handle != ISP_HANDLE_FREE) {
4552 /*
4553 * Try and make sure the command is really dead before
4554 * we release the handle (and DMA resources) for reuse.
4555 *

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

6268 break;
6269 }
6270 }
6271 isp->isp_osinfo.mbox_sleep_ok = 1;
6272 isp->isp_osinfo.mbox_sleeping = 0;
6273 } else {
6274 for (olim = 0; olim < max; olim++) {
6275 for (ilim = 0; ilim < usecs; ilim += 100) {
6280 uint32_t isr;
6281 uint16_t sema, mbox;
6276 uint16_t isr, sema, info;
6282 if (isp->isp_osinfo.mboxcmd_done) {
6283 break;
6284 }
6277 if (isp->isp_osinfo.mboxcmd_done) {
6278 break;
6279 }
6285 if (ISP_READ_ISR(isp, &isr, &sema, &mbox)) {
6286 isp_intr(isp, isr, sema, mbox);
6280 if (ISP_READ_ISR(isp, &isr, &sema, &info)) {
6281 isp_intr(isp, isr, sema, info);
6287 if (isp->isp_osinfo.mboxcmd_done) {
6288 break;
6289 }
6290 }
6291 ISP_DELAY(100);
6292 }
6293 if (isp->isp_osinfo.mboxcmd_done) {
6294 break;

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

6346 }
6347 return (hz);
6348}
6349
6350void
6351isp_platform_intr(void *arg)
6352{
6353 ispsoftc_t *isp = arg;
6282 if (isp->isp_osinfo.mboxcmd_done) {
6283 break;
6284 }
6285 }
6286 ISP_DELAY(100);
6287 }
6288 if (isp->isp_osinfo.mboxcmd_done) {
6289 break;

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

6341 }
6342 return (hz);
6343}
6344
6345void
6346isp_platform_intr(void *arg)
6347{
6348 ispsoftc_t *isp = arg;
6354 uint32_t isr;
6355 uint16_t sema, mbox;
6349 uint16_t isr, sema, info;
6356
6357 ISP_LOCK(isp);
6358 isp->isp_intcnt++;
6350
6351 ISP_LOCK(isp);
6352 isp->isp_intcnt++;
6359 if (ISP_READ_ISR(isp, &isr, &sema, &mbox) == 0) {
6353 if (ISP_READ_ISR(isp, &isr, &sema, &info))
6354 isp_intr(isp, isr, sema, info);
6355 else
6360 isp->isp_intbogus++;
6356 isp->isp_intbogus++;
6361 } else {
6362 isp_intr(isp, isr, sema, mbox);
6363 }
6364 ISP_UNLOCK(isp);
6365}
6366
6367void
6368isp_common_dmateardown(ispsoftc_t *isp, struct ccb_scsiio *csio, uint32_t hdl)
6369{
6370 if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) {
6371 bus_dmamap_sync(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, BUS_DMASYNC_POSTREAD);

--- 111 unchanged lines hidden ---
6357 ISP_UNLOCK(isp);
6358}
6359
6360void
6361isp_common_dmateardown(ispsoftc_t *isp, struct ccb_scsiio *csio, uint32_t hdl)
6362{
6363 if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) {
6364 bus_dmamap_sync(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, BUS_DMASYNC_POSTREAD);

--- 111 unchanged lines hidden ---