aboutsummaryrefslogtreecommitdiff
path: root/hw/lpc-uart.c
AgeCommit message (Collapse)AuthorFilesLines
2016-07-06uart: Cleanup initialization and remove simulator hackBenjamin Herrenschmidt1-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>
2016-03-07Enable Simics UART consoleRyan Grimm1-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>
2016-01-12Merge OPAL_CONSOLE_FLUSH from stableStewart Smith1-14/+16
2016-01-12Add OPAL_CONSOLE_FLUSH to the OPAL APIRussell Currey1-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>
2015-11-10sparse: fix incorrect type in assignment warning in hw/lpc-uart.cStewart Smith1-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>
2015-11-09console: Completely flush output buffer before power down and rebootRussell Currey1-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>
2015-11-09console: Completely flush output buffer before power down and rebootRussell Currey1-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>
2015-07-31errorlog: Deprecate elog callback parameterSamuel Mendoza-Jonas1-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>
2015-06-19Support for Naples LPC serial interruptsBenjamin Herrenschmidt1-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>
2015-05-01Add xscom_ok() and lpc_ok() to check XSCOM and LPC usabilityskiboot-5.0.1Benjamin Herrenschmidt1-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>
2015-04-01Remove redundant includes of opal-api.hMichael Ellerman1-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>
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-10-15uart: Works better if we actually allocate out_bufBenjamin Herrenschmidt1-0/+1
That got lost during a rebase ... oops. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2014-10-15uart: Fix thinko in output ring pointersBenjamin Herrenschmidt1-2/+2
I accidentally typed uint8_t instead of uint32_t... thanks Joel. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2014-10-15uart: Use prlog instead of printfBenjamin Herrenschmidt1-4/+4
And use PR_DEBUG for everything Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2014-10-15uart: Keep synchronous console flush when IRQ not workingBenjamin Herrenschmidt1-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>
2014-10-15uart: Add interrupt driver output ring buffer for Linux ouputBenjamin Herrenschmidt1-41/+85
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2014-10-15uart: Give UART it's own OPAL console callbacks instead of dummy consoleBenjamin Herrenschmidt1-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>
2014-10-09uart: Exploit Tx FIFOBenjamin Herrenschmidt1-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>
2014-07-02Initial commit of Open Source releaseBenjamin Herrenschmidt1-0/+343
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>