Subject: Re: 98658 SCSI adaptor and MI SCSI
To: None <port-hp300@netbsd.org>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: port-hp300
Date: 05/20/2003 00:36:01
Hi,

<200110132238.f9DMcCk08721@mirage.ceres.dti.ne.jp>
I wrote:

> Today I'm playing with MI SCSI driver for 98658 adaptor on HP382.
> I copy and modify sys/dev/ic/mb89352.c, and it just works
> with PIO and polling.

Today I'm playing with MI SCSI driver for 98658 adaptor on HP382 again,
and now it seems working with interrupt driven DMA:

---
>> NetBSD/hp300 Primary Boot, Revision 1.12
>> (tsutsui@delica, Wed Oct 10 02:16:00 JST 2001)
>> HP 9000/380 SPU
>> Enter "reset" to reset system.
Boot: [[[sd1a:]netbsd][-a][-c][-d][-s][-v][-q]] :- -s
1344936+48960+190432 [244112+101170]=0x1d9378
Start @ 0xfe803400 [1=0xfe986cc8-0x1d9378]...
Entry point: 0xfe803400
Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
    The NetBSD Foundation, Inc.  All rights reserved.
Copyright (c) 1982, 1986, 1989, 1991, 1993
    The Regents of the University of California.  All rights reserved.

NetBSD 1.6T (DELICA) #60: Mon May 19 23:42:42 JST 2003
	tsutsui@mirage:/usr/src/sys/arch/hp300/compile/DELICA
HP 9000/380 (25MHz MC68040 CPU+MMU+FPU, 4k on-chip physical I/D caches)
cpu: delay divisor 30, mmuid 11
total memory = 24564 KB
avail memory = 19552 KB
using 332 buffers containing 1328 KB of memory
mainbus0 (root)
intio0 at mainbus0
rtc0 at intio0 addr 0x420000
hil0 at intio0 addr 0x428000
dma0 at intio0 addr 0x500000: 98620C, 2 channels, 32-bit DMA
fb at intio0 addr 0x560000 not configured
dio0 at mainbus0
nhpib0 at dio0 scode 7 ipl 3: internal HP-IB
hpibbus0 at nhpib0
ppi0 at hpibbus0 slave 5 punit 0
WARNING: select code size unknown for id = 0x1 secid = 0x0
device id = 0x1 secid = 0x0 at dio0 scode 8 not configured
dca0 at dio0 scode 9 ipl 5: console, working fifo
internal parallel at dio0 scode 12 not configured
spc0 at dio0 scode 14 ipl 4, 32 bit DMA
scsibus0 at spc0: 8 targets, 8 luns per target
le0 at dio0 scode 21 ipl 5: address 08:00:09:18:d8:d2
le0: 8 receive buffers, 2 transmit buffers
WARNING: select code size unknown for id = 0x39 secid = 0x10
device id = 0x39 secid = 0x10 at dio0 scode 132 not configured
WARNING: select code size unknown for id = 0x39 secid = 0x10
device id = 0x39 secid = 0x10 at dio0 scode 133 not configured
WARNING: select code size unknown for id = 0x1 secid = 0x0
device id = 0x1 secid = 0x0 at dio0 scode 134 not configured
WARNING: select code size unknown for id = 0x1 secid = 0x0
device id = 0x1 secid = 0x0 at dio0 scode 135 not configured
interrupt levels: bio = 4, net = 5, tty = 5
hilconfig: unknown keyboard type 0x2, using default
hil0 device 1: US ASCII keyboard
scsibus0: waiting 2 seconds for devices to settle...
sd0 at scsibus0 target 0 lun 0: <TEAC, FC-1     HF   07, RV A> disk removable
sd0: 1280 KB, 80 cyl, 2 head, 32 sec, 256 bytes/sect x 5120 sectors
sd1 at scsibus0 target 1 lun 0: <CONNER, CP3500-540MB-3.5, 3236> disk fixed
sd1: 518 MB, 1807 cyl, 12 head, 49 sec, 512 bytes/sect x 1062516 sectors
sd2 at scsibus0 target 5 lun 0: <FUJITSU, M1606S-512, 6237> disk fixed
sd2: 1041 MB, 3457 cyl, 6 head, 102 sec, 512 bytes/sect x 2131992 sectors
boot device: sd1
root on sd1a dumps on sd1b
root file system type: ffs
Enter pathname of shell or RETURN for /bin/sh: 
We recommend creating a non-root account and using su(1) for root access.
# dd if=/dev/rsd1a of=/dev/null bs=64k
362+1 records in
362+1 records out
23783424 bytes transferred in 14.297 secs (1663525 bytes/sec)
# dd if=/dev/rsd2a of=/dev/null bs=64k
14343+1 records in
14343+1 records out
940032000 bytes transferred in 526.891 secs (1784110 bytes/sec)
# fsck -fp
/dev/rsd1a: 1094 files, 14196 used, 8213 free (213 frags, 1000 blocks, 0.0% fragmentation)
/dev/rsd1f: 311 files, 2068 used, 14947 free (123 frags, 1853 blocks, 0.7% fragmentation)
/dev/rsd1g: 14768 files, 206813 used, 238187 free (11987 frags, 28275 blocks, 2.7% fragmentation)
/dev/rsd2a: 10147 files, 117954 used, 771693 free (6221 frags, 95684 blocks, 0.7% fragmentation)
# halt
May 19 15:04:25 halt: halted by root
May 19 15:04:26 init: kernel security level changed from 0 to 1
syncing disks... done
System halted.  Hit any key to reboot.
---

Ugly patch is here:
http://www.ceres.dti.ne.jp/~tsutsui/netbsd/hp300-MI-SCSI-20030519.diff

...and there are still many TODO:
- needs tests on more heavy DMA load (with rd disks on HP-IB)
- sync transfer
- how to handle COMPAT_NOLABEL
- re-think how to add DMA hooks to MI mb89352 driver
- bus_space(9) "stride" method (i.e. sparse space access) to use
  MI sys/dev/ic/mb89352.c
 etc. etc.

---
Izumi Tsutsui
tsutsui@ceres.dti.ne.jp