46extern void l2cache_register_drv(
void);
48#define L2CACHE_ERR_OK 0
49#define L2CACHE_ERR_NOINIT -1
50#define L2CACHE_ERR_EINVAL -2
51#define L2CACHE_ERR_TOOMANY -3
52#define L2CACHE_ERR_ERROR -4
55#define L2CACHE_OPTIONS_FLUSH_WAIT (0x1 << 2)
56#define L2CACHE_OPTIONS_FLUSH_INVALIDATE (0x3 << 0)
57#define L2CACHE_OPTIONS_FLUSH_WRITEBACK (0x2 << 0)
58#define L2CACHE_OPTIONS_FLUSH_INV_WBACK (0x1 << 0)
59#define L2CACHE_OPTIONS_FLUSH_NONE (0 << 0)
62#define L2CACHE_STATUS_ENABLED 1
63#define L2CACHE_STATUS_SPLIT_ENABLED (0x1 << 1)
64#define L2CACHE_STATUS_EDAC_ENABLED (0x1 << 2)
65#define L2CACHE_STATUS_REPL (0x3 << L2CACHE_STATUS_REPL_BIT)
66#define L2CACHE_STATUS_REPL_BIT 3
67#define L2CACHE_STATUS_WRITETHROUGH (0x1 << 5)
68#define L2CACHE_STATUS_LOCK (0xf << L2CACHE_STATUS_LOCK_BIT)
69#define L2CACHE_STATUS_LOCK_BIT 6
70#define L2CACHE_STATUS_SCRUB_ENABLED (0x1 << 10)
71#define L2CACHE_STATUS_INT (0xf << L2CACHE_STATUS_INT_BIT)
72#define L2CACHE_STATUS_INT_BIT 11
73#define L2CACHE_STATUS_INT_BCKEND (0x1 << 11)
74#define L2CACHE_STATUS_INT_WPHIT (0x1 << 12)
75#define L2CACHE_STATUS_INT_UEE (0x1 << 13)
76#define L2CACHE_STATUS_INT_CEE (0x1 << 14)
77#define L2CACHE_STATUS_SCRUB_DELAY (0xffff << L2CACHE_STATUS_SCRUB_DELAY_BIT)
78#define L2CACHE_STATUS_SCRUB_DELAY_BIT 15
79#define L2CACHE_STATUS_SIGN_BIT 31
82#define L2CACHE_ENABLED(status) (status & L2CACHE_STATUS_ENABLED)
83#define L2CACHE_DISABLED(status) (!(status & L2CACHE_STATUS_ENABLED))
84#define L2CACHE_SPLIT_ENABLED(status) (status & L2CACHE_STATUS_SPLIT_ENABLED)
85#define L2CACHE_SPLIT_DISABLED(status) \
86 (!(status & L2CACHE_STATUS_SPLIT_ENABLED))
87#define L2CACHE_EDAC_ENABLED(status) (status & L2CACHE_STATUS_EDAC_ENABLED)
88#define L2CACHE_EDAC_DISABLED(status) (!(status & L2CACHE_STATUS_EDAC_ENABLED))
89#define L2CACHE_REPL(status) \
90 ((status & L2CACHE_STATUS_REPL) >> L2CACHE_STATUS_REPL_BIT)
91#define L2CACHE_WRITETHROUGH(status) (status & L2CACHE_STATUS_WRITETHROUGH)
92#define L2CACHE_WRITEBACK(status) (!(status & L2CACHE_STATUS_WRITETHROUGH))
93#define L2CACHE_LOCKED_WAYS(status) \
94 ((status & L2CACHE_STATUS_LOCK) >> L2CACHE_STATUS_LOCK_BIT)
95#define L2CACHE_SCRUB_ENABLED(status) (status & L2CACHE_STATUS_SCRUB_ENABLED)
96#define L2CACHE_SCRUB_DISABLED(status) \
97 (!(status & L2CACHE_STATUS_SCRUB_ENABLED))
98#define L2CACHE_SCRUB_DELAY(status) \
99 ((status & L2CACHE_STATUS_SCRUB_DELAY) >> L2CACHE_STATUS_SCRUB_DELAY_BIT)
100#define L2CACHE_INT_ENABLED(status) (status & L2CACHE_STATUS_INT)
101#define L2CACHE_INT_DISABLED(status) (!(status & L2CACHE_STATUS_INT))
102extern int l2cache_status(
void);
105extern int l2cache_enable(
int flush);
106extern int l2cache_disable(
int flush);
108extern int l2cache_split_enable(
void);
109extern int l2cache_split_disable(
void);
111extern int l2cache_edac_enable(
int flush);
112extern int l2cache_edac_disable(
int flush);
114extern int l2cache_scrub_enable(
int delay);
115extern int l2cache_scrub_disable(
void);
116extern int l2cache_scrub_line(
int way,
int index);
118extern int l2cache_writethrough(
int flush);
119extern int l2cache_writeback(
int flush);
121#define L2CACHE_OPTIONS_REPL_INDEX_WAY_BIT (2)
122#define L2CACHE_OPTIONS_REPL_MASTERIDX_MOD (3 << 0)
123#define L2CACHE_OPTIONS_REPL_MASTERIDX_IDX (2 << 0)
124#define L2CACHE_OPTIONS_REPL_RANDOM (1 << 0)
125#define L2CACHE_OPTIONS_REPL_LRU (0 << 0)
126extern int l2cache_replacement(
int options,
int flush);
129extern int l2cache_flush(
int flush);
130extern int l2cache_flush_address(uint32_t addr,
int size,
int flush);
131extern int l2cache_flush_line(
int way,
int index,
int flush);
132extern int l2cache_flush_way(
int way,
int flush);
135#define L2CACHE_OPTIONS_DIRTY (0x1 << 2)
136#define L2CACHE_OPTIONS_VALID (0x1 << 1)
137#define L2CACHE_OPTIONS_FETCH (0x1 << 0)
138#define L2CACHE_OPTIONS_DISABLE 2
139#define L2CACHE_OPTIONS_ENABLE 1
140#define L2CACHE_OPTIONS_NONE 0
141extern int l2cache_lock_way(uint32_t tag,
int options,
int flush,
int enable);
142extern int l2cache_unlock(
void);
145extern int l2cache_fill_way(
int way, uint32_t tag,
int options,
int flush);
148#define L2CACHE_OPTIONS_MTRR_ACCESS_WRITETHROUGH (0x1 << 2)
149#define L2CACHE_OPTIONS_MTRR_ACCESS_UNCACHED (0x0 << 2)
150#define L2CACHE_OPTIONS_MTRR_WRITEPROT_ENABLE (0x1 << 1)
151#define L2CACHE_OPTIONS_MTRR_WRITEPROT_DISABLE (0x0 << 1)
152extern int l2cache_mtrr_enable(
int id, uint32_t addr, uint32_t mask,
153 int options,
int flush);
154extern int l2cache_mtrr_disable(
int id);
157extern int l2cache_print(
void);
165typedef void (*l2cache_isr_t)(
void *arg, uint32_t addr, uint32_t status);
166#define L2CACHE_INTERRUPT_ALL (0xf << 0)
167#define L2CACHE_INTERRUPT_BACKENDERROR (0x1 << 3)
168#define L2CACHE_INTERRUPT_WPROTHIT (0x1 << 2)
169#define L2CACHE_INTERRUPT_UNCORRERROR (0x1 << 1)
170#define L2CACHE_INTERRUPT_CORRERROR (0x1 << 0)
171extern int l2cache_isr_register( l2cache_isr_t isr,
void * arg,
int options);
172extern int l2cache_isr_unregister(
void);
173extern int l2cache_interrupt_mask(
int options);
174extern int l2cache_interrupt_unmask(
int options);
177#define L2CACHE_STATUS_MULTIPLEERRORS 2
178#define L2CACHE_STATUS_NEWERROR 1
179#define L2CACHE_STATUS_NOERROR 0
180extern int l2cache_error_status(uint32_t * addr, uint32_t * status);
198struct l2cache_dataline {
202extern int l2cache_get_index( uint32_t addr);
203extern uint32_t l2cache_get_tag( uint32_t addr);
205extern int l2cache_diag_tag(
int way,
int index,
struct l2cache_tag * tag);
206extern int l2cache_diag_line(
int way,
int index,
207 struct l2cache_dataline * dataline);
210#define L2CACHE_MISS 0
211extern int l2cache_lookup(uint32_t addr,
int * way);
213extern int l2cache_error_inject_address( uint32_t addr, uint32_t mask);