From owner-freebsd-current Thu Jul 2 20:09:31 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id UAA27005 for freebsd-current-outgoing; Thu, 2 Jul 1998 20:09:31 -0700 (PDT) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from antipodes.cdrom.com (castles183.castles.com [208.214.165.183]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id UAA27000 for ; Thu, 2 Jul 1998 20:09:24 -0700 (PDT) (envelope-from mike@antipodes.cdrom.com) Received: from antipodes.cdrom.com (localhost [127.0.0.1]) by antipodes.cdrom.com (8.8.8/8.8.5) with ESMTP id UAA03446; Thu, 2 Jul 1998 20:09:55 -0700 (PDT) Message-Id: <199807030309.UAA03446@antipodes.cdrom.com> X-Mailer: exmh version 2.0zeta 7/24/97 To: brian@worldcontrol.com cc: Ian Freislich , freebsd-current@FreeBSD.ORG Subject: Re: SCSI problems on aic7880 In-reply-to: Your message of "Thu, 02 Jul 1998 14:15:21 PDT." <19980702141521.A4466@top.worldcontrol.com> Mime-Version: 1.0 Content-Type: multipart/mixed ; boundary="==_Exmh_5545622880" Date: Thu, 02 Jul 1998 20:09:55 -0700 From: Mike Smith Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG This is a multipart MIME message. --==_Exmh_5545622880 Content-Type: text/plain; charset=us-ascii > On %M 0, Ian Freislich wrote: > > Hi > > > > After a while (3 mins from boot to a day or so) I start getting > > the following messages on my console: > > (this sequence repeats infinitely so I'm not sure if the SCSI > > problem causes the pager problem or the other way around) > > I have repeatable problems with the aic7880. The same problems do > not appear on the aic7870. I suggest you find a aic7870 based board. > > CAM may solve the problem, however, I am unable to use it due to a > lack of CD burning facility. Please find attached patches for cdrecord 1.6a12. These have already been submitted to the CAM people and Joerg Schilling, but it sounds like the urgency level is rising. You need to set the following environment variables before building: COPTX= -DBSD_CAM LDOPTX= -lcam (Note that the patch was cleaned slightly by hand, as I just realised it was full of junk. It should still work though.) --==_Exmh_5545622880 Content-Type: text/plain; name="camdiff"; charset=us-ascii Content-Description: camdiff Content-Disposition: attachment; filename="camdiff" diff -ru cdrecord-1.6.orig/cdrecord/cdrecord.c cdrecord-1.6/cdrecord/cdrecord.c --- cdrecord-1.6.orig/cdrecord/cdrecord.c Thu Mar 12 14:42:11 1998 +++ cdrecord-1.6/cdrecord/cdrecord.c Mon Jun 29 16:37:12 1998 @@ -1709,6 +1709,13 @@ { struct sched_param scp; + /* + * Verify that scheduling is available + */ + if (sysconf(_SC_PRIORITY_SCHEDULING) == -1) { + errmsg("WARNING: RR-scheduler not available, disabling.\n"); + return(0); + } fillbytes(&scp, sizeof(scp), '\0'); scp.sched_priority = sched_get_priority_max(SCHED_RR) - pri; if (sched_setscheduler(0, SCHED_RR, &scp) < 0) { diff -ru cdrecord-1.6.orig/cdrecord/scsi-bsd.c cdrecord-1.6/cdrecord/scsi-bsd.c --- cdrecord-1.6.orig/cdrecord/scsi-bsd.c Sun Aug 31 15:25:17 1997 +++ cdrecord-1.6/cdrecord/scsi-bsd.c Tue Jun 2 15:27:20 1998 @@ -30,6 +30,8 @@ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ +#ifndef BSD_CAM + #undef sense #include @@ -283,3 +285,194 @@ return (ret); } #define sense u_sense.Sense + +#else /* BSD_CAM */ +/* + * Interface for the FreeBSD CAM passthrough device. + * + * Copyright (c) 1998 Michael Smith + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#undef sense +#define scsi_sense CAM_scsi_sense +#define scsi_inquiry CAM_scsi_inquiry +#include +#include +#include +#include +#include + +#define CAM_MAXDEVS 128 +struct cam_device *cam_devices[CAM_MAXDEVS + 1]; + +/* + * Build a list of everything we can find. + */ +EXPORT +int scsi_open() +{ + struct cam_device *dev; + char name[16]; + int unit; + + bzero(cam_devices, sizeof(cam_devices)); + + for (unit = 0; unit < CAM_MAXDEVS; unit++) { + sprintf(name, "pass%d", unit); + cam_devices[unit] = cam_open_device(name, O_RDWR); + } + return(unit); +} + +LOCAL +long scsi_maxdma() +{ + return (MAXPHYS); +} + +EXPORT void * +scsi_getbuf(amt) + long amt; +{ + void *ret; + + if (scg_maxdma == 0) + scg_maxdma = MAXPHYS; + + if (amt <= 0 || amt > scg_maxdma) + return ((void *)0); + if (debug) + printf("scsi_getbuf: %ld bytes\n", amt); + ret = valloc((size_t)(amt)); + return (ret); +} + +EXPORT +BOOL scsi_havebus(int busno) +{ + int unit; + + for (unit = 0; cam_devices[unit] != NULL; unit++) + if (cam_devices[unit]->path_id == busno) + return(1); + return(0); +} + +EXPORT +int scsi_fileno(bus, unit, lun) +{ + int i; + + for (i = 0; cam_devices[i] != NULL; i++) + if ((cam_devices[i]->path_id == bus) && + (cam_devices[i]->target_id == unit) && + (cam_devices[i]->target_lun == lun)) + return(i); + + fprintf(stderr, "lookup for %d,%d,%d failed\n", bus, unit, lun); + return(-1); +} + +EXPORT +int scsireset() +{ + /* XXX synchronous reset command - is this wise? */ +} + +LOCAL int +scsi_send(int unit, struct scg_cmd *sp) +{ + struct cam_device *dev; + union ccb *ccb; + int rv, result; + u_int32_t ccb_flags; + + if (unit < 0) { + fprintf(stderr, "attempt to reference invalid unit %d\n", unit); + sp->error = SCG_FATAL; + return (0); + } + + dev = cam_devices[unit]; + ccb = cam_getccb(dev); + + /* Build the CCB */ + bzero(&ccb->csio, sizeof(struct ccb_scsiio)); + bcopy(sp->cdb.cmd_cdb, &ccb->csio.cdb_io.cdb_bytes, sp->cdb_len); + + /* Request simple error recovery */ + ccb_flags = CAM_PASS_ERR_RECOVER; + if (sp->size != 0) { + ccb_flags |= (sp->flags & SCG_RECV_DATA) ? CAM_DIR_IN : CAM_DIR_OUT; + } + cam_fill_csio(&ccb->csio, + /* retries */ 1, + /* cbfncp */ NULL, + /* flags */ ccb_flags, + /* tag_action */ MSG_SIMPLE_Q_TAG, + /* data_ptr */ (u_int8_t *)sp->addr, + /* dxfer_len */ sp->size, + /* sense_len */ SSD_FULL_SIZE, + /* cdb_len */ sp->cdb_len, + /* timeout */ sp->timeout * 1000); + + /* Run the command */ + errno = 0; + if ((rv = cam_send_ccb(dev, ccb)) != 0) { + errmsg("CAM INTERFACE ERROR"); + result = SCG_FATAL; + sp->ux_errno = errno; + } else { + /* + * Check for command status; failure to complete a command is fatal, + * but anything else will be handled at a higher level. + */ + if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + scsi_sense_print(dev, &ccb->csio, stderr); + result = SCG_FATAL; + } else { + result = SCG_NO_ERROR; + } + } + + /* Pass the result back up */ + bzero(&sp->scb, sizeof(sp->scb)); + bzero(&sp->u_sense.cmd_sense, sizeof(sp->u_sense.cmd_sense)); + sp->resid = ccb->csio.resid; + sp->sense_count = SSD_FULL_SIZE - ccb->csio.sense_resid; + if (sp->sense_count > SCG_MAX_SENSE) + sp->sense_count = SCG_MAX_SENSE; + sp->u_scb.cmd_scb[0] = ccb->csio.scsi_status; + + cam_freeccb(ccb); + return(result); +} + +#undef scsi_sense +#undef scsi_inquiry +#define sense u_sense.Sense + +#endif /* BSD_CAM */ diff -ru cdrecord-1.6.orig/lib/libschily.mk cdrecord-1.6/lib/libschily.mk --- cdrecord-1.6.orig/lib/libschily.mk Sun Nov 9 09:58:01 1997 +++ cdrecord-1.6/lib/libschily.mk Thu Apr 16 10:37:23 1998 @@ -63,8 +63,8 @@ ########################################################################### $(ARCHDIRX)align_test$(DEP_SUFFIX): $(ARCHDIR) -include $(ARCHDIRX)avoffset$(DEP_SUFFIX) -include $(ARCHDIRX)align_test$(DEP_SUFFIX) +#include $(ARCHDIRX)avoffset$(DEP_SUFFIX) +#include $(ARCHDIRX)align_test$(DEP_SUFFIX) CLEAN_FILEX= $(ARCHDIR)/align_test.o $(ARCHDIR)/align_test CLEAN_FILEX += $(ARCHDIR)/avoffset.o $(ARCHDIR)/avoffset --==_Exmh_5545622880 Content-Type: text/plain; charset=us-ascii \\ Sometimes you're ahead, \\ Mike Smith \\ sometimes you're behind. \\ mike@smith.net.au \\ The race is long, and in the \\ msmith@freebsd.org \\ end it's only with yourself. \\ msmith@cdrom.com --==_Exmh_5545622880-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message