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 22:52:33 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1539291153; 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=tckC673f3r9QIPC/95kcBfEhOlF6FcM3Q1A6WCZLKyY=; b=kkRL8LWzuJIara/Lz1RHo710jOSsWsjp3KXmuczCsqZF/M/oW71NtS3WnZqod75bJZ 5Cs95jNzrO++58rI4SCRab+onT1uLAg6y7ypv6PMtAwC5HvWMgTJfP7Is274/4edy3ue 4LOpQz1fmnhKYquHUpQ5LOo2Yw5KwrEvVQUHgBEqoXpOREw34Sj4gAIbahTR08SGaCnr x/ZUuK1fpYMVHxIRZfIYGp1qFvUFY7qJvDVdkTs/bPM9r5/WVFSdAHK5Zo24rgb1Twwd pjJbSTLIL2JUrd/9X2vj2rLCeM+QIhZJhdHu1noQb6o7Wd/uFodEPNoaxaHY/yph87a0 dd/A==
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()