PERFORCE change 29118 for review
John Baldwin
jhb at FreeBSD.org
Thu Apr 17 08:23:50 PDT 2003
http://perforce.freebsd.org/chv.cgi?CH=29118
Change 29118 by jhb at jhb_laptop on 2003/04/17 08:22:52
IFC @29117.
Affected files ...
.. //depot/projects/smpng/sys/boot/alpha/boot1/boot1.c#3 integrate
.. //depot/projects/smpng/sys/boot/arc/lib/arcdisk.c#3 integrate
.. //depot/projects/smpng/sys/boot/arc/lib/devicename.c#2 integrate
.. //depot/projects/smpng/sys/boot/ofw/libofw/devicename.c#6 integrate
.. //depot/projects/smpng/sys/boot/ofw/libofw/ofw_disk.c#7 integrate
.. //depot/projects/smpng/sys/boot/sparc64/boot1/boot1.c#6 integrate
.. //depot/projects/smpng/sys/compat/linux/linux_ioctl.c#25 integrate
.. //depot/projects/smpng/sys/compat/linux/linux_misc.c#36 integrate
.. //depot/projects/smpng/sys/conf/files#73 integrate
.. //depot/projects/smpng/sys/conf/files.alpha#22 integrate
.. //depot/projects/smpng/sys/conf/files.i386#39 integrate
.. //depot/projects/smpng/sys/conf/files.ia64#26 integrate
.. //depot/projects/smpng/sys/conf/files.pc98#39 integrate
.. //depot/projects/smpng/sys/conf/files.sparc64#26 integrate
.. //depot/projects/smpng/sys/dev/asr/asr.c#18 integrate
.. //depot/projects/smpng/sys/dev/firewire/firewire.c#13 integrate
.. //depot/projects/smpng/sys/dev/firewire/firewire.h#6 integrate
.. //depot/projects/smpng/sys/dev/firewire/firewire_phy.h#2 integrate
.. //depot/projects/smpng/sys/dev/firewire/firewirereg.h#7 integrate
.. //depot/projects/smpng/sys/dev/firewire/fwcrom.c#3 integrate
.. //depot/projects/smpng/sys/dev/firewire/fwdev.c#6 integrate
.. //depot/projects/smpng/sys/dev/firewire/fwdma.c#1 branch
.. //depot/projects/smpng/sys/dev/firewire/fwdma.h#1 branch
.. //depot/projects/smpng/sys/dev/firewire/fwmem.c#8 integrate
.. //depot/projects/smpng/sys/dev/firewire/fwmem.h#4 integrate
.. //depot/projects/smpng/sys/dev/firewire/fwohci.c#14 integrate
.. //depot/projects/smpng/sys/dev/firewire/fwohci_pci.c#10 integrate
.. //depot/projects/smpng/sys/dev/firewire/fwohcireg.h#5 integrate
.. //depot/projects/smpng/sys/dev/firewire/fwohcivar.h#5 integrate
.. //depot/projects/smpng/sys/dev/firewire/iec13213.h#3 integrate
.. //depot/projects/smpng/sys/dev/firewire/iec68113.h#3 integrate
.. //depot/projects/smpng/sys/dev/firewire/if_fwe.c#10 integrate
.. //depot/projects/smpng/sys/dev/firewire/if_fwevar.h#3 integrate
.. //depot/projects/smpng/sys/dev/firewire/sbp.c#13 integrate
.. //depot/projects/smpng/sys/dev/mcd/mcd_isa.c#3 integrate
.. //depot/projects/smpng/sys/dev/scd/scd_isa.c#2 integrate
.. //depot/projects/smpng/sys/dev/sound/pci/via8233.c#6 integrate
.. //depot/projects/smpng/sys/dev/sound/pci/via8233.h#3 integrate
.. //depot/projects/smpng/sys/dev/wds/wd7000.c#3 integrate
.. //depot/projects/smpng/sys/geom/geom_bsd.c#26 integrate
.. //depot/projects/smpng/sys/geom/geom_bsd_enc.c#1 branch
.. //depot/projects/smpng/sys/i386/isa/bs/bsif.h#4 integrate
.. //depot/projects/smpng/sys/kern/kern_shutdown.c#34 integrate
.. //depot/projects/smpng/sys/kern/subr_devstat.c#9 integrate
.. //depot/projects/smpng/sys/kern/subr_disk.c#19 integrate
.. //depot/projects/smpng/sys/modules/firewire/Makefile.inc#2 integrate
.. //depot/projects/smpng/sys/modules/firewire/firewire/Makefile#7 integrate
.. //depot/projects/smpng/sys/modules/firewire/fwe/Makefile#3 integrate
.. //depot/projects/smpng/sys/pc98/pc98/wd.c#11 integrate
.. //depot/projects/smpng/sys/pci/if_dc.c#32 integrate
.. //depot/projects/smpng/sys/sys/disklabel.h#24 integrate
.. //depot/projects/smpng/sys/sys/param.h#38 integrate
.. //depot/user/jhb/proc/proc.fields#19 edit
Differences ...
==== //depot/projects/smpng/sys/boot/alpha/boot1/boot1.c#3 (text+ko) ====
@@ -1,5 +1,5 @@
/*
- * $FreeBSD: src/sys/boot/alpha/boot1/boot1.c,v 1.12 2002/06/29 02:32:32 peter Exp $
+ * $FreeBSD: src/sys/boot/alpha/boot1/boot1.c,v 1.13 2003/04/16 21:09:41 phk Exp $
* From $NetBSD: bootxx.c,v 1.4 1997/09/06 14:08:29 drochner Exp $
*/
@@ -33,7 +33,6 @@
#include <string.h>
#include <sys/param.h>
#include <sys/dirent.h>
-#include <sys/disklabel.h>
#include <machine/prom.h>
#include <machine/rpb.h>
==== //depot/projects/smpng/sys/boot/arc/lib/arcdisk.c#3 (text+ko) ====
@@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/boot/arc/lib/arcdisk.c,v 1.5 2003/04/04 16:35:14 phk Exp $
+ * $FreeBSD: src/sys/boot/arc/lib/arcdisk.c,v 1.6 2003/04/16 21:09:41 phk Exp $
*/
/*
@@ -39,7 +39,6 @@
#include <stand.h>
-#include <sys/disklabel.h>
#include <machine/stdarg.h>
==== //depot/projects/smpng/sys/boot/arc/lib/devicename.c#2 (text+ko) ====
@@ -23,12 +23,11 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/boot/arc/lib/devicename.c,v 1.2 1999/08/28 00:39:38 peter Exp $
+ * $FreeBSD: src/sys/boot/arc/lib/devicename.c,v 1.3 2003/04/16 21:09:41 phk Exp $
*/
#include <stand.h>
#include <string.h>
-#include <sys/disklabel.h>
#include "bootstrap.h"
#include "libarc.h"
==== //depot/projects/smpng/sys/boot/ofw/libofw/devicename.c#6 (text+ko) ====
@@ -23,11 +23,10 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/boot/ofw/libofw/devicename.c,v 1.12 2002/12/02 01:46:22 jake Exp $
+ * $FreeBSD: src/sys/boot/ofw/libofw/devicename.c,v 1.13 2003/04/16 21:09:41 phk Exp $
*/
#include <stand.h>
-#include <sys/disklabel.h>
#include "libofw.h"
static int ofw_parsedev(struct ofw_devdesc **, const char *, const char **);
==== //depot/projects/smpng/sys/boot/ofw/libofw/ofw_disk.c#7 (text+ko) ====
@@ -22,7 +22,7 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: src/sys/boot/ofw/libofw/ofw_disk.c,v 1.8 2002/11/10 19:17:36 jake Exp $
+ * $FreeBSD: src/sys/boot/ofw/libofw/ofw_disk.c,v 1.9 2003/04/16 21:09:41 phk Exp $
*/
/*
@@ -30,7 +30,6 @@
*/
#include <sys/param.h>
-#include <sys/disklabel.h>
#include <netinet/in.h>
==== //depot/projects/smpng/sys/boot/sparc64/boot1/boot1.c#6 (text+ko) ====
@@ -17,10 +17,9 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/boot/sparc64/boot1/boot1.c,v 1.15 2003/04/04 16:35:15 phk Exp $");
+__FBSDID("$FreeBSD: src/sys/boot/sparc64/boot1/boot1.c,v 1.16 2003/04/16 21:09:41 phk Exp $");
#include <sys/param.h>
-#include <sys/disklabel.h>
#include <sys/dirent.h>
#include <machine/elf.h>
#include <machine/stdarg.h>
==== //depot/projects/smpng/sys/compat/linux/linux_ioctl.c#25 (text+ko) ====
@@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: src/sys/compat/linux/linux_ioctl.c,v 1.105 2003/04/01 12:34:47 phk Exp $
+ * $FreeBSD: src/sys/compat/linux/linux_ioctl.c,v 1.106 2003/04/16 20:57:35 phk Exp $
*/
#include <sys/param.h>
@@ -37,7 +37,6 @@
#include <sys/disk.h>
#include <sys/consio.h>
#include <sys/ctype.h>
-#include <sys/disklabel.h>
#include <sys/fcntl.h>
#include <sys/file.h>
#include <sys/filedesc.h>
==== //depot/projects/smpng/sys/compat/linux/linux_misc.c#36 (text+ko) ====
@@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: src/sys/compat/linux/linux_misc.c,v 1.140 2003/04/16 20:07:48 jhb Exp $
+ * $FreeBSD: src/sys/compat/linux/linux_misc.c,v 1.141 2003/04/16 20:43:10 jhb Exp $
*/
#include "opt_mac.h"
@@ -878,7 +878,7 @@
{
#ifdef DEBUG
if (ldebug(personality))
- printf(ARGS(personality, "%ld"), args->per);
+ printf(ARGS(personality, "%lu"), (unsigned long)args->per);
#endif
#ifndef __alpha__
if (args->per != 0)
==== //depot/projects/smpng/sys/conf/files#73 (text+ko) ====
@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/files,v 1.782 2003/04/15 04:08:01 mdodd Exp $
+# $FreeBSD: src/sys/conf/files,v 1.784 2003/04/17 07:39:03 phk Exp $
#
# The long compile-with and dependency lines are required because of
# limitations in config: backslash-newline doesn't work in strings, and
@@ -395,6 +395,7 @@
dev/firewire/firewire.c optional firewire
dev/firewire/fwcrom.c optional firewire
dev/firewire/fwdev.c optional firewire
+dev/firewire/fwdma.c optional firewire
dev/firewire/fwmem.c optional firewire
dev/firewire/fwohci.c optional firewire
dev/firewire/fwohci_pci.c optional firewire pci
@@ -891,6 +892,7 @@
geom/geom_aes.c optional geom_aes
geom/geom_apple.c optional geom_apple
geom/geom_bsd.c optional geom_bsd
+geom/geom_bsd_enc.c optional geom_bsd
geom/geom_ctl.c standard
geom/geom_dev.c standard
geom/geom_disk.c standard
==== //depot/projects/smpng/sys/conf/files.alpha#22 (text+ko) ====
@@ -1,7 +1,7 @@
# This file tells config what files go into building a kernel,
# files marked standard are always included.
#
-# $FreeBSD: src/sys/conf/files.alpha,v 1.100 2003/02/28 21:59:13 ru Exp $
+# $FreeBSD: src/sys/conf/files.alpha,v 1.101 2003/04/17 07:39:03 phk Exp $
#
# The long compile-with and dependency lines are required because of
# limitations in config: backslash-newline doesn't work in strings, and
@@ -192,6 +192,7 @@
dev/syscons/syscons.c optional sc
dev/syscons/sysmouse.c optional sc
geom/geom_bsd.c standard
+geom/geom_bsd_enc.c standard
isa/atkbd_isa.c optional atkbd
isa/atkbdc_isa.c optional atkbdc
isa/fd.c optional fdc
==== //depot/projects/smpng/sys/conf/files.i386#39 (text+ko) ====
@@ -1,7 +1,7 @@
# This file tells config what files go into building a kernel,
# files marked standard are always included.
#
-# $FreeBSD: src/sys/conf/files.i386,v 1.442 2003/04/12 08:34:40 phk Exp $
+# $FreeBSD: src/sys/conf/files.i386,v 1.443 2003/04/17 07:39:03 phk Exp $
#
# The long compile-with and dependency lines are required because of
# limitations in config: backslash-newline doesn't work in strings, and
@@ -147,6 +147,7 @@
dev/syscons/syscons.c optional sc
dev/syscons/sysmouse.c optional sc
geom/geom_bsd.c standard
+geom/geom_bsd_enc.c standard
geom/geom_mbr.c standard
geom/geom_mbr_enc.c standard
gnu/i386/fpemul/div_small.s optional gpl_math_emulate \
==== //depot/projects/smpng/sys/conf/files.ia64#26 (text+ko) ====
@@ -1,7 +1,7 @@
# This file tells config what files go into building a kernel,
# files marked standard are always included.
#
-# $FreeBSD: src/sys/conf/files.ia64,v 1.49 2003/04/12 08:34:40 phk Exp $
+# $FreeBSD: src/sys/conf/files.ia64,v 1.50 2003/04/17 07:39:03 phk Exp $
#
# The long compile-with and dependency lines are required because of
# limitations in config: backslash-newline doesn't work in strings, and
@@ -93,6 +93,7 @@
dev/syscons/syscons.c optional sc
dev/syscons/sysmouse.c optional sc
geom/geom_bsd.c standard
+geom/geom_bsd_enc.c standard
geom/geom_gpt.c standard
geom/geom_mbr.c standard
geom/geom_mbr_enc.c standard
==== //depot/projects/smpng/sys/conf/files.pc98#39 (text+ko) ====
@@ -3,7 +3,7 @@
#
# modified for PC-9801
#
-# $FreeBSD: src/sys/conf/files.pc98,v 1.267 2003/03/25 05:19:17 mdodd Exp $
+# $FreeBSD: src/sys/conf/files.pc98,v 1.268 2003/04/17 07:39:03 phk Exp $
#
# The long compile-with and dependency lines are required because of
# limitations in config: backslash-newline doesn't work in strings, and
@@ -124,6 +124,7 @@
dev/syscons/scvidctl.c optional sc
dev/syscons/sysmouse.c optional sc
geom/geom_bsd.c standard
+geom/geom_bsd_enc.c standard
geom/geom_pc98.c standard
gnu/i386/fpemul/div_small.s optional gpl_math_emulate \
warning "kernel contains GPL contaminated math emulator"
==== //depot/projects/smpng/sys/conf/files.sparc64#26 (text+ko) ====
@@ -1,7 +1,7 @@
# This file tells config what files go into building a kernel,
# files marked standard are always included.
#
-# $FreeBSD: src/sys/conf/files.sparc64,v 1.40 2003/03/19 06:55:36 jake Exp $
+# $FreeBSD: src/sys/conf/files.sparc64,v 1.41 2003/04/17 07:39:03 phk Exp $
#
# The long compile-with and dependency lines are required because of
# limitations in config: backslash-newline doesn't work in strings, and
@@ -18,6 +18,7 @@
dev/sio/sio.c optional sio
dev/sio/sio_isa.c optional sio isa
geom/geom_bsd.c standard
+geom/geom_bsd_enc.c standard
geom/geom_sunlabel.c standard
libkern/ffs.c standard
kern/syscalls.c optional ktr
==== //depot/projects/smpng/sys/dev/asr/asr.c#18 (text+ko) ====
@@ -103,7 +103,7 @@
* use proprietary packet creation instead of scsi_inquire
* CAM layer sends synchronize commands.
*
- * $FreeBSD: src/sys/dev/asr/asr.c,v 1.33 2003/03/03 12:15:40 phk Exp $
+ * $FreeBSD: src/sys/dev/asr/asr.c,v 1.34 2003/04/16 20:46:30 phk Exp $
*/
#define ASR_VERSION 1
@@ -216,7 +216,7 @@
#include <sys/systm.h>
#include <sys/malloc.h>
#include <sys/conf.h>
-#include <sys/disklabel.h>
+#include <sys/ioccom.h>
#include <sys/proc.h>
#include <sys/bus.h>
#include <machine/resource.h>
==== //depot/projects/smpng/sys/dev/firewire/firewire.c#13 (text+ko) ====
@@ -1,4 +1,5 @@
/*
+ * Copyright (c) 2003 Hidetoshi Shimokawa
* Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa
* All rights reserved.
*
@@ -30,7 +31,7 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: src/sys/dev/firewire/firewire.c,v 1.45 2003/03/24 04:11:21 simokawa Exp $
+ * $FreeBSD: src/sys/dev/firewire/firewire.c,v 1.46 2003/04/17 03:38:02 simokawa Exp $
*
*/
@@ -44,13 +45,13 @@
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/conf.h>
-#include <sys/uio.h>
#include <sys/sysctl.h>
#include <machine/cpufunc.h> /* for rdtsc proto for clock.h below */
#include <machine/clock.h>
#include <sys/bus.h> /* used by smbus and newbus */
+#include <machine/bus.h>
#include <dev/firewire/firewire.h>
#include <dev/firewire/firewirereg.h>
@@ -71,8 +72,6 @@
#define FW_MAXASYRTY 4
#define FW_MAXDEVRCNT 4
-#define XFER_TIMEOUT 0
-
devclass_t firewire_devclass;
static int firewire_match __P((device_t));
@@ -202,9 +201,9 @@
xferq = fc->ats;
len = info->hdr_len;
if (info->flag & FWTI_BLOCK_STR)
- len += ntohs(fp->mode.stream.len);
+ len += fp->mode.stream.len;
else if (info->flag & FWTI_BLOCK_ASY)
- len += ntohs(fp->mode.rresb.len);
+ len += fp->mode.rresb.len;
if( len > xfer->send.len ){
printf("len(%d) > send.len(%d) (tcode=%d)\n",
len, xfer->send.len, tcode);
@@ -230,11 +229,9 @@
}
xfer->tl = tl;
- xfer->tcode = tcode;
xfer->resp = 0;
xfer->fc = fc;
xfer->q = xferq;
- xfer->act_type = FWACT_XFER;
xfer->retry_req = fw_asybusy;
fw_asystart(xfer);
@@ -252,12 +249,7 @@
* Postpone to later retry.
*/
void fw_asybusy(struct fw_xfer *xfer){
-#if 1
printf("fw_asybusy\n");
-#endif
-#if XFER_TIMEOUT
- untimeout(fw_xfer_timeout, (void *)xfer, xfer->ch);
-#endif
/*
xfer->ch = timeout((timeout_t *)fw_asystart, (void *)xfer, 20000);
*/
@@ -265,24 +257,7 @@
fw_asystart(xfer);
return;
}
-#if XFER_TIMEOUT
-/*
- * Post timeout for async. request.
- */
-void
-fw_xfer_timeout(void *arg)
-{
- int s;
- struct fw_xfer *xfer;
- xfer = (struct fw_xfer *)arg;
- printf("fw_xfer_timeout status=%d resp=%d\n", xfer->state, xfer->resp);
- /* XXX set error code */
- s = splfw();
- xfer->act.hand(xfer);
- splx(s);
-}
-#endif
/*
* Async. request with given xfer structure.
*/
@@ -292,6 +267,7 @@
struct firewire_comm *fc = xfer->fc;
int s;
if(xfer->retry++ >= fc->max_asyretry){
+ device_printf(fc->bdev, "max_asyretry exceeded\n");
xfer->resp = EBUSY;
xfer->state = FWXF_BUSY;
xfer->act.hand(xfer);
@@ -314,10 +290,6 @@
/* XXX just queue for mbuf */
if (xfer->mbuf == NULL)
xfer->q->start(fc);
-#if XFER_TIMEOUT
- if (xfer->act.hand != NULL)
- xfer->ch = timeout(fw_xfer_timeout, (void *)xfer, hz);
-#endif
return;
}
@@ -355,15 +327,7 @@
xfer->dst, i);
xfer->resp = ETIMEDOUT;
STAILQ_REMOVE_HEAD(&fc->tlabels[i], link);
- switch (xfer->act_type) {
- case FWACT_XFER:
- fw_xfer_done(xfer);
- break;
- default:
- /* ??? */
- fw_xfer_free(xfer);
- break;
- }
+ fw_xfer_done(xfer);
}
}
splx(s);
@@ -437,10 +401,8 @@
/* launch attachement of the added children */
bus_generic_attach(dev);
-#if 1
/* bus_reset */
fc->ibr(fc);
-#endif
return 0;
}
@@ -524,15 +486,7 @@
STAILQ_REMOVE_HEAD(&xferq->q, link);
xferq->queued --;
xfer->resp = EAGAIN;
- switch (xfer->act_type) {
- case FWACT_XFER:
- fw_xfer_done(xfer);
- break;
- default:
- /* ??? */
- fw_xfer_free(xfer);
- break;
- }
+ fw_xfer_done(xfer);
}
}
@@ -553,6 +507,9 @@
void
fw_busreset(struct firewire_comm *fc)
{
+ struct firewire_dev_comm *fdc;
+ device_t *devlistp;
+ int devcnt;
int i;
switch(fc->status){
@@ -601,6 +558,16 @@
CSRARC(fc, STATE_CLEAR) &= ~(1 << 23 | 1 << 15 | 1 << 14 );
CSRARC(fc, STATE_SET) = CSRARC(fc, STATE_CLEAR);
+
+ if (device_get_children(fc->bdev, &devlistp, &devcnt) == 0) {
+ for( i = 0 ; i < devcnt ; i++)
+ if (device_get_state(devlistp[i]) >= DS_ATTACHED) {
+ fdc = device_get_softc(devlistp[i]);
+ if (fdc->post_busreset != NULL)
+ fdc->post_busreset(fdc);
+ }
+ free(devlistp, M_TEMP);
+ }
}
/* Call once after reboot */
@@ -620,21 +587,15 @@
fc->atq->queued = 0;
fc->ats->queued = 0;
- fc->arq->psize = PAGE_SIZE;
- fc->ars->psize = PAGE_SIZE;
- fc->atq->psize = 0;
- fc->ats->psize = 0;
-
-
fc->arq->buf = NULL;
fc->ars->buf = NULL;
fc->atq->buf = NULL;
fc->ats->buf = NULL;
- fc->arq->flag = FWXFERQ_PACKET;
- fc->ars->flag = FWXFERQ_PACKET;
- fc->atq->flag = FWXFERQ_PACKET;
- fc->ats->flag = FWXFERQ_PACKET;
+ fc->arq->flag = 0;
+ fc->ars->flag = 0;
+ fc->atq->flag = 0;
+ fc->ats->flag = 0;
STAILQ_INIT(&fc->atq->q);
STAILQ_INIT(&fc->ats->q);
@@ -723,7 +684,6 @@
fw_xfer_free(xfer);
}
xfer->act.hand = fw_vmaccess;
- xfer->act_type = FWACT_XFER;
xfer->fc = fc;
xfer->sc = NULL;
@@ -744,7 +704,7 @@
struct fw_bind *tfw;
for(tfw = STAILQ_FIRST(&fc->binds) ; tfw != NULL ;
tfw = STAILQ_NEXT(tfw, fclist)){
- if(tfw->xfer->act_type != FWACT_NULL &&
+ if (tfw->act_type != FWACT_NULL &&
tfw->start_hi == dest_hi &&
tfw->start_lo <= dest_lo &&
(tfw->start_lo + tfw->addrlen) > dest_lo){
@@ -796,9 +756,8 @@
STAILQ_INSERT_TAIL(&fc->binds, fwb, fclist);
}
out:
- if(!err && fwb->xfer->act_type == FWACT_CH){
- STAILQ_INSERT_HEAD(&fc->ir[fwb->xfer->sub]->binds, fwb, chlist);
- }
+ if (!err && fwb->act_type == FWACT_CH)
+ STAILQ_INSERT_HEAD(&fc->ir[fwb->sub]->binds, fwb, chlist);
return err;
}
@@ -809,14 +768,19 @@
fw_bindremove(struct firewire_comm *fc, struct fw_bind *fwb)
{
int s;
+ struct fw_xfer *xfer, *next;
s = splfw();
/* shall we check the existance? */
STAILQ_REMOVE(&fc->binds, fwb, fw_bind, fclist);
+ /* shall we do this? */
+ for (xfer = STAILQ_FIRST(&fwb->xferlist); xfer != NULL; xfer = next) {
+ next = STAILQ_NEXT(xfer, link);
+ fw_xfer_free(xfer);
+ }
+ STAILQ_INIT(&fwb->xferlist);
+
splx(s);
- if (fwb->xfer)
- fw_xfer_free(fwb->xfer);
-
return 0;
}
@@ -881,12 +845,40 @@
return xfer;
microtime(&xfer->tv);
- xfer->sub = -1;
xfer->malloc = type;
return xfer;
}
+struct fw_xfer *
+fw_xfer_alloc_buf(struct malloc_type *type, int send_len, int recv_len)
+{
+ struct fw_xfer *xfer;
+
+ xfer = fw_xfer_alloc(type);
+ xfer->send.len = send_len;
+ xfer->recv.len = recv_len;
+ if (xfer == NULL)
+ return(NULL);
+ if (send_len) {
+ xfer->send.buf = malloc(send_len, type, M_NOWAIT | M_ZERO);
+ if (xfer->send.buf == NULL) {
+ fw_xfer_free(xfer);
+ return(NULL);
+ }
+ }
+ if (recv_len) {
+ xfer->recv.buf = malloc(recv_len, type, M_NOWAIT);
+ if (xfer->recv.buf == NULL) {
+ if (xfer->send.buf != NULL)
+ free(xfer->send.buf, type);
+ fw_xfer_free(xfer);
+ return(NULL);
+ }
+ }
+ return(xfer);
+}
+
/*
* IEEE1394 XFER post process.
*/
@@ -896,10 +888,6 @@
if (xfer->act.hand == NULL)
return;
-#if XFER_TIMEOUT
- untimeout(fw_xfer_timeout, (void *)xfer, xfer->ch);
-#endif
-
if (xfer->fc->status != FWBUSRESET)
xfer->act.hand(xfer);
else {
@@ -911,13 +899,11 @@
}
}
-/*
- * To free IEEE1394 XFER structure.
- */
void
-fw_xfer_free( struct fw_xfer* xfer)
+fw_xfer_unload(struct fw_xfer* xfer)
{
int s;
+
if(xfer == NULL ) return;
if(xfer->state == FWXF_INQ){
printf("fw_xfer_free FWXF_INQ\n");
@@ -926,25 +912,31 @@
xfer->q->queued --;
splx(s);
}
- if(xfer->fc != NULL){
- if(xfer->state == FWXF_START){
-#if 0 /* this could happen if we call fwohci_arcv() before fwohci_txd() */
- printf("fw_xfer_free FWXF_START\n");
+ if (xfer->fc != NULL) {
+#if 1 /* this could happen if we call fwohci_arcv() before fwohci_txd() */
+ if(xfer->state == FWXF_START)
+ panic("fw_xfer_free FWXF_START\n");
#endif
- s = splfw();
- xfer->q->drain(xfer->fc, xfer);
- splx(s);
- }
+ fw_tl_free(xfer->fc, xfer);
}
+ xfer->state = FWXF_INIT;
+ xfer->resp = 0;
+ xfer->retry = 0;
+}
+/*
+ * To free IEEE1394 XFER structure.
+ */
+void
+fw_xfer_free( struct fw_xfer* xfer)
+{
+ if(xfer == NULL ) return;
+ fw_xfer_unload(xfer);
if(xfer->send.buf != NULL){
- free(xfer->send.buf, M_FW);
+ free(xfer->send.buf, xfer->malloc);
}
if(xfer->recv.buf != NULL){
- free(xfer->recv.buf, M_FW);
+ free(xfer->recv.buf, xfer->malloc);
}
- if(xfer->fc != NULL){
- fw_tl_free(xfer->fc, xfer);
- }
free(xfer, xfer->malloc);
}
@@ -969,24 +961,19 @@
fc->status = FWBUSPHYCONF;
-#if 0
- DELAY(100000);
-#endif
- xfer = fw_xfer_alloc(M_FWXFER);
- xfer->send.len = 12;
- xfer->send.off = 0;
+ xfer = fw_xfer_alloc_buf(M_FWXFER, 12, 0);
+ if (xfer == NULL)
+ return;
xfer->fc = fc;
xfer->retry_req = fw_asybusy;
xfer->act.hand = fw_asy_callback_free;
- xfer->send.buf = malloc(sizeof(u_int32_t),
- M_FW, M_NOWAIT | M_ZERO);
fp = (struct fw_pkt *)xfer->send.buf;
fp->mode.ld[1] = 0;
if (root_node >= 0)
- fp->mode.ld[1] |= htonl((root_node & 0x3f) << 24 | 1 << 23);
+ fp->mode.ld[1] |= (root_node & 0x3f) << 24 | 1 << 23;
if (gap_count >= 0)
- fp->mode.ld[1] |= htonl(1 << 22 | (gap_count & 0x3f) << 16);
+ fp->mode.ld[1] |= 1 << 22 | (gap_count & 0x3f) << 16;
fp->mode.ld[2] = ~fp->mode.ld[1];
/* XXX Dangerous, how to pass PHY packet to device driver */
fp->mode.common.tcode |= FWTCODE_PHY;
@@ -1018,9 +1005,9 @@
/*
* To receive self ID.
*/
-void fw_sidrcv(struct firewire_comm* fc, caddr_t buf, u_int len, u_int off)
+void fw_sidrcv(struct firewire_comm* fc, u_int32_t *sid, u_int len)
{
- u_int32_t *p, *sid = (u_int32_t *)(buf + off);
+ u_int32_t *p;
union fw_self_id *self_id;
u_int i, j, node, c_port = 0, i_branch = 0;
@@ -1103,9 +1090,7 @@
bcopy(p, &CSRARC(fc, SPED_MAP + 8), (fc->speed_map->crc_len - 1)*4);
fc->max_hop = fc->max_node - i_branch;
-#if 1
printf(", maxhop <= %d", fc->max_hop);
-#endif
if(fc->irm == -1 ){
printf(", Not found IRM capable node");
@@ -1132,7 +1117,6 @@
CSRARC(fc, BUS_MGR_ID));
#endif
}
- free(buf, M_FW);
if(fc->irm == ((CSRARC(fc, NODE_IDS) >> 16 ) & 0x3f)){
/* I am BMGR */
fw_bmr(fc);
@@ -1240,12 +1224,7 @@
fwdev->dst = fc->ongonode;
fwdev->eui.hi = fc->ongoeui.hi; fwdev->eui.lo = fc->ongoeui.lo;
fwdev->status = FWDEVINIT;
-#if 0
- fwdev->speed = CSRARC(fc, SPED_MAP + 8 + fc->ongonode / 4)
- >> ((3 - (fc->ongonode % 4)) * 8);
-#else
fwdev->speed = fc->speed_map->speed[fc->nodeid][fc->ongonode];
-#endif
pfwdev = NULL;
STAILQ_FOREACH(tfwdev, &fc->devices, link) {
@@ -1276,28 +1255,20 @@
fw_bus_explore_callback);
if(xfer == NULL) goto done;
#else
- xfer = fw_xfer_alloc(M_FWXFER);
+ xfer = fw_xfer_alloc_buf(M_FWXFER, 16, 16);
if(xfer == NULL){
goto done;
}
- xfer->send.len = 16;
xfer->spd = 0;
- xfer->send.buf = malloc(16, M_FW, M_NOWAIT);
- if(xfer->send.buf == NULL){
- fw_xfer_free( xfer);
- return;
- }
-
- xfer->send.off = 0;
fp = (struct fw_pkt *)xfer->send.buf;
- fp->mode.rreqq.dest_hi = htons(0xffff);
+ fp->mode.rreqq.dest_hi = 0xffff;
fp->mode.rreqq.tlrt = 0;
fp->mode.rreqq.tcode = FWTCODE_RREQQ;
fp->mode.rreqq.pri = 0;
fp->mode.rreqq.src = 0;
xfer->dst = FWLOCALBUS | fc->ongonode;
- fp->mode.rreqq.dst = htons(xfer->dst);
- fp->mode.rreqq.dest_lo = htonl(addr);
+ fp->mode.rreqq.dst = xfer->dst;
+ fp->mode.rreqq.dest_lo = addr;
xfer->act.hand = fw_bus_explore_callback;
if (firewire_debug)
@@ -1330,21 +1301,13 @@
struct fw_pkt *fp;
int err;
- xfer = fw_xfer_alloc(M_FWXFER);
- if(xfer == NULL){
+ xfer = fw_xfer_alloc_buf(M_FWXFER, 16, 16);
+ if (xfer == NULL)
return NULL;
- }
- xfer->send.len = 16;
+
xfer->spd = spd; /* XXX:min(spd, fc->spd) */
- xfer->send.buf = malloc(16, M_FW, M_NOWAIT);
- if(xfer->send.buf == NULL){
- fw_xfer_free( xfer);
- return NULL;
- }
-
- xfer->send.off = 0;
fp = (struct fw_pkt *)xfer->send.buf;
- fp->mode.rreqq.dest_hi = htons(addr_hi & 0xffff);
+ fp->mode.rreqq.dest_hi = addr_hi & 0xffff;
if(tl & FWP_TL_VALID){
fp->mode.rreqq.tlrt = (tl & 0x3f) << 2;
}else{
@@ -1355,8 +1318,8 @@
fp->mode.rreqq.pri = 0;
fp->mode.rreqq.src = 0;
xfer->dst = addr_hi >> 16;
- fp->mode.rreqq.dst = htons(xfer->dst);
- fp->mode.rreqq.dest_lo = htonl(addr_lo);
+ fp->mode.rreqq.dst = xfer->dst;
+ fp->mode.rreqq.dest_lo = addr_lo;
xfer->act.hand = hand;
err = fw_asyreq(fc, -1, xfer);
@@ -1420,14 +1383,14 @@
qld = (u_int32_t *)xfer->recv.buf;
printf("len:%d\n", xfer->recv.len);
for( i = 0 ; i <= xfer->recv.len && i < 32; i+= 4){
- printf("0x%08x ", ntohl(rfp->mode.ld[i/4]));
+ printf("0x%08x ", rfp->mode.ld[i/4]);
if((i % 16) == 15) printf("\n");
}
if((i % 16) != 15) printf("\n");
}
#endif
if(fc->ongodev == NULL){
- if(sfp->mode.rreqq.dest_lo == htonl((0xf0000000 | CSRROMOFF))){
+ if(sfp->mode.rreqq.dest_lo == (0xf0000000 | CSRROMOFF)){
rfp->mode.rresq.data = ntohl(rfp->mode.rresq.data);
chdr = (struct csrhdr *)(&rfp->mode.rresq.data);
/* If CSR is minimal confinguration, more investgation is not needed. */
@@ -1439,10 +1402,10 @@
}else{
fc->ongoaddr = CSRROMOFF + 0xc;
}
- }else if(sfp->mode.rreqq.dest_lo == htonl((0xf0000000 |(CSRROMOFF + 0xc)))){
+ }else if(sfp->mode.rreqq.dest_lo == (0xf0000000 |(CSRROMOFF + 0xc))){
fc->ongoeui.hi = ntohl(rfp->mode.rresq.data);
fc->ongoaddr = CSRROMOFF + 0x10;
- }else if(sfp->mode.rreqq.dest_lo == htonl((0xf0000000 |(CSRROMOFF + 0x10)))){
+ }else if(sfp->mode.rreqq.dest_lo == (0xf0000000 |(CSRROMOFF + 0x10))){
fc->ongoeui.lo = ntohl(rfp->mode.rresq.data);
if (fc->ongoeui.hi == 0 && fc->ongoeui.lo == 0) {
if (firewire_debug)
@@ -1701,17 +1664,42 @@
return(-1);
}
+static void
+fw_rcv_copy(struct fw_xfer *xfer, struct iovec *vec, int nvec)
+{
+ char *p;
+ int res, i, len;
+
+ p = xfer->recv.buf;
+ res = xfer->recv.len;
+ for (i = 0; i < nvec; i++, vec++) {
+ len = vec->iov_len;
+ if (res < len) {
+ printf("rcv buffer(%d) is %d bytes short.\n",
+ xfer->recv.len, len - res);
+ len = res;
+ }
+ bcopy(vec->iov_base, p, len);
+ p += len;
+ res -= len;
+ if (res <= 0)
+ break;
+ }
+ xfer->recv.len -= res;
+}
+
/*
* Generic packet receving process.
*/
void
-fw_rcv(struct firewire_comm* fc, caddr_t buf, u_int len, u_int sub, u_int off, u_int spd)
+fw_rcv(struct firewire_comm *fc, struct iovec *vec, int nvec, u_int sub, u_int spd)
{
struct fw_pkt *fp, *resfp;
struct fw_xfer *xfer;
struct fw_bind *bind;
struct firewire_softc *sc;
- int s;
+ int tcode, s;
+ int i, len, oldstate;
#if 0
{
u_int32_t *qld;
@@ -1725,25 +1713,37 @@
if((i % 16) != 15) printf("\n");
}
#endif
- fp = (struct fw_pkt *)(buf + off);
- switch(fp->mode.common.tcode){
+ fp = (struct fw_pkt *)vec[0].iov_base;
+ tcode = fp->mode.common.tcode;
+#if 0 /* XXX this check is not valid for RRESQ and WREQQ */
+ if (vec[0].iov_len < fc->tcode[tcode].hdr_len) {
+#if __FreeBSD_version >= 500000
+ printf("fw_rcv: iov_len(%zu) is less than"
+#else
+ printf("fw_rcv: iov_len(%u) is less than"
+#endif
+ " hdr_len(%d:tcode=%d)\n", vec[0].iov_len,
+ fc->tcode[tcode].hdr_len, tcode);
+ }
+#endif
+ switch (tcode) {
case FWTCODE_WRES:
case FWTCODE_RRESQ:
case FWTCODE_RRESB:
case FWTCODE_LRES:
- xfer = fw_tl2xfer(fc, ntohs(fp->mode.hdr.src),
+ xfer = fw_tl2xfer(fc, fp->mode.hdr.src,
fp->mode.hdr.tlrt >> 2);
if(xfer == NULL) {
printf("fw_rcv: unknown response "
"tcode=%d src=0x%x tl=0x%x rt=%d data=0x%x\n",
- fp->mode.common.tcode,
- ntohs(fp->mode.hdr.src),
+ tcode,
+ fp->mode.hdr.src,
fp->mode.hdr.tlrt >> 2,
fp->mode.hdr.tlrt & 3,
fp->mode.rresq.data);
#if 1
printf("try ad-hoc work around!!\n");
- xfer = fw_tl2xfer(fc, ntohs(fp->mode.hdr.src),
+ xfer = fw_tl2xfer(fc, fp->mode.hdr.src,
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list