-/* $OpenBSD: drm_linux.c,v 1.90 2022/02/07 13:16:42 kettenis Exp $ */
+/* $OpenBSD: drm_linux.c,v 1.91 2022/02/28 02:40:16 jsg Exp $ */
/*
* Copyright (c) 2013 Jonathan Gray <jsg@openbsd.org>
* Copyright (c) 2015, 2016 Mark Kettenis <kettenis@openbsd.org>
return PCIE_LNK_WIDTH_UNKNOWN;
}
+bool
+pcie_aspm_enabled(struct pci_dev *pdev)
+{
+ pci_chipset_tag_t pc = pdev->pc;
+ pcitag_t tag = pdev->tag;
+ int pos ;
+ pcireg_t lcsr;
+
+ if (!pci_get_capability(pc, tag, PCI_CAP_PCIEXPRESS,
+ &pos, NULL))
+ return false;
+
+ lcsr = pci_conf_read(pc, tag, pos + PCI_PCIE_LCSR);
+ if ((lcsr & (PCI_PCIE_LCSR_ASPM_L0S | PCI_PCIE_LCSR_ASPM_L1)) != 0)
+ return true;
+
+ return false;
+}
+
int
autoremove_wake_function(struct wait_queue_entry *wqe, unsigned int mode,
int sync, void *key)
-/* $OpenBSD: pci.h,v 1.8 2022/01/14 06:53:14 jsg Exp $ */
+/* $OpenBSD: pci.h,v 1.9 2022/02/28 02:40:16 jsg Exp $ */
/*
* Copyright (c) 2015 Mark Kettenis
*
return pos;
}
+bool pcie_aspm_enabled(struct pci_dev *);
+
static inline bool
pci_is_pcie(struct pci_dev *pdev)
{