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: 34201 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f198.google.com (mail-vc0-f198.google.com [209.85.220.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A4EE920C7F for ; Thu, 24 Jul 2014 13:00:24 +0000 (UTC) Received: by mail-vc0-f198.google.com with SMTP id hu12sf8087213vcb.5 for ; Thu, 24 Jul 2014 06:00:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=YVRE6bRY7byeqJRQrS5tT+uF/5PgKg6eP26qJSVB7Ko=; b=XqWftJ7tIxMFihERZUuLO5XsNxK7JfxK+rRHwVieWid61GZc7VEMTZkPsYxcSFI/Nv 3g0KQNAyGJgJkxYw7yDkBdJUkeU6a43tlWzXcich/bgqa4/dwtPIshxJh8/lBUJg0A1F oRyitN7gfDsv9RoIwG3iZGuEkNrUL442glNnUw6sNIvleT96PctaRKqHS2n+fI9q2oO6 jKArxPVaRfZ+lBDfLWU4PzWikuR5hTJ2XQvmQDUJYKYtPktJTzNM7xLsf3Svv5xU5hjc l5pepUAqpaGkKlwJyEoD6TTFAghg7XpBEZMIg+id2E2G4JazkkRJj6W4cNqixZvzXxqx JlVA== X-Gm-Message-State: ALoCoQnqMFvSsjCY9S3cY9GNSlGD0KJsze5nCiwix+xndh2Kt78QLff1ZImRuHKYLzpx+eKFxfxl X-Received: by 10.52.137.69 with SMTP id qg5mr3643870vdb.5.1406206824061; Thu, 24 Jul 2014 06:00:24 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.38.51 with SMTP id s48ls776458qgs.64.gmail; Thu, 24 Jul 2014 06:00:23 -0700 (PDT) X-Received: by 10.221.66.67 with SMTP id xp3mr12019401vcb.44.1406206823805; Thu, 24 Jul 2014 06:00:23 -0700 (PDT) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id mb10si4873856vcb.59.2014.07.24.06.00.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 24 Jul 2014 06:00:23 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.180 as permitted sender) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id ij19so4757294vcb.39 for ; Thu, 24 Jul 2014 06:00:23 -0700 (PDT) X-Received: by 10.220.15.8 with SMTP id i8mr11818980vca.45.1406206823722; Thu, 24 Jul 2014 06:00:23 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp362713vcb; Thu, 24 Jul 2014 06:00:23 -0700 (PDT) X-Received: by 10.70.37.198 with SMTP id a6mr7159098pdk.75.1406206822679; Thu, 24 Jul 2014 06:00:22 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bv5si2965847pdb.330.2014.07.24.06.00.21 for ; Thu, 24 Jul 2014 06:00:22 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758944AbaGXNAT (ORCPT + 13 others); Thu, 24 Jul 2014 09:00:19 -0400 Received: from mail-pa0-f53.google.com ([209.85.220.53]:45517 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758922AbaGXNAM (ORCPT ); Thu, 24 Jul 2014 09:00:12 -0400 Received: by mail-pa0-f53.google.com with SMTP id kq14so3888134pab.12 for ; Thu, 24 Jul 2014 06:00:11 -0700 (PDT) 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 Cc: Graeme Gregory , Arnd Bergmann , Grant Likely , Sudeep Holla , Will Deacon , Jason Cooper , Marc Zyngier , Bjorn Helgaas , Daniel Lezcano , Mark Brown , Robert Richter , Lv Zheng , Robert Moore , Lorenzo Pieralisi , Liviu Dudau , Randy Dunlap , Charles.Garcia-Tobin@arm.com, linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linaro-acpi-private@linaro.org, Hanjun Guo 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: hanjun.guo@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.180 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 /******************************************************************************* *