]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/scsi/aic7xxx/aic7xxx_core.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6
[linux-2.6-omap-h63xx.git] / drivers / scsi / aic7xxx / aic7xxx_core.c
index 93e4e40944b6d42b1a36398500e1c03dfe529719..6d2ae641273c9fe56826043fb623761fe1063bb9 100644 (file)
@@ -1671,7 +1671,7 @@ ahc_devlimited_syncrate(struct ahc_softc *ahc,
                transinfo = &tinfo->goal;
        *ppr_options &= transinfo->ppr_options;
        if (transinfo->width == MSG_EXT_WDTR_BUS_8_BIT) {
-               maxsync = MAX(maxsync, AHC_SYNCRATE_ULTRA2);
+               maxsync = max(maxsync, (u_int)AHC_SYNCRATE_ULTRA2);
                *ppr_options &= ~MSG_EXT_PPR_DT_REQ;
        }
        if (transinfo->period == 0) {
@@ -1679,7 +1679,7 @@ ahc_devlimited_syncrate(struct ahc_softc *ahc,
                *ppr_options = 0;
                return (NULL);
        }
-       *period = MAX(*period, transinfo->period);
+       *period = max(*period, (u_int)transinfo->period);
        return (ahc_find_syncrate(ahc, period, ppr_options, maxsync));
 }
 
@@ -1701,7 +1701,16 @@ ahc_find_syncrate(struct ahc_softc *ahc, u_int *period,
        if ((*ppr_options & MSG_EXT_PPR_DT_REQ) == 0
         && maxsync < AHC_SYNCRATE_ULTRA2)
                maxsync = AHC_SYNCRATE_ULTRA2;
-       
+
+       /* Now set the maxsync based on the card capabilities
+        * DT is already done above */
+       if ((ahc->features & (AHC_DT | AHC_ULTRA2)) == 0
+           && maxsync < AHC_SYNCRATE_ULTRA)
+               maxsync = AHC_SYNCRATE_ULTRA;
+       if ((ahc->features & (AHC_DT | AHC_ULTRA2 | AHC_ULTRA)) == 0
+           && maxsync < AHC_SYNCRATE_FAST)
+               maxsync = AHC_SYNCRATE_FAST;
+
        for (syncrate = &ahc_syncrates[maxsync];
             syncrate->rate != NULL;
             syncrate++) {
@@ -1765,6 +1774,17 @@ ahc_find_period(struct ahc_softc *ahc, u_int scsirate, u_int maxsync)
        else
                scsirate &= SXFR;
 
+       /* now set maxsync based on card capabilities */
+       if ((ahc->features & AHC_DT) == 0 && maxsync < AHC_SYNCRATE_ULTRA2)
+               maxsync = AHC_SYNCRATE_ULTRA2;
+       if ((ahc->features & (AHC_DT | AHC_ULTRA2)) == 0
+           && maxsync < AHC_SYNCRATE_ULTRA)
+               maxsync = AHC_SYNCRATE_ULTRA;
+       if ((ahc->features & (AHC_DT | AHC_ULTRA2 | AHC_ULTRA)) == 0
+           && maxsync < AHC_SYNCRATE_FAST)
+               maxsync = AHC_SYNCRATE_FAST;
+
+
        syncrate = &ahc_syncrates[maxsync];
        while (syncrate->rate != NULL) {
 
@@ -1804,12 +1824,12 @@ ahc_validate_offset(struct ahc_softc *ahc,
                else
                        maxoffset = MAX_OFFSET_8BIT;
        }
-       *offset = MIN(*offset, maxoffset);
+       *offset = min(*offset, maxoffset);
        if (tinfo != NULL) {
                if (role == ROLE_TARGET)
-                       *offset = MIN(*offset, tinfo->user.offset);
+                       *offset = min(*offset, (u_int)tinfo->user.offset);
                else
-                       *offset = MIN(*offset, tinfo->goal.offset);
+                       *offset = min(*offset, (u_int)tinfo->goal.offset);
        }
 }
 
@@ -1835,9 +1855,9 @@ ahc_validate_width(struct ahc_softc *ahc, struct ahc_initiator_tinfo *tinfo,
        }
        if (tinfo != NULL) {
                if (role == ROLE_TARGET)
-                       *bus_width = MIN(tinfo->user.width, *bus_width);
+                       *bus_width = min((u_int)tinfo->user.width, *bus_width);
                else
-                       *bus_width = MIN(tinfo->goal.width, *bus_width);
+                       *bus_width = min((u_int)tinfo->goal.width, *bus_width);
        }
 }
 
@@ -1986,7 +2006,7 @@ ahc_set_syncrate(struct ahc_softc *ahc, struct ahc_devinfo *devinfo,
                tinfo->curr.ppr_options = ppr_options;
 
                ahc_send_async(ahc, devinfo->channel, devinfo->target,
-                              CAM_LUN_WILDCARD, AC_TRANSFER_NEG, NULL);
+                              CAM_LUN_WILDCARD, AC_TRANSFER_NEG);
                if (bootverbose) {
                        if (offset != 0) {
                                printf("%s: target %d synchronous at %sMHz%s, "
@@ -2056,7 +2076,7 @@ ahc_set_width(struct ahc_softc *ahc, struct ahc_devinfo *devinfo,
                tinfo->curr.width = width;
 
                ahc_send_async(ahc, devinfo->channel, devinfo->target,
-                              CAM_LUN_WILDCARD, AC_TRANSFER_NEG, NULL);
+                              CAM_LUN_WILDCARD, AC_TRANSFER_NEG);
                if (bootverbose) {
                        printf("%s: target %d using %dbit transfers\n",
                               ahc_name(ahc), devinfo->target,
@@ -2073,13 +2093,15 @@ ahc_set_width(struct ahc_softc *ahc, struct ahc_devinfo *devinfo,
 /*
  * Update the current state of tagged queuing for a given target.
  */
-void
-ahc_set_tags(struct ahc_softc *ahc, struct ahc_devinfo *devinfo,
-            ahc_queue_alg alg)
+static void
+ahc_set_tags(struct ahc_softc *ahc, struct scsi_cmnd *cmd,
+            struct ahc_devinfo *devinfo, ahc_queue_alg alg)
 {
-       ahc_platform_set_tags(ahc, devinfo, alg);
+       struct scsi_device *sdev = cmd->device;
+
+       ahc_platform_set_tags(ahc, sdev, devinfo, alg);
        ahc_send_async(ahc, devinfo->channel, devinfo->target,
-                      devinfo->lun, AC_TRANSFER_NEG, &alg);
+                      devinfo->lun, AC_TRANSFER_NEG);
 }
 
 /*
@@ -3489,7 +3511,7 @@ ahc_handle_msg_reject(struct ahc_softc *ahc, struct ahc_devinfo *devinfo)
                        printf("(%s:%c:%d:%d): refuses tagged commands.  "
                               "Performing non-tagged I/O\n", ahc_name(ahc),
                               devinfo->channel, devinfo->target, devinfo->lun);
-                       ahc_set_tags(ahc, devinfo, AHC_QUEUE_NONE);
+                       ahc_set_tags(ahc, scb->io_ctx, devinfo, AHC_QUEUE_NONE);
                        mask = ~0x23;
                } else {
                        printf("(%s:%c:%d:%d): refuses %s tagged commands.  "
@@ -3497,7 +3519,7 @@ ahc_handle_msg_reject(struct ahc_softc *ahc, struct ahc_devinfo *devinfo)
                               ahc_name(ahc), devinfo->channel, devinfo->target,
                               devinfo->lun, tag_type == MSG_ORDERED_TASK
                               ? "ordered" : "head of queue");
-                       ahc_set_tags(ahc, devinfo, AHC_QUEUE_BASIC);
+                       ahc_set_tags(ahc, scb->io_ctx, devinfo, AHC_QUEUE_BASIC);
                        mask = ~0x03;
                }
 
@@ -3763,7 +3785,7 @@ ahc_handle_devreset(struct ahc_softc *ahc, struct ahc_devinfo *devinfo,
        
        if (status != CAM_SEL_TIMEOUT)
                ahc_send_async(ahc, devinfo->channel, devinfo->target,
-                              CAM_LUN_WILDCARD, AC_SENT_BDR, NULL);
+                              CAM_LUN_WILDCARD, AC_SENT_BDR);
 
        if (message != NULL
         && (verbose_level <= bootverbose))
@@ -4406,7 +4428,7 @@ ahc_alloc_scbs(struct ahc_softc *ahc)
        physaddr = sg_map->sg_physaddr;
 
        newcount = (PAGE_SIZE / (AHC_NSEG * sizeof(struct ahc_dma_seg)));
-       newcount = MIN(newcount, (AHC_SCB_MAX_ALLOC - scb_data->numscbs));
+       newcount = min(newcount, (AHC_SCB_MAX_ALLOC - scb_data->numscbs));
        for (i = 0; i < newcount; i++) {
                struct scb_platform_data *pdata;
 #ifndef __linux__
@@ -5056,6 +5078,7 @@ ahc_pause_and_flushwork(struct ahc_softc *ahc)
        ahc->flags &= ~AHC_ALL_INTERRUPTS;
 }
 
+#ifdef CONFIG_PM
 int
 ahc_suspend(struct ahc_softc *ahc)
 {
@@ -5091,7 +5114,7 @@ ahc_resume(struct ahc_softc *ahc)
        ahc_restart(ahc);
        return (0);
 }
-
+#endif
 /************************** Busy Target Table *********************************/
 /*
  * Return the untagged transaction id for a given target/channel lun.
@@ -6018,7 +6041,7 @@ ahc_reset_channel(struct ahc_softc *ahc, char channel, int initiate_reset)
 #endif
        /* Notify the XPT that a bus reset occurred */
        ahc_send_async(ahc, devinfo.channel, CAM_TARGET_WILDCARD,
-                      CAM_LUN_WILDCARD, AC_BUS_RESET, NULL);
+                      CAM_LUN_WILDCARD, AC_BUS_RESET);
 
        /*
         * Revert to async/narrow transfers until we renegotiate.
@@ -6442,7 +6465,7 @@ ahc_download_instr(struct ahc_softc *ahc, u_int instrptr, uint8_t *dconsts)
                        if (skip_addr > i) {
                                int end_addr;
 
-                               end_addr = MIN(address, skip_addr);
+                               end_addr = min(address, skip_addr);
                                address_offset += end_addr - i;
                                i = skip_addr;
                        } else {