Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * This file is subject to the terms and conditions of the GNU General Public
0003  * License.  See the file "COPYING" in the main directory of this archive
0004  * for more details.
0005  *
0006  * Copyright (c) 1997, 1999 by Ralf Baechle
0007  * Copyright (c) 1999 Silicon Graphics, Inc.
0008  */
0009 #ifndef _ASM_BCACHE_H
0010 #define _ASM_BCACHE_H
0011 
0012 #include <linux/types.h>
0013 
0014 /* Some R4000 / R4400 / R4600 / R5000 machines may have a non-dma-coherent,
0015    chipset implemented caches.  On machines with other CPUs the CPU does the
0016    cache thing itself. */
0017 struct bcache_ops {
0018     void (*bc_enable)(void);
0019     void (*bc_disable)(void);
0020     void (*bc_wback_inv)(unsigned long page, unsigned long size);
0021     void (*bc_inv)(unsigned long page, unsigned long size);
0022     void (*bc_prefetch_enable)(void);
0023     void (*bc_prefetch_disable)(void);
0024     bool (*bc_prefetch_is_enabled)(void);
0025 };
0026 
0027 extern void indy_sc_init(void);
0028 
0029 #ifdef CONFIG_BOARD_SCACHE
0030 
0031 extern struct bcache_ops *bcops;
0032 
0033 static inline void bc_enable(void)
0034 {
0035     bcops->bc_enable();
0036 }
0037 
0038 static inline void bc_disable(void)
0039 {
0040     bcops->bc_disable();
0041 }
0042 
0043 static inline void bc_wback_inv(unsigned long page, unsigned long size)
0044 {
0045     bcops->bc_wback_inv(page, size);
0046 }
0047 
0048 static inline void bc_inv(unsigned long page, unsigned long size)
0049 {
0050     bcops->bc_inv(page, size);
0051 }
0052 
0053 static inline void bc_prefetch_enable(void)
0054 {
0055     if (bcops->bc_prefetch_enable)
0056         bcops->bc_prefetch_enable();
0057 }
0058 
0059 static inline void bc_prefetch_disable(void)
0060 {
0061     if (bcops->bc_prefetch_disable)
0062         bcops->bc_prefetch_disable();
0063 }
0064 
0065 static inline bool bc_prefetch_is_enabled(void)
0066 {
0067     if (bcops->bc_prefetch_is_enabled)
0068         return bcops->bc_prefetch_is_enabled();
0069 
0070     return false;
0071 }
0072 
0073 #else /* !defined(CONFIG_BOARD_SCACHE) */
0074 
0075 /* Not R4000 / R4400 / R4600 / R5000.  */
0076 
0077 #define bc_enable() do { } while (0)
0078 #define bc_disable() do { } while (0)
0079 #define bc_wback_inv(page, size) do { } while (0)
0080 #define bc_inv(page, size) do { } while (0)
0081 #define bc_prefetch_enable() do { } while (0)
0082 #define bc_prefetch_disable() do { } while (0)
0083 #define bc_prefetch_is_enabled() 0
0084 
0085 #endif /* !defined(CONFIG_BOARD_SCACHE) */
0086 
0087 #endif /* _ASM_BCACHE_H */