Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Jun 2006 14:24:38 +0200
From:      Karsten Brandt <Karsten.Brandt@sick.de>
To:        freebsd-drivers@freebsd.org
Subject:   ata CD driver
Message-ID:  <OFA39042C1.F8548349-ONC1257192.0043C260-C1257192.00449D67@sick.de>

next in thread | raw e-mail | index | archive | help
Hello Andrey,

thanks for your fast reply.

I believe that I've found the related source in src/sys/dev/ata/ata-cbus.c


static int
ata_cbuschannel_banking(device_t dev, int flags)
{
    struct ata_cbus_controller *ctlr = 
device_get_softc(device_get_parent(dev));
    struct ata_channel *ch = device_get_softc(dev);
    int res;

    mtx_lock(&ctlr->bank_mtx);
    switch (flags) {
    case ATA_LF_LOCK:
                 if (ctlr->locked_bank == -1)
                     ctlr->locked_bank = ch->unit;
                 if (ctlr->locked_bank == ch->unit) {
                     ctlr->hardware_bank = ch->unit;
                     ATA_OUTB(ctlr->bankio, 0, ch->unit);
                 }
                 else
                     ctlr->restart_bank = ch->unit;
                 break;

    case ATA_LF_UNLOCK:
                 if (ctlr->locked_bank == ch->unit) {
                     ctlr->locked_bank = -1;
                     if (ctlr->restart_bank != -1) {
                                 if ((ch = 
ctlr->interrupt[ctlr->restart_bank].argument)) {
                                     ctlr->restart_bank = -1;
                                     mtx_unlock(&ctlr->bank_mtx);
                                     ata_start(ch->dev);
                                     return -1;
                                 }
                     }
                 }
                 break;

    case ATA_LF_WHICH:
                 break;
    }
    res = ctlr->locked_bank;
    mtx_unlock(&ctlr->bank_mtx);
    return res;
}

static device_method_t ata_cbuschannel_methods[] = {
    /* device interface */
    DEVMETHOD(device_probe,     ata_cbuschannel_probe),
    DEVMETHOD(device_attach,    ata_attach),
    DEVMETHOD(device_detach,    ata_detach),
    DEVMETHOD(device_suspend,   ata_suspend),
    DEVMETHOD(device_resume,    ata_resume),

    /* ATA methods */
    DEVMETHOD(ata_locking,      ata_cbuschannel_banking),
    { 0, 0 }
};


Regards,

Karsten



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?OFA39042C1.F8548349-ONC1257192.0043C260-C1257192.00449D67>