From f0b298f8a7f946e61a2fc40519753fa4980c05ec Mon Sep 17 00:00:00 2001 From: jsg Date: Wed, 13 Sep 2023 12:31:49 +0000 Subject: [PATCH] add pcie_capability_set_word() pcie_capability_clear_and_set_word() needed for 6.1.53 drm --- sys/dev/pci/drm/include/linux/pci.h | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/sys/dev/pci/drm/include/linux/pci.h b/sys/dev/pci/drm/include/linux/pci.h index 3f8de6b8616..b5b51337f9d 100644 --- a/sys/dev/pci/drm/include/linux/pci.h +++ b/sys/dev/pci/drm/include/linux/pci.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pci.h,v 1.13 2023/01/01 01:34:58 jsg Exp $ */ +/* $OpenBSD: pci.h,v 1.14 2023/09/13 12:31:49 jsg Exp $ */ /* * Copyright (c) 2015 Mark Kettenis * @@ -305,6 +305,27 @@ pcie_capability_write_word(struct pci_dev *pdev, int off, u16 val) return 0; } +static inline int +pcie_capability_set_word(struct pci_dev *pdev, int off, u16 val) +{ + u16 r; + pcie_capability_read_word(pdev, off, &r); + r |= val; + pcie_capability_write_word(pdev, off, r); + return 0; +} + +static inline int +pcie_capability_clear_and_set_word(struct pci_dev *pdev, int off, u16 c, u16 s) +{ + u16 r; + pcie_capability_read_word(pdev, off, &r); + r &= ~c; + r |= s; + pcie_capability_write_word(pdev, off, r); + return 0; +} + static inline int pcie_get_readrq(struct pci_dev *pdev) { -- 2.20.1