Documentation ¶
Overview ¶
Package blobs implements OpenBMC IPMI Blob Protocol commands.
This file declares functions that implement the generic blob transfer interface detailed at https://github.com/openbmc/phosphor-ipmi-blobs with IPMI as a transport layer. See https://github.com/openbmc/google-ipmi-i2c for details on OEM commands.
Index ¶
- Constants
- Variables
- type BlobHandler
- func (h *BlobHandler) BlobClose(sid SessionID) error
- func (h *BlobHandler) BlobCommit(sid SessionID, data []int8) error
- func (h *BlobHandler) BlobDelete(id string) error
- func (h *BlobHandler) BlobEnumerate(index int) (string, error)
- func (h *BlobHandler) BlobGetCount() (int, error)
- func (h *BlobHandler) BlobOpen(id string, flags int16) (SessionID, error)
- func (h *BlobHandler) BlobRead(sid SessionID, offset, size uint32) ([]uint8, error)
- func (h *BlobHandler) BlobSessionStat(sid SessionID) (*BlobStats, error)
- func (h *BlobHandler) BlobStat(id string) (*BlobStats, error)
- func (h *BlobHandler) BlobWrite(sid SessionID, offset int32, data []int8) error
- type BlobStats
- type CRCOption
- type SessionID
Constants ¶
const ( BMC_BLOB_OPEN_FLAG_READ = 1 << 0 BMC_BLOB_OPEN_FLAG_WRITE = 1 << 1 )
Flags for blob open command.
const ( BMC_BLOB_STATE_OPEN_R = 1 << 0 BMC_BLOB_STATE_OPEN_W = 1 << 1 BMC_BLOB_STATE_COMMITTING = 1 << 2 BMC_BLOB_STATE_COMMITTED = 1 << 3 BMC_BLOB_STATE_COMMIT_ERROR = 1 << 4 )
Flags for blob state.
Variables ¶
var OENMap = map[string][3]uint8{
"OpenBMC": {0xcf, 0xc2, 0x00},
}
OENMap maps OEM names to a 3 byte OEM number. OENs are typically serialized as the first 3 bytes of a request body.
Functions ¶
This section is empty.
Types ¶
type BlobHandler ¶
BlobHandler provides an interface for the blob protocol. IT can be used to call all the blob transfer commands.
func NewBlobHandler ¶
func NewBlobHandler(i *ipmi.IPMI) *BlobHandler
NewBlobHandler takes an IPMI struct, which provides a reference to the IPMI device driver, and returns a BlobHandler.
func (*BlobHandler) BlobClose ¶
func (h *BlobHandler) BlobClose(sid SessionID) error
BlobClose has the BMC mark the specified blob as closed.
It must be called after commit-polling has finished, regardless of the result.
func (*BlobHandler) BlobCommit ¶
func (h *BlobHandler) BlobCommit(sid SessionID, data []int8) error
BlobCommit commits the blob.
Each blob defines its own commit behavior. Optional blob-specific commit data can be provided with |data|.
func (*BlobHandler) BlobDelete ¶
func (h *BlobHandler) BlobDelete(id string) error
BlobDelete deletes a blob if the operation is supported.
This command will fail if there are open sessions for the blob.
func (*BlobHandler) BlobEnumerate ¶
func (h *BlobHandler) BlobEnumerate(index int) (string, error)
BlobEnumerate returns the blob identifier for the given index.
Note that the index for a given blob ID is not expected to be stable long term. Callers are expected to call BlobGetCount, followed by N calls to BlobEnumerate, to collect all blob IDs.
func (*BlobHandler) BlobGetCount ¶
func (h *BlobHandler) BlobGetCount() (int, error)
BlobGetCount returns the number of enumerable blobs available.
func (*BlobHandler) BlobOpen ¶
func (h *BlobHandler) BlobOpen(id string, flags int16) (SessionID, error)
BlobOpen opens a blob referred to by |id| with the given |flags|, and returns a unique session identifier.
The BMC allocates a unique session identifier, and internally maps it to the blob identifier. The sessionId should be used by the rest of the session based commands to operate on the blob. NOTE: the new blob is not serialized and stored until BlobCommit is called.
func (*BlobHandler) BlobRead ¶
func (h *BlobHandler) BlobRead(sid SessionID, offset, size uint32) ([]uint8, error)
BlobRead reads and return the blob data.
|sessionID| returned from BlobOpen gives us the open blob. The byte sequence starts at |offset|, and |size| bytes are read. If there are not enough bytes, return the bytes that are available.
func (*BlobHandler) BlobSessionStat ¶
func (h *BlobHandler) BlobSessionStat(sid SessionID) (*BlobStats, error)
BlobSessionStat command returns the same data as BmcBlobStat.
However, this command operates on sessions, rather than blob IDs. Not all blobs must support this command; this is only useful when session semantics are more useful than raw blob IDs.
func (*BlobHandler) BlobStat ¶
func (h *BlobHandler) BlobStat(id string) (*BlobStats, error)
BlobStat returns statistics about a blob.
|size| is the size of blob in bytes. This may be zero if the blob does not support reading. |state| will be set with OPEN_R, OPEN_W, and/or COMMITTED as appropriate |metadata| is optional blob-specific bytes
func (*BlobHandler) BlobWrite ¶
func (h *BlobHandler) BlobWrite(sid SessionID, offset int32, data []int8) error
BlobWrite writes bytes to the requested blob offset, and returns number of bytes written if success.
|sessionID| returned from BlobOpen gives us the open blob. |data| is bounded by max size of an IPMI packet, which is platform-dependent. If not all of the bytes can be written, this operation will fail.
type BlobStats ¶
type BlobStats struct {
// contains filtered or unexported fields
}
BlobStats contains statistics for a given blob.