On Thu, Aug 15, 2024 at 11:04:32PM -0600, Theo de Raadt wrote:
> I'm no sure we should call it "BROKEN SUSPEND".
> It suspends, in our way.  It just has a bug in CRS for RESUME.
> 
> So maybe BROKEN_CRS?

NOCRS?

Index: sys/dev/usb/xhci.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/xhci.c,v
diff -u -p -r1.133 xhci.c
--- sys/dev/usb/xhci.c  15 Aug 2024 17:17:05 -0000      1.133
+++ sys/dev/usb/xhci.c  16 Aug 2024 05:14:59 -0000
@@ -463,7 +463,7 @@ xhci_config(struct xhci_softc *sc)
         * it here.  Otherwise some Intel controllers don't function
         * correctly after resume.
         */
-       if (sc->sc_saved_state) {
+       if (sc->sc_saved_state && (sc->sc_flags & XHCI_NOCRS) == 0) {
                XOWRITE4(sc, XHCI_USBCMD, XHCI_CMD_CRS); /* Restore state */
                hcr = XOREAD4(sc, XHCI_USBSTS);
                for (i = 0; i < 100; i++) {
Index: sys/dev/usb/xhcivar.h
===================================================================
RCS file: /cvs/src/sys/dev/usb/xhcivar.h,v
diff -u -p -r1.15 xhcivar.h
--- sys/dev/usb/xhcivar.h       15 Aug 2024 17:17:05 -0000      1.15
+++ sys/dev/usb/xhcivar.h       16 Aug 2024 05:15:43 -0000
@@ -121,6 +121,9 @@ struct xhci_softc {
 
        char                     sc_vendor[16]; /* Vendor string for root hub */
        int                      sc_id_vendor;  /* Vendor ID for root hub */
+       
+       int                      sc_flags;
+#define XHCI_NOCRS              0x01
 };
 
 int    xhci_init(struct xhci_softc *);
Index: sys/dev/pci/xhci_pci.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/xhci_pci.c,v
diff -u -p -r1.13 xhci_pci.c
--- sys/dev/pci/xhci_pci.c      24 May 2024 06:02:58 -0000      1.13
+++ sys/dev/pci/xhci_pci.c      16 Aug 2024 05:16:00 -0000
@@ -150,6 +164,11 @@ xhci_pci_attach(struct device *parent, s
                 if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_FRESCO_FL1000 ||
                     PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_FRESCO_FL1400)
                        pa->pa_flags &= ~PCI_FLAGS_MSI_ENABLED;
+               break;
+       case PCI_VENDOR_AMD:
+               if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_AMD_17_1X_XHCI_1 ||
+                   PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_AMD_17_1X_XHCI_2)
+                       psc->sc.sc_flags |= XHCI_NOCRS;
                break;
        }
 

Reply via email to