Deleted Added
full compact
firewire.c (109424) firewire.c (109736)
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 109424 2003-01-17 15:15:21Z simokawa $
33 * $FreeBSD: head/sys/dev/firewire/firewire.c 109736 2003-01-23 13:34:40Z 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>

--- 10 unchanged lines hidden (view full) ---

52
53#include <sys/bus.h> /* used by smbus and newbus */
54
55#include <dev/firewire/firewire.h>
56#include <dev/firewire/firewirereg.h>
57#include <dev/firewire/iec13213.h>
58#include <dev/firewire/iec68113.h>
59
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>

--- 10 unchanged lines hidden (view full) ---

52
53#include <sys/bus.h> /* used by smbus and newbus */
54
55#include <dev/firewire/firewire.h>
56#include <dev/firewire/firewirereg.h>
57#include <dev/firewire/iec13213.h>
58#include <dev/firewire/iec68113.h>
59
60int firewire_debug=0;
61SYSCTL_NODE(_hw, OID_AUTO, firewire, CTLFLAG_RD, 0, "FireWire Subsystem");
60int firewire_debug=0, try_bmr=1;
62SYSCTL_INT(_debug, OID_AUTO, firewire_debug, CTLFLAG_RW, &firewire_debug, 0,
63 "FireWire driver debug flag");
61SYSCTL_INT(_debug, OID_AUTO, firewire_debug, CTLFLAG_RW, &firewire_debug, 0,
62 "FireWire driver debug flag");
63SYSCTL_NODE(_hw, OID_AUTO, firewire, CTLFLAG_RD, 0, "FireWire Subsystem");
64SYSCTL_INT(_hw_firewire, OID_AUTO, try_bmr, CTLFLAG_RW, &try_bmr, 0,
65 "Try to be a bus manager");
64
65#define FW_MAXASYRTY 4
66#define FW_MAXDEVRCNT 4
67
68#define XFER_TIMEOUT 0
69
70devclass_t firewire_devclass;
71

--- 1118 unchanged lines hidden (view full) ---

1190 }else{
1191 printf(", cable IRM = %d", fc->irm);
1192 if (fc->irm == fc->nodeid)
1193 printf(" (me)\n");
1194 else
1195 printf("\n");
1196 }
1197
66
67#define FW_MAXASYRTY 4
68#define FW_MAXDEVRCNT 4
69
70#define XFER_TIMEOUT 0
71
72devclass_t firewire_devclass;
73

--- 1118 unchanged lines hidden (view full) ---

1192 }else{
1193 printf(", cable IRM = %d", fc->irm);
1194 if (fc->irm == fc->nodeid)
1195 printf(" (me)\n");
1196 else
1197 printf("\n");
1198 }
1199
1198 if((fc->irm != -1) && (CSRARC(fc, BUS_MGR_ID) == 0x3f) ){
1199 if(fc->irm == ((CSRARC(fc, NODE_IDS) >> 16 ) & 0x3f)){
1200 if (try_bmr && (fc->irm != -1) && (CSRARC(fc, BUS_MGR_ID) == 0x3f)) {
1201 if (fc->irm == ((CSRARC(fc, NODE_IDS) >> 16 ) & 0x3f)) {
1200 fc->status = FWBUSMGRDONE;
1201 CSRARC(fc, BUS_MGR_ID) = fc->set_bmr(fc, fc->irm);
1202 fc->status = FWBUSMGRDONE;
1203 CSRARC(fc, BUS_MGR_ID) = fc->set_bmr(fc, fc->irm);
1202 }else{
1204 } else {
1203 fc->status = FWBUSMGRELECT;
1205 fc->status = FWBUSMGRELECT;
1204 fc->bmrhandle = timeout((timeout_t *)fw_try_bmr,(void *)fc, hz / 8);
1206 fc->bmrhandle = timeout((timeout_t *)fw_try_bmr,
1207 (void *)fc, hz / 8);
1205 }
1208 }
1206 }else{
1209 } else {
1207 fc->status = FWBUSMGRDONE;
1210 fc->status = FWBUSMGRDONE;
1211#if 0
1208 device_printf(fc->bdev, "BMR = %x\n",
1209 CSRARC(fc, BUS_MGR_ID));
1212 device_printf(fc->bdev, "BMR = %x\n",
1213 CSRARC(fc, BUS_MGR_ID));
1214#endif
1210 }
1211 free(buf, M_DEVBUF);
1215 }
1216 free(buf, M_DEVBUF);
1212#if 1
1213 /* XXX optimize gap_count, if I am BMGR */
1217 /* Optimize gap_count, if I am BMGR */
1214 if(fc->irm == ((CSRARC(fc, NODE_IDS) >> 16 ) & 0x3f)){
1215 fw_phy_config(fc, -1, gap_cnt[fc->max_hop]);
1216 }
1218 if(fc->irm == ((CSRARC(fc, NODE_IDS) >> 16 ) & 0x3f)){
1219 fw_phy_config(fc, -1, gap_cnt[fc->max_hop]);
1220 }
1217#endif
1218#if 1
1219 callout_reset(&fc->busprobe_callout, hz/4,
1220 (void *)fw_bus_probe, (void *)fc);
1221 callout_reset(&fc->busprobe_callout, hz/4,
1222 (void *)fw_bus_probe, (void *)fc);
1221#else
1222 fw_bus_probe(fc);
1223#endif
1224}
1225
1226/*
1227 * To probe devices on the IEEE1394 bus.
1228 */
1229static void
1230fw_bus_probe(struct firewire_comm *fc)
1231{

--- 955 unchanged lines hidden ---
1223}
1224
1225/*
1226 * To probe devices on the IEEE1394 bus.
1227 */
1228static void
1229fw_bus_probe(struct firewire_comm *fc)
1230{

--- 955 unchanged lines hidden ---