static void AscSetBank(PortAddr, uchar);
static int AscResetChipAndScsiBus(ASC_DVC_VAR *);
#ifdef CONFIG_ISA
-static ushort AscGetIsaDmaChannel(PortAddr);
-static ushort AscSetIsaDmaChannel(PortAddr, ushort);
-static uchar AscSetIsaDmaSpeed(PortAddr, uchar);
static uchar AscGetIsaDmaSpeed(PortAddr);
#endif /* CONFIG_ISA */
static uchar AscReadLramByte(PortAddr, ushort);
static ushort AscGetEisaChipCfg(PortAddr);
#endif /* CONFIG_ISA */
static uchar AscGetChipScsiCtrl(PortAddr);
-static uchar AscSetChipScsiID(PortAddr, uchar);
static uchar AscGetChipVersion(PortAddr, ushort);
-static ushort AscGetChipBusType(PortAddr);
static ASC_DCNT AscLoadMicroCode(PortAddr, ushort, uchar *, ushort);
-static int AscFindSignature(PortAddr);
static void AscToggleIRQAct(PortAddr);
-static uchar AscGetChipIRQ(PortAddr, ushort);
-static uchar AscSetChipIRQ(PortAddr, uchar, ushort);
-static ushort AscGetChipBiosAddress(PortAddr, ushort);
static inline ulong DvcEnterCritical(void);
static inline void DvcLeaveCritical(ulong);
-static ushort AscGetChipBiosAddress(PortAddr, ushort);
static void DvcSleepMilliSecond(ASC_DCNT);
static void DvcDelayNanoSecond(ASC_DVC_VAR *, ASC_DCNT);
static void DvcPutScsiQ(PortAddr, ushort, uchar *, int);
#ifdef CONFIG_ISA
static void AscEnableIsaDma(uchar);
#endif /* CONFIG_ISA */
-static ASC_DCNT AscGetMaxDmaCount(ushort);
static const char *advansys_info(struct Scsi_Host *shost);
/*
static int asc_prt_line(char *, int, char *fmt, ...);
#endif /* CONFIG_PROC_FS */
-/* Declaration for Asc Library internal functions referenced by driver. */
-static int AscFindSignature(PortAddr);
-static ushort AscGetEEPConfig(PortAddr, ASCEEP_CONFIG *, ushort);
-
/* Statistics function prototypes. */
#ifdef ADVANSYS_STATS
#ifdef CONFIG_PROC_FS
cp = boardp->prtbuf;
cplen = asc_prt_adv_bios(shost, cp, ASC_PRTBUF_SIZE);
ASC_ASSERT(cplen < ASC_PRTBUF_SIZE);
- cnt =
- asc_proc_copy(advoffset, offset, curbuf, leftlen, cp,
+ cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp,
cplen);
totcnt += cnt;
leftlen -= cnt;
for (tgt_id = 0; tgt_id <= ADV_MAX_TID; tgt_id++) {
cp = boardp->prtbuf;
cplen = asc_prt_target_stats(shost, tgt_id, cp,
- ASC_PRTBUF_SIZE);
+ ASC_PRTBUF_SIZE);
ASC_ASSERT(cplen <= ASC_PRTBUF_SIZE);
- cnt =
- asc_proc_copy(advoffset, offset, curbuf, leftlen, cp,
- cplen);
+ cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp,
+ cplen);
totcnt += cnt;
leftlen -= cnt;
if (leftlen == 0) {
}
} else {
busname = "?";
- ASC_PRINT2
- ("advansys_info: board %d: unknown bus type %d\n",
- boardp->id, asc_dvc_varp->bus_type);
+ ASC_PRINT2("advansys_info: board %d: unknown "
+ "bus type %d\n", boardp->id,
+ asc_dvc_varp->bus_type);
}
/* Don't reference 'shost->n_io_port'; It may be truncated. */
sprintf(info,
"AdvanSys SCSI %s: %s: IO 0x%lX-0x%lX, IRQ 0x%X",
- ASC_VERSION, busname,
- (ulong)shost->io_port,
+ ASC_VERSION, busname, (ulong)shost->io_port,
(ulong)shost->io_port + boardp->asc_n_io_port -
1, shost->irq);
}
/* Refer to ASC_IERR_* defintions for meaning of 'err_code'. */
if (asc_dvc_varp->err_code) {
- ASC_PRINT2
- ("advansys_reset: board %d: SCSI bus reset error: 0x%x\n",
- boardp->id, asc_dvc_varp->err_code);
+ ASC_PRINT2("advansys_reset: board %d: SCSI bus reset "
+ "error: 0x%x\n", boardp->id,
+ asc_dvc_varp->err_code);
ret = FAILED;
} else if (status) {
- ASC_PRINT2
- ("advansys_reset: board %d: SCSI bus reset warning: 0x%x\n",
- boardp->id, status);
+ ASC_PRINT2("advansys_reset: board %d: SCSI bus reset "
+ "warning: 0x%x\n", boardp->id, status);
} else {
- ASC_PRINT1
- ("advansys_reset: board %d: SCSI bus reset successful.\n",
- boardp->id);
+ ASC_PRINT1("advansys_reset: board %d: SCSI bus reset "
+ "successful.\n", boardp->id);
}
ASC_DBG(1, "advansys_reset: after AscInitAsc1000Driver()\n");
ASC_DBG(1, "advansys_reset: before AdvResetChipAndSB()\n");
switch (AdvResetChipAndSB(adv_dvc_varp)) {
case ASC_TRUE:
- ASC_PRINT1
- ("advansys_reset: board %d: SCSI bus reset successful.\n",
- boardp->id);
+ ASC_PRINT1("advansys_reset: board %d: SCSI bus reset "
+ "successful.\n", boardp->id);
break;
case ASC_FALSE:
default:
- ASC_PRINT1
- ("advansys_reset: board %d: SCSI bus reset error.\n",
- boardp->id);
+ ASC_PRINT1("advansys_reset: board %d: SCSI bus reset "
+ "error.\n", boardp->id);
ret = FAILED;
break;
}
* is returned in 'last_scp'.
*/
if (done_scp == NULL) {
- done_scp =
- asc_dequeue_list(&boardp->active, &last_scp, ASC_TID_ALL);
+ done_scp = asc_dequeue_list(&boardp->active, &last_scp,
+ ASC_TID_ALL);
for (tscp = done_scp; tscp; tscp = REQPNEXT(tscp)) {
tscp->result = HOST_BYTE(DID_RESET);
}
* to DID_RESET.
*/
if (done_scp == NULL) {
- done_scp =
- asc_dequeue_list(&boardp->waiting, &last_scp, ASC_TID_ALL);
+ done_scp = asc_dequeue_list(&boardp->waiting, &last_scp,
+ ASC_TID_ALL);
for (tscp = done_scp; tscp; tscp = REQPNEXT(tscp)) {
tscp->result = HOST_BYTE(DID_RESET);
}
/*
* Complete all the 'done_scp' requests.
*/
- if (done_scp != NULL) {
+ if (done_scp)
asc_scsi_done_list(done_scp);
- }
ASC_DBG1(1, "advansys_reset: ret %d\n", ret);
case ASC_NOERROR:
ASC_STATS(scp->device->host, exe_noerror);
/*
- * Increment monotonically increasing per device successful
- * request counter. Wrapping doesn't matter.
+ * Increment monotonically increasing per device
+ * successful request counter. Wrapping doesn't matter.
*/
boardp->reqcnt[scp->device->id]++;
asc_enqueue(&boardp->active, scp, ASC_BACK);
- ASC_DBG(1,
- "asc_execute_scsi_cmnd: AscExeScsiQueue(), ASC_NOERROR\n");
+ ASC_DBG(1, "asc_execute_scsi_cmnd: AscExeScsiQueue(), "
+ "ASC_NOERROR\n");
break;
case ASC_BUSY:
/*
- * Caller will enqueue request on the target's waiting queue
- * and retry later.
+ * Caller will enqueue request on the target's waiting
+ * queue and retry later.
*/
ASC_STATS(scp->device->host, exe_busy);
break;
case ASC_ERROR:
- ASC_PRINT2
- ("asc_execute_scsi_cmnd: board %d: AscExeScsiQueue() ASC_ERROR, err_code 0x%x\n",
- boardp->id, asc_dvc_varp->err_code);
+ ASC_PRINT2("asc_execute_scsi_cmnd: board %d: "
+ "AscExeScsiQueue() ASC_ERROR, err_code 0x%x\n",
+ boardp->id, asc_dvc_varp->err_code);
ASC_STATS(scp->device->host, exe_error);
scp->result = HOST_BYTE(DID_ERROR);
asc_enqueue(&boardp->done, scp, ASC_BACK);
break;
default:
- ASC_PRINT2
- ("asc_execute_scsi_cmnd: board %d: AscExeScsiQueue() unknown, err_code 0x%x\n",
- boardp->id, asc_dvc_varp->err_code);
+ ASC_PRINT2("asc_execute_scsi_cmnd: board %d: "
+ "AscExeScsiQueue() unknown, err_code 0x%x\n",
+ boardp->id, asc_dvc_varp->err_code);
ASC_STATS(scp->device->host, exe_unknown);
scp->result = HOST_BYTE(DID_ERROR);
asc_enqueue(&boardp->done, scp, ASC_BACK);
*/
switch (adv_build_req(boardp, scp, &adv_scsiqp)) {
case ASC_NOERROR:
- ASC_DBG(3,
- "asc_execute_scsi_cmnd: adv_build_req ASC_NOERROR\n");
+ ASC_DBG(3, "asc_execute_scsi_cmnd: adv_build_req "
+ "ASC_NOERROR\n");
break;
case ASC_BUSY:
- ASC_DBG(1,
- "asc_execute_scsi_cmnd: adv_build_req ASC_BUSY\n");
+ ASC_DBG(1, "asc_execute_scsi_cmnd: adv_build_req "
+ "ASC_BUSY\n");
/*
- * If busy is returned the request has not been enqueued.
- * It will be enqueued by the caller on the target's waiting
- * queue and retried later.
+ * If busy is returned the request has not been
+ * enqueued. It will be enqueued by the caller on the
+ * target's waiting queue and retried later.
*
- * The asc_stats fields 'adv_build_noreq' and 'adv_build_nosg'
- * count wide board busy conditions. They are updated in
- * adv_build_req and adv_get_sglist, respectively.
+ * The asc_stats fields 'adv_build_noreq' and
+ * 'adv_build_nosg' count wide board busy conditions.
+ * They are updated in adv_build_req and
+ * adv_get_sglist, respectively.
*/
return ASC_BUSY;
case ASC_ERROR:
* by the caller.
*/
default:
- ASC_DBG(1,
- "asc_execute_scsi_cmnd: adv_build_req ASC_ERROR\n");
+ ASC_DBG(1, "asc_execute_scsi_cmnd: adv_build_req "
+ "ASC_ERROR\n");
ASC_STATS(scp->device->host, build_error);
return ASC_ERROR;
}
case ASC_NOERROR:
ASC_STATS(scp->device->host, exe_noerror);
/*
- * Increment monotonically increasing per device successful
- * request counter. Wrapping doesn't matter.
+ * Increment monotonically increasing per device
+ * successful request counter. Wrapping doesn't matter.
*/
boardp->reqcnt[scp->device->id]++;
asc_enqueue(&boardp->active, scp, ASC_BACK);
- ASC_DBG(1,
- "asc_execute_scsi_cmnd: AdvExeScsiQueue(), ASC_NOERROR\n");
+ ASC_DBG(1, "asc_execute_scsi_cmnd: AdvExeScsiQueue(), "
+ "ASC_NOERROR\n");
break;
case ASC_BUSY:
/*
- * Caller will enqueue request on the target's waiting queue
- * and retry later.
+ * Caller will enqueue request on the target's waiting
+ * queue and retry later.
*/
ASC_STATS(scp->device->host, exe_busy);
break;
case ASC_ERROR:
- ASC_PRINT2
- ("asc_execute_scsi_cmnd: board %d: AdvExeScsiQueue() ASC_ERROR, err_code 0x%x\n",
- boardp->id, adv_dvc_varp->err_code);
+ ASC_PRINT2("asc_execute_scsi_cmnd: board %d: "
+ "AdvExeScsiQueue() ASC_ERROR, err_code 0x%x\n",
+ boardp->id, adv_dvc_varp->err_code);
ASC_STATS(scp->device->host, exe_error);
scp->result = HOST_BYTE(DID_ERROR);
asc_enqueue(&boardp->done, scp, ASC_BACK);
break;
default:
- ASC_PRINT2
- ("asc_execute_scsi_cmnd: board %d: AdvExeScsiQueue() unknown, err_code 0x%x\n",
- boardp->id, adv_dvc_varp->err_code);
+ ASC_PRINT2("asc_execute_scsi_cmnd: board %d: "
+ "AdvExeScsiQueue() unknown, err_code 0x%x\n",
+ boardp->id, adv_dvc_varp->err_code);
ASC_STATS(scp->device->host, exe_unknown);
scp->result = HOST_BYTE(DID_ERROR);
asc_enqueue(&boardp->done, scp, ASC_BACK);
* is supported.
*/
if (scp->cmd_len > ASC_MAX_CDB_LEN) {
- ASC_PRINT3
- ("asc_build_req: board %d: cmd_len %d > ASC_MAX_CDB_LEN %d\n",
- boardp->id, scp->cmd_len, ASC_MAX_CDB_LEN);
+ ASC_PRINT3("asc_build_req: board %d: cmd_len %d > "
+ "ASC_MAX_CDB_LEN %d\n", boardp->id, scp->cmd_len,
+ ASC_MAX_CDB_LEN);
scp->result = HOST_BYTE(DID_ERROR);
asc_enqueue(&boardp->done, scp, ASC_BACK);
return ASC_ERROR;
* Return the BIOS address of the adapter at the specified
* I/O port and with the specified bus type.
*/
-static ushort __devinit AscGetChipBiosAddress(PortAddr iop_base, ushort bus_type)
+static unsigned short __devinit
+AscGetChipBiosAddress(PortAddr iop_base, unsigned short bus_type)
{
- ushort cfg_lsw;
- ushort bios_addr;
+ unsigned short cfg_lsw;
+ unsigned short bios_addr;
/*
* The PCI BIOS is re-located by the motherboard BIOS. Because
* of this the driver can not determine where a PCI BIOS is
* loaded and executes.
*/
- if (bus_type & ASC_IS_PCI) {
- return (0);
- }
+ if (bus_type & ASC_IS_PCI)
+ return 0;
+
#ifdef CONFIG_ISA
if ((bus_type & ASC_IS_EISA) != 0) {
cfg_lsw = AscGetEisaChipCfg(iop_base);
cfg_lsw &= 0x000F;
- bios_addr = (ushort)(ASC_BIOS_MIN_ADDR +
- (cfg_lsw * ASC_BIOS_BANK_SIZE));
- return (bios_addr);
- } /* if */
+ bios_addr = ASC_BIOS_MIN_ADDR + cfg_lsw * ASC_BIOS_BANK_SIZE;
+ return bios_addr;
+ }
#endif /* CONFIG_ISA */
cfg_lsw = AscGetChipCfgLsw(iop_base);
/*
* ISA PnP uses the top bit as the 32K BIOS flag
*/
- if (bus_type == ASC_IS_ISAPNP) {
+ if (bus_type == ASC_IS_ISAPNP)
cfg_lsw &= 0x7FFF;
- }
- /* if */
- bios_addr = (ushort)(((cfg_lsw >> 12) * ASC_BIOS_BANK_SIZE) +
- ASC_BIOS_MIN_ADDR);
- return (bios_addr);
+ bios_addr = ASC_BIOS_MIN_ADDR + (cfg_lsw >> 12) * ASC_BIOS_BANK_SIZE;
+ return bios_addr;
}
/*
printk(" timeout_per_command %d\n", s->timeout_per_command);
- printk
- (" scsi_done 0x%lx, done 0x%lx, host_scribble 0x%lx, result 0x%x\n",
- (ulong)s->scsi_done, (ulong)s->done, (ulong)s->host_scribble,
- s->result);
+ printk(" scsi_done 0x%p, done 0x%p, host_scribble 0x%p, result 0x%x\n",
+ s->scsi_done, s->done, s->host_scribble, s->result);
printk(" tag %u, pid %u\n", (unsigned)s->tag, (unsigned)s->pid);
}
{
printk("ASC_DVC_VAR at addr 0x%lx\n", (ulong)h);
- printk
- (" iop_base 0x%x, err_code 0x%x, dvc_cntl 0x%x, bug_fix_cntl %d,\n",
- h->iop_base, h->err_code, h->dvc_cntl, h->bug_fix_cntl);
+ printk(" iop_base 0x%x, err_code 0x%x, dvc_cntl 0x%x, bug_fix_cntl "
+ "%d,\n", h->iop_base, h->err_code, h->dvc_cntl, h->bug_fix_cntl);
- printk
- (" bus_type %d, isr_callback 0x%lx, exe_callback 0x%lx, init_sdtr 0x%x,\n",
- h->bus_type, (ulong)h->isr_callback, (ulong)h->exe_callback,
- (unsigned)h->init_sdtr);
+ printk(" bus_type %d, isr_callback 0x%p, exe_callback 0x%p, "
+ "init_sdtr 0x%x,\n", h->bus_type, h->isr_callback,
+ h->exe_callback, (unsigned)h->init_sdtr);
- printk
- (" sdtr_done 0x%x, use_tagged_qng 0x%x, unit_not_ready 0x%x, chip_no 0x%x,\n",
- (unsigned)h->sdtr_done, (unsigned)h->use_tagged_qng,
- (unsigned)h->unit_not_ready, (unsigned)h->chip_no);
+ printk(" sdtr_done 0x%x, use_tagged_qng 0x%x, unit_not_ready 0x%x, "
+ "chip_no 0x%x,\n", (unsigned)h->sdtr_done,
+ (unsigned)h->use_tagged_qng, (unsigned)h->unit_not_ready,
+ (unsigned)h->chip_no);
- printk
- (" queue_full_or_busy 0x%x, start_motor 0x%x, scsi_reset_wait %u,\n",
- (unsigned)h->queue_full_or_busy, (unsigned)h->start_motor,
- (unsigned)h->scsi_reset_wait);
+ printk(" queue_full_or_busy 0x%x, start_motor 0x%x, scsi_reset_wait "
+ "%u,\n", (unsigned)h->queue_full_or_busy,
+ (unsigned)h->start_motor, (unsigned)h->scsi_reset_wait);
- printk
- (" is_in_int %u, max_total_qng %u, cur_total_qng %u, in_critical_cnt %u,\n",
- (unsigned)h->is_in_int, (unsigned)h->max_total_qng,
- (unsigned)h->cur_total_qng, (unsigned)h->in_critical_cnt);
+ printk(" is_in_int %u, max_total_qng %u, cur_total_qng %u, "
+ "in_critical_cnt %u,\n", (unsigned)h->is_in_int,
+ (unsigned)h->max_total_qng, (unsigned)h->cur_total_qng,
+ (unsigned)h->in_critical_cnt);
- printk
- (" last_q_shortage %u, init_state 0x%x, no_scam 0x%x, pci_fix_asyn_xfer 0x%x,\n",
- (unsigned)h->last_q_shortage, (unsigned)h->init_state,
- (unsigned)h->no_scam, (unsigned)h->pci_fix_asyn_xfer);
+ printk(" last_q_shortage %u, init_state 0x%x, no_scam 0x%x, "
+ "pci_fix_asyn_xfer 0x%x,\n", (unsigned)h->last_q_shortage,
+ (unsigned)h->init_state, (unsigned)h->no_scam,
+ (unsigned)h->pci_fix_asyn_xfer);
printk(" cfg 0x%lx, irq_no 0x%x\n", (ulong)h->cfg, (unsigned)h->irq_no);
}
return (AscGetChipScsiID(iop_base));
}
-static uchar __devinit AscGetChipScsiCtrl(PortAddr iop_base)
+static unsigned char __devinit AscGetChipScsiCtrl(PortAddr iop_base)
{
- uchar sc;
+ unsigned char sc;
AscSetBank(iop_base, 1);
sc = inp(iop_base + IOP_REG_SC);
AscSetBank(iop_base, 0);
- return (sc);
+ return sc;
}
-static uchar __devinit AscGetChipVersion(PortAddr iop_base, ushort bus_type)
+static unsigned char __devinit
+AscGetChipVersion(PortAddr iop_base, unsigned short bus_type)
{
- if ((bus_type & ASC_IS_EISA) != 0) {
+ if (bus_type & ASC_IS_EISA) {
PortAddr eisa_iop;
- uchar revision;
+ unsigned char revision;
eisa_iop = (PortAddr) ASC_GET_EISA_SLOT(iop_base) |
(PortAddr) ASC_EISA_REV_IOP_MASK;
revision = inp(eisa_iop);
- return ((uchar)((ASC_CHIP_MIN_VER_EISA - 1) + revision));
+ return ASC_CHIP_MIN_VER_EISA - 1 + revision;
}
- return (AscGetChipVerNo(iop_base));
+ return AscGetChipVerNo(iop_base);
}
static ushort __devinit AscGetChipBusType(PortAddr iop_base)
warn_code |= AscInitAscDvcVar(asc_dvc);
warn_code |= AscInitFromEEP(asc_dvc);
asc_dvc->init_state |= ASC_INIT_STATE_END_GET_CFG;
- if (asc_dvc->scsi_reset_wait > ASC_MAX_SCSI_RESET_WAIT) {
+ if (asc_dvc->scsi_reset_wait > ASC_MAX_SCSI_RESET_WAIT)
asc_dvc->scsi_reset_wait = ASC_MAX_SCSI_RESET_WAIT;
- }
} else {
asc_dvc->err_code = ASC_IERR_BAD_SIGNATURE;
}
- return (warn_code);
+ return warn_code;
}
static ushort __devinit AscInitSetConfig(ASC_DVC_VAR *asc_dvc)
int ret;
/*
- * Adapter found.
- *
* Register the adapter, get its configuration, and
* initialize it.
*/
ASC_DBG(2, "advansys_board_found: scsi_host_alloc()\n");
shost = scsi_host_alloc(&advansys_template, sizeof(asc_board_t));
-
if (!shost)
return NULL;
boardp = ASC_BOARDP(shost);
memset(boardp, 0, sizeof(asc_board_t));
boardp->id = asc_board_count++;
-
- /* Initialize spinlock. */
spin_lock_init(&boardp->lock);
/*
*/
boardp->init_tidmask |=
ADV_TID_TO_TIDMASK(adv_dvc_varp->chip_scsi_id);
-
- /*
- * Finish initializing the 'Scsi_Host' structure.
- */
- shost->irq = adv_dvc_varp->irq_no;
}
/*