Documentation/: update FireWire debugging documentation
[deliverable/linux.git] / Documentation / debugging-via-ohci1394.txt
CommitLineData
f212ec4b
BK
1
2 Using physical DMA provided by OHCI-1394 FireWire controllers for debugging
3 ---------------------------------------------------------------------------
4
5Introduction
6------------
7
8Basically all FireWire controllers which are in use today are compliant
9to the OHCI-1394 specification which defines the controller to be a PCI
10bus master which uses DMA to offload data transfers from the CPU and has
11a "Physical Response Unit" which executes specific requests by employing
12PCI-Bus master DMA after applying filters defined by the OHCI-1394 driver.
13
14Once properly configured, remote machines can send these requests to
15ask the OHCI-1394 controller to perform read and write requests on
16physical system memory and, for read requests, send the result of
17the physical memory read back to the requester.
18
19With that, it is possible to debug issues by reading interesting memory
20locations such as buffers like the printk buffer or the process table.
21
22Retrieving a full system memory dump is also possible over the FireWire,
23using data transfer rates in the order of 10MB/s or more.
24
25Memory access is currently limited to the low 4G of physical address
26space which can be a problem on IA64 machines where memory is located
27mostly above that limit, but it is rarely a problem on more common
28hardware such as hardware based on x86, x86-64 and PowerPC.
29
30Together with a early initialization of the OHCI-1394 controller for debugging,
31this facility proved most useful for examining long debugs logs in the printk
32buffer on to debug early boot problems in areas like ACPI where the system
33fails to boot and other means for debugging (serial port) are either not
34available (notebooks) or too slow for extensive debug information (like ACPI).
35
36Drivers
37-------
38
a9954ce7 39The firewire-ohci driver in drivers/firewire uses filtered physical
080de8c2
SR
40DMA by default, which is more secure but not suitable for remote debugging.
41Compile the driver with CONFIG_FIREWIRE_OHCI_REMOTE_DMA (Kernel hacking menu:
42Remote debugging over FireWire with firewire-ohci) to get unfiltered physical
43DMA.
09d7328e 44
a9954ce7 45Because the firewire-ohci driver depends on the PCI enumeration to be
080de8c2
SR
46completed, an initialization routine which runs pretty early has been
47implemented for x86. This routine runs long before console_init() can be
48called, i.e. before the printk buffer appears on the console.
f212ec4b
BK
49
50To activate it, enable CONFIG_PROVIDE_OHCI1394_DMA_INIT (Kernel hacking menu:
080de8c2
SR
51Remote debugging over FireWire early on boot) and pass the parameter
52"ohci1394_dma=early" to the recompiled kernel on boot.
f212ec4b
BK
53
54Tools
55-----
56
57firescope - Originally developed by Benjamin Herrenschmidt, Andi Kleen ported
58it from PowerPC to x86 and x86_64 and added functionality, firescope can now
59be used to view the printk buffer of a remote machine, even with live update.
60
61Bernhard Kaindl enhanced firescope to support accessing 64-bit machines
62from 32-bit firescope and vice versa:
a9954ce7 63- http://v3.sk/~lkundrak/firescope/
f212ec4b
BK
64
65and he implemented fast system dump (alpha version - read README.txt):
211a6417 66- http://halobates.de/firewire/firedump-0.1.tar.bz2
f212ec4b
BK
67
68There is also a gdb proxy for firewire which allows to use gdb to access
69data which can be referenced from symbols found by gdb in vmlinux:
211a6417 70- http://halobates.de/firewire/fireproxy-0.33.tar.bz2
f212ec4b
BK
71
72The latest version of this gdb proxy (fireproxy-0.34) can communicate (not
73yet stable) with kgdb over an memory-based communication module (kgdbom).
74
75Getting Started
76---------------
77
78The OHCI-1394 specification regulates that the OHCI-1394 controller must
79disable all physical DMA on each bus reset.
80
81This means that if you want to debug an issue in a system state where
82interrupts are disabled and where no polling of the OHCI-1394 controller
83for bus resets takes place, you have to establish any FireWire cable
84connections and fully initialize all FireWire hardware __before__ the
85system enters such state.
86
87Step-by-step instructions for using firescope with early OHCI initialization:
88
891) Verify that your hardware is supported:
90
a9954ce7 91 Load the firewire-ohci module and check your kernel logs.
f212ec4b
BK
92 You should see a line similar to
93
a9954ce7
LR
94 firewire_ohci 0000:15:00.1: added OHCI v1.0 device as card 2, 4 IR + 4 IT
95 ... contexts, quirks 0x11
f212ec4b
BK
96
97 when loading the driver. If you have no supported controller, many PCI,
98 CardBus and even some Express cards which are fully compliant to OHCI-1394
99 specification are available. If it requires no driver for Windows operating
100 systems, it most likely is. Only specialized shops have cards which are not
101 compliant, they are based on TI PCILynx chips and require drivers for Win-
102 dows operating systems.
103
1042) Establish a working FireWire cable connection:
105
106 Any FireWire cable, as long at it provides electrically and mechanically
107 stable connection and has matching connectors (there are small 4-pin and
108 large 6-pin FireWire ports) will do.
109
110 If an driver is running on both machines you should see a line like
111
a9954ce7 112 firewire_core 0000:15:00.1: created device fw1: GUID 00061b0020105917, S400
f212ec4b
BK
113
114 on both machines in the kernel log when the cable is plugged in
115 and connects the two machines.
116
1173) Test physical DMA using firescope:
118
a9954ce7 119 On the debug host, make sure that /dev/fw* is accessible,
f212ec4b
BK
120 then start firescope:
121
122 $ firescope
a9954ce7 123 Port 0 (/dev/fw1) opened, 2 nodes detected
f212ec4b
BK
124
125 FireScope
126 ---------
127 Target : <unspecified>
128 Gen : 1
129 [Ctrl-T] choose target
130 [Ctrl-H] this menu
131 [Ctrl-Q] quit
132
133 ------> Press Ctrl-T now, the output should be similar to:
134
135 2 nodes available, local node is: 0
136 0: ffc0, uuid: 00000000 00000000 [LOCAL]
137 1: ffc1, uuid: 00279000 ba4bb801
138
139 Besides the [LOCAL] node, it must show another node without error message.
140
1414) Prepare for debugging with early OHCI-1394 initialization:
142
143 4.1) Kernel compilation and installation on debug target
144
145 Compile the kernel to be debugged with CONFIG_PROVIDE_OHCI1394_DMA_INIT
146 (Kernel hacking: Provide code for enabling DMA over FireWire early on boot)
147 enabled and install it on the machine to be debugged (debug target).
148
149 4.2) Transfer the System.map of the debugged kernel to the debug host
150
151 Copy the System.map of the kernel be debugged to the debug host (the host
152 which is connected to the debugged machine over the FireWire cable).
153
1545) Retrieving the printk buffer contents:
155
156 With the FireWire cable connected, the OHCI-1394 driver on the debugging
157 host loaded, reboot the debugged machine, booting the kernel which has
158 CONFIG_PROVIDE_OHCI1394_DMA_INIT enabled, with the option ohci1394_dma=early.
159
160 Then, on the debugging host, run firescope, for example by using -A:
161
162 firescope -A System.map-of-debug-target-kernel
163
164 Note: -A automatically attaches to the first non-local node. It only works
165 reliably if only connected two machines are connected using FireWire.
166
167 After having attached to the debug target, press Ctrl-D to view the
168 complete printk buffer or Ctrl-U to enter auto update mode and get an
169 updated live view of recent kernel messages logged on the debug target.
170
171 Call "firescope -h" to get more information on firescope's options.
172
173Notes
174-----
211a6417 175Documentation and specifications: http://halobates.de/firewire/
f212ec4b
BK
176
177FireWire is a trademark of Apple Inc. - for more information please refer to:
178http://en.wikipedia.org/wiki/FireWire
This page took 0.362909 seconds and 5 git commands to generate.