aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/mac_scsi.c
diff options
context:
space:
mode:
authorFinn Thain <fthain@telegraphics.com.au>2014-11-12 00:12:05 -0500
committerChristoph Hellwig <hch@lst.de>2014-11-20 03:11:12 -0500
commit6e9ae6d560e1a60113ef2a4d27eeb4931048b674 (patch)
tree5e34d6150c88f595ebca7869bdf13c84872a38e7 /drivers/scsi/mac_scsi.c
parent92de383154e98bc0b9c4b3364af3945076f77032 (diff)
mac_scsi: Add module option to Kconfig
Allow mac_scsi to be built as a module. Replace the old validation of __setup options with code that validates both module and __setup options. Signed-off-by: Finn Thain <fthain@telegraphics.com.au> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/scsi/mac_scsi.c')
-rw-r--r--drivers/scsi/mac_scsi.c112
1 files changed, 37 insertions, 75 deletions
diff --git a/drivers/scsi/mac_scsi.c b/drivers/scsi/mac_scsi.c
index 2b604a85f7c1..3b93f000499a 100644
--- a/drivers/scsi/mac_scsi.c
+++ b/drivers/scsi/mac_scsi.c
@@ -62,15 +62,18 @@
62static void mac_scsi_reset_boot(struct Scsi_Host *instance); 62static void mac_scsi_reset_boot(struct Scsi_Host *instance);
63#endif 63#endif
64 64
65static int setup_called = 0;
66static int setup_can_queue = -1; 65static int setup_can_queue = -1;
66module_param(setup_can_queue, int, 0);
67static int setup_cmd_per_lun = -1; 67static int setup_cmd_per_lun = -1;
68module_param(setup_cmd_per_lun, int, 0);
68static int setup_sg_tablesize = -1; 69static int setup_sg_tablesize = -1;
70module_param(setup_sg_tablesize, int, 0);
69static int setup_use_pdma = -1; 71static int setup_use_pdma = -1;
70#ifdef SUPPORT_TAGS 72module_param(setup_use_pdma, int, 0);
71static int setup_use_tagged_queuing = -1; 73static int setup_use_tagged_queuing = -1;
72#endif 74module_param(setup_use_tagged_queuing, int, 0);
73static int setup_hostid = -1; 75static int setup_hostid = -1;
76module_param(setup_hostid, int, 0);
74 77
75/* Time (in jiffies) to wait after a reset; the SCSI standard calls for 250ms, 78/* Time (in jiffies) to wait after a reset; the SCSI standard calls for 250ms,
76 * we usually do 0.5s to be on the safe side. But Toshiba CD-ROMs once more 79 * we usually do 0.5s to be on the safe side. But Toshiba CD-ROMs once more
@@ -102,72 +105,34 @@ static __inline__ void macscsi_write(struct Scsi_Host *instance, int reg, int va
102 out_8(instance->io_port + (reg<<4), value); 105 out_8(instance->io_port + (reg<<4), value);
103} 106}
104 107
105/* 108#ifndef MODULE
106 * Function : mac_scsi_setup(char *str) 109static int __init mac_scsi_setup(char *str)
107 * 110{
108 * Purpose : booter command line initialization of the overrides array,
109 *
110 * Inputs : str - comma delimited list of options
111 *
112 */
113
114static int __init mac_scsi_setup(char *str) {
115 int ints[7]; 111 int ints[7];
116 112
117 (void)get_options( str, ARRAY_SIZE(ints), ints); 113 (void)get_options(str, ARRAY_SIZE(ints), ints);
118 114
119 if (setup_called++ || ints[0] < 1 || ints[0] > 6) { 115 if (ints[0] < 1 || ints[0] > 6) {
120 printk(KERN_WARNING "scsi: <mac5380>" 116 pr_err("Usage: mac5380=<can_queue>[,<cmd_per_lun>[,<sg_tablesize>[,<hostid>[,<use_tags>[,<use_pdma>]]]]]\n");
121 " Usage: mac5380=<can_queue>[,<cmd_per_lun>,<sg_tablesize>,<hostid>,<use_tags>,<use_pdma>]\n"); 117 return 0;
122 printk(KERN_ALERT "scsi: <mac5380> Bad Penguin parameters?\n");
123 return 0;
124 }
125
126 if (ints[0] >= 1) {
127 if (ints[1] > 0)
128 /* no limits on this, just > 0 */
129 setup_can_queue = ints[1];
130 }
131 if (ints[0] >= 2) {
132 if (ints[2] > 0)
133 setup_cmd_per_lun = ints[2];
134 }
135 if (ints[0] >= 3) {
136 if (ints[3] >= 0) {
137 setup_sg_tablesize = ints[3];
138 /* Must be <= SG_ALL (255) */
139 if (setup_sg_tablesize > SG_ALL)
140 setup_sg_tablesize = SG_ALL;
141 }
142 }
143 if (ints[0] >= 4) {
144 /* Must be between 0 and 7 */
145 if (ints[4] >= 0 && ints[4] <= 7)
146 setup_hostid = ints[4];
147 else if (ints[4] > 7)
148 printk(KERN_WARNING "mac_scsi_setup: invalid host ID %d !\n", ints[4] );
149 }
150#ifdef SUPPORT_TAGS
151 if (ints[0] >= 5) {
152 if (ints[5] >= 0)
153 setup_use_tagged_queuing = !!ints[5];
154 } 118 }
155 119 if (ints[0] >= 1)
156 if (ints[0] == 6) { 120 setup_can_queue = ints[1];
157 if (ints[6] >= 0) 121 if (ints[0] >= 2)
122 setup_cmd_per_lun = ints[2];
123 if (ints[0] >= 3)
124 setup_sg_tablesize = ints[3];
125 if (ints[0] >= 4)
126 setup_hostid = ints[4];
127 if (ints[0] >= 5)
128 setup_use_tagged_queuing = ints[5];
129 if (ints[0] >= 6)
158 setup_use_pdma = ints[6]; 130 setup_use_pdma = ints[6];
159 }
160#else
161 if (ints[0] == 5) {
162 if (ints[5] >= 0)
163 setup_use_pdma = ints[5];
164 }
165#endif /* SUPPORT_TAGS */
166
167 return 1; 131 return 1;
168} 132}
169 133
170__setup("mac5380=", mac_scsi_setup); 134__setup("mac5380=", mac_scsi_setup);
135#endif /* !MODULE */
171 136
172/* 137/*
173 * Function : int macscsi_detect(struct scsi_host_template * tpnt) 138 * Function : int macscsi_detect(struct scsi_host_template * tpnt)
@@ -199,13 +164,8 @@ int __init macscsi_detect(struct scsi_host_template * tpnt)
199 tpnt->cmd_per_lun = setup_cmd_per_lun; 164 tpnt->cmd_per_lun = setup_cmd_per_lun;
200 if (setup_sg_tablesize >= 0) 165 if (setup_sg_tablesize >= 0)
201 tpnt->sg_tablesize = setup_sg_tablesize; 166 tpnt->sg_tablesize = setup_sg_tablesize;
202 167 if (setup_hostid >= 0)
203 if (setup_hostid >= 0) 168 tpnt->this_id = setup_hostid & 7;
204 tpnt->this_id = setup_hostid;
205 else {
206 /* use 7 as default */
207 tpnt->this_id = 7;
208 }
209 169
210#ifdef SUPPORT_TAGS 170#ifdef SUPPORT_TAGS
211 if (setup_use_tagged_queuing < 0) 171 if (setup_use_tagged_queuing < 0)
@@ -219,15 +179,15 @@ int __init macscsi_detect(struct scsi_host_template * tpnt)
219 return 0; 179 return 0;
220 180
221 if (macintosh_config->ident == MAC_MODEL_IIFX) { 181 if (macintosh_config->ident == MAC_MODEL_IIFX) {
222 mac_scsi_regp = via1+0x8000; 182 mac_scsi_regp = (unsigned char *) VIA1_BASE + 0x8000;
223 mac_scsi_drq = via1+0xE000; 183 mac_scsi_drq = (unsigned char *) VIA1_BASE + 0xE000;
224 mac_scsi_nodrq = via1+0xC000; 184 mac_scsi_nodrq = (unsigned char *) VIA1_BASE + 0xC000;
225 /* The IIFX should be able to do true DMA, but pseudo-dma doesn't work */ 185 /* The IIFX should be able to do true DMA, but pseudo-dma doesn't work */
226 flags = FLAG_NO_PSEUDO_DMA; 186 flags = FLAG_NO_PSEUDO_DMA;
227 } else { 187 } else {
228 mac_scsi_regp = via1+0x10000; 188 mac_scsi_regp = (unsigned char *) VIA1_BASE + 0x10000;
229 mac_scsi_drq = via1+0x6000; 189 mac_scsi_drq = (unsigned char *) VIA1_BASE + 0x6000;
230 mac_scsi_nodrq = via1+0x12000; 190 mac_scsi_nodrq = (unsigned char *) VIA1_BASE + 0x12000;
231 } 191 }
232 192
233 if (! setup_use_pdma) 193 if (! setup_use_pdma)
@@ -520,3 +480,5 @@ static struct scsi_host_template driver_template = {
520 480
521 481
522#include "scsi_module.c" 482#include "scsi_module.c"
483
484MODULE_LICENSE("GPL");