English Amiga Board


Go Back   English Amiga Board > Support > support.WinUAE

 
 
Thread Tools
Old 23 May 2017, 22:59   #1
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 3,334
Trouble setting up A2090A + ST-506 drive

I'm trying to get an emulated A2000 + A2090A + ST-506 drive config working, without much luck so far.

In hardfile settings, I set drive to ST-506 #1. WinUAE sets the "drive type" to SASI CHS and that's not changeable (you can select another type in the drop-down but it still says SASI CHS). Note that for the A2090 controller, ST-506 drives are accessed using SCSI-like commands (LBA not C/H/S values in the command block).

I created an HDF with 615×4×17 sectors, the size of a Miniscribe 8425. Booted from A2090A-Miniscribe8425.dms

Prep seems to get stuck in a loop, eventually repeating these lines over and over:
SCSIEMU HD 0: 0A.00.00.01.87.00.00.00.00.00.00.00 CMDLEN=6 DATA=0000000007531D10
-> DATAOUT=69120 ST=0 SENSELEN=0 REPLYLEN=0


Config uploaded to
Code:
https://www.media!fire.com/?lsjbd5s2jsj78mx
Boot A2090A-Miniscribe8425.dms, open Shell, do
Mount RES0: FROM ReInstall:MountList.HD
Prep RES0:

Choose ST-506, choose Miniscribe 8425 from list. Default answers, eventually answer Y to
Continuing will destroy any information on the
enture physical device, and the system will have to be rebooted.
Do you wish to proceed ? [Y/N] :



After rebooting, since Prep did write some data to the drive before getting stuck, the A2090A boot ROM does things differently:
Code:
A2090/A2091/A590 WD33C93 in use
SCSIEMU HD 0: 08.00.00.00.01.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=512 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 0C.00.00.00.01.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
INITIALIZE DRIVE CHARACTERISTICS: Heads: 1028 Cyls: 613 Secs: 17
4F 42 65 08 08 11 00 00
-> DATAOUT=8 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 08.00.00.01.01.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=512 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 08.00.00.88.08.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=4096 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 0B.00.A2.4C.08.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=-1 ST=2 SENSELEN=18 REPLYLEN=0
-> SENSE STATUS:
91.00.00.01.
Note the bogus heads value in the log. I guess WinUAE emulates a different variant of command $0C (called SET DRIVE PARAMETERS in the Amiga Technical Reference Manual) than the A2090A uses? Also, command $CC would be used to set parameters of the second ST-506 drive.

Here's log output after Prep starts. Note that command $06 (FORMAT TRACK) is unsupported which is probably the problem here.
Code:
SCSIEMU HD 0: 0B.00.A2.4C.08.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=-1 ST=2 SENSELEN=18 REPLYLEN=0
-> SENSE STATUS:
91.00.00.01.
SCSIEMU HD 0: 0C.00.A2.4C.08.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
INITIALIZE DRIVE CHARACTERISTICS: Heads: 1028 Cyls: 612 Secs: 17
4F 42 64 08 08 11 00 00
-> DATAOUT=8 ST=0 SENSELEN=0 REPLYLEN=0
SCSI command 06, no direction specified!
SCSIEMU HD 0: 06.00.00.00.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
UAEHF: unsupported scsi command 0x06 LUN=0
-> DATAOUT=-1 ST=2 SENSELEN=18 REPLYLEN=0
-> SENSE STATUS:
22.00.00.00.
SCSIEMU HD 0: 0A.00.00.00.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 08.00.00.00.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 0A.00.00.00.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 08.00.00.00.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 0A.00.00.00.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 08.00.00.00.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSI command 06, no direction specified!
SCSIEMU HD 0: 06.00.00.11.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
UAEHF: unsupported scsi command 0x06 LUN=0
-> DATAOUT=-1 ST=2 SENSELEN=18 REPLYLEN=0
-> SENSE STATUS:
22.00.00.00.
SCSIEMU HD 0: 0A.00.00.11.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 08.00.00.11.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 0A.00.00.11.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 08.00.00.11.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 0A.00.00.11.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 08.00.00.11.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSI command 06, no direction specified!
SCSIEMU HD 0: 06.00.00.22.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
UAEHF: unsupported scsi command 0x06 LUN=0
-> DATAOUT=-1 ST=2 SENSELEN=18 REPLYLEN=0
-> SENSE STATUS:
22.00.00.00.
SCSIEMU HD 0: 0A.00.00.22.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 08.00.00.22.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 0A.00.00.22.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 08.00.00.22.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 0A.00.00.22.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 08.00.00.22.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSI command 06, no direction specified!
SCSIEMU HD 0: 06.00.00.33.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
UAEHF: unsupported scsi command 0x06 LUN=0
-> DATAOUT=-1 ST=2 SENSELEN=18 REPLYLEN=0
-> SENSE STATUS:
22.00.00.00.
SCSIEMU HD 0: 0A.00.00.33.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 08.00.00.33.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 0A.00.00.33.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 08.00.00.33.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 0A.00.00.33.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 08.00.00.33.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 0A.00.00.00.01.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=512 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 0A.00.00.01.01.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=512 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 0A.00.00.02.01.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=512 ST=0 SENSELEN=0 REPLYLEN=0
SCSI command 06, no direction specified!
SCSIEMU HD 0: 06.00.00.44.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
UAEHF: unsupported scsi command 0x06 LUN=0
-> DATAOUT=-1 ST=2 SENSELEN=18 REPLYLEN=0
-> SENSE STATUS:
22.00.00.00.
SCSIEMU HD 0: 0A.00.00.44.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 08.00.00.44.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 0A.00.00.44.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 08.00.00.44.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 0A.00.00.44.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 08.00.00.44.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSI command 06, no direction specified!
SCSIEMU HD 0: 06.00.00.55.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
UAEHF: unsupported scsi command 0x06 LUN=0
-> DATAOUT=-1 ST=2 SENSELEN=18 REPLYLEN=0
-> SENSE STATUS:
22.00.00.00.
SCSIEMU HD 0: 0A.00.00.55.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 08.00.00.55.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 0A.00.00.55.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 08.00.00.55.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 0A.00.00.55.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 08.00.00.55.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSI command 06, no direction specified!
SCSIEMU HD 0: 06.00.00.66.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
UAEHF: unsupported scsi command 0x06 LUN=0
-> DATAOUT=-1 ST=2 SENSELEN=18 REPLYLEN=0
-> SENSE STATUS:
22.00.00.00.
SCSIEMU HD 0: 0A.00.00.66.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 08.00.00.66.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 0A.00.00.66.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 08.00.00.66.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 0A.00.00.66.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 08.00.00.66.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSI command 06, no direction specified!
SCSIEMU HD 0: 06.00.00.77.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
UAEHF: unsupported scsi command 0x06 LUN=0
-> DATAOUT=-1 ST=2 SENSELEN=18 REPLYLEN=0
-> SENSE STATUS:
22.00.00.00.
SCSIEMU HD 0: 0A.00.00.77.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 08.00.00.77.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 0A.00.00.77.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 08.00.00.77.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 0A.00.00.77.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 08.00.00.77.11.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=8704 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 0A.00.00.44.44.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=34816 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 0A.00.00.01.87.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=69120 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 0A.00.00.01.87.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
-> DATAOUT=69120 ST=0 SENSELEN=0 REPLYLEN=0
SCSIEMU HD 0: 0A.00.00.01.87.00.00.00.00.00.00.00 CMDLEN=6 DATA=0F917E08
...
mark_k is online now  
Old 24 May 2017, 15:50   #2
Saghalie
Registered User
 
Saghalie's Avatar
 
Join Date: Nov 2014
Location: FT Lewis, WA
Posts: 374
tried to load up a miniscribe as well and I have had the same results.

Logs attached.
Attached Files
File Type: txt winuaebootlog.txt (13.2 KB, 189 views)
File Type: txt winuaelog.txt (9.7 KB, 67 views)

Last edited by DH; 14 November 2017 at 17:21. Reason: Deleted direct signature
Saghalie is offline  
Old 24 May 2017, 18:50   #3
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 3,334
It might be enough just to treat FORMAT TRACK (opcode $06) as a no-op (just return no error/good status).
mark_k is online now  
Old 24 May 2017, 19:01   #4
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
I am not sure how I managed to partition it when ST-506 was first implemented but obvious reason is that A2090A Z80 code gets the command block and then converts it to whatever the drive wants, so CDB in ST-506 mode may not be exactly SCSI.

I guess best fix is to handle A2090A+ST-506 separately and convert all strange commands to real SCSI commands.
Toni Wilen is offline  
Old 24 May 2017, 20:27   #5
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 3,334
Probably not relevant to emulation since command $0C INITIALIZE DRIVE CHARACTERISTICS should be a no-op, but the format of the data for that command differs significantly between different ST-506 controllers.

Xebec S1410A SASI:
bytes 0-1: maximum# cyls
byte 2: num. heads
bytes 3-4: Reduce write current cylinder
bytes 5-6: Increase write precompensation cylinder
byte 7: Maximum ECC data burst length

OMTI 5510 is the same except byte 7 should be zero.

With the A2090 you pass six bytes not eight, and it looks like (p.183 of Amiga TRM):
byte 0: bits[7:4] user options, bits [3:0] step rate
byte 1: num. heads in bits[6:4] (bit 7 always 0?), bits[3:0] upper bits of num.cyls
byte 2: num.cyls low byte
byte 3: precompensation cylinder / 16
byte 4: reduced write current cylinder / 16
byte 5: number of sectors/track

In hardfile.cpp you have:
Code:
write_log(_T("INITIALIZE DRIVE CHARACTERISTICS: "));
write_log(_T("Heads: %d Cyls: %d Secs: %d\n"),
	(scsi_data[1] >> 4) | ((scsi_data[0] & 0xc0) << 4),
	((scsi_data[1] & 15) << 8) | (scsi_data[2]),
	scsi_data[5]);
I'm not sure which ST-506 controller that corresponds to, but I think the heads value should be
(scsi_data[1] >> 4) | (scsi_data[0] & 0xc0)
mark_k is online now  
Old 24 May 2017, 20:44   #6
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
0x0c/0xcc is now handled in A2090 emulation, it only prints the contents and returns ok.

FORMAT TRACK added.

More ST-506 mode logging added.

Unfortunately nothing changed, PREP still starts repeating "SCSIEMU HD 0: 0A.00.00.01.87.00" forever.
Toni Wilen is offline  
Old 24 May 2017, 21:25   #7
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 3,334
I'll try to figure out what's causing that. Sector $87 is the last sector in cylinder 1 by the way (2×4×17 - 1).
mark_k is online now  
Old 24 May 2017, 21:47   #8
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 3,334
After a command completes, 4 bytes status, loosely corresponding to REQUEST SENSE data, is returned in bytes 12-15 of the command block. Bit 7 of the 1st status byte is address-valid bit. If set then an LBA appears in the last three bytes. See Amiga TRM p.173.

hddisk.device usually sets byte 12 of the command block (i.e. where the first status byte will be) to $FF before executing a command and checks that byte afterwards.

Last edited by mark_k; 19 June 2017 at 10:33.
mark_k is online now  
Old 24 May 2017, 21:59   #9
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
I noticed the same, driver assumes last accessed LBA is always returned if command was read/write/format and it uses returned LBA to calculate how many blocks were transferred.

It looks like Commodore A600/A1200/A4000 IDE driver weirdness of using last accessed LBA maybe inherited from this code..

Should work now.

12 = $FF means CDB is valid, it is mentioned in A2090A Hard Disk Controller Tech Data document. (Which does not match real hardware 100%, for example DMA addresses don't have any RW bit)

EDIT: Returned LBA was always zero previously but it sort of worked because driver adds 1 to it (to make it next block). Until start block is also 1. 1-1=0 blocks transferred. (>1 overflowed the calculation and also "worked" unless caller checked IO_ACTUAL which would contain some very big number..)

Last edited by Toni Wilen; 24 May 2017 at 22:08.
Toni Wilen is offline  
Old 24 May 2017, 22:15   #10
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 3,334
Now Prep seems to complete successfully. However on rebooting afterwards, the boot process seems to hang (at least, I waited several minutes at a white screen). There was this in the log:
ST-506 CMD 08.00.00.00.01.00 c1.59.58
SCSIEMU HD 0: 08.00.00.00.01.00.00.00.00.00.00.00 CMDLEN=6 DATA=0FABF018
-> DATAOUT=512 ST=0 SENSELEN=0 REPLYLEN=0
ST-506 CMD 0c.00.00.00.01.00 c1.5b.d4
ST-506 Set Drive Parameters 0C: CHS=612,17,4 04 0f 08 08
ST-506 CMD 08.00.00.01.01.00 c1.dc.22
SCSIEMU HD 0: 08.00.00.01.01.00.00.00.00.00.00.00 CMDLEN=6 DATA=0FABF018
-> DATAOUT=512 ST=0 SENSELEN=0 REPLYLEN=0


(Using today's winuae.exe time 20:54.)
mark_k is online now  
Old 24 May 2017, 22:40   #11
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
CDB[12] == 0xff check does not seem to exist in Z80 code, removed the test and it started working. Next command was read of block 2 with old data in CDB[12]..

EDIT: Now also $0c/$cc command CHS values are used to check for possible out of bounds LBA value. No effect on normal use.

Last edited by Toni Wilen; 25 May 2017 at 09:19.
Toni Wilen is offline  
Old 25 May 2017, 10:07   #12
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
Block 1 ("bad1" = badblock data?) read:

Code:
; CMD=8
00E98C50 157c 0008 0254           MOVE.B #$08,(A2, $0254) == $00c15bac
; LEN=1
00E98C56 157c 0001 0258           MOVE.B #$01,(A2, $0258) == $00c15bb0
; "New command" flag
00E98C5C 157c 00ff 0260           MOVE.B #$ff,(A2, $0260) == $00c15bb8
; LBA
00E98C62 3540 0256                MOVE.W D0,(A2, $0256) == $00c15bae
00E98C66 4840                     SWAP.W D0
; D2 = LUN bit
00E98C68 d002                     ADD.B D2,D0
00E98C6A 1540 0255                MOVE.B D0,(A2, $0255) == $00c15bad
00E98C6E 41eb 0042                LEA.L (A3, $0042) == $00c1dc22,A0
; DMA address
00E98C72 2008                     MOVE.L A0,D0
00E98C74 1540 025c                MOVE.B D0,(A2, $025c) == $00c15bb4
00E98C78 e098                     ROR.L #$00000008,D0
00E98C7A 1540 025b                MOVE.B D0,(A2, $025b) == $00c15bb3
00E98C7E e098                     ROR.L #$00000008,D0
00E98C80 1540 025a                MOVE.B D0,(A2, $025a) == $00c15bb2
; execute command
Block 2 ("bad2") read:


Code:
; CMD,LEN or flag is not reset here
; DMA address
00E98CC6 1540 025c                MOVE.B D0,(A2, $025c) == $00c15bb4
00E98CCA e098                     ROR.L #$00000008,D0
00E98CCC 1540 025b                MOVE.B D0,(A2, $025b) == $00c15bb3
00E98CD0 e098                     ROR.L #$00000008,D0
00E98CD2 1540 025a                MOVE.B D0,(A2, $025a) == $00c15bb2
00E98CD6 202b 0046                MOVE.L (A3, $0046) == $00c1dc26,D0
00E98CDA 2740 003e                MOVE.L D0,(A3, $003e) == $00c1dc1e
; LBA
00E98CDE 3540 0256                MOVE.W D0,(A2, $0256) == $00c15bae
00E98CE2 4840                     SWAP.W D0
00E98CE4 d002                     ADD.B D2,D0
00E98CE6 1540 0255                MOVE.B D0,(A2, $0255) == $00c15bad
; execute command
So it is ROM driver bug and only happens if drive has bad block list (?) stored. This probably explains how I managed to partition this drive (using other install disk) even when emulation was wrong.. (Block 0 read and generic read/write code always has $ff set code)

Perhaps someone wants to disassemble the Z80 code?
Toni Wilen is offline  
Old 25 May 2017, 14:00   #13
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 3,334
There should always be a bad block list (even if empty) since Prep puts it there. My disassembly of that part of the code is below. I'll upload .rs files for my Prep and HDDisk disassemblies later.

The "new command flag" is actually the fourth byte of the CDB, the transfer length.

What the code seems to be doing, is reading both "BAD1" and BAD2" sectors. If either read fails it proceeds using an empty bad block list.

I had assumed the setting-byte-12-to-$FF before issuing a command thing is because $FF can't be returned as a status code, and is just a software convention. So the program knows that the returned status code is valid. As opposed to there being some hardware/controller/DMA error which causes the command to fail before the status byte is written, leaving the previous command's status byte there.

If this is a driver bug it's a really, really tiny one. If the $BAD2 sector read were to fail without changing the status byte the driver will think the sector read correctly when it didn't. But it then checks for the $BAD2 signature, and since that (almost certainly) won't match it will proceed with empty bad block list. But even if the $BAD2 signature somehow matched though the READ failed, that could only cause a problem if there are more than 63(?) bad block entries, because only then will the bad block list extend into the $BAD2 sector data.
Code:
MOVE.B	#8,(CmdBlock-Mem8284,A2)	;READ (6)
MOVE.B	#1,(CmdBlockByte4-Mem8284,A2)	;Transfer length
MOVE.B	#$FF,(CmdBlockByte12_StatusCode-Mem8284,A2)

MOVE.W	D0,(CmdBlockByte2-Mem8284,A2)	;Low word of LBA to read
SWAP	D0
ADD.B	D2,D0	;Drive number is in D2 bits [7:5]
MOVE.B	D0,(CmdBlockByte1-Mem8284,A2)

LEA	(BAD1_SectorBuf-Unit,A3),A0
MOVE.L	A0,D0
MOVE.B	D0,(CmdBlockByte8-Mem8284,A2)
ROR.L	#8,D0
MOVE.B	D0,(CmdBlockByte7-Mem8284,A2)
ROR.L	#8,D0
MOVE.B	D0,(CmdBlockByte6-Mem8284,A2)

LEA	(SomeMsgPort-Mem8DA1,A6),A0
LEA	(SomeIORequest?-Mem8284,A2),A1
MOVE.L	A6,-(SP)
MOVEA.L	(_SysBase-Mem8DA1,A6),A6
JSR	(_LVOPutMsg,A6)
MOVEA.L	(SP)+,A6

MOVE.L	#$800,D0	;Bit 11
MOVE.L	A6,-(SP)
MOVEA.L	(_SysBase-Mem8DA1,A6),A6
JSR	(_LVOWait,A6)
MOVEA.L	(SP)+,A6

MOVE.B	(CmdBlockByte12_StatusCode-Mem8284,A2),D0
BSR.W	IsHardError???
BNE.W	NoBadBlockSectors

CMPI.W	#$BAD1,(BAD1_SectorBuf-Unit,A3)
BNE.W	NoBadBlockSectors

LEA	(BAD2_SectorBuf-Unit,A3),A0
MOVE.L	A0,D0
MOVE.B	D0,(CmdBlockByte8-Mem8284,A2)
ROR.L	#8,D0
MOVE.B	D0,(CmdBlockByte7-Mem8284,A2)
ROR.L	#8,D0
MOVE.B	D0,(CmdBlockByte6-Mem8284,A2)

MOVE.L	(BAD1bufOffset4-Unit,A3),D0	;Set LBA in command block to that of the "BAD2" sector
MOVE.L	D0,(LBAofBAD2Sector-Unit,A3)
MOVE.W	D0,(CmdBlockByte2-Mem8284,A2)
SWAP	D0
ADD.B	D2,D0	;Drive number is in D2 bits [7:5]
MOVE.B	D0,(CmdBlockByte1-Mem8284,A2)

LEA	(SomeMsgPort-Mem8DA1,A6),A0
LEA	(SomeIORequest?-Mem8284,A2),A1
MOVE.L	A6,-(SP)
MOVEA.L	(_SysBase-Mem8DA1,A6),A6
JSR	(_LVOPutMsg,A6)
MOVEA.L	(SP)+,A6

MOVE.L	#$800,D0	;Bit 11
MOVE.L	A6,-(SP)
MOVEA.L	(_SysBase-Mem8DA1,A6),A6
JSR	(_LVOWait,A6)
MOVEA.L	(SP)+,A6

MOVE.B	(CmdBlockByte12_StatusCode-Mem8284,A2),D0
BSR.W	IsHardError???
BNE.B	NoBadBlockSectors

CMPI.W	#$BAD2,(BAD2_SectorBuf_Offset01FE-Unit,A3)	;"BAD2" signature should be in last word of sector
BNE.W	NoBadBlockSectors

Last edited by mark_k; 25 May 2017 at 14:08.
mark_k is online now  
Old 25 May 2017, 14:34   #14
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 3,334
By the way, if you change the A2090A autoboot disabled checkbox then click Reset (to hard reset) the previous setting is still used.
mark_k is online now  
Old 25 May 2017, 14:35   #15
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
I assumed it was "hardware" (Z80 code) check because documentation says "If byte 12 is an FF, the rest of the command block is retrieved by the HDC" (But unfortunately it does not say what happens if it is not FF..)
Toni Wilen is offline  
Old 25 May 2017, 14:57   #16
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 3,334
Yep, I noticed that after you mentioned it.

Another odd thing, did you notice the command $0F Change Command Block command description? Amiga TRM p.184-185 or A2090A tech data p.16-17.
Also worth noting, hddisk.device ensures the 16-byte command block is 512-byte-aligned. Meaning its (DMA) address could be specified in two bytes.

Last edited by mark_k; 25 May 2017 at 15:04.
mark_k is online now  
Old 25 May 2017, 16:17   #17
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
Quote:
Originally Posted by mark_k View Post
Yep, I noticed that after you mentioned it.

Another odd thing, did you notice the command $0F Change Command Block command description? Amiga TRM p.184-185 or A2090A tech data p.16-17.
Yeah but it makes no sense because CBD address is 8727 DMA controller transfer address and it is normal IO address in A2090 Z2 space.

F command is also never used.

Quote:
Also worth noting, hddisk.device ensures the 16-byte command block is 512-byte-aligned. Meaning its (DMA) address could be specified in two bytes.
It really sounds like documented spec and final hardware are not identical. Also 8727 DMA controller can't have 512 byte aligment restriction. (It is also used by SCSI and any word aligned address works)

Or Z80 programmers got slightly different spec which forced 68k driver programmers to use 512 byte aligment for CDB
Toni Wilen is offline  
Old 25 May 2017, 19:13   #18
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 3,334
Aha... after looking at the driver code some more, it seems command $0F could have some use. [Is there any software other than hddisk.device which directly controls the A2090? Maybe an A-Max AMHD? Minix?]

There appear to be two different hardware variants. I wonder if both exist in the wild. It could be that WinUAE currently emulates one which doesn't exist. The driver checks bit 7 of er_Reserved0c and if it's set does some initialisation which assumes the command block pointer is 512-byte aligned. Is there a jumper on the A2090 to disable the ST-506 parts maybe?

Maybe someone with real A2090 or A2090A could check which theirs is. It should be easy enough to test. I could either write a special program, or provide a patched driver which e.g. writes a different value to address 0 depending on the hardware type. Or just run your expdump program?

Another mystery... the driver contains code to check for product 514/2. If found, it tests the longword at BoardAddr+1MB. If it seems to be RAM, it adds 1MB of memory starting there to the system list. What product would that be for? It would seemingly require the board occupy 2MB in the $200000 region, wasting almost 1MB address space.

Could that possibly be related to the Commodore-designed Zorro I form factor A2090-hardware-like board produced by Byte By Byte?

Code snippets:
Code:
TaskCode
	MOVEA.L	(4,SP),A6	;Get pointer to $8DA1-bytes struct
	MOVEA.L	(_OurBoardAddr-Mem8DA1,A6),A1
	BTST	#7,($30,A1)	;High bit of er_Reserved0c ???
	BNE.W	lbC0023E2

	BSET	#1,(lbB00B676-Mem8DA1,A6)	;Set flag to indicate hardware type???
	BRA.B	lbC002412	;And skip the address-setting ???

lbC0023E2
	MOVE.L	(Mem8DA1-Mem8DA1,A6),D0	;Point to (512-byte-aligned) command block
	MOVEQ	#9,D1
	LSR.L	D1,D0	;Shift it right by 9 bits
	MOVEQ	#1,D1	;To write two bytes of address data
.Do2ndByte	MOVE.B	D0,($50,A1)
	MOVE.B	#$E0,($42,A1)	;HCBP=1, MRESET=1, SSEL=1, int.enable=0

lbC0023F6
	BTST	#7,($42,A1)	;Check HCBP bit
	BEQ.B	lbC0023F6

	MOVE.B	#$60,($42,A1)	;HCBP=0, MRESET=1, SSEL=1, int.enable=0
lbC002404
	BTST	#7,($42,A1)	;Check HCBP bit
	BNE.B	lbC002404

	LSR.L	#8,D0
	DBRA	D1,.Do2ndByte

lbC002412
	BSR.W	lbC001C1A
.Loop	BSR.B	lbC00242C

	MOVE.L	#$600,D0
	MOVE.L	A6,-(SP)
	MOVEA.L	(_SysBase-Mem8DA1,A6),A6
	JSR	(_LVOWait,A6)
	MOVEA.L	(SP)+,A6
	BRA.B	.Loop
And also:
Code:
; A3: Unit structure
DoLowLevelCommand???
	CMPI.B	#2,(UnitNum-Unit,A3)
	BGE.W	DoSCSILowLevelCommand???	;Branch if SCSI

	BTST	#1,(lbB00B676-Mem8DA1,A6)	;Check hardware type flag???
	BNE.B	.Return

	MOVEQ	#0,D0	;newSignals
	MOVE.L	#$100,D1	;signalMask
	MOVE.L	A6,-(SP)
	MOVEA.L	(_SysBase-Mem8DA1,A6),A6
	JSR	(_LVOSetSignal,A6)
	MOVEA.L	(SP)+,A6

	MOVE.L	A5,-(SP)
	MOVEA.L	(_OurBoardAddr-Mem8DA1,A6),A5
	BCLR	#4,(lbB00B676-Mem8DA1,A6)
	MOVE.B	#$50,($42,A5)
	MOVE.B	#0,($52,A5)
	MOVE.B	#1,($52,A5)
	MOVE.L	#$100,D0
	MOVE.L	A6,-(SP)
	MOVEA.L	(_SysBase-Mem8DA1,A6),A6
	JSR	(_LVOWait,A6)
	MOVEA.L	(SP)+,A6
	MOVE.B	#0,($52,A5)
	MOVEA.L	(SP)+,A5
.Return
	RTS
Code:
	MOVEA.L	D0,A0
	MOVE.L	A0,(_ConfigDev-Mem8284,A5)
	CMPI.B	#2,(cd_Rom+er_Product,A0)	;Product 2?
	BNE.B	.DontAddMem

	MOVE.L	(cd_BoardAddr,A0),D0
	ADDI.L	#$100000,D0
	MOVEA.L	D0,A1
	MOVE.L	#$5555AAAA,(A1)
	CMPI.L	#$5555AAAA,(A1)
	BNE.B	.DontAddMem

	NOT.L	(A1)
	CMPI.L	#$AAAA5555,(A1)
	BNE.B	.DontAddMem

	MOVEA.L	A1,A0
	MOVEA.L	#0,A1
	MOVE.L	#$100000,D0
	MOVE.L	#(MEMF_PUBLIC|MEMF_FAST),D1
	MOVEQ	#0,D2
	JSR	(_LVOAddMemList,A6)

lbC000798
	MOVEA.L	(_ConfigDev-Mem8284,A5),A0

.DontAddMem	MOVE.L	(cd_BoardAddr,A0),(BoardAddress-Mem8284,A5)
	BCLR	#CDB_CONFIGME,(cd_Flags,A0)
	TST.L	D7
	BEQ.B	.NotFound
	...
mark_k is online now  
Old 25 May 2017, 19:28   #19
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
Quote:
Originally Posted by mark_k View Post
There appear to be two different hardware variants. I wonder if both exist in the wild. It could be that WinUAE currently emulates one which doesn't exist. The driver checks bit 7 of er_Reserved0c and if it's set does some initialisation which assumes the command block pointer is 512-byte aligned. Is there a jumper on the A2090 to disable the ST-506 parts maybe?
I noticed that check long time ago, if it is not set, ST-506 don't seem to work so I assumed it tells if ST-506 parts are installed.

Actually I was wrong, CDB is not stored in DMAC but it probably goes to Z80, written strangely: write byte, handshake pulse, wait for interrupt, write next and so on. (3 times). It makes sense to have separate CDB change command if above method is very slow. So lets support it too

EDIT: ST-506 enable/disable option added. (note: default is disabled)

Last edited by Toni Wilen; 25 May 2017 at 20:02.
Toni Wilen is offline  
Old 25 May 2017, 20:04   #20
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 3,334
Another thing.. code can issue command F6 instead of FE to to the DMA controller, but F6 isn't listed in the table on p.7 of A2090A tech data. Maybe that loads the low DMA address latch but doesn't start DMA?
Code:
; D0: Address, shifted left 7 bits and with bit 31 = 1 for read, 0 for write
lbC002302
	ROL.L	#8,D0	;So bits 23..17 of address in D0[6:0], D0 bit 7 set or not
	MOVE.B	#$FB,($64,A5)	;$FB = Load upper DMA address latch
	MOVE.B	D0,($68,A5)	;"The MSB of the upper address latch is used to control the host R/W- line for DMA transfers."

	ROL.L	#8,D0	;So address bits [16:9] in D0.B
	MOVE.B	#$FD,($64,A5)	;Load mid DMA address latch
	MOVE.B	D0,($68,A5)

	ROL.L	#8,D0	;So address bits [8:1] in D0.B
	BTST	#5,(lbB00B676-Mem8DA1,A6)
	BEQ.B	.F6

	MOVE.B	#$FE,($64,A5)	;Load low DMA address latch; start DMA on rising edge of LDO; block mode XFER
	BRA.B	.Continue

.F6	MOVE.B	#$F6,($64,A5)	;$F6 = ???

.Continue
	MOVE.B	D0,($68,A5)
	MOVE.B	#$F7,($64,A5)	;$F7 = Open path to int. DMA FIFO (64 bytes)

	BSET	#7,(lbB00B676-Mem8DA1,A6)
	RTS
mark_k is online now  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Guide to setting up A2090a with SCSI2SD RobTurbo support.Hardware 37 29 November 2021 16:28
D3D point/bilinear setting trouble Ami_GFX support.WinUAE 4 10 December 2014 20:23
Trouble Setting up Transcend 4GB IDE Flash Disk mfletcher support.Hardware 15 07 January 2014 11:22
For Sale: A2090a SCSI HD and ST 506 Controller (Zorro2) Zetr0 MarketPlace 5 02 September 2009 10:43
Trouble setting up SCSI CD RW with CSMK3 CU_AMiGA support.Hardware 3 05 August 2008 16:51

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 21:33.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.13654 seconds with 14 queries