aboutsummaryrefslogtreecommitdiff
path: root/hw/xscom.c
AgeCommit message (Collapse)AuthorFilesLines
2017-03-24xscom: Add indirect form 1 scomsMichael Neuling1-2/+47
Add code to perform indirect form 1 scoms. POWER8 does form 0 only. POWER9 adds form 1. The form is determined from the address only. Hardware only allows writes for form 1. Only hostboot uses these scoms during IPL, so they are unused by skiboot currently. Signed-off-by: Michael Neuling <mikey@neuling.org> Reviewed-by: Cédric Le Goater <clg@kaod.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-03-24xscom: Harden indirect writesMichael Neuling1-0/+4
Indirect scoms can only set certain bits of data. Ensure only these are set when trying to write. Signed-off-by: Michael Neuling <mikey@neuling.org> Reviewed-by: Cédric Le Goater <clg@kaod.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-03-24xscom: Add POWER9 scom resetMichael Neuling1-3/+9
Add scom reset registers for POWER9. Signed-off-by: Michael Neuling <mikey@neuling.org> Reviewed-by: Cédric Le Goater <clg@kaod.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-03-24xscom: Abstract error recovery registersMichael Neuling1-3/+9
Abstract error recovery registers to get ready for POWER9. Signed-off-by: Michael Neuling <mikey@neuling.org> Reviewed-by: Cédric Le Goater <clg@kaod.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-02-03mambo: Don't probe ECID for DD1.0X on MamboStewart Smith1-1/+3
SCOM doesn't exist, we end up in a sad place (machine check) Fixes: c9cadb4fe60d4d41fc45a35a1d2ae27e0632c679 Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2017-02-02xscom: Grab P9 DD1.0 revision levelBenjamin Herrenschmidt1-0/+28
To differentiate between 1.00, 1.01, 1.02 etc... Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-11-24slw: do SLW timer testing while holding xscom lockStewart Smith1-6/+20
We add some routines that let a caller get the xscom lock once and then do a bunch of xscoms while holding it. In some situations without this, it could take long enough to get the xscom lock that the 1ms timeout would expire and we'd falsely think the SLW timer didn't work when in fact it did. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-09-13xscom: Map all HMER status codes to OPAL errorsBenjamin Herrenschmidt1-3/+13
Instead of mapping them to just 3 different codes, define an OPAL error code for all known HMER error status, as different recovery path might be needed at the call site, and it allows for more informative logging. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-09-13xscom: Initialize the data to a known value in xscom_readBenjamin Herrenschmidt1-0/+7
In case of error, don't leave the data random. It helps debugging when the user fails to check the error code. This happens due to a bug in the PRD wrapper app. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-08-17Use additional checks in skiboot for pointersBalbir Singh1-0/+3
The checks validate pointers sent in using opal_addr_valid() in opal_call API's provided via the console, cpu, fdt, flash, i2c, interrupts, nvram, opal-msg, opal, opal-pci, xscom and cec modules Signed-off-by: Balbir Singh <bsingharora@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-07-13xscom: Log error on invalid partidBenjamin Herrenschmidt1-0/+16
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Acked-by: Michael Neuling <mikey@neuling.org> [stewart@linux.vnet.ibm.com: added FWTS annotation] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-07-12hw/xscom: Reset XSCOM engine after querying sleeping core FIRVipin K Parashar1-1/+2
XSCOM engine blocks subsequently after querying FIR of any sleeping core. This causes subsequent XSCOM opertions to hang forever due to XSCOM engine being continuously busy. Reset XSCOM engine after querying FIR of any sleeping core. Signed-off-by: Vipin K Parashar <vipin@linux.vnet.ibm.com> Signed-off-by: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-07-06Cleanup xscom_read_cfam_chipid to make p8/p9 difference clearerBenjamin Herrenschmidt1-1/+2
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Acked-by: Michael Neuling <mikey@neuling.org> [stewart@linux.vnet.ibm.com: split from timebase quirk patch] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-07-06xscom: A few P9 updatesBenjamin Herrenschmidt1-10/+23
More to go, especially we need to review recovery, but at least this enables indirect and errors out on not-yet-supported EX targeting. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Acked-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-07-06POWER9: Fix P9 chip name in XSCOMBenjamin Herrenschmidt1-1/+1
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Acked-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-07-06POWER9: Make xscom_addr() work for p8 and p9Michael Neuling1-3/+5
Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-07-05hw/xscom: Reset XSCOM engine after finite number of retries when busyVipin K Parashar1-17/+57
OPAL retries XSCOM read/write operations forever till it succeeds. This can cause XSCOM ops to hang forever when XSCOM engine remains busy for some reason. Changed it to retry XSCOM operations only XSCOM_BUSY_MAX_RETRIES number of times instead of retrying forever. Also added logic to reset XSCOM engine after XSCOM_BUSY_RESET_THRESHOLD number of retries to unblock it when it remains busy. Cc: stable # 9c2d82394fd2 ("xscom: Return OPAL_WRONG_STATE on XSCOM ops..") Signed-off-by: Vipin K Parashar <vipin@linux.vnet.ibm.com> Signed-off-by: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-05-10Add base POWER9 supportMichael Neuling1-4/+14
Add PVR detection, chip id and other misc bits for POWER9. POWER9 changes the location of the HILE and attn enable bits in the HID0 register, so add these definitions also. Signed-off-by: Michael Neuling <mikey@neuling.org> [stewart@linux.vnet.ibm.com: Fix Numbus typo, hdata_to_dt build fixes] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2016-03-31xscom: Return OPAL_WRONG_STATE on XSCOM ops if CPU is asleepRussell Currey1-11/+18
xscom_read and xscom_write return OPAL_SUCCESS if they worked, and OPAL_HARDWARE if they didn't. This doesn't provide information about why the operation failed, such as if the CPU happens to be asleep. This is specifically useful in error scanning, so if every CPU is being scanned for errors, sleeping CPUs likely aren't the cause of failures. So, return OPAL_WRONG_STATE in xscom_read and xscom_write if the CPU is sleeping. Signed-off-by: Russell Currey <ruscur@russell.cc> Reviewed-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-11-10sparse: fix constant is so big warning in hw/xscom.cStewart Smith1-1/+1
hw/xscom.c:425:23: warning: constant 0x221EF04980000000 is so big it is long Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-10-01centaur: Add indirect XSCOM supportBenjamin Herrenschmidt1-12/+0
It works just like P8, we copy the code for now rather than make it somewhat common due to our locking differences and to limit the risk close to release. We can refactor later. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-09-30xscom: Fix logging of indirect XSCOM errorsBenjamin Herrenschmidt1-3/+3
We didn't pass the right "is_write" argument for writes and the string used for logging was somewhat confusing. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-07-31opal-api: Add OPAL call to handle abnormal reboots.Vipin K Parashar1-0/+32
This patch adds a new OPAL call OPAL_CEC_REBOOT2 which will be used to handle abnormal reboot/termination by kernel host. This call will allow host kernel to pass reboot type and additional debug data which needs to be captured/saved somewhere (for later analysis) before going down. Currently it will support two reboot types (0). normal reboot, that will behave similar to that of opal_cec_reboot() call, and (1). platform error reboot, that will trigger a system checkstop using xscom address and FIR bit information obtained via device-tree property 'ibm,sw-checkstop-fir'. For unsupported reboot type, this call will do nothing and return with OPAL_UNSUPPORTED. In future, we can overload this call to support additional reboot types. Signed-off-by: Vipin K Parashar <vipin@linux.vnet.ibm.com> Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com> Reviewed-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-07-31errorlog: Deprecate elog callback parameterSamuel Mendoza-Jonas1-3/+3
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>
2015-06-11Fix possible return garbage from xscom_read_cfam_chipid()Stewart Smith1-1/+2
If we get an error from the xscom_read() call we could extract a garbage chip_id rather than just returning an error. Caught by LLVM scan-build Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-05-01Merge branch 'stable', skiboot-5.0.1Stewart Smith1-18/+11
2015-05-01Add xscom_ok() and lpc_ok() to check XSCOM and LPC usabilityskiboot-5.0.1Benjamin Herrenschmidt1-0/+5
his primarily checks whether the caller already holds the corresponding locks to avoid re-entrancy in some of the deep error path such as when XSCOM itself triggers an error log. It will be extended in the case of LPC to also handle known HW error states. We use them to avoid queuing/polling in the BT driver and to discard characters in the UART driver. Note: This will not normally involve a loss of log to the UART as the UART driver is also protected by the console suspend mechanism. So this is a safety mechanism only. This fixes issues where the generation of error logs inside the LPC or XSCOM drivers could cause a re-entrancy (via the BT interface) causing deadlocks. Now, the error logs IPMI messages will be queued up and delivered later on the next poll handler. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-05-01xscom: Remove recursive lockingBenjamin Herrenschmidt1-18/+6
Nothing should be using it nowadays and it's dangerous. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-04-30chip: Fix chip name display for NaplesBenjamin Herrenschmidt1-3/+6
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-04-09Add Naples chip supportBenjamin Herrenschmidt1-0/+4
This adds the PVR and CFAM ID for the Naples chip. Otherwise treated as a Venice. This doesn't add the definitions for the new PHB revision yet Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-23hw: Create xscom_read_cfam_chipid()Michael Neuling1-6/+16
Create xscom_read_cfam_chipid() to read the cfam chipid(). We'll need to use this in a few places, so avoid replicating the code. Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-19update users of GET/SETFIELD()Dan Streetman1-7/+7
The last two patches updated GETFIELD() and SETFIELD() to no longer require the user to specify the mask and shift of a field, and to remove all _LSH defines and rename any _MASK defines. There are some places where the masks were used directly, where the caller needs to have the _MASK suffix removed. There are also two users of SETFIELD() where the field name still has the _MASK suffix because there is an existing macro with the base name. Change users of SETFIELD() to include the _MASK suffix where needed. Change direct users of any mask to remove the _MASK suffix. Signed-off-by: Dan Streetman <ddstreet@ieee.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-19Change user-defined _MASK/_LSH to just maskDan Streetman1-6/+4
The last patch changed the SETFIELD() and GETFIELD() macros to automatically calculate the shift of a given mask, so manually specifying the shift is no longer needed. Additionally, any masks should have the _MASK suffix removed since the GETFIELD() and SETFIELD() operations expected to be passed the mask name without the _MASK suffix (and so either the mask name or the get/setfield call needs to have its mask name changed). Change all _MASK masks to remove the _MASK suffix, except for any places that leaving _MASK makes sense (e.g. already an existing define without _MASK suffix). Remove all _LSH defines, as they are no longer needed. Signed-off-by: Dan Streetman <ddstreet@ieee.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-18Replace is_mambo_chip with a better chip quirk mechanismBenjamin Herrenschmidt1-1/+1
And add some basic qemu quirks Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2015-02-06Move skiboot internal things from opal.h to opal-api.hStewart Smith1-0/+1
This is probably not the best collection of things in the world, but it means that opal.h is much closer to being directly usable by an OS. This triggers a bunch of #include fixes throughout the tree. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-12-02elog: Clean up error logging headersAlistair Popple1-1/+1
Commit cf6f4e8912d29fb89ce85c84834607065ad595a5 introduced a platform independent frontend for error logging. However it failed to move the generic parts of the fsp-elog.h header into the platform independent one, instead relying on the fact that up until now fsp-elog.h was included whenever a function needed to log errors. This patch moves the platform independent defines into the frontend header file (errorlog.h) and removes the include of the platform specific header in generic code paths. Signed-off-by: Alistair Popple <alistair@popple.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-12-01Add tweaks to work in Mambo simulatorBenjamin Herrenschmidt1-2/+8
Mambo doesn't implement various things such as PBA SCOMs, LPC, ChipTOD, etc... It also provides a special console hook. This adds detection of Mambo via the /mambo node, and enables us to boot all the way to Linux. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
2014-08-08lock: Fix races when setting in_con_lockBenjamin Herrenschmidt1-0/+8
When setting the flag in a lock that indicates that it's on the console path, we need to take and release that lock to ensure that any other processor that might have taken it before the flag was set has released it, otherwise the lock might still be held without the console count properly incremented, which can cause it to go negative or cause the deadlock that we mean to avoid by that to still occur. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2014-07-02Initial commit of Open Source releaseBenjamin Herrenschmidt1-0/+518
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>