From patchwork Thu Jul 24 12:59:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanjun Guo X-Patchwork-Id: 4617711 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 325159F295 for ; Thu, 24 Jul 2014 13:03:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 04F63201F4 for ; Thu, 24 Jul 2014 13:03:32 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D02D0201DD for ; Thu, 24 Jul 2014 13:03:30 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XAIdU-00075a-Sq; Thu, 24 Jul 2014 13:00:40 +0000 Received: from mail-pd0-f177.google.com ([209.85.192.177]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XAIdP-0006sd-5j for linux-arm-kernel@lists.infradead.org; Thu, 24 Jul 2014 13:00:38 +0000 Received: by mail-pd0-f177.google.com with SMTP id p10so3619637pdj.22 for ; Thu, 24 Jul 2014 06:00:14 -0700 (PDT) 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=Tg9thPikm7CFOOi07FSY+tbdmUCZQWTVj3FxOTkMUhc=; b=I5R9IdTvkAmpNCieC9SkshjZfmmH0WdYBy7Wmg+skuKyAii1C0jTzYXImhSIbS2BB5 WCXvlOF1ZoPZTs9rqNZUvLmFgMelyYGS2ivwLVGs9meolNYRkAaaJYo+tGovjLeO+vpb HhwPWOv7yqJkcYIgG9AKp8/Ba1CzioGZqEVESOchRapeA1pKRHrnggjSJtzKN1GVMN4b 1TrZi1aU9lk4XhIDDByawvMRXdkVf2yFS2RrFY0D/B3GWBLikLPuATf78w0jNj7hTeYb lcpxCg/mtNlXXOc+6XfyAvDbdaVL3X67QC/Or1ahQVQxp1YlUJ/9wh5cwS1ydeXi6uGG Zy+w== X-Gm-Message-State: ALoCoQlISOeWshZYHUE/R1MrHNIZgQuHhvZyEeYiD5yX77K8yxB9fsmUbgwmoPX56N6D2OzbYruE X-Received: by 10.66.180.34 with SMTP id dl2mr10110329pac.124.1406206811684; Thu, 24 Jul 2014 06:00:11 -0700 (PDT) Received: from localhost ([183.247.163.231]) by mx.google.com with ESMTPSA id ey10sm7359302pdb.50.2014.07.24.06.00.05 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 24 Jul 2014 06:00:10 -0700 (PDT) From: Hanjun Guo To: Catalin Marinas , "Rafael J. Wysocki" , Mark Rutland Subject: [PATCH 3/3] ACPI / ACPICA: Add GTDT support updated by ACPI 5.1 Date: Thu, 24 Jul 2014 20:59:17 +0800 Message-Id: <1406206757-15512-4-git-send-email-hanjun.guo@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1406206757-15512-1-git-send-email-hanjun.guo@linaro.org> References: <1406206757-15512-1-git-send-email-hanjun.guo@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140724_060035_233689_BD92B75C X-CRM114-Status: GOOD ( 13.85 ) X-Spam-Score: -0.7 (/) Cc: Mark Brown , Liviu Dudau , Lv Zheng , Lorenzo Pieralisi , Daniel Lezcano , Robert Moore , linux-acpi@vger.kernel.org, Grant Likely , Charles.Garcia-Tobin@arm.com, Robert Richter , Jason Cooper , Arnd Bergmann , Marc Zyngier , Will Deacon , linaro-acpi-private@linaro.org, Bjorn Helgaas , linux-arm-kernel@lists.infradead.org, Graeme Gregory , Randy Dunlap , linux-kernel@vger.kernel.org, Hanjun Guo , Sudeep Holla X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP With ACPI 5.0, we got per-processor timer support in GTDT, and ACPI 5.1 introduced the support for platform (memory-mapped) timers: GT Block and SBSA watchdog timer, add the code needed for the spec change. Signed-off-by: Hanjun Guo --- include/acpi/actbl3.h | 99 ++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 85 insertions(+), 14 deletions(-) diff --git a/include/acpi/actbl3.h b/include/acpi/actbl3.h index c2295cc..96c60cd 100644 --- a/include/acpi/actbl3.h +++ b/include/acpi/actbl3.h @@ -241,33 +241,104 @@ struct acpi_s3pt_suspend { /******************************************************************************* * - * GTDT - Generic Timer Description Table (ACPI 5.0) - * Version 1 + * GTDT - Generic Timer Description Table (ACPI 5.1) + * Version 2 * ******************************************************************************/ struct acpi_table_gtdt { struct acpi_table_header header; /* Common ACPI table header */ - u64 address; - u32 flags; - u32 secure_pl1_interrupt; - u32 secure_pl1_flags; - u32 non_secure_pl1_interrupt; - u32 non_secure_pl1_flags; + u64 cnt_control_base_address; + u32 reserved; + u32 secure_el1_interrupt; + u32 secure_el1_flags; + u32 non_secure_el1_interrupt; + u32 non_secure_el1_flags; u32 virtual_timer_interrupt; u32 virtual_timer_flags; - u32 non_secure_pl2_interrupt; - u32 non_secure_pl2_flags; + u32 non_secure_el2_interrupt; + u32 non_secure_el2_flags; + u64 cnt_read_base_address; + u32 platform_timer_count; + u32 platform_timer_offset; }; -/* Values for Flags field above */ - -#define ACPI_GTDT_MAPPED_BLOCK_PRESENT 1 - /* Values for all "TimerFlags" fields above */ #define ACPI_GTDT_INTERRUPT_MODE 1 #define ACPI_GTDT_INTERRUPT_POLARITY 2 +#define ACPI_GTDT_ALWAYS_ON 4 + +/* + * GTDT Subtable header + */ +struct acpi_gtdt_header { + u8 type; + u16 length; +}; + +/* Values for GTDT subtable type for GTDT subtables above */ + +enum acpi_gtdt_type { + ACPI_GTDT_TYPE_GT_BLOCK = 0, /* memory-mapped generic timer */ + ACPI_GTDT_TYPE_SBSA_GENERIC_WATCHDOG = 1, + ACPI_GTDT_TYPE_RESERVED = 2 /* 2 and greater are reserved */ +}; + +/* + * GTDT Subtables, correspond to Type in struct acpi_gtdt_header + */ + +/* 0: Generic Timer Block */ + +struct acpi_gtdt_gt_block { + struct acpi_gtdt_header header; + u8 reserved; + u64 gt_block_address; + u32 gt_block_timer_count; /* must be less than or equal to 8 */ + u32 gt_block_timer_offset; +}; + +/* GT Block Timer Structure */ + +struct acpi_gt_block_timer { + u8 gt_frame_number; + u8 reseved[3]; + u64 cnt_base_address; + u64 cnt_el0_base_adress; + u32 physical_timer_interrupt; + u32 physical_timer_flags; + u32 vitual_timer_interrupt; + u32 vitual_timer_flags; + u32 timer_common_flags; +}; + +/* Flag Definitions: GT Block Physical Timers and Virtual timers */ + +#define ACPI_GT_BLOCK_INTERRUPT_MODE 1 +#define ACPI_GT_BLOCK_INTERRUPT_POLARITY 2 + +/* Flag Definitions: Common Flags */ + +#define ACPI_GT_BLOCK_IS_SECURE_TIMER 1 +#define ACPI_GT_BLOCK_ALWAYS_ON 2 + +/* 1: SBSA Generic Watchdog Structure */ + +struct acpi_sbsa_generic_watchdog { + struct acpi_gtdt_header header; + u8 reserved; + u64 refresh_frame_address; + u64 control_frame_address; + u32 interrupt; + u32 flags; +}; + +/* Flag Definitions: SBSA Generic Watchdog */ + +#define ACPI_SBSA_WATCHDOG_INTERRUPT_MODE 1 +#define ACPI_SBSA_WATCHDOG_INTERRUPT_POLARITY 2 +#define ACPI_SBSA_WATCHDOG_IS_SECURE_TIMER 4 /******************************************************************************* *