31 December 2012, 16:15 | #1 | ||
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
wd33c93 emulation debugging
[Moved from MMU thread]
Quote:
Anyway, problem is SCSI phase numbers. I haven't found documentation that describes exactly how scsi phases work, most of the stuff in emulation is guesses only. This driver apparently checks SCSI phase value returned by SCSI chip and simply hangs if value is not any of expected values. (I guess this also explains guru rom problem, some phase value is wrong) Quote:
Last edited by Toni Wilen; 01 January 2013 at 17:32. Reason: Moved from MMU thread |
||
31 December 2012, 17:06 | #2 | |
Thalion Webshrine
Join Date: Jan 2004
Location: Oxford
Posts: 14,337
|
The only SCSI book I have has a very small section which you've probably already seen :
Quote:
http://www.staff.uni-mainz.de/tacke/scsi/SCSI2-06.html I appreciate that this information is widely available and what you're probably after is how the WD chip actually works. |
|
31 December 2012, 18:13 | #3 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
|
31 December 2012, 21:43 | #4 | ||
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
WD SCSI chip documentation seems to miss some information..
It says about "Select and Transfer" command that command phase 0x60 = Command completed but other SCSI phase document says (for example http://challenge.nvg.ntnu.no/sgistuf...csi-errors.txt) Quote:
Quote:
|
||
31 December 2012, 22:23 | #5 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,335
|
I assume you have the 66-page WD33C93 datasheet (PDF available from http://www.datasheetcatalog.org/data.../501413_DS.pdf)?
From that, the PH_xxx values are what appear in the command phase register (address 10 hex). The ST_xxx values are put in the SCSI status register (address 17 hex). That's from pages 17-18 of the PDF. There's also a WD33C93B data sheet (better quality than the other one) at http://bitsavers.informatik.uni-stut...3_WD33C93B.pdf And WD33C93A: http://bitsavers.informatik.uni-stut...oller_1991.pdf Last edited by mark_k; 31 December 2012 at 22:46. |
31 December 2012, 23:39 | #6 | |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
Quote:
After some tweaks (+implemented SCSI statefile support) I got slightly farther.. |
|
01 January 2013, 11:38 | #7 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
Documentation says: "After the Command phase, the 33C93B anticipates a Data phase if the TRANSFER COUNT register contains a non-zero value, a Status phase if this register contains zero,"
This actually means Select-and-Transfer command jumps directly to Status phase if TRANSFER COUNT = 0, skipping whole Command phase! This is what A590 driver assumes. Funnily enough it seems A590 driver developer did it wrong but got lucky, code sets phase to $46 (which does nothing because Select-and-Transfer only writes to phase register, it does not care what it contains at the start of command) and code also does not clear transfer count (It was cleared by previous transfer). This A590 (now weird looking) driver behavior really confused me because I of course assumed setting phase to $46 must mean something. It does absolutely nothing with Select-and-Transfer... TC == 0 was the important information. Amix now detects partitions but partitioning fails with bus errors (and unfortunately they are real bus errors, some pointer has become null) Whats the original A3000UX HD size? Perhaps it hates too small or too big drives? |
01 January 2013, 19:01 | #8 |
Thalion Webshrine
Join Date: Jan 2004
Location: Oxford
Posts: 14,337
|
|
02 January 2013, 00:40 | #9 |
CaptainM68K-SPS France
|
the w33c93 is used on the capcom CPS-3 system. maybe there is info in the mame driver about this device ?
|
02 January 2013, 14:05 | #10 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
It seems only A590/A2091 and Guru ROM drivers do something weird with WD33C93.
All other drivers seem to use standard Select-and-Transfer command that does everything (select the drive, send command, send/receive data, disconnect) automatically. Weird drivers seem to do part of the SCSI protocol using lower level SCSI commands and then some other part(s) with high level commands (like Select-and-Transfer with zero transfer count). btw, I was wrong, Select-and-Transfer ignores scsi phase only if it started with non-zero transfer count. If transfer count = 0, it will check scsi phase number and jump to specific processing phase depending on scsi phase number. This is not fully documented in WD33C93 documentation. EDIT: I was even more wrong, scsi phase number is only ignored (starts from beginning) if unit is not currently selected. If already selected = continue from current scsi phase. Last edited by Toni Wilen; 08 January 2013 at 14:02. |
02 January 2013, 22:12 | #11 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,335
|
What with the new MMU support and improved A2091 emulation, I thought I'd try installing NetBSD 6.0.1 (using the 2013-01-02 winuae.exe).
I partitioned a hardfile and copied the miniroot.fs to it. On booting from that NetBSD repeatedly reports: sbicwait TIMEO @1570 with asr=x0 csr=x1f See attached pic. WinUAE config and hardfile attached too. |
04 January 2013, 17:01 | #12 | |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
Quote:
Does it really work with real hardware? It tries to send SCSI command to the drive with WD DMA mode but without programming DMAC for DMA operation. Normally commands are always send in PIO because DMA only makes sense with larger transfers. EDIT: Wait a moment, perhaps it enables DMA after starting the command.. EDIT2: No, it does not still make any sense. It still uses CPU writes while WD is in DMA mode.. This can't be right. Last edited by Toni Wilen; 04 January 2013 at 17:43. |
|
04 January 2013, 18:07 | #13 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,335
|
I haven't tested it on real hardware, but would assume it does work.
You can browse the source at http://cvsweb.netbsd.org/bsdweb.cgi/..._with_tag=MAIN. Scroll down and click wd33c93.c then click Download. Maybe that could help figure what the NetBSD devs are trying to do? Edit: A better browse interface (e.g. with links to function definitions) would be here: http://fxr.watson.org/fxr/source/dev...v=NETBSD;im=10. Last edited by mark_k; 04 January 2013 at 18:26. |
04 January 2013, 18:28 | #14 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
Yes but as usual it isn't that simple and assumptions are bad idea. There is also similar looking driver under amiga (arch/amiga/dev/sbic.c)...
|
04 January 2013, 18:49 | #15 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,335
|
Yes on second thoughts (bearing in mind the "atzsc0" text in the screenshot), probably these files are relevant:
arch/amiga/dev/atzsc.c arch/amiga/dev/atzscreg.h arch/amiga/dev/sbic.c arch/amiga/dev/sbicreg.h arch/amiga/dev/sbicvar.h Last edited by mark_k; 04 January 2013 at 20:39. Reason: Fixed links! |
04 January 2013, 20:29 | #16 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
All your links point to same file
I don't see anything obvious but perhaps it gets confused because not all scsi messages are generated during processing (like save pointers). I am still not familiar enough with SCSI stuff. It is soooo complex. (Guru ROM also seems to require this stuff) |
05 January 2013, 14:11 | #18 |
NetBSD developer
Join Date: May 2012
Location: Warsaw, Poland
Posts: 411
|
Hi guys.
I can't really comment on the problem you are seeing here. I don't know if A2091 driver still works, however I'm sure that A3000 driver does - I've tested it few months ago and I know of many users that installed 6.x on their A3000s. Both A2091 (atzsc) and A3000 (ahsc) use Amiga-specific 33C93 driver (sbic - SCSI phases are handled there). Differences between atzsc and ahsc are small, so I would expect that atzsc still works on a real hardware. I have to admit, that I don't really understand how this driver works . It doesn't use any modern kernel abstraction layers. It was written almost 20 years ago and didn't change much in last 10 years. Perhaps, there are old time developers still lurking on port-amiga .at. netbsd.org list. Asking there might be useful. I can prepare NetBSD kernel with DEBUG enabled for sbic driver if that helps. Btw. I also remember that Michael van Elst (of bustest fame) has his own UAE version for NetBSD testing (source). AFAIR it doesn't support SCSI, but might be interesting because of MMU and VNC code. Last edited by strim; 05 January 2013 at 14:46. |
05 January 2013, 14:28 | #19 |
Registered User
Join Date: Aug 2004
Location:
Posts: 3,335
|
Testing with the 2013-01-04 18:50 winuae.exe, output for A2091 and A3000 emulation is similar. The output with emulated A2091 has an additional "sbic_save_ptrs: asr 21 canceled!" line. WinUAE A3000 config file attached.
|
05 January 2013, 14:48 | #20 | ||
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,505
|
Quote:
ADDED: Log from working A3000 boot phase would be nice too for comparison purposes. (I'll try to do one, different drives may use different scsi features) Quote:
Last edited by Toni Wilen; 05 January 2013 at 18:07. |
||
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Debugging my dodgy asm! | hypnoshock | Coders. Asm / Hardware | 5 | 01 May 2012 01:55 |
Debugging and JIT issues | copse | support.WinUAE | 4 | 01 April 2012 05:50 |
Serial debugging while booting | jman | Coders. General | 1 | 25 March 2012 03:02 |
Help debugging a faulty CD32 | UberFreak | support.Hardware | 0 | 23 October 2009 03:29 |
Enforcer debugging tool | M&F | support.WinUAE | 0 | 21 May 2002 22:53 |
|
|