From b1abb4d67f2a706f52a95064001e0c55d9be2d26 Mon Sep 17 00:00:00 2001 From: James Bottomley Date: Tue, 24 May 2005 17:15:43 -0500 Subject: [SCSI] aic7xxx: remove separate target and device allocations Since the aic driver is now taught to speak in terms of the generic linux devices, we can now also dispense with the transport class get routines (since we update the parameters when the driver sees they change) and also plumb it into the spi transport transfer agreement reporting infrastructure. Signed-off-by: James Bottomley --- drivers/scsi/aic7xxx/aic7xxx_osm.c | 575 +++++++++++++----------------------- drivers/scsi/aic7xxx/aic7xxx_osm.h | 15 +- drivers/scsi/aic7xxx/aic7xxx_proc.c | 21 +- 3 files changed, 218 insertions(+), 393 deletions(-) (limited to 'drivers/scsi/aic7xxx') diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c index c13e5632001..57d22c4f008 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.c +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c @@ -122,8 +122,6 @@ #include "aic7xxx_osm.h" #include "aic7xxx_inline.h" #include -#include -#include static struct scsi_transport_template *ahc_linux_transport_template = NULL; @@ -423,7 +421,7 @@ MODULE_PARM_DESC(aic7xxx, ); static void ahc_linux_handle_scsi_status(struct ahc_softc *, - struct ahc_linux_device *, + struct scsi_device *, struct scb *); static void ahc_linux_queue_cmd_complete(struct ahc_softc *ahc, struct scsi_cmnd *cmd); @@ -434,17 +432,7 @@ static int ahc_linux_queue_recovery_cmd(struct scsi_cmnd *cmd, scb_flag flag); static void ahc_linux_initialize_scsi_bus(struct ahc_softc *ahc); static u_int ahc_linux_user_tagdepth(struct ahc_softc *ahc, struct ahc_devinfo *devinfo); -static void ahc_linux_device_queue_depth(struct ahc_softc *ahc, - struct ahc_linux_device *dev); -static struct ahc_linux_target* ahc_linux_alloc_target(struct ahc_softc*, - u_int, u_int); -static void ahc_linux_free_target(struct ahc_softc*, - struct ahc_linux_target*); -static struct ahc_linux_device* ahc_linux_alloc_device(struct ahc_softc*, - struct ahc_linux_target*, - u_int); -static void ahc_linux_free_device(struct ahc_softc*, - struct ahc_linux_device*); +static void ahc_linux_device_queue_depth(struct scsi_device *); static int ahc_linux_run_command(struct ahc_softc*, struct ahc_linux_device *, struct scsi_cmnd *); @@ -454,32 +442,12 @@ static int aic7xxx_setup(char *s); static int ahc_linux_next_unit(void); /********************************* Inlines ************************************/ -static __inline struct ahc_linux_device* - ahc_linux_get_device(struct ahc_softc *ahc, u_int channel, - u_int target, u_int lun); static __inline void ahc_linux_unmap_scb(struct ahc_softc*, struct scb*); static __inline int ahc_linux_map_seg(struct ahc_softc *ahc, struct scb *scb, struct ahc_dma_seg *sg, dma_addr_t addr, bus_size_t len); -static __inline struct ahc_linux_device* -ahc_linux_get_device(struct ahc_softc *ahc, u_int channel, u_int target, - u_int lun) -{ - struct ahc_linux_target *targ; - struct ahc_linux_device *dev; - u_int target_offset; - - target_offset = target; - if (channel != 0) - target_offset += 8; - targ = ahc->platform_data->targets[target_offset]; - BUG_ON(targ == NULL); - dev = targ->devices[lun]; - return dev; -} - static __inline void ahc_linux_unmap_scb(struct ahc_softc *ahc, struct scb *scb) { @@ -611,7 +579,7 @@ static int ahc_linux_queue(struct scsi_cmnd * cmd, void (*scsi_done) (struct scsi_cmnd *)) { struct ahc_softc *ahc; - struct ahc_linux_device *dev; + struct ahc_linux_device *dev = scsi_transport_device_data(cmd->device); ahc = *(struct ahc_softc **)cmd->device->host->hostdata; @@ -629,132 +597,162 @@ ahc_linux_queue(struct scsi_cmnd * cmd, void (*scsi_done) (struct scsi_cmnd *)) if (ahc->platform_data->qfrozen != 0) return SCSI_MLQUEUE_HOST_BUSY; - dev = ahc_linux_get_device(ahc, cmd->device->channel, cmd->device->id, - cmd->device->lun); - BUG_ON(dev == NULL); - cmd->result = CAM_REQ_INPROG << 16; return ahc_linux_run_command(ahc, dev, cmd); } -static int -ahc_linux_slave_alloc(struct scsi_device *device) +static inline struct scsi_target ** +ahc_linux_target_in_softc(struct scsi_target *starget) { - struct ahc_softc *ahc; - struct ahc_linux_target *targ; - struct scsi_target *starget = device->sdev_target; - struct ahc_linux_device *dev; + struct ahc_softc *ahc = + *((struct ahc_softc **)dev_to_shost(&starget->dev)->hostdata); unsigned int target_offset; + + target_offset = starget->id; + if (starget->channel != 0) + target_offset += 8; + + return &ahc->platform_data->starget[target_offset]; +} + +static int +ahc_linux_target_alloc(struct scsi_target *starget) +{ + struct ahc_softc *ahc = + *((struct ahc_softc **)dev_to_shost(&starget->dev)->hostdata); + struct seeprom_config *sc = ahc->seep_config; unsigned long flags; - int retval = -ENOMEM; + struct scsi_target **ahc_targp = ahc_linux_target_in_softc(starget); + struct ahc_linux_target *targ = scsi_transport_target_data(starget); + unsigned short scsirate; + struct ahc_devinfo devinfo; + struct ahc_initiator_tinfo *tinfo; + struct ahc_tmode_tstate *tstate; + char channel = starget->channel + 'A'; + unsigned int our_id = ahc->our_id; + unsigned int target_offset; target_offset = starget->id; if (starget->channel != 0) target_offset += 8; + + if (starget->channel) + our_id = ahc->our_id_b; - ahc = *((struct ahc_softc **)device->host->hostdata); - if (bootverbose) - printf("%s: Slave Alloc %d\n", ahc_name(ahc), device->id); ahc_lock(ahc, &flags); - targ = ahc->platform_data->targets[target_offset]; - if (targ == NULL) { - struct seeprom_config *sc; - - targ = ahc_linux_alloc_target(ahc, starget->channel, - starget->id); - sc = ahc->seep_config; - if (targ == NULL) - goto out; - if (sc) { - unsigned short scsirate; - struct ahc_devinfo devinfo; - struct ahc_initiator_tinfo *tinfo; - struct ahc_tmode_tstate *tstate; - char channel = starget->channel + 'A'; - unsigned int our_id = ahc->our_id; + BUG_ON(*ahc_targp != NULL); - if (starget->channel) - our_id = ahc->our_id_b; + *ahc_targp = starget; + memset(targ, 0, sizeof(*targ)); - if ((ahc->features & AHC_ULTRA2) != 0) { - scsirate = sc->device_flags[target_offset] & CFXFER; - } else { - scsirate = (sc->device_flags[target_offset] & CFXFER) << 4; - if (sc->device_flags[target_offset] & CFSYNCH) - scsirate |= SOFS; - } - if (sc->device_flags[target_offset] & CFWIDEB) { - scsirate |= WIDEXFER; - spi_max_width(starget) = 1; - } else - spi_max_width(starget) = 0; - spi_min_period(starget) = - ahc_find_period(ahc, scsirate, AHC_SYNCRATE_DT); - tinfo = ahc_fetch_transinfo(ahc, channel, ahc->our_id, - targ->target, &tstate); - ahc_compile_devinfo(&devinfo, our_id, targ->target, - CAM_LUN_WILDCARD, channel, - ROLE_INITIATOR); - ahc_set_syncrate(ahc, &devinfo, NULL, 0, 0, 0, - AHC_TRANS_GOAL, /*paused*/FALSE); - ahc_set_width(ahc, &devinfo, MSG_EXT_WDTR_BUS_8_BIT, - AHC_TRANS_GOAL, /*paused*/FALSE); + if (sc) { + if ((ahc->features & AHC_ULTRA2) != 0) { + scsirate = sc->device_flags[target_offset] & CFXFER; + } else { + scsirate = (sc->device_flags[target_offset] & CFXFER) << 4; + if (sc->device_flags[target_offset] & CFSYNCH) + scsirate |= SOFS; } - - } - dev = targ->devices[device->lun]; - if (dev == NULL) { - dev = ahc_linux_alloc_device(ahc, targ, device->lun); - if (dev == NULL) - goto out; + if (sc->device_flags[target_offset] & CFWIDEB) { + scsirate |= WIDEXFER; + spi_max_width(starget) = 1; + } else + spi_max_width(starget) = 0; + spi_min_period(starget) = + ahc_find_period(ahc, scsirate, AHC_SYNCRATE_DT); + tinfo = ahc_fetch_transinfo(ahc, channel, ahc->our_id, + starget->id, &tstate); } - retval = 0; - - out: + ahc_compile_devinfo(&devinfo, our_id, starget->id, + CAM_LUN_WILDCARD, channel, + ROLE_INITIATOR); + ahc_set_syncrate(ahc, &devinfo, NULL, 0, 0, 0, + AHC_TRANS_GOAL, /*paused*/FALSE); + ahc_set_width(ahc, &devinfo, MSG_EXT_WDTR_BUS_8_BIT, + AHC_TRANS_GOAL, /*paused*/FALSE); ahc_unlock(ahc, &flags); - return retval; + + return 0; +} + +static void +ahc_linux_target_destroy(struct scsi_target *starget) +{ + struct scsi_target **ahc_targp = ahc_linux_target_in_softc(starget); + + *ahc_targp = NULL; +} + +static int +ahc_linux_slave_alloc(struct scsi_device *sdev) +{ + struct ahc_softc *ahc = + *((struct ahc_softc **)sdev->host->hostdata); + struct scsi_target *starget = sdev->sdev_target; + struct ahc_linux_target *targ = scsi_transport_target_data(starget); + struct ahc_linux_device *dev; + + if (bootverbose) + printf("%s: Slave Alloc %d\n", ahc_name(ahc), sdev->id); + + BUG_ON(targ->sdev[sdev->lun] != NULL); + + dev = scsi_transport_device_data(sdev); + memset(dev, 0, sizeof(*dev)); + + /* + * We start out life using untagged + * transactions of which we allow one. + */ + dev->openings = 1; + + /* + * Set maxtags to 0. This will be changed if we + * later determine that we are dealing with + * a tagged queuing capable device. + */ + dev->maxtags = 0; + + targ->sdev[sdev->lun] = sdev; + + return 0; } static int -ahc_linux_slave_configure(struct scsi_device *device) +ahc_linux_slave_configure(struct scsi_device *sdev) { struct ahc_softc *ahc; - struct ahc_linux_device *dev; - ahc = *((struct ahc_softc **)device->host->hostdata); + ahc = *((struct ahc_softc **)sdev->host->hostdata); if (bootverbose) - printf("%s: Slave Configure %d\n", ahc_name(ahc), device->id); + printf("%s: Slave Configure %d\n", ahc_name(ahc), sdev->id); - dev = ahc_linux_get_device(ahc, device->channel, device->id, - device->lun); - dev->scsi_device = device; - ahc_linux_device_queue_depth(ahc, dev); + ahc_linux_device_queue_depth(sdev); /* Initial Domain Validation */ - if (!spi_initial_dv(device->sdev_target)) - spi_dv_device(device); + if (!spi_initial_dv(sdev->sdev_target)) + spi_dv_device(sdev); return 0; } static void -ahc_linux_slave_destroy(struct scsi_device *device) +ahc_linux_slave_destroy(struct scsi_device *sdev) { struct ahc_softc *ahc; - struct ahc_linux_device *dev; + struct ahc_linux_device *dev = scsi_transport_device_data(sdev); + struct ahc_linux_target *targ = scsi_transport_target_data(sdev->sdev_target); - ahc = *((struct ahc_softc **)device->host->hostdata); + ahc = *((struct ahc_softc **)sdev->host->hostdata); if (bootverbose) - printf("%s: Slave Destroy %d\n", ahc_name(ahc), device->id); - dev = ahc_linux_get_device(ahc, device->channel, - device->id, device->lun); + printf("%s: Slave Destroy %d\n", ahc_name(ahc), sdev->id); BUG_ON(dev->active); - ahc_linux_free_device(ahc, dev); + targ->sdev[sdev->lun] = NULL; } #if defined(__i386__) @@ -874,6 +872,8 @@ struct scsi_host_template aic7xxx_driver_template = { .slave_alloc = ahc_linux_slave_alloc, .slave_configure = ahc_linux_slave_configure, .slave_destroy = ahc_linux_slave_destroy, + .target_alloc = ahc_linux_target_alloc, + .target_destroy = ahc_linux_target_destroy, }; /**************************** Tasklet Handler *********************************/ @@ -1335,8 +1335,7 @@ ahc_platform_alloc(struct ahc_softc *ahc, void *platform_arg) void ahc_platform_free(struct ahc_softc *ahc) { - struct ahc_linux_target *targ; - struct ahc_linux_device *dev; + struct scsi_target *starget; int i, j; if (ahc->platform_data != NULL) { @@ -1347,22 +1346,17 @@ ahc_platform_free(struct ahc_softc *ahc) /* destroy all of the device and target objects */ for (i = 0; i < AHC_NUM_TARGETS; i++) { - targ = ahc->platform_data->targets[i]; - if (targ != NULL) { - /* Keep target around through the loop. */ - targ->refcount++; + starget = ahc->platform_data->starget[i]; + if (starget != NULL) { for (j = 0; j < AHC_NUM_LUNS; j++) { + struct ahc_linux_target *targ = + scsi_transport_target_data(starget); - if (targ->devices[j] == NULL) + if (targ->sdev[j] == NULL) continue; - dev = targ->devices[j]; - ahc_linux_free_device(ahc, dev); + targ->sdev[j] = NULL; } - /* - * Forcibly free the target now that - * all devices are gone. - */ - ahc_linux_free_target(ahc, targ); + ahc->platform_data->starget[i] = NULL; } } @@ -1395,15 +1389,25 @@ void ahc_platform_set_tags(struct ahc_softc *ahc, struct ahc_devinfo *devinfo, ahc_queue_alg alg) { + struct scsi_target *starget; + struct ahc_linux_target *targ; struct ahc_linux_device *dev; + struct scsi_device *sdev; + u_int target_offset; int was_queuing; int now_queuing; - dev = ahc_linux_get_device(ahc, devinfo->channel - 'A', - devinfo->target, - devinfo->lun); - if (dev == NULL) + target_offset = devinfo->target; + if (devinfo->channel != 'A') + target_offset += 8; + starget = ahc->platform_data->starget[target_offset]; + targ = scsi_transport_target_data(starget); + BUG_ON(targ == NULL); + sdev = targ->sdev[devinfo->lun]; + if (sdev == NULL) return; + dev = scsi_transport_device_data(sdev); + was_queuing = dev->flags & (AHC_DEV_Q_BASIC|AHC_DEV_Q_TAGGED); switch (alg) { default: @@ -1454,30 +1458,28 @@ ahc_platform_set_tags(struct ahc_softc *ahc, struct ahc_devinfo *devinfo, dev->maxtags = 0; dev->openings = 1 - dev->active; } - if (dev->scsi_device != NULL) { - switch ((dev->flags & (AHC_DEV_Q_BASIC|AHC_DEV_Q_TAGGED))) { - case AHC_DEV_Q_BASIC: - scsi_adjust_queue_depth(dev->scsi_device, - MSG_SIMPLE_TASK, - dev->openings + dev->active); - break; - case AHC_DEV_Q_TAGGED: - scsi_adjust_queue_depth(dev->scsi_device, - MSG_ORDERED_TASK, - dev->openings + dev->active); - break; - default: - /* - * We allow the OS to queue 2 untagged transactions to - * us at any time even though we can only execute them - * serially on the controller/device. This should - * remove some latency. - */ - scsi_adjust_queue_depth(dev->scsi_device, - /*NON-TAGGED*/0, - /*queue depth*/2); - break; - } + switch ((dev->flags & (AHC_DEV_Q_BASIC|AHC_DEV_Q_TAGGED))) { + case AHC_DEV_Q_BASIC: + scsi_adjust_queue_depth(sdev, + MSG_SIMPLE_TASK, + dev->openings + dev->active); + break; + case AHC_DEV_Q_TAGGED: + scsi_adjust_queue_depth(sdev, + MSG_ORDERED_TASK, + dev->openings + dev->active); + break; + default: + /* + * We allow the OS to queue 2 untagged transactions to + * us at any time even though we can only execute them + * serially on the controller/device. This should + * remove some latency. + */ + scsi_adjust_queue_depth(sdev, + /*NON-TAGGED*/0, + /*queue depth*/2); + break; } } @@ -1523,22 +1525,20 @@ ahc_linux_user_tagdepth(struct ahc_softc *ahc, struct ahc_devinfo *devinfo) * Determines the queue depth for a given device. */ static void -ahc_linux_device_queue_depth(struct ahc_softc *ahc, - struct ahc_linux_device *dev) +ahc_linux_device_queue_depth(struct scsi_device *sdev) { struct ahc_devinfo devinfo; u_int tags; + struct ahc_softc *ahc = *((struct ahc_softc **)sdev->host->hostdata); ahc_compile_devinfo(&devinfo, - dev->target->channel == 0 + sdev->sdev_target->channel == 0 ? ahc->our_id : ahc->our_id_b, - dev->target->target, dev->lun, - dev->target->channel == 0 ? 'A' : 'B', + sdev->sdev_target->id, sdev->lun, + sdev->sdev_target->channel == 0 ? 'A' : 'B', ROLE_INITIATOR); tags = ahc_linux_user_tagdepth(ahc, &devinfo); - if (tags != 0 - && dev->scsi_device != NULL - && dev->scsi_device->tagged_supported != 0) { + if (tags != 0 && sdev->tagged_supported != 0) { ahc_set_tags(ahc, &devinfo, AHC_QUEUE_TAGGED); ahc_print_devinfo(ahc, &devinfo); @@ -1767,106 +1767,6 @@ ahc_platform_flushwork(struct ahc_softc *ahc) } -static struct ahc_linux_target* -ahc_linux_alloc_target(struct ahc_softc *ahc, u_int channel, u_int target) -{ - struct ahc_linux_target *targ; - u_int target_offset; - - target_offset = target; - if (channel != 0) - target_offset += 8; - - targ = malloc(sizeof(*targ), M_DEVBUG, M_NOWAIT); - if (targ == NULL) - return (NULL); - memset(targ, 0, sizeof(*targ)); - targ->channel = channel; - targ->target = target; - targ->ahc = ahc; - ahc->platform_data->targets[target_offset] = targ; - return (targ); -} - -static void -ahc_linux_free_target(struct ahc_softc *ahc, struct ahc_linux_target *targ) -{ - struct ahc_devinfo devinfo; - struct ahc_initiator_tinfo *tinfo; - struct ahc_tmode_tstate *tstate; - u_int our_id; - u_int target_offset; - char channel; - - /* - * Force a negotiation to async/narrow on any - * future command to this device unless a bus - * reset occurs between now and that command. - */ - channel = 'A' + targ->channel; - our_id = ahc->our_id; - target_offset = targ->target; - if (targ->channel != 0) { - target_offset += 8; - our_id = ahc->our_id_b; - } - tinfo = ahc_fetch_transinfo(ahc, channel, our_id, - targ->target, &tstate); - ahc_compile_devinfo(&devinfo, our_id, targ->target, CAM_LUN_WILDCARD, - channel, ROLE_INITIATOR); - ahc_set_syncrate(ahc, &devinfo, NULL, 0, 0, 0, - AHC_TRANS_GOAL, /*paused*/FALSE); - ahc_set_width(ahc, &devinfo, MSG_EXT_WDTR_BUS_8_BIT, - AHC_TRANS_GOAL, /*paused*/FALSE); - ahc_update_neg_request(ahc, &devinfo, tstate, tinfo, AHC_NEG_ALWAYS); - ahc->platform_data->targets[target_offset] = NULL; - free(targ, M_DEVBUF); -} - -static struct ahc_linux_device* -ahc_linux_alloc_device(struct ahc_softc *ahc, - struct ahc_linux_target *targ, u_int lun) -{ - struct ahc_linux_device *dev; - - dev = malloc(sizeof(*dev), M_DEVBUG, M_NOWAIT); - if (dev == NULL) - return (NULL); - memset(dev, 0, sizeof(*dev)); - dev->lun = lun; - dev->target = targ; - - /* - * We start out life using untagged - * transactions of which we allow one. - */ - dev->openings = 1; - - /* - * Set maxtags to 0. This will be changed if we - * later determine that we are dealing with - * a tagged queuing capable device. - */ - dev->maxtags = 0; - - targ->refcount++; - targ->devices[lun] = dev; - return (dev); -} - -static void -ahc_linux_free_device(struct ahc_softc *ahc, struct ahc_linux_device *dev) -{ - struct ahc_linux_target *targ; - - targ = dev->target; - targ->devices[dev->lun] = NULL; - free(dev, M_DEVBUF); - targ->refcount--; - if (targ->refcount == 0) - ahc_linux_free_target(ahc, targ); -} - void ahc_send_async(struct ahc_softc *ahc, char channel, u_int target, u_int lun, ac_code code, void *arg) @@ -1875,11 +1775,15 @@ ahc_send_async(struct ahc_softc *ahc, char channel, case AC_TRANSFER_NEG: { char buf[80]; + struct scsi_target *starget; struct ahc_linux_target *targ; struct info_str info; struct ahc_initiator_tinfo *tinfo; struct ahc_tmode_tstate *tstate; int target_offset; + unsigned int target_ppr_options; + + BUG_ON(target == CAM_TARGET_WILDCARD); info.buffer = buf; info.length = sizeof(buf); @@ -1908,32 +1812,30 @@ ahc_send_async(struct ahc_softc *ahc, char channel, target_offset = target; if (channel == 'B') target_offset += 8; - targ = ahc->platform_data->targets[target_offset]; + starget = ahc->platform_data->starget[target_offset]; + targ = scsi_transport_target_data(starget); if (targ == NULL) break; - if (tinfo->curr.period == targ->last_tinfo.period - && tinfo->curr.width == targ->last_tinfo.width - && tinfo->curr.offset == targ->last_tinfo.offset - && tinfo->curr.ppr_options == targ->last_tinfo.ppr_options) + + target_ppr_options = + (spi_dt(starget) ? MSG_EXT_PPR_DT_REQ : 0) + + (spi_qas(starget) ? MSG_EXT_PPR_QAS_REQ : 0) + + (spi_iu(starget) ? MSG_EXT_PPR_IU_REQ : 0); + + if (tinfo->curr.period == spi_period(starget) + && tinfo->curr.width == spi_width(starget) + && tinfo->curr.offset == spi_offset(starget) + && tinfo->curr.ppr_options == target_ppr_options) if (bootverbose == 0) break; - targ->last_tinfo.period = tinfo->curr.period; - targ->last_tinfo.width = tinfo->curr.width; - targ->last_tinfo.offset = tinfo->curr.offset; - targ->last_tinfo.ppr_options = tinfo->curr.ppr_options; - - printf("(%s:%c:", ahc_name(ahc), channel); - if (target == CAM_TARGET_WILDCARD) - printf("*): "); - else - printf("%d): ", target); - ahc_format_transinfo(&info, &tinfo->curr); - if (info.pos < info.length) - *info.buffer = '\0'; - else - buf[info.length - 1] = '\0'; - printf("%s", buf); + spi_period(starget) = tinfo->curr.period; + spi_width(starget) = tinfo->curr.width; + spi_offset(starget) = tinfo->curr.offset; + spi_dt(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_DT_REQ; + spi_qas(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_QAS_REQ; + spi_iu(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_IU_REQ; + spi_display_xfer_agreement(starget); break; } case AC_SENT_BDR: @@ -2038,7 +1940,7 @@ ahc_done(struct ahc_softc *ahc, struct scb *scb) ahc_set_transaction_status(scb, CAM_REQ_CMP); } } else if (ahc_get_transaction_status(scb) == CAM_SCSI_STATUS_ERROR) { - ahc_linux_handle_scsi_status(ahc, dev, scb); + ahc_linux_handle_scsi_status(ahc, cmd->device, scb); } if (dev->openings == 1 @@ -2077,14 +1979,15 @@ ahc_done(struct ahc_softc *ahc, struct scb *scb) static void ahc_linux_handle_scsi_status(struct ahc_softc *ahc, - struct ahc_linux_device *dev, struct scb *scb) + struct scsi_device *sdev, struct scb *scb) { struct ahc_devinfo devinfo; + struct ahc_linux_device *dev = scsi_transport_device_data(sdev); ahc_compile_devinfo(&devinfo, ahc->our_id, - dev->target->target, dev->lun, - dev->target->channel == 0 ? 'A' : 'B', + sdev->sdev_target->id, sdev->lun, + sdev->sdev_target->channel == 0 ? 'A' : 'B', ROLE_INITIATOR); /* @@ -2368,8 +2271,7 @@ ahc_linux_queue_recovery_cmd(struct scsi_cmnd *cmd, scb_flag flag) * at all, and the system wanted us to just abort the * command, return success. */ - dev = ahc_linux_get_device(ahc, cmd->device->channel, cmd->device->id, - cmd->device->lun); + dev = scsi_transport_device_data(cmd->device); if (dev == NULL) { /* @@ -2626,18 +2528,6 @@ ahc_platform_dump_card_state(struct ahc_softc *ahc) static void ahc_linux_exit(void); -static void ahc_linux_get_width(struct scsi_target *starget) -{ - struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); - struct ahc_softc *ahc = *((struct ahc_softc **)shost->hostdata); - struct ahc_tmode_tstate *tstate; - struct ahc_initiator_tinfo *tinfo - = ahc_fetch_transinfo(ahc, - starget->channel + 'A', - shost->this_id, starget->id, &tstate); - spi_width(starget) = tinfo->curr.width; -} - static void ahc_linux_set_width(struct scsi_target *starget, int width) { struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); @@ -2652,18 +2542,6 @@ static void ahc_linux_set_width(struct scsi_target *starget, int width) ahc_unlock(ahc, &flags); } -static void ahc_linux_get_period(struct scsi_target *starget) -{ - struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); - struct ahc_softc *ahc = *((struct ahc_softc **)shost->hostdata); - struct ahc_tmode_tstate *tstate; - struct ahc_initiator_tinfo *tinfo - = ahc_fetch_transinfo(ahc, - starget->channel + 'A', - shost->this_id, starget->id, &tstate); - spi_period(starget) = tinfo->curr.period; -} - static void ahc_linux_set_period(struct scsi_target *starget, int period) { struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); @@ -2692,7 +2570,6 @@ static void ahc_linux_set_period(struct scsi_target *starget, int period) /* all PPR requests apart from QAS require wide transfers */ if (ppr_options & ~MSG_EXT_PPR_QAS_REQ) { - ahc_linux_get_width(starget); if (spi_width(starget) == 0) ppr_options &= MSG_EXT_PPR_QAS_REQ; } @@ -2704,18 +2581,6 @@ static void ahc_linux_set_period(struct scsi_target *starget, int period) ahc_unlock(ahc, &flags); } -static void ahc_linux_get_offset(struct scsi_target *starget) -{ - struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); - struct ahc_softc *ahc = *((struct ahc_softc **)shost->hostdata); - struct ahc_tmode_tstate *tstate; - struct ahc_initiator_tinfo *tinfo - = ahc_fetch_transinfo(ahc, - starget->channel + 'A', - shost->this_id, starget->id, &tstate); - spi_offset(starget) = tinfo->curr.offset; -} - static void ahc_linux_set_offset(struct scsi_target *starget, int offset) { struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); @@ -2744,18 +2609,6 @@ static void ahc_linux_set_offset(struct scsi_target *starget, int offset) ahc_unlock(ahc, &flags); } -static void ahc_linux_get_dt(struct scsi_target *starget) -{ - struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); - struct ahc_softc *ahc = *((struct ahc_softc **)shost->hostdata); - struct ahc_tmode_tstate *tstate; - struct ahc_initiator_tinfo *tinfo - = ahc_fetch_transinfo(ahc, - starget->channel + 'A', - shost->this_id, starget->id, &tstate); - spi_dt(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_DT_REQ; -} - static void ahc_linux_set_dt(struct scsi_target *starget, int dt) { struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); @@ -2787,18 +2640,6 @@ static void ahc_linux_set_dt(struct scsi_target *starget, int dt) ahc_unlock(ahc, &flags); } -static void ahc_linux_get_qas(struct scsi_target *starget) -{ - struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); - struct ahc_softc *ahc = *((struct ahc_softc **)shost->hostdata); - struct ahc_tmode_tstate *tstate; - struct ahc_initiator_tinfo *tinfo - = ahc_fetch_transinfo(ahc, - starget->channel + 'A', - shost->this_id, starget->id, &tstate); - spi_dt(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_QAS_REQ; -} - static void ahc_linux_set_qas(struct scsi_target *starget, int qas) { struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); @@ -2827,18 +2668,6 @@ static void ahc_linux_set_qas(struct scsi_target *starget, int qas) ahc_unlock(ahc, &flags); } -static void ahc_linux_get_iu(struct scsi_target *starget) -{ - struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); - struct ahc_softc *ahc = *((struct ahc_softc **)shost->hostdata); - struct ahc_tmode_tstate *tstate; - struct ahc_initiator_tinfo *tinfo - = ahc_fetch_transinfo(ahc, - starget->channel + 'A', - shost->this_id, starget->id, &tstate); - spi_dt(starget) = tinfo->curr.ppr_options & MSG_EXT_PPR_IU_REQ; -} - static void ahc_linux_set_iu(struct scsi_target *starget, int iu) { struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); @@ -2868,22 +2697,16 @@ static void ahc_linux_set_iu(struct scsi_target *starget, int iu) } static struct spi_function_template ahc_linux_transport_functions = { - .get_offset = ahc_linux_get_offset, .set_offset = ahc_linux_set_offset, .show_offset = 1, - .get_period = ahc_linux_get_period, .set_period = ahc_linux_set_period, .show_period = 1, - .get_width = ahc_linux_get_width, .set_width = ahc_linux_set_width, .show_width = 1, - .get_dt = ahc_linux_get_dt, .set_dt = ahc_linux_set_dt, .show_dt = 1, - .get_iu = ahc_linux_get_iu, .set_iu = ahc_linux_set_iu, .show_iu = 1, - .get_qas = ahc_linux_get_qas, .set_qas = ahc_linux_set_qas, .show_qas = 1, }; @@ -2896,6 +2719,10 @@ ahc_linux_init(void) ahc_linux_transport_template = spi_attach_transport(&ahc_linux_transport_functions); if (!ahc_linux_transport_template) return -ENODEV; + scsi_transport_reserve_target(ahc_linux_transport_template, + sizeof(struct ahc_linux_target)); + scsi_transport_reserve_device(ahc_linux_transport_template, + sizeof(struct ahc_linux_device)); if (ahc_linux_detect(&aic7xxx_driver_template)) return 0; spi_release_transport(ahc_linux_transport_template); diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.h b/drivers/scsi/aic7xxx/aic7xxx_osm.h index 30c200d5bcd..b135c8c787b 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.h +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.h @@ -79,6 +79,8 @@ #include #include #include +#include +#include /* Core SCSI definitions */ #define AIC_LIB_PREFIX ahc @@ -330,8 +332,6 @@ typedef enum { struct ahc_linux_target; struct ahc_linux_device { - TAILQ_ENTRY(ahc_linux_device) links; - /* * The number of transactions currently * queued to the device. @@ -401,17 +401,10 @@ struct ahc_linux_device { */ u_int commands_since_idle_or_otag; #define AHC_OTAG_THRESH 500 - - int lun; - struct scsi_device *scsi_device; - struct ahc_linux_target *target; }; struct ahc_linux_target { - struct ahc_linux_device *devices[AHC_NUM_LUNS]; - int channel; - int target; - int refcount; + struct scsi_device *sdev[AHC_NUM_LUNS]; struct ahc_transinfo last_tinfo; struct ahc_softc *ahc; }; @@ -445,7 +438,7 @@ struct ahc_platform_data { /* * Fields accessed from interrupt context. */ - struct ahc_linux_target *targets[AHC_NUM_TARGETS]; + struct scsi_target *starget[AHC_NUM_TARGETS]; spinlock_t spin_lock; u_int qfrozen; diff --git a/drivers/scsi/aic7xxx/aic7xxx_proc.c b/drivers/scsi/aic7xxx/aic7xxx_proc.c index 5fece859fbd..9c7f1056710 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_proc.c +++ b/drivers/scsi/aic7xxx/aic7xxx_proc.c @@ -50,7 +50,7 @@ static void ahc_dump_target_state(struct ahc_softc *ahc, u_int our_id, char channel, u_int target_id, u_int target_offset); static void ahc_dump_device_state(struct info_str *info, - struct ahc_linux_device *dev); + struct scsi_device *dev); static int ahc_proc_write_seeprom(struct ahc_softc *ahc, char *buffer, int length); @@ -142,6 +142,7 @@ ahc_dump_target_state(struct ahc_softc *ahc, struct info_str *info, u_int target_offset) { struct ahc_linux_target *targ; + struct scsi_target *starget; struct ahc_initiator_tinfo *tinfo; struct ahc_tmode_tstate *tstate; int lun; @@ -153,7 +154,8 @@ ahc_dump_target_state(struct ahc_softc *ahc, struct info_str *info, copy_info(info, "Target %d Negotiation Settings\n", target_id); copy_info(info, "\tUser: "); ahc_format_transinfo(info, &tinfo->user); - targ = ahc->platform_data->targets[target_offset]; + starget = ahc->platform_data->starget[target_offset]; + targ = scsi_transport_target_data(starget); if (targ == NULL) return; @@ -163,22 +165,25 @@ ahc_dump_target_state(struct ahc_softc *ahc, struct info_str *info, ahc_format_transinfo(info, &tinfo->curr); for (lun = 0; lun < AHC_NUM_LUNS; lun++) { - struct ahc_linux_device *dev; + struct scsi_device *sdev; - dev = targ->devices[lun]; + sdev = targ->sdev[lun]; - if (dev == NULL) + if (sdev == NULL) continue; - ahc_dump_device_state(info, dev); + ahc_dump_device_state(info, sdev); } } static void -ahc_dump_device_state(struct info_str *info, struct ahc_linux_device *dev) +ahc_dump_device_state(struct info_str *info, struct scsi_device *sdev) { + struct ahc_linux_device *dev = scsi_transport_device_data(sdev); + copy_info(info, "\tChannel %c Target %d Lun %d Settings\n", - dev->target->channel + 'A', dev->target->target, dev->lun); + sdev->sdev_target->channel + 'A', + sdev->sdev_target->id, sdev->lun); copy_info(info, "\t\tCommands Queued %ld\n", dev->commands_issued); copy_info(info, "\t\tCommands Active %d\n", dev->active); -- cgit v1.2.3 From 597487b9ba875785f3ee9bd541073e9edd2e700a Mon Sep 17 00:00:00 2001 From: James Bottomley Date: Fri, 3 Jun 2005 09:49:01 -0500 Subject: [SCSI] fix aic7xxx coupled parameter problem For setting coupled parameters, we need to be comparing against the goal settings, not the current ones. Signed-off-by: James Bottomley --- drivers/scsi/aic7xxx/aic7xxx_osm.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'drivers/scsi/aic7xxx') diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c index 57d22c4f008..34e486aba46 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.c +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c @@ -2552,9 +2552,9 @@ static void ahc_linux_set_period(struct scsi_target *starget, int period) starget->channel + 'A', shost->this_id, starget->id, &tstate); struct ahc_devinfo devinfo; - unsigned int ppr_options = tinfo->curr.ppr_options; + unsigned int ppr_options = tinfo->goal.ppr_options; unsigned long flags; - unsigned long offset = tinfo->curr.offset; + unsigned long offset = tinfo->goal.offset; struct ahc_syncrate *syncrate; if (offset == 0) @@ -2600,8 +2600,8 @@ static void ahc_linux_set_offset(struct scsi_target *starget, int offset) starget->channel + 'A', ROLE_INITIATOR); if (offset != 0) { syncrate = ahc_find_syncrate(ahc, &period, &ppr_options, AHC_SYNCRATE_DT); - period = tinfo->curr.period; - ppr_options = tinfo->curr.ppr_options; + period = tinfo->goal.period; + ppr_options = tinfo->goal.ppr_options; } ahc_lock(ahc, &flags); ahc_set_syncrate(ahc, &devinfo, syncrate, period, offset, @@ -2619,9 +2619,9 @@ static void ahc_linux_set_dt(struct scsi_target *starget, int dt) starget->channel + 'A', shost->this_id, starget->id, &tstate); struct ahc_devinfo devinfo; - unsigned int ppr_options = tinfo->curr.ppr_options + unsigned int ppr_options = tinfo->goal.ppr_options & ~MSG_EXT_PPR_DT_REQ; - unsigned int period = tinfo->curr.period; + unsigned int period = tinfo->goal.period; unsigned long flags; struct ahc_syncrate *syncrate; @@ -2635,7 +2635,7 @@ static void ahc_linux_set_dt(struct scsi_target *starget, int dt) starget->channel + 'A', ROLE_INITIATOR); syncrate = ahc_find_syncrate(ahc, &period, &ppr_options,AHC_SYNCRATE_DT); ahc_lock(ahc, &flags); - ahc_set_syncrate(ahc, &devinfo, syncrate, period, tinfo->curr.offset, + ahc_set_syncrate(ahc, &devinfo, syncrate, period, tinfo->goal.offset, ppr_options, AHC_TRANS_GOAL, FALSE); ahc_unlock(ahc, &flags); } @@ -2650,9 +2650,9 @@ static void ahc_linux_set_qas(struct scsi_target *starget, int qas) starget->channel + 'A', shost->this_id, starget->id, &tstate); struct ahc_devinfo devinfo; - unsigned int ppr_options = tinfo->curr.ppr_options + unsigned int ppr_options = tinfo->goal.ppr_options & ~MSG_EXT_PPR_QAS_REQ; - unsigned int period = tinfo->curr.period; + unsigned int period = tinfo->goal.period; unsigned long flags; struct ahc_syncrate *syncrate; @@ -2663,7 +2663,7 @@ static void ahc_linux_set_qas(struct scsi_target *starget, int qas) starget->channel + 'A', ROLE_INITIATOR); syncrate = ahc_find_syncrate(ahc, &period, &ppr_options, AHC_SYNCRATE_DT); ahc_lock(ahc, &flags); - ahc_set_syncrate(ahc, &devinfo, syncrate, period, tinfo->curr.offset, + ahc_set_syncrate(ahc, &devinfo, syncrate, period, tinfo->goal.offset, ppr_options, AHC_TRANS_GOAL, FALSE); ahc_unlock(ahc, &flags); } @@ -2678,9 +2678,9 @@ static void ahc_linux_set_iu(struct scsi_target *starget, int iu) starget->channel + 'A', shost->this_id, starget->id, &tstate); struct ahc_devinfo devinfo; - unsigned int ppr_options = tinfo->curr.ppr_options + unsigned int ppr_options = tinfo->goal.ppr_options & ~MSG_EXT_PPR_IU_REQ; - unsigned int period = tinfo->curr.period; + unsigned int period = tinfo->goal.period; unsigned long flags; struct ahc_syncrate *syncrate; @@ -2691,7 +2691,7 @@ static void ahc_linux_set_iu(struct scsi_target *starget, int iu) starget->channel + 'A', ROLE_INITIATOR); syncrate = ahc_find_syncrate(ahc, &period, &ppr_options, AHC_SYNCRATE_DT); ahc_lock(ahc, &flags); - ahc_set_syncrate(ahc, &devinfo, syncrate, period, tinfo->curr.offset, + ahc_set_syncrate(ahc, &devinfo, syncrate, period, tinfo->goal.offset, ppr_options, AHC_TRANS_GOAL, FALSE); ahc_unlock(ahc, &flags); } -- cgit v1.2.3 From 765c4d45b8cae32faff358aa760a33cde38ea1a7 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Sat, 11 Jun 2005 00:26:00 +0200 Subject: [SCSI] aic7xxx/aic79xx: remove useless byte order macro cruft Signed-off-by: Christoph Hellwig Signed-off-by: James Bottomley --- drivers/scsi/aic7xxx/aic79xx_osm.h | 17 ----------------- drivers/scsi/aic7xxx/aic7xxx_osm.h | 17 ----------------- 2 files changed, 34 deletions(-) (limited to 'drivers/scsi/aic7xxx') diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.h b/drivers/scsi/aic7xxx/aic79xx_osm.h index 605f92b6c5c..7823e52e99a 100644 --- a/drivers/scsi/aic7xxx/aic79xx_osm.h +++ b/drivers/scsi/aic7xxx/aic79xx_osm.h @@ -112,23 +112,6 @@ typedef Scsi_Cmnd *ahd_io_ctx_t; #define ahd_le32toh(x) le32_to_cpu(x) #define ahd_le64toh(x) le64_to_cpu(x) -#ifndef LITTLE_ENDIAN -#define LITTLE_ENDIAN 1234 -#endif - -#ifndef BIG_ENDIAN -#define BIG_ENDIAN 4321 -#endif - -#ifndef BYTE_ORDER -#if defined(__BIG_ENDIAN) -#define BYTE_ORDER BIG_ENDIAN -#endif -#if defined(__LITTLE_ENDIAN) -#define BYTE_ORDER LITTLE_ENDIAN -#endif -#endif /* BYTE_ORDER */ - /************************* Configuration Data *********************************/ extern uint32_t aic79xx_allow_memio; extern int aic79xx_detect_complete; diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.h b/drivers/scsi/aic7xxx/aic7xxx_osm.h index b135c8c787b..46c3a796e6b 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.h +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.h @@ -129,23 +129,6 @@ typedef struct scsi_cmnd *ahc_io_ctx_t; #define ahc_le32toh(x) le32_to_cpu(x) #define ahc_le64toh(x) le64_to_cpu(x) -#ifndef LITTLE_ENDIAN -#define LITTLE_ENDIAN 1234 -#endif - -#ifndef BIG_ENDIAN -#define BIG_ENDIAN 4321 -#endif - -#ifndef BYTE_ORDER -#if defined(__BIG_ENDIAN) -#define BYTE_ORDER BIG_ENDIAN -#endif -#if defined(__LITTLE_ENDIAN) -#define BYTE_ORDER LITTLE_ENDIAN -#endif -#endif /* BYTE_ORDER */ - /************************* Configuration Data *********************************/ extern u_int aic7xxx_no_probe; extern u_int aic7xxx_allow_memio; -- cgit v1.2.3 From e431223eca7e0785a5402999b43b16622409017f Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Sat, 11 Jun 2005 00:15:31 +0200 Subject: [SCSI] aic7xxx: do not check for duplicate pci ids pci layer handles this just fine for us Signed-off-by: Christoph Hellwig Signed-off-by: James Bottomley --- drivers/scsi/aic7xxx/aic7xxx_osm_pci.c | 16 ---------------- 1 file changed, 16 deletions(-) (limited to 'drivers/scsi/aic7xxx') diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c index 2a0ebce83e7..9cd4fe1c4ef 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c +++ b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c @@ -174,22 +174,6 @@ ahc_linux_pci_dev_probe(struct pci_dev *pdev, const struct pci_device_id *ent) char *name; int error; - /* - * Some BIOSen report the same device multiple times. - */ - TAILQ_FOREACH(ahc, &ahc_tailq, links) { - struct pci_dev *probed_pdev; - - probed_pdev = ahc->dev_softc; - if (probed_pdev->bus->number == pdev->bus->number - && probed_pdev->devfn == pdev->devfn) - break; - } - if (ahc != NULL) { - /* Skip duplicate. */ - return (-ENODEV); - } - pci = pdev; entry = ahc_find_pci_device(pci); if (entry == NULL) -- cgit v1.2.3 From 3d65692aed727c7fb4105f03795781ace437a84e Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Sat, 11 Jun 2005 00:14:30 +0200 Subject: [SCSI] aic7xxx: remove ahc_find_softc there's absolutely no reason not to trust the driver private data Signed-off-by: Christoph Hellwig Signed-off-by: James Bottomley --- drivers/scsi/aic7xxx/aic7770_osm.c | 24 ++++++------------------ drivers/scsi/aic7xxx/aic7xxx.h | 1 - drivers/scsi/aic7xxx/aic7xxx_core.c | 16 ---------------- drivers/scsi/aic7xxx/aic7xxx_osm_pci.c | 28 +++++++++------------------- drivers/scsi/aic7xxx/aic7xxx_proc.c | 10 +--------- 5 files changed, 16 insertions(+), 63 deletions(-) (limited to 'drivers/scsi/aic7xxx') diff --git a/drivers/scsi/aic7xxx/aic7770_osm.c b/drivers/scsi/aic7xxx/aic7770_osm.c index 682ca0b32b4..d0e9b54ab00 100644 --- a/drivers/scsi/aic7xxx/aic7770_osm.c +++ b/drivers/scsi/aic7xxx/aic7770_osm.c @@ -190,25 +190,13 @@ aic7770_eisa_dev_probe(struct device *dev) static int aic7770_eisa_dev_remove(struct device *dev) { - struct ahc_softc *ahc; - u_long l; + struct ahc_softc *ahc = dev_get_drvata(dev); + u_long s; - /* - * We should be able to just perform - * the free directly, but check our - * list for extra sanity. - */ - ahc_list_lock(&l); - ahc = ahc_find_softc((struct ahc_softc *)dev->driver_data); - if (ahc != NULL) { - u_long s; - - ahc_lock(ahc, &s); - ahc_intr_enable(ahc, FALSE); - ahc_unlock(ahc, &s); - ahc_free(ahc); - } - ahc_list_unlock(&l); + ahc_lock(ahc, &s); + ahc_intr_enable(ahc, FALSE); + ahc_unlock(ahc, &s); + ahc_free(ahc); return (0); } diff --git a/drivers/scsi/aic7xxx/aic7xxx.h b/drivers/scsi/aic7xxx/aic7xxx.h index 8ff16fd8ed4..d094e737173 100644 --- a/drivers/scsi/aic7xxx/aic7xxx.h +++ b/drivers/scsi/aic7xxx/aic7xxx.h @@ -1200,7 +1200,6 @@ void ahc_pause_and_flushwork(struct ahc_softc *ahc); int ahc_suspend(struct ahc_softc *ahc); int ahc_resume(struct ahc_softc *ahc); void ahc_softc_insert(struct ahc_softc *); -struct ahc_softc *ahc_find_softc(struct ahc_softc *ahc); void ahc_set_unit(struct ahc_softc *, int); void ahc_set_name(struct ahc_softc *, char *); void ahc_alloc_scbs(struct ahc_softc *ahc); diff --git a/drivers/scsi/aic7xxx/aic7xxx_core.c b/drivers/scsi/aic7xxx/aic7xxx_core.c index 9a6b4a570aa..8a2bb6f8d77 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_core.c +++ b/drivers/scsi/aic7xxx/aic7xxx_core.c @@ -3934,22 +3934,6 @@ ahc_softc_insert(struct ahc_softc *ahc) ahc->init_level++; } -/* - * Verify that the passed in softc pointer is for a - * controller that is still configured. - */ -struct ahc_softc * -ahc_find_softc(struct ahc_softc *ahc) -{ - struct ahc_softc *list_ahc; - - TAILQ_FOREACH(list_ahc, &ahc_tailq, links) { - if (list_ahc == ahc) - return (ahc); - } - return (NULL); -} - void ahc_set_unit(struct ahc_softc *ahc, int unit) { diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c index 9cd4fe1c4ef..89d737ee551 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c +++ b/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c @@ -140,27 +140,17 @@ struct pci_driver aic7xxx_pci_driver = { static void ahc_linux_pci_dev_remove(struct pci_dev *pdev) { - struct ahc_softc *ahc; - u_long l; + struct ahc_softc *ahc = pci_get_drvdata(pdev); + u_long s; - /* - * We should be able to just perform - * the free directly, but check our - * list for extra sanity. - */ - ahc_list_lock(&l); - ahc = ahc_find_softc((struct ahc_softc *)pci_get_drvdata(pdev)); - if (ahc != NULL) { - u_long s; + ahc_list_lock(&s); + TAILQ_REMOVE(&ahc_tailq, ahc, links); + ahc_list_unlock(&s); - TAILQ_REMOVE(&ahc_tailq, ahc, links); - ahc_list_unlock(&l); - ahc_lock(ahc, &s); - ahc_intr_enable(ahc, FALSE); - ahc_unlock(ahc, &s); - ahc_free(ahc); - } else - ahc_list_unlock(&l); + ahc_lock(ahc, &s); + ahc_intr_enable(ahc, FALSE); + ahc_unlock(ahc, &s); + ahc_free(ahc); } static int diff --git a/drivers/scsi/aic7xxx/aic7xxx_proc.c b/drivers/scsi/aic7xxx/aic7xxx_proc.c index 9c7f1056710..ab4469d83fb 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_proc.c +++ b/drivers/scsi/aic7xxx/aic7xxx_proc.c @@ -297,20 +297,13 @@ int ahc_linux_proc_info(struct Scsi_Host *shost, char *buffer, char **start, off_t offset, int length, int inout) { - struct ahc_softc *ahc; + struct ahc_softc *ahc = *(struct ahc_softc **)shost->hostdata; struct info_str info; char ahc_info[256]; - u_long s; u_int max_targ; u_int i; int retval; - retval = -EINVAL; - ahc_list_lock(&s); - ahc = ahc_find_softc(*(struct ahc_softc **)shost->hostdata); - if (ahc == NULL) - goto done; - /* Has data been written to the file? */ if (inout == TRUE) { retval = ahc_proc_write_seeprom(ahc, buffer, length); @@ -372,6 +365,5 @@ ahc_linux_proc_info(struct Scsi_Host *shost, char *buffer, char **start, } retval = info.pos > info.offset ? info.pos - info.offset : 0; done: - ahc_list_unlock(&s); return (retval); } -- cgit v1.2.3 From 8eb379425765bfc9a44f06f210224b10066fc46f Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Sat, 11 Jun 2005 00:13:30 +0200 Subject: [SCSI] aic7xxx: remove some dead wood especially the now dead scsi_cmnd overlay Signed-off-by: Christoph Hellwig Signed-off-by: James Bottomley --- drivers/scsi/aic7xxx/aic7xxx.h | 1 - drivers/scsi/aic7xxx/aic7xxx_osm.c | 18 +++--------------- drivers/scsi/aic7xxx/aic7xxx_osm.h | 31 ------------------------------- 3 files changed, 3 insertions(+), 47 deletions(-) (limited to 'drivers/scsi/aic7xxx') diff --git a/drivers/scsi/aic7xxx/aic7xxx.h b/drivers/scsi/aic7xxx/aic7xxx.h index d094e737173..0948d50ae75 100644 --- a/drivers/scsi/aic7xxx/aic7xxx.h +++ b/drivers/scsi/aic7xxx/aic7xxx.h @@ -346,7 +346,6 @@ typedef enum { * controller. */ AHC_NEWEEPROM_FMT = 0x4000, - AHC_RESOURCE_SHORTAGE = 0x8000, AHC_TQINFIFO_BLOCKED = 0x10000, /* Blocked waiting for ATIOs */ AHC_INT50_SPEEDFLEX = 0x20000, /* * Internal 50pin connector diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c index 34e486aba46..3287f8df180 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.c +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c @@ -500,17 +500,6 @@ ahc_linux_detect(struct scsi_host_template *template) struct ahc_softc *ahc; int found = 0; - /* - * Sanity checking of Linux SCSI data structures so - * that some of our hacks^H^H^H^H^Hassumptions aren't - * violated. - */ - if (offsetof(struct ahc_cmd_internal, end) - > offsetof(struct scsi_cmnd, host_scribble)) { - printf("ahc_linux_detect: SCSI data structures changed.\n"); - printf("ahc_linux_detect: Unable to attach\n"); - return (0); - } /* * If we've been passed any parameters, process them now. */ @@ -1587,10 +1576,9 @@ ahc_linux_run_command(struct ahc_softc *ahc, struct ahc_linux_device *dev, /* * Get an scb to use. */ - if ((scb = ahc_get_scb(ahc)) == NULL) { - ahc->flags |= AHC_RESOURCE_SHORTAGE; - return SCSI_MLQUEUE_HOST_BUSY; - } + scb = ahc_get_scb(ahc); + if (!scb) + return SCSI_MLQUEUE_HOST_BUSY; scb->io_ctx = cmd; scb->platform_data->dev = dev; diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.h b/drivers/scsi/aic7xxx/aic7xxx_osm.h index 46c3a796e6b..b97f718dfe5 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.h +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.h @@ -268,35 +268,6 @@ ahc_scb_timer_reset(struct scb *scb, u_int usec) #define AIC7XXX_DRIVER_VERSION "6.2.36" -/**************************** Front End Queues ********************************/ -/* - * Data structure used to cast the Linux struct scsi_cmnd to something - * that allows us to use the queue macros. The linux structure has - * plenty of space to hold the links fields as required by the queue - * macros, but the queue macors require them to have the correct type. - */ -struct ahc_cmd_internal { - /* Area owned by the Linux scsi layer. */ - uint8_t private[offsetof(struct scsi_cmnd, SCp.Status)]; - union { - STAILQ_ENTRY(ahc_cmd) ste; - LIST_ENTRY(ahc_cmd) le; - TAILQ_ENTRY(ahc_cmd) tqe; - } links; - uint32_t end; -}; - -struct ahc_cmd { - union { - struct ahc_cmd_internal icmd; - struct scsi_cmnd scsi_cmd; - } un; -}; - -#define acmd_icmd(cmd) ((cmd)->un.icmd) -#define acmd_scsi_cmd(cmd) ((cmd)->un.scsi_cmd) -#define acmd_links un.icmd.links - /*************************** Device Data Structures ***************************/ /* * A per probed device structure used to deal with some error recovery @@ -305,7 +276,6 @@ struct ahc_cmd { * after a successfully completed inquiry command to the target when * that inquiry data indicates a lun is present. */ -TAILQ_HEAD(ahc_busyq, ahc_cmd); typedef enum { AHC_DEV_FREEZE_TIL_EMPTY = 0x02, /* Freeze queue until active == 0 */ AHC_DEV_Q_BASIC = 0x10, /* Allow basic device queuing */ @@ -900,7 +870,6 @@ ahc_notify_xfer_settings_change(struct ahc_softc *ahc, static __inline void ahc_platform_scb_free(struct ahc_softc *ahc, struct scb *scb) { - ahc->flags &= ~AHC_RESOURCE_SHORTAGE; } int ahc_platform_alloc(struct ahc_softc *ahc, void *platform_arg); -- cgit v1.2.3 From d6cbbad7296538b6a38c0fe36e6ecf67f1e600a7 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Sat, 11 Jun 2005 00:17:03 +0200 Subject: [SCSI] aic7xxx: clean up eisa support - the eisa layer only probes when it's actually safe, no need for a driver option - store the id table directly in linux format instead of convering at runtime Signed-off-by: Christoph Hellwig Signed-off-by: James Bottomley --- drivers/scsi/aic7xxx/aic7770_osm.c | 175 +++++++++++++------------------------ drivers/scsi/aic7xxx/aic7xxx_osm.c | 18 ---- drivers/scsi/aic7xxx/aic7xxx_osm.h | 1 - 3 files changed, 63 insertions(+), 131 deletions(-) (limited to 'drivers/scsi/aic7xxx') diff --git a/drivers/scsi/aic7xxx/aic7770_osm.c b/drivers/scsi/aic7xxx/aic7770_osm.c index d0e9b54ab00..d4ed5e9f830 100644 --- a/drivers/scsi/aic7xxx/aic7770_osm.c +++ b/drivers/scsi/aic7xxx/aic7770_osm.c @@ -44,109 +44,6 @@ #include #include -#define EISA_MFCTR_CHAR0(ID) (char)(((ID>>26) & 0x1F) | '@') /* Bits 26-30 */ -#define EISA_MFCTR_CHAR1(ID) (char)(((ID>>21) & 0x1F) | '@') /* Bits 21-25 */ -#define EISA_MFCTR_CHAR2(ID) (char)(((ID>>16) & 0x1F) | '@') /* Bits 16-20 */ -#define EISA_PRODUCT_ID(ID) (short)((ID>>4) & 0xFFF) /* Bits 4-15 */ -#define EISA_REVISION_ID(ID) (uint8_t)(ID & 0x0F) /* Bits 0-3 */ - -static int aic7770_eisa_dev_probe(struct device *dev); -static int aic7770_eisa_dev_remove(struct device *dev); -static struct eisa_driver aic7770_driver = { - .driver = { - .name = "aic7xxx", - .probe = aic7770_eisa_dev_probe, - .remove = aic7770_eisa_dev_remove, - } -}; - -typedef struct device *aic7770_dev_t; - -static int aic7770_linux_config(struct aic7770_identity *entry, - aic7770_dev_t dev, u_int eisaBase); - -int -ahc_linux_eisa_init(void) -{ - struct eisa_device_id *eid; - struct aic7770_identity *id; - int i; - - if (aic7xxx_probe_eisa_vl == 0) - return -ENODEV; - - /* - * Linux requires the EISA IDs to be specified in - * the EISA ID string format. Perform the conversion - * and setup a table with a NUL terminal entry. - */ - aic7770_driver.id_table = malloc(sizeof(struct eisa_device_id) * - (ahc_num_aic7770_devs + 1), - M_DEVBUF, M_NOWAIT); - if (aic7770_driver.id_table == NULL) - return -ENOMEM; - - for (eid = (struct eisa_device_id *)aic7770_driver.id_table, - id = aic7770_ident_table, i = 0; - i < ahc_num_aic7770_devs; eid++, id++, i++) { - - sprintf(eid->sig, "%c%c%c%03X%01X", - EISA_MFCTR_CHAR0(id->full_id), - EISA_MFCTR_CHAR1(id->full_id), - EISA_MFCTR_CHAR2(id->full_id), - EISA_PRODUCT_ID(id->full_id), - EISA_REVISION_ID(id->full_id)); - eid->driver_data = i; - } - eid->sig[0] = 0; - - return eisa_driver_register(&aic7770_driver); -} - -void -ahc_linux_eisa_exit(void) -{ - if(aic7xxx_probe_eisa_vl != 0 && aic7770_driver.id_table != NULL) { - eisa_driver_unregister(&aic7770_driver); - free(aic7770_driver.id_table, M_DEVBUF); - } -} - -static int -aic7770_linux_config(struct aic7770_identity *entry, aic7770_dev_t dev, - u_int eisaBase) -{ - struct ahc_softc *ahc; - char buf[80]; - char *name; - int error; - - /* - * Allocate a softc for this card and - * set it up for attachment by our - * common detect routine. - */ - sprintf(buf, "ahc_eisa:%d", eisaBase >> 12); - name = malloc(strlen(buf) + 1, M_DEVBUF, M_NOWAIT); - if (name == NULL) - return (ENOMEM); - strcpy(name, buf); - ahc = ahc_alloc(&aic7xxx_driver_template, name); - if (ahc == NULL) - return (ENOMEM); - error = aic7770_config(ahc, entry, eisaBase); - if (error != 0) { - ahc->bsh.ioport = 0; - ahc_free(ahc); - return (error); - } - - dev->driver_data = (void *)ahc; - if (aic7xxx_detect_complete) - error = ahc_linux_register_host(ahc, &aic7xxx_driver_template); - return (error); -} - int aic7770_map_registers(struct ahc_softc *ahc, u_int port) { @@ -178,25 +75,79 @@ aic7770_map_int(struct ahc_softc *ahc, u_int irq) } static int -aic7770_eisa_dev_probe(struct device *dev) +aic7770_probe(struct device *dev) { - struct eisa_device *edev; + struct eisa_device *edev = to_eisa_device(dev); + u_int eisaBase = edev->base_addr+AHC_EISA_SLOT_OFFSET; + struct ahc_softc *ahc; + char buf[80]; + char *name; + int error; + + sprintf(buf, "ahc_eisa:%d", eisaBase >> 12); + name = malloc(strlen(buf) + 1, M_DEVBUF, M_NOWAIT); + if (name == NULL) + return (ENOMEM); + strcpy(name, buf); + ahc = ahc_alloc(&aic7xxx_driver_template, name); + if (ahc == NULL) + return (ENOMEM); + error = aic7770_config(ahc, aic7770_ident_table + edev->id.driver_data, + eisaBase); + if (error != 0) { + ahc->bsh.ioport = 0; + ahc_free(ahc); + return (error); + } + + dev_set_drvdata(dev, ahc); - edev = to_eisa_device(dev); - return (aic7770_linux_config(aic7770_ident_table + edev->id.driver_data, - dev, edev->base_addr+AHC_EISA_SLOT_OFFSET)); + if (aic7xxx_detect_complete) + error = ahc_linux_register_host(ahc, &aic7xxx_driver_template); + return (error); } static int -aic7770_eisa_dev_remove(struct device *dev) +aic7770_remove(struct device *dev) { - struct ahc_softc *ahc = dev_get_drvata(dev); + struct ahc_softc *ahc = dev_get_drvdata(dev); u_long s; ahc_lock(ahc, &s); ahc_intr_enable(ahc, FALSE); ahc_unlock(ahc, &s); - ahc_free(ahc); - return (0); + ahc_free(ahc); + return 0; +} + +static struct eisa_device_id aic7770_ids[] = { + { "ADP7771", 0 }, /* AHA 274x */ + { "ADP7756", 1 }, /* AHA 284x BIOS enabled */ + { "ADP7757", 2 }, /* AHA 284x BIOS disabled */ + { "ADP7782", 3 }, /* AHA 274x Olivetti OEM */ + { "ADP7783", 4 }, /* AHA 274x Olivetti OEM (Differential) */ + { "ADP7770", 5 }, /* AIC7770 generic */ + { "" } +}; + +static struct eisa_driver aic7770_driver = { + .id_table = aic7770_ids, + .driver = { + .name = "aic7xxx", + .probe = aic7770_probe, + .remove = aic7770_remove, + } +}; + +int +ahc_linux_eisa_init(void) +{ + return eisa_driver_register(&aic7770_driver); +} + +void +ahc_linux_eisa_exit(void) +{ + eisa_driver_unregister(&aic7770_driver); } diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c index 3287f8df180..55e0b2875f9 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.c +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c @@ -329,22 +329,6 @@ static uint32_t aic7xxx_extended; */ static uint32_t aic7xxx_pci_parity = ~0; -/* - * Certain newer motherboards have put new PCI based devices into the - * IO spaces that used to typically be occupied by VLB or EISA cards. - * This overlap can cause these newer motherboards to lock up when scanned - * for older EISA and VLB devices. Setting this option to non-0 will - * cause the driver to skip scanning for any VLB or EISA controllers and - * only support the PCI controllers. NOTE: this means that if the kernel - * os compiled with PCI support disabled, then setting this to non-0 - * would result in never finding any devices :) - */ -#ifndef CONFIG_AIC7XXX_PROBE_EISA_VL -uint32_t aic7xxx_probe_eisa_vl; -#else -uint32_t aic7xxx_probe_eisa_vl = ~0; -#endif - /* * There are lots of broken chipsets in the world. Some of them will * violate the PCI spec when we issue byte sized memory writes to our @@ -1101,8 +1085,6 @@ aic7xxx_setup(char *s) { "debug", &ahc_debug }, #endif { "reverse_scan", &aic7xxx_reverse_scan }, - { "no_probe", &aic7xxx_probe_eisa_vl }, - { "probe_eisa_vl", &aic7xxx_probe_eisa_vl }, { "periodic_otag", &aic7xxx_periodic_otag }, { "pci_parity", &aic7xxx_pci_parity }, { "seltime", &aic7xxx_seltime }, diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.h b/drivers/scsi/aic7xxx/aic7xxx_osm.h index b97f718dfe5..8ffe2d3e1d9 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.h +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.h @@ -605,7 +605,6 @@ typedef enum /**************************** VL/EISA Routines ********************************/ #ifdef CONFIG_EISA -extern uint32_t aic7xxx_probe_eisa_vl; int ahc_linux_eisa_init(void); void ahc_linux_eisa_exit(void); int aic7770_map_registers(struct ahc_softc *ahc, -- cgit v1.2.3 From 12021fff2bae7fab01c4bf283f3cd9bc6997d8c4 Mon Sep 17 00:00:00 2001 From: James Bottomley Date: Mon, 13 Jun 2005 20:58:56 -0500 Subject: [SCSI] aic7xxx: fix the BIOS limits setting routines Following the go around over the SONY DVD that needs artificial limits, this should be the correct code for all cases (minus the debugging prints). Signed-off-by: James Bottomley --- drivers/scsi/aic7xxx/aic7xxx_osm.c | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) (limited to 'drivers/scsi/aic7xxx') diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c index 55e0b2875f9..e3892585d7e 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.c +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c @@ -621,20 +621,35 @@ ahc_linux_target_alloc(struct scsi_target *starget) memset(targ, 0, sizeof(*targ)); if (sc) { + int maxsync = AHC_SYNCRATE_DT; + int ultra = 0; + int flags = sc->device_flags[target_offset]; + + if (ahc->flags & AHC_NEWEEPROM_FMT) { + if (flags & CFSYNCHISULTRA) + ultra = 1; + } else if (flags & CFULTRAEN) + ultra = 1; + /* AIC nutcase; 10MHz appears as ultra = 1, CFXFER = 0x04 + * change it to ultra=0, CFXFER = 0 */ + if(ultra && (flags & CFXFER) == 0x04) { + ultra = 0; + flags &= ~CFXFER; + } + if ((ahc->features & AHC_ULTRA2) != 0) { - scsirate = sc->device_flags[target_offset] & CFXFER; + scsirate = (flags & CFXFER) | (ultra ? 0x8 : 0); } else { - scsirate = (sc->device_flags[target_offset] & CFXFER) << 4; - if (sc->device_flags[target_offset] & CFSYNCH) - scsirate |= SOFS; + scsirate = (flags & CFXFER) << 4; + maxsync = ultra ? AHC_SYNCRATE_ULTRA : + AHC_SYNCRATE_FAST; } - if (sc->device_flags[target_offset] & CFWIDEB) { - scsirate |= WIDEXFER; - spi_max_width(starget) = 1; - } else - spi_max_width(starget) = 0; + spi_max_width(starget) = (flags & CFWIDEB) ? 1 : 0; + if (!(flags & CFSYNCH)) + spi_max_offset(starget) = 0; spi_min_period(starget) = - ahc_find_period(ahc, scsirate, AHC_SYNCRATE_DT); + ahc_find_period(ahc, scsirate, maxsync); + tinfo = ahc_fetch_transinfo(ahc, channel, ahc->our_id, starget->id, &tstate); } -- cgit v1.2.3 From 8fa728a26886f56a9ee10a44fea0ddda301d21c3 Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Sat, 28 May 2005 07:54:40 -0400 Subject: [SCSI] allow sleeping in ->eh_abort_handler() Signed-off-by: James Bottomley --- drivers/scsi/aic7xxx/aic79xx_osm.c | 8 ++++---- drivers/scsi/aic7xxx/aic7xxx_osm.c | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'drivers/scsi/aic7xxx') diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c index 550c9921691..7fc6c76e519 100644 --- a/drivers/scsi/aic7xxx/aic79xx_osm.c +++ b/drivers/scsi/aic7xxx/aic79xx_osm.c @@ -941,7 +941,7 @@ ahd_linux_queue(Scsi_Cmnd * cmd, void (*scsi_done) (Scsi_Cmnd *)) */ cmd->scsi_done = scsi_done; - ahd_midlayer_entrypoint_lock(ahd, &flags); + ahd_lock(ahd, &flags); /* * Close the race of a command that was in the process of @@ -955,7 +955,7 @@ ahd_linux_queue(Scsi_Cmnd * cmd, void (*scsi_done) (Scsi_Cmnd *)) ahd_cmd_set_transaction_status(cmd, CAM_REQUEUE_REQ); ahd_linux_queue_cmd_complete(ahd, cmd); ahd_schedule_completeq(ahd); - ahd_midlayer_entrypoint_unlock(ahd, &flags); + ahd_unlock(ahd, &flags); return (0); } dev = ahd_linux_get_device(ahd, cmd->device->channel, @@ -965,7 +965,7 @@ ahd_linux_queue(Scsi_Cmnd * cmd, void (*scsi_done) (Scsi_Cmnd *)) ahd_cmd_set_transaction_status(cmd, CAM_RESRC_UNAVAIL); ahd_linux_queue_cmd_complete(ahd, cmd); ahd_schedule_completeq(ahd); - ahd_midlayer_entrypoint_unlock(ahd, &flags); + ahd_unlock(ahd, &flags); printf("%s: aic79xx_linux_queue - Unable to allocate device!\n", ahd_name(ahd)); return (0); @@ -979,7 +979,7 @@ ahd_linux_queue(Scsi_Cmnd * cmd, void (*scsi_done) (Scsi_Cmnd *)) dev->flags |= AHD_DEV_ON_RUN_LIST; ahd_linux_run_device_queues(ahd); } - ahd_midlayer_entrypoint_unlock(ahd, &flags); + ahd_unlock(ahd, &flags); return (0); } diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c index e3892585d7e..89f073a3b76 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.c +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c @@ -2249,6 +2249,8 @@ ahc_linux_queue_recovery_cmd(struct scsi_cmnd *cmd, scb_flag flag) printf(" 0x%x", cmd->cmnd[cdb_byte]); printf("\n"); + spin_lock_irq(&ahc->platform_data->spin_lock); + /* * First determine if we currently own this command. * Start by searching the device queue. If not found @@ -2503,6 +2505,8 @@ done: } spin_lock_irq(&ahc->platform_data->spin_lock); } + + spin_unlock_irq(&ahc->platform_data->spin_lock); return (retval); } -- cgit v1.2.3 From 94d0e7b805961c44e4dc486ffc21075084bb7175 Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Sat, 28 May 2005 07:55:48 -0400 Subject: [SCSI] allow sleeping in ->eh_device_reset_handler() Signed-off-by: James Bottomley --- drivers/scsi/aic7xxx/aic79xx_osm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/scsi/aic7xxx') diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c index 7fc6c76e519..31db0edc7cf 100644 --- a/drivers/scsi/aic7xxx/aic79xx_osm.c +++ b/drivers/scsi/aic7xxx/aic79xx_osm.c @@ -1511,17 +1511,17 @@ ahd_linux_dev_reset(Scsi_Cmnd *cmd) ahd_name(ahd), cmd->device->channel, cmd->device->id, cmd->device->lun, cmd); #endif - ahd_midlayer_entrypoint_lock(ahd, &s); + ahd_lock(ahd, &s); dev = ahd_linux_get_device(ahd, cmd->device->channel, cmd->device->id, cmd->device->lun, /*alloc*/FALSE); if (dev == NULL) { - ahd_midlayer_entrypoint_unlock(ahd, &s); + ahd_unlock(ahd, &s); kfree(recovery_cmd); return (FAILED); } if ((scb = ahd_get_scb(ahd, AHD_NEVER_COL_IDX)) == NULL) { - ahd_midlayer_entrypoint_unlock(ahd, &s); + ahd_unlock(ahd, &s); kfree(recovery_cmd); return (FAILED); } @@ -1570,7 +1570,7 @@ ahd_linux_dev_reset(Scsi_Cmnd *cmd) spin_lock_irq(&ahd->platform_data->spin_lock); ahd_schedule_runq(ahd); ahd_linux_run_complete_queue(ahd); - ahd_midlayer_entrypoint_unlock(ahd, &s); + ahd_unlock(ahd, &s); printf("%s: Device reset returning 0x%x\n", ahd_name(ahd), retval); return (retval); } -- cgit v1.2.3 From 68b3aa7c9805aee9005a8ca53c5e99177961fbb9 Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Sat, 28 May 2005 07:56:31 -0400 Subject: [SCSI] allow sleeping in ->eh_bus_reset_handler() Signed-off-by: James Bottomley --- drivers/scsi/aic7xxx/aic79xx_osm.c | 4 ++-- drivers/scsi/aic7xxx/aic7xxx_osm.c | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'drivers/scsi/aic7xxx') diff --git a/drivers/scsi/aic7xxx/aic79xx_osm.c b/drivers/scsi/aic7xxx/aic79xx_osm.c index 31db0edc7cf..53b7b2c15f8 100644 --- a/drivers/scsi/aic7xxx/aic79xx_osm.c +++ b/drivers/scsi/aic7xxx/aic79xx_osm.c @@ -1591,11 +1591,11 @@ ahd_linux_bus_reset(Scsi_Cmnd *cmd) printf("%s: Bus reset called for cmd %p\n", ahd_name(ahd), cmd); #endif - ahd_midlayer_entrypoint_lock(ahd, &s); + ahd_lock(ahd, &s); found = ahd_reset_channel(ahd, cmd->device->channel + 'A', /*initiate reset*/TRUE); ahd_linux_run_complete_queue(ahd); - ahd_midlayer_entrypoint_unlock(ahd, &s); + ahd_unlock(ahd, &s); if (bootverbose) printf("%s: SCSI bus reset delivered. " diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c index 89f073a3b76..b89094db14c 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.c +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c @@ -829,10 +829,14 @@ ahc_linux_bus_reset(struct scsi_cmnd *cmd) { struct ahc_softc *ahc; int found; + unsigned long flags; ahc = *(struct ahc_softc **)cmd->device->host->hostdata; + + ahc_lock(ahc, &flags); found = ahc_reset_channel(ahc, cmd->device->channel + 'A', /*initiate reset*/TRUE); + ahc_unlock(ahc, &flags); if (bootverbose) printf("%s: SCSI bus reset delivered. " -- cgit v1.2.3