From ae126e0e427f4a5b82ecc9c096c524d45088a430 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Thu, 28 Mar 2024 19:51:03 -0400 Subject: kernel: pci: Add command register helpers Signed-off-by: Ian Moffett --- sys/dev/pci/pci.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'sys/dev/pci') 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) { -- cgit v1.2.3