RFC: defining sbus dma direction bits in terms of enum dma_data_direction?
We've been able to get rid of most of the scsi_to_pci_dma_dir mess in 2.6 now that both pci and scsi data directions are defined in terms of the generic enum dma_data_direction. Any chance to switch sbus over to using it aswell? And while we're at it, if someone cares for the sbus scsi drivers: any chance to convert them awaya from needing scsi.h and hosts.h in drivers/scsi/ to the <scsi/*.h> headers? It's really just some boring decrufting, mostly killing obsolete typedefs.
Re: RFC: defining sbus dma direction bits in terms of enum
Quoted 1 line · On Mon, 31 May 2004 14:44:55 +0200 Christoph Hellwig <[email protected]> wrote:
Any chance to switch sbus over to using it aswell?
If you submit a patch, I'll integrate it and munge it until it builds :-)
Quoted 4 lines
And while we're at it, if someone cares for the
sbus scsi drivers: any chance to convert them awaya from needingscsi.handhosts.hindrivers/scsi/to the <scsi/*.h> headers? It's really just some boring decrufting, mostly killing obsolete typedefs.
Similarly...
Quoted 7 lines · David S. Miller
Quoted 1 line · On Mon, 31 May 2004 14:44:55 +0200 Christoph Hellwig <[email protected]> wrote:
Any chance to switch sbus over to using it aswell?
If you submit a patch, I'll integrate it and munge it until it builds :-)
Okay, here's a patch to switch sbus dma directions to use the generic bits and kill all three users of scsi_to_sbus_dma direction.
BTW, should we keep the defintion because we're in stable series, or does sbus not count as published interface? :)
drivers/fc4/fc.c +20 -23
@@ -59,8 +59,6 @@#define dma_unmap_single (d,h,s,dir) sbus_unmap_single(d,h,s,dir)#define dma_map_sg (d,s,n,dir) sbus_map_sg(d,s,n,dir)#define dma_unmap_sg (d,s,n,dir) sbus_unmap_sg(d,s,n,dir) -#define scsi_to_fc_dma_dir (dir) scsi_to_sbus_dma_dir(dir) -#define FC_DMA_BIDIRECTIONAL SBUS_DMA_BIDIRECTIONAL#else #define dma_alloc_consistent (d,s,p) pci_alloc_consistent(d,s,p)#define dma_free_consistent (d,s,v,h) pci_free_consistent(d,s,v,h)
@@ -68,8 +66,6 @@#define dma_unmap_single (d,h,s,dir) pci_unmap_single(d,h,s,dir)#define dma_map_sg (d,s,n,dir) pci_map_sg(d,s,n,dir)#define dma_unmap_sg (d,s,n,dir) pci_unmap_sg(d,s,n,dir) -#define scsi_to_fc_dma_dir (dir) scsi_to_pci_dma_dir(dir) -#define FC_DMA_BIDIRECTIONAL PCI_DMA_BIDIRECTIONAL#endif #define FCP_CMND (SCpnt) ((fcp_cmnd *)&(SCpnt->SCp))
@@ -167,7 +163,7 @@ fcmd = l->fcmds + i; plogi = l->logi +3 * i;dma_unmap_single (fc->dev, fcmd->cmd,3 *sizeof (logi), -FC_DMA_BIDIRECTIONAL ); +DMA_BIDIRECTIONAL ); plogi->code =LS_PLOGI ;memcpy (&plogi->nport_wwn, &fc->wwn_nport,sizeof (fc_wwn));memcpy (&plogi->node_wwn, &fc->wwn_node,sizeof (fc_wwn));
@@ -188,7 +184,7 @@ }#endif fcmd->cmd =dma_map_single (fc->dev, plogi,3 *sizeof (logi), -FC_DMA_BIDIRECTIONAL ); +DMA_BIDIRECTIONAL ); fcmd->rsp = fcmd->cmd +2 *sizeof (logi);if (fc->hw_enque (fc, fcmd))printk ("FC: Cannot enque PLOGI packet on %s\n" , fc->name);
@@ -212,7 +208,7 @@case FC_STATUS_OK : plogi = l->logi +3 * i;dma_unmap_single (fc->dev, l->fcmds[i].cmd,3 *sizeof (logi), -FC_DMA_BIDIRECTIONAL ); +DMA_BIDIRECTIONAL );if (!fc->wwn_dest.lo && !fc->wwn_dest.hi) {memcpy (&fc->wwn_dest, &plogi[1 ].node_wwn,sizeof (fc_wwn));FCD (("Dest WWN %08x%08x\n" , *(u32 *)&fc->wwn_dest, fc->wwn_dest.lo))
@@ -231,7 +227,7 @@case FC_STATUS_ERR_OFFLINE : fc->state =FC_STATE_OFFLINE ;dma_unmap_single (fc->dev, l->fcmds[i].cmd,3 *sizeof (logi), -FC_DMA_BIDIRECTIONAL ); + _DMA_BIDIRECTIONAL);printk ("%s: FC is offline\n" , fc->name);if (atomic_dec_and_test (&l->todo))up (&l->sem);
@@ -256,7 +252,7 @@switch (status) {case FC_STATUS_OK :/* Ok, let's have a fun on a loop */ dma_unmap_single (fc->dev, l->fcmds[i].cmd,3 *sizeof (logi), -FC_DMA_BIDIRECTIONAL ); +DMA_BIDIRECTIONAL ); p = (fc_al_posmap *)(l->logi +3 * i);#ifdef FCDEBUG {
@@ -306,7 +302,7 @@FCD (("SID %d DID %d\n" , fc->sid, fc->did)) fcmd = l->fcmds + i;dma_unmap_single (fc->dev, fcmd->cmd,3 *sizeof (logi), -FC_DMA_BIDIRECTIONAL ); +DMA_BIDIRECTIONAL ); fch = &fcmd->fch;memset (l->logi +3 * i,0 ,3 *sizeof (logi));FILL_FCHDR_RCTL_DID (fch,R_CTL_ELS_REQ ,FS_FABRIC_F_PORT );
@@ -317,7 +313,7 @@ fch->param =0 ; l->logi [3 * i].code =LS_FLOGI ; fcmd->cmd =dma_map_single (fc->dev, l->logi +3 * i,3 *sizeof (logi), -FC_DMA_BIDIRECTIONAL ); +DMA_BIDIRECTIONAL ); fcmd->rsp = fcmd->cmd +sizeof (logi); fcmd->cmdlen =sizeof (logi); fcmd->rsplen =sizeof (logi);
@@ -434,11 +430,12 @@if (fcmd->data) {if (SCpnt->use_sg) -dma_unmap_sg (fc->dev, (struct scatterlist *)SCpnt->buffer, SCpnt->use_sg, -scsi_to_fc_dma_dir (SCpnt->sc_data_direction)); +dma_unmap_sg (fc->dev, (struct scatterlist *)SCpnt->buffer, + SCpnt->use_sg, + SCpnt->sc_data_direction);else dma_unmap_single (fc->dev, fcmd->data, SCpnt->request_bufflen, -scsi_to_fc_dma_dir (SCpnt->sc_data_direction)); + SCpnt->sc_data_direction); }break ;default :
@@ -579,7 +576,7 @@ fc->ls = (void *)l;/* Assumes sizeof(fc_al_posmap) < 3 * sizeof(logi), which is true */ fcmd->cmd =dma_map_single (fc->dev, l->logi +3 * i,3 *sizeof (logi), -FC_DMA_BIDIRECTIONAL ); +DMA_BIDIRECTIONAL ); fcmd->proto =PROTO_REPORT_AL_MAP ; fcmd->token = i; fcmd->fc = fc;
@@ -598,7 +595,7 @@ }else { fc->state =FC_STATE_OFFLINE ;enable_irq (fc->irq); -dma_unmap_single (fc->dev, l->fcmds[i].cmd,3 *sizeof (logi),FC_DMA_BIDIRECTIONAL ); +dma_unmap_single (fc->dev, l->fcmds[i].cmd,3 *sizeof (logi),DMA_BIDIRECTIONAL );if (atomic_dec_and_test (&l->todo)) goto all_done; }
@@ -615,7 +612,7 @@FCD (("SID %d DID %d\n" , fc->sid, fc->did)) fcmd = l->fcmds + i; -dma_unmap_single (fc->dev, fcmd->cmd,3 *sizeof (logi),FC_DMA_BIDIRECTIONAL ); +dma_unmap_single (fc->dev, fcmd->cmd,3 *sizeof (logi),DMA_BIDIRECTIONAL ); fch = &fcmd->fch;FILL_FCHDR_RCTL_DID (fch,R_CTL_ELS_REQ ,FS_FABRIC_F_PORT );FILL_FCHDR_SID (fch,0 );
@@ -624,7 +621,7 @@FILL_FCHDR_OXRX (fch,0xffff ,0xffff ); fch->param =0 ; l->logi [3 * i].code =LS_FLOGI ; - fcmd->cmd =dma_map_single (fc->dev, l->logi +3 * i,3 *sizeof (logi),FC_DMA_BIDIRECTIONAL ); + fcmd->cmd =dma_map_single (fc->dev, l->logi +3 * i,3 *sizeof (logi),DMA_BIDIRECTIONAL ); fcmd->rsp = fcmd->cmd +sizeof (logi); fcmd->cmdlen =sizeof (logi); fcmd->rsplen =sizeof (logi);
@@ -652,7 +649,7 @@switch (fc->state) {case FC_STATE_ONLINE :break ;case FC_STATE_OFFLINE :break ; -default :dma_unmap_single (fc->dev, l->fcmds[i].cmd,3 *sizeof (logi),FC_DMA_BIDIRECTIONAL ); +default :dma_unmap_single (fc->dev, l->fcmds[i].cmd,3 *sizeof (logi),DMA_BIDIRECTIONAL );break ; } }
@@ -821,14 +818,14 @@ cmd->fcp_data_len = SCpnt->request_bufflen; fcmd->data =dma_map_single (fc->dev, (char *)SCpnt->request_buffer, SCpnt->request_bufflen, -scsi_to_fc_dma_dir (SCpnt->sc_data_direction)); + SCpnt->sc_data_direction); }else {struct scatterlist *sg = (struct scatterlist *)SCpnt->buffer;int nents;FCD (("XXX: Use_sg %d %d\n" , SCpnt->use_sg, sg->length)) nents = dma_map_sg (fc->dev, sg, SCpnt->use_sg, -scsi_to_fc_dma_dir (SCpnt->sc_data_direction)); + SCpnt->sc_data_direction);if (nents >1 )printk ("%s: SG for nents %d (use_sg %d) not handled yet\n" , fc->name, nents, SCpnt->use_sg); fcmd->data =sg_dma_address (sg); cmd->fcp_data_len =sg_dma_len (sg);
@@ -1065,7 +1062,7 @@FILL_FCHDR_SEQ_DF_SEQ (fch,0 ,0 ,0 );FILL_FCHDR_OXRX (fch,0xffff ,0xffff ); fch->param =0 ; - fcmd->cmd =dma_map_single (fc->dev, data,2 * len,FC_DMA_BIDIRECTIONAL ); + fcmd->cmd =dma_map_single (fc->dev, data,2 * len,DMA_BIDIRECTIONAL ); fcmd->rsp = fcmd->cmd + len; fcmd->cmdlen = len; fcmd->rsplen = len;
@@ -1100,7 +1097,7 @@clear_bit (fcmd->token, fc->scsi_bitmap); fc->scsi_free++; -dma_unmap_single (fc->dev, fcmd->cmd,2 * len,FC_DMA_BIDIRECTIONAL ); +dma_unmap_single (fc->dev, fcmd->cmd,2 * len,DMA_BIDIRECTIONAL );return l.status; }
drivers/scsi/esp.c +4 -4
@@ -1437,7 +1437,7 @@if (sp->request_bufflen) { sp->SCp.have_data_in =sbus_map_single (esp->sdev, sp->SCp.buffer, sp->SCp.this_residual, -scsi_to_sbus_dma_dir (sp->sc_data_direction)); + sp->sc_data_direction); sp->SCp.ptr = (char *) ((unsigned long )sp->SCp.have_data_in); }else { sp->SCp.ptr =NULL ;
@@ -1447,7 +1447,7 @@ sp->SCp.buffers_residual =sbus_map_sg (esp->sdev, sp->SCp.buffer, sp->use_sg, -scsi_to_sbus_dma_dir (sp->sc_data_direction)); + sp->sc_data_direction); sp->SCp.this_residual =sg_dma_len (sp->SCp.buffer); sp->SCp.ptr = (char *) ((unsigned long )sg_dma_address (sp->SCp.buffer)); }
@@ -1457,12 +1457,12 @@ {if (sp->use_sg) {sbus_unmap_sg (esp->sdev, sp->buffer, sp->use_sg, -scsi_to_sbus_dma_dir (sp->sc_data_direction)); + sp->sc_data_direction); }else if (sp->request_bufflen) {sbus_unmap_single (esp->sdev, sp->SCp.have_data_in, sp->request_bufflen, -scsi_to_sbus_dma_dir (sp->sc_data_direction)); + sp->sc_data_direction); } }
drivers/scsi/qlogicpti.c +4 -4
@@ -1038,7 +1038,7 @@int sg_count; sg = (struct scatterlist *) Cmnd->buffer; - sg_count =sbus_map_sg (qpti->sdev, sg, Cmnd->use_sg,scsi_to_sbus_dma_dir (Cmnd->sc_data_direction)); + sg_count =sbus_map_sg (qpti->sdev, sg, Cmnd->use_sg, Cmnd->sc_data_direction); ds = cmd->dataseg; cmd->segment_cnt = sg_count;
@@ -1081,7 +1081,7 @@sbus_map_single (qpti->sdev, Cmnd->request_buffer, Cmnd->request_bufflen, -scsi_to_sbus_dma_dir (Cmnd->sc_data_direction)); + Cmnd->sc_data_direction); cmd->dataseg[0 ].d_base = (u32) ((unsigned long )Cmnd->SCp.ptr); cmd->dataseg[0 ].d_count = Cmnd->request_bufflen;
@@ -1412,12 +1412,12 @@sbus_unmap_sg (qpti->sdev, (struct scatterlist *)Cmnd->buffer, Cmnd->use_sg, -scsi_to_sbus_dma_dir (Cmnd->sc_data_direction)); + Cmnd->sc_data_direction); }else {sbus_unmap_single (qpti->sdev, (__u32)((unsigned long )Cmnd->SCp.ptr), Cmnd->request_bufflen, -scsi_to_sbus_dma_dir (Cmnd->sc_data_direction)); + Cmnd->sc_data_direction); } qpti->cmd_count[Cmnd->device->id]--;sbus_writew (out_ptr, qpti->qregs +MBOX5 );
include/asm-sparc/sbus.h +5 -4
@@ -7,6 +7,7 @@#ifndef _SPARC_SBUS_H#define _SPARC_SBUS_H +#include <linux/dma-mapping.h> #include <linux/ioport.h> #include <asm/oplib.h>
@@ -106,10 +107,10 @@extern void *sbus_alloc_consistent (struct sbus_dev *,long ,u32 *dma_addrp);extern void sbus_free_consistent (struct sbus_dev *,long ,void *,u32 ); -#define SBUS_DMA_BIDIRECTIONAL 0 -#define SBUS_DMA_TODEVICE 1 -#define SBUS_DMA_FROMDEVICE 2 -#define SBUS_DMA_NONE 3 +#define SBUS_DMA_BIDIRECTIONAL DMA_BIDIRECTIONAL +#define SBUS_DMA_TODEVICE DMA_TO_DEVICE +#define SBUS_DMA_FROMDEVICE DMA_FROM_DEVICE +#define SBUS_DMA_NONE DMA_NONE/* All the rest use streaming mode mappings. */ extern dma_addr_t sbus_map_single (struct sbus_dev *,void *,size_t ,int );
=== include/asm-sparc64/sbus.h 1.4 vs edited ==--- 1.4/include/asm-sparc64/sbus.h 2004-03-14 07:54:58 +01:00
+++ edited/include/asm-sparc64/sbus.h 2004-05-31 21:50:10 +02:00
@@ -7,6 +7,7 @@
#ifndef _SPARC64_SBUS_H
#define _SPARC64_SBUS_H
+#include <linux/dma-mapping.h>
#include <linux/ioport.h>
#include <asm/oplib.h>
@@ -99,10 +100,10 @@
extern void *sbus_alloc_consistent(struct sbus_dev *, size_t, dma_addr_t *dma_addrp); extern void sbus_free_consistent(struct sbus_dev *, size_t, void *, dma_addr_t);
-#define SBUS_DMA_BIDIRECTIONAL 0
-#define SBUS_DMA_TODEVICE 1
-#define SBUS_DMA_FROMDEVICE 2
-#define SBUS_DMA_NONE 3
+#define SBUS_DMA_BIDIRECTIONAL DMA_BIDIRECTIONAL
+#define SBUS_DMA_TODEVICE DMA_TO_DEVICE
+#define SBUS_DMA_FROMDEVICE DMA_FROM_DEVICE
+#define SBUS_DMA_NONE DMA_NONE
/* All the rest use streaming mode mappings. */
extern dma_addr_t sbus_map_single(struct sbus_dev *, void *, size_t, int);
Review line 233
Quoted 9 lines
(quoted diff) +1
-1@@ -231,7 +227,7 @@ case FC_STATUS_ERR_OFFLINE: fc->state = FC_STATE_OFFLINE; dma_unmap_single (fc->dev, l->fcmds[i].cmd, 3 * sizeof(logi), - FC_DMA_BIDIRECTIONAL); + _DMA_BIDIRECTIONAL); printk ("%s: FC is offline\n", fc->name); if (atomic_dec_and_test (&l->todo)) up(&l->sem);
Typo? s/_DMA_BIDIRECTIONAL/DMA_BIDIRECTIONAL/
Signature · 4 lines
Debian - http://www.debian.org/ Linux 1394 - http://www.linux1394.org/ Subversion - http://subversion.tigris.org/ WatchGuard - http://www.watchguard.com/
Quoted 11 lines · Ben Collins
Review line 233
Quoted 9 lines
(quoted diff) +1
-1@@ -231,7 +227,7 @@ case FC_STATUS_ERR_OFFLINE: fc->state = FC_STATE_OFFLINE; dma_unmap_single (fc->dev, l->fcmds[i].cmd, 3 * sizeof(logi), - FC_DMA_BIDIRECTIONAL); + _DMA_BIDIRECTIONAL); printk ("%s: FC is offline\n", fc->name); if (atomic_dec_and_test (&l->todo)) up(&l->sem);Typo? s/_DMA_BIDIRECTIONAL/DMA_BIDIRECTIONAL/
Thanks. Dave, can you fix that if/when applying?
Re: RFC: defining sbus dma direction bits in terms of enum
In reply to Christoph HellwigQuoted 4 lines · Christoph Hellwig
And while we're at it, if someone cares for the
sbus scsi drivers: any chance to convert them awaya from needingscsi.handhosts.hindrivers/scsi/to the <scsi/*.h> headers? It's really just some boring decrufting, mostly killing obsolete typedefs.
Patch attached to move from old typedefs to modern ones, and stop using the old headers. This covers esp & qlogicpti, and really isn't rocket science, just boring decrufting.
~spot
---
Tom "spot" Callaway <tcallawa(a)redhat*com> LCA, RHCE Red Hat Sales Engineer || Aurora SPARC Linux Project Leader
"If you are going through hell, keep going."
- Sir Winston Churchill
drivers/scsi/esp.c renamed from drivers/scsi/esp.c.BAD +61 -63
@@ -26,8 +26,6 @@#include <linux/spinlock.h> #include <linux/interrupt.h> -#include "scsi.h" -#include "hosts.h" #include "esp.h" #include <asm/sbus.h>
@@ -366,7 +364,7 @@ }#ifdef DEBUG_STATE_MACHINE -static inline void esp_advance_phase (Scsi_Cmnd *s,int newphase) +static inline void esp_advance_phase (struct scsi_cmnd *s,int newphase) {ESPLOG (("<%s>" ,phase_string (newphase))); s->SCp.sent_command = s->SCp.phase;
@@ -419,48 +417,48 @@* Note that these are per-ESP queues, not global queues like * the aha152x driver uses. */ -static inline void append_SC (Scsi_Cmnd **SC ,Scsi_Cmnd *new_SC) +static inline void append_SC (struct scsi_cmnd **SC ,struct scsi_cmnd *new_SC) { -Scsi_Cmnd *end; +struct scsi_cmnd *end; new_SC->host_scribble = (unsigned char *)NULL ;if (!*SC ) *SC = new_SC;else { -for (end=*SC ;end->host_scribble;end=(Scsi_Cmnd *)end->host_scribble) +for (end=*SC ;end->host_scribble;end=(struct scsi_cmnd *)end->host_scribble) ; end->host_scribble = (unsigned char *) new_SC; } } -static inline void prepend_SC (Scsi_Cmnd **SC ,Scsi_Cmnd *new_SC) +static inline void prepend_SC (struct scsi_cmnd **SC ,struct scsi_cmnd *new_SC) { new_SC->host_scribble = (unsigned char *) *SC ; *SC = new_SC; } -static inline Scsi_Cmnd *remove_first_SC (Scsi_Cmnd **SC ) +static inline struct scsi_cmnd *remove_first_SC (struct scsi_cmnd **SC ) { -Scsi_Cmnd *ptr; +struct scsi_cmnd *ptr; ptr = *SC ;if (ptr) - *SC = (Scsi_Cmnd *) (*SC )->host_scribble; + *SC = (struct scsi_cmnd *) (*SC )->host_scribble;return ptr; } -static inline Scsi_Cmnd *remove_SC (Scsi_Cmnd **SC ,int target,int lun) +static inline struct scsi_cmnd *remove_SC (struct scsi_cmnd **SC ,int target,int lun) { -Scsi_Cmnd *ptr, *prev; +struct scsi_cmnd *ptr, *prev;for (ptr = *SC , prev =NULL ; ptr && ((ptr->device->id != target) || (ptr->device->lun != lun)); - prev = ptr, ptr = (Scsi_Cmnd *) ptr->host_scribble) + prev = ptr, ptr = (struct scsi_cmnd *) ptr->host_scribble) ;if (ptr) {if (prev) prev->host_scribble=ptr->host_scribble;else - *SC =(Scsi_Cmnd *)ptr->host_scribble; + *SC =(struct scsi_cmnd *)ptr->host_scribble; }return ptr; }
@@ -1062,7 +1060,7 @@ esp->prev_hme_dmacsr =0xffffffff ; } -static int __init detect_one_esp (Scsi_Host_Template *tpnt,struct sbus_dev *esp_dev, +static int __init detect_one_esp (struct scsi_host_template *tpnt,struct sbus_dev *esp_dev,struct sbus_dev *espdma,struct sbus_bus *sbus,int id,int hme) {
@@ -1137,7 +1135,7 @@#include <asm/sun4paddr.h> -static int __init esp_detect (Scsi_Host_Template *tpnt) +static int __init esp_detect (struct scsi_host_template *tpnt) {static struct sbus_dev esp_dev;int esps_in_use =0 ;
@@ -1162,7 +1160,7 @@#else /* !CONFIG_SUN4 */ -static int __init esp_detect (Scsi_Host_Template *tpnt) +static int __init esp_detect (struct scsi_host_template *tpnt) {struct sbus_bus *sbus;struct sbus_dev *esp_dev, *sbdev_iter;
@@ -1428,7 +1426,7 @@return esp_host_info (esp, buffer, offset, length); } -static void esp_get_dmabufs (struct esp *esp,Scsi_Cmnd *sp) +static void esp_get_dmabufs (struct esp *esp,struct scsi_cmnd *sp) {if (sp->use_sg ==0 ) { sp->SCp.this_residual = sp->request_bufflen;
@@ -1453,7 +1451,7 @@ } } -static void esp_release_dmabufs (struct esp *esp,Scsi_Cmnd *sp) +static void esp_release_dmabufs (struct esp *esp,struct scsi_cmnd *sp) {if (sp->use_sg) { sbus_unmap_sg(esp->sdev, sp->buffer, sp->use_sg,
@@ -1466,7 +1464,7 @@ } } -static void esp_restore_pointers (struct esp *esp,Scsi_Cmnd *sp) +static void esp_restore_pointers (struct esp *esp,struct scsi_cmnd *sp) {struct esp_pointers *ep = &esp->data_pointers[sp->device->id];
@@ -1476,7 +1474,7 @@ sp->SCp.buffers_residual = ep->saved_buffers_residual; } -static void esp_save_pointers (struct esp *esp,Scsi_Cmnd *sp) +static void esp_save_pointers (struct esp *esp,struct scsi_cmnd *sp) {struct esp_pointers *ep = &esp->data_pointers[sp->device->id];
@@ -1506,7 +1504,7 @@* case where we could see an interrupt is where we have disconnected * commands active and they are trying to reselect us. */ -static inline void esp_check_cmd (struct esp *esp,Scsi_Cmnd *sp) +static inline void esp_check_cmd (struct esp *esp,struct scsi_cmnd *sp) {switch (sp->cmd_len) {case 6 :
@@ -1557,8 +1555,8 @@static void esp_exec_cmd (struct esp *esp) { -Scsi_Cmnd *SCptr; -Scsi_Device *SDptr; +struct scsi_cmnd *SCptr; +struct scsi_device *SDptr;struct esp_device *esp_dev;volatile u8 *cmdp = esp->esp_command;u8 the_esp_command;
@@ -1834,7 +1832,7 @@ }/* Queue a SCSI command delivered from the mid-level Linux SCSI code. */ -static int esp_queue (Scsi_Cmnd *SCpnt,void (*done)(Scsi_Cmnd *)) +static int esp_queue (struct scsi_cmnd *SCpnt,void (*done)(struct scsi_cmnd *)) {struct esp *esp;
@@ -1871,7 +1869,7 @@ }/* Dump driver state. */ -static void esp_dump_cmd (Scsi_Cmnd *SCptr) +static void esp_dump_cmd (struct scsi_cmnd *SCptr) { ESPLOG(("[tgt<%02x> lun<%02x> " "pphase<%s> cphase<%s>]",
@@ -1882,7 +1880,7 @@static void esp_dump_state (struct esp *esp) { -Scsi_Cmnd *SCptr = esp->current_SC; +struct scsi_cmnd *SCptr = esp->current_SC;#ifdef DEBUG_ESP_CMDS int i;#endif
@@ -1921,13 +1919,13 @@ESPLOG (("esp%d: disconnected " , esp->esp_id));while (SCptr) {esp_dump_cmd (SCptr); - SCptr = (Scsi_Cmnd *) SCptr->host_scribble; + SCptr = (struct scsi_cmnd *) SCptr->host_scribble; }ESPLOG (("\n" )); }/* Abort a command. The host_lock is acquired by caller. */ -static int esp_abort (Scsi_Cmnd *SCptr) +static int esp_abort (struct scsi_cmnd *SCptr) {struct esp *esp = (struct esp *) SCptr->device->host->hostdata;int don;
@@ -1957,14 +1955,14 @@ESP_INTSOFF (esp->dregs); }if (esp->issue_SC) { -Scsi_Cmnd **prev, *this; +struct scsi_cmnd **prev, *this;for (prev = (&esp->issue_SC), this = esp->issue_SC; this !=NULL ; - prev = (Scsi_Cmnd **) &(this->host_scribble), - this = (Scsi_Cmnd *) this->host_scribble) { + prev = (struct scsi_cmnd **) &(this->host_scribble), + this = (struct scsi_cmnd *) this->host_scribble) {if (this == SCptr) { - *prev = (Scsi_Cmnd *) this->host_scribble; + *prev = (struct scsi_cmnd *) this->host_scribble; this->host_scribble =NULL ;esp_release_dmabufs (esp, this);
@@ -2010,7 +2008,7 @@*/ static int esp_finish_reset (struct esp *esp) { -Scsi_Cmnd *sp = esp->current_SC; +struct scsi_cmnd *sp = esp->current_SC;/* Clean up currently executing command, if any. */ if (sp !=NULL ) {
@@ -2059,7 +2057,7 @@* * The host_lock is acquired by caller. */ -static int esp_reset (Scsi_Cmnd *SCptr) +static int esp_reset (struct scsi_cmnd *SCptr) {struct esp *esp = (struct esp *) SCptr->device->host->hostdata;
@@ -2077,7 +2075,7 @@/* Internal ESP done function. */ static void esp_done (struct esp *esp,int error) { -Scsi_Cmnd *done_SC = esp->current_SC; +struct scsi_cmnd *done_SC = esp->current_SC; esp->current_SC =NULL ;
@@ -2168,7 +2166,7 @@/* We try to avoid some interrupts by jumping ahead and see if the ESP * has gotten far enough yet. Hence the following. */ -static inline int skipahead1 (struct esp *esp,Scsi_Cmnd *scp, +static inline int skipahead1 (struct esp *esp,struct scsi_cmnd *scp,int prev_phase,int new_phase) {if (scp->SCp.sent_command != prev_phase)
@@ -2202,7 +2200,7 @@return do_intr_end; } -static inline int skipahead2 (struct esp *esp,Scsi_Cmnd *scp, +static inline int skipahead2 (struct esp *esp,struct scsi_cmnd *scp,int prev_phase1,int prev_phase2,int new_phase) { if (scp->SCp.sent_command != prev_phase1 &&
@@ -2318,7 +2316,7 @@dma_invalidate (esp); } -static int dma_can_transfer (struct esp *esp,Scsi_Cmnd *sp) +static int dma_can_transfer (struct esp *esp,struct scsi_cmnd *sp) {__u32 base, end, sz;
@@ -2379,7 +2377,7 @@* tell the ESP to eat the extraneous byte so that we can proceed * to the next phase. */ -static int esp100_sync_hwbug (struct esp *esp,Scsi_Cmnd *sp,int fifocnt) +static int esp100_sync_hwbug (struct esp *esp,struct scsi_cmnd *sp,int fifocnt) {/* Do not touch this piece of code. */ if ((!(esp->erev == esp100)) ||
@@ -2479,7 +2477,7 @@/* This puts the driver in a state where it can revitalize a command that * is being continued due to reselection. */ -static inline void esp_connect (struct esp *esp,Scsi_Cmnd *sp) +static inline void esp_connect (struct esp *esp,struct scsi_cmnd *sp) {struct esp_device *esp_dev = sp->device->hostdata;
@@ -2502,7 +2500,7 @@/* This will place the current working command back into the issue queue * if we are to receive a reselection amidst a selection attempt. */ -static inline void esp_reconnect (struct esp *esp,Scsi_Cmnd *sp) +static inline void esp_reconnect (struct esp *esp,struct scsi_cmnd *sp) {if (!esp->disconnected_SC) ESPLOG(("esp%d: Weird, being reselected but disconnected "
@@ -2540,7 +2538,7 @@return rval - fifo_count; } -static inline void advance_sg (Scsi_Cmnd *sp) +static inline void advance_sg (struct scsi_cmnd *sp) { ++sp->SCp.buffer; --sp->SCp.buffers_residual;
@@ -2568,7 +2566,7 @@*/ static int esp_do_data (struct esp *esp) { -Scsi_Cmnd *SCptr = esp->current_SC; +struct scsi_cmnd *SCptr = esp->current_SC;int thisphase, hmuch;ESPDATA (("esp_do_data: " ));
@@ -2619,7 +2617,7 @@/* See how successful the data transfer was. */ static int esp_do_data_finale (struct esp *esp) { -Scsi_Cmnd *SCptr = esp->current_SC; +struct scsi_cmnd *SCptr = esp->current_SC;struct esp_device *esp_dev = SCptr->device->hostdata;int bogus_data =0 , bytes_sent =0 , fifocnt, ecount =0 ;
@@ -2800,7 +2798,7 @@* a tape, we don't want to go into a loop re-negotiating * synchronous capabilities over and over. */ -static int esp_should_clear_sync (Scsi_Cmnd *sp) +static int esp_should_clear_sync (struct scsi_cmnd *sp) {u8 cmd1 = sp->cmnd[0 ];u8 cmd2 = sp->data_cmnd[0 ];
@@ -2834,7 +2832,7 @@*/ static int esp_do_freebus (struct esp *esp) { -Scsi_Cmnd *SCptr = esp->current_SC; +struct scsi_cmnd *SCptr = esp->current_SC;struct esp_device *esp_dev = SCptr->device->hostdata;int rval;
@@ -2905,7 +2903,7 @@*/ static int esp_bad_reconnect (struct esp *esp) { -Scsi_Cmnd *sp; +struct scsi_cmnd *sp;ESPLOG (("esp%d: Eieeee, reconnecting unknown command!\n" , esp->esp_id));
@@ -2914,7 +2912,7 @@ESPLOG (("esp%d: issue_SC[" , esp->esp_id));while (sp) {ESPLOG (("<%02x,%02x>" , sp->device->id, sp->device->lun)); - sp = (Scsi_Cmnd *) sp->host_scribble; + sp = (struct scsi_cmnd *) sp->host_scribble; }ESPLOG (("]\n" )); sp = esp->current_SC;
@@ -2928,7 +2926,7 @@ESPLOG (("esp%d: disconnected_SC[" , esp->esp_id));while (sp) {ESPLOG (("<%02x,%02x>" , sp->device->id, sp->device->lun)); - sp = (Scsi_Cmnd *) sp->host_scribble; + sp = (struct scsi_cmnd *) sp->host_scribble; }ESPLOG (("]\n" ));return do_reset_bus;
@@ -2938,7 +2936,7 @@static int esp_do_reconnect (struct esp *esp) {int lun, target; -Scsi_Cmnd *SCptr; +struct scsi_cmnd *SCptr;/* Check for all bogus conditions first. */ target =reconnect_target (esp);
@@ -2988,7 +2986,7 @@*/ static int esp_do_status (struct esp *esp) { -Scsi_Cmnd *SCptr = esp->current_SC; +struct scsi_cmnd *SCptr = esp->current_SC;int intr, rval; rval =skipahead1 (esp, SCptr, in_the_dark, in_status);
@@ -3133,7 +3131,7 @@static int esp_disconnect_amidst_phases (struct esp *esp) { -Scsi_Cmnd *sp = esp->current_SC; +struct scsi_cmnd *sp = esp->current_SC;struct esp_device *esp_dev = sp->device->hostdata;/* This means real problems if we see this
@@ -3226,7 +3224,7 @@/* First interrupt after exec'ing a cmd comes here. */ static int esp_select_complete (struct esp *esp) { -Scsi_Cmnd *SCptr = esp->current_SC; +struct scsi_cmnd *SCptr = esp->current_SC;struct esp_device *esp_dev = SCptr->device->hostdata;int cmd_bytes_sent, fcnt;
@@ -3582,7 +3580,7 @@* this because so many initiators cannot cope with this occurring. */ static int target_with_ants_in_pants (struct esp *esp, -Scsi_Cmnd *SCptr, +struct scsi_cmnd *SCptr,struct esp_device *esp_dev) {if (esp_dev->sync || SCptr->device->borken) {
@@ -3641,7 +3639,7 @@static int check_multibyte_msg (struct esp *esp) { -Scsi_Cmnd *SCptr = esp->current_SC; +struct scsi_cmnd *SCptr = esp->current_SC;struct esp_device *esp_dev = SCptr->device->hostdata;u8 regval =0 ;int message_out =0 ;
@@ -3822,7 +3820,7 @@static int esp_do_msgindone (struct esp *esp) { -Scsi_Cmnd *SCptr = esp->current_SC; +struct scsi_cmnd *SCptr = esp->current_SC;int message_out =0 , it =0 , rval; rval =skipahead1 (esp, SCptr, in_msgin, in_msgindone);
@@ -3904,7 +3902,7 @@static int esp_do_cmdbegin (struct esp *esp) { -Scsi_Cmnd *SCptr = esp->current_SC; +struct scsi_cmnd *SCptr = esp->current_SC;esp_advance_phase (SCptr, in_cmdend);if (esp->erev == fashme) {
@@ -4125,7 +4123,7 @@/* This is the second tier in our dual-level SCSI state machine. */ static int esp_work_bus (struct esp *esp) { -Scsi_Cmnd *SCptr = esp->current_SC; +struct scsi_cmnd *SCptr = esp->current_SC;unsigned int phase;ESPBUS (("esp_work_bus: " ));
@@ -4153,7 +4151,7 @@/* Main interrupt handler for an esp adapter. */ static void esp_handle (struct esp *esp) { -Scsi_Cmnd *SCptr; +struct scsi_cmnd *SCptr;int what_next = do_intr_end; SCptr = esp->current_SC;
@@ -4353,7 +4351,7 @@return IRQ_HANDLED ; } -static int esp_slave_alloc (Scsi_Device *SDptr) +static int esp_slave_alloc (struct scsi_device *SDptr) {struct esp_device *esp_dev =kmalloc (sizeof (struct esp_device ),GFP_ATOMIC );
@@ -4365,7 +4363,7 @@return 0 ; } -static void esp_slave_destroy (Scsi_Device *SDptr) +static void esp_slave_destroy (struct scsi_device *SDptr) {struct esp *esp = (struct esp *) SDptr->host->hostdata;
@@ -4374,7 +4372,7 @@ SDptr->hostdata =NULL ; } -static Scsi_Host_Template driver_template = { +static struct scsi_host_template driver_template = { .proc_name ="esp" , .proc_info = esp_proc_info, .name ="Sun ESP 100/100a/200" ,
drivers/scsi/esp.h renamed from drivers/scsi/esp.h.BAD +14 -3
@@ -10,9 +10,20 @@#include <linux/config.h> +/* #include "scsi.h" */ +#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> +#include <scsi/scsi_request.h> +#include <scsi/scsi_tcq.h> +#include <scsi/scsi.h> +#include <scsi/scsi_host.h> +/* For dvma controller register definitions. */ #include <asm/dma.h> +#define scsi_to_sbus_dma_dir (scsi_dir) ((int)(scsi_dir)) +/* The ESP SCSI controllers have their register sets in three * "classes": *
@@ -181,9 +192,9 @@int bursts;/* Burst sizes our DVMA supports */ /* Our command queues, only one cmd lives in the current_SC queue. */ -Scsi_Cmnd *issue_SC;/* Commands to be issued */ -Scsi_Cmnd *current_SC;/* Who is currently working the bus */ -Scsi_Cmnd *disconnected_SC;/* Commands disconnected from the bus */ +struct scsi_cmnd *issue_SC;/* Commands to be issued */ +struct scsi_cmnd *current_SC;/* Who is currently working the bus */ +struct scsi_cmnd *disconnected_SC;/* Commands disconnected from the bus */ /* Message goo */ u8 cur_msgout[16 ];
drivers/scsi/qlogicpti.h renamed from drivers/scsi/qlogicpti.h.BAD +12 -1
@@ -8,6 +8,17 @@#include <linux/config.h> +/* #include "scsi.h" */ +#include <scsi/scsi_cmnd.h> +#include <scsi/scsi_device.h> +#include <scsi/scsi_eh.h> +#include <scsi/scsi_request.h> +#include <scsi/scsi_tcq.h> +#include <scsi/scsi.h> +#include <scsi/scsi_host.h> + +#define scsi_to_sbus_dma_dir (scsi_dir) ((int)(scsi_dir)) +/* Qlogic/SBUS controller registers. */ #define SBUS_CFG1 0x006UL#define SBUS_CTRL 0x008UL
@@ -352,7 +363,7 @@* Ex000 sparc64 machines with >4GB of ram we just keep track of the * scsi command pointers here. This is essentially what Matt Jacob does. -DaveM */ -Scsi_Cmnd *cmd_slots[QLOGICPTI_REQ_QUEUE_LEN +1 ]; +struct scsi_cmnd *cmd_slots[QLOGICPTI_REQ_QUEUE_LEN +1 ];/* The rest of the elements are unimportant for performance. */ struct qlogicpti *next;
drivers/scsi/qlogicpti.c renamed from drivers/scsi/qlogicpti.c.BAD +19 -21
@@ -26,8 +26,6 @@#include <asm/byteorder.h> -#include "scsi.h" -#include "hosts.h" #include "qlogicpti.h" #include <asm/sbus.h>
@@ -809,7 +807,7 @@ }/* Detect all PTI Qlogic ISP's in the machine. */ -static int __init qlogicpti_detect (Scsi_Host_Template *tpnt) +static int __init qlogicpti_detect (struct scsi_host_template *tpnt) {struct qlogicpti *qpti;struct Scsi_Host *qpti_host;
@@ -878,7 +876,7 @@qpti_get_bursts (qpti);qpti_get_clock (qpti); -/* Clear out Scsi_Cmnd array. */ +/* Clear out scsi_cmnd array. */ memset (qpti->cmd_slots,0 ,sizeof (qpti->cmd_slots));if (qpti_map_queues (qpti) <0 )
@@ -997,7 +995,7 @@ marker->rsvd =0 ; } -static inline void cmd_frob (struct Command_Entry *cmd,Scsi_Cmnd *Cmnd, +static inline void cmd_frob (struct Command_Entry *cmd,struct scsi_cmnd *Cmnd,struct qlogicpti *qpti) {memset (cmd,0 ,sizeof (struct Command_Entry ));
@@ -1027,7 +1025,7 @@ }/* Do it to it baby. */ -static inline int load_cmd (Scsi_Cmnd *Cmnd,struct Command_Entry *cmd, +static inline int load_cmd (struct scsi_cmnd *Cmnd,struct Command_Entry *cmd,struct qlogicpti *qpti,u_int in_ptr,u_int out_ptr) {struct dataseg *ds;
@@ -1115,11 +1113,11 @@/* * Until we scan the entire bus with inquiries, go throught this fella... */ -static void ourdone (Scsi_Cmnd *Cmnd) +static void ourdone (struct scsi_cmnd *Cmnd) {struct qlogicpti *qpti = (struct qlogicpti *) Cmnd->device->host->hostdata;int tgt = Cmnd->device->id; -void (*done) (Scsi_Cmnd *); +void (*done) (struct scsi_cmnd *);/* This grot added by DaveM, blame him for ugliness. * The issue is that in the 2.3.x driver we use the
@@ -1127,7 +1125,7 @@* completion linked list at interrupt service time, * so we have to store the done function pointer elsewhere. */ - done = (void (*)(Scsi_Cmnd *)) + done = (void (*)(struct scsi_cmnd *)) (((unsigned long ) Cmnd->SCp.Message) #ifdef __sparc_v9__ | ((unsigned long) Cmnd->SCp.Status << 32UL)
@@ -1164,10 +1162,10 @@done (Cmnd); } -static int qlogicpti_queuecommand (Scsi_Cmnd *Cmnd,void (*done)(Scsi_Cmnd *)); +static int qlogicpti_queuecommand (struct scsi_cmnd *Cmnd,void (*done)(struct scsi_cmnd *)); -static int qlogicpti_queuecommand_slow (Scsi_Cmnd *Cmnd, -void (*done)(Scsi_Cmnd *)) +static int qlogicpti_queuecommand_slow (struct scsi_cmnd *Cmnd, +void (*done)(struct scsi_cmnd *)) {struct qlogicpti *qpti = (struct qlogicpti *) Cmnd->device->host->hostdata;
@@ -1238,7 +1236,7 @@* * "This code must fly." -davem */ -static int qlogicpti_queuecommand (Scsi_Cmnd *Cmnd,void (*done)(Scsi_Cmnd *)) +static int qlogicpti_queuecommand (struct scsi_cmnd *Cmnd,void (*done)(struct scsi_cmnd *)) {struct Scsi_Host *host = Cmnd->device->host;struct qlogicpti *qpti = (struct qlogicpti *) host->hostdata;
@@ -1351,9 +1349,9 @@return (sts->scsi_status &STATUS_MASK ) | (host_status <<16 ); } -static Scsi_Cmnd *qlogicpti_intr_handler (struct qlogicpti *qpti) +static struct scsi_cmnd *qlogicpti_intr_handler (struct qlogicpti *qpti) { -Scsi_Cmnd *Cmnd, *done_queue =NULL ; +struct scsi_cmnd *Cmnd, *done_queue =NULL ;struct Status_Entry *sts;u_int in_ptr, out_ptr;
@@ -1433,16 +1431,16 @@ {struct qlogicpti *qpti = dev_id;unsigned long flags; -Scsi_Cmnd *dq; +struct scsi_cmnd *dq;spin_lock_irqsave (qpti->qhost->host_lock, flags); dq =qlogicpti_intr_handler (qpti);if (dq !=NULL ) {do { -Scsi_Cmnd *next; +struct scsi_cmnd *next; - next = (Scsi_Cmnd *) dq->host_scribble; + next = (struct scsi_cmnd *) dq->host_scribble; dq->scsi_done (dq); dq = next; }while (dq !=NULL );
@@ -1452,7 +1450,7 @@return IRQ_HANDLED ; } -static int qlogicpti_abort (Scsi_Cmnd *Cmnd) +static int qlogicpti_abort (struct scsi_cmnd *Cmnd) {u_short param[6 ];struct Scsi_Host *host = Cmnd->device->host;
@@ -1489,7 +1487,7 @@return return_status; } -static int qlogicpti_reset (Scsi_Cmnd *Cmnd) +static int qlogicpti_reset (struct scsi_cmnd *Cmnd) {u_short param[6 ];struct Scsi_Host *host = Cmnd->device->host;
@@ -1513,7 +1511,7 @@return return_status; } -static Scsi_Host_Template driver_template = { +static struct scsi_host_template driver_template = { .detect = qlogicpti_detect, .release = qlogicpti_release, .info = qlogicpti_info,
Re: RFC: defining sbus dma direction bits in terms of enum
In reply to Christoph HellwigQuoted 13 lines · On Tue, 1 Jun 2004 18:01:46 +0200 Christoph Hellwig <[email protected]> wrote:
Quoted 11 lines · Ben Collins
Review line 233
Quoted 9 lines
(quoted diff) +1
-1@@ -231,7 +227,7 @@ case FC_STATUS_ERR_OFFLINE: fc->state = FC_STATE_OFFLINE; dma_unmap_single (fc->dev, l->fcmds[i].cmd, 3 * sizeof(logi), - FC_DMA_BIDIRECTIONAL); + _DMA_BIDIRECTIONAL); printk ("%s: FC is offline\n", fc->name); if (atomic_dec_and_test (&l->todo)) up(&l->sem);Typo? s/_DMA_BIDIRECTIONAL/DMA_BIDIRECTIONAL/
Quoted 1 line
Thanks. Dave, can you fix that if/when applying?
I will, I got backlogged today so I'll try to get to all this tomorrow. Including tcallawa's patch.
David S. Miller
AppliedRe: RFC: defining sbus dma direction bits in terms of enum
In reply to Christoph HellwigQuoted 9 lines · On Tue, 01 Jun 2004 11:47:32 -0500 "Tom 'spot' Callaway" <[email protected]>…
Quoted 4 lines · Christoph Hellwig
And while we're at it, if someone cares for the
sbus scsi drivers: any chance to convert them awaya from needingscsi.handhosts.hindrivers/scsi/to the <scsi/*.h> headers? It's really just some boring decrufting, mostly killing obsolete typedefs.Patch attached to move from old typedefs to modern ones, and stop using the old headers. This covers esp & qlogicpti, and really isn't rocket science, just boring decrufting.
Applied, thanks Tom.