|
From: darcagn <da...@us...> - 2024-08-27 16:19:15
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "A pseudo Operating System for the Dreamcast.".
The branch, master has been updated
via 715eb80e6e0ca1edf343b0fecee3275a67a5fab3 (commit)
via 0ba2d733dbcda4e735adfd876c501720a2ab1e50 (commit)
via d6260e268f41f22065001508d041ff7f864beeb8 (commit)
from d2ace52770a1f001847db31f829c3a572c9b8730 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 715eb80e6e0ca1edf343b0fecee3275a67a5fab3
Merge: d2ace527 0ba2d733
Author: darcagn <da...@pr...>
Date: Tue Aug 27 11:18:13 2024 -0500
Merge pull request #729 from DC-SWAT/g1_dma_unlock
Unlock all memory for G1 ATA DMA.
commit 0ba2d733dbcda4e735adfd876c501720a2ab1e50
Author: DC-SWAT <sw...@21...>
Date: Tue Aug 27 20:34:20 2024 +0700
Manage cache only on system RAM.
commit d6260e268f41f22065001508d041ff7f864beeb8
Author: DC-SWAT <sw...@21...>
Date: Tue Aug 27 15:59:15 2024 +0700
Unlock all memory for G1 ATA DMA.
This allows data to be loaded directly into video and audio memory.
-----------------------------------------------------------------------
Summary of changes:
kernel/arch/dreamcast/hardware/g1ata.c | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/kernel/arch/dreamcast/hardware/g1ata.c b/kernel/arch/dreamcast/hardware/g1ata.c
index 777c8b52..badc9ebc 100644
--- a/kernel/arch/dreamcast/hardware/g1ata.c
+++ b/kernel/arch/dreamcast/hardware/g1ata.c
@@ -2,7 +2,7 @@
hardware/g1ata.c
Copyright (C) 2013, 2014, 2015 Lawrence Sebald
- Copyright (C) 2015, 2023 Ruslan Rostovtsev
+ Copyright (C) 2015, 2023, 2024 Ruslan Rostovtsev
*/
#include <errno.h>
@@ -109,8 +109,12 @@ typedef struct ata_devdata {
#define G1_ATA_DMA_STATUS 0xA05F7418 /* Read/Write */
#define G1_ATA_DMA_PROTECTION 0xA05F74B8 /* Write-only */
+/* Protection register code. */
+#define G1_DMA_UNLOCK_CODE 0x8843
/* System memory protection unlock value. */
-#define G1_DMA_UNLOCK_SYSMEM 0x8843407F
+#define G1_DMA_UNLOCK_SYSMEM (G1_DMA_UNLOCK_CODE << 16 | 0x407F)
+/* All memory protection unlock value. */
+#define G1_DMA_UNLOCK_ALLMEM (G1_DMA_UNLOCK_CODE << 16 | 0x007F)
/* Bitmasks for the STATUS_REG/ALT_STATUS registers. */
#define G1_ATA_SR_ERR 0x01
@@ -665,8 +669,10 @@ int g1_ata_read_lba_dma(uint64_t sector, size_t count, void *buf,
return -1;
}
- /* Invalidate the dcache over the range of the data. */
- dcache_inval_range((uint32)buf, count * 512);
+ if((addr >> 24) == 0x0C) {
+ /* Invalidate the dcache over the range of the data. */
+ dcache_inval_range((uint32)buf, count * 512);
+ }
/* Lock the mutex. It will be unlocked later in the IRQ handler. */
if(g1_ata_mutex_lock())
@@ -845,8 +851,10 @@ int g1_ata_write_lba_dma(uint64_t sector, size_t count, const void *buf,
return -1;
}
- /* Flush the dcache over the range of the data. */
- dcache_flush_range((uint32)buf, count * 512);
+ if((addr >> 24) == 0x0C) {
+ /* Flush the dcache over the range of the data. */
+ dcache_flush_range((uint32)buf, count * 512);
+ }
/* Lock the mutex. It will be unlocked in the IRQ handler later. */
if(g1_ata_mutex_lock())
@@ -1057,7 +1065,7 @@ static int g1_ata_scan(void) {
if(!g1_ata_set_transfer_mode(ATA_TRANSFER_WDMA(2))) {
OUT32(G1_ATA_DMA_RACCESS_WAIT, G1_ACCESS_WDMA_MODE2);
OUT32(G1_ATA_DMA_WACCESS_WAIT, G1_ACCESS_WDMA_MODE2);
- OUT32(G1_ATA_DMA_PROTECTION, G1_DMA_UNLOCK_SYSMEM);
+ OUT32(G1_ATA_DMA_PROTECTION, G1_DMA_UNLOCK_ALLMEM);
}
else {
device.wdma_modes = 0;
hooks/post-receive
--
A pseudo Operating System for the Dreamcast.
|