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