Re: [hatari-devel] Cycle exact setting affects nf_scsidrv |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
]
- To: hatari-devel@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [hatari-devel] Cycle exact setting affects nf_scsidrv
- From: Uwe Seimet <Uwe.Seimet@xxxxxxxxx>
- Date: Thu, 11 Oct 2018 23:09:33 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1539292173; s=strato-dkim-0002; d=seimet.de; h=In-Reply-To:References:Message-ID:Subject:To:From:Date: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=zhmb09LjpdDP8J/BRFg0XGCPpIqJQHsKAOBSlVZWwpA=; b=rb0mHKAK2oISI/2WFaleuCM8XM6oCztKxZCa8glm5zfGuzK/mBZMbpbJB2g2ZC0WpH ekeh+lkGpztTzpnz5pGiVd3rljs0JfJvoH8oRMAMC86ptRDiF93OcMa6OweblMXf9FKp Cs+7fSfaW74aI0xYiVFg3JZd0PMZmzvy7kCXmdAq8fO9NIa6DxeAboNccJVPZdpdWoxk Z8zfKORKPpDOC2+z46Io98WrRsCbn/P+obmoNKUxbeYRMIrKspq3He78wxkCJsklotUJ WBzRdM4Gs9XKs6GAFtw3VZtylNbqYMKB4eIfbz6lhqvHk81cQzBGr3qxm6uKJ3Ga0HSe hNQA==
Please discard the previous patch and use this one.
> Hi,
>
> Thank you. Attached there is a patch for nf_scsidrv.c.
>
> Best regards
>
> Uwe
>
> > Le 11/10/2018 à 22:11, Uwe Seimet a écrit :
> > > Hi,
> > >
> > >> I don't see these flushes in your nf_scsidrv.c Hatari code.
> > >>
> > >> Tested patches welcome! :-)
> > >
> > > Since I cannot reproduce the original issue anymore, which is not that
> > > surprising if it's about caches, I will only be able to test that currently
> > > with this patch on my machine it works as expected.
> > >
> > > But first I need a hint how to correctly convert "unsigned char *" to
> > > uaecptr. Of course, I could just pass 0, becausing flushing ignores
> > > the address and size anyway :-).
> > >
> >
> > uaecptr is just a 32 bit pointer to somewhere in the emulated machine
> > memory, so it's just an unsigned int
> >
> > src/cpu/sysdeps.h:typedef uae_u32 uaecptr;
> >
> > for example, look at GemDOS_SNext() in gemdos.c
> >
> > Nicolas
> >
> >
> diff -r e87617b4fe45 src/nf_scsidrv.c
> --- a/src/nf_scsidrv.c Thu Oct 11 18:30:37 2018 +0200
> +++ b/src/nf_scsidrv.c Thu Oct 11 22:51:41 2018 +0200
> @@ -28,6 +28,7 @@
> #include "stMemory.h"
> #include "log.h"
> #include "gemdos_defines.h"
> +#include "m68000.h"
> #include "nf_scsidrv.h"
>
> // The driver interface version, 1.02
> @@ -173,11 +174,13 @@
>
> static int scsidrv_interface_features(Uint32 stack)
> {
> + Uint32 st_bus_name = STMemory_ReadLong(stack);
> char *busName = read_stack_pointer(&stack);
> Uint32 features = read_stack_long(&stack);
> Uint32 transferLen = read_stack_long(&stack);
>
> strncpy(busName, BUS_NAME, 20);
> + M68000_Flush_Data_Cache(st_bus_name, 20);
> write_word(features, BUS_FEATURES);
> write_long(transferLen, BUS_TRANSFER_LEN);
>
> @@ -288,8 +291,10 @@
> Uint32 dir = read_stack_long(&stack);
> unsigned char *cmd = read_stack_pointer(&stack);
> Uint32 cmd_len = read_stack_long(&stack);
> + Uint32 st_buffer = STMemory_ReadLong(stack);
> unsigned char *buffer = read_stack_pointer(&stack);
> Uint32 transfer_len = read_stack_long(&stack);
> + Uint32 st_sense_buffer = STMemory_ReadLong(stack);
> unsigned char *sense_buffer = read_stack_pointer(&stack);
> Uint32 timeout;
> int status;
> @@ -331,6 +336,7 @@
> // Sense Key and ASC
> sense_buffer[2] = 0x05;
> sense_buffer[12] = 0x25;
> + M68000_Flush_Data_Cache(st_sense_buffer, 18);
>
> LOG_TRACE(TRACE_SCSIDRV,
> "\n Sense Key=$%02X, ASC=$%02X, ASCQ=$00",
> @@ -415,7 +421,13 @@
> }
> }
>
> - return status;
> + M68000_Flush_Data_Cache(st_sense_buffer, 18);
> + if (dir)
> + {
> + M68000_Flush_Data_Cache(st_buffer, transfer_len);
> + }
> +
> + return status;
> }
>
> // SCSI Driver: Error()
diff -r e87617b4fe45 src/nf_scsidrv.c
--- a/src/nf_scsidrv.c Thu Oct 11 18:30:37 2018 +0200
+++ b/src/nf_scsidrv.c Thu Oct 11 23:08:51 2018 +0200
@@ -28,6 +28,7 @@
#include "stMemory.h"
#include "log.h"
#include "gemdos_defines.h"
+#include "m68000.h"
#include "nf_scsidrv.h"
// The driver interface version, 1.02
@@ -173,11 +174,13 @@
static int scsidrv_interface_features(Uint32 stack)
{
+ Uint32 st_bus_name = STMemory_ReadLong(stack);
char *busName = read_stack_pointer(&stack);
Uint32 features = read_stack_long(&stack);
Uint32 transferLen = read_stack_long(&stack);
strncpy(busName, BUS_NAME, 20);
+ M68000_Flush_Data_Cache(st_bus_name, 20);
write_word(features, BUS_FEATURES);
write_long(transferLen, BUS_TRANSFER_LEN);
@@ -288,8 +291,10 @@
Uint32 dir = read_stack_long(&stack);
unsigned char *cmd = read_stack_pointer(&stack);
Uint32 cmd_len = read_stack_long(&stack);
+ Uint32 st_buffer = STMemory_ReadLong(stack);
unsigned char *buffer = read_stack_pointer(&stack);
Uint32 transfer_len = read_stack_long(&stack);
+ Uint32 st_sense_buffer = STMemory_ReadLong(stack);
unsigned char *sense_buffer = read_stack_pointer(&stack);
Uint32 timeout;
int status;
@@ -331,6 +336,7 @@
// Sense Key and ASC
sense_buffer[2] = 0x05;
sense_buffer[12] = 0x25;
+ M68000_Flush_Data_Cache(st_sense_buffer, 18);
LOG_TRACE(TRACE_SCSIDRV,
"\n Sense Key=$%02X, ASC=$%02X, ASCQ=$00",
@@ -415,7 +421,13 @@
}
}
- return status;
+ M68000_Flush_Data_Cache(st_sense_buffer, 18);
+ if (!dir)
+ {
+ M68000_Flush_Data_Cache(st_buffer, transfer_len);
+ }
+
+ return status;
}
// SCSI Driver: Error()