xref: /illumos-gate/usr/src/uts/sun4u/sys/mem_cache.h (revision bbf21555)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 #ifndef _MEM_CACHE_H
26 #define	_MEM_CACHE_H
27 
28 #ifdef	__cplusplus
29 extern "C" {
30 #endif
31 
32 #define	mem_cache_device	"/devices/pseudo/mem_cache@0:mem_cache0"
33 #define	mem_cache_device1	"/devices/pseudo/mem_cache@1:mem_cache1"
34 #define	mem_cache_device2	"/devices/pseudo/mem_cache@2:mem_cache2"
35 #define	mem_cache_device3	"/devices/pseudo/mem_cache@3:mem_cache3"
36 #define	MEM_CACHE_DRIVER_NAME	"mem_cache"
37 #ifdef DEBUG
38 #define	MAX_MEM_CACHE_INSTANCES	4
39 #else
40 #define	MAX_MEM_CACHE_INSTANCES	1
41 #endif
42 #define	PN_CACHE_NWAYS	4
43 #define	PN_CACHE_LINESIZE	64
44 #define	PN_CACHE_LINE_SHIFT	6
45 #define	MAX_BIT_POSITION	511
46 #define	PN_L2_IDX_HW_ECC_EN	INT64_C(0x0000000000400000)
47 #define	PN_L3_IDX_HW_ECC_EN	INT64_C(0x0000000002000000)
48 #define	MSB_BIT_MASK		(1 << 15)
49 #define	TAG_BIT_MASK		0x3f
50 
51 
52 /*
53  * Private ioctls for fmd(8).  These interfaces are Sun Private.  Applications
54  * and drivers should not make use of these interfaces: they can change without
55  * notice and programs that consume them will fail to run on future releases.
56  */
57 
58 #define	MEM_CACHE_RETIRE	(('C' << 8) | 0x01)
59 #define	MEM_CACHE_ISRETIRED	(('C' << 8) | 0x02)
60 #define	MEM_CACHE_UNRETIRE	(('C' << 8) | 0x03)
61 #define	MEM_CACHE_STATE		(('C' << 8) | 0x04)
62 #define	MEM_CACHE_READ_TAGS	(('C' << 8) | 0x05)
63 #define	MEM_CACHE_INJECT_ERR	(('C' << 8) | 0x06)
64 #define	MEM_CACHE_READ_ERROR_INJECTED_TAGS	(('C' << 8) | 0x07)
65 #define	MEM_CACHE_PARK_UNPARK	(('C' << 8) | 0x08)
66 #define	MEM_CACHE_READ_RETIRE_CODE	(('C' << 8) | 0x09)
67 #define	MEM_CACHE_RW_RETIRE_CODE	(('C' << 8) | 0x0a)
68 #define	MEM_CACHE_RETIRE_AND_RW	(('C' << 8) | 0x0b)
69 #define	MEM_CACHE_RW_COLLISION_CODE	(('C' << 8) | 0x0c)
70 #define	MEM_CACHE_UNRETIRE_AND_RW	(('C' << 8) | 0x0d)
71 #define	MEM_CACHE_RETIRE_AND_UNRETIRE_RW	(('C' << 8) | 0x0e)
72 
73 typedef enum {
74 	L2_CACHE_DATA,
75 	L2_CACHE_TAG,
76 	L3_CACHE_DATA,
77 	L3_CACHE_TAG
78 } cache_id_t;
79 
80 typedef struct cache_info {
81 		int		cpu_id;
82 		cache_id_t	cache;
83 		uint32_t	index;
84 		uint32_t	way;
85 		uint16_t	bit;
86 		void		*datap;
87 } cache_info_t;
88 
89 #ifdef	__cplusplus
90 }
91 #endif
92 
93 #endif /* _MEM_CACHE_H */
94