NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Promise PDC40718 SATA300 hard disk order kludge



Hi all,

I wanted to share my kludge for getting to boot NetBSD off
an incorrectly-wired Promise SATA board. When the SATA
controller on my motherboard died, I went out and bought
a Promise PDC40718 SATA300 controller. I connected
the root disk and booted off it.

The Promise BIOS reported it as port 0 and and NetBSD
thought of it as wd0 at atabus4. When I connected the
raid data disks and booted, things got weird. 

The Promise BIOS reported the root disk on port 0 and
the data disks on port 1 to 3. I got the boot loader and
when the kernel booted, it tried to identify one of
the data disks as wd0 (atabus1) and did not find the
root filesystem it expected. Foo!

Here is what I did to fix the situation:
Tried to find out which harware port was which atabus.
Booted off the single root-disk-only configuration.
Built a new kernel with the following modification:

--- /usr/src/sys/dev/pci/pdcsata.orig      2013-03-08 15:04:05.000000000 +0100
+++ /usr/src/sys/dev/pci/pdcsata.c      2013-03-08 15:09:32.000000000 +0100
@@ -228,5 +228,6 @@
        struct wdc_regs *wdr;
-       int channel, i;
+       int cchannel, channel, i;
        pci_intr_handle_t intrhandle;
        const char *intrstr;
+       const unsigned int MYCHAN[4] = {4,2,1,3};

@@ -364,4 +365,5 @@

-       for (channel = 0; channel < sc->sc_wdcdev.sc_atac.atac_nchannels;
-            channel++) {
+       for (cchannel = 0; cchannel < sc->sc_wdcdev.sc_atac.atac_nchannels;
+            cchannel++) {
+                channel = MYCHAN[cchannel]-1;
                cp = &sc->pciide_channels[channel];

Reboot and NetBSD reports:
atabus1 at pdcsata0 channel 3
atabus2 at pdcsata0 channel 1
atabus3 at pdcsata0 channel 0
atabus4 at pdcsata0 channel 2
wd0 at atabus1 drive 0 
wd1 at atabus2 drive 0
...

Everything works fine now. 

Cheers 
Robert Vargason


Home | Main Index | Thread Index | Old Index