tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: SCSI Polled io fixes for mac68k with PDMA enabled.



Hi,

On Fri, 30 Dec 2022 12:08:21 Izumi Tsutsui wrote:
> > I've found while working with mac68k that devices that require polled io
> > scsi transfers would fail with sbc pdma (pseudo dma) would fail when
> > reading and writing to the respective device.
> > 
> > I've found that virtual devices for rascsi and the scsi2sd drives would
> > fail using pdma.  For virtual disks they would fail always when writing
> > to the device, reads were ok.
> > 
> > For virtual ethernet devices they would fail for reading and writing.
> 
> It looks more detailed information is necessary.
> 
> - How does it fail?  Lost interrupts?  Generic SCSI xfer errors?

I keep hitting the bus error when writing via pdma - This pertains to the 
PDMA_NO_WRITE to avoid the bus error.
https://nxr.netbsd.org/xref/src/sys/arch/mac68k/dev/sbc.c#342
> 
> - Does the mac68k sbc (with MI ncr5380sbc) work with other
>   real SCSI devices (at least on your machine)?
> 
> - Per obio/sbc_obio.c SBC_INTR and SBC_RESELECT are disabled
>   on MACIIFX and MACPB500 (maybe no working interrupts).
>  https://github.com/NetBSD/src/blob/43d029e4b58545fb46624a260279892a85d8a21
> 1/sys/arch/mac68k/obio/sbc_obio.c#L131 Does PDMA work on other machines
> (i.e. with working interrupts)?
> 

No idea as I dont have the hardware to test.  These changes are only for pdma 
transfers and they wont pertain to GENERIC with the esp driver.

I'm of the impression that this is a quirk for the powerbook 160 regardless of 
what devices are attached to the bus.

The kernel that was giving me problems had
sbc0 ... flags 0x1

> - Furthermore, why do you check XS_CTL_POLL instead of SBC_INTR in
>   sc_options?

This was because the dse.4 device would have erroneous data when reading and 
writing via pdma.

One of the thing that I tried was setting the adaptor properties in dse.4 to 
SCSIPI_ADAPT_POLL_ONLY - this worked but had the negative effect of slowing 
down all transfers to all devices when i just wanted to used the _pio_ methods 
for the dse.4 device.

https://nxr.netbsd.org/xref/src/sys/dev/scsipi/scsipi_base.c#2270





And there is no check for falling back to _pio_ its ether dma or pdma/pio.

So I check the current transfer for XS_CTL_POLL and if set use the _pio_ 
methods.

This had the effect of the devices requiring polled transfers to work while not 
slowing down the bus for other devices where pdma works for those devices.

As far as I can tell there would be no detremental effect for other devices 
where XS_CTL_POLL is set and they would work as intended.

> 
> - Does the RaSCSI etc. work with GENERIC (not GENERICSBC)?
>   I don't know a history why mac68k has both MI ncr5380 (GENERICSBC) and
>   the own NCR5380 driver (GENERIC with dev/mac68k5380.c) for years.

I found that for the powerbook 160 GENERICSBC worked but GENERIC did not 
crashing early during scsi device detection on boot.

> 
> - I wonder if these SCSI emulation devices using GPIO controled by
>   own software comply various xfer timings defined in SCSI spec.
>   (I have a drive with IDE-SCSI converter that emit errors
>    on news68k SCSI with MI ncr5380)
> 

I'm of the impression this probably only affects the powerbook 160 and alas I 
dont have any other capable macintoshoes to test otherwize.

> - I also wonder if the first byte of write xfer should be written on
>   manualy PDMA write, as eps_dma_go() in mac68k/obio/esp.c
>  https://github.com/NetBSD/src/blob/43d029e4b58545fb46624a260279892a85d8a21
> 1/sys/arch/mac68k/obio/esp.c#L564

I tried doing this and alas it did not work but I did find this
https://nxr.netbsd.org/xref/src/sys/dev/ic/ncr5380sbc.c#2101

I'm wondering if changing it will fix pdma for writing on my machine.


> 
> ---
> Izumi Tsutsui


Best regards and happy new year!

Nat


Home | Main Index | Thread Index | Old Index