2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
6 /******************************************************************************
10 AROS_LH3(void, CachePostDMA,
13 AROS_LHA(APTR, address, A0),
14 AROS_LHA(ULONG *, length, A1),
15 AROS_LHA(ULONG, flags, D0),
18 struct ExecBase *, SysBase, 128, Exec)
21 Do everything necessary to make CPU caches aware that a DMA has
25 address - Virtual address of memory affected by the DMA
26 *length - Number of bytes affected
27 flags - DMA_NoModify - Indicate that the memory did not change.
28 DMA_ReadFromRAM - Indicate that the DMA goes from RAM
29 to the device. Set this bit in bot calls.
34 DMA must follow a call to CachePreDMA() and must be followed
35 by a call to CachePostDMA().
48 ******************************************************************************/
51 XDEF AROS_SLIB_ENTRY(CachePostDMA_00,Exec,128) ; for 68000/10/20
52 XDEF AROS_SLIB_ENTRY(CachePostDMA_30,Exec,128) ; for 68030+
53 XDEF AROS_SLIB_ENTRY(CachePostDMA_40,Exec,128) ; for 68040/68060
56 #include "aros/m68k/asm.h"
59 #define DMAB_Continue 1 /* Continuation flag for CachePreDMA */
60 #define DMAB_NoModify 2 /* Set if DMA does not update memory */
61 #define DMAB_ReadFromRAM 3 /* Set if DMA goes *FROM* RAM to device */
65 .globl AROS_SLIB_ENTRY(CachePostDMA_00,Exec,128)
66 .type AROS_SLIB_ENTRY(CachePostDMA_00,Exec,128),@function
67 AROS_SLIB_ENTRY(CachePostDMA_00,Exec,128):
77 .globl AROS_SLIB_ENTRY(CachePostDMA_30,Exec,128)
78 .type AROS_SLIB_ENTRY(CachePostDMA_30,Exec,128),@function
79 AROS_SLIB_ENTRY(CachePostDMA_30,Exec,128):
85 btst.l #DMAB_NoModify,%d0 /* Has DMA modified data in mem? */
86 bne.s cpd_30_end /* nope, just exit */
88 lea.l cachepostdmasup_30,%a5
95 /* A DMA device has changed data in main memory. We have to clear
96 the data cache, so we get the chance to see this new data. */
97 or.w #0x0700,%sr /* Disable interrupts */
99 bset.l #11,%d0 /* Set CD Clear Data cache bit */
105 .globl AROS_SLIB_ENTRY(CachePostDMA_40,Exec,128)
106 .type AROS_SLIB_ENTRY(CachePostDMA_40,Exec,128),@function
107 AROS_SLIB_ENTRY(CachePostDMA_40,Exec,128):
113 movem.l %a3/%a5,-(%sp)
115 btst #DMAB_ReadFromRAM,%d0
122 /* Not cache line aligned.
123 * Check CachePreDMA for details. */
124 move.l %a6@(eb_KernelBase),%a3
125 move.l %a3@(kb_PlatformData),%a3
126 tst.l MMU_Level_A(%a3)
130 lea cacheprepostset,%a5
134 jsr -0x27C(%a6) /* CacheClearU() */
138 jsr -0x282(%a6) /* CacheClearE() */
141 movem.l (%sp)+,%a3/%a5
147 movem.l %d0-%d1/%a0-%a1,-(%sp)
154 movem.l (%sp)+,%d0-%d1/%a0-%a1
157 .string "PostDMA(%p,%x,%x)\n"