Home | History | Annotate | Line # | Download | only in i2c
      1 /* $NetBSD: ibmhawkreg.h,v 1.1 2011/02/14 08:50:39 hannken Exp $ */
      2 
      3 /*-
      4  * Copyright (c) 2011 The NetBSD Foundation, Inc.
      5  * All rights reserved.
      6  *
      7  * This code is derived from software contributed to The NetBSD Foundation
      8  * by Juergen Hannken-Illjes.
      9  *
     10  * Redistribution and use in source and binary forms, with or without
     11  * modification, are permitted provided that the following conditions
     12  * are met:
     13  * 1. Redistributions of source code must retain the above copyright
     14  *    notice, this list of conditions and the following disclaimer.
     15  * 2. Redistributions in binary form must reproduce the above copyright
     16  *    notice, this list of conditions and the following disclaimer in the
     17  *    documentation and/or other materials provided with the distribution.
     18  *
     19  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29  * POSSIBILITY OF SUCH DAMAGE.
     30  */
     31 
     32 #define IBMHAWK_MAX_CPU		2
     33 #define IBMHAWK_MAX_VOLTAGE	7
     34 #define IBMHAWK_MAX_FAN		6
     35 
     36 typedef union ibmhawk_response {
     37 	struct {
     38 		uint8_t unknown1;
     39 		uint8_t numcpus;
     40 		uint8_t unknown2[5];
     41 		uint8_t numfans;
     42 	} resp_equip;
     43 #define IHR_EQUIP		0x51
     44 #define ihr_numcpus		resp_equip.numcpus
     45 #define ihr_numfans		resp_equip.numfans
     46 	struct {
     47 		uint8_t unknown[4];
     48 		uint16_t rpm[IBMHAWK_MAX_FAN];
     49 	} resp_fan;
     50 #define IHR_FANRPM		0xa2
     51 #define ihr_fanrpm		resp_fan.rpm
     52 	struct {
     53 		char name[16];
     54 	} resp_name;
     55 #define IHR_NAME		0x14
     56 #define ihr_name		resp_name.name
     57 	struct {
     58 		uint8_t unknown1[4];
     59 		uint8_t ambient;
     60 		uint8_t cpu[IBMHAWK_MAX_CPU];
     61 		uint8_t unknown2[2];
     62 	} resp_temp;
     63 #define IHR_TEMP		0xa4
     64 #define ihr_t_ambient		resp_temp.ambient
     65 #define ihr_t_cpu		resp_temp.cpu
     66 	struct {
     67 		uint8_t	warn_reset;
     68 		uint8_t warn;
     69 		uint8_t soft;
     70 		uint8_t hard;
     71 	} resp_temp_thresh;
     72 #define IHR_TEMP_THR		0xe0
     73 #define ihr_t_warn_thr		resp_temp_thresh.warn
     74 #define ihr_t_soft_thr		resp_temp_thresh.soft
     75 	struct {
     76 		uint8_t unknown[2];
     77 		uint16_t voltage[IBMHAWK_MAX_VOLTAGE];
     78 	} resp_volt;
     79 #define IHR_VOLT		0xa6
     80 #define ihr_v_voltage		resp_volt.voltage
     81 	struct {
     82 		uint16_t voltage[IBMHAWK_MAX_VOLTAGE*2];
     83 	} resp_volt_thresh;
     84 #define IHR_VOLT_THR		0xea
     85 #define ihr_v_voltage_thr	resp_volt_thresh.voltage
     86 } ibmhawk_response_t __packed;
     87