Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 May 1999 00:12:48 -0400 (EDT)
From:      Brian Feldman <green@unixhelp.org>
To:        sos@freebsd.dk
Cc:        current@freebsd.org
Subject:   ATA and afd (LS-120): got it WORKING!
Message-ID:  <Pine.BSF.4.10.9905180011380.31813-100000@janus.syracuse.net>

next in thread | raw e-mail | index | archive | help
Yes, I finally got it working! The explanation is in the patch, which I should
not need to explain again :)

 Brian Feldman                _ __ ___ ____  ___ ___ ___  
 green@unixhelp.org                _ __ ___ | _ ) __|   \ 
     FreeBSD: The Power to Serve!      _ __ | _ \ _ \ |) |
         http://www.freebsd.org           _ |___)___/___/ 

--- src/sys/dev/ata/atapi-fd.c.orig	Mon May 17 20:28:16 1999
+++ src/sys/dev/ata/atapi-fd.c	Mon May 17 20:42:37 1999
@@ -83,7 +83,7 @@
 
 int32_t afdattach(struct atapi_softc *);
 static int32_t afd_sense(struct afd_softc *);
-static void afd_describe(struct afd_softc *);
+static void afd_describe(struct afd_softc *, int8_t *, int8_t *);
 static void afd_strategy(struct buf *);
 static void afd_start(struct afd_softc *);
 static void afd_done(struct atapi_request *);
@@ -96,6 +96,8 @@
 afdattach(struct atapi_softc *atp)
 {
     struct afd_softc *fdp;
+    int8_t model_buf[40+1];
+    int8_t revision_buf[8+1];
 
     if (afdnlun >= NUNIT) {
         printf("afd: too many units\n");
@@ -106,18 +108,22 @@
         printf("afd: out of memory\n");
         return -1;
     }
+
     bzero(fdp, sizeof(struct afd_softc));
     bufq_init(&fdp->buf_queue);
     fdp->atp = atp;
     fdp->lun = afdnlun;
     fdp->flags = F_MEDIA_CHANGED;
+    bpack(atp->atapi_parm->model, model_buf, sizeof(model_buf));
+    bpack(atp->atapi_parm->revision, revision_buf, sizeof(revision_buf));
+    fdp->maxblks = strcmp(model_buf, "IOMEGA  ZIP 100       ATAPI") ? 0 : 64;
 
     if (afd_sense(fdp)) {
 	free(fdp, M_TEMP);
 	return -1;
     }
 
-    afd_describe(fdp);
+    afd_describe(fdp, model_buf, revision_buf);
     afdtab[afdnlun++] = fdp;
     devstat_add_entry(&fdp->stats, "afd", fdp->lun, DEV_BSIZE,
                       DEVSTAT_NO_ORDERED_TAGS,
@@ -166,15 +172,10 @@
 }
 
 static void 
-afd_describe(struct afd_softc *fdp)
+afd_describe(struct afd_softc *fdp, int8_t *model, int8_t *revision)
 {
-    int8_t model_buf[40+1];
-    int8_t revision_buf[8+1];
-
-    bpack(fdp->atp->atapi_parm->model, model_buf, sizeof(model_buf));
-    bpack(fdp->atp->atapi_parm->revision, revision_buf, sizeof(revision_buf));
     printf("afd%d: <%s/%s> rewriteable drive at ata%d as %s\n",
-	   fdp->lun, model_buf, revision_buf,
+	   fdp->lun, model, revision,
            fdp->atp->controller->lun,
 	   (fdp->atp->unit == ATA_MASTER) ? "master" : "slave ");
     printf("afd%d: %luMB (%u sectors), %u cyls, %u heads, %u S/T, %u B/S\n",
@@ -320,9 +321,14 @@
     lba = bp->b_blkno / (fdp->cap.sector_size / DEV_BSIZE);
     count = (bp->b_bcount + (fdp->cap.sector_size - 1)) / fdp->cap.sector_size;
 
-    /* Should only be needed for ZIP drives, but better safe than sorry */
-    if (count > 64)
-	count = 64;
+    /*
+     * This should only be needed for ZIP drives, since they lock up if a
+     * transfer of > 64 sectors is attempted. XXX TODO (for SOS): when
+     * this problem is to be worked around, multiple transfers will need
+     * to be queued!
+     */
+    if (fdp->maxblks && count > fdp->maxblks)
+	count = fdp->maxblks;
 
     bzero(ccb, sizeof(ccb));
 



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.10.9905180011380.31813-100000>