firewire.c (109379) | firewire.c (109422) |
---|---|
1/* 2 * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 16 unchanged lines hidden (view full) --- 25 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 29 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 30 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 * POSSIBILITY OF SUCH DAMAGE. 32 * | 1/* 2 * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 16 unchanged lines hidden (view full) --- 25 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 29 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 30 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 * POSSIBILITY OF SUCH DAMAGE. 32 * |
33 * $FreeBSD: head/sys/dev/firewire/firewire.c 109379 2003-01-16 13:09:33Z simokawa $ | 33 * $FreeBSD: head/sys/dev/firewire/firewire.c 109422 2003-01-17 15:03:25Z simokawa $ |
34 * 35 */ 36 37#include <sys/param.h> 38#include <sys/systm.h> 39#include <sys/types.h> 40#include <sys/mbuf.h> 41#include <sys/socket.h> --- 1952 unchanged lines hidden (view full) --- 1994} 1995 1996/* 1997 * Post process for Bus Manager election process. 1998 */ 1999static void 2000fw_try_bmr_callback(struct fw_xfer *xfer) 2001{ | 34 * 35 */ 36 37#include <sys/param.h> 38#include <sys/systm.h> 39#include <sys/types.h> 40#include <sys/mbuf.h> 41#include <sys/socket.h> --- 1952 unchanged lines hidden (view full) --- 1994} 1995 1996/* 1997 * Post process for Bus Manager election process. 1998 */ 1999static void 2000fw_try_bmr_callback(struct fw_xfer *xfer) 2001{ |
2002 struct fw_pkt *sfp,*rfp; | 2002 struct fw_pkt *rfp; |
2003 struct firewire_comm *fc; | 2003 struct firewire_comm *fc; |
2004 int bmr; |
|
2004 | 2005 |
2005 if(xfer == NULL) return; | 2006 if (xfer == NULL) 2007 return; |
2006 fc = xfer->fc; | 2008 fc = xfer->fc; |
2007 if(xfer->resp != 0){ | 2009 if (xfer->resp != 0) |
2008 goto error; | 2010 goto error; |
2009 } 2010 2011 if(xfer->send.buf == NULL){ | 2011 if (xfer->send.buf == NULL) |
2012 goto error; | 2012 goto error; |
2013 } 2014 sfp = (struct fw_pkt *)xfer->send.buf; 2015 2016 if(xfer->recv.buf == NULL){ | 2013 if (xfer->recv.buf == NULL) |
2017 goto error; | 2014 goto error; |
2018 } | |
2019 rfp = (struct fw_pkt *)xfer->recv.buf; | 2015 rfp = (struct fw_pkt *)xfer->recv.buf; |
2020 CSRARC(fc, BUS_MGR_ID) 2021 = fc->set_bmr(fc, ntohl(rfp->mode.lres.payload[0]) & 0x3f); | 2016 if (rfp->mode.lres.rtcode != FWRCODE_COMPLETE) 2017 goto error; 2018 2019 bmr = ntohl(rfp->mode.lres.payload[0]); 2020 if (bmr == 0x3f) 2021 bmr = fc->nodeid; 2022 2023 CSRARC(fc, BUS_MGR_ID) = fc->set_bmr(fc, bmr & 0x3f); |
2022 device_printf(fc->bdev, "new bus manager %d ", 2023 CSRARC(fc, BUS_MGR_ID)); | 2024 device_printf(fc->bdev, "new bus manager %d ", 2025 CSRARC(fc, BUS_MGR_ID)); |
2024 if((htonl(rfp->mode.lres.payload[0]) & 0x3f) == fc->nodeid){ | 2026 if(bmr == fc->nodeid){ |
2025 printf("(me)\n"); 2026/* If I am bus manager, optimize gapcount */ 2027 if(fc->max_hop <= MAX_GAPHOP ){ 2028 fw_phy_config(fc, -1, gap_cnt[fc->max_hop]); 2029 } 2030 }else{ 2031 printf("\n"); 2032 } --- 33 unchanged lines hidden (view full) --- 2066 fp->mode.lreq.tcode = FWTCODE_LREQ; 2067 fp->mode.lreq.pri = 0; 2068 fp->mode.lreq.src = 0; 2069 fp->mode.lreq.len = htons(8); 2070 fp->mode.lreq.extcode = htons(FW_LREQ_CMPSWAP); 2071 xfer->dst = FWLOCALBUS | fc->irm; 2072 fp->mode.lreq.dst = htons(xfer->dst); 2073 fp->mode.lreq.dest_lo = htonl(0xf0000000 | BUS_MGR_ID); | 2027 printf("(me)\n"); 2028/* If I am bus manager, optimize gapcount */ 2029 if(fc->max_hop <= MAX_GAPHOP ){ 2030 fw_phy_config(fc, -1, gap_cnt[fc->max_hop]); 2031 } 2032 }else{ 2033 printf("\n"); 2034 } --- 33 unchanged lines hidden (view full) --- 2068 fp->mode.lreq.tcode = FWTCODE_LREQ; 2069 fp->mode.lreq.pri = 0; 2070 fp->mode.lreq.src = 0; 2071 fp->mode.lreq.len = htons(8); 2072 fp->mode.lreq.extcode = htons(FW_LREQ_CMPSWAP); 2073 xfer->dst = FWLOCALBUS | fc->irm; 2074 fp->mode.lreq.dst = htons(xfer->dst); 2075 fp->mode.lreq.dest_lo = htonl(0xf0000000 | BUS_MGR_ID); |
2074 fp->mode.lreq.payload[0] = 0x3f; 2075 fp->mode.lreq.payload[1] = fc->nodeid; | 2076 fp->mode.lreq.payload[0] = htonl(0x3f); 2077 fp->mode.lreq.payload[1] = htonl(fc->nodeid); |
2076 xfer->act_type = FWACT_XFER; 2077 xfer->act.hand = fw_try_bmr_callback; 2078 2079 err = fw_asyreq(fc, -1, xfer); 2080 if(err){ 2081 fw_xfer_free( xfer); 2082 return; 2083 } --- 101 unchanged lines hidden --- | 2078 xfer->act_type = FWACT_XFER; 2079 xfer->act.hand = fw_try_bmr_callback; 2080 2081 err = fw_asyreq(fc, -1, xfer); 2082 if(err){ 2083 fw_xfer_free( xfer); 2084 return; 2085 } --- 101 unchanged lines hidden --- |