Previous Thread
Next Thread
Print Thread
Pointers on using NSCSI? #114206 11/09/18 12:53 PM
Joined: May 2009
Posts: 1,805
J
Just Desserts Offline OP
Very Senior Member
OP Offline
Very Senior Member
J
Joined: May 2009
Posts: 1,805
I'd like to convert the wd33c93 to use the NSCSI system, as I strongly suspect that it will most likely fix a lot of the SCSI issues that are dogging me with the SGI Indy driver.

Unfortunately, it's incredibly opaque and seems to presume a heavy knowledge of SCSI in general.

Where would I even start to figure out how to convert wd33c93 to use NSCSI? Or should I just discard it and re-write it from the ground up? And in either case, how would I go about gleaning enough information about how the NSCSI system works in order to successfully pull it off?

Re: Pointers on using NSCSI? [Re: Just Desserts] #114208 11/09/18 01:52 PM
Joined: Mar 2001
Posts: 16,305
R
R. Belmont Online Content
Very Senior Member
Online Content
Very Senior Member
R
Joined: Mar 2001
Posts: 16,305
NSCSI is basically always a rewrite.

I assume you know about the NSCSI.txt, nicely marked up here: https://docs.mamedev.org/techspecs/nscsi.html

But it helps to understand the underlying SCSI state machine first. There's 3 state bits, C/D (Control or Data), I/O (transfer direction: host to device or vice versa), and MSG (bus contains message or command/data) and 8 states (called "bus phases" in SCSI), and a very simple set of rules as to what states can go in what order.

http://mirror.informatimago.com/next/developer.apple.com/documentation/mac/Devices/Devices-120.html has a pretty clear description of the 8 bus phases, a diagram showing what state transitions are valid (not many), and a description of how the handshaking works for selection and the like.

Re: Pointers on using NSCSI? [Re: Just Desserts] #114212 11/09/18 04:26 PM
Joined: Jun 2001
Posts: 414
O
Olivier Galibert Online Content
Senior Member
Online Content
Senior Member
O
Joined: Jun 2001
Posts: 414
In the wd93c33 case the real problem for a nscsi conversion is the way the dma is done. I recommend converting the current driver and users (it's the users that are the problem) to a sane dma interface, which means one that uses a drq signal and dma_r/w methods. After that the conversion will actually be easy, you can lift most of the ncr state machine, they're very similar.

OG.

Re: Pointers on using NSCSI? [Re: Olivier Galibert] #114220 11/09/18 08:22 PM
Joined: May 2009
Posts: 1,805
J
Just Desserts Offline OP
Very Senior Member
OP Offline
Very Senior Member
J
Joined: May 2009
Posts: 1,805
Originally Posted by Olivier Galibert
In the wd93c33 case the real problem for a nscsi conversion is the way the dma is done. I recommend converting the current driver and users (it's the users that are the problem) to a sane dma interface, which means one that uses a drq signal and dma_r/w methods. After that the conversion will actually be easy, you can lift most of the ncr state machine, they're very similar.


Well, I have some good news in that regard: I just had a look through the whole source base, and the only driver that actually seems to make use of the wd33c93's DMA functionality is the Indy driver. So it should be pretty straightforward to update.

Re: Pointers on using NSCSI? [Re: Just Desserts] #114226 11/10/18 04:35 PM
Joined: May 2009
Posts: 1,805
J
Just Desserts Offline OP
Very Senior Member
OP Offline
Very Senior Member
J
Joined: May 2009
Posts: 1,805
Unfortunately, the legacy SCSI system only seems to operate on a block level, not at a byte level. As a result, updating the existing wd33c93 to have a same DMA interface is not really viable. So, I'm going for broke and trying my best to graft the ncr5390 state machine into the wd33c93.

However, I've run into a bit of a roadblock with my understanding of the ncr5390 state machine versus how the wd33c93 works.

The ncr5390 has a 1-for-1 command set, one command does one thing. By contrast, the wd33c93 has a bunch of combined commands: Select and Transfer, Select w/ATN and Transfer, Reselct and Receive Data, Reselect and Send Data, Wait for Select And Receive, and Send Status and Command Complete.

What I'm thinking is that I can treat the combined commands as two commands taken sequentially. I would leave the actual command ID in the relevant register, but cache the appropriate half of the command as the "active" command, and at the relevant points in the state machine where function_complete, bus_complete, or function_bus_complete is normally called, I can instead check the cached command against the actual command, and in turn launch the second half of the command like it were a standalone command.

Does that sound reasonable, or am I most likely going to run into some ugly issues with that?

Re: Pointers on using NSCSI? [Re: Just Desserts] #114227 11/10/18 05:30 PM
Joined: Jun 2001
Posts: 414
O
Olivier Galibert Online Content
Senior Member
Online Content
Senior Member
O
Joined: Jun 2001
Posts: 414
That's already how the 5390 does it. Look at DISC_SEL_ARBITRATION: for insteance:
case DISC_SEL_ARBITRATION:
if(c == CD_SELECT) {
state = DISC_SEL_WAIT_REQ;
} else
state = DISC_SEL_ATN_WAIT_REQ;

scsi_bus->ctrl_wait(scsi_refid, S_REQ, S_REQ);
if(ctrl & S_REQ)
step(false);
break;

The next state is chosen depending on the actual command, which is in 'c'.

OG.

Re: Pointers on using NSCSI? [Re: Just Desserts] #114228 11/10/18 07:44 PM
Joined: May 2009
Posts: 1,805
J
Just Desserts Offline OP
Very Senior Member
OP Offline
Very Senior Member
J
Joined: May 2009
Posts: 1,805
Except there's a difference between "Select with ATN"/"Select without ATN", versus two entirely separate commands, isn't there?

Re: Pointers on using NSCSI? [Re: Just Desserts] #114231 11/10/18 09:52 PM
Joined: Jun 2001
Posts: 414
O
Olivier Galibert Online Content
Senior Member
Online Content
Senior Member
O
Joined: Jun 2001
Posts: 414
Well, not really, frankly :-)


Who's Online Now
2 registered members (Reznor007, nerd4gw), 32 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
ShoutChat Box
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics8,684
Posts114,040
Members4,863
Most Online510
Aug 26th, 2019
Powered by UBB.threads™ PHP Forum Software 7.7.3