git: 7cf8d63c884c - main - nvme_ahci: Mark AHCI devices as such in the controller
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 06 Dec 2021 17:25:42 UTC
The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=7cf8d63c884c484fee9b287f792549ee15270ae7 commit 7cf8d63c884c484fee9b287f792549ee15270ae7 Author: Warner Losh <imp@FreeBSD.org> AuthorDate: 2021-12-06 17:23:06 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2021-12-06 17:23:40 +0000 nvme_ahci: Mark AHCI devices as such in the controller Add a quirk to flag AHCI attachment to the controller. This is for any of the strategies for attaching nvme devices as children of the AHCI device for Intel's RAID devices. This also has a side effect of cleaning up resource allocation from failed nvme_attach calls now. Sponsored by: Netflix Reviewed by: mav Differential Revision: https://reviews.freebsd.org/D33285 --- sys/dev/nvme/nvme_ahci.c | 9 ++++++++- sys/dev/nvme/nvme_private.h | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/sys/dev/nvme/nvme_ahci.c b/sys/dev/nvme/nvme_ahci.c index 8542f6f55246..b2d5813537c3 100644 --- a/sys/dev/nvme/nvme_ahci.c +++ b/sys/dev/nvme/nvme_ahci.c @@ -104,7 +104,14 @@ nvme_ahci_attach(device_t dev) } ctrlr->tag = (void *)0x1; - return nvme_attach(dev); + /* + * We're attached via this funky mechanism. Flag the controller so that + * it avoids things that can't work when we do that, like asking for + * PCI config space entries. + */ + ctrlr->quirks |= QUIRK_AHCI; + + return (nvme_attach(dev)); /* Note: failure frees resources */ bad: if (ctrlr->resource != NULL) { bus_release_resource(dev, SYS_RES_MEMORY, diff --git a/sys/dev/nvme/nvme_private.h b/sys/dev/nvme/nvme_private.h index 3f89f12cf8fd..c889246f9350 100644 --- a/sys/dev/nvme/nvme_private.h +++ b/sys/dev/nvme/nvme_private.h @@ -241,6 +241,7 @@ struct nvme_controller { #define QUIRK_DELAY_B4_CHK_RDY 1 /* Can't touch MMIO on disable */ #define QUIRK_DISABLE_TIMEOUT 2 /* Disable broken completion timeout feature */ #define QUIRK_INTEL_ALIGNMENT 4 /* Pre NVMe 1.3 performance alignment */ +#define QUIRK_AHCI 8 /* Attached via AHCI redirect */ bus_space_tag_t bus_tag; bus_space_handle_t bus_handle;