From patchwork Fri Dec 9 01:23:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Matthew Gerlach X-Patchwork-Id: 31569 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp519111wrr; Thu, 8 Dec 2022 17:25:31 -0800 (PST) X-Google-Smtp-Source: AA0mqf4WRJx2YiNbmkHjmWkbi4svC2hSq2Z60x4UutNs1wJ09sEaRsRycTax9KI9XSJqxQGpEGtt X-Received: by 2002:a05:6a20:7f9b:b0:aa:23cb:a1a6 with SMTP id d27-20020a056a207f9b00b000aa23cba1a6mr7368274pzj.0.1670549131460; Thu, 08 Dec 2022 17:25:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670549131; cv=none; d=google.com; s=arc-20160816; b=S3dZQiFTrg66mrfo9OeG14gHTN7DqbbK2n3yj5WhLI4B3t+Mr6quglRJ7Y/uwVrqhu TmKWLcc49+KfPNtlIdjELPoXmMZshluxasP7irXGVhZbiMHVL6VT9Ta2Myt91NYzpWvi fMhNxYm3iL5pIqBIVc2TPiYOvrMbfLwWG/CUNdAZRsEtOP+qh6rPQkwdH2ztYFt1GHj9 fgLadgDLhqP5XUcWC/j/4HJTUGq7ACza4NOLE+F2E3fn2ho9apJ22CeqDdM6UmPEH/yB CIVMCqUsTxKteJNyOOJVe8FSjYWilU31JQyDxe0v34jpvf/nbWM0SA/lRyC+mTQ6laMO TEZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=wn5YsikU9XfSvOyszrA6XS6LXvsYjgWyoNiyaQAO1Xc=; b=Hncxj0zwIKdWXDpba6f6YpT4RelrezQm+WnmrnnwU0+/iJD7aBbwAv9XFybHmbUdI5 nQw4avWFW5Jiqcxj7mVP42Vpp3o0SGSYhkLvY5PiUxrRZutGPZU4EKqsn537uUa7c8wB pZSk1kLeyRzgdkwrajp3bAoHheC/FD1tAN1j2gS5A1eJapcobIsN4eo/HsjtCbpGupBU d2AbOgEjfO0bh4OPtbRNODBhkqLxtGEX/g5GKjWElaPrzr6TvRTk5eIyOpJ81vj6ohVG pjbcLFlT3UEyvZzlMKSkBece3VAfBx9PdDy7pwaACyxu7IT/NuuENsI6mMGyHr4oq8gB 7D7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ZIpH0NEE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bn23-20020a056a00325700b005771c7ccd95si373507pfb.53.2022.12.08.17.25.18; Thu, 08 Dec 2022 17:25:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ZIpH0NEE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229784AbiLIBXn (ORCPT + 99 others); Thu, 8 Dec 2022 20:23:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229637AbiLIBXb (ORCPT ); Thu, 8 Dec 2022 20:23:31 -0500 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77A217F89E; Thu, 8 Dec 2022 17:23:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1670549010; x=1702085010; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5+q4pL34Y1ZUiyioshkMnCpS0/DigWgD/VLd162QMw8=; b=ZIpH0NEE71VsGlMY2l7OlUrhSlIT0E6AFZRY8OFTKuVzX+kBx2k1P9za XjWtEJDOk3K1QiPaJlJanhgi+mmRbBRVHfto0uKMube5tWZKotWzOJ3d+ 3ooaJ7qsJ20/zqOAy6Us14SNVdcg2gUiTXBbzWkmIuPGTdwCHk5RbnOUs yNds/+6DtjBK7ZhRz3UQpmkAnE8VRI57o4gb7y1Q+zibjq7yQQgxPj968 LJJbm/8yYTwUpBanXdIzXs8fM+XJ7gtPVZaRYGqgE7vRs4Al5p8We9ra4 XbLOevKg+JB/Esv494zt7py1M4GZoQGi0IBfaZAJ8QpMD2favXMGZPUVe Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10555"; a="318504852" X-IronPort-AV: E=Sophos;i="5.96,228,1665471600"; d="scan'208";a="318504852" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Dec 2022 17:23:29 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10555"; a="715852795" X-IronPort-AV: E=Sophos;i="5.96,228,1665471600"; d="scan'208";a="715852795" Received: from rhweight-wrk1.ra.intel.com ([137.102.106.139]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Dec 2022 17:23:28 -0800 From: matthew.gerlach@linux.intel.com To: hao.wu@intel.com, yilun.xu@intel.com, russell.h.weight@intel.com, basheer.ahmed.muddebihal@intel.com, trix@redhat.com, mdf@kernel.org, linux-fpga@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, tianfei.zhang@intel.com, corbet@lwn.net, gregkh@linuxfoundation.org, linux-serial@vger.kernel.org, jirislaby@kernel.org, geert+renesas@glider.be, andriy.shevchenko@linux.intel.com, niklas.soderlund+renesas@ragnatech.se, macro@orcam.me.uk, johan@kernel.org, lukas@wunner.de, ilpo.jarvinen@linux.intel.com, marpagan@redhat.com Cc: Basheer Ahmed Muddebihal , Matthew Gerlach Subject: [PATCH v5 2/4] fpga: dfl: Add DFHv1 Register Definitions Date: Thu, 8 Dec 2022 17:23:46 -0800 Message-Id: <20221209012348.2883424-3-matthew.gerlach@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221209012348.2883424-1-matthew.gerlach@linux.intel.com> References: <20221209012348.2883424-1-matthew.gerlach@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751697725900543796?= X-GMAIL-MSGID: =?utf-8?q?1751697725900543796?= From: Basheer Ahmed Muddebihal This patch adds the definitions for DFHv1 header and related register bitfields. Signed-off-by: Basheer Ahmed Muddebihal Co-developed-by: Matthew Gerlach Signed-off-by: Matthew Gerlach Reviewed-by: Ilpo Järvinen --- v5: consistently use fields for parameter data s/EOL/EOP/ to match doc remove unneeded mask added Co-developed-by v4: s/MSIX/MSI_X/g move kerneldoc to implementation don't change copyright date v3: keep DFHv1 definitions "hidden" in drivers/fpga/dfl.h v2: clean up whitespace and one line comments remove extra space in commit use uniform number of digits in constants don't change copyright date because of removed content --- drivers/fpga/dfl.h | 32 ++++++++++++++++++++++++++++++++ include/linux/dfl.h | 11 +++++++++++ 2 files changed, 43 insertions(+) diff --git a/drivers/fpga/dfl.h b/drivers/fpga/dfl.h index 06cfcd5e84bb..fc59f33367ee 100644 --- a/drivers/fpga/dfl.h +++ b/drivers/fpga/dfl.h @@ -74,11 +74,43 @@ #define DFH_REVISION GENMASK_ULL(15, 12) /* Feature revision */ #define DFH_NEXT_HDR_OFST GENMASK_ULL(39, 16) /* Offset to next DFH */ #define DFH_EOL BIT_ULL(40) /* End of list */ +#define DFH_VERSION GENMASK_ULL(59, 52) /* DFH version */ #define DFH_TYPE GENMASK_ULL(63, 60) /* Feature type */ #define DFH_TYPE_AFU 1 #define DFH_TYPE_PRIVATE 3 #define DFH_TYPE_FIU 4 +/* + * DFHv1 Register Offset definitons + * In DHFv1, DFH + GUID + CSR_START + CSR_SIZE_GROUP + PARAM_HDR + PARAM_DATA + * as common header registers + */ +#define DFHv1_CSR_ADDR 0x18 /* CSR Register start address */ +#define DFHv1_CSR_SIZE_GRP 0x20 /* Size of Reg Block and Group/tag */ +#define DFHv1_PARAM_HDR 0x28 /* Optional First Param header */ + +/* + * CSR Rel Bit, 1'b0 = relative (offset from feature DFH start), + * 1'b1 = absolute (ARM or other non-PCIe use) + */ +#define DFHv1_CSR_ADDR_REL BIT_ULL(0) + +/* CSR Header Register Bit Definitions */ +#define DFHv1_CSR_ADDR_MASK GENMASK_ULL(63, 1) /* 63:1 of CSR address */ + +/* CSR SIZE Goup Register Bit Definitions */ +#define DFHv1_CSR_SIZE_GRP_INSTANCE_ID GENMASK_ULL(15, 0) /* Enumeration instantiated IP */ +#define DFHv1_CSR_SIZE_GRP_GROUPING_ID GENMASK_ULL(30, 16) /* Group Features/interfaces */ +#define DFHv1_CSR_SIZE_GRP_HAS_PARAMS BIT_ULL(31) /* Presence of Parameters */ +#define DFHv1_CSR_SIZE_GRP_SIZE GENMASK_ULL(63, 32) /* Size of CSR Block in bytes */ + +/* PARAM Header Register Bit Definitions */ +#define DFHv1_PARAM_HDR_ID GENMASK_ULL(15, 0) /* Id of this Param */ +#define DFHv1_PARAM_HDR_VER GENMASK_ULL(31, 16) /* Version Param */ +#define DFHv1_PARAM_HDR_NEXT_OFFSET GENMASK_ULL(63, 35) /* Offset of next Param */ +#define DFHv1_PARAM_HDR_NEXT_EOP BIT_ULL(32) +#define DFHv1_PARAM_DATA 0x08 /* Offset of Param data from Param header */ + /* Next AFU Register Bitfield */ #define NEXT_AFU_NEXT_DFH_OFST GENMASK_ULL(23, 0) /* Offset to next AFU */ diff --git a/include/linux/dfl.h b/include/linux/dfl.h index 431636a0dc78..7b11ac530a4e 100644 --- a/include/linux/dfl.h +++ b/include/linux/dfl.h @@ -11,6 +11,17 @@ #include #include +#define DFHv1_PARAM_ID_MSI_X 0x1 +#define DFHv1_PARAM_MSI_X_NUMV GENMASK_ULL(63, 32) +#define DFHv1_PARAM_MSI_X_STARTV GENMASK_ULL(31, 0) + +#define DFHv1_PARAM_ID_CLK_FRQ 0x2 +#define DFHv1_PARAM_ID_FIFO_LEN 0x3 + +#define DFHv1_PARAM_ID_REG_LAYOUT 0x4 +#define DFHv1_PARAM_REG_LAYOUT_WIDTH GENMASK_ULL(63, 32) +#define DFHv1_PARAM_REG_LAYOUT_SHIFT GENMASK_ULL(31, 0) + /** * enum dfl_id_type - define the DFL FIU types */