Message ID | 20181211024046.17067-1-sam@mendozajonas.com |
---|---|
Headers | show |
Series | Support IPMI "Boot Initiator Mailbox" | expand |
On Tue, 2018-12-11 at 13:40 +1100, Samuel Mendoza-Jonas wrote: > Add support for the IPMI Get/Set System Boot Options command parameter > 7, "Boot Initator Mailbox", to parse an alternate boot order > configuration. > > A brief description of the mailbox for interested BMC people below; for > details see section 28.13 in the IPMI spec. > > Petitboot already takes advantage of the Get/Set System Boot Option > commands to recognise "boot overrides" that have been set. Specifically > this uses parameter 5, "boot flags", of the command as described by Table > 28, "Boot Option Parameters" in the IPMI spec. These boot flags are > limited to generic options such as "boot from disk", "boot from network", > etc. > > What this series does it take advantage of parameter 7, "boot initiator > mailbox", in the same command. The difference here is that this is just a > bunch of space we can put something into. In particular we're using it to > hold a "petitboot,bootdevs=..." parameter the same as we would in NVRAM. > > The content of parameter 7 is > 1 byte: block number > 2-17 bytes: block data > > The BMC is required to hold *at least* 80 bytes of data, which means 5 > blocks (16 bytes * 5 = 80 bytes). > > The BMC is also required to set the first 3 bytes of the first block to > an IANA Enterprise ID Number. This series recognises the IBM number (2) > so the first three bytes must be 2, 0, 0 (least-significant first). > > So to store the string "petitboot,bootdevs="net usb disk" the format of > the blocks would be: > > 0: |2|0|0|p|e|t|i|t|b|o|o|t|,|b|o|o| > 1: |t|d|e|v|s|=|n|e|t| |u|s|b| |d|i| > 2: |s|k| | | | | | | | | | | | | | | > > The string must be null-terminated but the remaining buffer contents do > not necessarily need to be set. > Petitboot will request up to 255 blocks (stopping when it first receives > an error) and then use this string if it is present in order to set the > boot order. I would *highly* recommend a BMC supports well over 5 blocks > so that we can fit disk UUIDS and LV names. > > Each block is selected individually, eg. Petitboot will send several > requests like, > get-sys-boot-option, parameter 7, block 0 > get-sys-boot-option, parameter 7, block 1 > get-sys-boot-option, parameter 7, block 2 > ... > > And the BMC must return the corresponding block. Petitboot will similarly > send set-sys-boot-option commands to set the buffer (to clear it for > example). > > The script in patch two lays out the raw format for get & set to use with > ipmitool, and basically shows what the BMC would need to expect and how > to respond. > > These details can be found in section 28.13 in v2 rev1.1 of the IPMI > spec, and page 398 specifically for the mailbox. > > > Changes in v2: > Update get_ipmi_boot_mailbox() to support up to 255 blocks and partial > reads since the spec says it's possible. > Fixup some error messages in the helper utility. > Cleanup an error condition and support 255 blocks in > clear_ipmi_boot_mailbox(). Merged with some minor reshuffling as 95ec722a > > Samuel Mendoza-Jonas (3): > discover/platform-powerpc: read bootdev config from IPMI boot mailbox > utils: Add helper to send mailbox request > ui/ncurses: Add option to clear IPMI boot mailbox > > discover/platform-powerpc.c | 257 ++++++++++++++++++++++++++++++++++ > discover/platform.c | 2 +- > discover/platform.h | 2 + > lib/pb-config/pb-config.c | 1 + > lib/pb-protocol/pb-protocol.c | 6 + > lib/types/types.h | 1 + > ui/ncurses/nc-config.c | 49 ++++++- > utils/ipmi-mailbox-config.py | 166 ++++++++++++++++++++++ > 8 files changed, 482 insertions(+), 2 deletions(-) > create mode 100755 utils/ipmi-mailbox-config.py >