-#define ASC_VERSION "3.3K" /* AdvanSys Driver Version */
+#define ASC_VERSION "3.3GJ" /* AdvanSys Driver Version */
/*
* advansys.c - Linux Host Driver for AdvanSys SCSI Adapters
1. change select_queue_depths to slave_configure
2. make cmd_per_lun be sane again
- 3.3K [2004/06/24]:
- 1. continuing cleanup for lk 2.6 series
- 2. Fix problem in lk 2.6.7-bk2 that broke PCI wide cards
- 3. Fix problem that oopsed ISA cards
-
I. Known Problems/Fix List (XXX)
1. Need to add memory mapping workaround. Test the memory mapping.
#include <asm/system.h>
#include <asm/dma.h>
-/* FIXME: (by jejb@steeleye.com) This warning is present for two
- * reasons:
- *
- * 1) This driver badly needs converting to the correct driver model
- * probing API
- *
- * 2) Although all of the necessary command mapping places have the
- * appropriate dma_map.. APIs, the driver still processes its internal
- * queue using bus_to_virt() and virt_to_bus() which are illegal under
- * the API. The entire queue processing structure will need to be
- * altered to fix this.
- */
-#warning this driver is still not properly converted to the DMA API
-
-#include <scsi/scsi_cmnd.h>
-#include <scsi/scsi_device.h>
-#include <scsi/scsi.h>
+#include "scsi.h"
#include <scsi/scsi_host.h>
#include "advansys.h"
#ifdef CONFIG_PCI
#define ASC_BUSY 0
#define ASC_ERROR (-1)
-/* struct scsi_cmnd function return codes */
+/* Scsi_Cmnd function return codes */
#define STATUS_BYTE(byte) (byte)
#define MSG_BYTE(byte) ((byte) << 8)
#define HOST_BYTE(byte) ((byte) << 16)
* REQPTIME(reqp) - reqp's time stamp value
* REQTIMESTAMP() - system time stamp value
*/
-typedef struct scsi_cmnd REQ, *REQP;
+typedef Scsi_Cmnd REQ, *REQP;
#define REQPNEXT(reqp) ((REQP) ((reqp)->host_scribble))
#define REQPNEXTP(reqp) ((REQP *) &((reqp)->host_scribble))
#define REQPTID(reqp) ((reqp)->device->id)
typedef struct adv_req {
ADV_SCSI_REQ_Q scsi_req_q; /* Adv Library request structure. */
uchar align[32]; /* Request structure padding. */
- struct scsi_cmnd *cmndp; /* Mid-Level SCSI command pointer. */
+ Scsi_Cmnd *cmndp; /* Mid-Level SCSI command pointer. */
adv_sgblk_t *sgblkp; /* Adv Library scatter-gather pointer. */
struct adv_req *next_reqp; /* Next Request Structure. */
} adv_req_t;
asc_queue_t waiting; /* Waiting command queue */
asc_queue_t done; /* Done command queue */
ADV_SCSI_BIT_ID_TYPE init_tidmask; /* Target init./valid mask */
- struct scsi_device *device[ADV_MAX_TID+1]; /* Mid-Level Scsi Device */
+ Scsi_Device *device[ADV_MAX_TID+1]; /* Mid-Level Scsi Device */
ushort reqcnt[ADV_MAX_TID+1]; /* Starvation request count */
ADV_SCSI_BIT_ID_TYPE queue_full; /* Queue full mask */
ushort queue_full_cnt[ADV_MAX_TID+1]; /* Queue full count */
*/
STATIC irqreturn_t advansys_interrupt(int, void *, struct pt_regs *);
-STATIC int advansys_slave_configure(struct scsi_device *);
-STATIC void asc_scsi_done_list(struct scsi_cmnd *);
-STATIC int asc_execute_scsi_cmnd(struct scsi_cmnd *);
-STATIC int asc_build_req(asc_board_t *, struct scsi_cmnd *);
-STATIC int adv_build_req(asc_board_t *, struct scsi_cmnd *, ADV_SCSI_REQ_Q **);
-STATIC int adv_get_sglist(asc_board_t *, adv_req_t *, struct scsi_cmnd *, int);
+STATIC int advansys_slave_configure(Scsi_Device *);
+STATIC void asc_scsi_done_list(Scsi_Cmnd *);
+STATIC int asc_execute_scsi_cmnd(Scsi_Cmnd *);
+STATIC int asc_build_req(asc_board_t *, Scsi_Cmnd *);
+STATIC int adv_build_req(asc_board_t *, Scsi_Cmnd *, ADV_SCSI_REQ_Q **);
+STATIC int adv_get_sglist(asc_board_t *, adv_req_t *, Scsi_Cmnd *, int);
STATIC void asc_isr_callback(ASC_DVC_VAR *, ASC_QDONE_INFO *);
STATIC void adv_isr_callback(ADV_DVC_VAR *, ADV_SCSI_REQ_Q *);
STATIC void adv_async_callback(ADV_DVC_VAR *, uchar);
/* Debug function prototypes. */
#ifdef ADVANSYS_DEBUG
STATIC void asc_prt_scsi_host(struct Scsi_Host *);
-STATIC void asc_prt_scsi_cmnd(struct scsi_cmnd *);
+STATIC void asc_prt_scsi_cmnd(Scsi_Cmnd *);
STATIC void asc_prt_asc_dvc_cfg(ASC_DVC_CFG *);
STATIC void asc_prt_asc_dvc_var(ASC_DVC_VAR *);
STATIC void asc_prt_asc_scsi_q(ASC_SCSI_Q *);
* and scsi_free().
*/
int __init
-advansys_detect(struct scsi_host_template *tpnt)
+advansys_detect(Scsi_Host_Template *tpnt)
{
static int detect_called = ASC_FALSE;
int iop;
* in the 'scp' result field.
*/
int
-advansys_queuecommand(struct scsi_cmnd *scp, void (*done)(struct scsi_cmnd *))
+advansys_queuecommand(Scsi_Cmnd *scp, void (*done)(Scsi_Cmnd *))
{
struct Scsi_Host *shp;
asc_board_t *boardp;
ulong flags;
- struct scsi_cmnd *done_scp;
+ Scsi_Cmnd *done_scp;
shp = scp->device->host;
boardp = ASC_BOARDP(shp);
* required. Returns SUCCESS or FAILED.
*/
int
-advansys_reset(struct scsi_cmnd *scp)
+advansys_reset(Scsi_Cmnd *scp)
{
struct Scsi_Host *shp;
asc_board_t *boardp;
ASC_DVC_VAR *asc_dvc_varp;
ADV_DVC_VAR *adv_dvc_varp;
ulong flags;
- struct scsi_cmnd *done_scp = NULL, *last_scp = NULL;
- struct scsi_cmnd *tscp, *new_last_scp;
+ Scsi_Cmnd *done_scp = NULL, *last_scp = NULL;
+ Scsi_Cmnd *tscp, *new_last_scp;
int status;
int ret = SUCCESS;
* --- Loadable Driver Support
*/
-static struct scsi_host_template driver_template = {
+static Scsi_Host_Template driver_template = {
.proc_name = "advansys",
#ifdef CONFIG_PROC_FS
.proc_info = advansys_proc_info,
ulong flags;
int i;
asc_board_t *boardp;
- struct scsi_cmnd *done_scp = NULL, *last_scp = NULL;
- struct scsi_cmnd *new_last_scp;
+ Scsi_Cmnd *done_scp = NULL, *last_scp = NULL;
+ Scsi_Cmnd *new_last_scp;
struct Scsi_Host *shp;
ASC_DBG(1, "advansys_interrupt: begin\n");
* specified host adapter.
*/
STATIC int
-advansys_slave_configure(struct scsi_device *device)
+advansys_slave_configure(Scsi_Device *device)
{
asc_board_t *boardp;
* Interrupts can be enabled on entry.
*/
STATIC void
-asc_scsi_done_list(struct scsi_cmnd *scp)
+asc_scsi_done_list(Scsi_Cmnd *scp)
{
- struct scsi_cmnd *tscp;
+ Scsi_Cmnd *tscp;
ASC_DBG(2, "asc_scsi_done_list: begin\n");
while (scp != NULL) {
* host driver fields:
* SCp - Scsi_Pointer used for command processing status
* scsi_done - used to save caller's done function
- * host_scribble - used for pointer to another struct scsi_cmnd
+ * host_scribble - used for pointer to another Scsi_Cmnd
*
* If this function returns ASC_NOERROR the request has been enqueued
* on the board's 'active' queue and will be completed from the
* caller on the target's waiting queue and re-tried later.
*/
STATIC int
-asc_execute_scsi_cmnd(struct scsi_cmnd *scp)
+asc_execute_scsi_cmnd(Scsi_Cmnd *scp)
{
asc_board_t *boardp;
ASC_DVC_VAR *asc_dvc_varp;
ADV_DVC_VAR *adv_dvc_varp;
ADV_SCSI_REQ_Q *adv_scsiqp;
- struct scsi_device *device;
+ Scsi_Device *device;
int ret;
ASC_DBG2(1, "asc_execute_scsi_cmnd: scp 0x%lx, done 0x%lx\n",
* queue and return ASC_ERROR.
*/
STATIC int
-asc_build_req(asc_board_t *boardp, struct scsi_cmnd *scp)
+asc_build_req(asc_board_t *boardp, Scsi_Cmnd *scp)
{
struct device *dev = boardp->dvc_cfg.asc_dvc_cfg.dev;
memset(&asc_scsi_q, 0, sizeof(ASC_SCSI_Q));
/*
- * Point the ASC_SCSI_Q to the 'struct scsi_cmnd'.
+ * Point the ASC_SCSI_Q to the 'Scsi_Cmnd'.
*/
asc_scsi_q.q2.srb_ptr = ASC_VADDR_TO_U32(scp);
* to little-endian order.
*/
STATIC int
-adv_build_req(asc_board_t *boardp, struct scsi_cmnd *scp,
+adv_build_req(asc_board_t *boardp, Scsi_Cmnd *scp,
ADV_SCSI_REQ_Q **adv_scsiqpp)
{
adv_req_t *reqp;
scsiqp->srb_ptr = ASC_VADDR_TO_U32(reqp);
/*
- * Set the adv_req_t 'cmndp' to point to the struct scsi_cmnd structure.
+ * Set the adv_req_t 'cmndp' to point to the Scsi_Cmnd structure.
*/
reqp->cmndp = scp;
* buffer command.
*/
- scsiqp->data_cnt = cpu_to_le32(scp->request_bufflen);
- scsiqp->vdata_addr = scp->request_buffer;
- scsiqp->data_addr = cpu_to_le32(virt_to_bus(scp->request_buffer));
-
if (scp->use_sg == 0) {
/*
* CDB request of single contiguous buffer.
struct scatterlist *slp;
int use_sg;
+ scsiqp->data_cnt = 0;
+ scsiqp->vdata_addr = 0;
+ scsiqp->data_addr = 0;
+
slp = (struct scatterlist *)scp->request_buffer;
use_sg = dma_map_sg(dev, slp, scp->use_sg, scp->sc_data_direction);
* ADV_ERROR(-1) - SG List creation failed
*/
STATIC int
-adv_get_sglist(asc_board_t *boardp, adv_req_t *reqp, struct scsi_cmnd *scp, int use_sg)
+adv_get_sglist(asc_board_t *boardp, adv_req_t *reqp, Scsi_Cmnd *scp, int use_sg)
{
adv_sgblk_t *sgblkp;
ADV_SCSI_REQ_Q *scsiqp;
asc_isr_callback(ASC_DVC_VAR *asc_dvc_varp, ASC_QDONE_INFO *qdonep)
{
asc_board_t *boardp;
- struct scsi_cmnd *scp;
+ Scsi_Cmnd *scp;
struct Scsi_Host *shp;
int i;
ASC_DBG_PRT_ASC_QDONE_INFO(2, qdonep);
/*
- * Get the struct scsi_cmnd structure and Scsi_Host structure for the
+ * Get the Scsi_Cmnd structure and Scsi_Host structure for the
* command that has been completed.
*/
- scp = (struct scsi_cmnd *) ASC_U32_TO_VADDR(qdonep->d2.srb_ptr);
+ scp = (Scsi_Cmnd *) ASC_U32_TO_VADDR(qdonep->d2.srb_ptr);
ASC_DBG1(1, "asc_isr_callback: scp 0x%lx\n", (ulong) scp);
if (scp == NULL) {
}
/*
- * Because interrupts may be enabled by the 'struct scsi_cmnd' done
+ * Because interrupts may be enabled by the 'Scsi_Cmnd' done
* function, add the command to the end of the board's done queue.
* The done function for the command will be called from
* advansys_interrupt().
asc_board_t *boardp;
adv_req_t *reqp;
adv_sgblk_t *sgblkp;
- struct scsi_cmnd *scp;
+ Scsi_Cmnd *scp;
struct Scsi_Host *shp;
int i;
ADV_DCNT resid_cnt;
}
/*
- * Get the struct scsi_cmnd structure and Scsi_Host structure for the
+ * Get the Scsi_Cmnd structure and Scsi_Host structure for the
* command that has been completed.
*
* Note: The adv_req_t request structure and adv_sgblk_t structure,
}
/*
- * Because interrupts may be enabled by the 'struct scsi_cmnd' done
+ * Because interrupts may be enabled by the 'Scsi_Cmnd' done
* function, add the command to the end of the board's done queue.
* The done function for the command will be called from
* advansys_interrupt().
/*
* Execute as many queued requests as possible for the specified queue.
*
- * Calls asc_execute_scsi_cmnd() to execute a REQP/struct scsi_cmnd.
+ * Calls asc_execute_scsi_cmnd() to execute a REQP/Scsi_Cmnd.
*/
STATIC void
asc_execute_queue(asc_queue_t *ascq)
if (scan_tidmask & ADV_TID_TO_TIDMASK(i)) {
if ((reqp = asc_dequeue(ascq, i)) == NULL) {
scan_tidmask &= ~ADV_TID_TO_TIDMASK(i);
- } else if (asc_execute_scsi_cmnd((struct scsi_cmnd *) reqp)
+ } else if (asc_execute_scsi_cmnd((Scsi_Cmnd *) reqp)
== ASC_BUSY) {
scan_tidmask &= ~ADV_TID_TO_TIDMASK(i);
/*
* asc_prt_scsi_cmnd()
*/
STATIC void
-asc_prt_scsi_cmnd(struct scsi_cmnd *s)
+asc_prt_scsi_cmnd(Scsi_Cmnd *s)
{
- printk("struct scsi_cmnd at addr 0x%lx\n", (ulong) s);
+ printk("Scsi_Cmnd at addr 0x%lx\n", (ulong) s);
printk(
" host 0x%lx, device 0x%lx, target %u, lun %u, channel %u,\n",
" timeout_per_command %d, timeout_total %d, timeout %d\n",
s->timeout_per_command, s->timeout_total, s->timeout);
- printk(" internal_timeout %u\n", s->internal_timeout);
+ printk(
+" internal_timeout %u, flags %u\n",
+ s->internal_timeout, s->flags);
printk(
" scsi_done 0x%lx, done 0x%lx, host_scribble 0x%lx, result 0x%x\n",
ushort pci_device_id;
iop_base = asc_dvc->iop_base;
- if (asc_dvc->cfg->dev)
- pci_device_id = to_pci_dev(asc_dvc->cfg->dev)->device;
- else
- pci_device_id = 0;
+ pci_device_id = to_pci_dev(asc_dvc->cfg->dev)->device;
warn_code = 0;
cfg_msw = AscGetChipCfgMsw(iop_base);
if ((cfg_msw & ASC_CFG_MSW_CLR_MASK) != 0) {