I have two devices here based on the JMicron JMB585 chipset. This diff
adds the required pcidev IDs and sets disables native command queuing in
the driver. FreeBSD does something similar for this device:

https://github.com/freebsd/freebsd-src/commit/16b766eed443043f4216d50e40ba283e74f992c2

I've tested both devices on amd64 and riscv64 and it seems to be working well.

On my amd64 machine dmesg shows:

ahci0 at pci1 dev 0 function 0 "JMicron JMB585 SATA/AHCI" rev 0x00: msi,
AHCI 1.3.1

Thanks,

Ash


Index: sys/dev/pci/pcidevs
===================================================================
RCS file: /cvs/src/sys/dev/pci/pcidevs,v
retrieving revision 1.1975
diff -u -p -u -p -r1.1975 pcidevs
--- sys/dev/pci/pcidevs 18 Jul 2021 05:02:08 -0000      1.1975
+++ sys/dev/pci/pcidevs 23 Jul 2021 01:27:53 -0000
@@ -6400,6 +6400,7 @@ product ITT ITT3204               0x0002  ITT3204 MPEG
 /* JMicron */
 product JMICRON JMC250         0x0250  JMC250
 product JMICRON JMC260         0x0260  JMC260
+product JMICRON JMB585         0x0585  JMB585 SATA/AHCI
 product JMICRON JMB360         0x2360  JMB360 SATA
 product JMICRON JMB361         0x2361  JMB361 IDE/SATA
 product JMICRON JMB362         0x2362  JMB362 SATA
Index: sys/dev/pci/ahci_pci.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/ahci_pci.c,v
retrieving revision 1.15
diff -u -p -u -p -r1.15 ahci_pci.c
--- sys/dev/pci/ahci_pci.c      3 Aug 2018 22:18:13 -0000       1.15
+++ sys/dev/pci/ahci_pci.c      23 Jul 2021 01:28:02 -0000
@@ -76,6 +76,8 @@ int                   ahci_amd_hudson2_attach(struct ahc
                            struct pci_attach_args *);
 int                    ahci_intel_attach(struct ahci_softc *,
                            struct pci_attach_args *);
+int                    ahci_jmicron_jmb58x_attach(struct ahci_softc *,
+                           struct pci_attach_args *);
 int                    ahci_samsung_attach(struct ahci_softc *,
                            struct pci_attach_args *);
 
@@ -147,6 +149,9 @@ static const struct ahci_device ahci_dev
        { PCI_VENDOR_INTEL,     PCI_PRODUCT_INTEL_EP80579_AHCI,
            NULL,               ahci_intel_attach },
 
+       { PCI_VENDOR_JMICRON,   PCI_PRODUCT_JMICRON_JMB585,
+           NULL,               ahci_jmicron_jmb58x_attach },
+
        { PCI_VENDOR_SAMSUNG2,  PCI_PRODUCT_SAMSUNG2_S4LN053X01,
            NULL,               ahci_samsung_attach },
        { PCI_VENDOR_SAMSUNG2,  PCI_PRODUCT_SAMSUNG2_XP941,
@@ -288,6 +293,14 @@ ahci_samsung_attach(struct ahci_softc *s
         * https://bugzilla.kernel.org/show_bug.cgi?id=89171
         */
        sc->sc_flags |= AHCI_F_NO_MSI;
+
+       return (0);
+}
+
+int
+ahci_jmicron_jmb58x_attach(struct ahci_softc *sc, struct pci_attach_args *pa)
+{
+       sc->sc_flags |= AHCI_F_NO_NCQ;
 
        return (0);
 }

Reply via email to