Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Aug 1995 00:38:46 -0500
From:      Jon Loeliger <jdl@chrome.onramp.net>
To:        hackers@freebsd.org
Subject:   More ATAPI -- possible insight into probe problems...?
Message-ID:  <199508300538.AAA07671@chrome.onramp.net>

next in thread | raw e-mail | index | archive | help

Aha!  Watch this:

Given:

    controller      wdc0    at isa? port "IO_WD1" bio irq 14 vector wdintr
    disk            wd0     at wdc0 drive 0
    #disk           wd1     at wdc0 drive 1

    controller      wdc1    at isa? port "IO_WD2" bio irq 15 vector wdintr
    #disk           wd2     at wdc1 drive 0
    #disk           wd3     at wdc1 drive 1

    options         ATAPI   #Enable ATAPI support for IDE bus
    device          wcd0    #IDE CD-ROM

I see:

    wd0: probe started
    wd0: checking RW register on port 0x1f0 + 0x4
    wd0: reseting
    wd0: diagnosing
    wd0: Error : 0x1
    wdc0 at 0x1f0-0x1f7 irq 14 on isa
    wdc0: unit 0 (wd0): <WDC AC31000H>
    wd0: 1033MB (2116800 sectors), 2100 cyls, 16 heads, 63 S/T, 512 B/S
    atapi0.1 at 0x1f0: attach called
    atapi.1 at 0x1f0: identify not ready, status=1<check>
    wd1: probe started
    wd1: checking RW register on port 0x170 + 0x4
    wdc1 not found at 0x170


Oh my!  Let's peek at my highly superior wd.c:

    static int
    wdprobe(struct isa_device *dvp)
    {
        int     unit = dvp->id_unit;
        struct disk *du;

        if (unit >= NWDC)
                return (0);

    #ifdef WDDEBUG_PROBE
        printf("wd%d: probe started\n", unit);
    #endif

        du = malloc(sizeof *du, M_TEMP, M_NOWAIT);
        if (du == NULL)
                return (0);
        bzero(du, sizeof *du);
        du->dk_ctrlr = dvp->id_unit;
        du->dk_port = dvp->id_iobase;

        wdc_registerdev(dvp);

    #ifdef WDDEBUG_PROBE
        printf("wd%d: checking RW register on port 0x%x + 0x%x\n",
                unit, du->dk_port, wd_cyl_lo);
    #endif

        /* check if we have registers that work */
        outb(du->dk_port + wd_cyl_lo, 0xa5);    /* wd_cyl_lo is read/write */
        if (inb(du->dk_port + wd_cyl_lo) == 0xff)       /* XXX too weak */
                goto nodevice;

    #ifdef WDDEBUG_PROBE
        printf("wd%d: reseting\n", unit);
    #endif
        if (wdreset(du) != 0 && (DELAY(RECOVERYTIME), wdreset(du)) != 0)
                goto nodevice;


So who can tell me any details about that lovely weak check for R/W
registers that appears to be failing for me?  Simple things like:

    - Is this a valid register for a CDROM drive too? Ie, is this check
      tacitly assuming a hard disk beneath it?
    - Is it subject to timing problems?
    - It *claims* to be "too weak", however it appears to be too strong!

(Note also that I'd already bumped the TIMEOUT to 31000 to, I think,
meet spec.  Didn't seem to help anywhere...)

Now I then did the obvious frob:  totally *skip* this weak test.
This worked relatively nicely!

    wd0: probe started
    wd0: checking RW register on port 0x1f0 + 0x4
    wd0: reseting
    wd0: diagnosing
    wd0: Error : 0x1
    wdc0 at 0x1f0-0x1f7 irq 14 on isa
    wdc0: unit 0 (wd0): <WDC AC31000H>
    wd0: 1033MB (2116800 sectors), 2100 cyls, 16 heads, 63 S/T, 512 B/S
    atapi0.1 at 0x1f0: attach called
    atapi.1 at 0x1f0: identify not ready, status=1<check>
    wd1: probe started
    wd1: checking RW register on port 0x170 + 0x4
    wd1: reseting
    wd1: diagnosing
    wd0: Error : 0x1
    wdc1 at 0x170-0x177 irq 15 on isa
    atapi1.0 at 0x170: attach called
    wdc1: unit 0 (atapi): <NEC             CD-ROM DRIVE:260>, removable, cmd16
    wcd0: info 85-80-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-20-20-20-20-20-20-20-20-20-20-20-20-20-20-20-20-20-20-20-20-0-0-0-0-0-0-2e-34-33-32-20-20-20-20-4e-45-43-20-20-20-20-20-20-20-20-20-20-20-20-20-20-20-20-20-43-44-2d-52-4f-4d-20-44-52-49-56-45-3a-32-36-30-0-0-0-0-0-0-0-0-a-0-0-0-3-0-0-0-0-3-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-0-b4-0-b4-0-0-0-0-0-0-0-0-0-0-0
    atapi1.0: req im 5a-0-2a-0-0-0-0-0-18-0-0-0-0-0-0-0 len=24
    atapi1.0: start
    atapi1.0: send cmd 5a-0-2a-0-0-0-0-0-18-0-0-0-0-0-0-0
    atapi1.0: intr ireason=0x1, len=24, status=48<ready,drq>, error=0
    atapi1.0: send cmd 5a-0-2a-0-0-0-0-0-18-0-0-0-0-0-0-0
    atapi1.0: intr ireason=0x3, len=24, status=41<ready,check>, error=64<abort>
    atapi1.1 at 0x170: attach called
    atapi.1 at 0x170: no device

This is basically the same behaviour I was seeing when it was hanging
on the wdc0 controller.  Note that slightly different behaviour was
observed as the ATAPI device was not found as the second device of
each of the two controllers.

So -- bottom line:
    How 'bout that XXX weak register RW test?
    How 'bout that double interrupt on cmd 5a?

Anyone?

jdl



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199508300538.AAA07671>