]> git.hungrycats.org Git - linux/commitdiff
[PATCH] M68k NCR5380 SCSI updates
authorGeert Uytterhoeven <geert@linux-m68k.org>
Thu, 20 Mar 2003 14:04:21 +0000 (06:04 -0800)
committerLinus Torvalds <torvalds@home.transmeta.com>
Thu, 20 Mar 2003 14:04:21 +0000 (06:04 -0800)
M68k NCR5380 SCSI updates for changes in SCSI and NCR5380 SCSI layers:
  - Sun-3/3x (from Sam Creasey)
  - Atari (ported updates from Sun-3)
  - Mac (ported updates from Sun-3)

drivers/scsi/atari_NCR5380.c
drivers/scsi/atari_scsi.c
drivers/scsi/atari_scsi.h
drivers/scsi/mac_NCR5380.c
drivers/scsi/sun3_NCR5380.c
drivers/scsi/sun3_scsi.c
drivers/scsi/sun3_scsi.h
drivers/scsi/sun3_scsi_vme.c
drivers/scsi/sun3x_esp.c

index df9da107d11b326c9f5b9c69fdc8df24a976f119..a5ce400cd2d9e935f5f06d5b65fb0ea43dcf485d 100644 (file)
@@ -834,7 +834,7 @@ lprint_Scsi_Cmnd (Scsi_Cmnd *cmd, char *pos, char *buffer, int length)
  * 
  */
 
-static void __init NCR5380_init (struct Scsi_Host *instance, int flags)
+static int NCR5380_init (struct Scsi_Host *instance, int flags)
 {
     int i;
     SETUP_HOSTDATA(instance);
@@ -878,6 +878,8 @@ static void __init NCR5380_init (struct Scsi_Host *instance, int flags)
     NCR5380_write(MODE_REG, MR_BASE);
     NCR5380_write(TARGET_COMMAND_REG, 0);
     NCR5380_write(SELECT_ENABLE_REG, 0);
+
+    return 0;
 }
 
 /* 
@@ -898,10 +900,7 @@ static void __init NCR5380_init (struct Scsi_Host *instance, int flags)
  *
  */
 
-/* Only make static if a wrapper function is used */
-#ifndef NCR5380_queue_command
 static
-#endif
 int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
 {
     SETUP_HOSTDATA(cmd->host);
@@ -1014,7 +1013,7 @@ int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
     if (in_interrupt() || ((flags >> 8) & 7) >= 6)
        queue_main();
     else
-       NCR5380_main();
+       NCR5380_main(NULL);
     return 0;
 }
 
@@ -1030,7 +1029,7 @@ int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
  *  reenable them.  This prevents reentrancy and kernel stack overflow.
  */    
     
-static void NCR5380_main (void)
+static void NCR5380_main (void *bl)
 {
     Scsi_Cmnd *tmp, *prev;
     struct Scsi_Host *instance = first_instance;
@@ -2642,9 +2641,7 @@ static void NCR5380_reselect (struct Scsi_Host *instance)
  *      called where the loop started in NCR5380_main().
  */
 
-#ifndef NCR5380_abort
 static
-#endif
 int NCR5380_abort (Scsi_Cmnd *cmd)
 {
     struct Scsi_Host *instance = cmd->host;
@@ -2842,7 +2839,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd)
 
 
 /* 
- * Function : int NCR5380_reset (Scsi_Cmnd *cmd, unsigned int reset_flags)
+ * Function : int NCR5380_reset (Scsi_Cmnd *cmd)
  * 
  * Purpose : reset the SCSI bus.
  *
@@ -2850,7 +2847,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd)
  *
  */ 
 
-static int NCR5380_reset( Scsi_Cmnd *cmd, unsigned int reset_flags)
+static int NCR5380_bus_reset( Scsi_Cmnd *cmd)
 {
     SETUP_HOSTDATA(cmd->host);
     int           i;
index 07c40bd87e67534a4404c2fbaa71afa9185e8fcb..25412b60a3e72e82c728b726c145bad0603ea60a 100644 (file)
@@ -819,7 +819,7 @@ void __init atari_scsi_setup(char *str, int *ints)
 #endif
 }
 
-int atari_scsi_reset( Scsi_Cmnd *cmd, unsigned int reset_flags)
+int atari_scsi_bus_reset(Scsi_Cmnd *cmd)
 {
        int             rv;
        struct NCR5380_hostdata *hostdata =
@@ -845,7 +845,7 @@ int atari_scsi_reset( Scsi_Cmnd *cmd, unsigned int reset_flags)
 #endif /* REAL_DMA */
        }
 
-       rv = NCR5380_reset(cmd, reset_flags);
+       rv = NCR5380_bus_reset(cmd);
 
        /* Re-enable ints */
        if (IS_A_TT()) {
@@ -1146,8 +1146,8 @@ static Scsi_Host_Template driver_template = {
        .release                = atari_scsi_release,
        .info                   = atari_scsi_info,
        .queuecommand           = atari_scsi_queue_command,
-       .abort                  = atari_scsi_abort,
-       .reset                  = atari_scsi_reset,
+       .eh_abort_handler       = atari_scsi_abort,
+       .eh_bus_reset_handler   = atari_scsi_bus_reset,
        .can_queue              = 0, /* initialized at run-time */
        .this_id                = 0, /* initialized at run-time */
        .sg_tablesize           = 0, /* initialized at run-time */
index a6fd05a74d3334d88f11a3933ebd469358e8dafb..b417d6c6880c56607a719082cb031234c60fa1db 100644 (file)
 /* (I_HAVE_OVERRUNS stuff removed) */
 
 #ifndef ASM
-int atari_scsi_abort (Scsi_Cmnd *);
 int atari_scsi_detect (Scsi_Host_Template *);
 const char *atari_scsi_info (struct Scsi_Host *);
-int atari_scsi_queue_command (Scsi_Cmnd *, void (*done) (Scsi_Cmnd *));
 int atari_scsi_reset (Scsi_Cmnd *, unsigned int);
 int atari_scsi_proc_info (char *, char **, off_t, int, int, int);
 #ifdef MODULE
index b51eda3f81102c44b58b92efda9d8356fd5a9de2..81e94a695e5e3edf34443db3578839c7ab297036 100644 (file)
@@ -850,7 +850,7 @@ lprint_Scsi_Cmnd (Scsi_Cmnd *cmd, char *pos, char *buffer, int length)
 
 
 /* 
- * Function : void NCR5380_init (struct Scsi_Host *instance)
+ * Function : void NCR5380_init (struct Scsi_Host *instance, int flags)
  *
  * Purpose : initializes *instance and corresponding 5380 chip.
  *
@@ -861,7 +861,7 @@ lprint_Scsi_Cmnd (Scsi_Cmnd *cmd, char *pos, char *buffer, int length)
  * 
  */
 
-static void NCR5380_init (struct Scsi_Host *instance, int flags)
+static int NCR5380_init (struct Scsi_Host *instance, int flags)
 {
     int i;
     SETUP_HOSTDATA(instance);
@@ -905,6 +905,8 @@ static void NCR5380_init (struct Scsi_Host *instance, int flags)
     NCR5380_write(MODE_REG, MR_BASE);
     NCR5380_write(TARGET_COMMAND_REG, 0);
     NCR5380_write(SELECT_ENABLE_REG, 0);
+
+    return 0;
 }
 
 /* 
@@ -925,17 +927,13 @@ static void NCR5380_init (struct Scsi_Host *instance, int flags)
  *
  */
 
-/* Only make static if a wrapper function is used */
-#ifndef NCR5380_queue_command
 static
-#endif
 int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
 {
     SETUP_HOSTDATA(cmd->host);
     Scsi_Cmnd *tmp;
     int oldto;
     unsigned long flags;
-    extern int update_timeout(Scsi_Cmnd * SCset, int timeout);
 
 #if (NDEBUG & NDEBUG_NO_WRITE)
     switch (cmd->cmnd[0]) {
@@ -1025,12 +1023,12 @@ int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
     if (in_interrupt() > 0 || ((flags >> 8) & 7) >= 6)
        queue_main();
     else
-       NCR5380_main();
+       NCR5380_main(NULL);
     return 0;
 }
 
 /*
- * Function : NCR5380_main (void) 
+ * Function : NCR5380_main (void *bl)
  *
  * Purpose : NCR5380_main is a coroutine that runs as long as more work can 
  *     be done on the NCR5380 host adapters in a system.  Both 
@@ -1041,7 +1039,7 @@ int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
  *  reenable them.  This prevents reentrancy and kernel stack overflow.
  */    
     
-static void NCR5380_main (void)
+static void NCR5380_main (void *bl)
 {
     Scsi_Cmnd *tmp, *prev;
     struct Scsi_Host *instance = first_instance;
@@ -2790,9 +2788,6 @@ static void NCR5380_reselect (struct Scsi_Host *instance)
  *      called where the loop started in NCR5380_main().
  */
 
-#ifndef NCR5380_abort
-static
-#endif
 int NCR5380_abort (Scsi_Cmnd *cmd)
 {
     struct Scsi_Host *instance = cmd->host;
@@ -2982,7 +2977,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd)
 
 
 /* 
- * Function : int NCR5380_reset (Scsi_Cmnd *cmd, unsigned int reset_flags)
+ * Function : int NCR5380_bus_reset (Scsi_Cmnd *cmd)
  * 
  * Purpose : reset the SCSI bus.
  *
@@ -2990,7 +2985,7 @@ int NCR5380_abort (Scsi_Cmnd *cmd)
  *
  */ 
 
-static int NCR5380_reset( Scsi_Cmnd *cmd, unsigned int reset_flags)
+static int NCR5380_bus_reset( Scsi_Cmnd *cmd)
 {
     SETUP_HOSTDATA(cmd->host);
     int           i;
index 90ec7b11f7ec057f7b6823bc97ba3234c995ace9..cfcfb247fd2b24363bc8c763547403465c4ee10d 100644 (file)
@@ -842,7 +842,7 @@ lprint_Scsi_Cmnd (Scsi_Cmnd *cmd, char *pos, char *buffer, int length)
  * 
  */
 
-static void __init NCR5380_init (struct Scsi_Host *instance, int flags)
+static int NCR5380_init (struct Scsi_Host *instance, int flags)
 {
     int i;
     SETUP_HOSTDATA(instance);
@@ -886,6 +886,8 @@ static void __init NCR5380_init (struct Scsi_Host *instance, int flags)
     NCR5380_write(MODE_REG, MR_BASE);
     NCR5380_write(TARGET_COMMAND_REG, 0);
     NCR5380_write(SELECT_ENABLE_REG, 0);
+
+    return 0;
 }
 
 /* 
@@ -912,7 +914,6 @@ static int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
     SETUP_HOSTDATA(cmd->host);
     Scsi_Cmnd *tmp;
     unsigned long flags;
-    extern int update_timeout(Scsi_Cmnd * SCset, int timeout);
 
 #if (NDEBUG & NDEBUG_NO_WRITE)
     switch (cmd->cmnd[0]) {
@@ -1014,7 +1015,7 @@ static int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
     if (in_interrupt() || ((flags >> 8) & 7) >= 6)
        queue_main();
     else
-       NCR5380_main();
+       NCR5380_main(NULL);
     return 0;
 }
 
@@ -1030,7 +1031,7 @@ static int NCR5380_queue_command (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
  *  reenable them.  This prevents reentrancy and kernel stack overflow.
  */    
     
-static void NCR5380_main (void)
+static void NCR5380_main (void *bl)
 {
     Scsi_Cmnd *tmp, *prev;
     struct Scsi_Host *instance = first_instance;
@@ -1065,7 +1066,7 @@ static void NCR5380_main (void)
 
     local_save_flags(flags);
     do {
-       local_irq_disable(flags); /* Freeze request queues */
+       local_irq_disable(); /* Freeze request queues */
        done = 1;
        
        if (!hostdata->connected) {
@@ -2868,7 +2869,7 @@ static int NCR5380_abort (Scsi_Cmnd *cmd)
 
 
 /* 
- * Function : int NCR5380_reset (Scsi_Cmnd *cmd, unsigned int reset_flags)
+ * Function : int NCR5380_bus_reset (Scsi_Cmnd *cmd)
  * 
  * Purpose : reset the SCSI bus.
  *
@@ -2876,7 +2877,7 @@ static int NCR5380_abort (Scsi_Cmnd *cmd)
  *
  */ 
 
-static int NCR5380_reset( Scsi_Cmnd *cmd, unsigned int reset_flags)
+static int NCR5380_bus_reset( Scsi_Cmnd *cmd)
 {
     SETUP_HOSTDATA(cmd->host);
     int           i;
index 978e81e9e60236cca35772528f27ccdb49a44881..9ca0a90026a8d4021389baeb6fed6e56003400c1 100644 (file)
@@ -79,6 +79,8 @@
 #include "sun3_scsi.h"
 #include "NCR5380.h"
 
+static void NCR5380_print(struct Scsi_Host *instance);
+
 /* #define OLDDMA */
 
 #define USE_WRAPPER
@@ -621,8 +623,8 @@ static Scsi_Host_Template driver_template = {
        .release                = sun3scsi_release,
        .info                   = sun3scsi_info,
        .queuecommand           = sun3scsi_queue_command,
-       .abort                  = sun3scsi_abort,
-       .reset                  = sun3scsi_reset,
+       .eh_abort_handler       = sun3scsi_abort,
+       .eh_bus_reset_handler   = sun3scsi_bus_reset,
        .can_queue              = CAN_QUEUE,
        .this_id                = 7,
        .sg_tablesize           = SG_TABLESIZE,
index b7a569b3d2bb77c46cc4066474e71d5b72f683ac..23a897d39c874c5876e6ba687008601f0733ba64 100644 (file)
@@ -55,7 +55,7 @@
 static int sun3scsi_abort (Scsi_Cmnd *);
 static int sun3scsi_detect (Scsi_Host_Template *);
 static const char *sun3scsi_info (struct Scsi_Host *);
-static int sun3scsi_reset(Scsi_Cmnd *, unsigned int);
+static int sun3scsi_bus_reset(Scsi_Cmnd *);
 static int sun3scsi_queue_command (Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
 static int sun3scsi_proc_info (char *buffer, char **start, off_t offset,
                        int length, int hostno, int inout);
@@ -109,7 +109,7 @@ static int sun3scsi_release (struct Scsi_Host *);
 
 #define NCR5380_intr sun3scsi_intr
 #define NCR5380_queue_command sun3scsi_queue_command
-#define NCR5380_reset sun3scsi_reset
+#define NCR5380_bus_reset sun3scsi_bus_reset
 #define NCR5380_abort sun3scsi_abort
 #define NCR5380_proc_info sun3scsi_proc_info
 #define NCR5380_dma_xfer_len(i, cmd, phase) \
index 056a65cd455149d461efc367c75b144aa119971c..484500e20395b6450ee2140966fee851f0ba7216 100644 (file)
@@ -1,4 +1,4 @@
-/*
+ /*
  * Sun3 SCSI stuff by Erik Verbruggen (erik@bigmama.xtdnet.nl)
  *
  * Sun3 DMA routines added by Sam Creasey (sammy@sammy.net)
@@ -566,8 +566,8 @@ static Scsi_Host_Template driver_template = {
        .release                = sun3scsi_release,
        .info                   = sun3scsi_info,
        .queuecommand           = sun3scsi_queue_command,
-       .abort                  = sun3scsi_abort,
-       .reset                  = sun3scsi_reset,
+       .eh_abort_handler       = sun3scsi_abort,
+       .eh_bus_reset_handler   = sun3scsi_bus_reset,
        .can_queue              = CAN_QUEUE,
        .this_id                = 7,
        .sg_tablesize           = SG_TABLESIZE,
index bfbdf74c018bd965c95d4cfa2adbc18fea3a0679..7c44fc01f784f473370dfc0c49a53cbf876ba7f5 100644 (file)
@@ -374,11 +374,44 @@ static void dma_advance_sg (Scsi_Cmnd *sp)
     sp->SCp.ptr = (char *)((unsigned long)sp->SCp.buffer->dvma_address);
 }
 
+
+static int esp_slave_alloc(Scsi_Device *SDptr)
+{
+       struct esp_device *esp_dev =
+               kmalloc(sizeof(struct esp_device), GFP_ATOMIC);
+
+       if (!esp_dev)
+               return -ENOMEM;
+       memset(esp_dev, 0, sizeof(struct esp_device));
+       SDptr->hostdata = esp_dev;
+       return 0;
+}
+
+static void esp_slave_destroy(Scsi_Device *SDptr)
+{
+       struct NCR_ESP *esp = (struct NCR_ESP *) SDptr->host->hostdata;
+
+       esp->targets_present &= ~(1 << SDptr->id);
+       kfree(SDptr->hostdata);
+       SDptr->hostdata = NULL;
+}
+
+
+static int sun3x_esp_release(struct Scsi_Host *instance)
+{
+       /* this code does not support being compiled as a module */      
+       return 1;
+
+}
+
 static Scsi_Host_Template driver_template = {
        .proc_name              = "esp",
        .proc_info              = &esp_proc_info,
        .name                   = "Sun ESP 100/100a/200",
        .detect                 = sun3x_esp_detect,
+       .release                = sun3x_esp_release,
+       .slave_alloc            = esp_slave_alloc,
+       .slave_destroy          = esp_slave_destroy,
        .info                   = esp_info,
        .command                = esp_command,
        .queuecommand           = esp_queue,