blob: d60a89cb8052b2f20f12d77b583a82429b73b603 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Generic Generic NCR5380 driver defines
3 *
4 * Copyright 1993, Drew Eckhardt
5 * Visionary Computing
6 * (Unix and Linux consulting and custom programming)
7 * drew@colorado.edu
8 * +1 (303) 440-4894
9 *
10 * NCR53C400 extensions (c) 1994,1995,1996, Kevin Lentin
11 * K.Lentin@cs.monash.edu.au
12 *
13 * ALPHA RELEASE 1.
14 *
15 * For more information, please consult
16 *
17 * NCR 5380 Family
18 * SCSI Protocol Controller
19 * Databook
20 *
21 * NCR Microelectronics
22 * 1635 Aeroplaza Drive
23 * Colorado Springs, CO 80916
24 * 1+ (719) 578-3400
25 * 1+ (800) 334-5454
26 */
27
28/*
29 * $Log: generic_NCR5380.h,v $
30 */
31
32#ifndef GENERIC_NCR5380_H
33#define GENERIC_NCR5380_H
34
35#include <linux/config.h>
36
37#define GENERIC_NCR5380_PUBLIC_RELEASE 1
38
39#ifdef NCR53C400
40#define BIOSPARAM
41#define NCR5380_BIOSPARAM generic_NCR5380_biosparam
42#else
43#define NCR5380_BIOSPARAM NULL
44#endif
45
46#ifndef ASM
47static int generic_NCR5380_abort(Scsi_Cmnd *);
Christoph Hellwigd0be4a7d2005-10-31 18:31:40 +010048static int generic_NCR5380_detect(struct scsi_host_template *);
Linus Torvalds1da177e2005-04-16 15:20:36 -070049static int generic_NCR5380_release_resources(struct Scsi_Host *);
50static int generic_NCR5380_queue_command(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
51static int generic_NCR5380_bus_reset(Scsi_Cmnd *);
Linus Torvalds1da177e2005-04-16 15:20:36 -070052static const char* generic_NCR5380_info(struct Scsi_Host *);
53
54#ifndef CMD_PER_LUN
55#define CMD_PER_LUN 2
56#endif
57
58#ifndef CAN_QUEUE
59#define CAN_QUEUE 16
60#endif
61
62#ifndef HOSTS_C
63
64#define __STRVAL(x) #x
65#define STRVAL(x) __STRVAL(x)
66
67#ifndef CONFIG_SCSI_G_NCR5380_MEM
68
69#define NCR5380_map_config port
70#define NCR5380_map_type int
71#define NCR5380_map_name port
72#define NCR5380_instance_name io_port
73#define NCR53C400_register_offset 0
74#define NCR53C400_address_adjust 8
75
76#ifdef NCR53C400
77#define NCR5380_region_size 16
78#else
79#define NCR5380_region_size 8
80#endif
81
82#define NCR5380_read(reg) (inb(NCR5380_map_name + (reg)))
83#define NCR5380_write(reg, value) (outb((value), (NCR5380_map_name + (reg))))
84
Al Viroc818cb62006-03-24 03:15:37 -080085#define NCR5380_implementation_fields \
86 NCR5380_map_type NCR5380_map_name
87
88#define NCR5380_local_declare() \
89 register NCR5380_implementation_fields
90
91#define NCR5380_setup(instance) \
92 NCR5380_map_name = (NCR5380_map_type)((instance)->NCR5380_instance_name)
93
Linus Torvalds1da177e2005-04-16 15:20:36 -070094#else
95/* therefore CONFIG_SCSI_G_NCR5380_MEM */
96
97#define NCR5380_map_config memory
98#define NCR5380_map_type unsigned long
99#define NCR5380_map_name base
100#define NCR5380_instance_name base
101#define NCR53C400_register_offset 0x108
102#define NCR53C400_address_adjust 0
103#define NCR53C400_mem_base 0x3880
104#define NCR53C400_host_buffer 0x3900
105#define NCR5380_region_size 0x3a00
106
Al Viroc818cb62006-03-24 03:15:37 -0800107#define NCR5380_read(reg) readb(iomem + NCR53C400_mem_base + (reg))
108#define NCR5380_write(reg, value) writeb(value, iomem + NCR53C400_mem_base + (reg))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700109
110#define NCR5380_implementation_fields \
Al Viroc818cb62006-03-24 03:15:37 -0800111 NCR5380_map_type NCR5380_map_name; \
112 void __iomem *iomem;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700113
114#define NCR5380_local_declare() \
Al Viroc818cb62006-03-24 03:15:37 -0800115 register void __iomem *iomem
Linus Torvalds1da177e2005-04-16 15:20:36 -0700116
117#define NCR5380_setup(instance) \
Al Viroc818cb62006-03-24 03:15:37 -0800118 iomem = (((struct NCR5380_hostdata *)(instance)->hostdata).iomem)
119
120#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700121
122#define NCR5380_intr generic_NCR5380_intr
123#define NCR5380_queue_command generic_NCR5380_queue_command
124#define NCR5380_abort generic_NCR5380_abort
125#define NCR5380_bus_reset generic_NCR5380_bus_reset
Linus Torvalds1da177e2005-04-16 15:20:36 -0700126#define NCR5380_pread generic_NCR5380_pread
127#define NCR5380_pwrite generic_NCR5380_pwrite
128#define NCR5380_proc_info notyet_generic_proc_info
129
130#define BOARD_NCR5380 0
131#define BOARD_NCR53C400 1
132#define BOARD_NCR53C400A 2
133#define BOARD_DTC3181E 3
134
135#endif /* else def HOSTS_C */
136#endif /* ndef ASM */
137#endif /* GENERIC_NCR5380_H */
138