summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/esp.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/esp.h')
-rw-r--r--drivers/scsi/esp.h230
1 files changed, 174 insertions, 56 deletions
diff --git a/drivers/scsi/esp.h b/drivers/scsi/esp.h
index 23a7e35e3..bc5a879f6 100644
--- a/drivers/scsi/esp.h
+++ b/drivers/scsi/esp.h
@@ -4,11 +4,115 @@
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
*/
-#ifndef _SPARC_ESP_H
-#define _SPARC_ESP_H
+#ifndef _ESP_H
+#define _ESP_H
+
+/* Macros for debugging messages */
+
+/* #define DEBUG_ESP */
+/* #define DEBUG_ESP_HME */
+/* #define DEBUG_ESP_DATA */
+/* #define DEBUG_ESP_QUEUE */
+/* #define DEBUG_ESP_DISCONNECT */
+/* #define DEBUG_ESP_STATUS */
+/* #define DEBUG_ESP_PHASES */
+/* #define DEBUG_ESP_WORKBUS */
+/* #define DEBUG_STATE_MACHINE */
+/* #define DEBUG_ESP_CMDS */
+/* #define DEBUG_ESP_IRQS */
+/* #define DEBUG_SDTR */
+/* #define DEBUG_ESP_SG */
+
+/* Use the following to sprinkle debugging messages in a way which
+ * suits you if combinations of the above become too verbose when
+ * trying to track down a specific problem.
+ */
+/* #define DEBUG_ESP_MISC */
+
+#if defined(DEBUG_ESP)
+#define ESPLOG(foo) printk foo
+#else
+#define ESPLOG(foo)
+#endif /* (DEBUG_ESP) */
+
+#if defined(DEBUG_ESP_HME)
+#define ESPHME(foo) printk foo
+#else
+#define ESPHME(foo)
+#endif
+
+#if defined(DEBUG_ESP_DATA)
+#define ESPDATA(foo) printk foo
+#else
+#define ESPDATA(foo)
+#endif
+
+#if defined(DEBUG_ESP_QUEUE)
+#define ESPQUEUE(foo) printk foo
+#else
+#define ESPQUEUE(foo)
+#endif
+
+#if defined(DEBUG_ESP_DISCONNECT)
+#define ESPDISC(foo) printk foo
+#else
+#define ESPDISC(foo)
+#endif
+
+#if defined(DEBUG_ESP_STATUS)
+#define ESPSTAT(foo) printk foo
+#else
+#define ESPSTAT(foo)
+#endif
+
+#if defined(DEBUG_ESP_PHASES)
+#define ESPPHASE(foo) printk foo
+#else
+#define ESPPHASE(foo)
+#endif
+
+#if defined(DEBUG_ESP_WORKBUS)
+#define ESPBUS(foo) printk foo
+#else
+#define ESPBUS(foo)
+#endif
+
+#if defined(DEBUG_ESP_IRQS)
+#define ESPIRQ(foo) printk foo
+#else
+#define ESPIRQ(foo)
+#endif
+
+#if defined(DEBUG_SDTR)
+#define ESPSDTR(foo) printk foo
+#else
+#define ESPSDTR(foo)
+#endif
+
+#if defined(DEBUG_ESP_MISC)
+#define ESPMISC(foo) printk foo
+#else
+#define ESPMISC(foo)
+#endif
+
+#define INTERNAL_ESP_ERROR \
+ (panic ("Internal ESP driver error in file %s, line %d\n", \
+ __FILE__, __LINE__))
+
+#define INTERNAL_ESP_ERROR_NOPANIC \
+ (printk ("Internal ESP driver error in file %s, line %d\n", \
+ __FILE__, __LINE__))
+
+
+/*
+ * padding for register structure
+ */
+#ifdef CONFIG_JAZZ_ESP
+#define EREGS_PAD(n)
+#else
+#define EREGS_PAD(n) unchar n[3];
+#endif
-/* For dvma controller register definitions. */
-#include <asm/dma.h>
/* The ESP SCSI controllers have their register sets in three
* "classes":
@@ -24,47 +128,48 @@
* apart with a big-endian ordering to the bytes.
*/
-struct Sparc_ESP_regs {
+struct ESP_regs {
/* Access Description Offset */
volatile unchar esp_tclow; /* rw Low bits of the transfer count 0x00 */
- unchar tlpad1[3];
+ EREGS_PAD(tlpad);
volatile unchar esp_tcmed; /* rw Mid bits of the transfer count 0x04 */
- unchar fdpad[3];
+ EREGS_PAD(fdpad);
volatile unchar esp_fdata; /* rw FIFO data bits 0x08 */
- unchar cbpad[3];
+ EREGS_PAD(cbpad);
volatile unchar esp_cmd; /* rw SCSI command bits 0x0c */
- unchar stpad[3];
+ EREGS_PAD(stpad);
volatile unchar esp_status; /* ro ESP status register 0x10 */
#define esp_busid esp_status /* wo Bus ID for select/reselect 0x10 */
- unchar irqpd[3];
+ EREGS_PAD(irqpd);
volatile unchar esp_intrpt; /* ro Kind of interrupt 0x14 */
#define esp_timeo esp_intrpt /* wo Timeout value for select/resel 0x14 */
- unchar sspad[3];
+ EREGS_PAD(sspad);
volatile unchar esp_sstep; /* ro Sequence step register 0x18 */
#define esp_stp esp_sstep /* wo Transfer period per sync 0x18 */
- unchar ffpad[3];
+ EREGS_PAD(ffpad);
volatile unchar esp_fflags; /* ro Bits of current FIFO info 0x1c */
#define esp_soff esp_fflags /* wo Sync offset 0x1c */
- unchar cf1pd[3];
+ EREGS_PAD(cf1pd);
volatile unchar esp_cfg1; /* rw First configuration register 0x20 */
- unchar cfpad[3];
+ EREGS_PAD(cfpad);
volatile unchar esp_cfact; /* wo Clock conversion factor 0x24 */
#define esp_status2 esp_cfact /* ro HME status2 register 0x24 */
- unchar ctpad[3];
+ EREGS_PAD(ctpad);
volatile unchar esp_ctest; /* wo Chip test register 0x28 */
- unchar cf2pd[3];
+ EREGS_PAD(cf2pd);
volatile unchar esp_cfg2; /* rw Second configuration register 0x2c */
- unchar cf3pd[3];
+ EREGS_PAD(cf3pd);
/* The following is only found on the 53C9X series SCSI chips */
volatile unchar esp_cfg3; /* rw Third configuration register 0x30 */
- unchar thpd[7];
-
+ EREGS_PAD(holep);
+ volatile unchar esp_hole; /* hole in register map 0x34 */
+ EREGS_PAD(thpd);
/* The following is found on all chips except the NCR53C90 (ESP100) */
volatile unchar esp_tchi; /* rw High bits of transfer count 0x38 */
#define esp_uid esp_tchi /* ro Unique ID code 0x38 */
#define fas_rlo esp_tchi /* rw HME extended counter 0x38 */
- unchar fgpad[3];
+ EREGS_PAD(fgpad);
volatile unchar esp_fgrnd; /* rw Data base for fifo 0x3c */
#define fas_rhi esp_fgrnd /* rw HME extended counter 0x3c */
};
@@ -78,18 +183,19 @@ enum esp_rev {
fas100a = 0x04,
fast = 0x05,
fashme = 0x06,
- espunknown = 0x07
+ fas216 = 0x07,
+ espunknown = 0x08
};
/* We get one of these for each ESP probed. */
struct Sparc_ESP {
struct Sparc_ESP *next; /* Next ESP on probed or NULL */
- struct Sparc_ESP_regs *eregs; /* All esp registers */
- struct Linux_SBus_DMA *dma; /* Who I do transfers with. */
- struct sparc_dma_registers *dregs; /* And his registers. */
+ struct ESP_regs *eregs; /* All esp registers */
+ struct Linux_DMA *dma; /* Who I do transfers with. */
+ void *dregs; /* And his registers. */
struct Scsi_Host *ehost; /* Backpointer to SCSI Host */
- struct linux_sbus_device *edev; /* Pointer to SBus entry */
+ void *edev; /* Pointer to controller base/SBus */
char prom_name[64]; /* Name of ESP device from prom */
int prom_node; /* Prom node where ESP found */
int esp_id; /* Unique per-ESP ID number */
@@ -137,6 +243,7 @@ struct Sparc_ESP {
unsigned int sync_defp; /* Default sync transfer period */
unsigned int max_period; /* longest our period can be */
unsigned int min_period; /* shortest period we can withstand */
+ unsigned char ccf; /* Clock conversion factor */
/* For slow to medium speed input clock rates we shoot for 5mb/s,
* but for high input clock rates we try to do 10mb/s although I
* don't think a transfer can even run that fast with an ESP even
@@ -178,6 +285,40 @@ struct Sparc_ESP {
* cannot be assosciated with any specific command.
*/
unchar resetting_bus;
+
+ unchar do_pio_cmds; /* Do command transfer with pio */
+
+ /* Functions handling DMA
+ */
+ /* Required functions */
+ int (*dma_bytes_sent)(struct Sparc_ESP *, int);
+ int (*dma_can_transfer)(struct Sparc_ESP *, Scsi_Cmnd *);
+ void (*dma_dump_state)(struct Sparc_ESP *);
+ void (*dma_init_read)(struct Sparc_ESP *, char *, int);
+ void (*dma_init_write)(struct Sparc_ESP *, char *, int);
+ void (*dma_ints_off)(struct Sparc_ESP *);
+ void (*dma_ints_on)(struct Sparc_ESP *);
+ int (*dma_irq_p)(struct Sparc_ESP *);
+ int (*dma_ports_p)(struct Sparc_ESP *);
+ void (*dma_setup)(struct Sparc_ESP *, char *, int, int);
+
+ /* Optional functions (i.e. may be initialized to 0) */
+ void (*dma_barrier)(struct Sparc_ESP *);
+ void (*dma_drain)(struct Sparc_ESP *);
+ void (*dma_invalidate)(struct Sparc_ESP *);
+ void (*dma_irq_entry)(struct Sparc_ESP *);
+ void (*dma_irq_exit)(struct Sparc_ESP *);
+ void (*dma_led_off)(struct Sparc_ESP *);
+ void (*dma_led_on)(struct Sparc_ESP *);
+ void (*dma_poll)(struct Sparc_ESP *, unsigned char *);
+ void (*dma_reset)(struct Sparc_ESP *);
+
+ /* Optional virtual DMA functions */
+ void (*dma_mmu_get_scsi_one)(struct Sparc_ESP *, Scsi_Cmnd *);
+ void (*dma_mmu_get_scsi_sgl)(struct Sparc_ESP *, Scsi_Cmnd *);
+ void (*dma_mmu_release_scsi_one)(struct Sparc_ESP *, Scsi_Cmnd *);
+ void (*dma_mmu_release_scsi_sgl)(struct Sparc_ESP *, Scsi_Cmnd *);
+ void (*dma_advance_sg)(Scsi_Cmnd *);
};
/* Bitfield meanings for the above registers. */
@@ -384,42 +525,19 @@ struct Sparc_ESP {
#define ESP_MHZ_TO_CYCLE(mhertz) ((1000000000) / ((mhertz) / 1000))
#define ESP_TICK(ccf, cycle) ((7682 * (ccf) * (cycle) / 1000))
-extern int esp_detect(struct SHT *);
-extern const char *esp_info(struct Scsi_Host *);
-extern int esp_queue(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
-extern int esp_command(Scsi_Cmnd *);
-extern int esp_abort(Scsi_Cmnd *);
-extern int esp_reset(Scsi_Cmnd *, unsigned int);
-extern int esp_proc_info(char *buffer, char **start, off_t offset, int length,
- int hostno, int inout);
extern struct proc_dir_entry proc_scsi_esp;
-#define SCSI_SPARC_ESP { \
-/* struct SHT *next */ NULL, \
-/* struct module *module */ NULL, \
-/* struct proc_dir_entry *proc_dir */ &proc_scsi_esp, \
-/* int (*proc_info)(char *, char **, off_t, int, int, int) */ &esp_proc_info, \
-/* const char *name */ "Sun ESP 100/100a/200", \
-/* int detect(struct SHT *) */ esp_detect, \
-/* int release(struct Scsi_Host *) */ NULL, \
-/* const char *info(struct Scsi_Host *) */ esp_info, \
-/* int command(Scsi_Cmnd *) */ esp_command, \
-/* int queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *)) */ esp_queue, \
-/* int abort(Scsi_Cmnd *) */ esp_abort, \
-/* int reset(Scsi_Cmnd *, int) */ esp_reset, \
-/* int slave_attach(int, int) */ NULL, \
-/* int bios_param(Disk *, kdev_t, int[]) */ NULL, \
-/* int can_queue */ 7, \
-/* int this_id */ 7, \
-/* short unsigned int sg_tablesize */ SG_ALL, \
-/* short cmd_per_lun */ 1, \
-/* unsigned char present */ 0, \
-/* unsigned unchecked_isa_dma:1 */ 0, \
-/* unsigned use_clustering:1 */ DISABLE_CLUSTERING, }
+/* UGLY, UGLY, UGLY! */
+extern int nesps, esps_in_use, esps_running;
/* For our interrupt engine. */
#define for_each_esp(esp) \
for((esp) = espchain; (esp); (esp) = (esp)->next)
-#endif /* !(_SPARC_ESP_H) */
+
+/* External functions */
+extern struct Sparc_ESP *esp_allocate(Scsi_Host_Template *, void *);
+extern void esp_initialize(struct Sparc_ESP *);
+extern void esp_intr(int, void *, struct pt_regs *);
+#endif /* !(_ESP_H) */