1103285Sikob$FreeBSD$
2103285Sikob
3103285SikobIEEE 1394 support for FreeBSD-5.X and 4.X.
4103285Sikob
5103285Sikob1. Introduction
6103285Sikob
7103285Sikob	  This tarball contains IEEE1394(FireWire) driver which is first
8103285Sikob	written by Katsushi Kobayashi[1] <ikob@koganei.wide.ad.jp> and
9103285Sikob	modified by Hidetoshi Shimokawa <simokawa@freebsd.org>.
10103285Sikob	Please note this driver is still under development.
11103285Sikob	You can find latest snapshots under:
12103285Sikob		http://people.freebsd.org/~simokawa/
13103285Sikob	named firewire-2002XXXX.tar.gz
14103285Sikob
15103285Sikob	The driver consists of 6 parts:
16103285Sikob
17103285Sikob	- fwohci.c/fwohci_pci.c
18103285Sikob		OHCI[2] driver
19103285Sikob			- IEEE1394 link/phy chip control
20103285Sikob	- firewire.c
21103285Sikob		Chip independent driver 
22103285Sikob			- CSR
23103285Sikob			- Transaction
24103285Sikob			- Character devices for userland
25103285Sikob	- fwmem.c
26103285Sikob		/dev/fwmem0: physical memory of a remote node.
27103285Sikob	- sbp.c
28103285Sikob		SBP-II[3] (a.k.a. SCSI over FireWire) driver
29103285Sikob
30103285Sikob	- if_fwe.c
31103285Sikob		NON-Standard implementation of Ethernet over FireWire.
32103285Sikob
33103285Sikob	- bus_mgm.c (userland)
34103285Sikob		Bus management function for user. 
35103285Sikob		show topology map, change gap count, bus reset, etc.
36103285Sikob
37103285Sikob2. Installation
38103285Sikob
39103285Sikob	Suppose you have kernel source at /sys.
40103285Sikob
41103285Sikob	- Extract tarball at root directory.
42103285Sikob	- cd /sys/dev/firewire
43103285Sikob	- make 
44103285Sikob	- make install
45103285Sikob	- make load
46103285Sikob
47103285Sikob3. SBP-II support (sbp)
48103285Sikob
49103285Sikob	- You need CAM(SCSI) support in your kernel.
50103285Sikob	  If you are using FreeBSD-5 before 2002/03/23 or FreeBSD-4 before
51103285Sikob	  2002/4/8, you need to apply CAM-patch in this archive
52103285Sikob	  to handle HDD's(T_RBC or T_DIRECT which doesn't support READ_6).
53103285Sikob
54103285Sikob	- If you connect a few firewire devices only, try the following to
55103285Sikob	  reduce gap overhead.
56103285Sikob
57103285Sikob		- ./bus_mgm -g 8
58103285Sikob
59103285Sikob4. Ethernet over FireWire (if_fwe)
60103285Sikob
61103285Sikob	  This is a sample driver for ethernet emulation. Please note this
62103285Sikob	does NOT conform to any standards like IP over FireWire(RFC2734[4]).
63103285Sikob	It just sends ethernet frames encapsulated in asynchronous stream
64103285Sikob	packets. It doesn't scale because it does something like unicast over		multicast, but it's easy to be implemented and you can use any
65103285Sikob	facilities what ethernet can do. (ipv6, bridging, vlan etc.)
66103285Sikob
67103285Sikob	  It also has DEVICE_POLLING[5] support. To enable it, edit your
68103285Sikob	kernel config file and Makefile.fwe then rebuild kernel and if_fwe.ko.
69103285Sikob
70103285Sikob5. FireWire for Kernel Hackers
71103285Sikob
72103285Sikob          As you know, IEEE1394 is a bus and OHCI supports physical access
73103285Sikob	to the host memory. This means that you can access the remote
74103285Sikob	host over firewire without software support at the remote host.
75103285Sikob	In other words, you can investigate remote host's physical memory
76103285Sikob	whether its OS is alive or crashed or hangs up.
77103285Sikob
78103285Sikob	  You need to apply KVMLIB-patch and rebuild libkvm then rebuild ps,
79103285Sikob	dmesg and gdb those are statically linked.
80103285Sikob	You may want to apply GDB-patch in this archive to get same behavior
81103285Sikob	as gdb with /dev/mem or want to insert savectx(&dumppcb) into panic(),
82103285Sikob	breakpoint() and so on to emulation crash dump.
83103285Sikob
84103285Sikob	  You have to determine target node_id manually at this point.
85103285Sikob	(guess using bus_mgm -t or dmesg)
86103285Sikob	(Targets should be specified by EUI64 in the future)
87103285Sikob
88103285Sikob	# sysctl kern.firewire.fwmem_node=[node_id]
89103285Sikob
90103285Sikob	# ps -agx -M /dev/fwmem0 -N /sys/i386/compile/GENERIC/kernel
91103285Sikob	# dmesg -M /dev/fwmem0 -N /sys/i386/compile/GENERIC/kernel
92103285Sikob	# gdb -k -c /dev/fwmem0 /sys/i386/compile/GENERIC/kernel.debug
93103285Sikob	# dd if=/dev/fwmem0 of=vmcore bs=1m count=[phys. memory in MB]
94103285Sikob
95103285Sikob	remote gdb at 400,000,000 bps :-)
96103285Sikob
97103285Sikob	
98103285Sikob6. DV
99103285Sikob	I have not tested yet.
100103285Sikob
101103285Sikob7. Tested HW
102103285Sikob
103103285Sikob	OS
104103285Sikob	- FreeBSD-4/i386
105103285Sikob	- FreeBSD-4/alpha
106103285Sikob	- FreeBSD-5/i386
107103285Sikob
108103285Sikob	* Not tested on SMP.
109103285Sikob	* Not tested on big-endian machine...
110103285Sikob
111103285Sikob	OHCI
112103285Sikob	- Texas Instruments TSB12LV26 (PCI)
113103285Sikob	- Texas Instruments TSB43AA22 (PCI/Cardbus)
114103285Sikob
115103285Sikob	* There might be phy probing problem but most of the OHCI
116103285Sikob	  chips should work.
117103285Sikob	* Tested with multiple firewire buses.
118103285Sikob
119103285Sikob	SBP-II
120103285Sikob	- HDD: Logitec USB/FireWire LHD-P30FU
121103285Sikob	- HDD: Yano A-dish 120GB
122103285Sikob	- HDD: Yano B-Max 320GB
123103285Sikob		The repository of cvsup2.jp.freebsd.org is on this device.
124103285Sikob	- HDD: Personal Storage 3000XT 160GB
125103285Sikob		The last sector of this drive cannot be accessed..
126103285Sikob	- DVD-RAM: Panasonic LF-D340JD 
127103285Sikob	- SCSI-FireWire converter: Yano FWSCSI-01
128103285Sikob		We can recognize only 1 device/lun at this point
129103285Sikob	- HDD: iPod, PowerBook G4 (target mode)
130103285Sikob		Reported by ikob
131103285Sikob	- Scanner: Epson GT-9700F
132103285Sikob		Now works!!
133103285Sikob		Sane-backend needs a patch(SANE-patch in this archive).
134103285Sikob
135103285Sikob	if_fwe
136103285Sikob	- IPv4, IPv6, bridging, vlan.
137103285Sikob	- You need at least two FreeBSD machines with this driver to use.
138103285Sikob
139103285SikobReferences:
140103285Sikob[1] ftp://ftp.uec.ac.jp/pub/firewire/beta/ 
141103285Sikob[2] http://developer.intel.com/technology/1394/download/ohci_11.htm
142103285Sikob[3] http://www.t10.org/scsi-3.htm
143103285Sikob[4] http://www.faqs.org/rfcs/rfc2734.html
144103285Sikob[5] http://info.iet.unipi.it/~luigi/polling/
145103285Sikob
146103285Sikob
147103285SikobHidetoshi Shimokawa
148103285Sikobsimokawa@freebsd.org
149