PCI/switchtec: Rename generation-specific constants
Gen4 hardware will have different values for the SWITCHTEC_X_RUNNING and SWITCHTEC_IOCTL_NUM_PARTITIONS, so rename them with GEN3 in their name. No functional changes intended. Link: https://lore.kernel.org/r/20200115035648.2578-2-logang@deltatee.com Signed-off-by: Logan Gunthorpe <logang@deltatee.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
This commit is contained in:

committed by
Bjorn Helgaas

parent
2085747d53
commit
fcccd282b6
@@ -569,7 +569,7 @@ static int ioctl_flash_info(struct switchtec_dev *stdev,
|
|||||||
struct flash_info_regs __iomem *fi = stdev->mmio_flash_info;
|
struct flash_info_regs __iomem *fi = stdev->mmio_flash_info;
|
||||||
|
|
||||||
info.flash_length = ioread32(&fi->flash_length);
|
info.flash_length = ioread32(&fi->flash_length);
|
||||||
info.num_partitions = SWITCHTEC_IOCTL_NUM_PARTITIONS;
|
info.num_partitions = SWITCHTEC_NUM_PARTITIONS_GEN3;
|
||||||
|
|
||||||
if (copy_to_user(uinfo, &info, sizeof(info)))
|
if (copy_to_user(uinfo, &info, sizeof(info)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
@@ -599,25 +599,25 @@ static int ioctl_flash_part_info(struct switchtec_dev *stdev,
|
|||||||
case SWITCHTEC_IOCTL_PART_CFG0:
|
case SWITCHTEC_IOCTL_PART_CFG0:
|
||||||
active_addr = ioread32(&fi->active_cfg);
|
active_addr = ioread32(&fi->active_cfg);
|
||||||
set_fw_info_part(&info, &fi->cfg0);
|
set_fw_info_part(&info, &fi->cfg0);
|
||||||
if (ioread16(&si->cfg_running) == SWITCHTEC_CFG0_RUNNING)
|
if (ioread16(&si->cfg_running) == SWITCHTEC_GEN3_CFG0_RUNNING)
|
||||||
info.active |= SWITCHTEC_IOCTL_PART_RUNNING;
|
info.active |= SWITCHTEC_IOCTL_PART_RUNNING;
|
||||||
break;
|
break;
|
||||||
case SWITCHTEC_IOCTL_PART_CFG1:
|
case SWITCHTEC_IOCTL_PART_CFG1:
|
||||||
active_addr = ioread32(&fi->active_cfg);
|
active_addr = ioread32(&fi->active_cfg);
|
||||||
set_fw_info_part(&info, &fi->cfg1);
|
set_fw_info_part(&info, &fi->cfg1);
|
||||||
if (ioread16(&si->cfg_running) == SWITCHTEC_CFG1_RUNNING)
|
if (ioread16(&si->cfg_running) == SWITCHTEC_GEN3_CFG1_RUNNING)
|
||||||
info.active |= SWITCHTEC_IOCTL_PART_RUNNING;
|
info.active |= SWITCHTEC_IOCTL_PART_RUNNING;
|
||||||
break;
|
break;
|
||||||
case SWITCHTEC_IOCTL_PART_IMG0:
|
case SWITCHTEC_IOCTL_PART_IMG0:
|
||||||
active_addr = ioread32(&fi->active_img);
|
active_addr = ioread32(&fi->active_img);
|
||||||
set_fw_info_part(&info, &fi->img0);
|
set_fw_info_part(&info, &fi->img0);
|
||||||
if (ioread16(&si->img_running) == SWITCHTEC_IMG0_RUNNING)
|
if (ioread16(&si->img_running) == SWITCHTEC_GEN3_IMG0_RUNNING)
|
||||||
info.active |= SWITCHTEC_IOCTL_PART_RUNNING;
|
info.active |= SWITCHTEC_IOCTL_PART_RUNNING;
|
||||||
break;
|
break;
|
||||||
case SWITCHTEC_IOCTL_PART_IMG1:
|
case SWITCHTEC_IOCTL_PART_IMG1:
|
||||||
active_addr = ioread32(&fi->active_img);
|
active_addr = ioread32(&fi->active_img);
|
||||||
set_fw_info_part(&info, &fi->img1);
|
set_fw_info_part(&info, &fi->img1);
|
||||||
if (ioread16(&si->img_running) == SWITCHTEC_IMG1_RUNNING)
|
if (ioread16(&si->img_running) == SWITCHTEC_GEN3_IMG1_RUNNING)
|
||||||
info.active |= SWITCHTEC_IOCTL_PART_RUNNING;
|
info.active |= SWITCHTEC_IOCTL_PART_RUNNING;
|
||||||
break;
|
break;
|
||||||
case SWITCHTEC_IOCTL_PART_NVLOG:
|
case SWITCHTEC_IOCTL_PART_NVLOG:
|
||||||
|
@@ -98,10 +98,10 @@ struct sw_event_regs {
|
|||||||
} __packed;
|
} __packed;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
SWITCHTEC_CFG0_RUNNING = 0x04,
|
SWITCHTEC_GEN3_CFG0_RUNNING = 0x04,
|
||||||
SWITCHTEC_CFG1_RUNNING = 0x05,
|
SWITCHTEC_GEN3_CFG1_RUNNING = 0x05,
|
||||||
SWITCHTEC_IMG0_RUNNING = 0x03,
|
SWITCHTEC_GEN3_IMG0_RUNNING = 0x03,
|
||||||
SWITCHTEC_IMG1_RUNNING = 0x07,
|
SWITCHTEC_GEN3_IMG1_RUNNING = 0x07,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sys_info_regs {
|
struct sys_info_regs {
|
||||||
|
@@ -32,7 +32,10 @@
|
|||||||
#define SWITCHTEC_IOCTL_PART_VENDOR5 10
|
#define SWITCHTEC_IOCTL_PART_VENDOR5 10
|
||||||
#define SWITCHTEC_IOCTL_PART_VENDOR6 11
|
#define SWITCHTEC_IOCTL_PART_VENDOR6 11
|
||||||
#define SWITCHTEC_IOCTL_PART_VENDOR7 12
|
#define SWITCHTEC_IOCTL_PART_VENDOR7 12
|
||||||
#define SWITCHTEC_IOCTL_NUM_PARTITIONS 13
|
#define SWITCHTEC_NUM_PARTITIONS_GEN3 13
|
||||||
|
|
||||||
|
/* obsolete: for compatibility with old userspace software */
|
||||||
|
#define SWITCHTEC_IOCTL_NUM_PARTITIONS SWITCHTEC_NUM_PARTITIONS_GEN3
|
||||||
|
|
||||||
struct switchtec_ioctl_flash_info {
|
struct switchtec_ioctl_flash_info {
|
||||||
__u64 flash_length;
|
__u64 flash_length;
|
||||||
|
Reference in New Issue
Block a user