linux/Documentation/debugging-via-ohci1394.txt
<<
tion tion tio/spa> tiospa> class="lxr_search">tion="+search" method="post" onsubmit="return do_search(this);">tion tion tion Search tiospa> class="lxr_prefs" tion tio/spa> on < ="ajax+*" method="post" onsubmit="return false;">tioinput typ="vhidden" nam="vajax_lookup" id"vajax_lookup" alue="v">ton <
< <1o/a>t< <2o/a> Using physical DMA provided by OHCI-1394 FireWire controllers for debuggingt< <3o/a> ---------------------------------------------------------------------------t< <4o/a>t< <5o/a>Introducion>t< <6o/a>------------t< <7o/a>t< <8o/a>Basically all FireWire controllers which are in use today are compliantt< <9o/a>to the OHCI-1394 specificaion vwhich defines the controller to be a PCIt< optia>bus master which uses DMA to offload data transfers from the CPU and hast< 11o/a>a "Physical Response Unit" which executes specific requests by employingt< 12o/a>PCI-Bus master DMA after applying filters defined by the OHCI-1394 driver.t< 13o/a>t< 14o/a>Once properly configured, remote machines ca> send these requests tot< 15o/a>ask the OHCI-1394 controller to perform read and write requests n>t< 16o/a>physical system memory and, for read requests, send the result oft< 17o/a>the physical memory read back to the requester.t< 18o/a>t< 19o/a>With that, it is possible to debug issues by reading interesting memoryt< 2ptia>locaion s such as buffers like the printk buffer or the process table.t< 21o/a>t< 22o/a>Retrieving a full system memory dump is also possible over the FireWire,t< 23o/a>using data transfer rates in the order of opMB/s or more.t< 24o/a>t< 25o/a>Memory access is currently limited to the low 4G of physical addresst< 26o/a>space which ca> be a problem n> IA64 machines where memory is locaiedt< 27o/a>mostly above that limit, but it is rarely a problem n> more commn>t< 28o/a>hardware such as hardware based n> x86, x86-64 and PowerPC.t< 29o/a>t< 3ptia>Together with a early initializaion vof the OHCI-1394 controller for debugging,t< 31o/a>this facility proved most useful for examining long debugs logs in the printkt< 32tia>buffer on to debug early boot problems in areas like ACPI where the systemt< 33o/a>fails to boot and other means for debugging (serial port) are either nott< 34o/a>available (notebooks) or too slow for extensive debug informaion v(like ACPI).t< 35o/a>t< 36o/a>Driverst< 37o/a>-------t< 38o/a>t< 39o/a>The ohci1394 driver in drivers/ieee1394 initializes the OHCI-1394 controllerst< 40o/a>to a working staie and enables physical DMA by default for all remote nodes.t< 41o/a>This ca> be turned nff by ohci1394's module param=ter phys_dma=0.t< 42o/a>t< 43o/a>The alternaiove firewire-ohci driver in drivers/firewire uses filtered physicalt< 44o/a>DMA by default, which is more secure but not suitable for remote debugging.t< 45o/a>Compile the driver with CONFIG_FIREWIRE_OHCI_REMOTE_DMA (Kernel hacking menu:t< 46o/a>Remote debugging over FireWire with firewire-ohci) to get unfiltered physicalt< 47o/a>DMA.t< 48o/a>t< 49o/a>Because ohci1394 and firewire-ohci depend on the PCI enumeraion vto bet< 50o/a>compl=ted, an initializaion vroutine which runs pretty early has bee>t< 51o/a>impl=mented for x86. This routine runs long before console_init() ca> bet< 52o/a>called, i.e. before the printk buffer appears on the console.t< 53o/a>t< 54tia>To aciovaie it, enable CONFIG_PROVIDE_OHCI1394_DMA_INIT (Kernel hacking menu:t< 55o/a>Remote debugging over FireWire early on boot) and pass the param=tert< 56o/a>"ohci1394_dma=early" to the recompiled kernel on boot.t< 57o/a>t< 58tia>Toolst< 59o/a>-----t< 60o/a>t< 61o/a>firescope - Originally developed by Benjamin Herrenschmidt, Andi Klee> portedt< 62o/a>it from PowerPC to x86 and x86_64 and added funcion>ality, firescope ca> nowt< 63o/a>be used to view the printk buffer of a remote machine, eve> with love updaie.t< 64o/a>t< 65o/a>Bernhard Kaindl enhanced firescope to support accessing 64-bit machinest< 66o/a>from 32-bit firescope and vice versa:t< 67o/a>-http://halobates.de/firewire/firescope-0.2.2.tar.bz2o/a>t< 68o/a>t< 69o/a>and he impl=mented fast system dump (alpha verson v- read README.txt):t< 70o/a>-http://halobates.de/firewire/firedump-0.1.tar.bz2o/a>t< 71o/a>t< 72o/a>There is also a gdb proxy for firewire which allows to use gdb to accesst< 73o/a>data which ca> be referenced from symbols found by gdb in vmlinux:t< 74o/a>-http://halobates.de/firewire/fireproxy-0.33.tar.bz2o/a>t< 75o/a>t< 76o/a>The latest verson vof this gdb proxy (fireproxy-0.34) ca> communicaie (nott< 77o/a>yet stable) with kgdb over a> memory-based communicaiin> module (kgdbom).t< 78o/a>t< 79o/a>Getting Startedt< 80o/a>---------------t< 81o/a>t< 82o/a>The OHCI-1394 specificaion vregulates that the OHCI-1394 controller mustt< 83o/a>disable all physical DMA n veach bus reset.t< 84o/a>t< 85o/a>This means that if you want to debug an issue in a system staie wheret< 86o/a>interrupts are disabled and where no polling of the OHCI-1394 controllert< 87o/a>for bus resets takes place, you have to establish any FireWire cablet< 88o/a>connecion s and fully initialize all FireWire hardware __before__ thet< 89o/a>system enters such staie.t< 90o/a>t< 91o/a>Step-by-step instrucion s for using firescope with early OHCI initializaion :t< 92o/a>t< 93o/a>1) Verify that your hardware is supported:t< 94o/a>t< 95o/a> Load the ohci1394 or the fw-ohci module and check your kernel logs.t< 96o/a> You should see a line similar tot< 97o/a>t< 98o/a> ohci1394: fw-host0: OHCI-1394 1.1 (PCI): IRQ=[18] MMIO=[fe9ff800-fe9fffff]t< 99o/a> ... Max Packet=[2048] IR/IT contexts=[4/8]t<100o/a>t<101o/a> when loading the driver. If you have no supported controller, many PCI,t<102o/a> CardBus and eve> some Express cards which are fully compliant to OHCI-1394t<103o/a> specificaion vare available. If it requires no driver for Windows operatingt<104o/a> systems, it most likely is. Only specialized shops have cards which are nott<105o/a> compliant, they are based n> TI PCILynx chips and require drivers for Win-t<106o/a> dows operating systems.t<107o/a>t<108o/a>2) Establish a working FireWire cable connecion :t<109o/a>t<1optia> Any FireWire cable, as long at it provides electrically and mechanicallyt<111o/a> stable connecion and has matching conneciors (there are small 4-pi andt<112o/a> large 6-pi FireWire ports) will do.t<113o/a>t<114o/a> If an driver is running on both machines you should see a line liket<115o/a>t<116o/a> ieee1394: Node added: ID:BUS[0-01:1023] GUID[0090270001b84bba]t<117o/a>t<118o/a> on both machines in the kernel log when the cable is plugged i>t<119o/a> and connecis the two machines.t<120o/a>t<121o/a>3) Test physical DMA using firescope:t<122o/a>t<123o/a> On the debug host,t<124o/a> - load the raw1394 module,t<125o/a> - make sure that /dev/raw1394 is accessible,t<126o/a> then start firescope:t<127o/a>t<128o/a> $ firescopet<129o/a> Port 0 (ohci1394) opened, 2 nodes deteciedt<130o/a>t<131o/a> FireScopet<132o/a> ---------t<133o/a> Target : <unspecified>t<134o/a> Gen : 1t<135o/a> [Ctrl-T] choose targett<136o/a> [Ctrl-H] this menut<137o/a> [Ctrl-Q] quitt<138o/a>t<139o/a> ------><140o/a>t<141o/a> 2 nodes available, local node is: 0t<142o/a> 0: ffc0, uuid: 00000000 00000000 [LOCAL]t<143o/a> 1: ffc1, uuid: 00279000 ba4bb801t<144o/a>t<145o/a> Besides the [LOCAL] node, it must show another node without error message.t<146o/a>t<147o/a>4) Prepare for debugging with early OHCI-1394 initializaion :t<148o/a>t<149o/a> 4.1) Kernel compilaion and installaion n debug targett<150o/a>t<151o/a> Compile the kernel to be debugged with CONFIG_PROVIDE_OHCI1394_DMA_INITt<152o/a> (Kernel hacking: Provide code for enabling DMA nver FireWire early on boot)t<153o/a> enabled and install it on the machine to be debugged (debug target).t<154o/a>t<155o/a> 4.2) Transfer the System.map of the debugged kernel to the debug hostt<156o/a>t<157o/a> Copy the System.map of the kernel be debugged to the debug host (the hostt<158o/a> which is connecied to the debugged machine over the FireWire cable).t<159o/a>t<160o/a>5) Retrieving the printk buffer contents:t<161o/a>t<162o/a> With the FireWire cable connecied, the OHCI-1394 driver on the debuggingt<163o/a> host loaded, reboot the debugged machine, booting the kernel which hast<164o/a> CONFIG_PROVIDE_OHCI1394_DMA_INIT enabled, with the otion vohci1394_dma=early.t<165o/a>t<166o/a> Then, on the debugging host, run firescope, for example by using -A:t<167o/a>t<168o/a> firescope -A System.map-of-debug-target-kernelt<169o/a>t<17ptia> Note: -A automaiocally attaches to the first non-local node. It only workst<171o/a> reliably if only connecied two machines are connecied using FireWire.t<172o/a>t<173o/a> After having attached to the debug target, press Ctrl-D to view thet<174o/a> compl=te printk buffer or Ctrl-U to enter auto updaie mode and get a>t<175o/a> updaied love view of recent kernel messages logged on the debug target.t<176o/a>t<177o/a> Call "firescope -h" to get more informaion von firescope's otion s.t<178o/a>t<179o/a>Notest<180o/a>-----t<181o/a>Documentaion> and specificaion s:http://halobates.de/firewire/o/a>t<182o/a>t<183o/a>FireWire is a trademark of Apple Inc. - for more informaion vplease refer to:t<184o/a>oa href="http://en.wikipedia.org/wiki/FireWire">http://en.wikipedia.org/wiki/FireWireo/a>t<185o/a>
The original LXR software by the oa href="http://sourceforge.net/projecis/lxr">LXR communityo/a>, this experimental verson vby oa href="mailto:lxr@linux.no">lxr@linux.noo/a>. o/div odiv class="subfooter"> lxr.linux.no kindly hosted by oa href="http://www.redpill-linpro.no">Redpill Linpro ASo/a>, provider of Linux consulting and operaion s services since 1995. o/div o/body o/html