From patchwork Fri Nov 18 05:01:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver O'Halloran X-Patchwork-Id: 696417 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tKm9x60Lnz9syB for ; Fri, 18 Nov 2016 16:04:05 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="cFhQx1CJ"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3tKm9x51qxzDvy3 for ; Fri, 18 Nov 2016 16:04:05 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="cFhQx1CJ"; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from mail-pg0-x243.google.com (mail-pg0-x243.google.com [IPv6:2607:f8b0:400e:c05::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3tKm8851ylzDvx0 for ; Fri, 18 Nov 2016 16:02:32 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="cFhQx1CJ"; dkim-atps=neutral Received: by mail-pg0-x243.google.com with SMTP id e9so19146053pgc.1 for ; Thu, 17 Nov 2016 21:02:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=pboEAdpUnuZ5F7wLHiVnufLjdb3sIZehOB/5f742ess=; b=cFhQx1CJVuDln9W7OsGpFaTz6FYryFhdyCtFcFalK6jH8JsGvllgKaDSsUFhauNR7r p63NVs/dl++2Gw7OznatTpt1bQ21FbB73nEQDA1CmJ1lesYqx7NsB+AethykvKFFtjYm J7nJsEwM/7pq/nEd/xkkv6QrrJjsRTe3MiQsMDuR0mb3wcIJUQPqQukwXwJc5u7Y0M4z i5Z8E6UOsJmNyIPpURdwC37MrdCk72m9tBlG62P3N13JqmE4RSRZYdZ6HuW6lGUPSPH9 CPQMBO3hI0cA2ye+UXkcL8N7ZuyAYtR98sVQoEX6JF0We26HbW4SIqTFLnYney3pEsLV 8XQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=pboEAdpUnuZ5F7wLHiVnufLjdb3sIZehOB/5f742ess=; b=F7eq97TXwIPabDU9+d7egB+d0r/hQiHv3j/zC6lxXGN/ynt4qE4cLpyyWJGOhlV+Ge mCC1zFzy8Wr/vXZTxTJyzC2RPBlYeHaH31Tn+VTJmGHOxm7D9stveY/ir8FYPQfsRBjj ehti7lva4eMhnz8HP1qhpvaNxwuzfYl1KXf7F/S/3HSJoUFx8MHF6LJhwPDMibApsJY2 qDoVLQM0pdy9ayJWrXZIBDJ1w4k0JAtnIv3bpvR1t+DQ0XPfcXyEbWsP6+NoWEwhmv7V +I7xG6qZ2176KqebZZhqCeeEq8uJ1b3LwfqyiSr4GKSZxCYnMyatVaPmQ01/oeTBr4Nh jQRA== X-Gm-Message-State: ABUngvdWvXI/H3obOHi7iPRbE96QedTEvV94ardBL1qPpXwhY723zm43k8PLUrfNIrRX7g== X-Received: by 10.99.142.201 with SMTP id k192mr14623823pge.174.1479445350904; Thu, 17 Nov 2016 21:02:30 -0800 (PST) Received: from canetoad.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id x90sm12613462pfk.73.2016.11.17.21.02.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Nov 2016 21:02:30 -0800 (PST) From: Oliver O'Halloran To: skiboot@lists.ozlabs.org Date: Fri, 18 Nov 2016 16:01:48 +1100 Message-Id: <1479445312-12382-11-git-send-email-oohall@gmail.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1479445312-12382-1-git-send-email-oohall@gmail.com> References: <1479445312-12382-1-git-send-email-oohall@gmail.com> Subject: [Skiboot] [PATCH 10/14] console: define a opal_con_ops each driver X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Define the structures for each driver required to use the new opal_con_ops interface. Signed-off-by: Oliver O'Halloran --- core/console.c | 9 +++++++++ hw/fsp/fsp-console.c | 15 +++++++++++++++ hw/lpc-uart.c | 9 +++++++++ include/console.h | 5 +++++ 4 files changed, 38 insertions(+) diff --git a/core/console.c b/core/console.c index 85ca462988ca..dc632151049b 100644 --- a/core/console.c +++ b/core/console.c @@ -462,3 +462,12 @@ void dummy_console_add_nodes(void) opal_add_poller(dummy_console_poll, NULL); } + +struct opal_con_ops dummy_opal_con = { + .name = "Dummy Console", + .init = dummy_console_add_nodes, + .read = dummy_console_read, + .write = dummy_console_write, + .space = dummy_console_write_buffer_space, + .flush = dummy_console_flush, +}; diff --git a/hw/fsp/fsp-console.c b/hw/fsp/fsp-console.c index 8a88f2876aa8..b0fefb6bdd76 100644 --- a/hw/fsp/fsp-console.c +++ b/hw/fsp/fsp-console.c @@ -818,6 +818,21 @@ void fsp_console_init(void) op_display(OP_LOG, OP_MOD_FSPCON, 0x0005); } +static int64_t fsp_console_flush(int64_t terminal __unused) +{ + /* FIXME: There's probably something we can do here... */ + return OPAL_PARAMETER; +} + +struct opal_con_ops fsp_opal_con = { + .name = "FSP OPAL console", + .init = NULL, /* all the required setup is done in fsp_console_init() */ + .read = fsp_console_read, + .write = fsp_console_write, + .space = fsp_console_write_buffer_space, + .flush = fsp_console_flush, +}; + static void flush_all_input(void) { unsigned int i; diff --git a/hw/lpc-uart.c b/hw/lpc-uart.c index cc7f808bb920..4b068b72b2e8 100644 --- a/hw/lpc-uart.c +++ b/hw/lpc-uart.c @@ -462,6 +462,15 @@ void uart_setup_opal_console(void) opal_add_poller(uart_console_poll, NULL); } +struct opal_con_ops uart_opal_con = { + .name = "OPAL UART console", + .init = uart_setup_opal_console, + .read = uart_opal_read, + .write = uart_opal_write, + .space = uart_opal_write_buffer_space, + .flush = uart_opal_flush, +}; + static bool uart_init_hw(unsigned int speed, unsigned int clock) { unsigned int dll = (clock / 16) / speed; diff --git a/include/console.h b/include/console.h index 41be064f27cb..c2e31ce4b665 100644 --- a/include/console.h +++ b/include/console.h @@ -99,4 +99,9 @@ extern void dummy_console_add_nodes(void); struct dt_node *add_opal_console_node(int index, const char *type, uint32_t write_buffer_size); +/* OPAL console drivers */ +extern struct opal_con_ops uart_opal_con; +extern struct opal_con_ops fsp_opal_con; +extern struct opal_con_ops dummy_opal_con; + #endif /* __CONSOLE_H */