From patchwork Thu Sep 7 05:02:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?R290b3UsIFlhc3Vub3JpL+S6lOWztiDlurfmloc=?= X-Patchwork-Id: 9941587 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 DF8D86038C for ; Thu, 7 Sep 2017 05:03:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D83A4283E8 for ; Thu, 7 Sep 2017 05:03:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CD475283F5; Thu, 7 Sep 2017 05:03:59 +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, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6875528401 for ; Thu, 7 Sep 2017 05:03:59 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 7B48721EA35CC; Wed, 6 Sep 2017 22:00:22 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mgwkm04.jp.fujitsu.com (mgwkm04.jp.fujitsu.com [202.219.69.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 0F1F321E97806 for ; Wed, 6 Sep 2017 22:00:20 -0700 (PDT) Received: from kw-mxauth.gw.nic.fujitsu.com (unknown [192.168.231.132]) by mgwkm04.jp.fujitsu.com with smtp id 117a_b8f4_dfaf6bb2_33a6_47c5_81a7_b274da4f98d4; Thu, 07 Sep 2017 14:03:06 +0900 Received: from m3050.s.css.fujitsu.com (msm.b.css.fujitsu.com [10.134.21.208]) by kw-mxauth.gw.nic.fujitsu.com (Postfix) with ESMTP id B4ACFAC0201 for ; Thu, 7 Sep 2017 14:02:44 +0900 (JST) X-SecurityPolicyCheck: OK by SHieldMailChecker v2.5.2 X-SHieldMailCheckerPolicyVersion: FJ-ISEC-20170217-enc X-SHieldMailCheckerMailID: 73127387b53f4ba59fba7545432fcaf7 Date: Thu, 07 Sep 2017 14:02:40 +0900 From: Yasunori Goto To: NVDIMM-ML Subject: [ndctl PATCH v5 1/5] ndctl: Introduce libndctl-nfit.h In-Reply-To: <20170907140049.7F71.E1E9C6FF@jp.fujitsu.com> References: <20170907140049.7F71.E1E9C6FF@jp.fujitsu.com> Message-Id: <20170907140236.7F74.E1E9C6FF@jp.fujitsu.com> MIME-Version: 1.0 X-Mailer: Becky! ver. 2.73 [ja] X-TM-AS-MML: disable X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP This patch introduces libndctl-nfit.h. Since these command can be executed via ND_CMD_CALL, libndctl.h which is shared between ndctl command and kernel does not have to include these defintions. So, libndctl-nfit.h, which is defined for only ndctl, is created instead. --- ndctl/libndctl-nfit.h | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/ndctl/libndctl-nfit.h b/ndctl/libndctl-nfit.h new file mode 100644 index 0000000..8eeeb10 --- /dev/null +++ b/ndctl/libndctl-nfit.h @@ -0,0 +1,76 @@ +/* + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU Lesser General Public License, + * version 2.1, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for + * more details. + */ + +#ifndef __LIBNDCTL_NFIT_H__ +#define __LIBNDCTL_NFIT_H__ + +/* + * libndctl-nfit.h : definitions for NFIT related commands/functions. + */ + +/* nfit command numbers which are called via ND_CMD_CALL */ +enum { + NFIT_CMD_TRANSLATE_SPA = 5, + NFIT_CMD_ARS_INJECT_SET = 7, + NFIT_CMD_ARS_INJECT_CLEAR = 8, + NFIT_CMD_ARS_INJECT_GET = 9, +}; + +/* error number of Translate SPA by firmware */ +#define ND_TRANSLATE_SPA_STATUS_INVALID_SPA 2 + +/* + * The following structures are command packages which are + * defined by ACPI 6.2 (or later). + */ + +/* For Translate SPA */ +struct nd_cmd_translate_spa { + __u64 spa; + __u32 status; + __u8 flags; + __u8 _reserved[3]; + __u64 translate_length; + __u32 num_nvdimms; + struct nd_nvdimm_device { + __u32 nfit_device_handle; + __u32 _reserved; + __u64 dpa; + } __attribute__((packed)) devices[0]; + +} __attribute__((packed)); + +/* For ARS Error Inject */ +struct nd_cmd_ars_err_inj { + __u64 err_inj_spa_range_base; + __u64 err_inj_spa_range_length; + __u8 err_inj_options; + __u32 status; +} __attribute__((packed)); + +/* For ARS Error Inject Clear */ +struct nd_cmd_ars_err_inj_clr { + __u64 err_inj_clr_spa_range_base; + __u64 err_inj_clr_spa_range_length; + __u32 status; +} __attribute__((packed)); + +/* For ARS Error Inject Status Query */ +struct nd_cmd_ars_err_inj_stat { + __u32 status; + __u32 inj_err_rec_count; + struct nd_error_stat_query_record { + __u64 err_inj_stat_spa_range_base; + __u64 err_inj_stat_spa_range_length; + } __attribute__((packed)) record[0]; +} __attribute__((packed)); + +#endif /* __LIBNDCTL_NFIT_H__ */