1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate #ifndef _PIC16f747_H 28*7c478bd9Sstevel@tonic-gate #define _PIC16f747_H 29*7c478bd9Sstevel@tonic-gate 30*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*7c478bd9Sstevel@tonic-gate 32*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 33*7c478bd9Sstevel@tonic-gate extern "C" { 34*7c478bd9Sstevel@tonic-gate #endif 35*7c478bd9Sstevel@tonic-gate 36*7c478bd9Sstevel@tonic-gate /* 37*7c478bd9Sstevel@tonic-gate * PIC Registers 38*7c478bd9Sstevel@tonic-gate */ 39*7c478bd9Sstevel@tonic-gate #define RF_COMMAND 0x00 40*7c478bd9Sstevel@tonic-gate #define RF_STATUS 0x01 41*7c478bd9Sstevel@tonic-gate #define RF_IND_DATA 0x40 42*7c478bd9Sstevel@tonic-gate #define RF_IND_ADDR 0x41 43*7c478bd9Sstevel@tonic-gate #define RF_ENV_S0 0x80 44*7c478bd9Sstevel@tonic-gate #define RF_ENV_S1 0x81 45*7c478bd9Sstevel@tonic-gate #define RF_TPM_S0 0xC0 46*7c478bd9Sstevel@tonic-gate #define RF_TPM_S1 0xC1 47*7c478bd9Sstevel@tonic-gate 48*7c478bd9Sstevel@tonic-gate /* 49*7c478bd9Sstevel@tonic-gate * PIC Registers from Indirect Address/Data 50*7c478bd9Sstevel@tonic-gate */ 51*7c478bd9Sstevel@tonic-gate #define RF_FAN0_PERIOD 0x00 52*7c478bd9Sstevel@tonic-gate #define RF_FAN1_PERIOD 0x01 53*7c478bd9Sstevel@tonic-gate #define RF_FAN2_PERIOD 0x02 54*7c478bd9Sstevel@tonic-gate #define RF_FAN3_PERIOD 0x03 55*7c478bd9Sstevel@tonic-gate #define RF_FAN4_PERIOD 0x04 56*7c478bd9Sstevel@tonic-gate #define RF_LOCAL_TEMP 0x06 57*7c478bd9Sstevel@tonic-gate #define RF_REMOTE1_TEMP 0x07 58*7c478bd9Sstevel@tonic-gate #define RF_REMOTE2_TEMP 0x08 59*7c478bd9Sstevel@tonic-gate #define RF_REMOTE3_TEMP 0x09 60*7c478bd9Sstevel@tonic-gate #define RF_LM95221_TEMP 0x0A 61*7c478bd9Sstevel@tonic-gate #define RF_FIRE_TEMP 0x0B 62*7c478bd9Sstevel@tonic-gate #define RF_LSI1064_TEMP 0x0C 63*7c478bd9Sstevel@tonic-gate #define RF_FRONT_TEMP 0x0D 64*7c478bd9Sstevel@tonic-gate #define RF_FAN_STATUS 0x0E 65*7c478bd9Sstevel@tonic-gate #define RF_VCORE0 0x0F 66*7c478bd9Sstevel@tonic-gate #define RF_VCORE1 0x10 67*7c478bd9Sstevel@tonic-gate 68*7c478bd9Sstevel@tonic-gate /* 69*7c478bd9Sstevel@tonic-gate * Bitmasks for RF_STATUS register 70*7c478bd9Sstevel@tonic-gate */ 71*7c478bd9Sstevel@tonic-gate #define ST_FFAULT 0x01 /* fan failure has occurred */ 72*7c478bd9Sstevel@tonic-gate #define ST_ENV_BUSY 0x02 /* environmental bus is busy */ 73*7c478bd9Sstevel@tonic-gate #define ST_STALE_ADT_DATA 0x04 /* ADT7462 data currently invalid */ 74*7c478bd9Sstevel@tonic-gate #define ST_STALE_LM_DATA 0x08 /* LM95221 data currently invalid */ 75*7c478bd9Sstevel@tonic-gate #define ST_FW_VERSION 0xF0 /* firmware version number */ 76*7c478bd9Sstevel@tonic-gate 77*7c478bd9Sstevel@tonic-gate /* 78*7c478bd9Sstevel@tonic-gate * Bitmasks for RF_COMMAND values 79*7c478bd9Sstevel@tonic-gate */ 80*7c478bd9Sstevel@tonic-gate #define CMD_TO_ESTAR 0x01 81*7c478bd9Sstevel@tonic-gate #define CMD_PIC_RESET 0x80 82*7c478bd9Sstevel@tonic-gate 83*7c478bd9Sstevel@tonic-gate /* Number of fans/sensors */ 84*7c478bd9Sstevel@tonic-gate #define MAX_PIC_NODES 16 85*7c478bd9Sstevel@tonic-gate #define N_FANS 5 86*7c478bd9Sstevel@tonic-gate #define N_SENSORS 8 87*7c478bd9Sstevel@tonic-gate #define N_PIC_NODES (N_FANS+N_SENSORS+1) 88*7c478bd9Sstevel@tonic-gate 89*7c478bd9Sstevel@tonic-gate /* 90*7c478bd9Sstevel@tonic-gate * PIC devices' node name and register offset 91*7c478bd9Sstevel@tonic-gate */ 92*7c478bd9Sstevel@tonic-gate #define PICDEV_NODE_TYPE "pic_client:env-monitor" 93*7c478bd9Sstevel@tonic-gate typedef struct minor_node_info { 94*7c478bd9Sstevel@tonic-gate char *minor_name; /* node name */ 95*7c478bd9Sstevel@tonic-gate uint8_t reg_offset; /* indirect register offset */ 96*7c478bd9Sstevel@tonic-gate uint8_t ff_shift; /* fan fault shift (only for fans) */ 97*7c478bd9Sstevel@tonic-gate } minor_node_info; 98*7c478bd9Sstevel@tonic-gate 99*7c478bd9Sstevel@tonic-gate /* 100*7c478bd9Sstevel@tonic-gate * PIC device minor numbers are constructed as <inst_9-12>:<unit_0-8> 101*7c478bd9Sstevel@tonic-gate */ 102*7c478bd9Sstevel@tonic-gate #define PIC_INST_TO_MINOR(x) (((x) << 8) & 0x0F00) 103*7c478bd9Sstevel@tonic-gate #define PIC_UNIT_TO_MINOR(x) ((x) & 0xFF) 104*7c478bd9Sstevel@tonic-gate #define PIC_MINOR_TO_UNIT(x) ((x) & 0xFF) 105*7c478bd9Sstevel@tonic-gate #define PIC_MINOR_TO_INST(x) (((x)>> 8) & 0xF) 106*7c478bd9Sstevel@tonic-gate 107*7c478bd9Sstevel@tonic-gate /* 108*7c478bd9Sstevel@tonic-gate * PIC ioctl commands 109*7c478bd9Sstevel@tonic-gate */ 110*7c478bd9Sstevel@tonic-gate #define PICIOC ('X'<<8) 111*7c478bd9Sstevel@tonic-gate #define PIC_GET_TEMPERATURE (PICIOC|1) 112*7c478bd9Sstevel@tonic-gate #define PIC_GET_FAN_SPEED (PICIOC|2) 113*7c478bd9Sstevel@tonic-gate #define PIC_SET_FAN_SPEED (PICIOC|3) 114*7c478bd9Sstevel@tonic-gate #define PIC_GET_STATUS (PICIOC|4) 115*7c478bd9Sstevel@tonic-gate #define PIC_GET_FAN_STATUS (PICIOC|5) 116*7c478bd9Sstevel@tonic-gate #define PIC_SET_ESTAR_MODE (PICIOC|6) 117*7c478bd9Sstevel@tonic-gate 118*7c478bd9Sstevel@tonic-gate /* 119*7c478bd9Sstevel@tonic-gate * Miscellaneous 120*7c478bd9Sstevel@tonic-gate */ 121*7c478bd9Sstevel@tonic-gate #define MAX_PIC_INSTANCES 4 122*7c478bd9Sstevel@tonic-gate #define MAX_RETRIES 10 123*7c478bd9Sstevel@tonic-gate 124*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 125*7c478bd9Sstevel@tonic-gate } 126*7c478bd9Sstevel@tonic-gate #endif 127*7c478bd9Sstevel@tonic-gate 128*7c478bd9Sstevel@tonic-gate #endif /* _PIC16f747_H */ 129