[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 27/53] pcie_regs: drop duplicated indicator value macros
From: |
Michael S. Tsirkin |
Subject: |
[PULL 27/53] pcie_regs: drop duplicated indicator value macros |
Date: |
Thu, 2 Mar 2023 03:25:53 -0500 |
From: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
We already have indicator values in
include/standard-headers/linux/pci_regs.h , no reason to reinvent them
in include/hw/pci/pcie_regs.h. (and we already have usage of
PCI_EXP_SLTCTL_PWR_IND_BLINK and PCI_EXP_SLTCTL_PWR_IND_OFF in
hw/pci/pcie.c, so let's be consistent)
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Anton Kuchin <antonkuchin@yandex-team.ru>
Message-Id: <20230216180356.156832-9-vsementsov@yandex-team.ru>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
include/hw/pci/pcie_regs.h | 9 ---------
hw/pci/pcie.c | 13 +++++++------
2 files changed, 7 insertions(+), 15 deletions(-)
diff --git a/include/hw/pci/pcie_regs.h b/include/hw/pci/pcie_regs.h
index 963dc2e170..00b595a82e 100644
--- a/include/hw/pci/pcie_regs.h
+++ b/include/hw/pci/pcie_regs.h
@@ -70,15 +70,6 @@ typedef enum PCIExpLinkWidth {
#define PCI_EXP_SLTCTL_IND_ON 0x1
#define PCI_EXP_SLTCTL_IND_BLINK 0x2
#define PCI_EXP_SLTCTL_IND_OFF 0x3
-#define PCI_EXP_SLTCTL_AIC_SHIFT ctz32(PCI_EXP_SLTCTL_AIC)
-#define PCI_EXP_SLTCTL_AIC_OFF \
- (PCI_EXP_SLTCTL_IND_OFF << PCI_EXP_SLTCTL_AIC_SHIFT)
-
-#define PCI_EXP_SLTCTL_PIC_SHIFT ctz32(PCI_EXP_SLTCTL_PIC)
-#define PCI_EXP_SLTCTL_PIC_OFF \
- (PCI_EXP_SLTCTL_IND_OFF << PCI_EXP_SLTCTL_PIC_SHIFT)
-#define PCI_EXP_SLTCTL_PIC_ON \
- (PCI_EXP_SLTCTL_IND_ON << PCI_EXP_SLTCTL_PIC_SHIFT)
#define PCI_EXP_SLTCTL_SUPPORTED \
(PCI_EXP_SLTCTL_ABPE | \
diff --git a/hw/pci/pcie.c b/hw/pci/pcie.c
index 82ef723983..ccdb2377e1 100644
--- a/hw/pci/pcie.c
+++ b/hw/pci/pcie.c
@@ -634,8 +634,8 @@ void pcie_cap_slot_init(PCIDevice *dev, PCIESlot *s)
PCI_EXP_SLTCTL_PIC |
PCI_EXP_SLTCTL_AIC);
pci_word_test_and_set_mask(dev->config + pos + PCI_EXP_SLTCTL,
- PCI_EXP_SLTCTL_PIC_OFF |
- PCI_EXP_SLTCTL_AIC_OFF);
+ PCI_EXP_SLTCTL_PWR_IND_OFF |
+ PCI_EXP_SLTCTL_ATTN_IND_OFF);
pci_word_test_and_set_mask(dev->wmask + pos + PCI_EXP_SLTCTL,
PCI_EXP_SLTCTL_PIC |
PCI_EXP_SLTCTL_AIC |
@@ -679,7 +679,7 @@ void pcie_cap_slot_reset(PCIDevice *dev)
PCI_EXP_SLTCTL_PDCE |
PCI_EXP_SLTCTL_ABPE);
pci_word_test_and_set_mask(exp_cap + PCI_EXP_SLTCTL,
- PCI_EXP_SLTCTL_AIC_OFF);
+ PCI_EXP_SLTCTL_ATTN_IND_OFF);
if (dev->cap_present & QEMU_PCIE_SLTCAP_PCP) {
/* Downstream ports enforce device number 0. */
@@ -694,7 +694,8 @@ void pcie_cap_slot_reset(PCIDevice *dev)
PCI_EXP_SLTCTL_PCC);
}
- pic = populated ? PCI_EXP_SLTCTL_PIC_ON : PCI_EXP_SLTCTL_PIC_OFF;
+ pic = populated ?
+ PCI_EXP_SLTCTL_PWR_IND_ON : PCI_EXP_SLTCTL_PWR_IND_OFF;
pci_word_test_and_set_mask(exp_cap + PCI_EXP_SLTCTL, pic);
}
@@ -770,9 +771,9 @@ void pcie_cap_slot_write_config(PCIDevice *dev,
* control of powered off slots before powering them on.
*/
if ((sltsta & PCI_EXP_SLTSTA_PDS) && (val & PCI_EXP_SLTCTL_PCC) &&
- (val & PCI_EXP_SLTCTL_PIC) == PCI_EXP_SLTCTL_PIC_OFF &&
+ (val & PCI_EXP_SLTCTL_PIC) == PCI_EXP_SLTCTL_PWR_IND_OFF &&
(!(old_slt_ctl & PCI_EXP_SLTCTL_PCC) ||
- (old_slt_ctl & PCI_EXP_SLTCTL_PIC) != PCI_EXP_SLTCTL_PIC_OFF)) {
+ (old_slt_ctl & PCI_EXP_SLTCTL_PIC) != PCI_EXP_SLTCTL_PWR_IND_OFF)) {
pcie_cap_slot_do_unplug(dev);
}
pcie_cap_update_power(dev);
--
MST
- Re: [PULL 14/53] virtio-rng-pci: fix transitional migration compat for vectors, (continued)
- [PULL 08/53] Revert "hw/i386: pass RNG seed via setup_data entry", Michael S. Tsirkin, 2023/03/02
- [PULL 15/53] hw/timer/hpet: Fix expiration time overflow, Michael S. Tsirkin, 2023/03/02
- [PULL 06/53] Revert "x86: use typedef for SetupData struct", Michael S. Tsirkin, 2023/03/02
- [PULL 18/53] vhost-user: Adopt new backend naming, Michael S. Tsirkin, 2023/03/02
- [PULL 19/53] vdpa: stop all svq on device deletion, Michael S. Tsirkin, 2023/03/02
- [PULL 20/53] pci/shpc: set attention led to OFF on reset, Michael S. Tsirkin, 2023/03/02
- [PULL 21/53] pci/shpc: change shpc_get_status() return type to uint8_t, Michael S. Tsirkin, 2023/03/02
- [PULL 22/53] pci/shpc: shpc_slot_command(): handle PWRONLY -> ENABLED transition, Michael S. Tsirkin, 2023/03/02
- [PULL 23/53] pci/shpc: more generic handle hot-unplug in shpc_slot_command(), Michael S. Tsirkin, 2023/03/02
- [PULL 27/53] pcie_regs: drop duplicated indicator value macros,
Michael S. Tsirkin <=
- [PULL 24/53] pci/shpc: pass PCIDevice pointer to shpc_slot_command(), Michael S. Tsirkin, 2023/03/02
- [PULL 25/53] pci/shpc: refactor shpc_device_plug_common(), Michael S. Tsirkin, 2023/03/02
- [PULL 26/53] pcie: pcie_cap_slot_write_config(): use correct macro, Michael S. Tsirkin, 2023/03/02
- [PULL 29/53] pcie: pcie_cap_slot_enable_power() use correct helper, Michael S. Tsirkin, 2023/03/02
- [PULL 28/53] pcie: drop unused PCIExpressIndicator, Michael S. Tsirkin, 2023/03/02
- [PULL 31/53] pcie: set power indicator to off on reset by default, Michael S. Tsirkin, 2023/03/02
- [PULL 32/53] vhost: avoid a potential use of an uninitialized variable in vhost_svq_poll(), Michael S. Tsirkin, 2023/03/02