ide: add "ignore_cable" parameter (take 2)
Add "ignore_cable" parameter: * "ide_core.ignore_cable=[interface_number]" boot option if IDE is built-in (i.e. "ide_core.ignore_cable=1" to force ignoring cable for "ide1") * "ignore_cable=[interface_number]" module parameter (for ide_core module) if IDE is compiled as module v2: * Add ide_port_apply_params() helper - use it in ide_device_add_all() and ide_scan_port(). * Make it possible to later disable ignoring cable detection by passing "[interface_number]:0" to /sys/module/ide_core/parameters/ignore_cable (however sysfs interface is not enabled yet since it needs some other IDE changes to make it work reliable). Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
This commit is contained in:
parent
9c391bae6a
commit
9fd91d959f
4 changed files with 53 additions and 6 deletions
|
@ -224,11 +224,6 @@ Summary of ide driver parameters for kernel command line
|
|||
|
||||
"idex=reset" : reset interface after probe
|
||||
|
||||
"idex=ata66" : informs the interface that it has an 80c cable
|
||||
for chipsets that are ATA-66 capable, but the
|
||||
ability to bit test for detection is currently
|
||||
unknown.
|
||||
|
||||
"ide=doubler" : probe/support IDE doublers on Amiga
|
||||
|
||||
There may be more options than shown -- use the source, Luke!
|
||||
|
@ -251,6 +246,16 @@ are detected automatically).
|
|||
You also need to use "probe" kernel parameter for ide-4drives driver
|
||||
(support for IDE generic chipset with four drives on one port).
|
||||
|
||||
To force ignoring cable detection (this should be needed only if you're using
|
||||
short 40-wires cable which cannot be automatically detected - if this is not
|
||||
a case please report it as a bug instead) use "ignore_cable" kernel parameter:
|
||||
|
||||
* "ide_core.ignore_cable=[interface_number]" boot option if IDE is built-in
|
||||
(i.e. "ide_core.ignore_cable=1" to force ignoring cable for "ide1")
|
||||
|
||||
* "ignore_cable=[interface_number]" module parameter (for ide_core module)
|
||||
if IDE is compiled as module
|
||||
|
||||
================================================================================
|
||||
|
||||
Some Terminology
|
||||
|
|
|
@ -1518,13 +1518,20 @@ int ide_device_add_all(u8 *idx, const struct ide_port_info *d)
|
|||
int i, rc = 0;
|
||||
|
||||
for (i = 0; i < MAX_HWIFS; i++) {
|
||||
if (d == NULL || idx[i] == 0xff) {
|
||||
if (idx[i] == 0xff) {
|
||||
mate = NULL;
|
||||
continue;
|
||||
}
|
||||
|
||||
hwif = &ide_hwifs[idx[i]];
|
||||
|
||||
ide_port_apply_params(hwif);
|
||||
|
||||
if (d == NULL) {
|
||||
mate = NULL;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (d->chipset != ide_etrax100 && (i & 1) && mate) {
|
||||
hwif->mate = mate;
|
||||
mate->mate = hwif;
|
||||
|
@ -1621,6 +1628,7 @@ EXPORT_SYMBOL_GPL(ide_device_add);
|
|||
|
||||
void ide_port_scan(ide_hwif_t *hwif)
|
||||
{
|
||||
ide_port_apply_params(hwif);
|
||||
ide_port_cable_detect(hwif);
|
||||
ide_port_init_devices(hwif);
|
||||
|
||||
|
|
|
@ -1239,6 +1239,38 @@ static void ide_port_class_release(struct device *portdev)
|
|||
put_device(&hwif->gendev);
|
||||
}
|
||||
|
||||
static unsigned int ide_ignore_cable;
|
||||
|
||||
static int ide_set_ignore_cable(const char *s, struct kernel_param *kp)
|
||||
{
|
||||
int i, j = 1;
|
||||
|
||||
if (sscanf(s, "%d:%d", &i, &j) != 2 && sscanf(s, "%d", &i) != 1)
|
||||
return -EINVAL;
|
||||
|
||||
if (i >= MAX_HWIFS || j < 0 || j > 1)
|
||||
return -EINVAL;
|
||||
|
||||
if (j)
|
||||
ide_ignore_cable |= (1 << i);
|
||||
else
|
||||
ide_ignore_cable &= (1 << i);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
module_param_call(ignore_cable, ide_set_ignore_cable, NULL, NULL, 0);
|
||||
MODULE_PARM_DESC(ignore_cable, "ignore cable detection");
|
||||
|
||||
void ide_port_apply_params(ide_hwif_t *hwif)
|
||||
{
|
||||
if (ide_ignore_cable & (1 << hwif->index)) {
|
||||
printk(KERN_INFO "ide: ignoring cable detection for %s\n",
|
||||
hwif->name);
|
||||
hwif->cbl = ATA_CBL_PATA40_SHORT;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This is gets invoked once during initialization, to set *everything* up
|
||||
*/
|
||||
|
|
|
@ -1222,6 +1222,8 @@ void ide_unregister_region(struct gendisk *);
|
|||
|
||||
void ide_undecoded_slave(ide_drive_t *);
|
||||
|
||||
void ide_port_apply_params(ide_hwif_t *);
|
||||
|
||||
int ide_device_add_all(u8 *idx, const struct ide_port_info *);
|
||||
int ide_device_add(u8 idx[4], const struct ide_port_info *);
|
||||
int ide_legacy_device_add(const struct ide_port_info *, unsigned long);
|
||||
|
|
Loading…
Reference in a new issue