linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Logan Gunthorpe <logang@deltatee.com>
To: linux-ntb@googlegroups.com, linux-pci@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: Jon Mason <jdmason@kudzu.us>, Dave Jiang <dave.jiang@intel.com>,
	Allen Hubbe <Allen.Hubbe@emc.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Kurt Schwemmer <kurt.schwemmer@microsemi.com>,
	Stephen Bates <sbates@raithlin.com>,
	Logan Gunthorpe <logang@deltatee.com>
Subject: [RFC PATCH 03/13] switchtec: add ntb hardware register definitions
Date: Thu, 15 Jun 2017 14:37:19 -0600	[thread overview]
Message-ID: <20170615203729.9009-4-logang@deltatee.com> (raw)
In-Reply-To: <20170615203729.9009-1-logang@deltatee.com>

There are two additional regions: ctrl and dbmsg. The first is
for generic ntb control and memory windows. The second for doorbells
and message registers. This patch also adds a number of related
constants for using these registers.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Reviewed-by: Stephen Bates <sbates@raithlin.com>
Reviewed-by: Kurt Schwemmer <kurt.schwemmer@microsemi.com>
---
 include/linux/switchtec.h | 84 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 84 insertions(+)

diff --git a/include/linux/switchtec.h b/include/linux/switchtec.h
index 3b87618fc42f..3c6b964885e9 100644
--- a/include/linux/switchtec.h
+++ b/include/linux/switchtec.h
@@ -147,6 +147,12 @@ struct flash_info_regs {
 	struct partition_info vendor[8];
 };
 
+enum {
+	SWITCHTEC_NTB_REG_INFO_OFFSET   = 0x0000,
+	SWITCHTEC_NTB_REG_CTRL_OFFSET   = 0x4000,
+	SWITCHTEC_NTB_REG_DBMSG_OFFSET  = 0x64000,
+};
+
 struct ntb_info_regs {
 	u8  partition_count;
 	u8  partition_id;
@@ -182,6 +188,84 @@ struct part_cfg_regs {
 } __packed;
 
 enum {
+	NTB_CTRL_PART_OP_LOCK = 0x1,
+	NTB_CTRL_PART_OP_CFG = 0x2,
+	NTB_CTRL_PART_OP_RESET = 0x3,
+
+	NTB_CTRL_PART_STATUS_NORMAL = 0x1,
+	NTB_CTRL_PART_STATUS_LOCKED = 0x2,
+	NTB_CTRL_PART_STATUS_LOCKING = 0x3,
+	NTB_CTRL_PART_STATUS_CONFIGURING = 0x4,
+	NTB_CTRL_PART_STATUS_RESETTING = 0x5,
+
+	NTB_CTRL_BAR_VALID = 1 << 0,
+	NTB_CTRL_BAR_DIR_WIN_EN = 1 << 4,
+	NTB_CTRL_BAR_LUT_WIN_EN = 1 << 5,
+
+	NTB_CTRL_REQ_ID_EN = 1 << 0,
+
+	NTB_CTRL_LUT_EN = 1 << 0,
+
+	NTB_PART_CTRL_ID_PROT_DIS = 1 << 0,
+};
+
+struct ntb_ctrl_regs {
+	u32 partition_status;
+	u32 partition_op;
+	u32 partition_ctrl;
+	u32 bar_setup;
+	u32 bar_error;
+	u16 lut_table_entries;
+	u16 lut_table_offset;
+	u32 lut_error;
+	u16 req_id_table_size;
+	u16 req_id_table_offset;
+	u32 req_id_error;
+	u32 reserved1[7];
+	struct {
+		u32 ctl;
+		u32 win_size;
+		u64 xlate_addr;
+	} bar_entry[6];
+	u32 reserved2[216];
+	u32 req_id_table[256];
+	u32 reserved3[512];
+	u64 lut_entry[512];
+} __packed;
+
+#define NTB_DBMSG_IMSG_STATUS BIT_ULL(32)
+#define NTB_DBMSG_IMSG_MASK   BIT_ULL(40)
+
+struct ntb_dbmsg_regs {
+	u32 reserved1[1024];
+	u64 odb;
+	u64 odb_mask;
+	u64 idb;
+	u64 idb_mask;
+	u8  idb_vec_map[64];
+	u32 msg_map;
+	u32 reserved2;
+	struct {
+		u32 msg;
+		u32 status;
+	} omsg[4];
+
+	struct {
+		u32 msg;
+		u8  status;
+		u8  mask;
+		u8  src;
+		u8  reserved;
+	} imsg[4];
+
+	u8 reserved3[3928];
+	u8 msix_table[1024];
+	u8 reserved4[3072];
+	u8 pba[24];
+	u8 reserved5[4072];
+} __packed;
+
+enum {
 	SWITCHTEC_PART_CFG_EVENT_RESET = 1 << 0,
 	SWITCHTEC_PART_CFG_EVENT_MRPC_CMP = 1 << 1,
 	SWITCHTEC_PART_CFG_EVENT_MRPC_ASYNC_CMP = 1 << 2,
-- 
2.11.0

  parent reply	other threads:[~2017-06-15 20:38 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-15 20:37 [RFC PATCH 00/13] Switchtec NTB Support Logan Gunthorpe
2017-06-15 20:37 ` [RFC PATCH 01/13] switchtec: move structure definitions into a common header Logan Gunthorpe
2017-06-17  5:11   ` Greg Kroah-Hartman
2017-06-15 20:37 ` [RFC PATCH 02/13] switchtec: export class symbol for use in upper layer driver Logan Gunthorpe
2017-06-17  5:11   ` Greg Kroah-Hartman
2017-06-17 16:16     ` Logan Gunthorpe
2017-06-15 20:37 ` Logan Gunthorpe [this message]
2017-06-15 20:37 ` [RFC PATCH 04/13] switchtec: add link event notifier block Logan Gunthorpe
2017-06-17  5:14   ` Greg Kroah-Hartman
2017-06-17 16:20     ` Logan Gunthorpe
2017-06-15 20:37 ` [RFC PATCH 05/13] switchtec_ntb: introduce initial ntb driver Logan Gunthorpe
2017-06-15 20:37 ` [RFC PATCH 06/13] switchtec_ntb: initialize hardware for memory windows Logan Gunthorpe
2017-06-17  5:16   ` Greg Kroah-Hartman
2017-06-17 16:39     ` Logan Gunthorpe
2017-06-18  0:33       ` Greg Kroah-Hartman
2017-06-15 20:37 ` [RFC PATCH 07/13] switchtec_ntb: initialize hardware for doorbells and messages Logan Gunthorpe
2017-06-15 20:37 ` [RFC PATCH 08/13] switchtec_ntb: add skeleton ntb driver Logan Gunthorpe
2017-06-15 20:37 ` [RFC PATCH 09/13] switchtec_ntb: add link management Logan Gunthorpe
2017-06-15 20:37 ` [RFC PATCH 10/13] switchtec_ntb: implement doorbell registers Logan Gunthorpe
2017-06-15 20:37 ` [RFC PATCH 11/13] switchtec_ntb: implement scratchpad registers Logan Gunthorpe
2017-06-15 20:37 ` [RFC PATCH 12/13] switchtec_ntb: add memory window support Logan Gunthorpe
2017-06-15 20:37 ` [RFC PATCH 13/13] switchtec_ntb: update switchtec documentation with notes for ntb Logan Gunthorpe
2017-06-16 13:53 ` [RFC PATCH 00/13] Switchtec NTB Support Allen Hubbe
2017-06-16 14:09   ` Logan Gunthorpe
2017-06-16 15:34     ` Allen Hubbe
2017-06-16 16:47       ` Logan Gunthorpe
2017-06-16 17:39         ` Serge Semin
2017-06-16 18:08         ` Allen Hubbe
2017-06-16 19:17           ` Logan Gunthorpe
2017-06-16 16:33     ` Serge Semin
2017-06-16 17:08       ` Logan Gunthorpe
2017-06-16 18:38         ` Serge Semin
2017-06-16 19:34           ` Logan Gunthorpe
2017-06-16 20:21             ` Serge Semin
2017-06-17  5:09               ` 'Greg Kroah-Hartman'
2017-06-17 16:11                 ` Logan Gunthorpe
2017-06-17 16:15                 ` Logan Gunthorpe
2017-06-19 19:14                 ` Jon Mason
2017-06-19 20:07 ` Jon Mason
2017-06-19 20:27   ` Logan Gunthorpe
2017-06-19 21:09     ` Jon Mason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170615203729.9009-4-logang@deltatee.com \
    --to=logang@deltatee.com \
    --cc=Allen.Hubbe@emc.com \
    --cc=bhelgaas@google.com \
    --cc=dave.jiang@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jdmason@kudzu.us \
    --cc=kurt.schwemmer@microsemi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-ntb@googlegroups.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=sbates@raithlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).