Deleted Added
sdiff udiff text old ( 290779 ) new ( 290785 )
full compact
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 $");
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;
4525
4526 if (ISP_READ_ISR(isp, &isr, &sema, &mbox)) {
4527 isp_intr(isp, isr, sema, mbox);
4528 }
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) {
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 }
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) {
6280 uint32_t isr;
6281 uint16_t sema, mbox;
6282 if (isp->isp_osinfo.mboxcmd_done) {
6283 break;
6284 }
6285 if (ISP_READ_ISR(isp, &isr, &sema, &mbox)) {
6286 isp_intr(isp, isr, sema, mbox);
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;
6354 uint32_t isr;
6355 uint16_t sema, mbox;
6356
6357 ISP_LOCK(isp);
6358 isp->isp_intcnt++;
6359 if (ISP_READ_ISR(isp, &isr, &sema, &mbox) == 0) {
6360 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 ---