Skip to content

Commit f00e8db

Browse files
ij-intelbjorn-helgaas
authored andcommitted
PCI/DPC: Use defined fields with DPC_CTL register
Instead of using a literal to clear bits, add PCI_EXP_DPC_CTL_EN_MASK and use the usual pattern to modify a bitfield. While at it, rearrange RMW code more logically together. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ilpo Järvinen <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]>
1 parent 9a9eec4 commit f00e8db

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

drivers/pci/pcie/dpc.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
#include "portdrv.h"
1919
#include "../pci.h"
2020

21+
#define PCI_EXP_DPC_CTL_EN_MASK (PCI_EXP_DPC_CTL_EN_FATAL | \
22+
PCI_EXP_DPC_CTL_EN_NONFATAL)
23+
2124
static const char * const rp_pio_error_string[] = {
2225
"Configuration Request received UR Completion", /* Bit Position 0 */
2326
"Configuration Request received CA Completion", /* Bit Position 1 */
@@ -369,12 +372,13 @@ static int dpc_probe(struct pcie_device *dev)
369372
}
370373

371374
pci_read_config_word(pdev, pdev->dpc_cap + PCI_EXP_DPC_CAP, &cap);
372-
pci_read_config_word(pdev, pdev->dpc_cap + PCI_EXP_DPC_CTL, &ctl);
373375

374-
ctl = (ctl & 0xfff4) | PCI_EXP_DPC_CTL_EN_FATAL | PCI_EXP_DPC_CTL_INT_EN;
376+
pci_read_config_word(pdev, pdev->dpc_cap + PCI_EXP_DPC_CTL, &ctl);
377+
ctl &= ~PCI_EXP_DPC_CTL_EN_MASK;
378+
ctl |= PCI_EXP_DPC_CTL_EN_FATAL | PCI_EXP_DPC_CTL_INT_EN;
375379
pci_write_config_word(pdev, pdev->dpc_cap + PCI_EXP_DPC_CTL, ctl);
376-
pci_info(pdev, "enabled with IRQ %d\n", dev->irq);
377380

381+
pci_info(pdev, "enabled with IRQ %d\n", dev->irq);
378382
pci_info(pdev, "error containment capabilities: Int Msg #%d, RPExt%c PoisonedTLP%c SwTrigger%c RP PIO Log %d, DL_ActiveErr%c\n",
379383
cap & PCI_EXP_DPC_IRQ, FLAG(cap, PCI_EXP_DPC_CAP_RP_EXT),
380384
FLAG(cap, PCI_EXP_DPC_CAP_POISONED_TLP),

0 commit comments

Comments
 (0)