From: kn Date: Sun, 16 Jun 2024 18:00:08 +0000 (+0000) Subject: Disable MSI on Zhaoxin ZX-100/ZX-200/ZX-E StorX to unhang SSD X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=9406b56eb929f42aa2d612f2397127181fa02d3a;p=openbsd Disable MSI on Zhaoxin ZX-100/ZX-200/ZX-E StorX to unhang SSD The Unchartevice 6640MA's BIOS forces one of three SATA speeds: - Gen1/2: bsd.rd reaches installer, but SSD does not attach - Gen3: bsd.rd attaches SSD but hangs MSI works for iwm(4) and and xhci(4), only ahci(4) bugs out, so add a quirk for this controller as done for a few other devices already: ahci0 at pci0 dev 15 function 0 "Zhaoxin StorX AHCI" rev 0x01: apic 9 int 21, AHCI 1.3.1 -ahci0: device not communicating on port 0 +ahci0: port 0: 6.0Gb/s scsibus0 at ahci0: 32 targets +sd0 at scsibus0 targ 0 lun 0: naa.5000000000000000 +sd0: 244198MB, 512 bytes/sector, 500118192 sectors, thin OK kettenis --- diff --git a/sys/dev/pci/ahci_pci.c b/sys/dev/pci/ahci_pci.c index 183df336aaa..964abde5b0a 100644 --- a/sys/dev/pci/ahci_pci.c +++ b/sys/dev/pci/ahci_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ahci_pci.c,v 1.17 2024/05/24 06:02:53 jsg Exp $ */ +/* $OpenBSD: ahci_pci.c,v 1.18 2024/06/16 18:00:08 kn Exp $ */ /* * Copyright (c) 2006 David Gwynne @@ -71,6 +71,8 @@ int ahci_intel_attach(struct ahci_softc *, struct pci_attach_args *); int ahci_samsung_attach(struct ahci_softc *, struct pci_attach_args *); +int ahci_storx_attach(struct ahci_softc *, + struct pci_attach_args *); static const struct ahci_device ahci_devices[] = { { PCI_VENDOR_AMD, PCI_PRODUCT_AMD_HUDSON2_SATA_1, @@ -148,7 +150,10 @@ static const struct ahci_device ahci_devices[] = { NULL, ahci_samsung_attach }, { PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8251_SATA, - ahci_no_match, ahci_vt8251_attach } + ahci_no_match, ahci_vt8251_attach }, + + { PCI_VENDOR_ZHAOXIN, PCI_PRODUCT_ZHAOXIN_STORX_AHCI, + NULL, ahci_storx_attach }, }; int ahci_pci_match(struct device *, void *, void *); @@ -285,6 +290,19 @@ ahci_samsung_attach(struct ahci_softc *sc, struct pci_attach_args *pa) return (0); } +int +ahci_storx_attach(struct ahci_softc *sc, struct pci_attach_args *pa) +{ + /* + * Disable MSI with the ZX-100/ZX-200/ZX-E StorX AHCI Controller + * in the Unchartevice 6640MA notebook, otherwise ahci(4) hangs + * with SATA speed set to "Gen3" in BIOS. + */ + sc->sc_flags |= AHCI_F_NO_MSI; + + return (0); +} + int ahci_pci_match(struct device *parent, void *match, void *aux) {