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