diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-27 09:38:30 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-27 09:38:30 -0400 |
commit | 4706a7e03a03d6d206a93a49a0c723dd612cf8e9 (patch) | |
tree | aa78320ae86d353d1cdbd818deb8e0ddeaf8893d | |
parent | 6e87543a94fb2a966c81a61fc91246592f9719da (diff) |
ide: add "cdrom=" and "chs=" parameters
* Add "cdrom=" and "chs=" parameters.
* Obsolete "hdx=cdrom" and "hdx=cyls,heads,sects" kernel parameters.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r-- | Documentation/ide/ide.txt | 31 | ||||
-rw-r--r-- | drivers/ide/ide.c | 71 |
2 files changed, 80 insertions, 22 deletions
diff --git a/Documentation/ide/ide.txt b/Documentation/ide/ide.txt index 5bff93c89a23..caf24b21e7f5 100644 --- a/Documentation/ide/ide.txt +++ b/Documentation/ide/ide.txt | |||
@@ -82,17 +82,16 @@ Drives are normally found by auto-probing and/or examining the CMOS/BIOS data. | |||
82 | For really weird situations, the apparent (fdisk) geometry can also be specified | 82 | For really weird situations, the apparent (fdisk) geometry can also be specified |
83 | on the kernel "command line" using LILO. The format of such lines is: | 83 | on the kernel "command line" using LILO. The format of such lines is: |
84 | 84 | ||
85 | hdx=cyls,heads,sects | 85 | ide_core.chs=[interface_number.device_number]:cyls,heads,sects |
86 | or hdx=cdrom | 86 | or ide_core.cdrom=[interface_number.device_number] |
87 | 87 | ||
88 | where hdx can be any of hda through hdh, Three values are required | 88 | For example: |
89 | (cyls,heads,sects). For example: | ||
90 | 89 | ||
91 | hdc=1050,32,64 hdd=cdrom | 90 | ide_core.chs=1.0:1050,32,64 ide_core.cdrom=1.1 |
92 | 91 | ||
93 | either {hda,hdb} or {hdc,hdd}. The results of successful auto-probing may | 92 | The results of successful auto-probing may override the physical geometry/irq |
94 | override the physical geometry/irq specified, though the "original" geometry | 93 | specified, though the "original" geometry may be retained as the "logical" |
95 | may be retained as the "logical" geometry for partitioning purposes (fdisk). | 94 | geometry for partitioning purposes (fdisk). |
96 | 95 | ||
97 | If the auto-probing during boot time confuses a drive (ie. the drive works | 96 | If the auto-probing during boot time confuses a drive (ie. the drive works |
98 | with hd.c but not with ide.c), then an command line option may be specified | 97 | with hd.c but not with ide.c), then an command line option may be specified |
@@ -101,7 +100,7 @@ probe/identification sequence. For example: | |||
101 | 100 | ||
102 | ide_core.noprobe=0.1 | 101 | ide_core.noprobe=0.1 |
103 | or | 102 | or |
104 | hdc=768,16,32 | 103 | ide_core.chs=1.0:768,16,32 |
105 | ide_core.noprobe=1.0 | 104 | ide_core.noprobe=1.0 |
106 | 105 | ||
107 | Note that when only one IDE device is attached to an interface, it should be | 106 | Note that when only one IDE device is attached to an interface, it should be |
@@ -118,9 +117,9 @@ If for some reason your cdrom drive is *not* found at boot time, you can force | |||
118 | the probe to look harder by supplying a kernel command line parameter | 117 | the probe to look harder by supplying a kernel command line parameter |
119 | via LILO, such as: | 118 | via LILO, such as: |
120 | 119 | ||
121 | hdc=cdrom /* hdc = "master" on second interface */ | 120 | ide_core.cdrom=1.0 /* "master" on second interface (hdc) */ |
122 | or | 121 | or |
123 | hdd=cdrom /* hdd = "slave" on second interface */ | 122 | ide_core.cdrom=1.1 /* "slave" on second interface (hdd) */ |
124 | 123 | ||
125 | For example, a GW2000 system might have a hard drive on the primary | 124 | For example, a GW2000 system might have a hard drive on the primary |
126 | interface (/dev/hda) and an IDE cdrom drive on the secondary interface | 125 | interface (/dev/hda) and an IDE cdrom drive on the secondary interface |
@@ -182,12 +181,6 @@ driver using the "options=" keyword to insmod, while replacing any ',' with | |||
182 | Summary of ide driver parameters for kernel command line | 181 | Summary of ide driver parameters for kernel command line |
183 | -------------------------------------------------------- | 182 | -------------------------------------------------------- |
184 | 183 | ||
185 | "hdx=" is recognized for all "x" from "a" to "u", such as "hdc". | ||
186 | |||
187 | "hdx=cdrom" : drive is present, and is a cdrom drive | ||
188 | |||
189 | "hdx=cyl,head,sect" : disk drive is present, with specified geometry | ||
190 | |||
191 | "ide=doubler" : probe/support IDE doublers on Amiga | 184 | "ide=doubler" : probe/support IDE doublers on Amiga |
192 | 185 | ||
193 | There may be more options than shown -- use the source, Luke! | 186 | There may be more options than shown -- use the source, Luke! |
@@ -230,6 +223,10 @@ Other kernel parameters for ide_core are: | |||
230 | 223 | ||
231 | * "nowerr=[interface_number.device_number]" to ignore the WRERR_STAT bit | 224 | * "nowerr=[interface_number.device_number]" to ignore the WRERR_STAT bit |
232 | 225 | ||
226 | * "cdrom=[interface_number.device_number]" to force device as a CD-ROM | ||
227 | |||
228 | * "chs=[interface_number.device_number]" to force device as a disk (using CHS) | ||
229 | |||
233 | ================================================================================ | 230 | ================================================================================ |
234 | 231 | ||
235 | Some Terminology | 232 | Some Terminology |
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index d8f40ee74ce8..a4bceeecde70 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c | |||
@@ -924,7 +924,7 @@ static int __init ide_setup(char *s) | |||
924 | drive->media = ide_cdrom; | 924 | drive->media = ide_cdrom; |
925 | /* an ATAPI device ignores DRDY */ | 925 | /* an ATAPI device ignores DRDY */ |
926 | drive->ready_stat = 0; | 926 | drive->ready_stat = 0; |
927 | goto done; | 927 | goto obsolete_option; |
928 | case -5: /* nodma */ | 928 | case -5: /* nodma */ |
929 | drive->nodma = 1; | 929 | drive->nodma = 1; |
930 | goto obsolete_option; | 930 | goto obsolete_option; |
@@ -948,7 +948,7 @@ static int __init ide_setup(char *s) | |||
948 | drive->sect = drive->bios_sect = vals[2]; | 948 | drive->sect = drive->bios_sect = vals[2]; |
949 | drive->present = 1; | 949 | drive->present = 1; |
950 | drive->forced_geom = 1; | 950 | drive->forced_geom = 1; |
951 | goto done; | 951 | goto obsolete_option; |
952 | default: | 952 | default: |
953 | goto bad_option; | 953 | goto bad_option; |
954 | } | 954 | } |
@@ -975,9 +975,6 @@ bad_option: | |||
975 | obsolete_option: | 975 | obsolete_option: |
976 | printk(" -- OBSOLETE OPTION, WILL BE REMOVED SOON!\n"); | 976 | printk(" -- OBSOLETE OPTION, WILL BE REMOVED SOON!\n"); |
977 | return 1; | 977 | return 1; |
978 | done: | ||
979 | printk("\n"); | ||
980 | return 1; | ||
981 | } | 978 | } |
982 | 979 | ||
983 | EXPORT_SYMBOL(ide_lock); | 980 | EXPORT_SYMBOL(ide_lock); |
@@ -1167,6 +1164,51 @@ static unsigned int ide_nowerr; | |||
1167 | module_param_call(nowerr, ide_set_dev_param_mask, NULL, &ide_nowerr, 0); | 1164 | 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"); | 1165 | MODULE_PARM_DESC(nowerr, "ignore the WRERR_STAT bit for a device"); |
1169 | 1166 | ||
1167 | static unsigned int ide_cdroms; | ||
1168 | |||
1169 | module_param_call(cdrom, ide_set_dev_param_mask, NULL, &ide_cdroms, 0); | ||
1170 | MODULE_PARM_DESC(cdrom, "force device as a CD-ROM"); | ||
1171 | |||
1172 | struct chs_geom { | ||
1173 | unsigned int cyl; | ||
1174 | u8 head; | ||
1175 | u8 sect; | ||
1176 | }; | ||
1177 | |||
1178 | static unsigned int ide_disks; | ||
1179 | static struct chs_geom ide_disks_chs[MAX_HWIFS * MAX_DRIVES]; | ||
1180 | |||
1181 | static int ide_set_disk_chs(const char *str, struct kernel_param *kp) | ||
1182 | { | ||
1183 | int a, b, c = 0, h = 0, s = 0, i, j = 1; | ||
1184 | |||
1185 | if (sscanf(str, "%d.%d:%d,%d,%d", &a, &b, &c, &h, &s) != 5 && | ||
1186 | sscanf(str, "%d.%d:%d", &a, &b, &j) != 3) | ||
1187 | return -EINVAL; | ||
1188 | |||
1189 | i = a * MAX_DRIVES + b; | ||
1190 | |||
1191 | if (i >= MAX_HWIFS * MAX_DRIVES || j < 0 || j > 1) | ||
1192 | return -EINVAL; | ||
1193 | |||
1194 | if (c > INT_MAX || h > 255 || s > 255) | ||
1195 | return -EINVAL; | ||
1196 | |||
1197 | if (j) | ||
1198 | ide_disks |= (1 << i); | ||
1199 | else | ||
1200 | ide_disks &= (1 << i); | ||
1201 | |||
1202 | ide_disks_chs[i].cyl = c; | ||
1203 | ide_disks_chs[i].head = h; | ||
1204 | ide_disks_chs[i].sect = s; | ||
1205 | |||
1206 | return 0; | ||
1207 | } | ||
1208 | |||
1209 | module_param_call(chs, ide_set_disk_chs, NULL, NULL, 0); | ||
1210 | MODULE_PARM_DESC(chs, "force device as a disk (using CHS)"); | ||
1211 | |||
1170 | static void ide_dev_apply_params(ide_drive_t *drive) | 1212 | static void ide_dev_apply_params(ide_drive_t *drive) |
1171 | { | 1213 | { |
1172 | int i = drive->hwif->index * MAX_DRIVES + drive->select.b.unit; | 1214 | int i = drive->hwif->index * MAX_DRIVES + drive->select.b.unit; |
@@ -1189,6 +1231,25 @@ static void ide_dev_apply_params(ide_drive_t *drive) | |||
1189 | drive->name); | 1231 | drive->name); |
1190 | drive->bad_wstat = BAD_R_STAT; | 1232 | drive->bad_wstat = BAD_R_STAT; |
1191 | } | 1233 | } |
1234 | if (ide_cdroms & (1 << i)) { | ||
1235 | printk(KERN_INFO "ide: forcing %s as a CD-ROM\n", drive->name); | ||
1236 | drive->present = 1; | ||
1237 | drive->media = ide_cdrom; | ||
1238 | /* an ATAPI device ignores DRDY */ | ||
1239 | drive->ready_stat = 0; | ||
1240 | } | ||
1241 | if (ide_disks & (1 << i)) { | ||
1242 | drive->cyl = drive->bios_cyl = ide_disks_chs[i].cyl; | ||
1243 | drive->head = drive->bios_head = ide_disks_chs[i].head; | ||
1244 | drive->sect = drive->bios_sect = ide_disks_chs[i].sect; | ||
1245 | drive->forced_geom = 1; | ||
1246 | printk(KERN_INFO "ide: forcing %s as a disk (%d/%d/%d)\n", | ||
1247 | drive->name, | ||
1248 | drive->cyl, drive->head, drive->sect); | ||
1249 | drive->present = 1; | ||
1250 | drive->media = ide_disk; | ||
1251 | drive->ready_stat = READY_STAT; | ||
1252 | } | ||
1192 | } | 1253 | } |
1193 | 1254 | ||
1194 | static unsigned int ide_ignore_cable; | 1255 | static unsigned int ide_ignore_cable; |