Re: [hatari-devel] SCSI emulation

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Hello all,

maybe it is worth having a look at Previous' scsi.c: 

https://sourceforge.net/p/previous/code/HEAD/tree/trunk/src/scsi.c

There are some mode pages emulated, including rigid disk geometry page. It is obviously good enough to make NeXTstep happy. Feel free to copy this. I wrote it on my own using documentation of some old seagate drive.

Best wishes,

Andreas

Am 16.09.2018 um 08:49 schrieb Uwe Seimet <Uwe.Seimet@xxxxxxxxx>:

> Hi Thomas,
> 
>>> Just for fun I hacked the MODE SENSE code in hdc.c to not report an
>>> error for an unknown mode page. The ASV loader now loads several
>>> hundred sectors, which I assume is the complete kernel.) The double
>>> bus fault in the attached screenshot vanished after enabling MMU
>>> emulation and soft floating point support. Now, after displaying the
>>> boot messages, there is a warm boot, without any console output that
>>> would indicate what went wrong.
>> 
>> Wow, that's more than I expected already. Do you have any information
>> about that missing MODE SENSE page? Would it make sense to emulate it
>> in Hatari, or is it too specific for that certain drive?
> 
> I only know the CDB, which is 0x1a,0x00,0x04,0x00,0x40,0x00, i.e. it's
> the rigid disk drive geometry page, description see below (copied from
> the SCSI-2 specification).
> Because the boot process continued when I simply commented out the return
> statement in line 315 of hdc.c the data returned may not even have relevance.
> With SCSI drives the actual geometry does not matter anyway as long as the
> driver justreads and writes. The only non-exotic fields in this mage page are
> the cylinder and heads counts, and if Hatari just returns some meaningful
> values here, just like I guess it does for IDE drives, the emulation of this
> mode page should be fine.
> 
> Best regards
> 
> Uwe
> 
> ---
> 
> 9.3.3.7 Rigid disk drive geometry page
> 
> The rigid disk drive geometry page (see table 171) specifies parameters
> for direct-access devices employing a rigid disk drive.
> 
>                  Table 171 - Rigid disk drive geometry page
> +=====-========-========-========-========-========-========-========-========+
> |  Bit|   7    |   6    |   5    |   4    |   3    |   2    |   1    |   0    |
> |Byte |        |        |        |        |        |        |        |        |
> |=====+========+========+=====================================================|
> | 0   |   PS   |Reserved|         Page code (04h)                             |
> |-----+-----------------------------------------------------------------------|
> | 1   |                           Page length (16h)                           |
> |-----+-----------------------------------------------------------------------|
> | 2   | (MSB)                                                                 |
> |- - -+---                        Number of cylinders                      ---|
> | 4   |                                                                 (LSB) |
> |-----+-----------------------------------------------------------------------|
> | 5   |                           Number of heads                             |
> |-----+-----------------------------------------------------------------------|
> | 6   | (MSB)                                                                 |
> |- - -+---               Starting cylinder-write precompensation           ---|
> | 8   |                                                                 (LSB) |
> |-----+-----------------------------------------------------------------------|
> | 9   | (MSB)                                                                 |
> |- - -+---               Starting cylinder-reduced write current           ---|
> | 11  |                                                                 (LSB) |
> |-----+-----------------------------------------------------------------------|
> | 12  | (MSB)                                                                 |
> |-----+---                        Drive step rate                          ---|
> | 13  |                                                                 (LSB) |
> |-----+-----------------------------------------------------------------------|
> | 14  | (MSB)                                                                 |
> |- - -+---                        Landing zone cylinder                    ---|
> | 16  |                                                                 (LSB) |
> |-----+-----------------------------------------------------------------------|
> | 17  |                           Reserved                  |       RPL       |
> |-----+-----------------------------------------------------------------------|
> | 18  |                           Rotational offset                           |
> |-----+-----------------------------------------------------------------------|
> | 19  |                           Reserved                                    |
> |-----+-----------------------------------------------------------------------|
> | 20  | (MSB)                                                                 |
> |-----+---                        Medium rotation rate                     ---|
> | 21  |                                                                 (LSB) |
> |-----+-----------------------------------------------------------------------|
> | 22  |                           Reserved                                    |
> |-----+-----------------------------------------------------------------------|
> | 23  |                           Reserved                                    |
> +=============================================================================+
> 
> 
> The parameters savable (PS) bit is only used with the MODE SENSE
> command.  This bit is reserved with the MODE SELECT command.  A PS bit
> of one indicates that the target is capable of saving the page in a
> non-volatile vendor-specific location.
> 
>   NOTE 135 This page is intended to define drive geometry parameters of
>   rigid disk drives.  It may be used for other devices if applicable.
> 
> The number of cylinders field defines the number of physical cylinders
> used for data storage.  
> 
> The number of heads field defines the physical number of heads used for
> data storage.  Heads used exclusively for servo information are
> excluded. 
> 
> The starting cylinder for write precompensation field is the physical
> cylinder at which write precompensation is to begin.  The first
> cylinder is number zero.  If the starting cylinder for write
> precompensation is equal to the value in the number of cylinders field,
> write precompensation shall be disabled by the target.
> 
> The starting cylinder for reduced write current field is the physical
> cylinder at which write current is reduced.  The first cylinder is
> number zero.  If the starting cylinder for reduced write current is
> equal to the value in the number of cylinders field, reduced write
> current shall be disabled by the target.
> 
> The drive step rate field indicates the step rate in 100 ns increments.
> The target shall use the drive step rate, greater than or equal to the
> drive step rate specified.  If the target rounds this field it shall
> terminate the command as described in 7.5.4.  A value of zero requests
> the target to set its default value.
> 
> The landing zone cylinder field indicates two's complement location
> where the target shall position the disk heads.  A negative value
> indicates that the heads are positioned below cylinder zero by that
> number of cylinders.  A positive value greater than the number of
> cylinders indicates that the heads are positioned beyond the cylinders
> used for data storage at the cylinder location specified.  A zero
> indicates that the default should be used.
> 
> The rotational position locking (RPL) field is used for spindle
> synchronization as defined in table 172.  See K of the ANSI X3.170A-
> 1991 for further information on synchronized spindles.
> 
>                   Table 172 - Rotational position locking
> +=======-=====================================================================+
> |  RPL  |  Description                                                        |
> |-------+---------------------------------------------------------------------|
> |  00b  |  Indicates that spindle synchronization is disabled or not supported|
> |  01b  |  The target operates as a synchronized-spindle slave                |
> |  10b  |  The target operates as a synchronized-spindle master               |
> |  11b  |  The target operates as a synchronized-spindle master control       |
> +=============================================================================+
> 
> 
>   NOTE 136 The signals and connectors used for rotational position locking
>   are external to the SCSI bus and are not part of this International
>   Standard.
> 
> If a target fails to achieve synchronization it shall create a unit
> attention condition to all initiators.  The sense key shall be set to
> UNIT ATTENTION and the additional sense code set to RPL STATUS CHANGE. 
> 
> 
> If subsequent to achieving synchronization the target detects a change
> of synchronization:
>   a)     and, if the logical unit is not presently executing an I/O
>          process for the initiator, the target shall create a unit
>          attention condition.  The sense key shall be set to UNIT
>          ATTENTION and the additional sense code set to RPL STATUS CHANGE.
>   b)     and, if the logical unit is presently executing an I/O process
>          and no other error occurs, then the target shall return CHECK
>          CONDITION status.  The sense key shall be set to RECOVERED ERROR
>          if the target is able to complete the I/O process or HARDWARE
>          ERROR if the target is unable to complete the I/O process.  The
>          additional sense code is set to RPL STATUS CHANGE.
> 
> The rotational offset indicates the amount of rotational skew that the
> target shall use when synchronized.  The rotational skew is applied in
> the retarded direction (lagging the synchronized spindle master
> control).  The value in the field is the numerator of a fractional
> multiplier that has 256 as its denominator (e.g. a value of 128
> indicates a one-half revolution skew).  A value of zero indicates that
> rotational offset shall not be used.  This value may be rounded as
> defined in 7.5.4.  The rotational offset is not used when a target is
> configured as synchronized-spindle master. 
> 
> The medium rotation rate indicates the speed at which the medium
> rotates.  The unit of measure is rotations per minute (e.g. 3 600 rpm). 
> 
> 
> 




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/