diff options
| author | Alex Williamson <alex.williamson@redhat.com> | 2013-12-17 18:43:57 -0500 |
|---|---|---|
| committer | Bjorn Helgaas <bhelgaas@google.com> | 2013-12-17 19:49:39 -0500 |
| commit | 274127a1fdbad3c0d64e813521f4a0ef96cfc70e (patch) | |
| tree | 72c5702de4cfcb7337550f355af46f568c448022 | |
| parent | 425c1b223dac456d00a61fd6b451b6d1cf00d065 (diff) | |
PCI: Rename PCI_VC_PORT_REG1/2 to PCI_VC_PORT_CAP1/2
These are set of two capability registers, it's pretty much given that
they're registers, so reflect their purpose in the name.
Suggested-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
| -rw-r--r-- | drivers/pci/vc.c | 28 | ||||
| -rw-r--r-- | drivers/vfio/pci/vfio_pci_config.c | 12 | ||||
| -rw-r--r-- | include/uapi/linux/pci_regs.h | 18 |
3 files changed, 29 insertions, 29 deletions
diff --git a/drivers/pci/vc.c b/drivers/pci/vc.c index c10567e4f14f..7e1304d2e389 100644 --- a/drivers/pci/vc.c +++ b/drivers/pci/vc.c | |||
| @@ -104,7 +104,7 @@ static void pci_vc_load_port_arb_table(struct pci_dev *dev, int pos, int res) | |||
| 104 | static void pci_vc_enable(struct pci_dev *dev, int pos, int res) | 104 | static void pci_vc_enable(struct pci_dev *dev, int pos, int res) |
| 105 | { | 105 | { |
| 106 | int ctrl_pos, status_pos, id, pos2, evcc, i, ctrl_pos2, status_pos2; | 106 | int ctrl_pos, status_pos, id, pos2, evcc, i, ctrl_pos2, status_pos2; |
| 107 | u32 ctrl, header, reg1, ctrl2; | 107 | u32 ctrl, header, cap1, ctrl2; |
| 108 | struct pci_dev *link = NULL; | 108 | struct pci_dev *link = NULL; |
| 109 | 109 | ||
| 110 | /* Enable VCs from the downstream device */ | 110 | /* Enable VCs from the downstream device */ |
| @@ -129,8 +129,8 @@ static void pci_vc_enable(struct pci_dev *dev, int pos, int res) | |||
| 129 | if (!pos2) | 129 | if (!pos2) |
| 130 | goto enable; | 130 | goto enable; |
| 131 | 131 | ||
| 132 | pci_read_config_dword(dev->bus->self, pos2 + PCI_VC_PORT_REG1, ®1); | 132 | pci_read_config_dword(dev->bus->self, pos2 + PCI_VC_PORT_CAP1, &cap1); |
| 133 | evcc = reg1 & PCI_VC_REG1_EVCC; | 133 | evcc = cap1 & PCI_VC_CAP1_EVCC; |
| 134 | 134 | ||
| 135 | /* VC0 is hardwired enabled, so we can start with 1 */ | 135 | /* VC0 is hardwired enabled, so we can start with 1 */ |
| 136 | for (i = 1; i < evcc + 1; i++) { | 136 | for (i = 1; i < evcc + 1; i++) { |
| @@ -188,7 +188,7 @@ static int pci_vc_do_save_buffer(struct pci_dev *dev, int pos, | |||
| 188 | struct pci_cap_saved_state *save_state, | 188 | struct pci_cap_saved_state *save_state, |
| 189 | bool save) | 189 | bool save) |
| 190 | { | 190 | { |
| 191 | u32 reg1; | 191 | u32 cap1; |
| 192 | char evcc, lpevcc, parb_size; | 192 | char evcc, lpevcc, parb_size; |
| 193 | int i, len = 0; | 193 | int i, len = 0; |
| 194 | u8 *buf = save_state ? (u8 *)save_state->cap.data : NULL; | 194 | u8 *buf = save_state ? (u8 *)save_state->cap.data : NULL; |
| @@ -201,13 +201,13 @@ static int pci_vc_do_save_buffer(struct pci_dev *dev, int pos, | |||
| 201 | return -ENOMEM; | 201 | return -ENOMEM; |
| 202 | } | 202 | } |
| 203 | 203 | ||
| 204 | pci_read_config_dword(dev, pos + PCI_VC_PORT_REG1, ®1); | 204 | pci_read_config_dword(dev, pos + PCI_VC_PORT_CAP1, &cap1); |
| 205 | /* Extended VC Count (not counting VC0) */ | 205 | /* Extended VC Count (not counting VC0) */ |
| 206 | evcc = reg1 & PCI_VC_REG1_EVCC; | 206 | evcc = cap1 & PCI_VC_CAP1_EVCC; |
| 207 | /* Low Priority Extended VC Count (not counting VC0) */ | 207 | /* Low Priority Extended VC Count (not counting VC0) */ |
| 208 | lpevcc = (reg1 & PCI_VC_REG1_LPEVCC) >> 4; | 208 | lpevcc = (cap1 & PCI_VC_CAP1_LPEVCC) >> 4; |
| 209 | /* Port Arbitration Table Entry Size (bits) */ | 209 | /* Port Arbitration Table Entry Size (bits) */ |
| 210 | parb_size = 1 << ((reg1 & PCI_VC_REG1_ARB_SIZE) >> 10); | 210 | parb_size = 1 << ((cap1 & PCI_VC_CAP1_ARB_SIZE) >> 10); |
| 211 | 211 | ||
| 212 | /* | 212 | /* |
| 213 | * Port VC Control Register contains VC Arbitration Select, which | 213 | * Port VC Control Register contains VC Arbitration Select, which |
| @@ -231,20 +231,20 @@ static int pci_vc_do_save_buffer(struct pci_dev *dev, int pos, | |||
| 231 | * in Port VC Capability Register 2 then save/restore it next. | 231 | * in Port VC Capability Register 2 then save/restore it next. |
| 232 | */ | 232 | */ |
| 233 | if (lpevcc) { | 233 | if (lpevcc) { |
| 234 | u32 reg2; | 234 | u32 cap2; |
| 235 | int vcarb_offset; | 235 | int vcarb_offset; |
| 236 | 236 | ||
| 237 | pci_read_config_dword(dev, pos + PCI_VC_PORT_REG2, ®2); | 237 | pci_read_config_dword(dev, pos + PCI_VC_PORT_CAP2, &cap2); |
| 238 | vcarb_offset = ((reg2 & PCI_VC_REG2_ARB_OFF) >> 24) * 16; | 238 | vcarb_offset = ((cap2 & PCI_VC_CAP2_ARB_OFF) >> 24) * 16; |
| 239 | 239 | ||
| 240 | if (vcarb_offset) { | 240 | if (vcarb_offset) { |
| 241 | int size, vcarb_phases = 0; | 241 | int size, vcarb_phases = 0; |
| 242 | 242 | ||
| 243 | if (reg2 & PCI_VC_REG2_128_PHASE) | 243 | if (cap2 & PCI_VC_CAP2_128_PHASE) |
| 244 | vcarb_phases = 128; | 244 | vcarb_phases = 128; |
| 245 | else if (reg2 & PCI_VC_REG2_64_PHASE) | 245 | else if (cap2 & PCI_VC_CAP2_64_PHASE) |
| 246 | vcarb_phases = 64; | 246 | vcarb_phases = 64; |
| 247 | else if (reg2 & PCI_VC_REG2_32_PHASE) | 247 | else if (cap2 & PCI_VC_CAP2_32_PHASE) |
| 248 | vcarb_phases = 32; | 248 | vcarb_phases = 32; |
| 249 | 249 | ||
| 250 | /* Fixed 4 bits per phase per lpevcc (plus VC0) */ | 250 | /* Fixed 4 bits per phase per lpevcc (plus VC0) */ |
diff --git a/drivers/vfio/pci/vfio_pci_config.c b/drivers/vfio/pci/vfio_pci_config.c index ffd0632c3cbc..83cd1574c810 100644 --- a/drivers/vfio/pci/vfio_pci_config.c +++ b/drivers/vfio/pci/vfio_pci_config.c | |||
| @@ -975,20 +975,20 @@ static int vfio_vc_cap_len(struct vfio_pci_device *vdev, u16 pos) | |||
| 975 | int ret, evcc, phases, vc_arb; | 975 | int ret, evcc, phases, vc_arb; |
| 976 | int len = PCI_CAP_VC_BASE_SIZEOF; | 976 | int len = PCI_CAP_VC_BASE_SIZEOF; |
| 977 | 977 | ||
| 978 | ret = pci_read_config_dword(pdev, pos + PCI_VC_PORT_REG1, &tmp); | 978 | ret = pci_read_config_dword(pdev, pos + PCI_VC_PORT_CAP1, &tmp); |
| 979 | if (ret) | 979 | if (ret) |
| 980 | return pcibios_err_to_errno(ret); | 980 | return pcibios_err_to_errno(ret); |
| 981 | 981 | ||
| 982 | evcc = tmp & PCI_VC_REG1_EVCC; /* extended vc count */ | 982 | evcc = tmp & PCI_VC_CAP1_EVCC; /* extended vc count */ |
| 983 | ret = pci_read_config_dword(pdev, pos + PCI_VC_PORT_REG2, &tmp); | 983 | ret = pci_read_config_dword(pdev, pos + PCI_VC_PORT_CAP2, &tmp); |
| 984 | if (ret) | 984 | if (ret) |
| 985 | return pcibios_err_to_errno(ret); | 985 | return pcibios_err_to_errno(ret); |
| 986 | 986 | ||
| 987 | if (tmp & PCI_VC_REG2_128_PHASE) | 987 | if (tmp & PCI_VC_CAP2_128_PHASE) |
| 988 | phases = 128; | 988 | phases = 128; |
| 989 | else if (tmp & PCI_VC_REG2_64_PHASE) | 989 | else if (tmp & PCI_VC_CAP2_64_PHASE) |
| 990 | phases = 64; | 990 | phases = 64; |
| 991 | else if (tmp & PCI_VC_REG2_32_PHASE) | 991 | else if (tmp & PCI_VC_CAP2_32_PHASE) |
| 992 | phases = 32; | 992 | phases = 32; |
| 993 | else | 993 | else |
| 994 | phases = 0; | 994 | phases = 0; |
diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h index 5eefacd93e18..d0160cc83fcf 100644 --- a/include/uapi/linux/pci_regs.h +++ b/include/uapi/linux/pci_regs.h | |||
| @@ -677,15 +677,15 @@ | |||
| 677 | #define PCI_ERR_ROOT_ERR_SRC 52 /* Error Source Identification */ | 677 | #define PCI_ERR_ROOT_ERR_SRC 52 /* Error Source Identification */ |
| 678 | 678 | ||
| 679 | /* Virtual Channel */ | 679 | /* Virtual Channel */ |
| 680 | #define PCI_VC_PORT_REG1 4 | 680 | #define PCI_VC_PORT_CAP1 4 |
| 681 | #define PCI_VC_REG1_EVCC 0x00000007 /* extended VC count */ | 681 | #define PCI_VC_CAP1_EVCC 0x00000007 /* extended VC count */ |
| 682 | #define PCI_VC_REG1_LPEVCC 0x00000070 /* low prio extended VC count */ | 682 | #define PCI_VC_CAP1_LPEVCC 0x00000070 /* low prio extended VC count */ |
| 683 | #define PCI_VC_REG1_ARB_SIZE 0x00000c00 | 683 | #define PCI_VC_CAP1_ARB_SIZE 0x00000c00 |
| 684 | #define PCI_VC_PORT_REG2 8 | 684 | #define PCI_VC_PORT_CAP2 8 |
| 685 | #define PCI_VC_REG2_32_PHASE 0x00000002 | 685 | #define PCI_VC_CAP2_32_PHASE 0x00000002 |
| 686 | #define PCI_VC_REG2_64_PHASE 0x00000004 | 686 | #define PCI_VC_CAP2_64_PHASE 0x00000004 |
| 687 | #define PCI_VC_REG2_128_PHASE 0x00000008 | 687 | #define PCI_VC_CAP2_128_PHASE 0x00000008 |
| 688 | #define PCI_VC_REG2_ARB_OFF 0xff000000 | 688 | #define PCI_VC_CAP2_ARB_OFF 0xff000000 |
| 689 | #define PCI_VC_PORT_CTRL 12 | 689 | #define PCI_VC_PORT_CTRL 12 |
| 690 | #define PCI_VC_PORT_CTRL_LOAD_TABLE 0x00000001 | 690 | #define PCI_VC_PORT_CTRL_LOAD_TABLE 0x00000001 |
| 691 | #define PCI_VC_PORT_STATUS 14 | 691 | #define PCI_VC_PORT_STATUS 14 |
