Subject: osiop and the 53c700
To: None <tech-kern@netbsd.org>
From: Matt Fredette <fredette@theory.lcs.mit.edu>
List: tech-kern
Date: 07/10/2002 13:23:05
Hi.  Lots of hp700 machines have a 53c700 SCSI chip in them.  NetBSD's
osiop driver supports the 53c710, and the two chips are so similar I 
thought it made the most sense to expand osiop to support the 53c700.

Most notably, the scripts for the 53c700 (dev/microcode/siop/oosiop.ss) 
and the 53c710 (dev/microcode/siop/osiop.ss) correspond line-for-line.  
The modified osiop driver sees both scripts in the same way, finding the
same subroutines at the same addresses.

The most significant architectural difference between the two chips is 
the 53c710's memory-indirect addressing mode.  The 53c710 has a register 
that the unmodified osiop driver fills with a pointer to an array of 
<pointer, length> pairs for the various buffers used in a SCSI command.

In my patch I simply abstract out the loading of this register into a 
function.  On a 53c710, it does the normal register load.  On a 53c700, 
the <pointer, length> pairs are instead broken out and copied into the 
appropriate instructions in the script.

Other differences between the two chips: the 53c700 doesn't have relative
jumps (easily handled by relocating the script at attach time), and a 
handful of registers and bits have moved.

This patch also supports systems where the 53c7[01]0 is not the same 
endianness as the CPU, as is often the case on hp700, and may be the 
case on other systems.

One shortcoming of my patch is that disconnect/reselect on the 53c700
is missing; however I've read things that hint it may not be possible
to do perfect disconnect/reselect on this chip anyways.

So, here's the patch and the big questions:

ftp://ftp.netbsd.org/pub/NetBSD/misc/fredette/osiop/osiop-20020710.diff

Is this patch any good?  Does a single driver for both chips sound right 
here?  ur@netbsd.org has an almost-finished 53c700-only driver, should 
we use that?

Matt

-- 
Matt Fredette