1 2uio_usbdebug - Run coreboot's usbdebug driver in userspace 3========================================================== 4 5 6## Purpose 7 8uio_usbdebug enables you to debug coreboot's usbdebug driver inside a 9running operating system (only Linux at this time). This comes very 10handy if you're hacking the usbdebug driver and don't have any other 11debug output from coreboot itself. 12 13 14## State 15 16Currently only Intel chipsets are supported. Support for other chipsets 17should be straightforward (normally just some port-enable code has to 18be implemented). 19 20The Linux kernel driver (see linux/uio_ehci_pci.c) has only one PCI ID 21hardcoded (for ICH7). The whole setup has been developed and tested on 22a ThinkPad T60. 23 24### Files 25 26uio_usbdebug.c - The userspace part of the uio interface. 27 28uio_usbdebug_intel.c - Port enable code for Intel chipsets. 29 30linux/uio_ehci_pci.c - Kernel part of the uio interface. 31 32console/printk.c - A printk() implementation so you can see debug 33 output with CONFIG_DEBUG_USBDEBUG enabled. 34 35device/*.c lib/*.c - Some stubs for (hopefully) unneeded functions for 36 proper linking. 37 38 39## Usage 40 41### Preparations 42 43The MMIO space has to be a whole 4K page in size and alignment to be 44mapped into userspace. This is very uncommon, so you'll most probably 45have to remap the MMIO space. The Linux kernel does that for you with 46the `pci=resource_alignment=<pci address>` kernel parameter (e.g. 47`pci=resource_alignment=0:1d.7` for ICH7). 48 49If your PCI device isn't listed in the kernel driver yet, you might want 50to add it to the `ehci_pci_ids` table in `linux/uio_ehci_pci.c` (or do 51some module alias magic if you know how to). 52 53### Build / Install 54 55Somehow like this: 56 57$ # Configure coreboot for your board and enable CONFIG_USBDEBUG 58$ make menuconfig 59$ cd util/uio_usbdebug/ 60$ make -Clinux/ 61$ sudo make -Clinux/ install 62$ make 63 64### Run 65 66$ # Unload Linux' EHCI driver (high-speed devices will stop working) 67$ sudo modprobe -r ehci-pci 68$ # Load the uio driver 69$ sudo modprobe uio-ehci-pci 70$ # Find your uio device 71$ ls /sys/module/uio_ehci_pci/drivers/*/*/uio/ 72uio0 73$ # Run uio_usbdebug on this device 74$ sudo ./uio_usbdebug /dev/uio0 75 76Sadly, uio_usbdebug has to be run with root privileges since there are 77port-80 writes in the usbdebug driver. 78