Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!mips!daver!bungi.com!news From: culberts@hplwbc.hpl.hp.com (Bruce Culbertson) Newsgroups: comp.sys.nsc.32k Subject: Re: SCSI Question. Message-ID: <9104242032.AA15808@hplwbc.hpl.hp.com> Date: 24 Apr 91 20:32:19 GMT Sender: news@daver.bungi.com Lines: 42 Approved: news@daver.bungi.com > I noticed in Bruce's SCSI driver that it says that SCSI always transfer > multiples > of four bytes. Is this true? > *** Randy Hyde This is only an issue when tranferring from the SCSI device to the pc532 (a "read" phase of a SCSI command). Tranfers in the other direction are always the correct length. The SCSI controller's data register, from the CPU's point of view, is just like ordinary memory. When the CPU tries to read an address which is mapped to the data register, it first tries to find the value in the cache. The controller software has been carefully written to insure that the values are never found in the cache -- a read always results in a cache miss and, hence, the controller register actually gets read. On a cache miss, the CPU always fills an entire cache line (4 bytes), regardless of the size of the object wanted. Hence, groups of four bytes are always read from the controller. This does not mean that the SCSI device on the other side of the SCSI bus has to send four bytes. If the SCSI device sends, say, two bytes, then those two bytes plus two garbage bytes will be read by the CPU when it fills the cache line. Study the logic driving the CPU /RDY signal to see how this happens. To prevent SCSI read transfers from ending prematurely, movd instructions (more precisely, instructions operating on four byte objects) should be used to read the SCSI controller data register. This is explained in the comments in scsi_8490.c. Hence, you should provide a buffer which is a multiple of four bytes to receive a read transfer, even if you are expecting a smaller transfer. > Is this why I'm having troubles when I'm > attempting to transfer only 10 bytes for the read command? I doubt it. Lots of people have Minix configured to do extended read commands. I use the six byte (obsolete) read command on my obsolete disk. I just noticed that the monitor (as opposed to Minix) always transfers multiples of four bytes, even on the write phases. Shouldn't matter, though. The SCSI controller just stuffs the extra data into the proverbial bit-bucket. Bruce Culbertson