ocp

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 2, 2023 License: BSD-3-Clause Imports: 13 Imported by: 7

Documentation

Overview

Package ocp implements OCP/Facebook-specific IPMI client functions.

Package ocp implements OCP/Facebook-specific IPMI client functions.

Index

Constants

View Source
const (
	// Boot order bit[2:0] defined as
	// 000b: USB device
	// 001b: Network
	// 010b: SATA HDD
	// 011b: SATA-CDROM
	// 100b: Other removable Device
	// If bit[2:0] is 001b (Network), bit3 determines IPv4/IPv6 order,
	// when bit3 is 0: IPv4 first, bit3 is 1: IPv6 first
	NETWORK_BOOT = 0x1
	LOCAL_BOOT   = 0x2
	INVALID_BOOT = 0xff

	// Default boot order systembooter configurations
	NETBOOTER_CONFIG   = "{\"type\":\"netboot\",\"method\":\"dhcpv6\"}"
	LOCALBOOTER_CONFIG = "{\"type\":\"localboot\",\"method\":\"grub\"}"
)

Variables

View Source
var (
	// BmcUpdatedBootorder is true when IPMI set boot order has been issued
	BmcUpdatedBootorder = false
	// BootEntries is created with the new boot order and will be used to boot this time
	BootEntries []systembooter.BootEntry
)
View Source
var OENMap = map[string][3]uint8{
	"Wiwynn": {0x0, 0x9c, 0x9c},
}

OENMap maps OEM names to a 3 byte OEM number.

OENs are typically serialized as the first 3 bytes of a request body.

Functions

func CheckBMCBootOrder

func CheckBMCBootOrder(i *ipmi.IPMI, bmcBootOverride bool) error

CheckBMCBootOrder synchronize BIOS's boot order with BMC's boot order. When BMC IPMI sets boot order (valid bit 1), BIOS will update VPD boot order and create new BootEntries accordingly. If BMC didn't set boot order, BIOS would set its current boot order to BMC.

func ClearCMOSClearValidBits

func ClearCMOSClearValidBits(i *ipmi.IPMI, data []byte) error

Set BIOS boot order with both CMOS clear and valid bits cleared

func IsCMOSClearSet

func IsCMOSClearSet(i *ipmi.IPMI) (bool, []byte, error)

Get BIOS boot order data and check if CMOS clear bit and valid bit are both set

func SendOemIpmiBootDriveInfo added in v0.9.0

func SendOemIpmiBootDriveInfo(i *ipmi.IPMI, info *BootDriveInfo) error

func SendOemIpmiDimmInfo

func SendOemIpmiDimmInfo(i *ipmi.IPMI, info []DimmInfo) error

func SendOemIpmiProcessorInfo

func SendOemIpmiProcessorInfo(i *ipmi.IPMI, info []ProcessorInfo) error

func SetOemIpmiPostEnd

func SetOemIpmiPostEnd(i *ipmi.IPMI) error

Types

type BootDriveInfo added in v0.9.0

type BootDriveInfo struct {
	ManufacturerID    [3]uint8
	ControlType       uint8
	DriveNumber       uint8
	ParameterSelector uint8
	VendorID          uint16
	DeviceID          uint16
}

func GetOemIpmiBootDriveInfo added in v0.9.0

func GetOemIpmiBootDriveInfo(si *smbios.Info) (*BootDriveInfo, error)

Read type 9 from SMBIOS tables and look for SlotDesignation which contains string 'Boot_Drive', and get bus and device number from the matched table to read the Device ID and Vendor ID of the boot drive for sending the IPMI OEM command. This requires the BDF number is correctly set in the type 9 table.

type BootOrder

type BootOrder struct {
	// contains filtered or unexported fields
}

type DimmInfo

type DimmInfo struct {
	ManufacturerID          [3]uint8
	Index                   uint8
	ParameterSelector       uint8
	DIMMPresent             uint8
	NodeNumber              uint8
	ChannelNumber           uint8
	DIMMNumber              uint8
	DIMMType                uint8
	DIMMSpeed               uint16
	DIMMSize                uint32
	ModulePartNumber        [20]byte
	ModuleSerialNumber      uint32
	ModuleManufacturerIDLSB uint8
	ModuleManufacturerIDMSB uint8
}

func GetOemIpmiDimmInfo

func GetOemIpmiDimmInfo(si *smbios.Info) ([]DimmInfo, error)

type ProcessorInfo

type ProcessorInfo struct {
	ManufacturerID        [3]uint8
	Index                 uint8
	ParameterSelector     uint8
	ProductName           [48]byte
	CoreNumber            uint8
	ThreadNumberLSB       uint8
	ThreadNumberMSB       uint8
	ProcessorFrequencyLSB uint8
	ProcessorFrequencyMSB uint8
	Revision1             uint8
	Revision2             uint8
}

func GetOemIpmiProcessorInfo

func GetOemIpmiProcessorInfo(si *smbios.Info) ([]ProcessorInfo, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL