From owner-freebsd-scsi Wed Jan 29 15:53:03 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id PAA00715 for freebsd-scsi-outgoing; Wed, 29 Jan 1997 15:53:03 -0800 (PST) Received: from alpo.whistle.com (alpo.whistle.com [207.76.204.38]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id PAA00710 for ; Wed, 29 Jan 1997 15:53:00 -0800 (PST) Received: from current1.whistle.com (current1.whistle.com [207.76.205.22]) by alpo.whistle.com (8.8.4/8.8.4) with SMTP id PAA27486; Wed, 29 Jan 1997 15:50:27 -0800 (PST) Message-ID: <32EFE1E2.ABD322C@whistle.com> Date: Wed, 29 Jan 1997 15:48:50 -0800 From: Julian Elischer Organization: Whistle Communications X-Mailer: Mozilla 3.0Gold (X11; I; FreeBSD 2.2-CURRENT i386) MIME-Version: 1.0 To: Simon Shapiro CC: freebsd-scsi@FreeBSD.ORG Subject: Re: XXXminpys question References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-scsi@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk Simon Shapiro wrote: > > When/how is the minphys entry point in an HBA driver called? the adapter has a minphys that cuts down any transfer it couldn't do. It's adapter dependent of course. devices that can't handle their transfer being done in two parts should notice that this has happenned and abort the operation. (e.g. some tape drives). the adapter minphys is called from the genereic scsi minphys() scsi_minphys() in scsi_driver.c which is called by the device specific driver ( e.g sd.c) in the strategy() function. > All we see in the bt and ahc drivers is a comparison between a buf and a > constant. and a truncation of the transfer.. the higher level code will notice on return that not all the data was transfered an dwill re-try for the rest. > > In the driver we are writing now, mulltiple controllers, all run with the > same driver, can EACH have their own minphys.? Yes, you can put any code you wish in there. it could be a comparison with a field in the device's local structure.. > Actually, like others, it is > limited by the scatter-gather DMA engine. The cheapest HBA can have 16 > segments in the DBA S/G. The largest can have 8192 currently. May grow > larger. 16, yuk.. even the aha had 17, the reason for th extra one is to allow a guaranteed ability to transfer 64K, as the first and lat pages migh tbe only partial in the casae of a non-alligned transfer.. the bt has LOTS and the aha has 17. note however htat the present limit inside the kernel is for 64K trnasfers so you will not get a request for > than that. This should be fixed but is not yet.. > > What we need, in addition to the clarification above is these answers: > > a. Does minphys get called for each I/O request, with that I/O's own buf? YES. that's how it can truncate the transfer to break it up to multiple transfers. > b. Does minphys get called, at initialization time, once per HBA? NO > c. Does minphys get called only once for ``the driver''? NO > If A is true, we can (nasty) extract the HBA from the device data in buf. you mean "can we"? no and yes.. you could trivially extract it from bp->b_driver2 where the generic scsi code stores it. It is not ALWAYS htere however. It would be a trivial change for scsi_minphys() which has that information to make sure it is always set before calling the HBA minphys. The information is in the scsi_link structure. bp->b_driver2 is used to hold a pointer for this some times and scsi_minphys has a pointer to this. bp->b_driver2 = sc->link; would be all that is needed to add to scsi_minphys. > If B is true, we need some indication in calling minphys as to which HBA. it's not true. > Ic C is true, we have a problem. In that case, can we manipilate the buf it's not true > structure when the SCSI command is called in and do only partial I/O by > manipulating the b_count and b_resid fields? that's what the system already does > > This is sort of a stalling stump for us so soon response will be > appreciated... > > Thanx! > > Simon julian