ata CD driver
Karsten Brandt
Karsten.Brandt at sick.de
Mon Jun 19 12:27:56 UTC 2006
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
More information about the freebsd-drivers
mailing list