xref: /illumos-gate/usr/src/uts/sun4u/sys/mem_cache.h (revision bbf215553c7233fbab8a0afdf1fac74c44781867)
17bebe46cSjc25722 /*
27bebe46cSjc25722  * CDDL HEADER START
37bebe46cSjc25722  *
47bebe46cSjc25722  * The contents of this file are subject to the terms of the
57bebe46cSjc25722  * Common Development and Distribution License (the "License").
67bebe46cSjc25722  * You may not use this file except in compliance with the License.
77bebe46cSjc25722  *
87bebe46cSjc25722  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97bebe46cSjc25722  * or http://www.opensolaris.org/os/licensing.
107bebe46cSjc25722  * See the License for the specific language governing permissions
117bebe46cSjc25722  * and limitations under the License.
127bebe46cSjc25722  *
137bebe46cSjc25722  * When distributing Covered Code, include this CDDL HEADER in each
147bebe46cSjc25722  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157bebe46cSjc25722  * If applicable, add the following below this CDDL HEADER, with the
167bebe46cSjc25722  * fields enclosed by brackets "[]" replaced with your own identifying
177bebe46cSjc25722  * information: Portions Copyright [yyyy] [name of copyright owner]
187bebe46cSjc25722  *
197bebe46cSjc25722  * CDDL HEADER END
207bebe46cSjc25722  */
217bebe46cSjc25722 /*
227bebe46cSjc25722  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
237bebe46cSjc25722  * Use is subject to license terms.
247bebe46cSjc25722  */
257bebe46cSjc25722 #ifndef _MEM_CACHE_H
267bebe46cSjc25722 #define	_MEM_CACHE_H
277bebe46cSjc25722 
287bebe46cSjc25722 #ifdef	__cplusplus
297bebe46cSjc25722 extern "C" {
307bebe46cSjc25722 #endif
317bebe46cSjc25722 
327bebe46cSjc25722 #define	mem_cache_device	"/devices/pseudo/mem_cache@0:mem_cache0"
337bebe46cSjc25722 #define	mem_cache_device1	"/devices/pseudo/mem_cache@1:mem_cache1"
347bebe46cSjc25722 #define	mem_cache_device2	"/devices/pseudo/mem_cache@2:mem_cache2"
357bebe46cSjc25722 #define	mem_cache_device3	"/devices/pseudo/mem_cache@3:mem_cache3"
367bebe46cSjc25722 #define	MEM_CACHE_DRIVER_NAME	"mem_cache"
377bebe46cSjc25722 #ifdef DEBUG
387bebe46cSjc25722 #define	MAX_MEM_CACHE_INSTANCES	4
397bebe46cSjc25722 #else
407bebe46cSjc25722 #define	MAX_MEM_CACHE_INSTANCES	1
417bebe46cSjc25722 #endif
427bebe46cSjc25722 #define	PN_CACHE_NWAYS	4
437bebe46cSjc25722 #define	PN_CACHE_LINESIZE	64
447bebe46cSjc25722 #define	PN_CACHE_LINE_SHIFT	6
457bebe46cSjc25722 #define	MAX_BIT_POSITION	511
467bebe46cSjc25722 #define	PN_L2_IDX_HW_ECC_EN	INT64_C(0x0000000000400000)
477bebe46cSjc25722 #define	PN_L3_IDX_HW_ECC_EN	INT64_C(0x0000000002000000)
487bebe46cSjc25722 #define	MSB_BIT_MASK		(1 << 15)
497bebe46cSjc25722 #define	TAG_BIT_MASK		0x3f
507bebe46cSjc25722 
517bebe46cSjc25722 
527bebe46cSjc25722 /*
53*bbf21555SRichard Lowe  * Private ioctls for fmd(8).  These interfaces are Sun Private.  Applications
547bebe46cSjc25722  * and drivers should not make use of these interfaces: they can change without
557bebe46cSjc25722  * notice and programs that consume them will fail to run on future releases.
567bebe46cSjc25722  */
577bebe46cSjc25722 
587bebe46cSjc25722 #define	MEM_CACHE_RETIRE	(('C' << 8) | 0x01)
597bebe46cSjc25722 #define	MEM_CACHE_ISRETIRED	(('C' << 8) | 0x02)
607bebe46cSjc25722 #define	MEM_CACHE_UNRETIRE	(('C' << 8) | 0x03)
617bebe46cSjc25722 #define	MEM_CACHE_STATE		(('C' << 8) | 0x04)
627bebe46cSjc25722 #define	MEM_CACHE_READ_TAGS	(('C' << 8) | 0x05)
637bebe46cSjc25722 #define	MEM_CACHE_INJECT_ERR	(('C' << 8) | 0x06)
647bebe46cSjc25722 #define	MEM_CACHE_READ_ERROR_INJECTED_TAGS	(('C' << 8) | 0x07)
657bebe46cSjc25722 #define	MEM_CACHE_PARK_UNPARK	(('C' << 8) | 0x08)
667bebe46cSjc25722 #define	MEM_CACHE_READ_RETIRE_CODE	(('C' << 8) | 0x09)
677bebe46cSjc25722 #define	MEM_CACHE_RW_RETIRE_CODE	(('C' << 8) | 0x0a)
687bebe46cSjc25722 #define	MEM_CACHE_RETIRE_AND_RW	(('C' << 8) | 0x0b)
697bebe46cSjc25722 #define	MEM_CACHE_RW_COLLISION_CODE	(('C' << 8) | 0x0c)
707bebe46cSjc25722 #define	MEM_CACHE_UNRETIRE_AND_RW	(('C' << 8) | 0x0d)
717bebe46cSjc25722 #define	MEM_CACHE_RETIRE_AND_UNRETIRE_RW	(('C' << 8) | 0x0e)
727bebe46cSjc25722 
737bebe46cSjc25722 typedef enum {
747bebe46cSjc25722 	L2_CACHE_DATA,
757bebe46cSjc25722 	L2_CACHE_TAG,
767bebe46cSjc25722 	L3_CACHE_DATA,
777bebe46cSjc25722 	L3_CACHE_TAG
787bebe46cSjc25722 } cache_id_t;
797bebe46cSjc25722 
807bebe46cSjc25722 typedef struct cache_info {
817bebe46cSjc25722 		int		cpu_id;
827bebe46cSjc25722 		cache_id_t	cache;
837bebe46cSjc25722 		uint32_t	index;
847bebe46cSjc25722 		uint32_t	way;
857bebe46cSjc25722 		uint16_t	bit;
867bebe46cSjc25722 		void		*datap;
877bebe46cSjc25722 } cache_info_t;
887bebe46cSjc25722 
897bebe46cSjc25722 #ifdef	__cplusplus
907bebe46cSjc25722 }
917bebe46cSjc25722 #endif
927bebe46cSjc25722 
937bebe46cSjc25722 #endif /* _MEM_CACHE_H */
94