summaryrefslogtreecommitdiffstats
path: root/hw/lpc-uart.c
Commit message (Collapse)AuthorAgeFilesLines
* Quieten console output on bootStewart Smith2018-06-051-1/+1
| | | | | | | | | | | We print out a whole bunch of things on boot, most of which aren't interesting, so we should *not* print them instead. Printing things like what CPUs we found and what PCI devices we found *are* useful, so continue to do that. But we don't need to splat out a bunch of things that are always going to be true. Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
* uart: fix uart_opal_flush to take console lock over uart_con_flushNicholas Piggin2018-04-291-2/+8
| | | | | | | Cc: Russell Currey <ruscur@russell.cc> Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Reviewed-by: Russell Currey <ruscur@russell.cc> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
* Revert "console(lpc/fsp-console): Use only stdout-path property on P9 and above"Stewart Smith2018-03-061-11/+3
| | | | | | | | | | | | | This reverts commit 20f685a3627a2a522c465716377561a8fbcc608f. We've hit problems on Zaius machines and the needed petitboot changes haven't made it upstream yet. Let's revert for the time being while we sort everything out. We probably have to keep both around for a few years. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* console(lpc/fsp-console): Use only stdout-path property on P9 and abovePridhiviraj Paidipeddi2018-03-011-3/+11
| | | | | | | | | | | | | | | | | | | dtc tool complaining about below warning as usage of linux,stdout-path property under /chosen node is deprecated. dts: Warning (chosen_node_stdout_path): Use 'stdout-path' instead of 'linux,stdout-path' So this patch fix this by using stdout-path property on all the systems and keep linux,stdout-path only on P8 and before. This property refers to a node which represents the device to be used for boot console output. Verified boot on both P8 and P9 systems with new and older kernels. And also verified dtc warnings got fixed in both P8 and P9. Signed-off-by: Pridhiviraj Paidipeddi <ppaidipe@linux.vnet.ibm.com> [stewart: simplify logic] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* hw/lpc-uart: read from RBR to clear character timeout interruptsJeremy Kerr2017-10-061-0/+21
| | | | | | | | | | When using the aspeed SUART, we see a condition where the UART sends continuous character timeout interrupts. This change adds a (heavily commented) dummy read from the RBR to clear the interrupt condition on init. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Convert important polling loops to spin at lowest SMT priorityNicholas Piggin2017-06-061-3/+9
| | | | | | | | | | | The pattern of calling cpu_relax() inside a polling loop does not suit the powerpc SMT priority instructions. Prefrred is to set a low priority then spin until break condition is reached, then restore priority. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> [stewart@linux.vnet.ibm.com: fixup lpc-uart wait_tx_room() and unit test] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* hdat: Parse BMC nodes much earlierOliver O'Halloran2017-03-071-0/+34
| | | | | | | | | | This moves the parsing of the BMC and LPC details to the start of the HDAT parsing. This allows us to enable the Skiboot log console earlier so we can get debug output while parsing the rest of the HDAT. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Acked-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Fixup init of struct lpc_clientStewart Smith2017-03-031-0/+3
| | | | | | | | | Gcc 4.8 would warn: hw/lpc-uart.c: In function 'uart_setup_os_passthrough': hw/lpc-uart.c:428:2: error: missing initializer for field 'reset' of 'struct lpc_client' [-Werror=missing-field-initializers] Fixes: a2940770ca6da2c58081f8207aded197e45f6cd6 Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* lpc/uart: Support routing of selected LPC interrupts to LinuxBenjamin Herrenschmidt2017-03-031-16/+32
| | | | | | | | | | | | | Each LPC interrupt can be routed to one of 4 lines to the PSI bridge which represent 4 different system interrupts. This allows LPC clients to request as specific target (Linux or OPAL) and makes the LPC core pick a route and configure it appropriately. The UART is updated to properly forward interrupts to Linux if necessary Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* uart: Fix Linux pass-through policyBenjamin Herrenschmidt2017-02-071-3/+34
| | | | | | | | This was broken on Rhesus. Also add an nvram way of overriding the policy Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* console: remove con_ops->flush()Oliver O'Halloran2017-01-041-3/+0
| | | | | | | | | Flushing the OPAL console is now handled by a driver specific OPAL call handler so this can be removed. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* console: use opal_con_ops APIOliver O'Halloran2017-01-041-7/+0
| | | | | | | | | | | | | | | | | | Adds a new structure that contains the implementations of the various OPAL console handlers. This is intended to replace the existing ad-hoc mechanism where the OPAL call handlers are overwritten in the OPAL console driver's init function. Currently this just moves the site where the OPAL call handlers are overwritten to inside of console.c, but it is intended to give us a mechanism for implementing features such as pointer validation for the OPAL console calls without having to manually update each driver. This also helps to clarify differences between the internal (skiboot) console and the external (OPAL) console. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* console: add opal_con_ops structureOliver O'Halloran2017-01-041-0/+17
| | | | | | | | | | Adds a separate structure to house the operations for the OPAL console. This is used to define a new API for dealing with the OPAL console in the next patch. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* console: add helper to create serial console nodesOliver O'Halloran2017-01-041-14/+2
| | | | | | | | | | The creation of /ibm,skiboot/console/serial@<xyz> nodes is pretty much identical across the various OPAL console drivers. This patch moves it into a helper function as a cleanup. Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com> Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* uart: Cleanup initialization and remove simulator hackBenjamin Herrenschmidt2016-07-061-87/+65
| | | | | | | | | | Add more generic support for MMIO based UARTs, simplify code, use common initialization, and clean up the device-tree representation as well. 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>
* Enable Simics UART consoleRyan Grimm2016-03-071-3/+60
| | | | | | | | | | | | | The UART is a simulated ns16550 with memory mapped registers. A /simics dt node is detected and a SIMICS_QUIRK is added to chip quirks similar to MAMBO_CALLOUTS. It can contain an ns16550 dt node with a property console-bar. The LPC UART code is reused and this will work without an LPC bus in the model. Signed-off-by: Ryan Grimm <grimm@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Merge OPAL_CONSOLE_FLUSH from stableStewart Smith2016-01-121-14/+16
|\
| * Add OPAL_CONSOLE_FLUSH to the OPAL APIRussell Currey2016-01-121-14/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | uart consoles only flush output when polled. The Linux kernel calls these pollers frequently, except when in a panic state. As such, panic messages are not fully printed unless the system is configured to reboot after panic. This patch adds a new call to the OPAL API to flush the buffer. If the system has a uart console (i.e. BMC machines), it will incrementally flush the buffer, returning if there is more to be flushed or not. If the system has a different console, the function will have no effect. This will allow the Linux kernel to ensure that panic message have been fully printed out. The existing synchronous flushing mechanism used in OPAL's shutdown and reboot routines has been refactored into a helper that repeatedly calls the new partial flush function. Signed-off-by: Russell Currey <ruscur@russell.cc> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
| * console: Completely flush output buffer before power down and rebootRussell Currey2015-11-091-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Completely flush the output buffer of the console driver before power down and reboot. Implements the flushing function for uart consoles, which includes the astbmc and rhesus platforms. Adds a new function, flush(), to the con_ops struct that allows each console driver to specify how their output buffers are flushed. In the cec_power_down and cec_reboot functions, the flush function of the driver is called if it exists. This fixes an issue where some console output is sometimes lost before power down or reboot in uart consoles. If this issue is also prevalent in other console types then it can be fixed later by adding a .flush to that driver's con_ops. Signed-off-by: Russell Currey <ruscur@russell.cc> [stewart@linux.vnet.ibm.com: reduce diff size, change flush function name] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | sparse: fix incorrect type in assignment warning in hw/lpc-uart.cStewart Smith2015-11-101-1/+1
| | | | | | | | | | | | | | | | hw/lpc-uart.c:77:25: warning: incorrect type in assignment (different base types) hw/lpc-uart.c:77:25: expected restricted beint16_t [assigned] [usertype] in_count hw/lpc-uart.c:77:25: got unsigned char [unsigned] [usertype] in_count Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* | console: Completely flush output buffer before power down and rebootRussell Currey2015-11-091-1/+13
|/ | | | | | | | | | | | | | | | | | | | | Completely flush the output buffer of the console driver before power down and reboot. Implements the flushing function for uart consoles, which includes the astbmc and rhesus platforms. Adds a new function, flush(), to the con_ops struct that allows each console driver to specify how their output buffers are flushed. In the cec_power_down and cec_reboot functions, the flush function of the driver is called if it exists. This fixes an issue where some console output is sometimes lost before power down or reboot in uart consoles. If this issue is also prevalent in other console types then it can be fixed later by adding a .flush to that driver's con_ops. Signed-off-by: Russell Currey <ruscur@russell.cc> [stewart@linux.vnet.ibm.com: reduce diff size, change flush function name] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* errorlog: Deprecate elog callback parameterSamuel Mendoza-Jonas2015-07-311-1/+1
| | | | | | | | | | 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>
* Support for Naples LPC serial interruptsBenjamin Herrenschmidt2015-06-191-12/+21
| | | | | | | | | | | | | | | | | | | | | | | This adds support for the HW SerIRQ deserializer of the P8 LPC bridge which is properly wired up on Naples. It also adds support for detecting and reporting LPC error interrupts on all P8s. On most platforms (Rhesus is the exception here due to the way it lets Linux handle the UART interrupts directly), we modify the device-tree to properly represent the LPC controller as a cascaded interrupt-controller and the "interrupts" property of LPC devices to contain the actual LPC interrupt number for the device. We add a mechanism for drivers to register specific LPC interrupts, and a "workaround" for pre-Naples P8 which platforms can use to call all of them for when the external FPGA based deserializer is used. There's also a callback on LPC resets which isn't used yet, we need a bit more work on the general LPC error handling, but it can be done a separate patches. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* Add xscom_ok() and lpc_ok() to check XSCOM and LPC usabilityBenjamin Herrenschmidt2015-05-011-0/+4
| | | | | | | | | | | | | | | | | | | | | | 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>
* Remove redundant includes of opal-api.hMichael Ellerman2015-04-011-1/+0
| | | | | | | | 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>
* Move skiboot internal things from opal.h to opal-api.hStewart Smith2015-02-061-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>
* elog: Clean up error logging headersAlistair Popple2014-12-021-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>
* uart: Works better if we actually allocate out_bufBenjamin Herrenschmidt2014-10-151-0/+1
| | | | | | That got lost during a rebase ... oops. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* uart: Fix thinko in output ring pointersBenjamin Herrenschmidt2014-10-151-2/+2
| | | | | | I accidentally typed uint8_t instead of uint32_t... thanks Joel. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* uart: Use prlog instead of printfBenjamin Herrenschmidt2014-10-151-4/+4
| | | | | | And use PR_DEBUG for everything Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* uart: Keep synchronous console flush when IRQ not workingBenjamin Herrenschmidt2014-10-151-3/+25
| | | | | | | | | | | | | | Some boards are missing an EC for interrupts (or might not have the FPGA properly flashed). In that case the serial interrupt isn't working. We attempt to detect this by enabling all interrupts by default and when the first one occurs, we mark interrupts as "functional". Until they are detected as such, we keep all output flushes fully synchronous. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* uart: Add interrupt driver output ring buffer for Linux ouputBenjamin Herrenschmidt2014-10-151-41/+85
| | | | Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* uart: Give UART it's own OPAL console callbacks instead of dummy consoleBenjamin Herrenschmidt2014-10-151-100/+204
| | | | | | | | | | | This means the Linux output no longer gets into our internal log, which makes dumping of it from Linux a lot nicer. It will also allow us to improve the way we do the bufferring for Linux and to exploit eventually the TX interrupts. It will also allow us to implement some form of timeouts for the OPAL console variant of it so we don't get stuck of the BMC doesn't consume from the virtual UART. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* uart: Exploit Tx FIFOBenjamin Herrenschmidt2014-10-091-10/+18
| | | | | | | When THRE is 1, we can write up to 16 bytes, so let's make good use of it Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* Initial commit of Open Source releaseBenjamin Herrenschmidt2014-07-021-0/+343
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
OpenPOWER on IntegriCloud