Commit 6e87543a94fb2a966c81a61fc91246592f9719da

Authored by Bartlomiej Zolnierkiewicz
1 parent 207daeaabb

ide: add "nodma|noflush|noprobe|nowerr=" parameters

* Add "nodma|noflush|noprobe|nowerr=" parameters.

* Obsolete "hdx=noprobe|none|nowerr|nodma|noflush" kernel parameters.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

Showing 2 changed files with 88 additions and 17 deletions Side-by-side Diff

Documentation/ide/ide.txt
... ... @@ -99,10 +99,10 @@
99 99 for each drive for which you'd like the drive to skip the hardware
100 100 probe/identification sequence. For example:
101 101  
102   - hdb=noprobe
  102 + ide_core.noprobe=0.1
103 103 or
104 104 hdc=768,16,32
105   - hdc=noprobe
  105 + ide_core.noprobe=1.0
106 106  
107 107 Note that when only one IDE device is attached to an interface, it should be
108 108 jumpered as "single" or "master", *not* "slave". Many folks have had
109 109  
110 110  
... ... @@ -174,11 +174,9 @@
174 174  
175 175 When ide.c is used as a module, you can pass command line parameters to the
176 176 driver using the "options=" keyword to insmod, while replacing any ',' with
177   -';'. For example:
  177 +';'.
178 178  
179   - insmod ide.o options="hda=nodma hdb=nodma"
180 179  
181   -
182 180 ================================================================================
183 181  
184 182 Summary of ide driver parameters for kernel command line
185 183  
... ... @@ -186,18 +184,10 @@
186 184  
187 185 "hdx=" is recognized for all "x" from "a" to "u", such as "hdc".
188 186  
189   - "hdx=noprobe" : drive may be present, but do not probe for it
190   -
191   - "hdx=none" : drive is NOT present, ignore cmos and do not probe
192   -
193   - "hdx=nowerr" : ignore the WRERR_STAT bit on this drive
194   -
195 187 "hdx=cdrom" : drive is present, and is a cdrom drive
196 188  
197 189 "hdx=cyl,head,sect" : disk drive is present, with specified geometry
198 190  
199   - "hdx=nodma" : disallow DMA
200   -
201 191 "ide=doubler" : probe/support IDE doublers on Amiga
202 192  
203 193 There may be more options than shown -- use the source, Luke!
... ... @@ -229,6 +219,16 @@
229 219  
230 220 * "ignore_cable=[interface_number]" module parameter (for ide_core module)
231 221 if IDE is compiled as module
  222 +
  223 +Other kernel parameters for ide_core are:
  224 +
  225 +* "nodma=[interface_number.device_number]" to disallow DMA for a device
  226 +
  227 +* "noflush=[interface_number.device_number]" to disable flush requests
  228 +
  229 +* "noprobe=[interface_number.device_number]" to skip probing
  230 +
  231 +* "nowerr=[interface_number.device_number]" to ignore the WRERR_STAT bit
232 232  
233 233 ================================================================================
234 234  
... ... @@ -915,10 +915,10 @@
915 915 case -1: /* "none" */
916 916 case -2: /* "noprobe" */
917 917 drive->noprobe = 1;
918   - goto done;
  918 + goto obsolete_option;
919 919 case -3: /* "nowerr" */
920 920 drive->bad_wstat = BAD_R_STAT;
921   - goto done;
  921 + goto obsolete_option;
922 922 case -4: /* "cdrom" */
923 923 drive->present = 1;
924 924 drive->media = ide_cdrom;
925 925  
... ... @@ -927,10 +927,10 @@
927 927 goto done;
928 928 case -5: /* nodma */
929 929 drive->nodma = 1;
930   - goto done;
  930 + goto obsolete_option;
931 931 case -11: /* noflush */
932 932 drive->noflush = 1;
933   - goto done;
  933 + goto obsolete_option;
934 934 case -12: /* "remap" */
935 935 drive->remap_0_to_1 = 1;
936 936 goto obsolete_option;
... ... @@ -1125,6 +1125,72 @@
1125 1125 module_param_named(pci_clock, ide_pci_clk, int, 0);
1126 1126 MODULE_PARM_DESC(pci_clock, "PCI bus clock frequency (in MHz)");
1127 1127  
  1128 +static int ide_set_dev_param_mask(const char *s, struct kernel_param *kp)
  1129 +{
  1130 + int a, b, i, j = 1;
  1131 + unsigned int *dev_param_mask = (unsigned int *)kp->arg;
  1132 +
  1133 + if (sscanf(s, "%d.%d:%d", &a, &b, &j) != 3 &&
  1134 + sscanf(s, "%d.%d", &a, &b) != 2)
  1135 + return -EINVAL;
  1136 +
  1137 + i = a * MAX_DRIVES + b;
  1138 +
  1139 + if (i >= MAX_HWIFS * MAX_DRIVES || j < 0 || j > 1)
  1140 + return -EINVAL;
  1141 +
  1142 + if (j)
  1143 + *dev_param_mask |= (1 << i);
  1144 + else
  1145 + *dev_param_mask &= (1 << i);
  1146 +
  1147 + return 0;
  1148 +}
  1149 +
  1150 +static unsigned int ide_nodma;
  1151 +
  1152 +module_param_call(nodma, ide_set_dev_param_mask, NULL, &ide_nodma, 0);
  1153 +MODULE_PARM_DESC(nodma, "disallow DMA for a device");
  1154 +
  1155 +static unsigned int ide_noflush;
  1156 +
  1157 +module_param_call(noflush, ide_set_dev_param_mask, NULL, &ide_noflush, 0);
  1158 +MODULE_PARM_DESC(noflush, "disable flush requests for a device");
  1159 +
  1160 +static unsigned int ide_noprobe;
  1161 +
  1162 +module_param_call(noprobe, ide_set_dev_param_mask, NULL, &ide_noprobe, 0);
  1163 +MODULE_PARM_DESC(noprobe, "skip probing for a device");
  1164 +
  1165 +static unsigned int ide_nowerr;
  1166 +
  1167 +module_param_call(nowerr, ide_set_dev_param_mask, NULL, &ide_nowerr, 0);
  1168 +MODULE_PARM_DESC(nowerr, "ignore the WRERR_STAT bit for a device");
  1169 +
  1170 +static void ide_dev_apply_params(ide_drive_t *drive)
  1171 +{
  1172 + int i = drive->hwif->index * MAX_DRIVES + drive->select.b.unit;
  1173 +
  1174 + if (ide_nodma & (1 << i)) {
  1175 + printk(KERN_INFO "ide: disallowing DMA for %s\n", drive->name);
  1176 + drive->nodma = 1;
  1177 + }
  1178 + if (ide_noflush & (1 << i)) {
  1179 + printk(KERN_INFO "ide: disabling flush requests for %s\n",
  1180 + drive->name);
  1181 + drive->noflush = 1;
  1182 + }
  1183 + if (ide_noprobe & (1 << i)) {
  1184 + printk(KERN_INFO "ide: skipping probe for %s\n", drive->name);
  1185 + drive->noprobe = 1;
  1186 + }
  1187 + if (ide_nowerr & (1 << i)) {
  1188 + printk(KERN_INFO "ide: ignoring the WRERR_STAT bit for %s\n",
  1189 + drive->name);
  1190 + drive->bad_wstat = BAD_R_STAT;
  1191 + }
  1192 +}
  1193 +
1128 1194 static unsigned int ide_ignore_cable;
1129 1195  
1130 1196 static int ide_set_ignore_cable(const char *s, struct kernel_param *kp)
1131 1197  
... ... @@ -1150,11 +1216,16 @@
1150 1216  
1151 1217 void ide_port_apply_params(ide_hwif_t *hwif)
1152 1218 {
  1219 + int i;
  1220 +
1153 1221 if (ide_ignore_cable & (1 << hwif->index)) {
1154 1222 printk(KERN_INFO "ide: ignoring cable detection for %s\n",
1155 1223 hwif->name);
1156 1224 hwif->cbl = ATA_CBL_PATA40_SHORT;
1157 1225 }
  1226 +
  1227 + for (i = 0; i < MAX_DRIVES; i++)
  1228 + ide_dev_apply_params(&hwif->drives[i]);
1158 1229 }
1159 1230  
1160 1231 /*