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 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);
4523 uint16_t isr, sema, info;
4524
4525 if (ISP_READ_ISR(isp, &isr, &sema, &info))
4526 isp_intr(isp, isr, sema, info);
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) {
4545 uint16_t isr, sema, info;
4546 if (ISP_READ_ISR(isp, &isr, &sema, &info) != 0)
4547 isp_intr(isp, isr, sema, info);
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) {
6276 uint16_t isr, sema, info;
6277 if (isp->isp_osinfo.mboxcmd_done) {
6278 break;
6279 }
6280 if (ISP_READ_ISR(isp, &isr, &sema, &info)) {
6281 isp_intr(isp, isr, sema, info);
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;
6349 uint16_t isr, sema, info;
6350
6351 ISP_LOCK(isp);
6352 isp->isp_intcnt++;
6353 if (ISP_READ_ISR(isp, &isr, &sema, &info))
6354 isp_intr(isp, isr, sema, info);
6355 else
6356 isp->isp_intbogus++;
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 ---