Discussion:
[9fans] usb mouse not working
(too old to reply)
erik quanstrom
2012-01-04 17:21:30 UTC
Permalink
i have a ehci-only system that seems to be recogizing the mouse, but
the mouse doesn't work. one thing that stands out is that the "online"
light in the scroll button doesn't light. i seem to have the kbd process running,

p=(Proc)0x56798 pid 92 Running
t=(Thread)0x57138 Running /sys/src/cmd/usb/kb/kb.c:554 kbdwork
pread()+0x7 /sys/src/libc/9syscall/pread.s:5
read(fd=0xe,buf=0x673e7,n=0x8)+0x2f /sys/src/libc/9sys/read.c:7
kbdwork(a=0x4e0f8)+0x107 /sys/src/cmd/usb/kb/kb.c:554
launcher386(arg=0x4e0f8,f=0x9129)+0x10 /sys/src/libthread/386.c:10
0xfefefefe ?file?:0


p=(Proc)0x57498 pid 93 Sched
t=(Thread)0x57e38 Rendez /sys/src/cmd/usb/kb/kb.c:435 repeatproc
recvul(c=0x57458)+0x2c /sys/src/libthread/channel.c:380
repeatproc(a=0x4e0f8)+0x56 /sys/src/cmd/usb/kb/kb.c:435
launcher386(arg=0x4e0f8,f=0x8c8b)+0x10 /sys/src/libthread/386.c:10
0xfefefefe ?file?:0


p=(Proc)0x57fd8 pid 94 Running
t=(Thread)0x58978 Running /sys/src/cmd/usb/kb/kb.c:341 ptrwork
pread()+0x7 /sys/src/libc/9syscall/pread.s:5
read(fd=0x11,buf=0x77488,n=0x8)+0x2f /sys/src/libc/9sys/read.c:7
ptrwork(a=0x571d8)+0xb7 /sys/src/cmd/usb/kb/kb.c:341
launcher386(arg=0x571d8,f=0x8843)+0x10 /sys/src/libthread/386.c:10
0xfefefefe ?file?:0

usb debug output looks like this

usb/usbd: hub 0x5ee48 /dev/usb/ep3.0 port 1: <nildev>
usb/usbd: hub 0x5ee48 /dev/usb/ep3.0 port 2: /dev/usb/ep4.0 1 refs
usb/usbd: hub 0x5ee48 /dev/usb/ep3.0 port 3: <nildev>
usb/usbd: hub 0x5ee48 /dev/usb/ep3.0 port 4: <nildev>
usb/usbd: hub 0x5ee48 /dev/usb/ep3.0 port 5: <nildev>
usb/usbd: hub 0x5ee48 /dev/usb/ep3.0 port 6: <nildev>
usb/usbd: hub 0x5e5e8 /dev/usb/ep2.0 port 1: <nildev>
usb/usbd: hub 0x5e5e8 /dev/usb/ep2.0 port 2: <nildev>
usb/usbd: hub 0x5e668 /dev/usb/ep1.0 port 1: /dev/usb/ep3.0 csp hub.0.1 vid 0x8087 did 0x24 refs 2
none <nil> <nil>
conf: cval 1 attrib e0 0 mA
iface csp hub.0.0
alt 0 attr 3 ival 12
ep id 1 addr 129 dir in type intr itype 0 maxpkt 1 ntds 1
usb/usbd: hub 0x5e668 /dev/usb/ep1.0 port 2: <nildev>
usb/usbd: fs list: (1 used 2 total)
usb/usbd: usbdctl

; grep usb /dev/irqalloc
97 11 123521 794000276 ioapic usbehci
105 5 0 0 ioapic usbehci

; pci -v
0.0.0: brg 06.00.00 8086/0108 0
Intel Corporation Xeon E3-1200 Processor Family DRAM Controller
0.1.0: brg 06.04.00 8086/0101 11
Intel Corporation Xeon E3-1200/2nd Generation Core Processor Family PCI Express Root Port
0.25.0: net 02.00.00 8086/1502 7 0:fbb00000 131072 1:fbb24000 4096 2:0000f021 32
Intel Corporation 82579LM Gigabit Network Connection
0.26.0: usb 0c.03.20 8086/1c2d 11 0:fbb23000 1024
Intel Corporation 6 Series Chipset Family USB Enhanced Host Controller #2
0.28.0: brg 06.04.00 8086/1c10 5
Intel Corporation 6 Series Chipset Family PCI Express Root Port 1
0.28.4: brg 06.04.00 8086/1c18 5
Intel Corporation 6 Series Chipset Family PCI Express Root Port 5
0.29.0: usb 0c.03.20 8086/1c26 5 0:fbb22000 1024
Intel Corporation 6 Series Chipset Family USB Enhanced Host Controller #1
0.30.0: brg 06.04.01 8086/244e 255
Intel Corporation 82801 PCI Bridge
0.31.0: brg 06.01.00 8086/1c54 0
Intel Corporation C204 Chipset Family LPC Controller
0.31.2: disk 01.06.01 8086/1c02 11 0:0000f071 16 1:0000f061 16 2:0000f051 16 3:0000f041 16 4:0000f001 32 5:fbb21000 2048
Intel Corporation 6 Series Chipset Family 6 port SATA AHCI Controller
0.31.3: smb 0c.05.00 8086/1c22 11 0:fbb20004 256 1:00000000 16 4:00001181 32
Intel Corporation 6 Series Chipset Family SMBus Controller
1.0.0: disk 01.00.00 11ab/6485 11 2:0000e001 128 4:fba40004 65536 5:00000000 16
Marvell Technology Group Ltd. MV64460/64461/64462 System Controller, Revision B
3.0.0: net 02.00.00 8086/10d3 11 0:fb900000 131072 2:0000d001 32 3:fb920000 16384
Intel Corporation 82574L Gigabit Network Connection
4.3.0: vid 03.00.00 102b/0532 5 0:fa000008 16777216 1:fb800000 16384 2:fb000000 8388608
Matrox Graphics, Inc. MGA G200eW WPCM450

- erik
erik quanstrom
2012-01-04 21:01:22 UTC
Permalink
a bit of an update, disabling one of the usb ehci devies "fixed" things
but i get a number of errors and warnings from epiowait() with this
format: "ehci %#p: io %#p qh %#p timed out (no intr?)\n".
things are not right, but at least the machine is working as a terminal.

i added some general code to disable arbitrary ehci devices.
also, i noticed that there's a smalloc() that really can't be counted
on as we're holding an ilock. i'd rather panic on nil indirection
than just hang.

- erik

----

; 9diff usbehcipc.c
post...
/n/sources/plan9//sys/src/9/pc/usbehcipc.c:142,179 - usbehcipc.c:142,192
iunlock(ctlr);
}

+ static int
+ checkdev(Pcidev *p)
+ {
+ char *conf, *s, dev[32];
+
+ conf = getconf("*badehci");
+ if(conf == nil)
+ return 0;
+ snprint(dev, sizeof dev, "%.4ux/%.4ux", p->vid, p->did);
+
+ s = strstr(conf, dev);
+ if(s != nil && (s[9] == 0 || s[9] == ' '))
+ return -1;
+ return 0;
+ }
+
static void
scanpci(void)
{
- static int already = 0;
int i;
ulong io;
Ctlr *ctlr;
Pcidev *p;
Ecapio *capio;
+ static int already;

if(already)
return;
already = 1;
- p = nil;
- while ((p = pcimatch(p, 0, 0)) != nil) {
+ i = 0;
+ for(p = nil; (p = pcimatch(p, 0, 0)) != nil; ) {
/*
* Find EHCI controllers (Programming Interface = 0x20).
*/
- if(p->ccrb != Pcibcserial || p->ccru != Pciscusb)
+ if(p->ccrb != Pcibcserial || p->ccru != Pciscusb || p->ccrp != 0x20)
continue;
- switch(p->ccrp){
- case 0x20:
- io = p->mem[0].bar & ~0x0f;
- break;
- default:
+ if(i == Nhcis){
+ print("ehci: bug: more than %d controllers\n", Nhcis);
continue;
}
- if(0 && p->vid == Vintel && p->did == 0x3b34) {
- print("usbehci: ignoring known bad ctlr %#ux/%#ux\n",
- p->vid, p->did);
+ if(checkdev(p) == -1){
+ print("usbehci: ignore %.4ux/%.4ux\n", p->vid, p->did);
continue;
}
+ io = p->mem[0].bar & ~0x0f;
if(io == 0){
print("usbehci: %x %x: failed to map registers\n",
p->vid, p->did);
/n/sources/plan9//sys/src/9/pc/usbehcipc.c:186,204 - usbehcipc.c:199,210
dprint("usbehci: %#x %#x: port %#lux size %#x irq %d\n",
p->vid, p->did, io, p->mem[0].size, p->intl);

- ctlr = smalloc(sizeof(Ctlr));
+ ctlr = malloc(sizeof(Ctlr));
ctlr->pcidev = p;
capio = ctlr->capio = vmap(io, p->mem[0].size);
ctlr->opio = (Eopio*)((uintptr)capio + (capio->cap & 0xff));
pcisetbme(p);
pcisetpms(p, 0);
- for(i = 0; i < Nhcis; i++)
- if(ctlrs[i] == nil){
- ctlrs[i] = ctlr;
- break;
- }
- if(i >= Nhcis)
- print("ehci: bug: more than %d controllers\n", Nhcis);

/*
* currently, if we enable a second ehci controller on zt
/n/sources/plan9//sys/src/9/pc/usbehcipc.c:208,215 - usbehcipc.c:214,225
if (i >= maxehci) {
print("usbehci: ignoring controllers after first %d, "
"at %#p\n", maxehci, io);
- ctlrs[i] = nil;
+ pciclrbme(p);
+ vunmap(capio, p->mem[0].size);
+ free(ctlr);
+ continue;
}
+ ctlrs[i++] = ctlr;
}
}

Continue reading on narkive:
Loading...