github.com/mvdan/u-root-coreutils@v0.0.0-20230122170626-c2eef2898555/pkg/ipmi/structures.go (about)

     1  // Copyright 2022 the u-root Authors. All rights reserved
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package ipmi
     6  
     7  import "unsafe"
     8  
     9  // Command is the command code for a given message.
    10  type Command byte
    11  
    12  // NetFn is the network function of the class of message being sent.
    13  type NetFn byte
    14  
    15  // Msg is the full IPMI message to be sent.
    16  type Msg struct {
    17  	Netfn   NetFn
    18  	Cmd     Command
    19  	DataLen uint16
    20  	Data    unsafe.Pointer
    21  }
    22  
    23  type request struct {
    24  	addr    *systemInterfaceAddr
    25  	addrLen uint32
    26  	msgid   int64 //nolint:structcheck
    27  	msg     Msg
    28  }
    29  
    30  type response struct {
    31  	recvType int32 //nolint:structcheck
    32  	addr     *systemInterfaceAddr
    33  	addrLen  uint32
    34  	msgid    int64 //nolint:structcheck
    35  	msg      Msg
    36  }
    37  
    38  type systemInterfaceAddr struct {
    39  	addrType int32
    40  	channel  int16
    41  	lun      byte //nolint:unused
    42  }
    43  
    44  // StandardEvent is a standard systemevent.
    45  //
    46  // The data in this event should follow IPMI spec
    47  type StandardEvent struct {
    48  	Timestamp    uint32
    49  	GenID        uint16
    50  	EvMRev       uint8
    51  	SensorType   uint8
    52  	SensorNum    uint8
    53  	EventTypeDir uint8
    54  	EventData    [3]uint8
    55  }
    56  
    57  // OEMTsEvent is a timestamped OEM-custom event.
    58  //
    59  // It holds 6 bytes of OEM-defined arbitrary data.
    60  type OEMTsEvent struct {
    61  	Timestamp        uint32
    62  	ManfID           [3]uint8
    63  	OEMTsDefinedData [6]uint8
    64  }
    65  
    66  // OEMNonTsEvent is a non-timestamped OEM-custom event.
    67  //
    68  // It holds 13 bytes of OEM-defined arbitrary data.
    69  type OEMNonTsEvent struct {
    70  	OEMNontsDefinedData [13]uint8
    71  }
    72  
    73  // Event is included three kinds of events, Standard, OEM timestamped and OEM non-timestamped
    74  //
    75  // The record type decides which event should be used
    76  type Event struct {
    77  	RecordID   uint16
    78  	RecordType uint8
    79  	StandardEvent
    80  	OEMTsEvent
    81  	OEMNonTsEvent
    82  }
    83  
    84  type setSystemInfoReq struct {
    85  	paramSelector byte
    86  	setSelector   byte
    87  	strData       [_SYSTEM_INFO_BLK_SZ]byte
    88  }
    89  
    90  // DevID holds information of a Device provided by the BMC via IPMI
    91  type DevID struct {
    92  	DeviceID          byte
    93  	DeviceRevision    byte
    94  	FwRev1            byte
    95  	FwRev2            byte
    96  	IpmiVersion       byte
    97  	AdtlDeviceSupport byte
    98  	ManufacturerID    [3]byte
    99  	ProductID         [2]byte
   100  	AuxFwRev          [4]byte
   101  }
   102  
   103  // ChassisStatus holds information about status of the chassis reported by the BMC via IPMI
   104  type ChassisStatus struct {
   105  	CurrentPowerState byte
   106  	LastPowerEvent    byte
   107  	MiscChassisState  byte
   108  	FrontPanelButton  byte
   109  }
   110  
   111  // SELInfo holds information about System Event Log reported by the BMC via IPMI
   112  type SELInfo struct {
   113  	Version     byte
   114  	Entries     uint16
   115  	FreeSpace   uint16
   116  	LastAddTime uint32
   117  	LastDelTime uint32
   118  	OpSupport   byte
   119  }