From patchwork Thu Jul 25 16:59:30 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 18589 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f69.google.com (mail-vb0-f69.google.com [209.85.212.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CCF2925DF6 for ; Thu, 25 Jul 2013 17:00:03 +0000 (UTC) Received: by mail-vb0-f69.google.com with SMTP id e12sf239601vbg.4 for ; Thu, 25 Jul 2013 10:00:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=wHyK95QXPt1s5SLB1GLkGZyOsJbw1gtUOnnssyoELTA=; b=SbEok9oqPPvC98X+/IUFsbnd2qs0jpVl4va/amzWTPHZoO6DvJigBlgxURdZT2xEgF D9XN+pJi0UnCeZgUveVpB1FqjM3lXZZKMrdqaEasIReqLc0cJjuvT+dJBtM3k+ddFlR2 F18o7eVCA84W/UV1Gfh8T80TnvwBrONnM7HYyHb2rQsbPnAPVgXMk0gqLEH4JfjAjsjv 61lBc4p2CBkGjtFVX+5cE7fejhg/eJ/9yxrn5ziXH30eIHIl2pc6S9n5AQ554xvlxnqU IsWGHuKtF6NyyTeu4NHL0ZJWZoZpUOe30sngh4RED7OhtK+IWXA0AlPpDHfDVpol3z6B 3Reg== X-Received: by 10.236.70.105 with SMTP id o69mr4611153yhd.53.1374771603289; Thu, 25 Jul 2013 10:00:03 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.105.136 with SMTP id gm8ls279558qeb.45.gmail; Thu, 25 Jul 2013 10:00:03 -0700 (PDT) X-Received: by 10.220.101.138 with SMTP id c10mr1068021vco.19.1374771603179; Thu, 25 Jul 2013 10:00:03 -0700 (PDT) Received: from mail-ve0-f182.google.com (mail-ve0-f182.google.com [209.85.128.182]) by mx.google.com with ESMTPS id c10si605544vcm.72.2013.07.25.10.00.03 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 25 Jul 2013 10:00:03 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.182 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.182; Received: by mail-ve0-f182.google.com with SMTP id m1so198205ves.13 for ; Thu, 25 Jul 2013 10:00:03 -0700 (PDT) X-Received: by 10.52.77.5 with SMTP id o5mr15242946vdw.46.1374771603088; Thu, 25 Jul 2013 10:00:03 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.165.8 with SMTP id yu8csp87041veb; Thu, 25 Jul 2013 10:00:02 -0700 (PDT) X-Received: by 10.194.238.199 with SMTP id vm7mr30731959wjc.37.1374771602092; Thu, 25 Jul 2013 10:00:02 -0700 (PDT) Received: from mail-wi0-f176.google.com (mail-wi0-f176.google.com [209.85.212.176]) by mx.google.com with ESMTPS id gs7si1997440wib.4.2013.07.25.10.00.01 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 25 Jul 2013 10:00:02 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.176 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=209.85.212.176; Received: by mail-wi0-f176.google.com with SMTP id ey16so5886628wid.9 for ; Thu, 25 Jul 2013 10:00:01 -0700 (PDT) X-Received: by 10.194.133.106 with SMTP id pb10mr31222824wjb.62.1374771601656; Thu, 25 Jul 2013 10:00:01 -0700 (PDT) Received: from belegaer.uk.xensource.com. (firewall.ctxuk.citrix.com. [46.33.159.2]) by mx.google.com with ESMTPSA id nb12sm3150016wic.3.2013.07.25.09.59.59 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 25 Jul 2013 10:00:00 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Cc: ian.campbell@citrix.com, Stefano.Stabellini@eu.citrix.com, patches@linaro.org, Julien Grall , Keir Fraser Subject: [PATCH 4/8] xen/arm: New callback in uart_driver to retrieve serial information Date: Thu, 25 Jul 2013 17:59:30 +0100 Message-Id: <1374771574-7848-5-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1374771574-7848-1-git-send-email-julien.grall@linaro.org> References: <1374771574-7848-1-git-send-email-julien.grall@linaro.org> X-Gm-Message-State: ALoCoQnjyxpNarJbxIaz373YN8uDCD/NcOWJLkz0noXTwtjQyjp8c3iKZ531T9OWsw1p2PRV/f5P X-Original-Sender: julien.grall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.182 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , There is no way to retrieve basic informations (base address, size, ....) for an UART. This callback will be used later to partially emulate the real UART for DOM0 on ARM. Signed-off-by: Julien Grall CC: Keir Fraser --- xen/drivers/char/serial.c | 8 ++++++++ xen/include/xen/serial.h | 13 +++++++++++++ 2 files changed, 21 insertions(+) diff --git a/xen/drivers/char/serial.c b/xen/drivers/char/serial.c index e1c3f47..7640f8e 100644 --- a/xen/drivers/char/serial.c +++ b/xen/drivers/char/serial.c @@ -497,6 +497,14 @@ const struct dt_irq __init *serial_dt_irq(int idx) return NULL; } +const struct serial_info *serial_info(int idx) +{ + if ( (idx >= 0) && (idx < ARRAY_SIZE(com)) && + com[idx].driver && com[idx].driver->info ) + return com[idx].driver->info(&com[idx]); + + return NULL; +} void serial_suspend(void) { diff --git a/xen/include/xen/serial.h b/xen/include/xen/serial.h index 9caf776..c312032 100644 --- a/xen/include/xen/serial.h +++ b/xen/include/xen/serial.h @@ -32,6 +32,14 @@ enum serial_port_state { serial_initialized }; +struct serial_info { + unsigned long base_addr; /* Base address of the UART */ + unsigned long size; /* Size of the memory region */ + unsigned long data_off; /* Data register offset */ + unsigned long status_off; /* Status register offset */ + unsigned long status; /* Ready status value */ +}; + struct serial_port { /* Uart-driver parameters. */ struct uart_driver *driver; @@ -74,6 +82,8 @@ struct uart_driver { int (*irq)(struct serial_port *); /* Get IRQ device node for this port's serial line: returns NULL if none. */ const struct dt_irq *(*dt_irq_get)(struct serial_port *); + /* Get serial information */ + const struct serial_info *(*info)(struct serial_port *); }; /* 'Serial handles' are composed from the following fields. */ @@ -127,6 +137,9 @@ int serial_irq(int idx); /* Return irq device node for specified serial port (identified by index). */ const struct dt_irq *serial_dt_irq(int idx); +/* Retrieve basic UART information (base address, size, ...) */ +const struct serial_info* serial_info(int idx); + /* Serial suspend/resume. */ void serial_suspend(void); void serial_resume(void);