From: alsaggaf@gnu.ai.mit.edu (Muhammad Saggaf) Subject: Work-around for docked NEC IDE driver trouble I had a bit of a problem yesterday running linux on a docked NEC notebook, and I thought to share the solution with you. Let me elaborate a bit on the setup. For systems with two IDE controllers, CMOS on most motherbaords lists two entries for devices connected to the primary controller (devices 1 and 2), and two entries for the devices connected to the secondary controller (devices 3 and 4). The linux IDE driver obtains the geometries of the first two devices from CMOS and assigns them hda and hdb, and probes for the devices connected to the secondary and assigns them hdc and hdd. However, the driver apparently makes a certain assumption that although valid in the majority of cases, it is not valiad in all situations. That assumption is that "the first two devices in CMOS" is the same as "the devices connected to the primary IDE controller". Unfortunately, this is not always true. For example, a docked NEC notebook has only 3 entries in CMOS, the first lists the device connected to the primary IDE controller (the controller inside the notebook), and the other two list the devices connected to the secondary controller (in the docking station). Note the difference between this and a typical motherboard: Typical: This case: --- Entry 1 --- Entry 1 Primary IDE --| Primary IDE --| --- Entry 2 --- No entry --- Entry 3 --- Entry 2 Secondary IDE --| Primary IDE --| --- Entry 4 --- Entry 3 So what happens in this case? The kernel obtains the geometries for the first two devices from CMOS, and gets entries 1 and 2. However, entry 2 is on the secondary controller, and so hdb gets a bogus device. It then probes the secondary controller, and gets the equivalent of entries 2 and 3. Having a bogus device in hdb confuses the system though, and could break havoc on the non-bogus device, since the two refer to the same drive: Console: colour EGA+ 80x25, 1 virtual console (max 63) Calibrating delay loop.. ok - 25.04 BogoMips Serial driver version 4.11 with no serial options enabled tty00 at 0x03f8 (irq = 4) is a 16450 lp1 at 0x0378, using polling driver PS/2 auxiliary pointing device detected -- driver installed. ftape: allocated 3 buffers aligned at: 00210000 hda: DHAA-2405, 328MB w/32KB Cache, LBA, CHS=915/15/49, MaxMult=16 >> hdb: non-IDE device, CHS=1010/12/55 hdc: WDC AC2340H, 325MB w/128KB Cache, CHS=1010/12/55, MaxMult=16 ide1: secondary interface on irq 15 ide0: primary interface on irq 14 Floppy drive(s): fd0 is 1.44M ... Linux version 1.2.8 (root@bigkitty) (gcc version 2.6.3) #1 Sun May 7 12:24:55 CDT 1995 Partition check: hda: hda1 >> hdb: DRDY error: status=0x00 { } hdb: DRDY error: status=0x00 { } hdb: DRDY error: status=0x00 { } hdb: DRDY error: status=0x00 { } ide0: do_ide_reset: success hdb: DRDY error: status=0x00 { } hdb: DRDY error: status=0x00 { } hdb: DRDY error: status=0x00 { } hdb: DRDY error: status=0x00 { } ide0: do_ide_reset: success hdb: DRDY error: status=0x00 { } end_request: I/O error, dev 0340, sector 0 hdb: unexpected_intr: status=0x00 { } >> unable to read partition table of device 0340 hdc: hdc1 UMSDOS Beta 0.6 (compatibility level 0.4, fast msdos) Mounting root A quick work-around is to tell the kernel not to rely on CMOS at all, and just probe for all devices. So, in ide.c, comment out the relevant line in ide_init() towards the end of the file (or dirtier still, just ensure the condition leading to it is always false, like I did below): for (hwif = 0; hwif < 2; hwif++) { init_ide_data (hwif); if (SUPPORT_TWO_INTERFACES || hwif == HWIF) { >> if (hwif == 10) /* used to be hwif == 1 */ #ifdef CONFIG_BLK_DEV_HD continue; #else >> probe_cmos_for_drives (); #endif /* CONFIG_BLJ_DEV_HD */ probe_mem_start = (mem_start + 3uL) & ~3uL; probe_for_drives (hwif); mem_start = probe_mem_start; } } I'm not sure if this would break anything on other systems, though undoubtly probing for devices instead of asking CMOS might lead to trouble on some older hardware, and that might be the reason the kernel developers thought to keep the above intact. Best wishes. -- Muhammad