summaryrefslogtreecommitdiff
path: root/sys/dev/pci/pci.c
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-03-28 19:51:03 -0400
committerIan Moffett <ian@osmora.org>2024-03-28 19:51:03 -0400
commitae126e0e427f4a5b82ecc9c096c524d45088a430 (patch)
treefedfe0ffe997486732cd4accc5dd9f069c3dfd01 /sys/dev/pci/pci.c
parent4fc22f9295061d17e11828af625d9f92aabfb4a5 (diff)
kernel: pci: Add command register helpers
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/dev/pci/pci.c')
-rw-r--r--sys/dev/pci/pci.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c
index 57133bf..c4383e6 100644
--- a/sys/dev/pci/pci.c
+++ b/sys/dev/pci/pci.c
@@ -212,6 +212,21 @@ pci_writel(struct pci_device *dev, uint32_t offset, uint32_t val)
__builtin_unreachable();
}
+/*
+ * Set command register bits.
+ *
+ * @dev: Device whose command register to modify.
+ * @bits: Bits to set.
+ */
+void
+pci_set_cmdreg(struct pci_device *dev, uint16_t bits)
+{
+ uint32_t tmp;
+
+ tmp = pci_readl(dev, 0x4) | bits;
+ pci_writel(dev, 0x4, tmp);
+}
+
struct pci_device *
pci_get_device(struct pci_lookup lookup, uint16_t lookup_type)
{