2018-05-06 21:58:06 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0+ */
|
2008-01-15 11:52:31 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 1998 Dan Malek <dmalek@jlc.net>
|
|
|
|
* Copyright (C) 1999 Magnus Damm <kieraypc01.p.y.kie.era.ericsson.se>
|
|
|
|
* Copyright (C) 2000, 2001,2002 Wolfgang Denk <wd@denx.de>
|
2009-07-29 02:49:52 +00:00
|
|
|
* Copyright Freescale Semiconductor, Inc. 2004, 2006.
|
2008-01-15 11:52:31 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
#include <ppc_asm.tmpl>
|
2015-03-27 15:07:32 +00:00
|
|
|
#include <ppc_defs.h>
|
|
|
|
|
|
|
|
#include <asm/cache.h>
|
2008-01-15 11:52:31 +00:00
|
|
|
|
|
|
|
/*------------------------------------------------------------------------------- */
|
|
|
|
/* Function: ppcDcbf */
|
|
|
|
/* Description: Data Cache block flush */
|
|
|
|
/* Input: r3 = effective address */
|
|
|
|
/* Output: none. */
|
|
|
|
/*------------------------------------------------------------------------------- */
|
|
|
|
.globl ppcDcbf
|
|
|
|
ppcDcbf:
|
|
|
|
dcbf r0,r3
|
|
|
|
blr
|
|
|
|
|
|
|
|
/*------------------------------------------------------------------------------- */
|
|
|
|
/* Function: ppcDcbi */
|
|
|
|
/* Description: Data Cache block Invalidate */
|
|
|
|
/* Input: r3 = effective address */
|
|
|
|
/* Output: none. */
|
|
|
|
/*------------------------------------------------------------------------------- */
|
|
|
|
.globl ppcDcbi
|
|
|
|
ppcDcbi:
|
|
|
|
dcbi r0,r3
|
|
|
|
blr
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------------
|
|
|
|
* Function: ppcDcbz
|
|
|
|
* Description: Data Cache block zero.
|
|
|
|
* Input: r3 = effective address
|
|
|
|
* Output: none.
|
|
|
|
*-------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
.globl ppcDcbz
|
|
|
|
ppcDcbz:
|
|
|
|
dcbz r0,r3
|
|
|
|
blr
|
|
|
|
|
|
|
|
/*------------------------------------------------------------------------------- */
|
|
|
|
/* Function: ppcSync */
|
|
|
|
/* Description: Processor Synchronize */
|
|
|
|
/* Input: none. */
|
|
|
|
/* Output: none. */
|
|
|
|
/*------------------------------------------------------------------------------- */
|
|
|
|
.globl ppcSync
|
|
|
|
ppcSync:
|
|
|
|
sync
|
|
|
|
blr
|
2015-03-27 15:07:32 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Write any modified data cache blocks out to memory and invalidate them.
|
|
|
|
* Does not invalidate the corresponding instruction cache blocks.
|
|
|
|
*
|
|
|
|
* flush_dcache_range(unsigned long start, unsigned long stop)
|
|
|
|
*/
|
|
|
|
_GLOBAL(flush_dcache_range)
|
2017-06-27 14:49:14 +00:00
|
|
|
#if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
|
2015-03-27 15:07:32 +00:00
|
|
|
li r5,L1_CACHE_BYTES-1
|
|
|
|
andc r3,r3,r5
|
|
|
|
subf r4,r3,r4
|
|
|
|
add r4,r4,r5
|
|
|
|
srwi. r4,r4,L1_CACHE_SHIFT
|
|
|
|
beqlr
|
|
|
|
mtctr r4
|
|
|
|
|
|
|
|
1: dcbf 0,r3
|
|
|
|
addi r3,r3,L1_CACHE_BYTES
|
|
|
|
bdnz 1b
|
|
|
|
sync /* wait for dcbst's to get to ram */
|
2016-04-07 16:56:48 +00:00
|
|
|
#endif
|
2015-03-27 15:07:32 +00:00
|
|
|
blr
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Like above, but invalidate the D-cache. This is used by the 8xx
|
|
|
|
* to invalidate the cache so the PPC core doesn't get stale data
|
|
|
|
* from the CPM (no cache snooping here :-).
|
|
|
|
*
|
|
|
|
* invalidate_dcache_range(unsigned long start, unsigned long stop)
|
|
|
|
*/
|
|
|
|
_GLOBAL(invalidate_dcache_range)
|
2017-06-27 14:49:14 +00:00
|
|
|
#if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
|
2015-03-27 15:07:32 +00:00
|
|
|
li r5,L1_CACHE_BYTES-1
|
|
|
|
andc r3,r3,r5
|
|
|
|
subf r4,r3,r4
|
|
|
|
add r4,r4,r5
|
|
|
|
srwi. r4,r4,L1_CACHE_SHIFT
|
|
|
|
beqlr
|
|
|
|
mtctr r4
|
|
|
|
|
|
|
|
sync
|
|
|
|
1: dcbi 0,r3
|
|
|
|
addi r3,r3,L1_CACHE_BYTES
|
|
|
|
bdnz 1b
|
|
|
|
sync /* wait for dcbi's to get to ram */
|
2016-04-07 16:56:48 +00:00
|
|
|
#endif
|
2015-03-27 15:07:32 +00:00
|
|
|
blr
|