Date: 30 Jul 1997 22:10:55 -0700 From: Frank McConnell <fmc@reanimators.org> To: freebsd-scsi@FreeBSD.ORG, freebsd-hackers@FreeBSD.ORG Subject: Re: SCSI 1542 error Message-ID: <199707310510.WAA15704@daemonweed.reanimators.org> In-Reply-To: Bill Pechter's message of Wed, 30 Jul 1997 08:02:41 -0400 (EDT) References: <199707301202.IAA15575@i4got.lakewood.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Bill Pechter <pechter@lakewood.com> writes: > BTW -- the ch device doesn't use bounce buffers at all (unfortunately)... > I've got the same problem with 2.2.2... I noticed this the other day (similar config, 2.2.1, ISA bus, 1542CP? with Archive changer) and have come up with what I think is a fix. Diffs below. But first, some notes: (a) I am running FreeBSD 2.2.1-RELEASE, not 2.2.2. I have no idea how much the ch driver has changed in that span. (b) This corrects the malloc()s of data buffers in ch_usergetelemstatus() so that bounce buffers may be used instead. (c) Still questionable to me is the use of a stack temporary (sense_data) in ch_get_params() as a data buffer. It seems to work but I don't understand why, probably because I don't quite understand how what happens down below happens. Should it be changed too? (d) From (c), I probably have no business monkeying with this sort of thing, and someone who knows more ought to look this over. It lets me do chio status in addition to chio move, but that's as far as I've tested it. Criticism is welcome. -Frank McConnell, maybe-wannabe-freebsd-hacker --- cut here --- *** ch.c.2.2.1-RELEASE Fri Mar 7 01:34:26 1997 --- ch.c Tue Jul 29 21:30:42 1997 *************** *** 36,41 **** --- 36,42 ---- * $Id: ch.c,v 1.34.2.1 1997/03/07 09:34:26 joerg Exp $ */ + #include "opt_bounce.h" #include "opt_scsi.h" #include <sys/param.h> *************** *** 511,517 **** struct read_element_status_page_header *pg_hdr; struct read_element_status_descriptor *desc; caddr_t data = NULL; ! size_t size, desclen; int avail, i, error = 0; u_int8_t *user_data = NULL; --- 512,518 ---- struct read_element_status_page_header *pg_hdr; struct read_element_status_descriptor *desc; caddr_t data = NULL; ! size_t size, desclen, datalen; int avail, i, error = 0; u_int8_t *user_data = NULL; *************** *** 528,534 **** * we can allocate enough storage for all of them. We assume * that the first one can fit into 1k. */ ! data = (caddr_t)malloc(1024, M_DEVBUF, M_WAITOK); if (error = ch_getelemstatus(sc, sc->sc_firsts[chet], 1, data, 1024)) goto done; --- 529,540 ---- * we can allocate enough storage for all of them. We assume * that the first one can fit into 1k. */ ! datalen = 1024; ! #ifdef BOUNCE_BUFFERS ! data = (caddr_t)vm_bounce_kva_alloc(btoc(datalen)); ! #else ! data = (caddr_t)malloc(datalen, M_DEVBUF, M_WAITOK); ! #endif if (error = ch_getelemstatus(sc, sc->sc_firsts[chet], 1, data, 1024)) goto done; *************** *** 545,554 **** * Reallocate storage for descriptors and get them from the * device. */ free(data, M_DEVBUF); data = (caddr_t)malloc(size, M_DEVBUF, M_WAITOK); if (error = ch_getelemstatus(sc, sc->sc_firsts[chet], ! sc->sc_counts[chet], data, size)) goto done; /* --- 551,566 ---- * Reallocate storage for descriptors and get them from the * device. */ + #ifdef BOUNCE_BUFFERS + vm_bounce_kva_alloc_free((vm_offset_t)data, btoc(datalen)); + data = (caddr_t)vm_bounce_kva_alloc(btoc(size)); + #else free(data, M_DEVBUF); data = (caddr_t)malloc(size, M_DEVBUF, M_WAITOK); + #endif + datalen = size; if (error = ch_getelemstatus(sc, sc->sc_firsts[chet], ! sc->sc_counts[chet], data, size)) goto done; /* *************** *** 575,581 **** --- 587,597 ---- done: if (data != NULL) + #ifdef BOUNCE_BUFFERS + vm_bounce_kva_alloc_free((vm_offset_t)data, btoc(datalen)); + #else free(data, M_DEVBUF); + #endif if (user_data != NULL) free(user_data, M_DEVBUF); return (error);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199707310510.WAA15704>