summaryrefslogtreecommitdiffstats
path: root/sys/dev/ata/atapi-fd.c
diff options
context:
space:
mode:
authorsos <sos@FreeBSD.org>2000-02-04 10:20:22 +0000
committersos <sos@FreeBSD.org>2000-02-04 10:20:22 +0000
commite12f0fb0979f70fe1dad3927cc2b802c8755434a (patch)
tree18d7acac9e61bb96f1244b86d34b83980960c823 /sys/dev/ata/atapi-fd.c
parentffc4c1858f3d68a6cfee5b63ce40cb00620dc359 (diff)
downloadFreeBSD-src-e12f0fb0979f70fe1dad3927cc2b802c8755434a.zip
FreeBSD-src-e12f0fb0979f70fe1dad3927cc2b802c8755434a.tar.gz
fix support for shared IRQ's.
fix support for multiple HPT & Promise controllers. support mixed 33/66 devices on the Promise 66 controllers. fix the refcount stuff in the atapi drivers. misc cleanups.
Diffstat (limited to 'sys/dev/ata/atapi-fd.c')
-rw-r--r--sys/dev/ata/atapi-fd.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/sys/dev/ata/atapi-fd.c b/sys/dev/ata/atapi-fd.c
index 5358afb..51a4e06 100644
--- a/sys/dev/ata/atapi-fd.c
+++ b/sys/dev/ata/atapi-fd.c
@@ -65,8 +65,8 @@ static struct cdevsw afd_cdevsw = {
/* maj */ 118,
/* dump */ nodump,
/* psize */ nopsize,
- /* flags */ D_DISK,
- /* bmaj */ 32,
+ /* flags */ D_DISK | D_TRACKCLOSE,
+ /* bmaj */ 32
};
static struct cdevsw afddisk_cdevsw;
@@ -215,7 +215,8 @@ afdopen(dev_t dev, int32_t flags, int32_t fmt, struct proc *p)
atapi_test_ready(fdp->atp);
- afd_prevent_allow(fdp, 1);
+ if (!fdp->refcnt++)
+ afd_prevent_allow(fdp, 1);
if (afd_sense(fdp))
printf("afd%d: sense media type failed\n", fdp->lun);
@@ -237,7 +238,8 @@ afdclose(dev_t dev, int32_t flags, int32_t fmt, struct proc *p)
{
struct afd_softc *fdp = dev->si_drv1;
- afd_prevent_allow(fdp, 0);
+ if (!--fdp->refcnt)
+ afd_prevent_allow(fdp, 0);
return 0;
}
@@ -248,12 +250,12 @@ afdioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flag, struct proc *p)
switch (cmd) {
case CDIOCEJECT:
- if ((fdp->flags & F_OPEN) && fdp->refcnt)
+ if (fdp->refcnt > 1)
return EBUSY;
return afd_eject(fdp, 0);
case CDIOCCLOSE:
- if ((fdp->flags & F_OPEN) && fdp->refcnt)
+ if (fdp->refcnt > 1)
return 0;
return afd_eject(fdp, 1);
OpenPOWER on IntegriCloud