1 /* uio_usbdebug - Run coreboot's usbdebug driver in userspace */
2 /* SPDX-License-Identifier: GPL-2.0-only */
12 /* coreboot's arch/io.h conflicts with libc's sys/io.h, so declare this here: */
13 int ioperm(unsigned long from
, unsigned long num
, int turn_on
);
16 #include <console/usb.h>
19 struct pci_access
*pci_access
;
21 int main(int argc
, char *argv
[])
24 fprintf(stderr
, "Usage: %s <uio-dev>\n", argv
[0]);
27 const int fd
= open(argv
[1], O_RDWR
);
29 perror("Failed to open uio device");
33 mmap(NULL
, 1 << 8, PROT_READ
| PROT_WRITE
, MAP_SHARED
, fd
, 0);
34 if (MAP_FAILED
== ehci_bar
) {
35 perror("Failed to map ehci bar");
42 pci_access
= pci_alloc();
47 pci_cleanup(pci_access
);
48 munmap(ehci_bar
, 1 << 8);