summaryrefslogtreecommitdiffstats
path: root/discover/platform-powerpc.c
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* discover: Add debug flag to configJeremy Kerr2014-08-051-0/+6
| | | | | | | | | | This change adds a debug flag to the config, and groups it under not-user-modifiable parts of struct config. This means we no longer need the pb-sysinfo helper, as the last remaining function (--debug-enabled) can be implemented with pb-config. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Use platform code to read sysinfo type and identifierJeremy Kerr2014-08-051-0/+20
| | | | | | | | | | | | | | | | This change uses the platform-specific code to read the system type and identifier, rather than the pb-sysinfo utility. We introduce a new callback for struct platform: int (*get_sysinfo)(struct platform *, struct system_info *); - which populates struct system_info with appropriate information. This means that the system-specific code is kept in one place; rather than having powerpc-specific device-tree-reading code in the pb-sysinfo shell script. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/platform-powerpc: Configure safe mode from IPMI bootdev settingJeremy Kerr2014-07-221-0/+6
| | | | | | | An IPMI bootflags of 0x3 indicates a safe-mode boot. Use this to trigger petitboot's safe mode. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/powerpc: Parse & save default boot device parameterJeremy Kerr2014-07-211-0/+46
| | | | | | | This change implement load & save support for the default boot device configuration parameter. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/platform-powerpc: Don't rely on NVRAM workingJeremy Kerr2014-06-301-5/+1
| | | | | | | | | Although we need nvram to save settings, we may be running on a nvram-less machine, but still need to detect as powerpc. This change removes the nvram check. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Fix uninitialised var warningsJeremy Kerr2014-04-161-2/+2
| | | | | | | | | | | | | | We get a couple of uninitialised var warning when compiling with certain CFLAGS (-fprofile-arcs -ftest-coverage at this stage). In statement_if_execute: We'll never actually use this uninitialised (as there must be at least one conditional in the parsed statement), but we should address the warning nonetheless. As passed to strtok_r: strtok will initialise this, but it isn't obvious to the compiler. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/powerpc: Invalidate next bootdev after readingJeremy Kerr2014-03-141-3/+46
| | | | | | | The next-bootdev sysparam should only apply for the next boot, so invalidate it after reading. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/powerpc: Fix sysparams base pathJeremy Kerr2014-03-141-1/+1
| | | | | | | We are appending the sysparam filename onto sysparams_dir, so we need a trailing slash. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
OpenPOWER on IntegriCloud