Commit f8aea200 authored by Linus Torvalds's avatar Linus Torvalds

Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (21 commits)
  [SCSI] sd: fix computation of the full size of the device
  [SCSI] lib: string_get_size(): don't hang on zero; no decimals on exact
  [SCSI] sun3x_esp: Convert && to ||
  [SCSI] sd: remove command-size switching code
  [SCSI] 3w-9xxx: remove unnecessary local_irq_save/restore for scsi sg copy API
  [SCSI] 3w-xxxx: remove unnecessary local_irq_save/restore for scsi sg copy API
  [SCSI] fix netlink kernel-doc
  [SCSI] sd: Fix handling of NO_SENSE check condition
  [SCSI] export busy state via q->lld_busy_fn()
  [SCSI] refactor sdev/starget/shost busy checking
  [SCSI] mptfusion: Increase scsi-timeouts, similariy to the LSI 4.x driver.
  [SCSI] aic7xxx: Take the LED out of diagnostic mode on PM resume
  [SCSI] aic79xx: user visible misuse wrong SI units (not disk size!)
  [SCSI] ipr: use memory_read_from_buffer()
  [SCSI] aic79xx: fix shadowed variables
  [SCSI] aic79xx: fix shadowed variables, add statics
  [SCSI] aic7xxx: update *_shipped files
  [SCSI] aic7xxx: update .reg files
  [SCSI] aic7xxx: introduce "dont_generate_debug_code" keyword in aicasm parser
  [SCSI] scsi_dh: Initialize path state to be passive when path is not owned
  ...
parents c3c9897c 520a2c27
......@@ -1760,10 +1760,9 @@ mptscsih_get_tm_timeout(MPT_ADAPTER *ioc)
case FC:
return 40;
case SAS:
return 10;
case SPI:
default:
return 2;
return 10;
}
}
......
......@@ -1924,12 +1924,9 @@ static void twa_scsiop_execute_scsi_complete(TW_Device_Extension *tw_dev, int re
(cmd->sc_data_direction == DMA_FROM_DEVICE ||
cmd->sc_data_direction == DMA_BIDIRECTIONAL)) {
if (scsi_sg_count(cmd) == 1) {
unsigned long flags;
void *buf = tw_dev->generic_buffer_virt[request_id];
local_irq_save(flags);
scsi_sg_copy_from_buffer(cmd, buf, TW_SECTOR_SIZE);
local_irq_restore(flags);
}
}
} /* End twa_scsiop_execute_scsi_complete() */
......
......@@ -1466,12 +1466,7 @@ static int tw_scsiop_inquiry(TW_Device_Extension *tw_dev, int request_id)
static void tw_transfer_internal(TW_Device_Extension *tw_dev, int request_id,
void *data, unsigned int len)
{
struct scsi_cmnd *cmd = tw_dev->srb[request_id];
unsigned long flags;
local_irq_save(flags);
scsi_sg_copy_from_buffer(cmd, data, len);
local_irq_restore(flags);
scsi_sg_copy_from_buffer(tw_dev->srb[request_id], data, len);
}
/* This function is called by the isr to complete an inquiry command */
......
This diff is collapsed.
......@@ -2472,8 +2472,6 @@ ahd_handle_scsiint(struct ahd_softc *ahd, u_int intstat)
if ((ahd->bugs & AHD_CLRLQO_AUTOCLR_BUG) != 0)
ahd_outb(ahd, CLRLQOINT1, 0);
} else if ((status & SELTO) != 0) {
u_int scbid;
/* Stop the selection */
ahd_outb(ahd, SCSISEQ0, 0);
......@@ -2583,9 +2581,6 @@ ahd_handle_scsiint(struct ahd_softc *ahd, u_int intstat)
case BUSFREE_DFF0:
case BUSFREE_DFF1:
{
u_int scbid;
struct scb *scb;
mode = busfreetime == BUSFREE_DFF0
? AHD_MODE_DFF0 : AHD_MODE_DFF1;
ahd_set_modes(ahd, mode, mode);
......@@ -3689,7 +3684,7 @@ ahd_free_tstate(struct ahd_softc *ahd, u_int scsi_id, char channel, int force)
* by the capabilities of the bus connectivity of and sync settings for
* the target.
*/
void
static void
ahd_devlimited_syncrate(struct ahd_softc *ahd,
struct ahd_initiator_tinfo *tinfo,
u_int *period, u_int *ppr_options, role_t role)
......@@ -4136,7 +4131,7 @@ ahd_update_neg_table(struct ahd_softc *ahd, struct ahd_devinfo *devinfo,
/*
* Harpoon2A assumed that there would be a
* fallback rate between 160MHz and 80Mhz,
* fallback rate between 160MHz and 80MHz,
* so 7 is used as the period factor rather
* than 8 for 160MHz.
*/
......@@ -8708,7 +8703,7 @@ ahd_reset_current_bus(struct ahd_softc *ahd)
int
ahd_reset_channel(struct ahd_softc *ahd, char channel, int initiate_reset)
{
struct ahd_devinfo devinfo;
struct ahd_devinfo caminfo;
u_int initiator;
u_int target;
u_int max_scsiid;
......@@ -8729,7 +8724,7 @@ ahd_reset_channel(struct ahd_softc *ahd, char channel, int initiate_reset)
ahd->pending_device = NULL;
ahd_compile_devinfo(&devinfo,
ahd_compile_devinfo(&caminfo,
CAM_TARGET_WILDCARD,
CAM_TARGET_WILDCARD,
CAM_LUN_WILDCARD,
......@@ -8868,7 +8863,7 @@ ahd_reset_channel(struct ahd_softc *ahd, char channel, int initiate_reset)
}
/* Notify the XPT that a bus reset occurred */
ahd_send_async(ahd, devinfo.channel, CAM_TARGET_WILDCARD,
ahd_send_async(ahd, caminfo.channel, CAM_TARGET_WILDCARD,
CAM_LUN_WILDCARD, AC_BUS_RESET);
ahd_restart(ahd);
......
......@@ -223,10 +223,10 @@ static const char *pci_bus_modes[] =
"PCI bus mode unknown",
"PCI bus mode unknown",
"PCI bus mode unknown",
"PCI-X 101-133Mhz",
"PCI-X 67-100Mhz",
"PCI-X 50-66Mhz",
"PCI 33 or 66Mhz"
"PCI-X 101-133MHz",
"PCI-X 67-100MHz",
"PCI-X 50-66MHz",
"PCI 33 or 66MHz"
};
#define TESTMODE 0x00000800ul
......@@ -337,8 +337,6 @@ ahd_pci_config(struct ahd_softc *ahd, const struct ahd_pci_identity *entry)
* 64bit bus (PCI64BIT set in devconfig).
*/
if ((ahd->flags & (AHD_39BIT_ADDRESSING|AHD_64BIT_ADDRESSING)) != 0) {
uint32_t devconfig;
if (bootverbose)
printf("%s: Enabling 39Bit Addressing\n",
ahd_name(ahd));
......@@ -483,8 +481,6 @@ ahd_pci_test_register_access(struct ahd_softc *ahd)
goto fail;
if ((ahd_inb(ahd, INTSTAT) & PCIINT) != 0) {
u_int targpcistat;
ahd_set_modes(ahd, AHD_MODE_CFG, AHD_MODE_CFG);
targpcistat = ahd_inb(ahd, TARGPCISTAT);
if ((targpcistat & STA) != 0)
......
This diff is collapsed.
This diff is collapsed.
......@@ -814,6 +814,7 @@ ahc_intr(struct ahc_softc *ahc)
static void
ahc_restart(struct ahc_softc *ahc)
{
uint8_t sblkctl;
ahc_pause(ahc);
......@@ -868,6 +869,12 @@ ahc_restart(struct ahc_softc *ahc)
ahc_outb(ahc, SEQADDR0, 0);
ahc_outb(ahc, SEQADDR1, 0);
/*
* Take the LED out of diagnostic mode on PM resume, too
*/
sblkctl = ahc_inb(ahc, SBLKCTL);
ahc_outb(ahc, SBLKCTL, (sblkctl & ~(DIAGLEDEN|DIAGLEDON)));
ahc_unpause(ahc);
}
......
This diff is collapsed.
......@@ -147,6 +147,8 @@ void yyerror(const char *string);
%token T_ACCESS_MODE
%token T_DONT_GENERATE_DEBUG_CODE
%token T_MODES
%token T_DEFINE
......@@ -357,6 +359,7 @@ reg_attribute:
| size
| count
| access_mode
| dont_generate_debug_code
| modes
| field_defn
| enum_defn
......@@ -410,6 +413,13 @@ access_mode:
}
;
dont_generate_debug_code:
T_DONT_GENERATE_DEBUG_CODE
{
cur_symbol->dont_generate_debug_code = 1;
}
;
modes:
T_MODES mode_list
{
......
......@@ -164,6 +164,7 @@ download { return T_DOWNLOAD; }
address { return T_ADDRESS; }
count { return T_COUNT; }
access_mode { return T_ACCESS_MODE; }
dont_generate_debug_code { return T_DONT_GENERATE_DEBUG_CODE; }
modes { return T_MODES; }
RW|RO|WO {
if (strcmp(yytext, "RW") == 0)
......
......@@ -539,6 +539,9 @@ symtable_dump(FILE *ofile, FILE *dfile)
aic_print_include(dfile, stock_include_file);
SLIST_FOREACH(curnode, &registers, links) {
if (curnode->symbol->dont_generate_debug_code)
continue;
switch(curnode->symbol->type) {
case REGISTER:
case SCBLOC:
......
......@@ -137,7 +137,8 @@ typedef struct symbol {
struct label_info *linfo;
struct cond_info *condinfo;
struct macro_info *macroinfo;
}info;
} info;
int dont_generate_debug_code;
} symbol_t;
typedef struct symbol_ref {
......
......@@ -401,6 +401,9 @@ static int check_ownership(struct scsi_device *sdev, struct rdac_dh_data *h)
}
}
if (h->lun_state == RDAC_LUN_UNOWNED)
h->state = RDAC_STATE_PASSIVE;
return err;
}
......
......@@ -2456,20 +2456,14 @@ static ssize_t ipr_read_trace(struct kobject *kobj,
struct Scsi_Host *shost = class_to_shost(dev);
struct ipr_ioa_cfg *ioa_cfg = (struct ipr_ioa_cfg *)shost->hostdata;
unsigned long lock_flags = 0;
int size = IPR_TRACE_SIZE;
char *src = (char *)ioa_cfg->trace;
if (off > size)
return 0;
if (off + count > size) {
size -= off;
count = size;
}
ssize_t ret;
spin_lock_irqsave(ioa_cfg->host->host_lock, lock_flags);
memcpy(buf, &src[off], count);
ret = memory_read_from_buffer(buf, count, &off, ioa_cfg->trace,
IPR_TRACE_SIZE);
spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags);
return count;
return ret;
}
static struct bin_attribute ipr_trace_attr = {
......
......@@ -529,6 +529,14 @@ static void scsi_single_lun_run(struct scsi_device *current_sdev)
spin_unlock_irqrestore(shost->host_lock, flags);
}
static inline int scsi_device_is_busy(struct scsi_device *sdev)
{
if (sdev->device_busy >= sdev->queue_depth || sdev->device_blocked)
return 1;
return 0;
}
static inline int scsi_target_is_busy(struct scsi_target *starget)
{
return ((starget->can_queue > 0 &&
......@@ -536,6 +544,15 @@ static inline int scsi_target_is_busy(struct scsi_target *starget)
starget->target_blocked);
}
static inline int scsi_host_is_busy(struct Scsi_Host *shost)
{
if ((shost->can_queue > 0 && shost->host_busy >= shost->can_queue) ||
shost->host_blocked || shost->host_self_blocked)
return 1;
return 0;
}
/*
* Function: scsi_run_queue()
*
......@@ -558,11 +575,7 @@ static void scsi_run_queue(struct request_queue *q)
scsi_single_lun_run(sdev);
spin_lock_irqsave(shost->host_lock, flags);
while (!list_empty(&shost->starved_list) &&
!shost->host_blocked && !shost->host_self_blocked &&
!((shost->can_queue > 0) &&
(shost->host_busy >= shost->can_queue))) {
while (!list_empty(&shost->starved_list) && !scsi_host_is_busy(shost)) {
int flagset;
/*
......@@ -1348,8 +1361,6 @@ int scsi_prep_fn(struct request_queue *q, struct request *req)
static inline int scsi_dev_queue_ready(struct request_queue *q,
struct scsi_device *sdev)
{
if (sdev->device_busy >= sdev->queue_depth)
return 0;
if (sdev->device_busy == 0 && sdev->device_blocked) {
/*
* unblock after device_blocked iterates to zero
......@@ -1363,7 +1374,7 @@ static inline int scsi_dev_queue_ready(struct request_queue *q,
return 0;
}
}
if (sdev->device_blocked)
if (scsi_device_is_busy(sdev))
return 0;
return 1;
......@@ -1440,8 +1451,7 @@ static inline int scsi_host_queue_ready(struct request_queue *q,
return 0;
}
}
if ((shost->can_queue > 0 && shost->host_busy >= shost->can_queue) ||
shost->host_blocked || shost->host_self_blocked) {
if (scsi_host_is_busy(shost)) {
if (list_empty(&sdev->starved_entry))
list_add_tail(&sdev->starved_entry, &shost->starved_list);
return 0;
......@@ -1454,6 +1464,37 @@ static inline int scsi_host_queue_ready(struct request_queue *q,
return 1;
}
/*
* Busy state exporting function for request stacking drivers.
*
* For efficiency, no lock is taken to check the busy state of
* shost/starget/sdev, since the returned value is not guaranteed and
* may be changed after request stacking drivers call the function,
* regardless of taking lock or not.
*
* When scsi can't dispatch I/Os anymore and needs to kill I/Os
* (e.g. !sdev), scsi needs to return 'not busy'.
* Otherwise, request stacking drivers may hold requests forever.
*/
static int scsi_lld_busy(struct request_queue *q)
{
struct scsi_device *sdev = q->queuedata;
struct Scsi_Host *shost;
struct scsi_target *starget;
if (!sdev)
return 0;
shost = sdev->host;
starget = scsi_target(sdev);
if (scsi_host_in_recovery(shost) || scsi_host_is_busy(shost) ||
scsi_target_is_busy(starget) || scsi_device_is_busy(sdev))
return 1;
return 0;
}
/*
* Kill a request for a dead device
*/
......@@ -1757,6 +1798,7 @@ struct request_queue *scsi_alloc_queue(struct scsi_device *sdev)
blk_queue_prep_rq(q, scsi_prep_fn);
blk_queue_softirq_done(q, scsi_softirq_done);
blk_queue_rq_timed_out(q, scsi_times_out);
blk_queue_lld_busy(q, scsi_lld_busy);
return q;
}
......@@ -2105,22 +2147,21 @@ scsi_test_unit_ready(struct scsi_device *sdev, int timeout, int retries,
do {
result = scsi_execute_req(sdev, cmd, DMA_NONE, NULL, 0, sshdr,
timeout, retries);
} while ((driver_byte(result) & DRIVER_SENSE) &&
sshdr && sshdr->sense_key == UNIT_ATTENTION &&
--retries);
if (sdev->removable && scsi_sense_valid(sshdr) &&
sshdr->sense_key == UNIT_ATTENTION)
sdev->changed = 1;
} while (scsi_sense_valid(sshdr) &&
sshdr->sense_key == UNIT_ATTENTION && --retries);
if (!sshdr)
/* could not allocate sense buffer, so can't process it */
return result;
if ((driver_byte(result) & DRIVER_SENSE) && sdev->removable) {
if ((scsi_sense_valid(sshdr)) &&
((sshdr->sense_key == UNIT_ATTENTION) ||
(sshdr->sense_key == NOT_READY))) {
sdev->changed = 1;
result = 0;
}
if (sdev->removable && scsi_sense_valid(sshdr) &&
(sshdr->sense_key == UNIT_ATTENTION ||
sshdr->sense_key == NOT_READY)) {
sdev->changed = 1;
result = 0;
}
if (!sshdr_external)
kfree(sshdr);
......
......@@ -205,16 +205,13 @@ static struct notifier_block scsi_netlink_notifier = {
};
/**
/*
* GENERIC SCSI transport receive and event handlers
**/
*/
/**
* scsi_generic_msg_handler - receive message handler for GENERIC transport
* messages
*
* scsi_generic_msg_handler - receive message handler for GENERIC transport messages
* @skb: socket receive buffer
*
**/
static int
scsi_generic_msg_handler(struct sk_buff *skb)
......
......@@ -1049,7 +1049,6 @@ static int sd_done(struct scsi_cmnd *SCpnt)
good_bytes = sd_completed_bytes(SCpnt);
break;
case RECOVERED_ERROR:
case NO_SENSE:
/* Inform the user, but make sure that it's not treated
* as a hard error.
*/
......@@ -1058,6 +1057,15 @@ static int sd_done(struct scsi_cmnd *SCpnt)
memset(SCpnt->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
good_bytes = scsi_bufflen(SCpnt);
break;
case NO_SENSE:
/* This indicates a false check condition, so ignore it. An
* unknown amount of data was transferred so treat it as an
* error.
*/
scsi_print_sense("sd", SCpnt);
SCpnt->result = 0;
memset(SCpnt->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
break;
case ABORTED_COMMAND:
if (sshdr.asc == 0x10) { /* DIF: Disk detected corruption */
scsi_print_result(SCpnt);
......@@ -1071,15 +1079,6 @@ static int sd_done(struct scsi_cmnd *SCpnt)
scsi_print_sense("sd", SCpnt);
good_bytes = sd_completed_bytes(SCpnt);
}
if (!scsi_device_protection(SCpnt->device) &&
SCpnt->device->use_10_for_rw &&
(SCpnt->cmnd[0] == READ_10 ||
SCpnt->cmnd[0] == WRITE_10))
SCpnt->device->use_10_for_rw = 0;
if (SCpnt->device->use_10_for_ms &&
(SCpnt->cmnd[0] == MODE_SENSE_10 ||
SCpnt->cmnd[0] == MODE_SELECT_10))
SCpnt->device->use_10_for_ms = 0;
break;
default:
break;
......@@ -1432,7 +1431,7 @@ sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer)
{
char cap_str_2[10], cap_str_10[10];
u64 sz = sdkp->capacity << ffz(~sector_size);
u64 sz = (u64)sdkp->capacity << ilog2(sector_size);
string_get_size(sz, STRING_UNITS_2, cap_str_2,
sizeof(cap_str_2));
......
......@@ -213,7 +213,7 @@ static int __devinit esp_sun3x_probe(struct platform_device *dev)
esp->ops = &sun3x_esp_ops;
res = platform_get_resource(dev, IORESOURCE_MEM, 0);
if (!res && !res->start)
if (!res || !res->start)
goto fail_unlink;
esp->regs = ioremap_nocache(res->start, 0x20);
......@@ -221,7 +221,7 @@ static int __devinit esp_sun3x_probe(struct platform_device *dev)
goto fail_unmap_regs;
res = platform_get_resource(dev, IORESOURCE_MEM, 1);
if (!res && !res->start)
if (!res || !res->start)
goto fail_unmap_regs;
esp->dma_regs = ioremap_nocache(res->start, 0x10);
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment