Browse Source

Plan 9 from Bell Labs 2006-12-09

David du Colombier 17 years ago
parent
commit
fb4580b39e

+ 24 - 24
dist/replica/_plan9.db

@@ -1279,7 +1279,7 @@ lib/face/48x48x2/x - 20000000775 sys sys 1020895710 0
 lib/face/48x48x2/y - 20000000775 sys sys 1020895710 0
 lib/face/48x48x2/z - 20000000775 sys sys 1020895710 0
 lib/face/48x48x4 - 20000000775 sys sys 944941894 0
-lib/face/48x48x4/.dict - 664 sys sys 1161059931 3416
+lib/face/48x48x4/.dict - 664 sys sys 1165561735 3448
 lib/face/48x48x4/Z - 20000000775 sys sys 944945342 0
 lib/face/48x48x4/a - 20000000775 sys sys 944945701 0
 lib/face/48x48x4/a/adb.1 - 664 sys sys 944941890 962
@@ -7304,7 +7304,7 @@ sys/man/1/echo - 664 sys sys 1079969656 430
 sys/man/1/ed - 664 sys sys 961259286 13916
 sys/man/1/emacs - 664 sys sys 944959673 199
 sys/man/1/eqn - 664 sys sys 1134592617 5655
-sys/man/1/expect - 664 sys sys 1141913757 3018
+sys/man/1/expect - 664 sys sys 1165622338 3018
 sys/man/1/faces - 664 sys sys 1113743326 2395
 sys/man/1/factor - 664 sys sys 1135084026 1015
 sys/man/1/file - 664 sys sys 1157143697 1481
@@ -7336,8 +7336,8 @@ sys/man/1/look - 664 sys sys 1113743326 1357
 sys/man/1/lp - 664 sys sys 1113743326 3329
 sys/man/1/ls - 664 sys sys 1113743327 2890
 sys/man/1/mail - 664 sys sys 1050078464 2158
-sys/man/1/man - 664 sys sys 1138555093 2006
-sys/man/1/marshal - 664 sys sys 1079970326 3150
+sys/man/1/man - 664 sys sys 1165622295 2006
+sys/man/1/marshal - 664 sys sys 1165622300 3149
 sys/man/1/mc - 664 sys sys 1113743326 552
 sys/man/1/mk - 664 sys sys 1113743328 13198
 sys/man/1/mkdir - 664 sys sys 1082593141 717
@@ -7388,7 +7388,7 @@ sys/man/1/strip - 664 sys sys 1131293239 523
 sys/man/1/sum - 664 sys sys 984772442 1390
 sys/man/1/syscall - 664 sys sys 1016466457 1439
 sys/man/1/tail - 664 sys sys 1113743327 1413
-sys/man/1/tar - 664 sys sys 1131884436 3439
+sys/man/1/tar - 664 sys sys 1165622307 3439
 sys/man/1/tbl - 664 sys sys 944959674 4308
 sys/man/1/tcs - 664 sys sys 1143131200 2654
 sys/man/1/tee - 664 sys sys 969499886 351
@@ -7411,14 +7411,14 @@ sys/man/1/vnc - 664 sys sys 1158063994 4313
 sys/man/1/vt - 664 sys sys 1133880370 2256
 sys/man/1/wc - 664 sys sys 1113743327 908
 sys/man/1/who - 664 sys sys 944959674 332
-sys/man/1/winwatch - 664 sys sys 1159419872 724
+sys/man/1/winwatch - 664 sys sys 1165622316 708
 sys/man/1/xd - 664 sys sys 944959674 1517
 sys/man/1/yacc - 664 sys sys 944959676 3273
 sys/man/1/yesterday - 664 sys sys 1148760984 2640
 sys/man/2 - 20000000775 sys sys 1017423721 0
 sys/man/2/0intro - 664 sys sys 1115941566 11660
 sys/man/2/9p - 664 sys sys 1150036738 15887
-sys/man/2/9pcmdbuf - 664 sys sys 1044430197 2057
+sys/man/2/9pcmdbuf - 664 sys sys 1165622380 2076
 sys/man/2/9pfid - 664 sys sys 1106072437 3663
 sys/man/2/9pfile - 664 sys sys 1048637158 4408
 sys/man/2/INDEX - 664 sys sys 1141357442 20441
@@ -7455,7 +7455,7 @@ sys/man/2/dial - 664 sys sys 1108158522 6594
 sys/man/2/dirread - 664 sys sys 1015091519 1901
 sys/man/2/disk - 664 sys sys 1015091519 3188
 sys/man/2/draw - 664 sys sys 1059484405 19362
-sys/man/2/dsa - 664 sys sys 1027629169 2072
+sys/man/2/dsa - 664 sys sys 1165622511 2091
 sys/man/2/dup - 664 sys sys 950593489 827
 sys/man/2/elgamal - 664 sys sys 1027629189 2152
 sys/man/2/encode - 664 sys sys 1071289168 1572
@@ -7518,7 +7518,7 @@ sys/man/2/pipe - 664 sys sys 950892864 1587
 sys/man/2/plumb - 664 sys sys 1015091524 4816
 sys/man/2/pool - 664 sys sys 1162102403 8574
 sys/man/2/postnote - 664 sys sys 944959695 790
-sys/man/2/prime - 664 sys sys 1063855709 1962
+sys/man/2/prime - 664 sys sys 1165622556 1961
 sys/man/2/print - 664 sys sys 1115941566 8852
 sys/man/2/privalloc - 664 sys sys 984709633 651
 sys/man/2/proto - 664 sys sys 969499889 2948
@@ -7536,7 +7536,7 @@ sys/man/2/readv - 664 sys sys 1017423721 1454
 sys/man/2/regexp - 664 sys sys 988225293 3548
 sys/man/2/remove - 664 sys sys 958249504 518
 sys/man/2/rendezvous - 664 sys sys 1135487949 1322
-sys/man/2/rsa - 664 sys sys 1087829658 4245
+sys/man/2/rsa - 664 sys sys 1165622556 4260
 sys/man/2/rune - 664 sys sys 1143079849 3086
 sys/man/2/runestrcat - 664 sys sys 969499889 1086
 sys/man/2/scribble - 664 sys sys 985638584 3847
@@ -7544,7 +7544,7 @@ sys/man/2/scsi - 664 sys sys 969499889 3171
 sys/man/2/sechash - 664 sys sys 1046042040 3016
 sys/man/2/seek - 664 sys sys 944959696 671
 sys/man/2/segattach - 664 sys sys 1135487945 4166
-sys/man/2/segbrk - 664 sys sys 1135487945 1195
+sys/man/2/segbrk - 664 sys sys 1165622575 1211
 sys/man/2/segflush - 664 sys sys 944959695 944
 sys/man/2/semacquire - 664 sys sys 1143134715 1865
 sys/man/2/setjmp - 664 sys sys 1144424826 1863
@@ -7576,7 +7576,7 @@ sys/man/3/dup - 664 sys sys 1015024778 1099
 sys/man/3/env - 664 sys sys 1015024778 1409
 sys/man/3/ether - 664 sys sys 984709635 2563
 sys/man/3/floppy - 664 sys sys 954378905 881
-sys/man/3/fs - 664 sys sys 1133880474 2702
+sys/man/3/fs - 664 sys sys 1165622643 2702
 sys/man/3/i82365 - 664 sys sys 954378906 884
 sys/man/3/ip - 664 sys sys 1163208517 21559
 sys/man/3/kbmap - 664 sys sys 1131110122 1732
@@ -7612,11 +7612,11 @@ sys/man/4/execnet - 664 sys sys 1019866708 1069
 sys/man/4/exportfs - 664 sys sys 1145881912 4655
 sys/man/4/ext2srv - 664 sys sys 1055692986 2409
 sys/man/4/factotum - 664 sys sys 1131294573 14841
-sys/man/4/fossil - 664 sys sys 1164860933 9587
+sys/man/4/fossil - 664 sys sys 1165622806 9590
 sys/man/4/fs - 664 sys sys 1019058716 3387
 sys/man/4/ftpfs - 664 sys sys 1112563349 4410
 sys/man/4/httpfile - 664 sys sys 1128556957 1233
-sys/man/4/import - 664 sys sys 1133180700 3202
+sys/man/4/import - 664 sys sys 1165622806 3202
 sys/man/4/iostats - 664 sys sys 1105574383 1621
 sys/man/4/keyfs - 664 sys sys 1116594919 5048
 sys/man/4/kfs - 664 sys sys 1102088374 2164
@@ -7664,7 +7664,7 @@ sys/man/6/INDEX - 664 sys sys 1141357442 485
 sys/man/6/INDEX.html - 664 sys sys 1141352366 3298
 sys/man/6/a.out - 664 sys sys 1015024888 7155
 sys/man/6/ar - 664 sys sys 944959678 2092
-sys/man/6/authsrv - 664 sys sys 1128483124 13304
+sys/man/6/authsrv - 664 sys sys 1165622854 13320
 sys/man/6/color - 664 sys sys 988225304 5181
 sys/man/6/face - 664 sys sys 1062505426 2846
 sys/man/6/font - 664 sys sys 1077594184 2528
@@ -7697,7 +7697,7 @@ sys/man/7/INDEX - 664 sys sys 1104811679 111
 sys/man/7/INDEX.html - 664 sys sys 1104736386 918
 sys/man/7/astro - 664 sys sys 964455064 2454
 sys/man/7/dict - 664 sys sys 944959678 3438
-sys/man/7/juke - 664 sys sys 1159419718 7769
+sys/man/7/juke - 664 sys sys 1165622887 7768
 sys/man/7/map - 664 sys sys 1032632790 13549
 sys/man/7/playlistfs - 664 sys sys 1103794042 3831
 sys/man/7/scat - 664 sys sys 970069855 8904
@@ -7711,7 +7711,7 @@ sys/man/8/aan - 664 sys sys 1045501064 1670
 sys/man/8/aliasmail - 664 sys sys 1055701148 1353
 sys/man/8/apm - 664 sys sys 1017679308 1811
 sys/man/8/auth - 664 sys sys 1163208463 4227
-sys/man/8/boot - 664 sys sys 1163208457 8362
+sys/man/8/boot - 664 sys sys 1165623055 8357
 sys/man/8/booting - 664 sys sys 1015024984 4136
 sys/man/8/cpurc - 664 sys sys 971455510 1275
 sys/man/8/cron - 664 sys sys 1063858596 1867
@@ -7722,8 +7722,8 @@ sys/man/8/fossilcons - 664 sys sys 1155362671 18291
 sys/man/8/fs - 664 sys sys 1055701170 15029
 sys/man/8/fsconfig - 664 sys sys 1142906116 8281
 sys/man/8/getflags - 664 sys sys 1159419702 1713
-sys/man/8/gpsfs - 664 sys sys 1123643451 4924
-sys/man/8/httpd - 664 sys sys 1142795704 6866
+sys/man/8/gpsfs - 664 sys sys 1165623047 4918
+sys/man/8/httpd - 664 sys sys 1165623004 6865
 sys/man/8/init - 664 sys sys 944959679 1430
 sys/man/8/ipconfig - 664 sys sys 1159419702 6170
 sys/man/8/ipserv - 664 sys sys 1095862383 4375
@@ -7762,7 +7762,7 @@ sys/man/8/statusbar - 664 sys sys 1159419702 1254
 sys/man/8/stub - 664 sys sys 1044830500 943
 sys/man/8/swap - 664 sys sys 1158604825 886
 sys/man/8/timesync - 664 sys sys 1145882352 1717
-sys/man/8/tlssrv - 664 sys sys 1159419702 2590
+sys/man/8/tlssrv - 664 sys sys 1165623041 2589
 sys/man/8/trampoline - 664 sys sys 1126104844 1199
 sys/man/8/udpecho - 664 sys sys 954305553 303
 sys/man/8/update - 664 sys sys 961259288 2336
@@ -7968,7 +7968,7 @@ sys/src/9/pc/devlpt.c - 664 sys sys 1015014514 4420
 sys/src/9/pc/devpccard.c - 664 sys sys 1162222267 39301
 sys/src/9/pc/devrtc.c - 664 sys sys 1015014515 7167
 sys/src/9/pc/devtv.c - 664 sys sys 1131290299 45676
-sys/src/9/pc/devusb.c - 664 sys sys 1105193103 18364
+sys/src/9/pc/devusb.c - 664 sys sys 1165555433 18791
 sys/src/9/pc/devvga.c - 664 sys sys 1131290315 9332
 sys/src/9/pc/dma.c - 664 sys sys 1142966373 5332
 sys/src/9/pc/ether2000.c - 664 sys sys 1089299187 4819
@@ -8005,7 +8005,7 @@ sys/src/9/pc/i8253.c - 664 sys sys 1139681387 6236
 sys/src/9/pc/i8259.c - 664 sys sys 1131290399 4586
 sys/src/9/pc/init9.c - 664 sys sys 1040002518 94
 sys/src/9/pc/initcode.s - 664 sys sys 1015014519 282
-sys/src/9/pc/io.h - 664 sys sys 1099761152 8095
+sys/src/9/pc/io.h - 664 sys sys 1165555523 9406
 sys/src/9/pc/kbd.c - 664 sys sys 1132574883 12365
 sys/src/9/pc/l.s - 664 sys sys 1143129925 28552
 sys/src/9/pc/main.c - 664 sys sys 1162952105 15321
@@ -8049,8 +8049,8 @@ sys/src/9/pc/uartaxp.c - 664 sys sys 1158803840 18862
 sys/src/9/pc/uarti8250.c - 664 sys sys 1102820421 13958
 sys/src/9/pc/uartisa.c - 664 sys sys 1127126907 1777
 sys/src/9/pc/uartpci.c - 664 sys sys 1162859151 3617
-sys/src/9/pc/usb.h - 664 sys sys 1099760881 3650
-sys/src/9/pc/usbuhci.c - 664 sys sys 1154725785 30910
+sys/src/9/pc/usb.h - 664 sys sys 1165555430 4257
+sys/src/9/pc/usbuhci.c - 664 sys sys 1165555497 31000
 sys/src/9/pc/vga.c - 664 sys sys 1131290595 5148
 sys/src/9/pc/vga3dfx.c - 664 sys sys 1133218367 3833
 sys/src/9/pc/vgaark2000pv.c - 664 sys sys 1131290600 3422

+ 24 - 24
dist/replica/plan9.db

@@ -1279,7 +1279,7 @@ lib/face/48x48x2/x - 20000000775 sys sys 1020895710 0
 lib/face/48x48x2/y - 20000000775 sys sys 1020895710 0
 lib/face/48x48x2/z - 20000000775 sys sys 1020895710 0
 lib/face/48x48x4 - 20000000775 sys sys 944941894 0
-lib/face/48x48x4/.dict - 664 sys sys 1161059931 3416
+lib/face/48x48x4/.dict - 664 sys sys 1165561735 3448
 lib/face/48x48x4/Z - 20000000775 sys sys 944945342 0
 lib/face/48x48x4/a - 20000000775 sys sys 944945701 0
 lib/face/48x48x4/a/adb.1 - 664 sys sys 944941890 962
@@ -7304,7 +7304,7 @@ sys/man/1/echo - 664 sys sys 1079969656 430
 sys/man/1/ed - 664 sys sys 961259286 13916
 sys/man/1/emacs - 664 sys sys 944959673 199
 sys/man/1/eqn - 664 sys sys 1134592617 5655
-sys/man/1/expect - 664 sys sys 1141913757 3018
+sys/man/1/expect - 664 sys sys 1165622338 3018
 sys/man/1/faces - 664 sys sys 1113743326 2395
 sys/man/1/factor - 664 sys sys 1135084026 1015
 sys/man/1/file - 664 sys sys 1157143697 1481
@@ -7336,8 +7336,8 @@ sys/man/1/look - 664 sys sys 1113743326 1357
 sys/man/1/lp - 664 sys sys 1113743326 3329
 sys/man/1/ls - 664 sys sys 1113743327 2890
 sys/man/1/mail - 664 sys sys 1050078464 2158
-sys/man/1/man - 664 sys sys 1138555093 2006
-sys/man/1/marshal - 664 sys sys 1079970326 3150
+sys/man/1/man - 664 sys sys 1165622295 2006
+sys/man/1/marshal - 664 sys sys 1165622300 3149
 sys/man/1/mc - 664 sys sys 1113743326 552
 sys/man/1/mk - 664 sys sys 1113743328 13198
 sys/man/1/mkdir - 664 sys sys 1082593141 717
@@ -7388,7 +7388,7 @@ sys/man/1/strip - 664 sys sys 1131293239 523
 sys/man/1/sum - 664 sys sys 984772442 1390
 sys/man/1/syscall - 664 sys sys 1016466457 1439
 sys/man/1/tail - 664 sys sys 1113743327 1413
-sys/man/1/tar - 664 sys sys 1131884436 3439
+sys/man/1/tar - 664 sys sys 1165622307 3439
 sys/man/1/tbl - 664 sys sys 944959674 4308
 sys/man/1/tcs - 664 sys sys 1143131200 2654
 sys/man/1/tee - 664 sys sys 969499886 351
@@ -7411,14 +7411,14 @@ sys/man/1/vnc - 664 sys sys 1158063994 4313
 sys/man/1/vt - 664 sys sys 1133880370 2256
 sys/man/1/wc - 664 sys sys 1113743327 908
 sys/man/1/who - 664 sys sys 944959674 332
-sys/man/1/winwatch - 664 sys sys 1159419872 724
+sys/man/1/winwatch - 664 sys sys 1165622316 708
 sys/man/1/xd - 664 sys sys 944959674 1517
 sys/man/1/yacc - 664 sys sys 944959676 3273
 sys/man/1/yesterday - 664 sys sys 1148760984 2640
 sys/man/2 - 20000000775 sys sys 1017423721 0
 sys/man/2/0intro - 664 sys sys 1115941566 11660
 sys/man/2/9p - 664 sys sys 1150036738 15887
-sys/man/2/9pcmdbuf - 664 sys sys 1044430197 2057
+sys/man/2/9pcmdbuf - 664 sys sys 1165622380 2076
 sys/man/2/9pfid - 664 sys sys 1106072437 3663
 sys/man/2/9pfile - 664 sys sys 1048637158 4408
 sys/man/2/INDEX - 664 sys sys 1141357442 20441
@@ -7455,7 +7455,7 @@ sys/man/2/dial - 664 sys sys 1108158522 6594
 sys/man/2/dirread - 664 sys sys 1015091519 1901
 sys/man/2/disk - 664 sys sys 1015091519 3188
 sys/man/2/draw - 664 sys sys 1059484405 19362
-sys/man/2/dsa - 664 sys sys 1027629169 2072
+sys/man/2/dsa - 664 sys sys 1165622511 2091
 sys/man/2/dup - 664 sys sys 950593489 827
 sys/man/2/elgamal - 664 sys sys 1027629189 2152
 sys/man/2/encode - 664 sys sys 1071289168 1572
@@ -7518,7 +7518,7 @@ sys/man/2/pipe - 664 sys sys 950892864 1587
 sys/man/2/plumb - 664 sys sys 1015091524 4816
 sys/man/2/pool - 664 sys sys 1162102403 8574
 sys/man/2/postnote - 664 sys sys 944959695 790
-sys/man/2/prime - 664 sys sys 1063855709 1962
+sys/man/2/prime - 664 sys sys 1165622556 1961
 sys/man/2/print - 664 sys sys 1115941566 8852
 sys/man/2/privalloc - 664 sys sys 984709633 651
 sys/man/2/proto - 664 sys sys 969499889 2948
@@ -7536,7 +7536,7 @@ sys/man/2/readv - 664 sys sys 1017423721 1454
 sys/man/2/regexp - 664 sys sys 988225293 3548
 sys/man/2/remove - 664 sys sys 958249504 518
 sys/man/2/rendezvous - 664 sys sys 1135487949 1322
-sys/man/2/rsa - 664 sys sys 1087829658 4245
+sys/man/2/rsa - 664 sys sys 1165622556 4260
 sys/man/2/rune - 664 sys sys 1143079849 3086
 sys/man/2/runestrcat - 664 sys sys 969499889 1086
 sys/man/2/scribble - 664 sys sys 985638584 3847
@@ -7544,7 +7544,7 @@ sys/man/2/scsi - 664 sys sys 969499889 3171
 sys/man/2/sechash - 664 sys sys 1046042040 3016
 sys/man/2/seek - 664 sys sys 944959696 671
 sys/man/2/segattach - 664 sys sys 1135487945 4166
-sys/man/2/segbrk - 664 sys sys 1135487945 1195
+sys/man/2/segbrk - 664 sys sys 1165622575 1211
 sys/man/2/segflush - 664 sys sys 944959695 944
 sys/man/2/semacquire - 664 sys sys 1143134715 1865
 sys/man/2/setjmp - 664 sys sys 1144424826 1863
@@ -7576,7 +7576,7 @@ sys/man/3/dup - 664 sys sys 1015024778 1099
 sys/man/3/env - 664 sys sys 1015024778 1409
 sys/man/3/ether - 664 sys sys 984709635 2563
 sys/man/3/floppy - 664 sys sys 954378905 881
-sys/man/3/fs - 664 sys sys 1133880474 2702
+sys/man/3/fs - 664 sys sys 1165622643 2702
 sys/man/3/i82365 - 664 sys sys 954378906 884
 sys/man/3/ip - 664 sys sys 1163208517 21559
 sys/man/3/kbmap - 664 sys sys 1131110122 1732
@@ -7612,11 +7612,11 @@ sys/man/4/execnet - 664 sys sys 1019866708 1069
 sys/man/4/exportfs - 664 sys sys 1145881912 4655
 sys/man/4/ext2srv - 664 sys sys 1055692986 2409
 sys/man/4/factotum - 664 sys sys 1131294573 14841
-sys/man/4/fossil - 664 sys sys 1164860933 9587
+sys/man/4/fossil - 664 sys sys 1165622806 9590
 sys/man/4/fs - 664 sys sys 1019058716 3387
 sys/man/4/ftpfs - 664 sys sys 1112563349 4410
 sys/man/4/httpfile - 664 sys sys 1128556957 1233
-sys/man/4/import - 664 sys sys 1133180700 3202
+sys/man/4/import - 664 sys sys 1165622806 3202
 sys/man/4/iostats - 664 sys sys 1105574383 1621
 sys/man/4/keyfs - 664 sys sys 1116594919 5048
 sys/man/4/kfs - 664 sys sys 1102088374 2164
@@ -7664,7 +7664,7 @@ sys/man/6/INDEX - 664 sys sys 1141357442 485
 sys/man/6/INDEX.html - 664 sys sys 1141352366 3298
 sys/man/6/a.out - 664 sys sys 1015024888 7155
 sys/man/6/ar - 664 sys sys 944959678 2092
-sys/man/6/authsrv - 664 sys sys 1128483124 13304
+sys/man/6/authsrv - 664 sys sys 1165622854 13320
 sys/man/6/color - 664 sys sys 988225304 5181
 sys/man/6/face - 664 sys sys 1062505426 2846
 sys/man/6/font - 664 sys sys 1077594184 2528
@@ -7697,7 +7697,7 @@ sys/man/7/INDEX - 664 sys sys 1104811679 111
 sys/man/7/INDEX.html - 664 sys sys 1104736386 918
 sys/man/7/astro - 664 sys sys 964455064 2454
 sys/man/7/dict - 664 sys sys 944959678 3438
-sys/man/7/juke - 664 sys sys 1159419718 7769
+sys/man/7/juke - 664 sys sys 1165622887 7768
 sys/man/7/map - 664 sys sys 1032632790 13549
 sys/man/7/playlistfs - 664 sys sys 1103794042 3831
 sys/man/7/scat - 664 sys sys 970069855 8904
@@ -7711,7 +7711,7 @@ sys/man/8/aan - 664 sys sys 1045501064 1670
 sys/man/8/aliasmail - 664 sys sys 1055701148 1353
 sys/man/8/apm - 664 sys sys 1017679308 1811
 sys/man/8/auth - 664 sys sys 1163208463 4227
-sys/man/8/boot - 664 sys sys 1163208457 8362
+sys/man/8/boot - 664 sys sys 1165623055 8357
 sys/man/8/booting - 664 sys sys 1015024984 4136
 sys/man/8/cpurc - 664 sys sys 971455510 1275
 sys/man/8/cron - 664 sys sys 1063858596 1867
@@ -7722,8 +7722,8 @@ sys/man/8/fossilcons - 664 sys sys 1155362671 18291
 sys/man/8/fs - 664 sys sys 1055701170 15029
 sys/man/8/fsconfig - 664 sys sys 1142906116 8281
 sys/man/8/getflags - 664 sys sys 1159419702 1713
-sys/man/8/gpsfs - 664 sys sys 1123643451 4924
-sys/man/8/httpd - 664 sys sys 1142795704 6866
+sys/man/8/gpsfs - 664 sys sys 1165623047 4918
+sys/man/8/httpd - 664 sys sys 1165623004 6865
 sys/man/8/init - 664 sys sys 944959679 1430
 sys/man/8/ipconfig - 664 sys sys 1159419702 6170
 sys/man/8/ipserv - 664 sys sys 1095862383 4375
@@ -7762,7 +7762,7 @@ sys/man/8/statusbar - 664 sys sys 1159419702 1254
 sys/man/8/stub - 664 sys sys 1044830500 943
 sys/man/8/swap - 664 sys sys 1158604825 886
 sys/man/8/timesync - 664 sys sys 1145882352 1717
-sys/man/8/tlssrv - 664 sys sys 1159419702 2590
+sys/man/8/tlssrv - 664 sys sys 1165623041 2589
 sys/man/8/trampoline - 664 sys sys 1126104844 1199
 sys/man/8/udpecho - 664 sys sys 954305553 303
 sys/man/8/update - 664 sys sys 961259288 2336
@@ -7968,7 +7968,7 @@ sys/src/9/pc/devlpt.c - 664 sys sys 1015014514 4420
 sys/src/9/pc/devpccard.c - 664 sys sys 1162222267 39301
 sys/src/9/pc/devrtc.c - 664 sys sys 1015014515 7167
 sys/src/9/pc/devtv.c - 664 sys sys 1131290299 45676
-sys/src/9/pc/devusb.c - 664 sys sys 1105193103 18364
+sys/src/9/pc/devusb.c - 664 sys sys 1165555433 18791
 sys/src/9/pc/devvga.c - 664 sys sys 1131290315 9332
 sys/src/9/pc/dma.c - 664 sys sys 1142966373 5332
 sys/src/9/pc/ether2000.c - 664 sys sys 1089299187 4819
@@ -8005,7 +8005,7 @@ sys/src/9/pc/i8253.c - 664 sys sys 1139681387 6236
 sys/src/9/pc/i8259.c - 664 sys sys 1131290399 4586
 sys/src/9/pc/init9.c - 664 sys sys 1040002518 94
 sys/src/9/pc/initcode.s - 664 sys sys 1015014519 282
-sys/src/9/pc/io.h - 664 sys sys 1099761152 8095
+sys/src/9/pc/io.h - 664 sys sys 1165555523 9406
 sys/src/9/pc/kbd.c - 664 sys sys 1132574883 12365
 sys/src/9/pc/l.s - 664 sys sys 1143129925 28552
 sys/src/9/pc/main.c - 664 sys sys 1162952105 15321
@@ -8049,8 +8049,8 @@ sys/src/9/pc/uartaxp.c - 664 sys sys 1158803840 18862
 sys/src/9/pc/uarti8250.c - 664 sys sys 1102820421 13958
 sys/src/9/pc/uartisa.c - 664 sys sys 1127126907 1777
 sys/src/9/pc/uartpci.c - 664 sys sys 1162859151 3617
-sys/src/9/pc/usb.h - 664 sys sys 1099760881 3650
-sys/src/9/pc/usbuhci.c - 664 sys sys 1154725785 30910
+sys/src/9/pc/usb.h - 664 sys sys 1165555430 4257
+sys/src/9/pc/usbuhci.c - 664 sys sys 1165555497 31000
 sys/src/9/pc/vga.c - 664 sys sys 1131290595 5148
 sys/src/9/pc/vga3dfx.c - 664 sys sys 1133218367 3833
 sys/src/9/pc/vgaark2000pv.c - 664 sys sys 1131290600 3422

+ 24 - 0
dist/replica/plan9.log

@@ -31764,3 +31764,27 @@
 1165046406 0 c sys/src/cmd/usb/lib/setup.c - 664 sys sys 1165044747 1936
 1165046406 1 c sys/src/cmd/usb/lib/usb.h - 664 sys sys 1165044715 7066
 1165338006 0 c sys/games/lib/fortunes - 664 sys sys 1164833354 262072
+1165555805 0 c sys/src/9/pc/devusb.c - 664 sys sys 1165555433 18791
+1165555805 1 c sys/src/9/pc/io.h - 664 sys sys 1165555523 9406
+1165555805 2 c sys/src/9/pc/usb.h - 664 sys sys 1165555430 4257
+1165555805 3 c sys/src/9/pc/usbuhci.c - 664 sys sys 1165555497 31000
+1165563005 0 c lib/face/48x48x4/.dict - 664 sys sys 1165561735 3448
+1165622406 0 c sys/man/1/man - 664 sys sys 1165622295 2006
+1165622406 1 c sys/man/1/tar - 664 sys sys 1165622307 3439
+1165622406 2 c sys/man/1/expect - 664 sys sys 1165622338 3018
+1165622406 3 c sys/man/1/marshal - 664 sys sys 1165622300 3149
+1165622406 4 c sys/man/1/winwatch - 664 sys sys 1165622316 708
+1165622406 5 c sys/man/2/9pcmdbuf - 664 sys sys 1165622380 2076
+1165624206 0 c sys/man/2/segbrk - 664 sys sys 1165622575 1211
+1165624206 1 c sys/man/2/dsa - 664 sys sys 1165622511 2091
+1165624206 2 c sys/man/2/prime - 664 sys sys 1165622556 1961
+1165624206 3 c sys/man/2/rsa - 664 sys sys 1165622556 4260
+1165624206 4 c sys/man/3/fs - 664 sys sys 1165622643 2702
+1165624206 5 c sys/man/4/fossil - 664 sys sys 1165622806 9590
+1165624206 6 c sys/man/4/import - 664 sys sys 1165622806 3202
+1165624206 7 c sys/man/6/authsrv - 664 sys sys 1165622854 13320
+1165624206 8 c sys/man/7/juke - 664 sys sys 1165622887 7768
+1165624206 9 c sys/man/8/boot - 664 sys sys 1165623055 8357
+1165624206 10 c sys/man/8/gpsfs - 664 sys sys 1165623047 4918
+1165624206 11 c sys/man/8/httpd - 664 sys sys 1165623004 6865
+1165624206 12 c sys/man/8/tlssrv - 664 sys sys 1165623041 2589

+ 1 - 0
lib/face/48x48x4/.dict

@@ -90,6 +90,7 @@ ghs.com/unknown u/unknown.ghs.com
 gmail.com/howard.trickey h/howard.1
 gmail.com/mirtchovski a/andrey.1
 gmail.com/presotto p/presotto.1
+gmail.com/rminnich r/rminnich.1
 gmail.com/robpike r/rob.1
 gmail.com/russcox r/rsc.1
 gmx.de/heiko.dudzus h/heiko.1

+ 8 - 8
sys/man/1/expect

@@ -97,14 +97,6 @@ and means the same as it does for
 discards any input waiting on standard input.  It
 is used to sync up the stream at the start of dialing
 or after an error.
-.SH FILES
-.B /rc/bin/ipconf/*
-example dialer scripts for ppp
-.SH SOURCE
-.B /sys/src/cmd/dial/*.c
-.SH SEE ALSO
-.IR ppp (8),
-.IR telco (4)
 .SH EXAMPLE
 The following
 .B rc
@@ -170,3 +162,11 @@ fn dialfn {
 	ip/ppp $primary -f
 } < $dev > $dev
 .EE
+.SH FILES
+.B /rc/bin/ipconf/*
+example dialer scripts for ppp
+.SH SOURCE
+.B /sys/src/cmd/dial/*.c
+.SH SEE ALSO
+.IR ppp (8),
+.IR telco (4)

+ 1 - 1
sys/man/1/man

@@ -49,7 +49,7 @@ Print the pages on the standard output using
 Print the pages using
 .I nroff
 and send them to 
-.IR plumber (1)
+.IR plumber (4)
 for display in the editor.
 .TP
 .B -p

+ 1 - 1
sys/man/1/marshal

@@ -113,7 +113,7 @@ as a recipient.
 tells marshal what message this one is in reply to.
 .I Replymsg
 is an
-.IR upas/fs (1)
+.IR upasfs (4)
 directory containing the message.
 .I Marshal
 uses any message id in this message in its

+ 1 - 1
sys/man/1/tar

@@ -153,7 +153,7 @@ can be used to copy hierarchies thus:
 .SH SEE ALSO
 .IR ar (1),
 .IR bundle (1),
-.IR tapefs (1)
+.IR tapefs (4)
 .SH BUGS
 There is no way to ask for any but the last
 occurrence of a file.

+ 0 - 1
sys/man/1/winwatch

@@ -42,6 +42,5 @@ Excluding winwatch, stats and faces from being showed.
 .B /sys/src/cmd/winwatch.c
 .SH SEE ALSO
 .IR rio (1),
-.IR window (1),
 .IR rio (4),
 .IR regexp (6).

+ 3 - 1
sys/man/2/9pcmdbuf

@@ -42,7 +42,9 @@ bytes at
 .I p
 (which need not be NUL-terminated) as a UTF string and splits it
 using
-.IR tokenize (2).
+.I tokenize
+(see
+.IR getfields (2)).
 It returns a
 .B Cmdbuf
 structure holding pointers to each field in the message.

+ 24 - 17
sys/man/2/dsa

@@ -43,27 +43,30 @@ DSApub*	dsaprivtopub(DSApriv*)
 .PP
 DSA is the NIST approved digital signature algorithm.  The owner of a key publishes
 the public part of the key:
+.IP
 .EX
-	struct DSApub
-	{
-		mpint	*p;	// modulus
-		mpint	*q;	// group order, q divides p-1
-		mpint	*alpha;	// group generator
-		mpint	*key;	// alpha**secret mod p
-	};
+struct DSApub
+{
+	mpint	*p;	// modulus
+	mpint	*q;	// group order, q divides p-1
+	mpint	*alpha;	// group generator
+	mpint	*key;	// alpha**secret mod p
+};
 .EE
+.LP
 This part can be used for verifying signatures (with
 .IR dsaverify )
 created by the owner.
 The owner signs (with
 .IR dsasign )
 using his private key:
+.IP
 .EX
-	struct DSApriv
-	{
-		DSApub	pub;
-		mpint	*secret; // (decryption key)
-	};
+struct DSApriv
+{
+	DSApub	pub;
+	mpint	*secret; // (decryption key)
+};
 .EE
 .PP
 Keys are generated using
@@ -79,7 +82,9 @@ a key is created using a new
 and
 .B q
 generated by
-.IR DSAprimes (2).
+.I DSAprimes
+(see
+.IR prime (2)).
 Otherwise,
 .B p
 and
@@ -104,12 +109,14 @@ signs message
 using a private key
 .I k
 yielding a
+.IP
 .EX
-	struct DSAsig
-	{
-		mpint	*r, *s;
-	};
+struct DSAsig
+{
+	mpint	*r, *s;
+};
 .EE
+.LP
 .I Dsaverify
 returns 0 if the signature is valid and \-1 if not.
 .PP

+ 1 - 1
sys/man/2/prime

@@ -97,4 +97,4 @@ slow algorithm.
 .IR blowfish (2),
 .IR des (2),
 .IR elgamal (2),
-.IR rsa (2),
+.IR rsa (2)

+ 4 - 2
sys/man/2/rsa

@@ -162,7 +162,9 @@ The subject line is conventionally of the form
    "C=US ST=NJ L=07922 O=Lucent OU='Bell Labs' CN=Eric"
 .EE
 using the quoting conventions of
-.IR tokenize (2).
+.I tokenize
+in
+.IR getfields (2).
 .PP
 .I Asn1toRSApriv
 converts an ASN1 formatted RSA private key into the corresponding
@@ -203,4 +205,4 @@ is undefined.
 .IR sechash (2),
 .IR prime (2),
 .IR rand (2),
-.IR x509 (8)
+.IR rsa (8)

+ 3 - 1
sys/man/2/segbrk

@@ -61,4 +61,6 @@ subsuming the functions of
 .IR brk (2),
 .IR segflush (2)
 and
-.IR segfree (2).
+.I segfree
+in
+.IR segattach (2).

+ 1 - 1
sys/man/3/fs

@@ -16,7 +16,7 @@ driver builds complex disk files out of simpler disk files.
 Inspired by the Plan 9 file server kernel's configuration strings,
 it provides device mirroring, partitioning, interleaving, and catenation
 for disk-based services like
-.IR kfs (8)
+.IR kfs (4)
 or
 .IR venti (8).
 .PP

+ 4 - 3
sys/man/4/fossil

@@ -142,9 +142,10 @@ will be named
 .BR /archive/2002/1215/ .
 .PP
 The attach name used in
-.IR mount (1)
-(see also
-.IR mount (2)
+.I mount
+(see
+.IR bind (1),
+.IR bind (2)
 and
 .IR attach (5))
 selects a file system to be served

+ 1 - 1
sys/man/4/import

@@ -189,7 +189,7 @@ to restart
 .B /sys/src/cmd/import.c
 .SH SEE ALSO
 .IR bind (1),
-.IR aan (1),
+.IR aan (8),
 .IR ssl (3),
 .IR exportfs (4),
 .IR listen (8),

+ 3 - 1
sys/man/6/authsrv

@@ -526,7 +526,9 @@ The
 .I challenge
 is a random five-digit decimal number.
 When using a SecureNet key or
-.IR netkey (1),
+.I netkey
+(see
+.IR passwd (1)),
 the 
 .I response
 is an eight-digit decimal or hexadecimal number

+ 1 - 1
sys/man/7/juke

@@ -44,7 +44,7 @@ juke \- music jukebox
 .I Jukebox
 controls a playlist server
 (see
-.IR playlistsrv (7))
+.IR playlistfs (7))
 through a graphical user interface.  It connects to a music database server which reads a set of
 .I map
 files that describe recordings and their location.  Currently, there is

+ 1 - 1
sys/man/8/boot

@@ -319,7 +319,7 @@ partition,
 invokes
 .BR /boot/kfs .
 A variety of programs, like
-.IR 9660srv (4)
+.I 9660srv
 and
 .IR dossrv (4)
 masquerade as

+ 6 - 5
sys/man/8/gpsfs

@@ -96,12 +96,14 @@ format.
 .TP
 .I "gps time
 in
-.IR nsec (2)
+.I nsec
+(see
+.IR time (2))
 format (ms accuracy).
 .TP
 .I "system time
 in
-.IR nsec (2)
+.I nsec
 format.  This is the system time at the time of the
 .I "gps time
 sample.  The difference between this and the previous field is used in clock
@@ -236,9 +238,8 @@ given in a single argument (separated by white space), or in two arguments, in e
 Initialization time is taken from
 .IR time (2).
 .SH "SEE ALSO
-.IR timesync (2),
-.IR time (2),
-.IR nsec (2).
+.IR timesync (8),
+.IR time (2)
 .SH FILES
 .TF /mnt/gps/satellites
 .TP

+ 1 - 1
sys/man/8/httpd

@@ -305,4 +305,4 @@ regular expressions describing explicitly unlistable pathnames
 in
 .IR auth (2),
 .IR listen (8),
-.IR x509 (8)
+.IR rsa (8)

+ 1 - 1
sys/man/8/tlssrv

@@ -146,7 +146,7 @@ actual TCP port numbers.)
 .SH "SEE ALSO"
 .IR factotum (4),
 .IR listen (8),
-.IR x509 (8)
+.IR rsa (8)
 .br
 Unix's
 .I stunnel

+ 51 - 21
sys/src/9/pc/devusb.c

@@ -1,3 +1,7 @@
+/*
+ * USB device and framework.
+ * usb*.c contains host controller interface drivers.
+ */
 #include	"u.h"
 #include	"../port/lib.h"
 #include	"mem.h"
@@ -192,7 +196,8 @@ devendpt(Udev *d, int id, int add)
 	lock(d);
 	if(*p != nil){
 		incref(*p);
-		XPRINT("incref(0x%p) in devendpt, new value %ld\n", *p, (*p)->ref);
+		XPRINT("incref(0x%p) in devendpt, new value %ld\n",
+			*p, (*p)->ref);
 		unlock(d);
 		uh->epfree(uh, e);
 		free(e);
@@ -230,6 +235,11 @@ usbnewdevice(Usbhost *uh)
 	d = nil;
 	qlock(uh);
 	if(waserror()){
+		if (d) {
+			uh->dev[d->x] = nil;
+			freept(d->ep[0]);
+			free(d);
+		}
 		qunlock(uh);
 		nexterror();
 	}
@@ -243,8 +253,10 @@ usbnewdevice(Usbhost *uh)
 			d->id = (uh->idgen << 8) | i;
 			d->state = Enabled;
 			XPRINT("calling devendpt in usbnewdevice\n");
-			e = devendpt(d, 0, 1);	/* always provide control endpoint 0 */
+			e = devendpt(d, 0, 1);	/* always provide ctl endpt 0 */
 			e->mode = ORDWR;
+			e->in.epmode = e->out.epmode = Ctlmode;	/* OHCI */
+			// epsetMPS(e, 64, 64);		/* OHCI; see epalloc*/
 			e->iso = 0;
 			e->sched = -1;
 			uh->dev[i] = d;
@@ -277,7 +289,7 @@ freedev(Udev *d, int ept)
 			if(e != nil)
 				uh->epclose(uh, e);
 		}
-	}	
+	}
 }
 
 static int
@@ -429,7 +441,8 @@ usbprobe(int cardno, int ctlrno)
 	intrenable(uh->irq, uh->interrupt, uh, uh->tbdf, name);
 
 	ebuf = buf + sizeof buf;
-	p = seprint(buf, ebuf, "#U/usb%d: %s: port 0x%luX irq %d", ctlrno, usbtypes[cardno].type, uh->port, uh->irq);
+	p = seprint(buf, ebuf, "#U/usb%d: %s: port 0x%luX irq %d",
+		ctlrno, usbtypes[cardno].type, uh->port, uh->irq);
 	if(uh->mem)
 		p = seprint(p, ebuf, " addr 0x%luX", PADDR(uh->mem));
 	if(uh->size)
@@ -557,6 +570,12 @@ usbopen(Chan *c, int omode)
 		XPRINT("usbopen, Qctl 0x%p\n", d);
 		break;
 
+//	case Qsetup:			/* OHCI addition */
+//		d = usbhdevice(c);
+//		doopen(ub, d, 0);
+//		incref(d);
+//		break;
+
 	default:
 		s = type - Qep0;
 		XPRINT("usbopen, default 0x%p, %d\n", d, s);
@@ -617,11 +636,14 @@ epstatus(char *s, char *se, Endpt *e, int i)
 {
 	char *p;
 
-	p = seprint(s, se, "%2d %#6.6lux %10lud bytes %10lud blocks\n", i, e->csp, e->nbytes, e->nblocks);
+	p = seprint(s, se, "%2d %#6.6lux %10lud bytes %10lud blocks\n",
+		i, e->csp, e->nbytes, e->nblocks);
 	if(e->iso){
-		p = seprint(p, se, "bufsize %6d buffered %6d", e->maxpkt, e->buffered);
+		p = seprint(p, se, "bufsize %6d buffered %6d",
+			e->maxpkt, e->buffered);
 		if(e->toffset)
-			p = seprint(p, se, " offset  %10lud time %19lld\n", e->toffset, e->time);
+			p = seprint(p, se, " offset  %10lud time %19lld\n",
+				e->toffset, e->time);
 		p = seprint(p, se, "\n");
 	}
 	return p;
@@ -658,7 +680,7 @@ usbread(Chan *c, void *a, long n, vlong offset)
 			if(e->setin){
 				e->setin = 0;
 				e->wdata01 = 1;
-				uh->write(uh, e, "", 0, 0LL, TokOUT);
+				uh->write(uh, e, "", 0, 0LL, uh->tokout);
 			}
 			return n;
 		}
@@ -682,9 +704,11 @@ usbread(Chan *c, void *a, long n, vlong offset)
 
 	case Qstatus:
 		if (d->did || d->vid)
-			p = seprint(s, se, "%s %#6.6lux %#4.4ux %#4.4ux\n", devstates[d->state], d->csp, d->vid, d->did);
+			p = seprint(s, se, "%s %#6.6lux %#4.4ux %#4.4ux\n",
+				devstates[d->state], d->csp, d->vid, d->did);
 		else
-			p = seprint(s, se, "%s %#6.6lux\n", devstates[d->state], d->csp);
+			p = seprint(s, se, "%s %#6.6lux\n",
+				devstates[d->state], d->csp);
 		for(i=0; i<nelem(d->ep); i++) {
 			e = d->ep[i];
 			if(e == nil)
@@ -736,7 +760,7 @@ usbwrite(Chan *c, void *a, long n, vlong offset)
 			uh->portreset(uh, id);
 			break;
 		}
-	
+
 		poperror();
 		free(cb);
 		return n;
@@ -755,8 +779,11 @@ usbwrite(Chan *c, void *a, long n, vlong offset)
 		case CMclass:
 			if (cb->nf != 4 && cb->nf != 6)
 				cmderror(cb, Ebadusbmsg);
-			/* class #ifc ept csp ( == class subclass proto) [vendor product] */
-			d->npt = strtoul(cb->f[1], nil, 0);	/* # of interfaces */
+			/*
+			 * class #ifc ept csp
+			 * (== class subclass proto) [vendor product]
+			 */
+			d->npt = strtoul(cb->f[1], nil, 0); /* # of interfaces */
 			i = strtoul(cb->f[2], nil, 0);		/* endpoint */
 			if (i < 0 || i >= nelem(d->ep)
 			 || d->npt > nelem(d->ep) || i >= d->npt)
@@ -833,7 +860,8 @@ usbwrite(Chan *c, void *a, long n, vlong offset)
 			 */
 			i = strtoul(cb->f[1], nil, 0);
 			if(i < 0 || i >= nelem(d->ep)) {
-				XPRINT("field 1: 0 <= %d < %d\n", i, nelem(d->ep));
+				XPRINT("field 1: 0 <= %d < %d\n",
+					i, nelem(d->ep));
 				error(Ebadarg);
 			}
 			if((e = d->ep[i]) == nil){
@@ -880,19 +908,21 @@ usbwrite(Chan *c, void *a, long n, vlong offset)
 					e->hz = i;
 					e->remain = 0;
 				}else {
-					XPRINT("field 5: 1 < %d <= 100000 Hz\n", i);
+					XPRINT("field 5: 1 < %d <= 100000 Hz\n",
+						i);
 					error(Ebadarg);
 				}
-				e->maxpkt = (e->hz * e->pollms + 999)/1000 * e->samplesz;
+				e->maxpkt = (e->hz*e->pollms + 999)/1000 *
+					e->samplesz;
 				e->iso = 1;
 			}
-			e->mode = strcmp(cb->f[3],"r") == 0? OREAD :
-				  	strcmp(cb->f[3],"w") == 0? OWRITE : ORDWR;
+			e->mode = strcmp(cb->f[3],"r") == 0? OREAD:
+				  strcmp(cb->f[3],"w") == 0? OWRITE: ORDWR;
 			uh->epmode(uh, e);
 			poperror();
 			qunlock(uh);
 		}
-	
+
 		poperror();
 		free(cb);
 		return n;
@@ -906,7 +936,7 @@ usbwrite(Chan *c, void *a, long n, vlong offset)
 			error(Eio);
 		nw = *(uchar*)a & RD2H;
 		e->wdata01 = 0;
-		n = uh->write(uh, e, a, n, 0LL, TokSETUP);
+		n = uh->write(uh, e, a, n, 0LL, uh->toksetup);
 		if(nw == 0) {	/* host to device: use IN[DATA1] to ack */
 			e->rdata01 = 1;
 			nw = uh->read(uh, e, cmd, 0LL, 8);
@@ -923,7 +953,7 @@ usbwrite(Chan *c, void *a, long n, vlong offset)
 		e = d->ep[t];
 		if(e == nil || e->mode == OREAD)
 			error(Egreg);
-		n = uh->write(uh, e, a, n, offset, TokOUT);
+		n = uh->write(uh, e, a, n, offset, uh->tokout);
 		break;
 	}
 	return n;

+ 49 - 1
sys/src/9/pc/io.h

@@ -94,7 +94,7 @@ enum {
 /*
  * PCI support code.
  */
-enum {					/* type 0 and type 1 pre-defined header */
+enum {					/* type 0 & type 1 pre-defined header */
 	PciVID		= 0x00,		/* vendor ID */
 	PciDID		= 0x02,		/* device ID */
 	PciPCR		= 0x04,		/* command */
@@ -115,6 +115,54 @@ enum {					/* type 0 and type 1 pre-defined header */
 	PciINTP		= 0x3D,		/* interrupt pin */
 };
 
+/* ccrb (base class code) values; controller types */
+enum {
+	Pcibcpci1	= 0,		/* pci 1.0; no class codes defined */
+	Pcibcstore	= 1,		/* mass storage */
+	Pcibcnet	= 2,		/* network */
+	Pcibcdisp	= 3,		/* display */
+	Pcibcmmedia	= 4,		/* multimedia */
+	Pcibcmem	= 5,		/* memory */
+	Pcibcbridge	= 6,		/* bridge */
+	Pcibccomm	= 7,		/* simple comms (e.g., serial) */
+	Pcibcbasesys	= 8,		/* base system */
+	Pcibcinput	= 9,		/* input */
+	Pcibcdock	= 0xa,		/* docking stations */
+	Pcibcproc	= 0xb,		/* processors */
+	Pcibcserial	= 0xc,		/* serial bus (e.g., USB) */
+	Pcibcwireless	= 0xd,		/* wireless */
+	Pcibcintell	= 0xe,		/* intelligent i/o */
+	Pcibcsatcom	= 0xf,		/* satellite comms */
+	Pcibccrypto	= 0x10,		/* encryption/decryption */
+	Pcibcdacq	= 0x11,		/* data acquisition & signal proc. */
+};
+
+/* ccru (sub-class code) values; common cases only */
+enum {
+	/* mass storage */
+	Pciscscsi	= 0,		/* SCSI */
+	Pciscide	= 1,		/* IDE (ATA) */
+
+	/* network */
+	Pciscether	= 0,		/* Ethernet */
+
+	/* display */
+	Pciscvga	= 0,		/* VGA */
+	Pciscxga	= 1,		/* XGA */
+	Pcisc3d		= 2,		/* 3D */
+
+	/* bridges */
+	Pcischostpci	= 0,		/* host/pci */
+	Pciscpcicpci	= 1,		/* pci/pci */
+
+	/* simple comms */
+	Pciscserial	= 0,		/* 16450, etc. */
+	Pciscmultiser	= 1,		/* multiport serial */
+
+	/* serial bus */
+	Pciscusb	= 3,		/* USB */
+};
+
 enum {					/* type 0 pre-defined header */
 	PciCIS		= 0x28,		/* cardbus CIS pointer */
 	PciSVID		= 0x2C,		/* subsystem vendor ID */

+ 68 - 27
sys/src/9/pc/usb.h

@@ -1,3 +1,6 @@
+/*
+ * common USB definitions
+ */
 typedef struct Ctlr Ctlr;
 typedef struct Endpt Endpt;
 typedef struct Udev Udev;
@@ -5,15 +8,8 @@ typedef struct Usbhost Usbhost;
 
 enum
 {
-	MaxUsb = 10,		/* max number of USB Host Controller Interfaces (Usbhost*) */
-	MaxUsbDev = 32,	/* max number of attached USB devices, including root hub (Udev*) */
-
-	/*
-	 * USB packet definitions...
- 	*/
-	TokIN = 0x69,
-	TokOUT = 0xE1,
-	TokSETUP = 0x2D,
+	MaxUsb = 10,	/* max # of USB Host Controller Interfaces (Usbhost*) */
+	MaxUsbDev = 32,	/* max # of attached USB devs, including root hub (Udev*) */
 
 	/* request type */
 	RH2D = 0<<7,
@@ -21,25 +17,51 @@ enum
 	Rstandard = 0<<5,
 	Rclass = 1<<5,
 	Rvendor = 2<<5,
+
 	Rdevice = 0,
 	Rinterface = 1,
 	Rendpt = 2,
 	Rother = 3,
 };
 
-#define Class(csp)		((csp)&0xff)
+#define Class(csp)	((csp)&0xff)
 #define Subclass(csp)	(((csp)>>8)&0xff)
-#define Proto(csp)		(((csp)>>16)&0xff)
+#define Proto(csp)	(((csp)>>16)&0xff)
 #define CSP(c, s, p)	((c) | ((s)<<8) | ((p)<<16))
 
+/* for OHCI */
+typedef struct ED ED;
+struct ED {
+	ulong ctrl;
+	ulong tail;		/* transfer descriptor */
+	ulong head;
+	ulong next;
+};
+
 /*
  * device endpoint
  */
 struct Endpt
 {
+	ED *ined;		/* for OHCI */
+	ED *outed;		/* for OHCI */
 	Ref;
 	Lock;
 	int	x;		/* index in Udev.ep */
+	struct {		/* OHCI */
+		int epmode;
+		int	nbuf;	/* number of buffers allowed */
+		int	ntd;
+		int	mps;
+	} out;
+	struct {		/* OHCI */
+		int epmode;
+		int	nbuf;	/* number of buffers allowed */
+		int	sched;	/* schedule index; -1 if undefined or aperiodic */
+		int	pollms;	/* polling interval in msec */
+		int	ntd;
+		int	mps;
+	} in;
 	int	id;		/* hardware endpoint address */
 	int	maxpkt;		/* maximum packet size (from endpoint descriptor) */
  	uchar	wdata01;	/* 0=DATA0, 1=DATA1 for output direction */
@@ -64,10 +86,12 @@ struct Endpt
 	ulong	foffset;	/* file offset (to detect seeks) */
 	ulong	poffset;	/* offset of next packet to be queued */
 	ulong	toffset;	/* offset associated with time */
-	vlong	time;		/* timeassociated with offset */
+	vlong	time;		/* time associated with offset */
 	int	buffered;	/* bytes captured but unread, or written but unsent */
 	/* end ISO stuff */
 
+	ulong	bw;		/* bandwidth requirement (OHCI) */
+
 	Udev*	dev;		/* owning device */
 
 	ulong	nbytes;
@@ -75,20 +99,32 @@ struct Endpt
 
 	void	*private;
 
-	/* all the rest could (should?) move to the driver private structure; except perhaps err */
+	/*
+	 * all the rest could (should?) move to the driver private structure;
+	 * except perhaps err.
+	 */
 	QLock	rlock;
 	Rendez	rr;
 	Queue*	rq;
+
 	QLock	wlock;
 	Rendez	wr;
 	Queue*	wq;
 
-	int		ntd;
-	char*	err;		// needs to be global for unstall; fix?
+	int	ntd;
+	char*	err;		/* needs to be global for unstall; fix? */
 
 	Endpt*	activef;	/* active endpoint list */
 };
 
+/* OHCI endpoint modes */
+enum {
+	Nomode,
+	Ctlmode,
+	Bulkmode,
+	Intrmode
+};
+
 /* device parameters */
 enum
 {
@@ -112,18 +148,19 @@ struct Udev
 	Ref;
 	Lock;
 	Usbhost	*uh;
-	int		x;		/* index in usbdev[] */
-	int		busy;
-	int		state;
-	int		id;
+	int	x;		/* index in usbdev[] */
+	int	busy;
+	int	state;
+	int	id;
 	uchar	port;		/* port number on connecting hub */
 	ulong	csp;
 	ushort	vid;		/* vendor id */
 	ushort	did;		/* product id */
-	int		ls;
-	int		npt;
-	Endpt*	ep[16];	/* active end points */
-	Udev*	ports;	/* active ports, if hub */
+	int	ls;
+	int	npt;
+	Endpt*	ep[16];		/* active end points */
+
+	Udev*	ports;		/* active ports, if hub */
 	Udev*	next;		/* next device on this hub */
 };
 
@@ -132,11 +169,11 @@ struct Udev
  */
 struct Usbhost
 {
-	ISAConf;					/* hardware info */
-	int	tbdf;					/* type+busno+devno+funcno */
+	ISAConf;		/* hardware info */
+	int	tbdf;		/* type+busno+devno+funcno */
 
-	QLock;					/* protects namespace state */
-	int		idgen;			/* version number to distinguish new connections */
+	QLock;			/* protects namespace state */
+	int	idgen;		/* version # to distinguish new connections */
 	Udev*	dev[MaxUsbDev];	/* device endpoints managed by this HCI */
 
 	void	(*init)(Usbhost*);
@@ -156,6 +193,10 @@ struct Usbhost
 	long	(*write)(Usbhost*, Endpt*, void*, long, vlong, int);
 
 	void	*ctlr;
+
+	int	tokin;
+	int	tokout;
+	int	toksetup;
 };
 
 extern void addusbtype(char*, int(*)(Usbhost*));

+ 104 - 79
sys/src/9/pc/usbuhci.c

@@ -1,3 +1,6 @@
+/*
+ * USB Universal Host Controller Interface (UHCI) driver
+ */
 #include	"u.h"
 #include	"../port/lib.h"
 #include	"mem.h"
@@ -21,6 +24,13 @@ static	char	Estalled[] = "usb endpoint stalled";
  */
 enum
 {
+	/*
+	 * USB packet definitions...
+ 	*/
+	Utokin = 0x69,
+	Utokout = 0xE1,
+	Utoksetup = 0x2D,
+
 	/* i/o space */
 	Cmd = 0,
 	Status = 2,
@@ -42,7 +52,7 @@ enum
 	DevicePresent =	1<<0,
 
 	NFRAME = 	1024,
-	FRAMESIZE=	NFRAME*sizeof(ulong),	/* fixed by hardware; aligned to same */
+	FRAMESIZE=	NFRAME*sizeof(ulong), /* fixed by hardware; aligned to same */
 
 	Vf =		1<<2,	/* TD only */
 	IsQH =		1<<1,
@@ -64,7 +74,8 @@ enum
 	NAKed =		1<<19,
 	CRCorTimeout =	1<<18,
 	BitstuffErr =	1<<17,
-	AnyError = (Stalled | DataBufferErr | Babbling | NAKed | CRCorTimeout | BitstuffErr),
+	AnyError = (Stalled | DataBufferErr | Babbling | NAKed | CRCorTimeout |
+			BitstuffErr),
 
 	/* TD.dev */
 	IsDATA1 =	1<<19,
@@ -107,9 +118,9 @@ struct Ctlr
 	int	active;
 
 	int	io;
-	ulong*	frames;	/* frame list */
-	ulong*	frameld;	/* real time load on each of the frame list entries */
-	QLock	resetl;	/* lock controller during USB reset */
+	ulong*	frames;		/* frame list */
+	ulong*	frameld;	/* real time load on each frame list entry */
+	QLock	resetl;		/* lock controller during USB reset */
 
 	TD*	tdpool;
 	TD*	freetd;
@@ -117,7 +128,7 @@ struct Ctlr
 	QH*	freeqh;
 
 	QH*	ctlq;	/* queue for control i/o */
-	QH*	bwsop;	/* empty bandwidth sop (to PIIX4 errata specifications) */
+	QH*	bwsop;	/* empty bandwidth sop (to PIIX4 errata specs) */
 	QH*	bulkq;	/* queue for bulk i/o (points back to bandwidth sop) */
 	QH*	recvq;	/* receive queues for bulk i/o */
 
@@ -149,7 +160,7 @@ struct Endptx
 	void*	bpalloc;
 	uchar*	bp0;		/* first block in array */
 	TD*	td0;		/* first td in array */
-	TD*	etd;		/* pointer into circular list of TDs for isochronous ept */
+	TD*	etd; /* pointer into circular list of TDs for isochronous ept */
 	TD*	xtd;		/* next td to be cleaned */
 };
 
@@ -159,7 +170,7 @@ struct Endptx
 struct TD
 {
 	ulong	link;
-	ulong	status;	/* controller r/w */
+	ulong	status;		/* controller r/w */
 	ulong	dev;
 	ulong	buffer;
 
@@ -177,7 +188,7 @@ struct TD
 struct QH
 {
 	ulong	head;
-	ulong	entries;	/* address of next TD or QH to process (updated by controller) */
+	ulong	entries; /* address of next TD or QH to process (updated by controller) */
 
 	/* software */
 	QH*	hlink;
@@ -187,6 +198,7 @@ struct QH
 	ulong	_d1;		/* fillers */
 	ulong	_d2;
 };
+
 #define	QFOL(p)	((QH*)KADDR((ulong)(p) & ~(0xF|PCIWINDOW)))
 
 static TD *
@@ -247,7 +259,7 @@ dumptd(TD *t, int follow)
 	t0 = t;
 	while(t){
 		i = t->dev & 0xFF;
-		if(i == TokOUT || i == TokSETUP)
+		if(i == Utokout || i == Utoksetup)
 			n = ((t->dev>>21) + 1) & 0x7FF;
 		else if((t->status & Active) == 0)
 			n = (t->status + 1) & 0x7FF;
@@ -273,16 +285,17 @@ dumptd(TD *t, int follow)
 		*s = 0;
 		XPRINT("td %8.8lux: ", t);
 		XPRINT("l=%8.8lux s=%8.8lux d=%8.8lux b=%8.8lux %8.8lux f=%8.8lux\n",
-			t->link, t->status, t->dev, t->buffer, t->bp?(ulong)t->bp->rp:0, t->flags);
-		XPRINT("\ts=%s,ep=%ld,d=%ld,D=%ld\n",
-			buf, (t->dev>>15)&0xF, (t->dev>>8)&0xFF, (t->dev>>19)&1);
+			t->link, t->status, t->dev, t->buffer,
+			(t->bp? (ulong)t->bp->rp: 0), t->flags);
+		XPRINT("\ts=%s,ep=%ld,d=%ld,D=%ld\n", buf, (t->dev>>15)&0xF,
+			(t->dev>>8)&0xFF, (t->dev>>19)&1);
 		if(debug && t->bp && (t->flags & CancelTD) == 0)
 			dumpdata(t->bp, n);
 		if(!follow || t->link & Terminate || t->link & IsQH)
 			break;
 		t = TFOL(t->link);
 		if(t == t0)
-			break;	/* looped */
+			break;		/* looped */
 	}
 }
 
@@ -295,7 +308,7 @@ alloctde(Ctlr *ctlr, Endpt *e, int pid, int n)
 	t = alloctd(ctlr);
 	id = (e->x<<7)|(e->dev->x&0x7F);
 	tog = 0;
-	if((pid == TokOUT && e->wdata01) || (pid == TokIN && e->rdata01))
+	if((pid == Utokout && e->wdata01) || (pid == Utokin && e->rdata01))
 		tog = IsDATA1;
 	t->ep = e;
 	t->status = ErrLimit3 | Active | IOC;	/* or put IOC only on last? */
@@ -389,7 +402,8 @@ cleantd(Ctlr *ctlr, TD *t, int discard)
 	Block *b;
 	int n, err;
 
-	XPRINT("cleanTD: %8.8lux %8.8lux %8.8lux %8.8lux\n", t->link, t->status, t->dev, t->buffer);
+	XPRINT("cleanTD: %8.8lux %8.8lux %8.8lux %8.8lux\n",
+		t->link, t->status, t->dev, t->buffer);
 	if(t->ep != nil && t->ep->debug)
 		dumptd(t, 0);
 	if(t->status & Active)
@@ -397,16 +411,20 @@ cleantd(Ctlr *ctlr, TD *t, int discard)
 	err = t->status & (AnyError&~NAKed);
 	/* TO DO: on t->status&AnyError, q->entries will not have advanced */
 	if (err) {
-		XPRINT("cleanTD: Error %8.8lux %8.8lux %8.8lux %8.8lux\n", t->link, t->status, t->dev, t->buffer);
-//		print("cleanTD: Error %8.8lux %8.8lux %8.8lux %8.8lux\n", t->link, t->status, t->dev, t->buffer);
+		XPRINT("cleanTD: Error %8.8lux %8.8lux %8.8lux %8.8lux\n",
+			t->link, t->status, t->dev, t->buffer);
+//		print("cleanTD: Error %8.8lux %8.8lux %8.8lux %8.8lux\n",
+//			t->link, t->status, t->dev, t->buffer);
 	}
 	switch(t->dev&0xFF){
-	case TokIN:
-		if(discard || (t->flags & CancelTD) || t->ep == nil || t->ep->x!=0&&err){
+	case Utokin:
+		if(discard || (t->flags & CancelTD) || t->ep == nil ||
+		    t->ep->x!=0&&err){
 			if(t->ep != nil){
 				if(err != 0)
-					t->ep->err = err==Stalled? Estalled: Eio;
-				wakeup(&t->ep->rr);	/* in case anyone cares */
+					t->ep->err = err==Stalled?
+						Estalled: Eio;
+				wakeup(&t->ep->rr);   /* in case anyone cares */
 			}
 			break;
 		}
@@ -423,15 +441,18 @@ cleantd(Ctlr *ctlr, TD *t, int discard)
 		qpass(t->ep->rq, b);	/* TO DO: flow control */
 		wakeup(&t->ep->rr);	/* TO DO */
 		break;
-	case TokSETUP:
-		XPRINT("cleanTD: TokSETUP %lux\n", &t->ep);
-		/* don't really need to wakeup: subsequent IN or OUT gives status */
+	case Utoksetup:
+		XPRINT("cleanTD: Utoksetup %lux\n", &t->ep);
+		/*
+		 * don't really need to wakeup: subsequent IN or OUT
+		 * gives status./
+		 */
 		if(t->ep != nil) {
 			wakeup(&t->ep->wr);	/* TO DO */
 			XPRINT("cleanTD: wakeup %lux\n", &t->ep->wr);
 		}
 		break;
-	case TokOUT:
+	case Utokout:
 		/* TO DO: mark it done somewhere */
 		XPRINT("cleanTD: TokOut %lux\n", &t->ep);
 		if(t->ep != nil){
@@ -442,8 +463,10 @@ cleantd(Ctlr *ctlr, TD *t, int discard)
 			}
 			if(t->ep->x!=0 && err != 0)
 				t->ep->err = err==Stalled? Estalled: Eio;
+			ilock(ctlr);		/* e->ntd++ is ilocked */
 			if(--t->ep->ntd < 0)
 				panic("cleantd ntd");
+			iunlock(ctlr);
 			wakeup(&t->ep->wr);	/* TO DO */
 			XPRINT("cleanTD: wakeup %lux\n", &t->ep->wr);
 		}
@@ -460,17 +483,20 @@ cleanq(Ctlr *ctlr, QH *q, int discard, int vf)
 	ilock(ctlr);
 	tp = nil;
 	for(t = q->first; t != nil;){
-		XPRINT("cleanq: %8.8lux %8.8lux %8.8lux %8.8lux %8.8lux %8.8lux\n", t->link, t->status, t->dev, t->buffer, t->flags, t->next);
+		XPRINT("cleanq: %8.8lux %8.8lux %8.8lux %8.8lux %8.8lux %8.8lux\n",
+		    t->link, t->status, t->dev, t->buffer, t->flags, t->next);
 		if(t->status & Active){
 			if(t->status & NAKed){
-				t->status = (t->status & ~NAKed) | IOC;	/* ensure interrupt next frame */
+				/* ensure interrupt next frame */
+				t->status = (t->status & ~NAKed) | IOC;
 				tp = t;
 				t = t->next;
 				continue;
 			}
 			if(t->flags & CancelTD){
 				XPRINT("cancelTD: %8.8lux\n", (ulong)t);
-				t->status = (t->status & ~Active) | IOC;	/* ensure interrupt next frame */
+				/* ensure interrupt next frame */
+				t->status = (t->status & ~Active) | IOC;
 				tp = t;
 				t = t->next;
 				continue;
@@ -633,7 +659,7 @@ qrcv(Ctlr *ctlr, Endpt *e)
 	Endptx *x;
 
 	x = e->private;
-	t = alloctde(ctlr, e, TokIN, e->maxpkt);
+	t = alloctde(ctlr, e, Utokin, e->maxpkt);
 	b = allocb(e->maxpkt);
 	t->bp = b;
 	t->buffer = PCIWADDR(b->wp);
@@ -658,10 +684,9 @@ usbsched(Ctlr *ctlr, int pollms, ulong load)
 	q = -1;
 	for (d = 0; d < pollms; d++){
 		worst = 0;
-		for (i = d; i < NFRAME; i++){
+		for (i = d; i < NFRAME; i++)
 			if (ctlr->frameld[i] + load > worst)
 				worst = ctlr->frameld[i] + load;
-		}
 		if (worst < best){
 			best = worst;
 			q = d;
@@ -681,9 +706,8 @@ schedendpt(Ctlr *ctlr, Endpt *e)
 	if(!e->iso || e->sched >= 0)
 		return 0;
 
-	if (e->active){
+	if (e->active)
 		return -1;
-	}
 	e->off = 0;
 	e->sched = usbsched(ctlr, e->pollms, e->maxpkt);
 	if(e->sched < 0)
@@ -719,12 +743,12 @@ schedendpt(Ctlr *ctlr, Endpt *e)
 		id = (e->x<<7)|(e->dev->x&0x7F);
 		if (e->mode == OREAD)
 			/* enable receive on this entry */
-			td->dev = ((e->maxpkt-1)<<21) | ((id&0x7FF)<<8) | TokIN;
+			td->dev = (e->maxpkt-1)<<21 | (id&0x7FF)<<8 | Utokin;
 		else{
 			size = (e->hz + e->remain)*e->pollms/1000;
 			e->remain = (e->hz + e->remain)*e->pollms%1000;
 			size *= e->samplesz;
-			td->dev = ((size-1)<<21) | ((id&0x7FF)<<8) | TokOUT;
+			td->dev = (size-1)<<21 | (id&0x7FF)<<8 | Utokout;
 		}
 		td->status = ErrLimit1 | Active | IsoSelect | IOC;
 		td->link = ctlr->frames[ix];
@@ -832,8 +856,7 @@ epmode(Usbhost *uh, Endpt *e)
 			freeqh(ctlr, x->epq);
 			x->epq = nil;
 		}
-	}
-	else {
+	} else {
 		/* Each bulk device gets a queue head hanging off the
 		 * bulk queue head
 		 */
@@ -925,6 +948,7 @@ portinfo(Usbhost *uh, char *s, char *se)
 		ilock(ctlr);
 		x = IN(ioport[i]);
 		if((x & (PortChange|StatusChange)) != 0)
+			/* TODO: could notify usbd equivalent here */
 			OUT(ioport[i], x);
 		iunlock(ctlr);
 		s = seprint(s, se, "%d %ux", i, x);
@@ -948,7 +972,7 @@ cleaniso(Endpt *e, int frnum)
 	td = x->xtd;
 	if (td->status & Active)
 		return;
-	id = (e->x<<7)|(e->dev->x&0x7F);
+	id = e->x<<7 | (e->dev->x&0x7F);
 	do {
 		if (td->status & AnyError)
 			XPRINT("usbisoerror 0x%lux\n", td->status);
@@ -960,7 +984,7 @@ cleaniso(Endpt *e, int frnum)
 			e->buffered += n;
 			e->poffset += (td->status + 1) & 0x3ff;
 			td->offset = e->poffset;
-			td->dev = ((e->maxpkt -1)<<21) | ((id&0x7FF)<<8) | TokIN;
+			td->dev = (e->maxpkt-1)<<21 | (id&0x7FF)<<8 | Utokin;
 			e->toffset = td->offset;
 		}else{
 			if ((td->flags & IsoClean) == 0){
@@ -974,7 +998,7 @@ cleaniso(Endpt *e, int frnum)
 			n = (e->hz + e->remain)*e->pollms/1000;
 			e->remain = (e->hz + e->remain)*e->pollms%1000;
 			n *= e->samplesz;
-			td->dev = ((n -1)<<21) | ((id&0x7FF)<<8) | TokOUT;
+			td->dev = (n-1)<<21 | (id&0x7FF)<<8 | Utokout;
 			td->offset = e->poffset;
 			e->poffset += n;
 		}
@@ -987,7 +1011,7 @@ cleaniso(Endpt *e, int frnum)
 	e->time = todget(nil);
 	x->xtd = td;
 	for (n = 2; n < 4; n++){
-		i = ((frnum + n)&0x3ff);
+		i = (frnum + n) & 0x3ff;
 		td = x->td0 + i;
 		bp = x->bp0 + e->maxpkt*i/e->pollms;
 		if (td->status & Active)
@@ -1000,17 +1024,17 @@ cleaniso(Endpt *e, int frnum)
 				if (e->off == 0)
 					td->flags |= IsoClean;
 				else
-					e->buffered += (((td->dev>>21) +1) & 0x3ff) - e->off;
+					e->buffered += (((td->dev>>21) +1) &
+						0x3ff) - e->off;
 				x->etd = nil;
 			}else if ((td->flags & IsoClean) == 0){
 				XPRINT("-");
 				memset(bp, 0, e->maxpkt);
 				td->flags |= IsoClean;
 			}
-		} else {
+		} else
 			/* Unread bytes are now lost */
 			e->buffered -= (td->status + 1) & 0x3ff;
-		}
 		td->status = ErrLimit1 | Active | IsoSelect | IOC;
 	}
 	wakeup(&e->wr);
@@ -1081,7 +1105,8 @@ isoready(void *a)
 	TD *etd;
 
 	x = a;
-	return (etd = x->etd) == nil || (etd != x->xtd && (etd->status & Active) == 0);
+	return (etd = x->etd) == nil ||
+		(etd != x->xtd && (etd->status & Active) == 0);
 }
 
 static long
@@ -1116,7 +1141,8 @@ isoio(Ctlr *ctlr, Endpt *e, void *a, long n, ulong offset, int w)
 		while (offset > e->toffset){
 			tsleep(&e->wr, return0, 0, 500);
 		}
-		while (offset >= td->offset + ((w?(td->dev >> 21):td->status) + 1) & 0x7ff){
+		while (offset >= td->offset +
+		    ((w? (td->dev>>21): td->status) + 1) & 0x7ff){
 			td = td->next;
 			if (td == x->xtd)
 				iprint("trouble\n");
@@ -1188,11 +1214,10 @@ isoio(Ctlr *ctlr, Endpt *e, void *a, long n, ulong offset, int w)
 		td->flags &= ~IsoClean;
 		bp = x->bp0 + (td - x->td0) * e->maxpkt / e->pollms;
 		q = bp + e->off;
-		if (w){
+		if (w)
 			memmove(q, p, i);
-		}else{
+		else
 			memmove(p, q, i);
-		}
 		p += i;
 		n -= i;
 		e->off += i;
@@ -1203,7 +1228,8 @@ isoio(Ctlr *ctlr, Endpt *e, void *a, long n, ulong offset, int w)
 			break;
 		}
 		if(w)
-			td->offset = offset + (p-(uchar*)a) - (((td->dev >> 21) + 1) & 0x7ff);
+			td->offset = offset + (p-(uchar*)a) -
+				(((td->dev >> 21) + 1) & 0x7ff);
 		td->status = ErrLimit3 | Active | IsoSelect | IOC;
 		x->etd = td->next;
 		e->off = 0;
@@ -1323,11 +1349,12 @@ write(Usbhost *uh, Endpt *e, void *a, long n, vlong offset, int tok)
 		n -= i;
 		poperror();
 		qh = qxmit(ctlr, e, b, tok);
-		tok = TokOUT;
+		tok = Utokout;
 		e->wdata01 ^= 1;
 		if(e->ntd >= e->nbuf) {
-XPRINT("qh %s: q=%p first=%p last=%p entries=%.8lux\n",
- "writeusb sleep", qh, qh->first, qh->last, qh->entries);
+			XPRINT("qh %s: q=%p first=%p last=%p entries=%.8lux\n",
+				"writeusb sleep", qh, qh->first, qh->last,
+				qh->entries);
 			XPRINT("write: sleep %lux\n", &e->wr);
 			sleep(&e->wr, qisempty, qh);
 			XPRINT("write: awake\n");
@@ -1370,22 +1397,14 @@ scanpci(void)
 	p = nil;
 	while(p = pcimatch(p, 0, 0)) {
 		/*
-		 * Find UHCI controllers.  Class = 12 (serial controller),
-		 * Sub-class = 3 (USB) and Programming Interface = 0.
+		 * Find UHCI controllers (Programming Interface = 0).
 		 */
-		if(p->ccrb != 0x0C || p->ccru != 0x03)
+		if(p->ccrb != Pcibcserial || p->ccru != Pciscusb)
 			continue;
 		switch(p->ccrp){
-		case 0x00:
+		case 0:
 			io = p->mem[4].bar & ~0x0F;
 			break;
-		case 0x10:
-		case 0x20:
-			print("usb%chci: %x/%x %sport 0x%lux size 0x%x irq %d (ignored)\n",
-				(p->ccrp == 0x10? 'o': 'e'), p->vid, p->did,
-				(p->ccrp == 0x10? "": "USB 2 "),
-				p->mem[0].bar & ~0x0F, p->mem[0].size, p->intl);
-			/* fallthrough */
 		default:
 			continue;
 		}
@@ -1455,17 +1474,18 @@ reset(Usbhost *uh)
 	XPRINT("frbaseadd\t0x%.4x\nsofmod\t0x%x\nportsc1\t0x%.4x\nportsc2\t0x%.4x\n",
 		IN(Flbaseadd), inb(io+SOFMod), IN(Portsc0), IN(Portsc1));
 
-	OUT(Cmd, 0);					/* stop */
+	OUT(Cmd, 0);				/* stop */
 	while((IN(Status) & (1<<5)) == 0)	/* wait for halt */
 		;
-	OUT(Status, 0xFF);				/* clear pending interrupts */
-	pcicfgw16(p, 0xc0, 0x2000);		/* legacy support register: turn off lunacy mode */
+	OUT(Status, 0xFF);			/* clear pending interrupts */
+	/* legacy support register: turn off lunacy mode */
+	pcicfgw16(p, 0xc0, 0x2000);
 
 	if(0){
 		i = inb(io+SOFMod);
-		OUT(Cmd, 4);	/* global reset */
+		OUT(Cmd, 4);		/* global reset */
 		delay(15);
-		OUT(Cmd, 0);	/* end reset */
+		OUT(Cmd, 0);		/* end reset */
 		delay(4);
 		outb(io+SOFMod, i);
 	}
@@ -1482,27 +1502,28 @@ reset(Usbhost *uh)
 	}
 
 	/*
-	 * the last entries of the periodic (interrupt & isochronous) scheduling TD entries
-	 * points to the control queue and the bandwidth sop for bulk traffic.
-	 * this is looped following the instructions in PIIX4 errata 29773804.pdf:
-	 * a QH links to a looped but inactive TD as its sole entry,
-	 * with its head entry leading on to the bulk traffic, the last QH of which
-	 * links back to the empty QH.
+	 * the last entries of the periodic (interrupt & isochronous)
+	 * scheduling TD entries points to the control queue and the
+	 * bandwidth sop for bulk traffic.  this is looped following the
+	 * instructions in PIIX4 errata 29773804.pdf: a QH links to a
+	 * looped but inactive TD as its sole entry, with its head entry
+	 * leading on to the bulk traffic, the last QH of which links
+	 * back to the empty QH.
 	 */
 	ctlr->ctlq = allocqh(ctlr);
 	ctlr->bwsop = allocqh(ctlr);
 	ctlr->bulkq = allocqh(ctlr);
 	ctlr->recvq = allocqh(ctlr);
-	t = alloctd(ctlr);	/* inactive TD, looped */
+	t = alloctd(ctlr);		/* inactive TD, looped */
 	t->link = PCIWADDR(t);
 	ctlr->bwsop->entries = PCIWADDR(t);
 
 	ctlr->ctlq->head = PCIWADDR(ctlr->bulkq) | IsQH;
 	ctlr->bulkq->head = PCIWADDR(ctlr->recvq) | IsQH;
 	ctlr->recvq->head = PCIWADDR(ctlr->bwsop) | IsQH;
-	if (1)	/* don't use loop back */
+	if (1)				/* don't use loop back */
  		ctlr->bwsop->head = Terminate;
-	else	/* set up loop back */
+	else				/* set up loop back */
 		ctlr->bwsop->head = PCIWADDR(ctlr->bwsop) | IsQH;
 
 	ctlr->frames = xspanalloc(FRAMESIZE, FRAMESIZE, 0);
@@ -1529,6 +1550,10 @@ reset(Usbhost *uh)
 	uh->read = read;
 	uh->write = write;
 
+	uh->tokin = Utokin;
+	uh->tokout = Utokout;
+	uh->toksetup = Utoksetup;
+
 	return 0;
 }