From patchwork Wed Jul 31 15:38:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 18713 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f197.google.com (mail-qc0-f197.google.com [209.85.216.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 061B4246CC for ; Wed, 31 Jul 2013 15:38:45 +0000 (UTC) Received: by mail-qc0-f197.google.com with SMTP id s1sf880342qcw.8 for ; Wed, 31 Jul 2013 08:38:44 -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-removed-original-auth :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=ssgTgIscV2D5eVxTB1IXNfUMIwUpAf/p567UMEKy1EM=; b=OyA5OzXsFvmCncmMUi8rGHBS7E+88ydAP1IzNuLyg4Lo0yzAiqHK3AkMYTs/STKdOu SRI86187rp95ycgW8dzw3j92K7RG9NRlfDcn40xFJF6c6KQag0Io8aXMq7piu2zUb9ma 2LEgBAuHLoc0dFtj8ILByWsEVgP+4qRjqY9X5YGBBUoFGzvTT8tgjj/DIQsIepUgs1Pq AwW+h2zSKHoywQm9orzzQbV8pkyjWW3jyAhp9vyHTfQ3Pzi1ygr0GUr+T2mRKcyApIIp QJAMipDWMq7gdRXgcPEidSeHnppxA+uhkRgqnNxmm1/9rz+9kBK6UaWz4xUCep98/R1A FS0w== X-Received: by 10.236.150.82 with SMTP id y58mr35363528yhj.5.1375285124699; Wed, 31 Jul 2013 08:38:44 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.47.110 with SMTP id c14ls702706qen.71.gmail; Wed, 31 Jul 2013 08:38:44 -0700 (PDT) X-Received: by 10.58.75.41 with SMTP id z9mr29607404vev.4.1375285124594; Wed, 31 Jul 2013 08:38:44 -0700 (PDT) Received: from mail-ve0-f169.google.com (mail-ve0-f169.google.com [209.85.128.169]) by mx.google.com with ESMTPS id to9si410069vdc.149.2013.07.31.08.38.44 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 31 Jul 2013 08:38:44 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.169 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.169; Received: by mail-ve0-f169.google.com with SMTP id db10so952376veb.14 for ; Wed, 31 Jul 2013 08:38:44 -0700 (PDT) X-Received: by 10.58.6.210 with SMTP id d18mr28302860vea.96.1375285124453; Wed, 31 Jul 2013 08:38:44 -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.221.11.8 with SMTP id pc8csp243367vcb; Wed, 31 Jul 2013 08:38:43 -0700 (PDT) X-Received: by 10.180.12.80 with SMTP id w16mr4655089wib.47.1375285123342; Wed, 31 Jul 2013 08:38:43 -0700 (PDT) Received: from mail-we0-f175.google.com (mail-we0-f175.google.com [74.125.82.175]) by mx.google.com with ESMTPS id pj8si1072346wjb.73.2013.07.31.08.38.43 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 31 Jul 2013 08:38:43 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.82.175 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=74.125.82.175; Received: by mail-we0-f175.google.com with SMTP id q58so737772wes.6 for ; Wed, 31 Jul 2013 08:38:42 -0700 (PDT) X-Received: by 10.194.119.228 with SMTP id kx4mr49562871wjb.33.1375285122806; Wed, 31 Jul 2013 08:38:42 -0700 (PDT) Received: from belegaer.uk.xensource.com. (firewall.ctxuk.citrix.com. [46.33.159.2]) by mx.google.com with ESMTPSA id u9sm3135483wif.6.2013.07.31.08.38.40 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 31 Jul 2013 08:38:41 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org, ian.campbell@citrix.com Cc: stefano.stabellini@eu.citrix.com, patches@linaro.org, Julien Grall , Keir Fraser Subject: [PATCH v2 4/8] xen/arm: New callback in uart_driver to retrieve serial information Date: Wed, 31 Jul 2013 16:38:24 +0100 Message-Id: <1375285109-3053-5-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1375285109-3053-1-git-send-email-julien.grall@linaro.org> References: <1375285109-3053-1-git-send-email-julien.grall@linaro.org> X-Gm-Message-State: ALoCoQlzUrccjRemfAD6JSBF2Jnek30OKOMt3K1j25HR7+5ygSJdhfYPnhb5Avm0Uet2rSO7zucE X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: julien.grall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.169 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 --- Changes in v2: - Rename the callback to vuart_info --- 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..cd0b864 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 vuart_info *serial_vuart_info(int idx) +{ + if ( (idx >= 0) && (idx < ARRAY_SIZE(com)) && + com[idx].driver && com[idx].driver->vuart_info ) + return com[idx].driver->vuart_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..7d48163 100644 --- a/xen/include/xen/serial.h +++ b/xen/include/xen/serial.h @@ -32,6 +32,14 @@ enum serial_port_state { serial_initialized }; +struct vuart_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 vuart_info *(*vuart_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 to emulate it (base address, size...) */ +const struct vuart_info* serial_vuart_info(int idx); + /* Serial suspend/resume. */ void serial_suspend(void); void serial_resume(void);