From patchwork Fri Mar 17 04:09:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: somasundaram.a@hpe.com X-Patchwork-Id: 9629767 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 27FCB60132 for ; Fri, 17 Mar 2017 04:10:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0BB4528631 for ; Fri, 17 Mar 2017 04:10:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F0ABA2865B; Fri, 17 Mar 2017 04:10:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9E81128631 for ; Fri, 17 Mar 2017 04:10:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:Message-ID:Date :Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: List-Owner; bh=2PfvIVgoXs9u4A07o+3uWGcgnaesTQGR+GDNYOFS7+Y=; b=X6aikfO9cdjQqu 2iss+4m6pUkewmKi+1KnANpP5eyHkmAwy7lP6euPTz+zC6w5V6U40oSPppGigLdeI/3cJp1XjEzVf em+6coqWR3SZsy124x9X44HyQV9Muk/E8Ozcz6nu9hXK7EJhFkqaF4Ys4trNru2zcJN/OqQOHyS8q T/OGpZqaL3086/MzmCiy3HSCWjbaeAX27FuH+w9JlQ8siHL4u5fttZCTwv+0McKlx8Nzm9o35vGVM nn9LqOrb97iF3UNZ4vj41a/pez5mCP38QtVUbaz1yRERAILJVfZthJTZa76w9i/UVn3pB+gGognFL A211vj9PpvQJ9/T0UAHQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cojDZ-0005P3-TF; Fri, 17 Mar 2017 04:10:21 +0000 Received: from mail-by2nam03on0138.outbound.protection.outlook.com ([104.47.42.138] helo=NAM03-BY2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cojDV-00049z-83 for linux-arm-kernel@lists.infradead.org; Fri, 17 Mar 2017 04:10:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=HPEnterprise.onmicrosoft.com; s=selector1-hpe-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=NP9kMt1rdrSam06Gu02DrPguPzAJSt8HTs3YoWx/SXI=; b=YdcFZmcSYiuWVwQBUqTeOb/Q7CF4xcbrniQ/i0fLzxpzWSp3OeXDJETHBbmqBbfH0rcdtIzrU2NF8S40uOvgUWF0oAnL0h1Svphhvrvtz93V99V8SijHQYmZsYkpuMo9gqH0bP/WetSKNu8UpSvuDqZbKbZz9piMyURsjFT3k+0= Received: from CS1PR84MB0038.NAMPRD84.PROD.OUTLOOK.COM (10.162.189.144) by CS1PR84MB0248.NAMPRD84.PROD.OUTLOOK.COM (10.162.190.158) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.961.17; Fri, 17 Mar 2017 04:09:54 +0000 Received: from CS1PR84MB0038.NAMPRD84.PROD.OUTLOOK.COM ([10.162.189.144]) by CS1PR84MB0038.NAMPRD84.PROD.OUTLOOK.COM ([10.162.189.144]) with mapi id 15.01.0961.022; Fri, 17 Mar 2017 04:09:53 +0000 From: "Arunachalam, Somasundaram" To: "linux-acpi@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" Subject: [PATCH] ACPI:RASF- Adding support for RASF PCC interfaces. Thread-Topic: [PATCH] ACPI:RASF- Adding support for RASF PCC interfaces. Thread-Index: AQHSK546n6HrOcUNa0iS8aGHUXr98aCy5URAgM8G4ACAAA4QgIAXVDjA Date: Fri, 17 Mar 2017 04:09:53 +0000 Message-ID: References: <1477094344-14816-1-git-send-email-somasundaram.a@hpe.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=hpe.com; x-originating-ip: [15.219.195.8] x-microsoft-exchange-diagnostics: 1; CS1PR84MB0248; 7:ccPMEWt6I7RluPYfC+f0/1yOdFE0V6HCfNkwrn5MAD7G+PaZBEXPrBGAkiYqGUL+R9YdQ5NryXgsRHJ8bIa0KSX7PJ1Fahm19pJ6SSz0X9vZKy2vhtbqti9DtP3Yv+R/mT43qrOFMTJC2fgyKwqe6SMbiiWfOPulMCbBhrFdpmngbytmkHXgAUKMws4U4UYF5PHDfWz2anL3zzKmIdZSAbhc+enRYmO4Jfs6OSfdZw72bszDfLDcJCENQWl+KqBonxsrby35OD5NNVLTPFPWjKcbMyE8ptGoKLzwppHjPusMIYFXo9ktH0ToA3B2+RH+42THetBK5RfP5LDi3RzfXQ== x-forefront-antispam-report: SFV:SKI; SCL:-1SFV:NSPM; SFS:(10019020)(6009001)(39450400003)(39860400002)(39410400002)(39840400002)(39850400002)(43784003)(13464003)(377454003)(252514010)(2501003)(86362001)(575784001)(7696004)(5660300001)(2900100001)(305945005)(74316002)(7736002)(33656002)(55016002)(54906002)(9686003)(66066001)(6506006)(122556002)(189998001)(3280700002)(3660700001)(2906002)(53936002)(38730400002)(50986999)(76176999)(54356999)(8936002)(6436002)(81166006)(8676002)(6116002)(3846002)(4326008)(102836003)(77096006)(53546008)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:CS1PR84MB0248; H:CS1PR84MB0038.NAMPRD84.PROD.OUTLOOK.COM; FPR:; SPF:None; MLV:sfv; LANG:en; x-ms-office365-filtering-correlation-id: 08ec22b8-4274-40e9-e396-08d46ceb76d8 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(48565401081); SRVR:CS1PR84MB0248; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(227479698468861)(9452136761055)(35073007944872)(258649278758335); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026)(6041248)(20161123555025)(20161123564025)(20161123560025)(20161123558025)(20161123562025)(6072148); SRVR:CS1PR84MB0248; BCL:0; PCL:0; RULEID:; SRVR:CS1PR84MB0248; x-forefront-prvs: 0249EFCB0B spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: hpe.com X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Mar 2017 04:09:53.2184 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-Transport-CrossTenantHeadersStamped: CS1PR84MB0248 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170316_211017_406376_450F30CE X-CRM114-Status: GOOD ( 28.46 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Chidambaram, Saravanan \(OSTL\)" , "Sajjan, Vikas C" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Hi, All, Can you pls help review this patch and let me know your valuable comments. I agree that, it is somewhat big. But I have splited in to logically coherent functional pieces, and this is first of them. Pls refer to ACPI 5.1 (or) above, RASF Table (section 5.2.20), for the concept implemented. I have tested with by enabling this on Linux, and tested on QEMU-ARM. It is stable. Thanks again in advance for your help. With Best Regards, Somasundaram. -----Original Message----- From: A, Somasundaram Sent: Saturday, October 22, 2016 5:29 AM To: linux-acpi@vger.kernel.org; linux-arm-kernel@lists.infradead.org Cc: Sajjan, Vikas C ; A, Somasundaram Subject: [PATCH] ACPI:RASF- Adding support for RASF PCC interfaces. From: A Somasundaram These files contains pcc interfaces for rasf table, and basic rasf init, as per ACPI 5.1 & upwards revision. section 5.2.20, chapter 14 Platform communication channel are references for this implementation. This module uses pcc interfaces to talk to ACPI HW. This version has PCC interfaces ready. The functions to send RASF commands to be used by OSPM is planned for future revision of the file(rasf_acpi.c). Signed-off-by:somasundaram.a@hpe.com --- drivers/acpi/Kconfig | 15 ++ drivers/acpi/Makefile | 1 + drivers/acpi/processor_driver.c | 6 +- drivers/acpi/rasf_acpi.c | 330 ++++++++++++++++++++++++++++++++++++++++ include/acpi/rasf_acpi.h | 58 +++++++ 5 files changed, 409 insertions(+), 1 deletion(-) create mode 100644 drivers/acpi/rasf_acpi.c create mode 100644 include/acpi/rasf_acpi.h -- 1.9.1 diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 445ce28..3a1b24fd 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig @@ -238,6 +238,21 @@ config ACPI_CPPC_LIB If your platform does not support CPPC in firmware, leave this option disabled. +config ACPI_RASF_LIB + bool + depends on ACPI_PROCESSOR + select MAILBOX + select PCC + default y + help + The files corresponding to this option implements pcc interfaces + (platform communication channel) to talk to RASF(RAS Feature table) + in the ACPI Complaint hardware platform. The first revision(current one) + contains basic init of RASF(extraction of RASF Table, from OS system table) + and, pcc interfaces. + Subsequent revision will contain OSPM interfaces to send RASF + Memory patrol scrub commands to the ACPI hardware. + config ACPI_PROCESSOR tristate "Processor" depends on X86 || IA64 || ARM64 diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index 5ae9d85..0bbf0d8 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile @@ -81,6 +81,7 @@ obj-$(CONFIG_ACPI_EC_DEBUGFS) += ec_sys.o obj-$(CONFIG_ACPI_CUSTOM_METHOD)+= custom_method.o obj-$(CONFIG_ACPI_BGRT) += bgrt.o obj-$(CONFIG_ACPI_CPPC_LIB) += cppc_acpi.o +obj-$(CONFIG_ACPI_RASF_LIB) += rasf_acpi.o obj-$(CONFIG_ACPI_DEBUGGER_USER) += acpi_dbg.o # processor has its own "processor." module_param namespace diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c index 0553aee..c7aea1a 100644 --- a/drivers/acpi/processor_driver.c +++ b/drivers/acpi/processor_driver.c @@ -32,7 +32,7 @@ #include #include #include - +#include #include #include "internal.h" @@ -66,6 +66,8 @@ static struct device_driver acpi_processor_driver = { .remove = acpi_processor_stop, }; +extern RASF_STATUS rasf_acpi_init(void ); + static void acpi_processor_notify(acpi_handle handle, u32 event, void *data) { struct acpi_device *device = data; @@ -257,6 +259,8 @@ static int __acpi_processor_start(struct acpi_device *device) status = acpi_install_notify_handler(device->handle, ACPI_DEVICE_NOTIFY, acpi_processor_notify, device); + rasf_acpi_init(); + pr_info("rasf init called \n"); if (ACPI_SUCCESS(status)) return 0; diff --git a/drivers/acpi/rasf_acpi.c b/drivers/acpi/rasf_acpi.c new file mode 100644 index 0000000..1d378cf --- /dev/null +++ b/drivers/acpi/rasf_acpi.c @@ -0,0 +1,330 @@ +/* + * (C) Copyright 2014, 2015 Hewlett-Packard Enterprises. + * A.Somasundaram, email: somasundaram.a@hpe.com + * This file contains + * RASF - ACPI 6.1 Specification, section 5.2.20 + * PCC(Platform Communications Channel) - ACPI 6.1 Specification , +chapter 14 + * This file contains PCC(Platform communication channel) interfaces, +and basic RASF Init, which extracts the RASF table and + * Registers the PCC channel for communicating with the ACPI compliant +platform that contains RASF command support in hardware + * + *Next revision of this file will contain functions for sending RASF +commands for memory patrol scrubbing. This version contains + * core framework of PCC communication and RASF Init. + * + */ + +#define pr_fmt(fmt) "ACPI RASF: " fmt +#include +#include +#include +#include +#include + +#ifdef NEXT_REV +/* + * Lock to provide mutually exclusive access to pcc channel, this is for next version. + * when functions for RASF command send/recv are implemented. + */ +static DEFINE_SPINLOCK(rasf_lock); +#endif + + +/* Data structure for pcc communication and rasf table */ + +static struct mbox_chan *pcc_channel; +static void __iomem *pcc_comm_addr; +static u64 comm_base_addr; +static int pcc_subspace_idx = -1; +static bool pcc_channel_acquired; +static ktime_t deadline; +static unsigned int pcc_mpar, pcc_mrtt; static struct acpi_table_rasf +*pRasfTable = NULL; RASF_STATUS rasf_acpi_init(void ); + +#ifdef NEXT_REV +/* pcc mapped address + header size + offset within PCC subspace + * This will be useful in next revision, when functions for RASF Command send/recv are implemented. + */ +#define RASF_VADDR(offs) (pcc_comm_addr + 0x8 + (offs)) #endif + +/* + * Arbitrary Retries for pcc commands. + */ +#define NUM_RETRIES 600 + +/* + *This function checks the pcc channel availability + * + * + */ +static int rasf_check_pcc_chan(void) +{ + int ret = -EIO; + + struct acpi_rasf_shared_memory __iomem *generic_comm_base = pcc_comm_addr; + ktime_t next_deadline = ktime_add(ktime_get(), deadline); + + while (!ktime_after(ktime_get(), next_deadline)) { + /* + * As per ACPI spec, the PCC space wil be initialized by + * platform and should have set the command completion bit when + * PCC can be used by OSPM + */ + if (readw_relaxed(&generic_comm_base->status) & RASF_PCC_CMD_COMPLETE) { + ret = 0; + break; + } + /* + * Reducing the bus traffic in case this loop takes longer than + * a few retries. + */ + udelay(3); + } + + return ret; +} + +static int rasf_send_pcc_cmd(u16 cmd) +{ + int ret = -EIO; + + struct acpi_rasf_shared_memory *generic_comm_base = + (struct acpi_rasf_shared_memory *) pcc_comm_addr; + static ktime_t last_cmd_cmpl_time, last_mpar_reset; + static int mpar_count; + unsigned int time_delta; + + /* + * For CMD_WRITE we know for a fact the caller should have checked + * the channel before writing to PCC space + */ + if (cmd == RASF_CMD_READ) { + ret = rasf_check_pcc_chan(); + if (ret) + return ret; + } + + /* + * Handle the Minimum Request Turnaround Time(MRTT) + * "The minimum amount of time that OSPM must wait after the completion + * of a command before issuing the next command, in microseconds" + */ + if (pcc_mrtt) { + time_delta = ktime_us_delta(ktime_get(), last_cmd_cmpl_time); + if (pcc_mrtt > time_delta) + udelay(pcc_mrtt - time_delta); + } + + /* + * Handle the non-zero Maximum Periodic Access Rate(MPAR) + * "The maximum number of periodic requests that the subspace channel can + * support, reported in commands per minute. 0 indicates no limitation." + * + * This parameter should be ideally zero or large enough so that it can + * handle maximum number of requests that all the cores in the system can + * collectively generate. If it is not, we will follow the spec and just + * not send the request to the platform after hitting the MPAR limit in + * any 60s window + */ + if (pcc_mpar) { + if (mpar_count == 0) { + time_delta = ktime_ms_delta(ktime_get(), last_mpar_reset); + if (time_delta < 60 * MSEC_PER_SEC) { + pr_debug("PCC cmd not sent due to MPAR limit"); + return -EIO; + } + last_mpar_reset = ktime_get(); + mpar_count = pcc_mpar; + } + mpar_count--; + } + + /* Write to the shared comm region. */ + writew_relaxed(cmd, &generic_comm_base->command); + + /* Flip CMD COMPLETE bit */ + writew_relaxed(0, &generic_comm_base->status); + + /* Ring doorbell */ + ret = mbox_send_message(pcc_channel, &cmd); + if (ret < 0) { + pr_err("Err sending PCC mbox message. cmd:%d, ret:%d\n", + cmd, ret); + return ret; + } + + /* + * For READs we need to ensure the cmd completed to ensure + * the ensuing read()s can proceed. For WRITEs we dont care + * because the actual write()s are done before coming here + * and the next READ or WRITE will check if the channel + * is busy/free at the entry of this call. + * + * If Minimum Request Turnaround Time is non-zero, we need + * to record the completion time of both READ and WRITE + * command for proper handling of MRTT, so we need to check + * for pcc_mrtt in addition to CMD_READ + */ + if (cmd == RASF_CMD_READ || pcc_mrtt) { + ret = rasf_check_pcc_chan(); + if (pcc_mrtt) + last_cmd_cmpl_time = ktime_get(); + } + + mbox_client_txdone(pcc_channel, ret); + return ret; +} + +static void rasf_chan_tx_done(struct mbox_client *cl, void *msg, int +ret) { + if (ret < 0) + pr_debug("TX did not complete: CMD sent:%x, ret:%d\n", + *(u16 *)msg, ret); + else + pr_debug("TX completed. CMD sent:%x, ret:%d\n", + *(u16 *)msg, ret); +} + +struct mbox_client rasf_mbox_cl = { + .tx_done = rasf_chan_tx_done, + .knows_txdone = true, +}; + + + +static int rasf_register_pcc_channel(int pcc_subspace_idx) { + struct acpi_pcct_hw_reduced *rasf_ss; + unsigned int len; + u64 usecs_lat; + + if (pcc_subspace_idx >= 0) { + pcc_channel = pcc_mbox_request_channel(&rasf_mbox_cl, + pcc_subspace_idx); + + if (IS_ERR(pcc_channel)) { + pr_err("Failed to find PCC communication channel\n"); + return -ENODEV; + } + + /* + * The PCC mailbox controller driver should + * have parsed the PCCT (global table of all + * PCC channels) and stored pointers to the + * subspace communication region in con_priv. + */ + rasf_ss = pcc_channel->con_priv; + + if (!rasf_ss) { + pr_err("No PCC subspace found for CPPC\n"); + return -ENODEV; + } + + /* + * This is the shared communication region + * for the OS and Platform to communicate over. + */ + comm_base_addr = rasf_ss->base_address; + len = rasf_ss->length; + + /* + * rasf_ss->latency is just a Nominal value. In reality + * the remote processor could be much slower to reply. + * So add an arbitrary amount of wait on top of Nominal. + */ + usecs_lat = NUM_RETRIES * rasf_ss->latency; + deadline = ns_to_ktime(usecs_lat * NSEC_PER_USEC); + pcc_mrtt = rasf_ss->min_turnaround_time; + pcc_mpar = rasf_ss->max_access_rate; + + pcc_comm_addr = acpi_os_ioremap(comm_base_addr, len); + if (!pcc_comm_addr) { + pr_err("Failed to ioremap PCC comm region mem\n"); + return -ENOMEM; + } + + /* Set flag so that we dont come here for each CPU. */ + pcc_channel_acquired = true; + } + + return 0; +} + +#ifdef NEXT_REV + +/* The next revision of this file will contain the implementation of +the following functions + * + *These functions are used for processing/sending RASF Commands. + * + */ +/* + * The below functions are exposed to OSPM, to query and, initiate memory range patrol. + * + * + */ +bool DoPatrolScrub(....) +{ +} + +bool IsPatrolScrubExposedtoSw(...) +{ +/* send command, for read */ + +} + +bool GetPatrolParams(...) +{ +} + +bool SetPatrolParams(...) +{ +/* start patrol + stop patrol +*/ +} +#endif + +RASF_STATUS rasf_acpi_init(void ) +{ + struct acpi_table_header *pAcpiTable = NULL; + acpi_size irasf_size = 0; + acpi_status status = AE_OK; + + + status = acpi_get_table_with_size("RASF", 0, &pAcpiTable, + &irasf_size); + + if (ACPI_FAILURE(status)) + { + + pr_err("rasf driver failed to initialize, get table failed\n"); + + pr_info("RASF Init failed \n"); + return(RASF_FAILURE); + } + + pRasfTable = kmalloc(sizeof(struct acpi_table_header), GFP_KERNEL); + + + if(NULL == pRasfTable) + { + pr_err("ptr to RasfTable, kmalloc failed \n"); + + pr_info("RASF Init failed \n"); + /* error debug print */ + return(RASF_FAILURE); + } + memcpy(pRasfTable, pAcpiTable, irasf_size); + +/* extract the pcc subspace channel id from the table */ + pRasfTable = (struct acpi_table_rasf *)pAcpiTable; + memcpy(&pcc_subspace_idx, &pRasfTable->channel_id,12); + rasf_register_pcc_channel(pcc_subspace_idx); + pr_info("RASF Init Success \n"); + return(RASF_SUCCESS); + + +} +EXPORT_SYMBOL_GPL(rasf_acpi_init); + + + diff --git a/include/acpi/rasf_acpi.h b/include/acpi/rasf_acpi.h new file mode 100644 index 0000000..2f28ad3 --- /dev/null +++ b/include/acpi/rasf_acpi.h @@ -0,0 +1,58 @@ +/* + * RASF(feature for patrol scrubbing of memory ranges , if exposed to +software) + * RASF Diagnostic driver header file + * + * (C) Copyright 2014, 2015 Hewlett-Packard Enterprises + * Author: A.Somasundaram (somasundaram.a@hpe.com) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; version 2 + * of the License. + */ + +#ifndef _RASF_ACPI_H +#define _RASF_ACPI_H + +#include +#include +#include +#include + +typedef int RASF_STATUS; + +#define RASF_NUM_ENT 21 +#define RASF_REV 2 + +#define RASF_PCC_CMD_COMPLETE 1 + +/* CPPC specific PCC commands. */ +#define RASF_CMD_READ 0 +#define RASF_CMD_WRITE 1 + +#define RASF_FAILURE 0 +#define RASF_SUCCESS 1 + +/* Each register has the folowing format. */ struct rasf_reg { + u8 descriptor; + u16 length; + u8 space_id; + u8 bit_width; + u8 bit_offset; + u8 access_width; + u64 __iomem address; +} __packed; + +struct rasf_register_resource { + acpi_object_type type; + union { + struct rasf_reg reg; + u64 int_value; + } rasf_entry; +}; +/* Methods to interact with the PCC mailbox controller. */ extern +struct mbox_chan * + pcc_mbox_request_channel(struct mbox_client *, unsigned int); + +#endif /* _CPPC_ACPI_H*/