aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian König <ckoenig.leichtzumerken@gmail.com>2018-06-29 20:55:03 -0400
committerBjorn Helgaas <helgaas@kernel.org>2018-06-29 20:55:03 -0400
commitb1277a226d8c519b8c33e23fe68b4e1658f15963 (patch)
tree733a5646b0b03f664bd81831c6cb80e58ce5cc95
parentd3252ace0bc652a1a244455556b6a549f969bf99 (diff)
PCI: Cleanup PCI_REBAR_CTRL_BAR_SHIFT handling
Cleanup PCI_REBAR_CTRL_BAR_SHIFT handling. That was hard coded instead of properly defined in the header for some reason. Signed-off-by: Christian König <christian.koenig@amd.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
-rw-r--r--drivers/pci/pci.c6
-rw-r--r--include/uapi/linux/pci_regs.h3
2 files changed, 5 insertions, 4 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 44ccfb31363e..1b20c4392f09 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -1193,7 +1193,7 @@ static void pci_restore_rebar_state(struct pci_dev *pdev)
1193 res = pdev->resource + bar_idx; 1193 res = pdev->resource + bar_idx;
1194 size = order_base_2((resource_size(res) >> 20) | 1) - 1; 1194 size = order_base_2((resource_size(res) >> 20) | 1) - 1;
1195 ctrl &= ~PCI_REBAR_CTRL_BAR_SIZE; 1195 ctrl &= ~PCI_REBAR_CTRL_BAR_SIZE;
1196 ctrl |= size << 8; 1196 ctrl |= size << PCI_REBAR_CTRL_BAR_SHIFT;
1197 pci_write_config_dword(pdev, pos + PCI_REBAR_CTRL, ctrl); 1197 pci_write_config_dword(pdev, pos + PCI_REBAR_CTRL, ctrl);
1198 } 1198 }
1199} 1199}
@@ -3098,7 +3098,7 @@ int pci_rebar_get_current_size(struct pci_dev *pdev, int bar)
3098 return pos; 3098 return pos;
3099 3099
3100 pci_read_config_dword(pdev, pos + PCI_REBAR_CTRL, &ctrl); 3100 pci_read_config_dword(pdev, pos + PCI_REBAR_CTRL, &ctrl);
3101 return (ctrl & PCI_REBAR_CTRL_BAR_SIZE) >> 8; 3101 return (ctrl & PCI_REBAR_CTRL_BAR_SIZE) >> PCI_REBAR_CTRL_BAR_SHIFT;
3102} 3102}
3103 3103
3104/** 3104/**
@@ -3121,7 +3121,7 @@ int pci_rebar_set_size(struct pci_dev *pdev, int bar, int size)
3121 3121
3122 pci_read_config_dword(pdev, pos + PCI_REBAR_CTRL, &ctrl); 3122 pci_read_config_dword(pdev, pos + PCI_REBAR_CTRL, &ctrl);
3123 ctrl &= ~PCI_REBAR_CTRL_BAR_SIZE; 3123 ctrl &= ~PCI_REBAR_CTRL_BAR_SIZE;
3124 ctrl |= size << 8; 3124 ctrl |= size << PCI_REBAR_CTRL_BAR_SHIFT;
3125 pci_write_config_dword(pdev, pos + PCI_REBAR_CTRL, ctrl); 3125 pci_write_config_dword(pdev, pos + PCI_REBAR_CTRL, ctrl);
3126 return 0; 3126 return 0;
3127} 3127}
diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h
index 4da87e2ef8a8..82e6b361204e 100644
--- a/include/uapi/linux/pci_regs.h
+++ b/include/uapi/linux/pci_regs.h
@@ -960,8 +960,9 @@
960#define PCI_REBAR_CTRL 8 /* control register */ 960#define PCI_REBAR_CTRL 8 /* control register */
961#define PCI_REBAR_CTRL_BAR_IDX 0x00000007 /* BAR index */ 961#define PCI_REBAR_CTRL_BAR_IDX 0x00000007 /* BAR index */
962#define PCI_REBAR_CTRL_NBAR_MASK 0x000000E0 /* # of resizable BARs */ 962#define PCI_REBAR_CTRL_NBAR_MASK 0x000000E0 /* # of resizable BARs */
963#define PCI_REBAR_CTRL_NBAR_SHIFT 5 /* shift for # of BARs */ 963#define PCI_REBAR_CTRL_NBAR_SHIFT 5 /* shift for # of BARs */
964#define PCI_REBAR_CTRL_BAR_SIZE 0x00001F00 /* BAR size */ 964#define PCI_REBAR_CTRL_BAR_SIZE 0x00001F00 /* BAR size */
965#define PCI_REBAR_CTRL_BAR_SHIFT 8 /* shift for BAR size */
965 966
966/* Dynamic Power Allocation */ 967/* Dynamic Power Allocation */
967#define PCI_DPA_CAP 4 /* capability register */ 968#define PCI_DPA_CAP 4 /* capability register */