Age | Commit message (Collapse) | Author | Files | Lines |
|
SPDX makes it a simpler diff.
I have audited the commit history of each file to ensure that they are
exclusively authored by IBM and thus we have the right to relicense.
The motivation behind this is twofold:
1) We want to enable experiments with coreboot, which is GPLv2 licensed
2) An upcoming firmware component wants to incorporate code from skiboot
and code from the Linux kernel, which is GPLv2 licensed.
I have gone through the IBM internal way of gaining approval for this.
The following files are not exclusively authored by IBM, so are *not*
included in this update (I will be seeking approval from contributors):
core/direct-controls.c
core/flash.c
core/pcie-slot.c
external/common/arch_flash_unknown.c
external/common/rules.mk
external/gard/Makefile
external/gard/rules.mk
external/opal-prd/Makefile
external/pflash/Makefile
external/xscom-utils/Makefile
hdata/vpd.c
hw/dts.c
hw/ipmi/ipmi-watchdog.c
hw/phb4.c
include/cpu.h
include/phb4.h
include/platform.h
libflash/libffs.c
libstb/mbedtls/sha512.c
libstb/mbedtls/sha512.h
platforms/astbmc/barreleye.c
platforms/astbmc/garrison.c
platforms/astbmc/mihawk.c
platforms/astbmc/nicole.c
platforms/astbmc/p8dnu.c
platforms/astbmc/p8dtu.c
platforms/astbmc/p9dsu.c
platforms/astbmc/vesnin.c
platforms/rhesus/ec/config.h
platforms/rhesus/ec/gpio.h
platforms/rhesus/gpio.c
platforms/rhesus/rhesus.c
platforms/astbmc/talos.c
platforms/astbmc/romulus.c
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
[oliver: fixed up the drift]
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
|
|
Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
|
|
Reported-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
|
|
Use Software Package Data Exchange (SPDX) to indicate license for each
file that is unique to skiboot.
At the same time, ensure the (C) who and years are correct.
See https://spdx.org/
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
[oliver: Added a few missing files]
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
|
|
The current code has a few possible issues with string handling, and
gcc flags a number of string / buffer warnings when enabling more
checking.
Some of the issues in the file:
- Mixing of null-terminated arrays (in most cases), and non-null in the
input/output buffer format. memcpy generally should be used when the
length is known.
- Lack of input data length bounds checking. Malformed input could
cause overruns.
- String copying from same sized source and destination array sizes,
where the source is a NUL terminated string, so the strncpy copies
the string without its NUL terminator, which becomes NUL terminated
at the zeroed destination array. Compiler does not like this, and
it only works if the destination has been zeroed, so not a great
pattern.
- Attemping to NUL terminate string using strcat, which will overwrite
a byte past the end of the array if the string length is at maximum,
or worse if the input was malformed.
This patch fixes several of these issues and fixes a number of compiler
warnings. In general, the buffer and string handling could probably
benefit from a more in-depth audit.
Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Tested-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
|
|
Caught by scan-build, also constant-ify the input
parameter.
Signed-off-by: Balbir singh <bsingharora@gmail.com>
Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
|
|
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
This is an experimental patch that implements "Fast reboot" on P8
machines.
The basic idea is that when the OS calls OPAL reboot, we gather all
the threads in the system using a combination of patching the reset
vector and soft-resetting them, then cleanup a few bits of hardware
(we do re-probe PCIe for example), and reload & restart the bootloader.
For Trusted Boot, this means we *add* measurements to the TPM, so you
will get *different* PCR values as compared to a full IPL. This makes
sense as if you want to be sure you are running something known then,
well, do a full IPL as soft reset should never be trusted to clear any
malicious code.
This is very experimental and needs a lot of testing and also auditing
code for other bits of HW that might need to be cleaned up.
BenH TODO: I also need to check if we are properly PERST'ing PCI devices.
This is partially based on old code I had to do that on P7. I only
support it on P8 though as there are issues with the PSI interrupts
on P7 that cannot be reliably solved.
Even though this should be considered somewhat experimental, we've had
a lot of success on a variety of machines. Dozens/hundreds of reboots
across Tuleta, Garrison and Habanero.
Currently, we've hidden it behind a NVRAM config option, which *is*
liable to change in the future (to ensure that only those who know
what they're doing enable it)
You can enable the experimental support via nvram option:
nvram -p ibm,skiboot --update-config experimental-fast-reset=feeling-lucky
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
[stewart@linux.vnet.ibm.com: hide behind nvram option, include Mambo fixes
from Mikey]
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Only the major ones at this point in time.
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Simple fix as bytes_sent is assigned in the following line.
hw/fsp/fsp-leds.c:817:3: warning: Value stored to 'bytes_sent' is never read
bytes_sent = 0;
^ ~
hw/fsp/fsp-leds.c:830:4: warning: Value stored to 'bytes_sent' is never read
bytes_sent = 0;
^ ~
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
|
|
|
|
This bug has originated since day 1 (of public release), what was going on
was that we were incorrectly using PSI_DMA_LOC_COD_BUF as the *address*
to write to for the FSP to read rather than using that purely as the
TCE table.
What we *should* have been doing (and this patch now does), is allocating
some (aligned) memory and using it.
With this patch, we no longer write over some poor random memory location
that could be being used by the host OS for something important, for example,
in the (internal) bug report of this, it was futex_hash_bucket in Linux
being replaced with our structure for replying to FSP_CMD_GET_LED_LIST (which
is around 4kb) and Linux doesn't like it when you replace a bunch of lock
data structures with essentially garbage.
Since this is FSP LED code specific, this only affects FSP based systems.
Reported-by: Dionysius d. Bell <belldi@us.ibm.com>
Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
See https://github.com/lucasdemarchi/codespel
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
There are now no users of the call_out parameter and future users should
use the log_append_msg() and log_append_data() functions, so remove all
references to call_out.
Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Ideally service processor shouldn't request OPAL for SAI state...as this
LED is controlled by service processor itself.
But of some reason its asking OPAL to provide state. Hence handle this
request until FSP team fixes it.
Sample log without this patch:
[77884350335,3] FSPLED: Could not find the location code LC=U8246.L2C.060377A
[77942662287,8] FSPLED: FSP_CMD_GET_LED_LIST command received
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
We added led-loc property.. which contains LED location information.
But this property was never used. Also we can make out LED location
(enclosure/component) based on location code (if location code doesn't
contain "-" means its enclosure location code).
As Ben suggested [1], removing this property.
Present code is included in skiboot skiboot-5.0 release..But we don't
have any consumer yet. Hence I think its fine to make this changes.
[1] https://lists.ozlabs.org/pipermail/linuxppc-dev/2015-June/130433.html
Suggested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
struct led_set_cmd cmd is zalloc. While doing strncpy of
loc_code to cmd->loc_code, there are chances of cmd->loc_code
being unterminated. Fix the issue by copying LOC_CODE_SIZE - 1.
Fixes Coverity defect #100249.
Signed-off-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
... instead of potentially unbounded src buffer size
Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
FSP sends SA indicator update notification via sys param update.
Use that info to update cached indicator state.
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
SAI is controlled by FSP. This patch adds support to get/set
this indicator. Also update OPAL interface so that playload
can read/set this indicator.
During init, we read this indicator state using MBOX command.
OPAL uses MBOX interface to update this SAI.
FSP sends update notification whenever there is change in SAI
state (except for OPAL initiates updates). We use the notification
to update cached SAI state.
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
SAI information is available in device tree. This patch parses
device tree to get SAI location code information.
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Lets use the LED mode information populated by previous patch.
We don't support fault indicator in 'Guiding Light' mode. So
don't expose fault indicator to playload in Guiding Light mode.
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
We get SAI indicator via HDAT. So we have to create led node
while parsing HDAT itself. Lets get led node from device tree.
Note that LED DT creation fails until next commit...which creates
LED device tree node.
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Define macors for LED related device tree property and
its values.
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
We want to refer leds header file in hdata. Hence move
header file to include directory.
No functionality changes.
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Now that opal.h includes opal-api.h, there are a bunch of files that
include both but don't need to.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
If FSP messes up SLCA data then attention location code points
to some other location code and its possible that we may endup
in duplicate LED location code :-(
Better to continue with partial LED list than crashing OPAL because
of duplicate node in device tree.
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
[stewart@linux.vnet.ibm.com: prlog(PR_WARNING) on duplicate found]
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Presently if fsp_msg_set_led_state() fails then we don't continue
processing remaining LED update request...which is not correct.
Also free spcn_cmd in one place rather than freeing at every failure
block.
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Presently we update enclosure exclusive bit before making LED update
SPCN passthrough command and not reverting if this command fails. So
we endup having wrong state if SPCN passthrough command fails.
This patch fixes above described issue.
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
This patch adds and registers the following two new OPAL interfaces
for the LED subsystem. With the help of these new OPAL calls, the
host will be able to set or query the state of various LEDs on the
system at any given location code (as passed in the device tree).
As of now, it supports two kinds of LEDs on the same location code
one is "Identify LED" and the other being the "Fault LED".
(1) OPAL_LEDS_GET_INDICATOR fsp_opal_leds_get_ind
(2) OPAL_LEDS_SET_INDICATOR fsp_opal_leds_set_ind
The signtaure of these OPAL interfaces are like the following
(1) fsp_opal_leds_get_ind(loc_code, led_mask, led_value, led_max_type)
The host will pass the location code of the LED (loc_code) and
maximum number of LED types it understands (led_max_type). Sapphire
updates the led_mask with set bits pointing to LED types whose status
is availbale and updates the led_value with actual status. Sapphire
checks the led_max_type to understand whether host is newer or older
compared to itself. In the case where the Sapphire is newer compared
to host (Sapphire's led_max_type > host's led_max_type), it will update
led_mask and led_value according to led_max_type requested by the host.
When the host is newer compared to the Sapphire (host's led_max_type >
Sapphire's led_max_type), Sapphire updates led_max_type to the maximum
number of LED type it understands and updates led_mask, led_value based
on that maximum value.
(2) fsp_opal_leds_set_ind(loc_code, led_mask, led_value, led_max_type)
The host will pass the location code of the LED types, mask,
value and maximum number of LED types it understands. Sapphire will
update LED status for all the LED types mentioned in the mask with
their value mentioned. Sapphire checks the 'led_max_type' to understand
whether the host is newer or older compared to itself. In case where
the Sapphire is newer compared to the host (Sapphire's led_max_type >
host's led_max_type), it updates LED status based on led_max_type
requested from the host. When the host is newer compared to the Sapphire
(host's led_max_type > Sapphire's led_max_type), Sapphire updates
'led_max_type' to the maximum number of LED type it understands and
then it updates LED status based on that updated maximum value of LED
types. Host needs to check the returned updated value of led_max_type
to figure out which part of it's request got served and which ones got
ignored.
Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
If set LED mbox command fails then we have to respond to FSP
with apropriate status code.
Moved MBOX response code to separate function so that we can
just call that with different status code.
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
The LED local state gets updated before queuing the FSP command.
If the command returns in error state, the state gets rolled back
in the function callback. But in case where the FSP command queue
it self fails, it does not get rolled back. This patch fixes this
scenario by rolling back the state change in case the FSP command
queuing itself fails.
Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
This patch increase the scope of the lock to cover all data structure
manipulation and SPCN command queuing to change the LED state. It also
locks the corresponding sections in the function callback.
Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
OPAL queues up asynchronous SPCN command to change the state of any
given LED with a function call back. After receiving the call back, it
sends acknowledgement message to the FSP for the previous command. But
in case of OPAL interface initiated LED state changes, no ack message
needs to be sent to the FSP, instead we might want to enable some flags
for OPAL indicating the success of the previous LED request thus making
the OPAL interface ready for subsequent commands from the host. This
creates a need to distinguish between SPCN based LED commands generated
because of FSP async interface compared to that of OPAL interface. This
patch achieves the classification and other needfull changes in this
regard. These changes will be necessary and used by OPAL interface in
subsequent patches in this series.
Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
"fsp_led_data" structure contains ckpt_status variable which keeps
current LED state before updating and if LED update fails then we
use this to revert the LED state.
We have introduced new structure (led_set_cmd) to queue up LED update
requests. It make sense to move checkpoint status variable to this
new structure.
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
This patch creates a parent LED device node called 'led' under the root
'opal' device node. This also creates child device nodes under 'led'
corresponding to all individual LEDs on the system whether it is an enclosure
type or a descendant type with their location code as name. The location code
information will be used by the host to enlist and access all the individual
LEDs present on the system. The child LED device nodes also have the properties
'led-types' and 'led-loc' representing what kind of LEDs present on the same
loation code and whether it is an enclosure type LED or a descendant type LED.
Sample device tree output:
ibm,opal {
..
..
led {
compatible = "ibm,opal-v3-led";
phandle = <0x1000006b>;
linux,phandle = <0x1000006b>;
U78C9.001.RST0027-P1-C1 {
led-types = "identify", "fault";
led-loc = "descendent";
phandle = <0x1000006f>;
linux,phandle = <0x1000006f>;
};
<snip>
};
};
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
[stewart@linux.vnet.ibm.com: Move create_led_device_nodes to FSP platform.exit]
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
Acked-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Simultaneous FSP async commands and OPAL requests to change various
LED states will generate multiple SPCN commands back to back before
their callback get processed. With this, some of the SPCN requests
might get overridden with the newer ones and hence will be lost. This
patch implements a set LED SPCN command queue which will serialize
multiple SPCN commands generated either through FSP async or OPAL
requests. All new requests are added to the queue when any previous
SPCN command completion is still pending. These requests would be
de-queued and then processed inside the SPCN command callback function
sequentially. This ensures completion of all the generated LED state
change requests without any loss.
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
[stewart@linux.vnet.ibm.com: s/spcn_cmd_cmplt/spcn_cmd_complete/]
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
We are going to expose LED list to host via device tree. We want
to make sure 'query LED list' MBOX command is completed before
populating the device tree.
fsp_led_init initiates async MBOX command to retrieve list of
LEDs. And towards the end of OPAL init path we will come back
to LED driver and populate device tree.
We can reuse existing led_support variable to check the status
before populating device tree. But this doesn't guarantee that
LED list read request is completed. Hence modify led_support to
have multiple state.
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
There may be other drivers which are registered for same MCLASS.
Hence don't log warning message in default case.. Just return
false.
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Presently we check only selected status from SPCN passthrough
command. So if MBOX command fails for any other reason then
we endup considering that as success...which is not correct.
This patch considers all response status except success as fail.
Also removes unnecessary variable (fail).
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Validate fsp msg allocation before using.
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Remove redundant variable declaration
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Don't expose functions which are not used outside LED driver.
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Presently errors logged into FSP starts with prefix "LED" and
rest starts with FSPLED. Lets use consistent prefix (FSPLED).
No change in functionality.
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Check for FSP presence before initializing LED driver.
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Remove unnecessary forward declaration.
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Remove enthusiastic use of #includes in FSP/LEDS code.
...like hdata.h which is not expected to be used outside hdata dir.
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|