From: Logan Gunthorpe <logang@deltatee.com>
To: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
Bjorn Helgaas <bhelgaas@google.com>
Cc: Kelvin.Cao@microchip.com, Eric Pilmore <epilmore@gigaio.com>,
Doug Meyer <dmeyer@gigaio.com>,
Logan Gunthorpe <logang@deltatee.com>
Subject: [PATCH 07/12] PCI/switchtec: Separate out gen3 specific fields in the sys_info_regs structure
Date: Mon, 6 Jan 2020 12:03:32 -0700 [thread overview]
Message-ID: <20200106190337.2428-8-logang@deltatee.com> (raw)
In-Reply-To: <20200106190337.2428-1-logang@deltatee.com>
Since gen4 system info region in GAS is diverged from gen3, separate
oute the gen3 specific stuff in preparation for adding a gen4 variant.
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
---
drivers/pci/switch/switchtec.c | 18 +++++++++---------
include/linux/switchtec.h | 12 ++++++++----
2 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/drivers/pci/switch/switchtec.c b/drivers/pci/switch/switchtec.c
index 674c57c9ae4c..21d3dd6e74f9 100644
--- a/drivers/pci/switch/switchtec.c
+++ b/drivers/pci/switch/switchtec.c
@@ -317,8 +317,8 @@ static ssize_t field ## _show(struct device *dev, \
struct device_attribute *attr, char *buf) \
{ \
struct switchtec_dev *stdev = to_stdev(dev); \
- return io_string_show(buf, &stdev->mmio_sys_info->field, \
- sizeof(stdev->mmio_sys_info->field)); \
+ return io_string_show(buf, &stdev->mmio_sys_info->gen3.field, \
+ sizeof(stdev->mmio_sys_info->gen3.field)); \
} \
\
static DEVICE_ATTR_RO(field)
@@ -332,7 +332,7 @@ static ssize_t component_id_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct switchtec_dev *stdev = to_stdev(dev);
- int id = ioread16(&stdev->mmio_sys_info->component_id);
+ int id = ioread16(&stdev->mmio_sys_info->gen3.component_id);
return sprintf(buf, "PM%04X\n", id);
}
@@ -342,7 +342,7 @@ static ssize_t component_revision_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct switchtec_dev *stdev = to_stdev(dev);
- int rev = ioread8(&stdev->mmio_sys_info->component_revision);
+ int rev = ioread8(&stdev->mmio_sys_info->gen3.component_revision);
return sprintf(buf, "%d\n", rev);
}
@@ -599,25 +599,25 @@ static int ioctl_flash_part_info(struct switchtec_dev *stdev,
case SWITCHTEC_IOCTL_PART_CFG0:
active_addr = ioread32(&fi->active_cfg);
set_fw_info_part(&info, &fi->cfg0);
- if (ioread16(&si->cfg_running) == SWITCHTEC_CFG0_RUNNING)
+ if (ioread16(&si->gen3.cfg_running) == SWITCHTEC_CFG0_RUNNING)
info.active |= SWITCHTEC_IOCTL_PART_RUNNING;
break;
case SWITCHTEC_IOCTL_PART_CFG1:
active_addr = ioread32(&fi->active_cfg);
set_fw_info_part(&info, &fi->cfg1);
- if (ioread16(&si->cfg_running) == SWITCHTEC_CFG1_RUNNING)
+ if (ioread16(&si->gen3.cfg_running) == SWITCHTEC_CFG1_RUNNING)
info.active |= SWITCHTEC_IOCTL_PART_RUNNING;
break;
case SWITCHTEC_IOCTL_PART_IMG0:
active_addr = ioread32(&fi->active_img);
set_fw_info_part(&info, &fi->img0);
- if (ioread16(&si->img_running) == SWITCHTEC_IMG0_RUNNING)
+ if (ioread16(&si->gen3.img_running) == SWITCHTEC_IMG0_RUNNING)
info.active |= SWITCHTEC_IOCTL_PART_RUNNING;
break;
case SWITCHTEC_IOCTL_PART_IMG1:
active_addr = ioread32(&fi->active_img);
set_fw_info_part(&info, &fi->img1);
- if (ioread16(&si->img_running) == SWITCHTEC_IMG1_RUNNING)
+ if (ioread16(&si->gen3.img_running) == SWITCHTEC_IMG1_RUNNING)
info.active |= SWITCHTEC_IOCTL_PART_RUNNING;
break;
case SWITCHTEC_IOCTL_PART_NVLOG:
@@ -1378,7 +1378,7 @@ static int switchtec_init_pci(struct switchtec_dev *stdev,
stdev->mmio_sys_info = stdev->mmio + SWITCHTEC_GAS_SYS_INFO_OFFSET;
stdev->mmio_flash_info = stdev->mmio + SWITCHTEC_GAS_FLASH_INFO_OFFSET;
stdev->mmio_ntb = stdev->mmio + SWITCHTEC_GAS_NTB_OFFSET;
- stdev->partition = ioread8(&stdev->mmio_sys_info->partition_id);
+ stdev->partition = ioread8(&stdev->mmio_sys_info->gen3.partition_id);
stdev->partition_count = ioread8(&stdev->mmio_ntb->partition_count);
stdev->mmio_part_cfg_all = stdev->mmio + SWITCHTEC_GAS_PART_CFG_OFFSET;
stdev->mmio_part_cfg = &stdev->mmio_part_cfg_all[stdev->partition];
diff --git a/include/linux/switchtec.h b/include/linux/switchtec.h
index 0963912c679d..d6ba4b5dbbed 100644
--- a/include/linux/switchtec.h
+++ b/include/linux/switchtec.h
@@ -109,10 +109,7 @@ enum {
SWITCHTEC_IMG1_RUNNING = 0x07,
};
-struct sys_info_regs {
- u32 device_id;
- u32 device_version;
- u32 firmware_version;
+struct sys_info_regs_gen3 {
u32 reserved1;
u32 vendor_table_revision;
u32 table_format_version;
@@ -129,6 +126,13 @@ struct sys_info_regs {
u8 component_revision;
} __packed;
+struct sys_info_regs {
+ u32 device_id;
+ u32 device_version;
+ u32 firmware_version;
+ struct sys_info_regs_gen3 gen3;
+} __packed;
+
struct flash_info_regs {
u32 flash_part_map_upd_idx;
--
2.20.1
next prev parent reply other threads:[~2020-01-06 19:04 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-06 19:03 [PATCH 00/12] Switchtec Fixes and Gen4 Support Logan Gunthorpe
2020-01-06 19:03 ` [PATCH 01/12] PCI/switchtec: Use dma_set_mask_and_coherent() Logan Gunthorpe
2020-01-06 19:03 ` [PATCH 02/12] PCI/switchtec: Fix vep_vector_number ioread width Logan Gunthorpe
2020-01-06 19:03 ` [PATCH 03/12] PCI/switchtec: Add support for new events Logan Gunthorpe
2020-01-08 21:33 ` Bjorn Helgaas
2020-01-08 21:47 ` Logan Gunthorpe
2020-01-14 2:07 ` Kelvin.Cao
2020-01-14 18:21 ` Logan Gunthorpe
2020-01-14 19:07 ` Bjorn Helgaas
2020-01-06 19:03 ` [PATCH 04/12] PCI/switchtec: Remove redundant valid PFF number count Logan Gunthorpe
2020-01-06 19:03 ` [PATCH 05/12] PCI/switchtec: Move check event id from mask_event() to switchtec_event_isr() Logan Gunthorpe
2020-01-06 19:03 ` [PATCH 06/12] PCI/switchtec: Introduce Generation Variable Logan Gunthorpe
2020-01-06 19:03 ` Logan Gunthorpe [this message]
2020-01-06 19:03 ` [PATCH 08/12] PCI/switchtec: Add gen4 support in struct sys_info_regs Logan Gunthorpe
2020-01-08 21:21 ` Bjorn Helgaas
2020-01-06 19:03 ` [PATCH 09/12] PCI/switchtec: Add gen4 support in struct flash_info_regs Logan Gunthorpe
2020-01-08 21:23 ` Bjorn Helgaas
2020-01-08 21:34 ` Logan Gunthorpe
2020-01-06 19:03 ` [PATCH 10/12] PCI/switchtec: Add permission check for the GAS access MRPC commands Logan Gunthorpe
2020-01-06 19:03 ` [PATCH 11/12] PCI/switchtec: Introduce gen4 variant IDS in the device ID table Logan Gunthorpe
2020-01-06 19:03 ` [PATCH 12/12] PCI: Apply switchtec DMA aliasing quirk to GEN4 devices Logan Gunthorpe
2020-01-08 21:47 ` [PATCH 00/12] Switchtec Fixes and Gen4 Support Bjorn Helgaas
2020-01-08 21:53 ` Logan Gunthorpe
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=20200106190337.2428-8-logang@deltatee.com \
--to=logang@deltatee.com \
--cc=Kelvin.Cao@microchip.com \
--cc=bhelgaas@google.com \
--cc=dmeyer@gigaio.com \
--cc=epilmore@gigaio.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
/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