Subject: Indigo2 eisa bus WORKING ! (embryonic support)
To: None <port-sgimips@netbsd.org>
From: pascal dameme <netinet@freesurf.fr>
List: port-sgimips
Date: 05/09/2002 17:12:56
Hi all ,

Hourra !

I finally managed to get the EISA bus of my Indigo2 (sort of) working, using
a -current snapshot as base (and adding some code into it).

I am able to ping through a 3c579 card plugged into it. (luckily this driver
does not use dma, see below).

What works:
    - eisa bus configuration & init
    - eisa interrupts registering & dispatching
What "sort of work" :
    - pio.
What does not work :
    - DMA.

Plans :
    Add DMA support, understand the endianness problem, fix it and remove
the ugly hack in the card driver, and publish the code.

Modifications summary:
   * I fixed a bug in sgimips/dev/imc.c that prevented the EISA bus from
being detected.
   * I modified the implementation of bus_space_map to be able to "see"
the EISA register space, and the EIU;
   * I added code into sgimips/eisa/eisa_machdep.c to initialize the EIU
and the EISA chipset, to allocate and to dispatch eisa interrupts.

Open problems :

- 32 bit wide pio access (using bus_space_read/write)  done by the network
card are byte swapped, whereas 16 bit access  are not.
I can't figure out why ?? I  forced the card driver into 8 bit  access to
circumvent  the problem.
Anybody understands why only 32 bit access are byte swapped ?
From what I understood (after reading the IRIX device driver programming
manual) , the eisa bus is little endian, and drivers are supposed to
accomodate ... But from what I see, only 32 bit access look like little
endian. I don't know if this is a side effect of the EIU, the EISA chipset
or the card itself.
Moreover, I don't know if there is any way to modify this behavior.

Please, if someone has (or knows someone who has) a clue about that, contact
me. Also, does the ep driver works "as is" for other big-endian machines ?

 - DMA support. Need to incorporate the code. I plan to grab it from the
i386 architecture. I suppose the above endianess problem will byte me .

For the record, here is the dmesg of the very first eisa friendly
kernel I managed to compile (debug printfs and all):

Back to the code,
Pascal.

----
NetBSD 1.5ZC (EISA) #36: Tue May  7 01:04:18 UTC 2002
    pascal@glyneth:/usr/src/syssrc/sys/arch/sgimips/compile/EISA
    65536 KB memory, 57624 KB free, 768 KB for ARCS, 3376 KB in 844 buffers
    mainbus0 (root): SGI-IP22 [SGI, 6908b576], 1 processor
    cpu0 at mainbus0: QED R4600 Orion CPU (0x2020) Rev. 2.0 with built-in
FPU Rev. 2.0
    cpu0: 16KB/32B 2-way set-associative L1 Instruction cache, 48 TLB
entries
    cpu0: 16KB/32B 2-way set-associative write-back L1 Data cache
    cpu0: 512KB/32B direct-mapped write-back L2 Data cache
    cpu0: disabling IP22 SysAD L2 cache
    imc0 at mainbus0 addr 0x1fa00000
    imc0: Revision 3, EISA bus present
    eisa0 at imc0
    ep0 at eisa0 slot 2: 3Com 3C579 Ethernet
    eisa : new mask=fffffbfb
    ep0: interrupting at irq 10
    ep0: address 00:20:af:eb:7a:76, 8KB byte-wide FIFO, 5:3 Rx:Tx split
    ep0: 10base5, 10base2 (default 10base2)
    gio0 at imc0
    hpc0 at gio0 addr 0x1fb80000: SGI HPC3
    zsc0 at hpc0 offset 0x59830
    zstty0 at zsc0 channel 1 (console i/o)
    zstty1 at zsc0 channel 0
    sq0 at hpc0 offset 0x54000: SGI Seeq 80c03
    sq0: Ethernet address 08:00:69:08:b5:76
    wdsc0 at hpc0 offset 0x44000: WD33C93B SCSI, rev=0, target 7
    scsibus0 at wdsc0: 8 targets, 8 luns per target
    wdsc1 at hpc0 offset 0x4c000: WD33C93B SCSI, rev=0, target 7
    scsibus1 at wdsc1: 8 targets, 8 luns per target
    dsclock0 at hpc0 offset 0x60000
    biomask 07 netmask 07 ttymask 0f clockmask bf
    scsibus0: waiting 5 seconds for devices to settle...
    sd0 at scsibus0 target 1 lun 0: <SGI, IBM  DFHSS2F, 1111> SCSI2 0/direct
fixed
    sd0: 2150 MB, 4390 cyl, 8 head, 125 sec, 512 bytes/sect x 4404489
sectors
    sd0: sync (200.0ns offset 12), 8-bit (5.000MB/s) transfers, tagged
queueing
    sd1 at scsibus0 target 2 lun 0: <SGI, SeagateST12550N, 2703> SCSI2
0/direct fixed
    sd1: 2048 MB, 2708 cyl, 19 head, 81 sec, 512 bytes/sect x 4195116
sectors
    sd1: sync (200.0ns offset 12), 8-bit (5.000MB/s) transfers, tagged
queueing
    cd0 at scsibus0 target 3 lun 0: <TOSHIBA, CD-ROM XM-3401TA, 1534> SCSI2
5/cdrom removable
    cd0: async, 8-bit transfers
    scsibus1: waiting 5 seconds for devices to settle...
    boot device: sd1
    root on sd1a dumps on sd1b
    mountroot: trying cd9660...
    mountroot: trying nfs...
    mountroot: trying ffs...
    readclock: 2002/5/7/1/5/40
    root file system type: ffs
    init: copying out flags `-s' 3
    init: copying out path `/sbin/init' 11
    Enter pathname of shell or RETURN for sh:
    We recommend creating a non-root account and using su(1) for root
access.
    # stty erase ^H
    # ifconfig ep0 192.168.70.56 debug media 10base5 up
    # ping -n 192.168.70.1
    PING 1eisabus_intr : eiuintr=a dma1=0 dma2=0
    ep0: intr RX_COMPLETE
    ep0: intr
    ep0: intr latch cleared
    called 0xc0020fc0 : res=1
    eisabus_intr : eiuintr=a dma1=0 dma2=0
    ep0: intr RX_COMPLETE
    ep0: intr
    ep0: intr latch cleared
    called 0xc0020fc0 : res=1
    92.168.70.1 (192.168.70.1): 56 data bytes
    64 bytes from 192.168.70.1: icmp_seq=0 ttl=255 time=16.402 ms
    eisabus_intr : eiuintr=a dma1=0 dma2=0
    ep0: intr RX_COMPLETE
    ep0: intr
    ep0: intr latch cleared
    called 0xc0020fc0 : res=1
    4 bytes from 192.168.70.1: icmp_seq=1 ttl=255 time=10.341 ms
    eisabus_intr : eiuintr=a dma1=0 dma2=0
    ep0: intr RX_COMPLETE
    ep0: intr
    ep0: intr latch cleared
    called 0xc0020fc0 : res=1
    4 bytes from 192.168.70.1: icmp_seq=2 ttl=255 time=10.349 ms
    eisabus_intr : eiuintr=a dma1=0 dma2=0
    ep0: intr RX_COMPLETE
    ep0: intr
    ep0: intr latch cleared
    called 0xc0020fc0 : res=1
    64 bytes from 192.168.70.1: icmp_seq=3 ttl=255 time=10.414 ms
    eisabus_intr : eiuintr=a dma1=0 dma2=0
    ep0: intr RX_COMPLETE
    ep0: intr
    ep0: intr latch cleared
    called 0xc0020fc0 : res=1
    64 bytes from 192.168.70.1: icmp_seq=4 ttl=255 time=10.346 ms
    eisabus_intr : eiuintr=a dma1=0 dma2=0
    ep0: intr RX_COMPLETE
    ep0: intr
    ep0: intr latch cleared
    called 0xc0020fc0 : res=1
    ^C
    ----192.168.70.1 PING Statistics----
    5 packets transmitted, 5 packets received, 0.0% packet loss
    round-trip min/avg/max/stddev = 10.341/11.570/16.402/2.701 ms