Annotation of sys/dev/ipmivar.h, Revision 1.1
1.1 ! nbrk 1: /* $OpenBSD: ipmivar.h,v 1.18 2007/03/22 16:55:31 deraadt Exp $ */
! 2:
! 3: /*
! 4: * Copyright (c) 2005 Jordan Hargrave
! 5: * All rights reserved.
! 6: *
! 7: * Redistribution and use in source and binary forms, with or without
! 8: * modification, are permitted provided that the following conditions
! 9: * are met:
! 10: * 1. Redistributions of source code must retain the above copyright
! 11: * notice, this list of conditions and the following disclaimer.
! 12: * 2. Redistributions in binary form must reproduce the above copyright
! 13: * notice, this list of conditions and the following disclaimer in the
! 14: * documentation and/or other materials provided with the distribution.
! 15: *
! 16: * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
! 17: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
! 18: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
! 19: * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
! 20: * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
! 21: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
! 22: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
! 23: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
! 24: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
! 25: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
! 26: * SUCH DAMAGE.
! 27: *
! 28: */
! 29:
! 30: #ifndef _IPMIVAR_H_
! 31: #define _IPMIVAR_H_
! 32:
! 33: #include <sys/timeout.h>
! 34: #include <sys/rwlock.h>
! 35: #include <sys/sensors.h>
! 36:
! 37: #define IPMI_IF_KCS 1
! 38: #define IPMI_IF_SMIC 2
! 39: #define IPMI_IF_BT 3
! 40:
! 41: #define IPMI_IF_KCS_NREGS 2
! 42: #define IPMI_IF_SMIC_NREGS 3
! 43: #define IPMI_IF_BT_NREGS 3
! 44:
! 45: struct ipmi_thread;
! 46: struct ipmi_softc;
! 47:
! 48: struct ipmi_bmc_args{
! 49: int offset;
! 50: u_int8_t mask;
! 51: u_int8_t value;
! 52: volatile u_int8_t *v;
! 53: };
! 54:
! 55: struct ipmi_attach_args {
! 56: char *iaa_name;
! 57: bus_space_tag_t iaa_iot;
! 58: bus_space_tag_t iaa_memt;
! 59:
! 60: int iaa_if_type;
! 61: int iaa_if_rev;
! 62: int iaa_if_iotype;
! 63: int iaa_if_iobase;
! 64: int iaa_if_iospacing;
! 65: int iaa_if_irq;
! 66: int iaa_if_irqlvl;
! 67: };
! 68:
! 69: struct ipmi_if {
! 70: const char *name;
! 71: int nregs;
! 72: void *(*buildmsg)(struct ipmi_softc *, int, int, int,
! 73: const void *, int *);
! 74: int (*sendmsg)(struct ipmi_softc *, int, const u_int8_t *);
! 75: int (*recvmsg)(struct ipmi_softc *, int, int *, u_int8_t *);
! 76: int (*reset)(struct ipmi_softc *);
! 77: int (*probe)(struct ipmi_softc *);
! 78: };
! 79:
! 80: struct ipmi_softc {
! 81: struct device sc_dev;
! 82:
! 83: struct ipmi_if *sc_if; /* Interface layer */
! 84: int sc_if_iospacing; /* Spacing of I/O ports */
! 85: int sc_if_rev; /* IPMI Revision */
! 86:
! 87: void *sc_ih; /* Interrupt/IO handles */
! 88: bus_space_tag_t sc_iot;
! 89: bus_space_handle_t sc_ioh;
! 90:
! 91: int sc_btseq;
! 92:
! 93: int sc_wdog_period;
! 94:
! 95: struct ipmi_thread *sc_thread;
! 96:
! 97: struct timeout sc_timeout;
! 98: int sc_max_retries;
! 99: int sc_retries;
! 100: int sc_wakeup;
! 101:
! 102: struct rwlock sc_lock;
! 103:
! 104: struct ipmi_bmc_args *sc_iowait_args;
! 105:
! 106: struct ipmi_sensor *current_sensor;
! 107: struct ksensordev sc_sensordev;
! 108: };
! 109:
! 110: struct ipmi_thread {
! 111: struct ipmi_softc *sc;
! 112: volatile int running;
! 113: };
! 114:
! 115: #define IPMI_WDOG_MASK 0x03
! 116: #define IPMI_WDOG_DISABLED 0x00
! 117: #define IPMI_WDOG_REBOOT 0x01
! 118: #define IPMI_WDOG_PWROFF 0x02
! 119: #define IPMI_WDOG_PWRCYCLE 0x03
! 120:
! 121: #define IPMI_WDOG_PRE_DISABLED 0x00
! 122: #define IPMI_WDOG_PRE_SMI 0x01
! 123: #define IPMI_WDOG_PRE_NMI 0x02
! 124: #define IPMI_WDOG_PRE_INTERRUPT 0x03
! 125:
! 126: struct ipmi_watchdog {
! 127: u_int8_t wdog_timer;
! 128: u_int8_t wdog_action;
! 129: u_int8_t wdog_pretimeout;
! 130: u_int8_t wdog_flags;
! 131: u_int16_t wdog_timeout;
! 132: } __packed;
! 133:
! 134: void ipmi_create_thread(void *);
! 135: void ipmi_poll_thread(void *);
! 136:
! 137: int kcs_probe(struct ipmi_softc *);
! 138: int kcs_reset(struct ipmi_softc *);
! 139: int kcs_sendmsg(struct ipmi_softc *, int, const u_int8_t *);
! 140: int kcs_recvmsg(struct ipmi_softc *, int, int *len, u_int8_t *);
! 141:
! 142: int bt_probe(struct ipmi_softc *);
! 143: int bt_reset(struct ipmi_softc *);
! 144: int bt_sendmsg(struct ipmi_softc *, int, const u_int8_t *);
! 145: int bt_recvmsg(struct ipmi_softc *, int, int *, u_int8_t *);
! 146:
! 147: int smic_probe(struct ipmi_softc *);
! 148: int smic_reset(struct ipmi_softc *);
! 149: int smic_sendmsg(struct ipmi_softc *, int, const u_int8_t *);
! 150: int smic_recvmsg(struct ipmi_softc *, int, int *, u_int8_t *);
! 151:
! 152: struct dmd_ipmi {
! 153: u_int8_t dmd_sig[4]; /* Signature 'IPMI' */
! 154: u_int8_t dmd_i2c_address; /* Address of BMC */
! 155: u_int8_t dmd_nvram_address; /* Address of NVRAM */
! 156: u_int8_t dmd_if_type; /* IPMI Interface Type */
! 157: u_int8_t dmd_if_rev; /* IPMI Interface Revision */
! 158: } __packed;
! 159:
! 160:
! 161: #define APP_NETFN 0x06
! 162: #define APP_GET_DEVICE_ID 0x01
! 163: #define APP_RESET_WATCHDOG 0x22
! 164: #define APP_SET_WATCHDOG_TIMER 0x24
! 165: #define APP_GET_WATCHDOG_TIMER 0x25
! 166:
! 167: #define TRANSPORT_NETFN 0xC
! 168: #define BRIDGE_NETFN 0x2
! 169:
! 170: #define STORAGE_NETFN 0x0A
! 171: #define STORAGE_GET_FRU_INV_AREA 0x10
! 172: #define STORAGE_READ_FRU_DATA 0x11
! 173: #define STORAGE_RESERVE_SDR 0x22
! 174: #define STORAGE_GET_SDR 0x23
! 175: #define STORAGE_ADD_SDR 0x24
! 176: #define STORAGE_ADD_PARTIAL_SDR 0x25
! 177: #define STORAGE_DELETE_SDR 0x26
! 178: #define STORAGE_RESERVE_SEL 0x42
! 179: #define STORAGE_GET_SEL 0x43
! 180: #define STORAGE_ADD_SEL 0x44
! 181: #define STORAGE_ADD_PARTIAL_SEL 0x45
! 182: #define STORAGE_DELETE_SEL 0x46
! 183:
! 184: #define SE_NETFN 0x04
! 185: #define SE_GET_SDR_INFO 0x20
! 186: #define SE_GET_SDR 0x21
! 187: #define SE_RESERVE_SDR 0x22
! 188: #define SE_GET_SENSOR_FACTOR 0x23
! 189: #define SE_SET_SENSOR_HYSTERESIS 0x24
! 190: #define SE_GET_SENSOR_HYSTERESIS 0x25
! 191: #define SE_SET_SENSOR_THRESHOLD 0x26
! 192: #define SE_GET_SENSOR_THRESHOLD 0x27
! 193: #define SE_SET_SENSOR_EVENT_ENABLE 0x28
! 194: #define SE_GET_SENSOR_EVENT_ENABLE 0x29
! 195: #define SE_REARM_SENSOR_EVENTS 0x2A
! 196: #define SE_GET_SENSOR_EVENT_STATUS 0x2B
! 197: #define SE_GET_SENSOR_READING 0x2D
! 198: #define SE_SET_SENSOR_TYPE 0x2E
! 199: #define SE_GET_SENSOR_TYPE 0x2F
! 200:
! 201: struct sdrhdr {
! 202: u_int16_t record_id; /* SDR Record ID */
! 203: u_int8_t sdr_version; /* SDR Version */
! 204: u_int8_t record_type; /* SDR Record Type */
! 205: u_int8_t record_length; /* SDR Record Length */
! 206: } __packed;
! 207:
! 208: /* SDR: Record Type 1 */
! 209: struct sdrtype1 {
! 210: struct sdrhdr sdrhdr;
! 211:
! 212: u_int8_t owner_id;
! 213: u_int8_t owner_lun;
! 214: u_int8_t sensor_num;
! 215:
! 216: u_int8_t entity_id;
! 217: u_int8_t entity_instance;
! 218: u_int8_t sensor_init;
! 219: u_int8_t sensor_caps;
! 220: u_int8_t sensor_type;
! 221: u_int8_t event_code;
! 222: u_int16_t trigger_mask;
! 223: u_int16_t reading_mask;
! 224: u_int16_t settable_mask;
! 225: u_int8_t units1;
! 226: u_int8_t units2;
! 227: u_int8_t units3;
! 228: u_int8_t linear;
! 229: u_int8_t m;
! 230: u_int8_t m_tolerance;
! 231: u_int8_t b;
! 232: u_int8_t b_accuracy;
! 233: u_int8_t accuracyexp;
! 234: u_int8_t rbexp;
! 235: u_int8_t analogchars;
! 236: u_int8_t nominalreading;
! 237: u_int8_t normalmax;
! 238: u_int8_t normalmin;
! 239: u_int8_t sensormax;
! 240: u_int8_t sensormin;
! 241: u_int8_t uppernr;
! 242: u_int8_t upperc;
! 243: u_int8_t uppernc;
! 244: u_int8_t lowernr;
! 245: u_int8_t lowerc;
! 246: u_int8_t lowernc;
! 247: u_int8_t physt;
! 248: u_int8_t nhyst;
! 249: u_int8_t resvd[2];
! 250: u_int8_t oem;
! 251: u_int8_t typelen;
! 252: u_int8_t name[1];
! 253: } __packed;
! 254:
! 255: /* SDR: Record Type 2 */
! 256: struct sdrtype2 {
! 257: struct sdrhdr sdrhdr;
! 258:
! 259: u_int8_t owner_id;
! 260: u_int8_t owner_lun;
! 261: u_int8_t sensor_num;
! 262:
! 263: u_int8_t entity_id;
! 264: u_int8_t entity_instance;
! 265: u_int8_t sensor_init;
! 266: u_int8_t sensor_caps;
! 267: u_int8_t sensor_type;
! 268: u_int8_t event_code;
! 269: u_int16_t trigger_mask;
! 270: u_int16_t reading_mask;
! 271: u_int16_t set_mask;
! 272: u_int8_t units1;
! 273: u_int8_t units2;
! 274: u_int8_t units3;
! 275: u_int8_t share1;
! 276: u_int8_t share2;
! 277: u_int8_t physt;
! 278: u_int8_t nhyst;
! 279: u_int8_t resvd[3];
! 280: u_int8_t oem;
! 281: u_int8_t typelen;
! 282: u_int8_t name[1];
! 283: } __packed;
! 284:
! 285: int ipmi_probe(void *);
! 286:
! 287: #endif /* _IPMIVAR_H_ */
CVSweb