The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/ipmivar.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /* $OpenBSD: ipmivar.h,v 1.34 2021/01/23 12:10:08 kettenis 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/rwlock.h>
   34 #include <sys/sensors.h>
   35 #include <sys/task.h>
   36 
   37 #include <dev/ipmi.h>
   38 
   39 #define IPMI_IF_KCS             1
   40 #define IPMI_IF_SMIC            2
   41 #define IPMI_IF_BT              3
   42 #define IPMI_IF_SSIF            4
   43 
   44 #define IPMI_IF_KCS_NREGS       2
   45 #define IPMI_IF_SMIC_NREGS      3
   46 #define IPMI_IF_BT_NREGS        3
   47 
   48 struct ipmi_thread;
   49 struct ipmi_softc;
   50 struct ipmi_cmd;
   51 
   52 struct ipmi_iowait {
   53         int                     offset;
   54         u_int8_t                mask;
   55         u_int8_t                value;
   56         volatile u_int8_t       *v;
   57         const char              *lbl;
   58 };
   59 
   60 struct ipmi_attach_args {
   61         char            *iaa_name;
   62         bus_space_tag_t iaa_iot;
   63         bus_space_tag_t iaa_memt;
   64 
   65         int             iaa_if_type;
   66         int             iaa_if_rev;
   67         int             iaa_if_iotype;
   68         bus_addr_t      iaa_if_iobase;
   69         int             iaa_if_iosize;
   70         int             iaa_if_iospacing;
   71         int             iaa_if_irq;
   72         int             iaa_if_irqlvl;
   73 };
   74 
   75 struct ipmi_if {
   76         const char      *name;
   77         int             nregs;
   78         void            (*buildmsg)(struct ipmi_cmd *);
   79         int             (*sendmsg)(struct ipmi_cmd *);
   80         int             (*recvmsg)(struct ipmi_cmd *);
   81         int             (*reset)(struct ipmi_softc *);
   82         int             (*probe)(struct ipmi_softc *);
   83         int             datasnd;
   84         int             datarcv;
   85 };
   86 
   87 struct ipmi_cmd {
   88         struct ipmi_softc       *c_sc;
   89 
   90         int                     c_rssa;
   91         int                     c_rslun;
   92         int                     c_netfn;
   93         int                     c_cmd;
   94 
   95         int                     c_txlen;
   96         int                     c_maxrxlen;
   97         int                     c_rxlen;
   98 
   99         void                    *c_data;
  100         u_int                   c_ccode;
  101 };
  102 
  103 struct ipmi_softc {
  104         struct device           sc_dev;
  105 
  106         struct ipmi_if          *sc_if;                 /* Interface layer */
  107         int                     sc_if_iosize;           /* Size of I/O porrs */
  108         int                     sc_if_iospacing;        /* Spacing of I/O ports */
  109         int                     sc_if_rev;              /* IPMI Revision */
  110 
  111         void                    *sc_ih;                 /* Interrupt/IO handles */
  112         bus_space_tag_t         sc_iot;
  113         bus_space_handle_t      sc_ioh;
  114 
  115         int                     sc_btseq;
  116         u_int8_t                sc_buf[IPMI_MAX_RX + 16];
  117         struct taskq            *sc_cmd_taskq;
  118 
  119         struct ipmi_ioctl {
  120                 struct rwlock           lock;
  121                 struct ipmi_req         req;
  122                 struct ipmi_cmd         cmd;
  123                 uint8_t                 buf[IPMI_MAX_RX];
  124         } sc_ioctl;
  125 
  126         int                     sc_wdog_period;
  127         struct task             sc_wdog_tickle_task;
  128 
  129         struct ipmi_thread      *sc_thread;
  130 
  131         struct ipmi_sensor      *current_sensor;
  132         struct ksensordev       sc_sensordev;
  133 };
  134 
  135 struct ipmi_thread {
  136         struct ipmi_softc   *sc;
  137         volatile int        running;
  138 };
  139 
  140 #define IPMI_WDOG_DONTSTOP      0x40
  141 
  142 #define IPMI_WDOG_MASK          0x03
  143 #define IPMI_WDOG_DISABLED      0x00
  144 #define IPMI_WDOG_REBOOT        0x01
  145 #define IPMI_WDOG_PWROFF        0x02
  146 #define IPMI_WDOG_PWRCYCLE      0x03
  147 
  148 #define IPMI_WDOG_PRE_DISABLED  0x00
  149 #define IPMI_WDOG_PRE_SMI       0x01
  150 #define IPMI_WDOG_PRE_NMI       0x02
  151 #define IPMI_WDOG_PRE_INTERRUPT 0x03
  152 
  153 #define IPMI_SET_WDOG_TIMER     0
  154 #define IPMI_SET_WDOG_ACTION    1
  155 #define IPMI_SET_WDOG_PRETIMO   2
  156 #define IPMI_SET_WDOG_FLAGS     3
  157 #define IPMI_SET_WDOG_TIMOL     4
  158 #define IPMI_SET_WDOG_TIMOM     5
  159 #define IPMI_SET_WDOG_MAX       6
  160 
  161 #define IPMI_GET_WDOG_TIMER     IPMI_SET_WDOG_TIMER
  162 #define IPMI_GET_WDOG_ACTION    IPMI_SET_WDOG_ACTION
  163 #define IPMI_GET_WDOG_PRETIMO   IPMI_SET_WDOG_PRETIMO
  164 #define IPMI_GET_WDOG_FLAGS     IPMI_SET_WDOG_FLAGS
  165 #define IPMI_GET_WDOG_TIMOL     IPMI_SET_WDOG_TIMOL
  166 #define IPMI_GET_WDOG_TIMOM     IPMI_SET_WDOG_TIMOM
  167 #define IPMI_GET_WDOG_PRECDL    6
  168 #define IPMI_GET_WDOG_PRECDM    7
  169 #define IPMI_GET_WDOG_MAX       8
  170 
  171 int     ipmi_probe(void *);
  172 void    ipmi_attach_common(struct ipmi_softc *, struct ipmi_attach_args *);
  173 int     ipmi_activate(struct device *, int);
  174 
  175 int     ipmi_sendcmd(struct ipmi_cmd *);
  176 int     ipmi_recvcmd(struct ipmi_cmd *);
  177 
  178 #define IPMI_MSG_NFLN                   0
  179 #define IPMI_MSG_CMD                    1
  180 #define IPMI_MSG_CCODE                  2
  181 #define IPMI_MSG_DATASND                2
  182 #define IPMI_MSG_DATARCV                3
  183 
  184 #define APP_NETFN                       0x06
  185 #define APP_GET_DEVICE_ID               0x01
  186 #define APP_RESET_WATCHDOG              0x22
  187 #define APP_SET_WATCHDOG_TIMER          0x24
  188 #define APP_GET_WATCHDOG_TIMER          0x25
  189 #define APP_GET_SYSTEM_INTERFACE_CAPS   0x57
  190 
  191 #define TRANSPORT_NETFN                 0xC
  192 #define BRIDGE_NETFN                    0x2
  193 
  194 #define STORAGE_NETFN                   0x0A
  195 #define STORAGE_GET_FRU_INV_AREA        0x10
  196 #define STORAGE_READ_FRU_DATA           0x11
  197 #define STORAGE_RESERVE_SDR             0x22
  198 #define STORAGE_GET_SDR                 0x23
  199 #define STORAGE_ADD_SDR                 0x24
  200 #define STORAGE_ADD_PARTIAL_SDR         0x25
  201 #define STORAGE_DELETE_SDR              0x26
  202 #define STORAGE_RESERVE_SEL             0x42
  203 #define STORAGE_GET_SEL                 0x43
  204 #define STORAGE_ADD_SEL                 0x44
  205 #define STORAGE_ADD_PARTIAL_SEL         0x45
  206 #define STORAGE_DELETE_SEL              0x46
  207 
  208 #define SE_NETFN                        0x04
  209 #define SE_GET_SDR_INFO                 0x20
  210 #define SE_GET_SDR                      0x21
  211 #define SE_RESERVE_SDR                  0x22
  212 #define SE_GET_SENSOR_FACTOR            0x23
  213 #define SE_SET_SENSOR_HYSTERESIS        0x24
  214 #define SE_GET_SENSOR_HYSTERESIS        0x25
  215 #define SE_SET_SENSOR_THRESHOLD         0x26
  216 #define SE_GET_SENSOR_THRESHOLD         0x27
  217 #define SE_SET_SENSOR_EVENT_ENABLE      0x28
  218 #define SE_GET_SENSOR_EVENT_ENABLE      0x29
  219 #define SE_REARM_SENSOR_EVENTS          0x2A
  220 #define SE_GET_SENSOR_EVENT_STATUS      0x2B
  221 #define SE_GET_SENSOR_READING           0x2D
  222 #define SE_SET_SENSOR_TYPE              0x2E
  223 #define SE_GET_SENSOR_TYPE              0x2F
  224 
  225 struct sdrhdr {
  226         u_int16_t       record_id;              /* SDR Record ID */
  227         u_int8_t        sdr_version;            /* SDR Version */
  228         u_int8_t        record_type;            /* SDR Record Type */
  229         u_int8_t        record_length;          /* SDR Record Length */
  230 } __packed;
  231 
  232 /* SDR: Record Type 1 */
  233 struct sdrtype1 {
  234         struct sdrhdr   sdrhdr;
  235 
  236         u_int8_t        owner_id;
  237         u_int8_t        owner_lun;
  238         u_int8_t        sensor_num;
  239 
  240         u_int8_t        entity_id;
  241         u_int8_t        entity_instance;
  242         u_int8_t        sensor_init;
  243         u_int8_t        sensor_caps;
  244         u_int8_t        sensor_type;
  245         u_int8_t        event_code;
  246         u_int16_t       trigger_mask;
  247         u_int16_t       reading_mask;
  248         u_int16_t       settable_mask;
  249         u_int8_t        units1;
  250         u_int8_t        units2;
  251         u_int8_t        units3;
  252         u_int8_t        linear;
  253         u_int8_t        m;
  254         u_int8_t        m_tolerance;
  255         u_int8_t        b;
  256         u_int8_t        b_accuracy;
  257         u_int8_t        accuracyexp;
  258         u_int8_t        rbexp;
  259         u_int8_t        analogchars;
  260         u_int8_t        nominalreading;
  261         u_int8_t        normalmax;
  262         u_int8_t        normalmin;
  263         u_int8_t        sensormax;
  264         u_int8_t        sensormin;
  265         u_int8_t        uppernr;
  266         u_int8_t        upperc;
  267         u_int8_t        uppernc;
  268         u_int8_t        lowernr;
  269         u_int8_t        lowerc;
  270         u_int8_t        lowernc;
  271         u_int8_t        physt;
  272         u_int8_t        nhyst;
  273         u_int8_t        resvd[2];
  274         u_int8_t        oem;
  275         u_int8_t        typelen;
  276         u_int8_t        name[1];
  277 } __packed;
  278 
  279 /* SDR: Record Type 2 */
  280 struct sdrtype2 {
  281         struct sdrhdr   sdrhdr;
  282 
  283         u_int8_t        owner_id;
  284         u_int8_t        owner_lun;
  285         u_int8_t        sensor_num;
  286 
  287         u_int8_t        entity_id;
  288         u_int8_t        entity_instance;
  289         u_int8_t        sensor_init;
  290         u_int8_t        sensor_caps;
  291         u_int8_t        sensor_type;
  292         u_int8_t        event_code;
  293         u_int16_t       trigger_mask;
  294         u_int16_t       reading_mask;
  295         u_int16_t       set_mask;
  296         u_int8_t        units1;
  297         u_int8_t        units2;
  298         u_int8_t        units3;
  299         u_int8_t        share1;
  300         u_int8_t        share2;
  301         u_int8_t        physt;
  302         u_int8_t        nhyst;
  303         u_int8_t        resvd[3];
  304         u_int8_t        oem;
  305         u_int8_t        typelen;
  306         u_int8_t        name[1];
  307 } __packed;
  308 
  309 #endif                          /* _IPMIVAR_H_ */

Cache object: 67899b71fc8648aa135241f2eb8b7eaf


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.