Subject: USB (and other weird things) on a PWS500au
To: None <port-alpha@netbsd.org>
From: Nathan J. Williams <nathanw@MIT.EDU>
List: port-alpha
Date: 03/14/2000 02:36:42
Spurred on my my recent success with USB on my pc164, I decided to
give it a whirl on a PWS500au I have access to - a genuine Deq machine
with USB[1]. 

I first stumbled over the code in dec_550.c:dec_550_intr_map() that
punts mapping an interrupt for PCI bus 0 device 7 function *. I tried
changing that to not punt for function 3, the USB function. 
At this point I started really losing; the interrupt line from
pa_attach args had the totally unreasonable value 234 (though the
intr_pin was 1, which is okay).

I noticed that the SRM ISA configuration table had an entry for USB,
which seemed a trifle odd, as it's not a ISA device. It was listed [2]
with IRQ 10 and no other resources.

I hacked up dec_550_inter_map() to use various other interrupt line
values (3, 2, 1, 0). I expected intersting stuff at 2, since there's
an offset of 8, giving 10, the value in the isacfg table. Instead, I
didn't get anything until 0 (the same value used by the on-board ethernet):

ohci0 at pci0 dev 7 function 3: vendor 0x1080 product 0xc693 (rev. 0x00)
dec_550_intr_map: about to map bus 0 dev 7 func 3 pin 1 line 234
ohci0: interrupting at dec 550 irq 8
ohci0: OHCI version 1.0, legacy support
usb0 at ohci0: USB revision 1.0
uhub0 at usb0
uhub0: vendor 0x1080 OHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub0: 2 ports with 2 removable, self powered

However, it didn't notice the one device I had handy (a Sony Vaio USB
floppy) when it was plugged in. Somewhat unsurprisingly, when I tried
to use tlp0 at the same interrupt, the ohci caused problems and panic'd.

Questions:

* What's up with the interrupt line having a bad value? I'm wondering
  if SRM is just bypassing device 7, since it's mostly used in Digital
  Unix for the IDE controller, which has the wacky ISA-compat
  interrupts and I/O mapping. 

* If SRM is ignoring it, how should we (a) detect this and (b) pick
  another interrupt to use? I'm still unclear on why the interrupt
  lines 3, 2, and 1 failed, but I haven't yet gone into the guts of
  the interrupt controller, either. 

        - Nathan

1. The D/UX 4.0 USB support seems pretty superficial - it probes the
   controller, but nothing else, and doesn't notice devices being
   plugged or unplugged.

2. Full config output:

>>>show config

Firmware
SRM Console:    V7.1-3
ARC Console:    5.70
PALcode:        VMS PALcode V1.20-16, OSF PALcode V1.22-18
SROM Version:   v5.90

Processor
DECchip (tm) 21164A-2   Pass   500 MHz  96 KBytes SCache 
0 MB BCache
PYXIS ASIC Pass 257

MEMORY


Memory Size = 128Mb
Bank      Size/Sets   Base Addr
------    ----------  ---------
   0        128Mb      00000000


BCache Size = 0Mb

Tested Memory =  128Mbytes

PCI Bus 
     Bus 00  Slot 03: Digital Semiconductor 21143 Network Controller
                                   ewa0.0.0.3.0          08-00-2B-86-8D-A6   

     Bus 00  Slot 07: Cypress PCI Peripheral Controller
                                                                             

     Bus 00  Slot 07: Function 1: PCI IDE  
                                                                             

     Bus 00  Slot 07: Function 2: PCI IDE  
                                                                             
                                   dkb0.0.0.207.0         Compaq CRD-8322B    

     Bus 00  Slot 07: PCI USB
     Bus 00  Slot 11: Power Storm 300
     Bus 00  Slot 20: DECchip 21152 PCI to PCI Bridge
       Bus 01  Slot 04: ISP1040 Scsi Controller
                                   pkc0.7.0.1004.0       SCSI Bus ID 7       
                                   dkc0.0.0.1004.0        COMPAQ BB00921B91   

ISA
Slot    Device  Name            Type         Enabled  BaseAddr  IRQ     DMA
0
        0       MOUSE           Embedded        Yes     60      12
        1       KBD             Embedded        Yes     60      1
        2       COM1            Embedded        Yes     3f8     4
        3       COM2            Embedded        Yes     2f8     3
        4       LPT1            Embedded        Yes     3bc     7
        5       FLOPPY          Embedded        Yes     3f0     6       2
        6       EIDE            Embedded        Yes     1f0     14
                                                        3f6     15
                                                        170
                                                        376
        7       ES1888          Embedded        Yes     220     5       1
                                                                        5
        8       USB             Embedded        Yes             10


[3] Full dmesg output (with slightly hacked interrupt mapping routine)

NetBSD 1.4U (INSTALL) #8: Tue Mar 14 02:21:28 EST 2000
    nathanw@daffy-duck.putnam:/u1/nbsd/src/sys/arch/alpha/compile/INSTALL
Digital Personal WorkStation 500au, 500MHz
8192 byte page size, 1 processor.
total memory = 128 MB
(1952 KB reserved for PROM, 126 MB used by NetBSD)
avail memory = 109 MB
using 819 buffers containing 6552 KB of memory
mainbus0 (root)
cpu0 at mainbus0: ID 0 (primary), 21164A-0 (unknown minor type 0)
cia0 at mainbus0: DECchip 2117x Core Logic Chipset (Pyxis), pass 1
cia0: extended capabilities: 1<BWEN>
cia0: using BWX for PCI config access
pci0 at cia0 bus 0
pci0: i/o space, memory space enabled, rd/line, rd/mult, wr/inv ok
tlp0 at pci0 dev 3 function 0: DECchip 21143 Ethernet, pass 3.0
dec_550_intr_map: about to map bus 0 dev 3 func 0 pin 1 line 0
tlp0: interrupting at dec 550 irq 8
tlp0: DEC , Ethernet address 08:00:2b:86:8d:a6
nsphy0 at tlp0 phy 5: DP83840 10/100 media interface, rev. 1
nsphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
tlp0: 10baseT, 10baseT-FDX, 10base2, 10base5
sio0 at pci0 dev 7 function 0: vendor 0x1080 product 0xc693 (rev. 0x00)
pciide0 at pci0 dev 7 function 1: Contaq Microsystems CY82C693 IDE Controller
pciide0: device disabled (at device)
pciide1 at pci0 dev 7 function 2: Contaq Microsystems CY82C693 IDE Controller
pciide1: hardware does not support DMA
pciide1: primary channel wired to compatibility mode
atapibus0 at pciide1 channel 0
cd0 at atapibus0 drive 0: <Compaq  CRD-8322B, 1999/02/11, 1.07> type 5 cdrom removable
cd0: 32-bits data port
cd0: drive supports PIO mode 4, DMA mode 2
cd0(pciide1:0:0): using PIO mode 4
ohci0 at pci0 dev 7 function 3: vendor 0x1080 product 0xc693 (rev. 0x00)
dec_550_intr_map: about to map bus 0 dev 7 func 3 pin 1 line 234
ohci0: interrupting at dec 550 irq 8
ohci0: OHCI version 1.0, legacy support
usb0 at ohci0: USB revision 1.0
uhub0 at usb0
uhub0: vendor 0x1080 OHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub0: 2 ports with 2 removable, self powered
vga0 at pci0 dev 11 function 0: vendor 0x10ba product 0x0304 (rev. 0x00)
wsdisplay0 at vga0
ppb0 at pci0 dev 20 function 0: vendor 0x1011 product 0x0024 (rev. 0x03)
pci1 at ppb0 bus 1
pci1: i/o space, memory space enabled, rd/line, wr/inv ok
isp0 at pci1 dev 4 function 0
dec_550_intr_map: about to map bus 0 dev 20 func 0 pin 1 line 3
isp0: interrupting at dec 550 irq 11
scsibus0 at isp0: 16 targets, 8 luns per target
isa0 at sio0
com0 at isa0 port 0x3f8-0x3ff irq 4: ns16550a, working fifo
com0: console
com1 at isa0 port 0x2f8-0x2ff irq 3: ns16550a, working fifo
pckbc0 at isa0 port 0x60-0x64
pckbd0 at pckbc0 (kbd slot)
pckbc0: using irq 1 for kbd slot
wskbd0 at pckbd0
pms0 at pckbc0 (aux slot)
pckbc0: using irq 12 for aux slot
wsmouse0 at pms0
lpt0 at isa0 port 0x3bc-0x3bf irq 7
fdc0 at isa0 port 0x3f0-0x3f7 irq 6 drq 2
fd0 at fdc0 drive 0: 1.44MB, 80 cyl, 2 head, 18 sec
mcclock0 at isa0 port 0x70-0x71: mc146818 or compatible
<3>stray isa irq 4
scsibus0: waiting 2 seconds for devices to settle...
isp0: SCSI bus 0 reset detected
sd0 at scsibus0 targ 0 lun 0: <COMPAQ, BB00921B91, 3B05> SCSI2 0/direct fixed
sd0: 8678 MB, 5273 cyl, 20 head, 168 sec, 512 bytes/sect x 17773524 sectors
md0: internal 4650K image area
WARNING: can't figure what device matches "DVA 1 0 0 0 0 0 0"
root on md0a dumps on md0b
root file system type: ffs