Deleted Added
full compact
dpt_scsi.c (36579) dpt_scsi.c (37618)
1/**
2 * Copyright (c) 1997 by Simon Shapiro
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

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

59 * 3 dpt_handle_timeouts potentially removes from the queue.
60 *
61 * There are three places where the the completed queue is accessed:
62 * 1. dpt_intr() inserts into the queue
63 * 2. dpt_sintr() removes from the queue
64 * 3. dpt_handle_timeouts potentially inserts into the queue
65 */
66
1/**
2 * Copyright (c) 1997 by Simon Shapiro
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

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

59 * 3 dpt_handle_timeouts potentially removes from the queue.
60 *
61 * There are three places where the the completed queue is accessed:
62 * 1. dpt_intr() inserts into the queue
63 * 2. dpt_sintr() removes from the queue
64 * 3. dpt_handle_timeouts potentially inserts into the queue
65 */
66
67#ident "$Id: dpt_scsi.c,v 1.5 1998/03/11 00:30:08 julian Exp $"
67#ident "$Id: dpt_scsi.c,v 1.6 1998/06/02 00:32:38 eivind Exp $"
68#define _DPT_C_
69
70#include "opt_dpt.h"
71#include <sys/param.h>
72#include <sys/systm.h>
73#include <sys/malloc.h>
74#include <sys/buf.h>
75#include <sys/kernel.h>

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

1861 * Examine the command flags and handle properly. XXXX We are not
1862 * handling external resets right now. Needs to be added. We do not
1863 * care about the SCSI_NOSLEEP flag as we do not sleep here. We have
1864 * to observe the SCSI_NOMASK flag, though.
1865 */
1866 if (xs->flags & SCSI_RESET) {
1867 printf("dpt%d: Unsupported option...\n"
1868 " I refuse to Reset b%dt%du%d...!\n",
68#define _DPT_C_
69
70#include "opt_dpt.h"
71#include <sys/param.h>
72#include <sys/systm.h>
73#include <sys/malloc.h>
74#include <sys/buf.h>
75#include <sys/kernel.h>

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

1861 * Examine the command flags and handle properly. XXXX We are not
1862 * handling external resets right now. Needs to be added. We do not
1863 * care about the SCSI_NOSLEEP flag as we do not sleep here. We have
1864 * to observe the SCSI_NOMASK flag, though.
1865 */
1866 if (xs->flags & SCSI_RESET) {
1867 printf("dpt%d: Unsupported option...\n"
1868 " I refuse to Reset b%dt%du%d...!\n",
1869 __FILE__, __LINE__, channel, target, lun);
1869 dpt->unit, channel, target, lun);
1870 xs->error = XS_DRIVER_STUFFUP;
1871 return (COMPLETE);
1872 }
1873 if (dpt->state & DPT_HA_SHUTDOWN_ACTIVE) {
1874 printf("dpt%d ERROR: Command \"%s\" recieved for b%dt%du%d\n"
1875 " but controller is shutdown; Aborting...\n",
1876 dpt->unit,
1877 scsi_cmd_name(xs->cmd->opcode),

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

2158 * It gets called at least once per I/O. Sometimes more
2159 */
2160
2161 if (dpt_min_segs == 0) {
2162 panic("DPT: Minphys without attach!\n");
2163 }
2164 if (bp->b_bcount > ((dpt_min_segs - 1) * PAGE_SIZE)) {
2165#ifdef DPT_DEBUG_MINPHYS
1870 xs->error = XS_DRIVER_STUFFUP;
1871 return (COMPLETE);
1872 }
1873 if (dpt->state & DPT_HA_SHUTDOWN_ACTIVE) {
1874 printf("dpt%d ERROR: Command \"%s\" recieved for b%dt%du%d\n"
1875 " but controller is shutdown; Aborting...\n",
1876 dpt->unit,
1877 scsi_cmd_name(xs->cmd->opcode),

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

2158 * It gets called at least once per I/O. Sometimes more
2159 */
2160
2161 if (dpt_min_segs == 0) {
2162 panic("DPT: Minphys without attach!\n");
2163 }
2164 if (bp->b_bcount > ((dpt_min_segs - 1) * PAGE_SIZE)) {
2165#ifdef DPT_DEBUG_MINPHYS
2166 printf("DPT: Block size of %x is larger than %x. Truncating\n",
2166 printf("DPT: Block size of %lx is larger than %x. Truncating\n",
2167 bp->b_bcount, ((dpt_min_segs - 1) * PAGE_SIZE));
2168#endif
2169 bp->b_bcount = ((dpt_min_segs - 1) * PAGE_SIZE);
2170 }
2171}
2172
2173/*
2174 * This function goes to the waiting queue, peels off a request, gives it to

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

2375 /*
2376 * Make SURE the next caller is legitimate. If they are not, we will
2377 * find 0x55555555 here. We see 0x000000 or 0xffffffff when the PCi
2378 * bus has DMA troubles (as when behing a PCI-PCI * bridge .
2379 */
2380 if ((dccb == NULL)
2381 || (dccb == (dpt_ccb_t *) ~ 0)
2382 || (dccb == (dpt_ccb_t *) 0x55555555)) {
2167 bp->b_bcount, ((dpt_min_segs - 1) * PAGE_SIZE));
2168#endif
2169 bp->b_bcount = ((dpt_min_segs - 1) * PAGE_SIZE);
2170 }
2171}
2172
2173/*
2174 * This function goes to the waiting queue, peels off a request, gives it to

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

2375 /*
2376 * Make SURE the next caller is legitimate. If they are not, we will
2377 * find 0x55555555 here. We see 0x000000 or 0xffffffff when the PCi
2378 * bus has DMA troubles (as when behing a PCI-PCI * bridge .
2379 */
2380 if ((dccb == NULL)
2381 || (dccb == (dpt_ccb_t *) ~ 0)
2382 || (dccb == (dpt_ccb_t *) 0x55555555)) {
2383 printf("dpt%d: BAD (%x) CCB in SP (AUX status = %s).\n",
2384 dpt->unit, dccb, i2bin((unsigned long) aux_status,
2385 sizeof(aux_status) * 8));
2383 printf("dpt%d: BAD (%p) CCB in SP (AUX status = %s).\n",
2384 dpt->unit, (void *)dccb,
2385 i2bin((unsigned long) aux_status,
2386 sizeof(aux_status) * 8));
2386#ifdef DPT_MEASURE_PERFORMANCE
2387 ++dpt->performance.aborted_interrupts;
2388#endif
2389 /* This CLEARS the interrupt! */
2390 status = dpt_inb(dpt, HA_RSTATUS);
2391 return;
2392 }
2393 for (tccb = TAILQ_FIRST(&dpt->submitted_ccbs);
2394 (tccb != NULL) && (tccb != dccb);
2395 tccb = TAILQ_NEXT(tccb, links));
2396 if (tccb == NULL) {
2387#ifdef DPT_MEASURE_PERFORMANCE
2388 ++dpt->performance.aborted_interrupts;
2389#endif
2390 /* This CLEARS the interrupt! */
2391 status = dpt_inb(dpt, HA_RSTATUS);
2392 return;
2393 }
2394 for (tccb = TAILQ_FIRST(&dpt->submitted_ccbs);
2395 (tccb != NULL) && (tccb != dccb);
2396 tccb = TAILQ_NEXT(tccb, links));
2397 if (tccb == NULL) {
2397 printf("dpt%d: %x is not in the SUBMITTED queue\n",
2398 dpt->unit, dccb);
2398 printf("dpt%d: %p is not in the SUBMITTED queue\n",
2399 dpt->unit, (void *)dccb);
2399
2400 for (tccb = TAILQ_FIRST(&dpt->completed_ccbs);
2401 (tccb != NULL) && (tccb != dccb);
2402 tccb = TAILQ_NEXT(tccb, links));
2403 if (tccb != NULL)
2400
2401 for (tccb = TAILQ_FIRST(&dpt->completed_ccbs);
2402 (tccb != NULL) && (tccb != dccb);
2403 tccb = TAILQ_NEXT(tccb, links));
2404 if (tccb != NULL)
2404 printf("dpt%d: %x is in the COMPLETED queue\n",
2405 dpt->unit, dccb);
2405 printf("dpt%d: %p is in the COMPLETED queue\n",
2406 dpt->unit, (void *)dccb);
2406
2407 for (tccb = TAILQ_FIRST(&dpt->waiting_ccbs);
2408 (tccb != NULL) && (tccb != dccb);
2409 tccb = TAILQ_NEXT(tccb, links));
2410 if (tccb != NULL)
2407
2408 for (tccb = TAILQ_FIRST(&dpt->waiting_ccbs);
2409 (tccb != NULL) && (tccb != dccb);
2410 tccb = TAILQ_NEXT(tccb, links));
2411 if (tccb != NULL)
2411 printf("dpt%d: %x is in the WAITING queue\n",
2412 dpt->unit, dccb);
2412 printf("dpt%d: %p is in the WAITING queue\n",
2413 dpt->unit, (void *)dccb);
2413
2414 for (tccb = TAILQ_FIRST(&dpt->free_ccbs);
2415 (tccb != NULL) && (tccb != dccb);
2416 tccb = TAILQ_NEXT(tccb, links));
2417 if (tccb != NULL)
2414
2415 for (tccb = TAILQ_FIRST(&dpt->free_ccbs);
2416 (tccb != NULL) && (tccb != dccb);
2417 tccb = TAILQ_NEXT(tccb, links));
2418 if (tccb != NULL)
2418 printf("dpt%d: %x is in the FREE queue\n",
2419 dpt->unit, dccb);
2419 printf("dpt%d: %p is in the FREE queue\n",
2420 dpt->unit, (void *)dccb);
2420
2421#ifdef DPT_MEASURE_PERFORMANCE
2422 ++dpt->performance.aborted_interrupts;
2423#endif
2424 /* This CLEARS the interrupt! */
2425 status = dpt_inb(dpt, HA_RSTATUS);
2426 return;
2427 }

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

2454 " All transactions should be "
2455 "resubmitted\n",
2456 dpt->unit);
2457
2458 printf("dpt%d: >>---->> This is incomplete, fix me"
2459 ".... <<----<<",
2460 dpt->unit);
2461 printf(" Incomplete Code; Re-queue the lost "
2421
2422#ifdef DPT_MEASURE_PERFORMANCE
2423 ++dpt->performance.aborted_interrupts;
2424#endif
2425 /* This CLEARS the interrupt! */
2426 status = dpt_inb(dpt, HA_RSTATUS);
2427 return;
2428 }

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

2455 " All transactions should be "
2456 "resubmitted\n",
2457 dpt->unit);
2458
2459 printf("dpt%d: >>---->> This is incomplete, fix me"
2460 ".... <<----<<",
2461 dpt->unit);
2462 printf(" Incomplete Code; Re-queue the lost "
2462 "commands\n",
2463 dpt->unit);
2463 "commands\n");
2464 Debugger("DPT Rebooted");
2465
2466#ifdef DPT_MEASURE_PERFORMANCE
2467 ++dpt->performance.aborted_interrupts;
2468#endif
2469 return;
2470 }
2471 }

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

2672static int
2673dpt_process_completion(dpt_softc_t * dpt,
2674 dpt_ccb_t * ccb)
2675{
2676 int ospl;
2677 struct scsi_xfer *xs;
2678
2679 if (ccb == NULL) {
2464 Debugger("DPT Rebooted");
2465
2466#ifdef DPT_MEASURE_PERFORMANCE
2467 ++dpt->performance.aborted_interrupts;
2468#endif
2469 return;
2470 }
2471 }

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

2672static int
2673dpt_process_completion(dpt_softc_t * dpt,
2674 dpt_ccb_t * ccb)
2675{
2676 int ospl;
2677 struct scsi_xfer *xs;
2678
2679 if (ccb == NULL) {
2680 panic("dpt%d: Improper argumet to process_completion (%p%p)\n",
2681 dpt->unit, ccb);
2680 panic("dpt%d: Improper argumet to process_completion (%p)\n",
2681 dpt->unit, (void *)ccb);
2682 } else {
2683 xs = ccb->xs;
2684 }
2685
2686#ifdef DPT_MEASURE_PERFORMANCE
2687 {
2688 u_int32_t size;
2689 struct scsi_rw_big *cmd;

--- 1005 unchanged lines hidden ---
2682 } else {
2683 xs = ccb->xs;
2684 }
2685
2686#ifdef DPT_MEASURE_PERFORMANCE
2687 {
2688 u_int32_t size;
2689 struct scsi_rw_big *cmd;

--- 1005 unchanged lines hidden ---