|
|
1.1 ! root 1: /* Driver for the PPA3 parallel port SCSI HBA embedded in ! 2: * the Iomega ZIP drive ! 3: * ! 4: * (c) 1996 Grant R. Guenther [email protected] ! 5: * David Campbell [email protected] ! 6: * ! 7: * All comments to David. ! 8: */ ! 9: ! 10: #include <linux/config.h> /* CONFIG_SCSI_PPA_HAVE_PEDANTIC */ ! 11: #ifndef _PPA_H ! 12: #define _PPA_H ! 13: ! 14: #define PPA_VERSION "1.42" ! 15: ! 16: #if 0 ! 17: /* Use the following to enable certain chipset support ! 18: * Default is PEDANTIC = 3 ! 19: */ ! 20: #ifndef CONFIG_SCSI_PPA_HAVE_PEDANTIC ! 21: #define CONFIG_SCSI_PPA_HAVE_PEDANTIC 3 ! 22: #endif ! 23: #endif ! 24: ! 25: /* ! 26: * this driver has been hacked by Matteo Frigo ([email protected]) ! 27: * to support EPP and scatter-gather. [0.26-athena] ! 28: * ! 29: * additional hacks by David Campbell ! 30: * in response to this driver "mis-behaving" on his machine. ! 31: * Fixed EPP to handle "software" changing of EPP port data direction. ! 32: * Chased down EPP timeouts ! 33: * Made this driver "kernel version friendly" [0.28-athena] ! 34: * ! 35: * [ Stuff removed ] ! 36: * ! 37: * Compiled against 2.1.53. ! 38: * Rebuilt ppa_abort() function, should handle unplugged cable. ! 39: * [1.35s] ! 40: * ! 41: * PPA now auto probes for EPP on base address which are aligned on ! 42: * 8 byte boundaries (0x278 & 0x378) using the attached devices. ! 43: * This hopefully avoids the nasty problem of trying to detect EPP. ! 44: * Tested on 2.1.53 [1.36] ! 45: * ! 46: * The id_probe utility no longer performs read/write tests. ! 47: * Additional code included for checking the Intel ECP bug ! 48: * (Bit 0 of STR stuck low which fools the EPP detection routine) ! 49: * [1.37] ! 50: * ! 51: * Oops! Got the bit sign mixed up for the Intel bug check. ! 52: * Found that an additional delay is required during SCSI resets ! 53: * to allow devices to settle down. ! 54: * [1.38] ! 55: * ! 56: * Fixed all problems in the parport sharing scheme. Now ppa can be safe ! 57: * used with lp or other parport devices on the same parallel port. ! 58: * 1997 by Andrea Arcangeli ! 59: * [1.39] ! 60: * ! 61: * Little fix in ppa engine to ensure that ppa don' t release parport ! 62: * or disconnect in wrong cases. ! 63: * 1997 by Andrea Arcangeli ! 64: * [1.40] ! 65: * ! 66: * Corrected ppa.h for 2.1.x kernels (>=2.1.85) ! 67: * Modified "Nat Semi Kludge" for extended chipsets ! 68: * [1.41] ! 69: * ! 70: * Fixed id_probe for EPP 1.9 chipsets (misdetected as EPP 1.7) ! 71: * [1.42] ! 72: */ ! 73: /* ------ END OF USER CONFIGURABLE PARAMETERS ----- */ ! 74: ! 75: #ifdef PPA_CODE ! 76: #include <linux/stddef.h> ! 77: #include <linux/module.h> ! 78: #include <linux/kernel.h> ! 79: #include <linux/tqueue.h> ! 80: #include <linux/ioport.h> ! 81: #include <linux/delay.h> ! 82: #include <linux/proc_fs.h> ! 83: #include <linux/stat.h> ! 84: #include <linux/blk.h> ! 85: #include <linux/sched.h> ! 86: #include <linux/interrupt.h> ! 87: ! 88: #include <asm/io.h> ! 89: #include "sd.h" ! 90: #include "hosts.h" ! 91: /* batteries not included :-) */ ! 92: ! 93: /* ! 94: * modes in which the driver can operate ! 95: */ ! 96: #define PPA_AUTODETECT 0 /* Autodetect mode */ ! 97: #define PPA_NIBBLE 1 /* work in standard 4 bit mode */ ! 98: #define PPA_PS2 2 /* PS/2 byte mode */ ! 99: #define PPA_EPP_8 3 /* EPP mode, 8 bit */ ! 100: #define PPA_EPP_16 4 /* EPP mode, 16 bit */ ! 101: #define PPA_EPP_32 5 /* EPP mode, 32 bit */ ! 102: #define PPA_UNKNOWN 6 /* Just in case... */ ! 103: ! 104: static char *PPA_MODE_STRING[] = ! 105: { ! 106: "Autodetect", ! 107: "SPP", ! 108: "PS/2", ! 109: "EPP 8 bit", ! 110: "EPP 16 bit", ! 111: "EPP 32 bit", ! 112: "Unknown"}; ! 113: ! 114: /* This is a global option */ ! 115: int ppa_sg = SG_ALL; /* enable/disable scatter-gather. */ ! 116: ! 117: /* other options */ ! 118: #define PPA_CAN_QUEUE 1 /* use "queueing" interface */ ! 119: #define PPA_BURST_SIZE 512 /* data burst size */ ! 120: #define PPA_SELECT_TMO 5000 /* how long to wait for target ? */ ! 121: #define PPA_SPIN_TMO 50000 /* ppa_wait loop limiter */ ! 122: #define PPA_DEBUG 0 /* debuging option */ ! 123: #define IN_EPP_MODE(x) (x == PPA_EPP_8 || x == PPA_EPP_16 || x == PPA_EPP_32) ! 124: ! 125: /* args to ppa_connect */ ! 126: #define CONNECT_EPP_MAYBE 1 ! 127: #define CONNECT_NORMAL 0 ! 128: ! 129: #define r_dtr(x) (unsigned char)inb((x)) ! 130: #define r_str(x) (unsigned char)inb((x)+1) ! 131: #define r_ctr(x) (unsigned char)inb((x)+2) ! 132: #define r_epp(x) (unsigned char)inb((x)+4) ! 133: #define r_fifo(x) (unsigned char)inb((x)+0x400) ! 134: #define r_ecr(x) (unsigned char)inb((x)+0x402) ! 135: ! 136: #define w_dtr(x,y) outb(y, (x)) ! 137: #define w_str(x,y) outb(y, (x)+1) ! 138: #define w_ctr(x,y) outb(y, (x)+2) ! 139: #define w_epp(x,y) outb(y, (x)+4) ! 140: #define w_fifo(x,y) outb(y, (x)+0x400) ! 141: #define w_ecr(x,y) outb(y, (x)+0x402) ! 142: ! 143: static int ppa_engine(ppa_struct *, Scsi_Cmnd *); ! 144: static int ppa_in(int, char *, int); ! 145: static int ppa_init(int); ! 146: static void ppa_interrupt(void *); ! 147: static int ppa_out(int, char *, int); ! 148: ! 149: struct proc_dir_entry proc_scsi_ppa = ! 150: {PROC_SCSI_PPA, 3, "ppa", S_IFDIR | S_IRUGO | S_IXUGO, 2}; ! 151: #else ! 152: extern struct proc_dir_entry proc_scsi_ppa; ! 153: #endif ! 154: ! 155: int ppa_detect(Scsi_Host_Template *); ! 156: const char *ppa_info(struct Scsi_Host *); ! 157: int ppa_queuecommand(Scsi_Cmnd *, void (*done) (Scsi_Cmnd *)); ! 158: int ppa_abort(Scsi_Cmnd *); ! 159: int ppa_reset(Scsi_Cmnd *, unsigned int); ! 160: int ppa_proc_info(char *, char **, off_t, int, int, int); ! 161: int ppa_biosparam(Disk *, kdev_t, int *); ! 162: ! 163: #define PPA { proc_dir: &proc_scsi_ppa, \ ! 164: proc_info: ppa_proc_info, \ ! 165: name: "Iomega parport ZIP drive", \ ! 166: detect: ppa_detect, \ ! 167: queuecommand: ppa_queuecommand, \ ! 168: abort: ppa_abort, \ ! 169: reset: ppa_reset, \ ! 170: bios_param: ppa_biosparam, \ ! 171: this_id: -1, \ ! 172: sg_tablesize: SG_ALL, \ ! 173: cmd_per_lun: 1, \ ! 174: use_clustering: ENABLE_CLUSTERING \ ! 175: } ! 176: #endif /* _PPA_H */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.