summaryrefslogtreecommitdiffstats
path: root/discover/platform-powerpc.c
Commit message (Collapse)AuthorAgeFilesLines
* discover/platform-powerpc: change sys/fcntl.h to fcntl.hBrett Grandbois2018-03-231-1/+1
| | | | | | | for musl libc Signed-off-by: Brett Grandbois <brett.grandbois@opengear.com> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/platform-powerpc: Avoid confusing gateway and URLSamuel Mendoza-Jonas2018-02-271-10/+19
| | | | | | | | | | | | If we have a static network config with a URL set but not a gateway we can confuse the URL as the gateway due to how we write the network string in NVRAM. To avoid changing the parameter format if we only have one of the two tokens check whether or not it's actually a URL; the gateway and the URL will have distinct formats. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/platform-powerpc: Increase IPMI timeoutv1.6.2Samuel Mendoza-Jonas2017-10-261-1/+1
| | | | | | | | | | | | | | | On OpenBMC platforms IPMI requests can take over five seconds to complete. OpenBMC does inform OPAL in BT init that it may take up to ten seconds to respond to any requests, so update our timeout value to accommodate this extra delay. On other platforms this will won't change anything (AMI- and SMC- based BMCs for example respond in under a second), but on OpenBMC platforms such as Witherspoon this will delay Petitboot significantly while we wait for the response. This is not ideal but we need to wait in order to receive important information such as a safe mode request. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover: Update env vars at init and suppress LVM warningsSamuel Mendoza-Jonas2017-08-221-15/+0
| | | | | | | | | | | Environment variables are not platform-specific so move set_proxy_variables to device-handler and call it at handler init. At the same time set LVM_SUPPRESS_FD_WARNINGS to ignore the "file descriptor leaked" warnings when calling LVM-utilities, since we must keep some file descriptors open in lib/process. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/platform-powerpc: Handle optional Get Device ID sectionSamuel Mendoza-Jonas2017-06-201-8/+18
| | | | | | | | | | The 'auxiliary' section of the 'Get Device ID' response is optional, and some platforms exclude it from the response entirely. However Petitboot only recognises the response as valid if it includes the full 16 bytes. Update get_ipmi_bmc_versions() to also handle responses of only 12 bytes. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/platform-powerpc: Correct aux revision formatSamuel Mendoza-Jonas2017-06-201-7/+8
| | | | | | | | The Auxiliary Firmware Revision Information should be displayed as four hexadecimal bytes if a manufacturer-specific format is not known. Update the "Firmware version" format to reflect this. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/platform-powerpc: Don't fail early if nvram failsSamuel Mendoza-Jonas2017-04-271-1/+1
| | | | Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover: Track both configured and current autoboot settingsSamuel Mendoza-Jonas2017-03-151-14/+1
| | | | | | | | | | | | | | | If autoboot is enabled but later disabled or cancelled by, for example, an IPMI override then the nc-config screen will set the autoboot widget as disabled. If the user then makes and saves a change in nc-config, autoboot will also be saved as disabled. This accidental change is particularly awkward if the user is attempting to remove an IPMI override. Instead only ever change the autoboot setting if the user explicitly changes it. Use a new helper function 'config_autoboot_active()' to determine the current autoboot status where needed. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/platform-powerpc: Reject bootdevs with empty UUIDsSamuel Mendoza-Jonas2016-11-241-4/+5
| | | | | | | | | | If a "uuid:" label is set in the petitboot,bootdevs parameter without a matching UUID, the UUID is unintentionally accepted and set to NULL. This can cause a segfault in nc-config when device UUIDs are compared against the autoboot option. Instead treat options like this as malformed. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/platform-powerpc: Deprecate petitboot,bootdev parameterSamuel Mendoza-Jonas2016-11-241-45/+6
| | | | | | | | | The "petitboot,bootdevs" parameter has been around long enough now that there shouldn't be anyone still transitioning over from the old "petitboot,bootdev" parameter. Drop this parameter to simplify the populate_bootdev_config() logic. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/platform-powerpc: Remove unused max_partition_sizeSamuel Mendoza-Jonas2016-11-241-3/+0
| | | | Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* Support HTTP(S) proxies when downloading resourcesSamuel Mendoza-Jonas2016-11-241-0/+29
| | | | | | | | Allow the user to specify a HTTP and HTTPS proxy server. The discover server will set the http_proxy and https_proxy environment variables, enabling the proxy servers for any further HTTP(S) requests. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* Consolidate petitboot,tty and petitboot,consoleSamuel Mendoza-Jonas2016-09-081-4/+9
| | | | | | | | | | | | | | | | | | | | Commit ce54f86 "Add petitboot,tty and track available consoles" added the petitboot,tty parameter, but the petitboot,console parameter is also recognised by Petitboot. These are ultimately handled by the 30-add-offb and 80-set-stdout hooks respectively, but exist for mostly the same purpose. We consolidate these down to just the original petitboot,console parameter. If the contents of petitboot,console have been configured by Petitboot (ie. it is of the form /dev/dev# [ Description ]) we behave as normal, otherwise we assume that petitboot,console contains a full OF path to the intended console device and do not allow it to be modified. This follows petitboot,console's original intent to be a debug aid, and takes precedence over any other use. The 80-set-stdout hook is removed as 30-add-offb now accounts for both use cases. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* Use 'consoles' instead of 'tty' to refer to interfacesSamuel Mendoza-Jonas2016-09-081-14/+14
| | | | | | | 'Console' is more readily understandable and technically more correct than 'tty' for referring to the interfaces that Petitboot starts a UI on. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover: Avoid writing network overrides to NVRAMSamuel Mendoza-Jonas2016-09-081-0/+9
| | | | | | | | Explicitly keep track of whether the current interface config was set by an IPMI network override, and avoid overwriting any saved config unless the override was marked persistent. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/platform-powerpc: Use IPMI on BMC-based machines onlySamuel Mendoza-Jonas2016-07-141-3/+5
| | | | | | | | With a kernel that has IPMI support Petitboot will try to use direct IPMI, however on FSP machines this is not fully functional. Use direct IPMI only on BMC-based machines, and use sysparams otherwise. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover: Add petitboot,tty and track available consolesSamuel Mendoza-Jonas2016-06-291-0/+43
| | | | | | | | | | Add the NVRAM parameter petitboot,tty which sets the default console to use when booting a kernel. In load_config() construct a list of available consoles depending on the current platform. A future patch depending on firmware changes will allow this list to be constructed dynamically. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/platform-powerpc: Return bootdev error correctlyv1.1.1Samuel Mendoza-Jonas2016-06-161-2/+2
| | | | | | | | | | | | | In one case get_ipmi_bootdev_ipmi() can return 0 on an error, which leads to bootdev being treated as a valid bootdev despite being uninitialised. If the planets line up correctly and bootdev is less than or equal to IPMI_BOOTDEV_SETUP, Petitboot will incorrectly apply an IPMI override. Update the error return value in get_ipmi_bootdev_ipmi(), and properly initialise bootdev. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover/platform-powerpc: Zero-pad BMC aux-versionv1.0.1Samuel Mendoza-Jonas2016-04-261-1/+1
| | | | Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover: Respect persistent flag for network overridesv1.0.0Samuel Mendoza-Jonas2016-03-231-4/+16
| | | | | | | If the persistent bit is set in a IPMI network override, overwrite any existing interface config in NVRAM with the new network override. Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
* discover: Include leading zero in firmware version stringSam Mendoza-Jonas2016-02-261-2/+2
| | | | Signed-off-by: Sam Mendoza-Jonas <sam@mendozajonas.com>
* discover: Add support for IPMI network overrideSam Mendoza-Jonas2016-02-261-0/+95
| | | | | | | | | | | | | | | | | | | | | | On BMC platforms the 'Get System Boot Options' command can also be used to check for a temporary network interface config override. This is implemented via the optional 'OEM Parameters' field defined in the IPMI v2 spec. We define the actual format of the field as: - 4 byte cookie value - 2 byte version value - 1 byte hardware address size - 1 byte IP address size - Hardware address - 1 byte flags for 'ignore' and 'method' And for static configs: - IP Address - 1 byte subnet value - Gateway address If set the config override replaces any other interface config, forcing the use of the specified configuration. Signed-off-by: Sam Mendoza-Jonas <sam@mendozajonas.com>
* Retrieve BMC version info via IPMISam Mendoza-Jonas2016-02-101-0/+91
| | | | | | | | On BMC machines the "Get Device ID" and "Get BMC Golden Side Version" IPMI commands are available. If possible retrieve some interesting version numbers and display them in the System Information screen. Signed-off-by: Sam Mendoza-Jonas <sam@mendozajonas.com>
* Display VERSION partition info on BMC machinesSamuel Mendoza-Jonas2016-02-091-0/+10
| | | | | | | | | | On supported platforms read the VERSION partition on startup and display the available versions strings in the System Information screen. This adds a skeleton hostboot.c to support possible additional BMC platform support. Signed-off-by: Sam Mendoza-Jonas <sam@mendozajonas.com>
* discover: Print IPMI bootdev response for debugSam Mendoza-Jonas2016-02-091-0/+5
| | | | Signed-off-by: Sam Mendoza-Jonas <sam@mendozajonas.com>
* ui: add URL for static configurations to load a specified fileNishanth Aravamudan2015-12-181-3/+11
| | | | | | | | | | | | In certain configurations, e.g. automation, we want to use static networking but load a particular file, automatically and parse it as a pxelinux config file. Currently, we support something like this for DHCP based booting, but not static. Add a URL field to the UI for static configurations and reuse the logic from device_handler_process_url() to load the specified file. Signed-off-by: Nishanth Aravamudan <nacc@linux.vnet.ibm.com> Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
* discover: Skip malformed bootdev fieldsSamuel Mendoza-Jonas2015-12-181-5/+2
| | | | | | Fixes Coverity defect #30471 Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
* discover: Use snprintf() when building sysparam pathSamuel Mendoza-Jonas2015-12-171-6/+4
| | | | | | Fixes Coverity defects #30481 and #30482 Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
* discover: Properly handle return valuesSamuel Mendoza-Jonas2015-12-171-1/+1
| | | | | | | | Fixes three unchecked return values, and one missing initialisation. Fixes Coverity defects #30450, #30451, #30454, and #30483 Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
* Add BMC interface MAC to system info outputJack Miller2015-12-151-1/+29
| | | | | | Useful for identifying the initial BMC traffic on the network. Signed-off-by: Jack Miller <jack@codezen.org>
* discover/ipmi: Increase IPMI timeout to a reasonable valueJeremy Kerr2015-09-301-1/+1
| | | | | | | | | | | | | | | | | We've seen some IPMI timeouts during testing - meaning that an IPMI bootdev setting will be ignored. This can result in a machine booting from an incorrect boot device, or missing a 'safe mode' indication, or incorrectly proceeding past petitboot. The firmware & kernel has its own timeout & retry mechanism, so we already have a little error-recovery there; the timeout in petitboot is to prevent an indefinite block if the kernel interface isn't behaving correctly. So, this change bumps the timeout to a value that suits BMCs we've seen in the field (specifying a 2 second timeout, with one retry). Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Add disable param for dm-snapshotsSamuel Mendoza-Jonas2015-08-181-0/+5
| | | | | | | Add a debug-style nvram parameter to disallow the use of device-mapper snapshots. Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
* Make read-only guarantee user-settableSamuel Mendoza-Jonas2015-08-061-0/+11
| | | | | | | | Create a new Petitboot option 'petitboot,write?' that specifies whether the system is allowed to mount devices read-write. The option can be toggled by the user in the nc-config screen. Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
* discover: Fix raw string argument to talloc_asprintf_appendJeremy Kerr2015-06-261-1/+1
| | | | | | | | | | | | | | Current builds give a warning: ../discover/platform-powerpc.c: In function ‘update_bootdev_config’: ../discover/platform-powerpc.c:667:4: warning: format not a string literal and no format arguments [-Wformat-security] tmp = val = talloc_asprintf_append(val, boot_str); ^ This change uses "%s" for the format string. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Clear default-boot-device when invalidatedSamuel Mendoza-Jonas2015-05-051-6/+22
| | | | | | | | | Update the clear_ipmi_bootdev functions to optionally invalidate the next- or default-boot-device for their respective machines. If a client invalidates the ipmi_bootdev in the config, invalidate the respective bootdev. Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
* lib: Move ipmi_bootdev enum to types.hSamuel Mendoza-Jonas2015-05-051-0/+1
| | | | | | | Move the ipmi_bootdev definition to types.h to support returning descriptive strings to the system configuration UI. Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
* petitboot: Implement ordered boot optionsSamuel Mendoza-Jonas2015-05-051-19/+102
| | | | | | | | | | | Move petitboot to a more familiar 'boot-order' based autoboot system. The discover server now reads multiple values from the petitboot,bootdev parameter and adds them in order to config->autoboot_opts. Boot priority is determined by the options' position in the list. On the client, nc-config now recognises the new boot order, and allows the user to add, remove, and reorder the devices in the list. Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
* discover: Add support for multiple bootdev argumentsSamuel Mendoza-Jonas2015-05-051-0/+41
| | | | | | | | To support multiple autoboot options while retaining backwards compatability, interpret the petitboot,bootdev parameter as optionally having several space-separated values. Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
* discover: Set OS Boot sensor with 0xa9Joel Stanley2015-04-301-1/+1
| | | | | | | | | | | | | If we don't set all the things, we only get an assertion event, without the state being asserted. Despite the IPMI spec suggesting we only needed to set 0x10, aka the assertion bits, testing reveals we want to set all of the things to cause the BMC to assert the state. Tested-by: Nick Bofferding <bofferdn@us.ibm.com> Signed-off-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
* discover/platform-powerpc: Set IPMI OS boot sensorJoel Stanley2015-04-211-1/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is to indicate to a BMC that we have initiated OS boot. This patch manually parses the device tree for the sensor information. In the future this could be replaced by libfdt or similar. Discover the id of your OS Boot sensor: $ sudo ipmitool sensor get "OS Boot" Locating sensor record... Sensor ID : OS Boot (0x5a) Entity ID : 35.0 (Operating System) Sensor Type (Discrete): OS Boot (0x1f) Sensor Reading : 0h Event Message Control : Per-threshold Assertion Events : OS Boot [boot completed - device not specified] Assertions Enabled : OS Boot [A: boot completed] [C: boot completed] [PXE boot completed] [Diagnostic boot completed] [CD-ROM boot completed] [ROM boot completed] [boot completed - device not specified] [Installation started] [Installation completed] [Installation aborted] [Installation failed] OEM : 0 In this case it is 0x1f. Note that the sesnor is currently asserted iwth boot completed - device not specified. Test by clearing all assertions in the OS Boot sensor: $ sudo ipmitool raw 0x04 0x30 0x5a 0x30 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 $ sudo ipmitool sensor get "OS Boot" Locating sensor record... Sensor ID : OS Boot (0x5a) Entity ID : 35.0 (Operating System) Sensor Type (Discrete): OS Boot (0x1f) Sensor Reading : 0h Event Message Control : Per-threshold Assertions Enabled : OS Boot [A: boot completed] [C: boot completed] [PXE boot completed] [Diagnostic boot completed] [CD-ROM boot completed] [ROM boot completed] [boot completed - device not specified] [Installation started] [Installation completed] [Installation aborted] [Installation failed] OEM : 0 Then reboot your system. The assertion event should once more say "boot completed - device not specified". Signed-off-by: Joel Stanley <joel@jms.id.au>
* discover: Initialise strtok_r saveptr to NULLSamuel Mendoza-Jonas2015-04-141-1/+1
| | | | | Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/platform-powerpc: Fix logic for persistent IPMI boot settingsJeremy Kerr2015-04-021-1/+1
| | | | | | We should only clear the IPMI bootdev if the setting *isn't* persistent. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/platform: rename finalise_config hookJeremy Kerr2015-02-161-2/+2
| | | | | | | We want to expand the finalise_config hook to cover generic pre-boot functionality, so rename to pre_boot. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/platform-powerpc: Implement direct IPMI interfaceJeremy Kerr2014-12-151-1/+96
| | | | | | | This change adds a direct IPMI interface to the /dev/ipmi0 device node, which is present on OpenPower machines. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Integrate ipmi bootdev settings into the priority systemJeremy Kerr2014-12-151-30/+48
| | | | | | | | | | | | | | | | | | Currently, we expose the boot device priorities through an array in struct config, which will either be the default (network -> disk), or a single device type specified by the IPMI code. Rather than hide the implementation details in this array, we'd like to expose the details of the machine configuration instead. This allows user visibility of the real boot configuration (for example, if an IPMI boot preference is set). This change removes the priority array, and replaces it with the ipmi_bootdev data (and a persistent flag). We update the default-conflict-resolution code to reflect the priorities between IPMI and UUID preferences. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/powerpc: Separate ipmi bootdev handling into separate functionsJeremy Kerr2014-12-151-30/+27
| | | | | | | | We'd like to add a new backend to the bootdev storage, so move the common bootdev-handling code into separate functions, moving ipmi_bootdev_is_valid to ipmi.c. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Add ipmi moduleJeremy Kerr2014-12-151-10/+1
| | | | | | | | Move our IPMI-specific definitions to a separate header, and a mostly-empty ipmi.c file. We'll populate this with IPMI functionality in later changes. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/platform: Add finalise_config_hookJeremy Kerr2014-09-301-11/+14
| | | | Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
* discover/platform-powerpc: Read language configuration from NVRAMJeremy Kerr2014-09-181-0/+7
| | | | | | Implement load & save of the petitboot language configuration. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/platform-powerpc: Fix incorrect device tree directoryJeremy Kerr2014-08-071-3/+8
| | | | | | | It's /proc/device-tree, not /proc/device_tree. Use a variable to hold this prefix. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
OpenPOWER on IntegriCloud