aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firmware/google/memconsole-coreboot.c
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2017-05-02 15:16:29 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-05-18 16:59:06 +0200
commit7918cfc46cfad784b2aafdbbc690a96af0ae78d0 (patch)
treed775a893e4bc85b26b8df0f43570ccfa03c753e1 /drivers/firmware/google/memconsole-coreboot.c
parentuio/uio_pci_generic: don't fail probe if pdev->irq == NULL (diff)
downloadlinux-dev-7918cfc46cfad784b2aafdbbc690a96af0ae78d0.tar.xz
linux-dev-7918cfc46cfad784b2aafdbbc690a96af0ae78d0.zip
firmware: google: memconsole: Make memconsole interface more flexible
This patch redesigns the interface between the generic memconsole driver and its implementations to become more flexible than a flat memory buffer with unchanging bounds. This allows memconsoles like coreboot's to include lines that were added by runtime firmware after the driver was initialized. Since the console log size is thus no longer static, this means that the /sys/firmware/log file has to become unseekable. Signed-off-by: Julius Werner <jwerner@chromium.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/firmware/google/memconsole-coreboot.c')
-rw-r--r--drivers/firmware/google/memconsole-coreboot.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/firmware/google/memconsole-coreboot.c b/drivers/firmware/google/memconsole-coreboot.c
index 02711114dece..d48a80c3042d 100644
--- a/drivers/firmware/google/memconsole-coreboot.c
+++ b/drivers/firmware/google/memconsole-coreboot.c
@@ -33,6 +33,14 @@ struct cbmem_cons {
static struct cbmem_cons __iomem *cbmem_console;
+static ssize_t memconsole_coreboot_read(char *buf, loff_t pos, size_t count)
+{
+ return memory_read_from_buffer(buf, count, &pos,
+ cbmem_console->buffer_body,
+ min(cbmem_console->buffer_cursor,
+ cbmem_console->buffer_size));
+}
+
static int memconsole_coreboot_init(phys_addr_t physaddr)
{
struct cbmem_cons __iomem *tmp_cbmc;
@@ -50,9 +58,7 @@ static int memconsole_coreboot_init(phys_addr_t physaddr)
if (!cbmem_console)
return -ENOMEM;
- memconsole_setup(cbmem_console->buffer_body,
- min(cbmem_console->buffer_cursor, cbmem_console->buffer_size));
-
+ memconsole_setup(memconsole_coreboot_read);
return 0;
}