On Sun, 3 Mar 2024, BALATON Zoltan wrote:
On Sun, 3 Mar 2024, Sven Schnelle wrote:
BALATON Zoltan <bala...@eik.bme.hu> writes:

Hello,

AmigaOS4 also has a driver for this card so I've tried to test it but
it trips an assert. Does anybody have an idea why and how it could be
fixed? Sven's recent patches don't seem to have an effect on this, it
still happens shortly after it tries to access the SCSI device with
those patches applied. (Unfortunately AmigaOS is not freely available
so it's a bit hard to reproduce but I can do tests if needed.) I got
the following traces:

lsi_reg_write Write reg SIEN0 0x40 = 0x84
lsi_reg_write Write reg SIEN1 0x41 = 0x04
lsi_reg_write Write reg DIEN 0x39 = 0xff
lsi_reg_write Write reg DSP0 0x2c = 0x00
lsi_reg_write Write reg DSP1 0x2d = 0x80
lsi_reg_write Write reg DSP2 0x2e = 0x19
lsi_reg_write Write reg DSP3 0x2f = 0x00
lsi_execute_script SCRIPTS dsp=0x198000 opcode 0x7c07fe00 arg 0x0
lsi_execute_script_io_opcode Read-Modify-Write reg 0x7 AND data8=0xfe sfbr=0x01
lsi_reg_read Read reg GPREG 0x7 = 0x7f
lsi_reg_write Write reg GPREG 0x7 = 0x7e
lsi_execute_script SCRIPTS dsp=0x198008 opcode 0x60000200 arg 0x0
lsi_execute_script_io_clear Clear TM
lsi_execute_script SCRIPTS dsp=0x198010 opcode 0x40000000 arg 0x198208
lsi_execute_script_io_alreadyreselected Already reselected, jumping to
alternative address
here ---^
lsi_do_msgout_select Select LUN 0
lsi_execute_script SCRIPTS dsp=0x198070 opcode 0x820b0000 arg 0x1981f8
lsi_execute_script_tc_compp Compare phase CMD == CMD
lsi_execute_script_tc_jump Jump to 0x1981f8
lsi_execute_script SCRIPTS dsp=0x1981f8 opcode 0xa000006 arg 0x199000
lsi_do_command Send command len=6
qemu-system-ppc: ../hw/scsi/lsi53c895a.c:863: lsi_do_command: Assertion `s->current == NULL' failed.

Any idea what could it be and what could be done about it?

Wild guess is that this is because of the 'Already reselected' line
above. lsi_reselect() sets s->current, and later when lsi_do_command()
is called it gets confused because s->current is already set. But i
would need the whole logfile to see why this is going wrong, or even
better AmigaOS (which is not free as you already mentioned)

Thanks for looking at this. I've uploaded the full log here: http://zero.eik.bme.hu/~balaton/qemu/aos-lsi-scsi.log.xz but not sure you'd get more info from it as it seems to be working up to the error. This happens short after boot when the driver is started which seems to be going OK but when first accessing the device then it runs into the error. I don't know how this controller works so can't really tell what would be correct behaviour here.

AFAIU this log it tries to read a sector which completes on the drive side but I can't see where this read finishes and maybe the guest tries to send another command while it's still running? The read is here:

lsi_execute_script SCRIPTS dsp=0x1981f8 opcode 0xa00000a arg 0x199000
lsi_do_command Send command len=10
scsi_req_parsed target 0 lun 0 tag 0 command 40 dir 1 length 2048
scsi_req_parsed_lba target 0 lun 0 tag 0 command 40 lba 16
scsi_req_alloc target 0 lun 0 tag 0
scsi_disk_new_request Command: lun=0 tag=0x0 data= 0x28 0x00 0x00 0x00 0x00 
0x10 0x00 0x00 0x01 0x00
scsi_disk_dma_command_READ Read (sector 16, count 1)
scsi_req_continue target 0 lun 0 tag 0
scsi_disk_read_data_count Read sector_count=4
lsi_add_msg_byte MSG IN 0x02
lsi_add_msg_byte MSG IN 0x04
lsi_queue_command Queueing tag=0x0
lsi_execute_script SCRIPTS dsp=0x198200 opcode 0x870b0000 arg 0x1980c0
lsi_execute_script_tc_compp Compare phase MSGIN == MSGIN
lsi_execute_script_tc_jump Jump to 0x1980c0
lsi_execute_script SCRIPTS dsp=0x1980c0 opcode 0xf000001 arg 0x199040
lsi_do_msgin Message in len=1 2
lsi_execute_script SCRIPTS dsp=0x1980c8 opcode 0x800c0000 arg 0x198398
lsi_execute_script_tc_compd Compare data 0x2 & 0xff == 0x0
lsi_execute_script_tc_cc_failed Control condition failed
lsi_execute_script SCRIPTS dsp=0x1980d0 opcode 0x800c0004 arg 0x198398
lsi_execute_script_tc_compd Compare data 0x2 & 0xff == 0x4
lsi_execute_script_tc_cc_failed Control condition failed
lsi_execute_script SCRIPTS dsp=0x1980d8 opcode 0x800c0002 arg 0x198398
lsi_execute_script_tc_compd Compare data 0x2 & 0xff == 0x2
lsi_execute_script_tc_jump Jump to 0x198398
lsi_execute_script SCRIPTS dsp=0x198398 opcode 0x7c027f00 arg 0x0
lsi_execute_script_io_opcode Read-Modify-Write reg 0x2 AND data8=0x7f sfbr=0x02
lsi_reg_read Read reg SCNTL2 0x2 = 0x00
lsi_reg_write Write reg SCNTL2 0x2 = 0x00
lsi_execute_script SCRIPTS dsp=0x1983a0 opcode 0x60000048 arg 0x0
lsi_execute_script_io_clear Clear ATN ACK
lsi_execute_script SCRIPTS dsp=0x1983a8 opcode 0x48000000 arg 0x0
lsi_execute_script_io_disconnect Wait Disconnect
lsi_execute_script SCRIPTS dsp=0x1983b0 opcode 0x7a070100 arg 0x0
lsi_execute_script_io_opcode Read-Modify-Write reg 0x7 OR data8=0x01 sfbr=0x02
lsi_reg_read Read reg GPREG 0x7 = 0x7f
lsi_reg_write Write reg GPREG 0x7 = 0x7f
lsi_execute_script SCRIPTS dsp=0x1983b8 opcode 0x98080000 arg 0x10
lsi_execute_script_tc_interrupt Interrupt 0x10
lsi_script_dma_interrupt DMA Interrupt 0x4 prev 0x0
lsi_update_irq Update IRQ level 1 dstat 0x04 sist 0x000x00
lsi_execute_script_stop SCRIPTS execution stopped
lsi_reg_read Read reg ISTAT 0x14 = 0x01
lsi_update_irq Update IRQ level 0 dstat 0x00 sist 0x000x00
lsi_reg_read Read reg DSTAT 0xc = 0x84
lsi_reg_read Read reg DSPS0 0x30 = 0x10
lsi_reg_read Read reg DSPS1 0x31 = 0x00
lsi_reg_read Read reg DSPS2 0x32 = 0x00
lsi_reg_read Read reg DSPS3 0x33 = 0x00
scsi_disk_read_complete Data ready tag=0x0 len=2048
scsi_req_data target 0 lun 0 tag 0 len 2048
lsi_queue_req Queueing IO tag=0x0

but I don't see if the guest got the results. How should this transfer end and why it does not seem to have reached the guest? After this the guest seems to send another command:

lsi_do_command Send command len=6
scsi_req_parsed target 0 lun 0 tag 0 command 0 dir 0 length 0
scsi_req_parsed_lba target 0 lun 0 tag 0 command 0 lba 0
scsi_req_alloc target 0 lun 0 tag 0
scsi_disk_new_request Command: lun=0 tag=0x0 data= 0x00 0x00 0x00 0x00 0x00 0x00
scsi_test_unit_ready target 0 lun 0 tag 0
scsi_req_dequeue target 0 lun 0 tag 0
lsi_command_complete Command complete status=0

which then completes;

lsi_execute_script SCRIPTS dsp=0x1983a0 opcode 0x60000048 arg 0x0
lsi_execute_script_io_clear Clear ATN ACK
lsi_execute_script SCRIPTS dsp=0x1983a8 opcode 0x48000000 arg 0x0
lsi_execute_script_io_disconnect Wait Disconnect
lsi_reselect Reselected target 0
lsi_add_msg_byte MSG IN 0x80

and when it tries to send another command it sees the reselected target:

lsi_execute_script SCRIPTS dsp=0x198008 opcode 0x60000200 arg 0x0
lsi_execute_script_io_clear Clear TM
lsi_execute_script SCRIPTS dsp=0x198010 opcode 0x40000000 arg 0x198208
lsi_execute_script_io_alreadyreselected Already reselected, jumping to 
alternative address

but this does not yet cause an error, it ends here:

lsi_execute_script SCRIPTS dsp=0x1983a0 opcode 0x60000048 arg 0x0
lsi_execute_script_io_clear Clear ATN ACK
lsi_execute_script SCRIPTS dsp=0x1983a8 opcode 0x48000000 arg 0x0
lsi_execute_script_io_disconnect Wait Disconnect

When the next command is sent it starts normally:

lsi_execute_script SCRIPTS dsp=0x198008 opcode 0x60000200 arg 0x0
lsi_execute_script_io_clear Clear TM
lsi_execute_script SCRIPTS dsp=0x198010 opcode 0x40000000 arg 0x198208
lsi_execute_script_io_selected Selected target 0

but when trying to send the command it gets the assertion. I think the first read above should somehow be finished which I don't see in this log so it may still be queued at this point. Does this make sense to anybody?

Regards,
BALATON Zoltan

Reply via email to