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
This commit is contained in:
Warner Losh 2021-12-06 10:23:06 -07:00
parent 053f8ed6eb
commit 7cf8d63c88
2 changed files with 9 additions and 1 deletions

View File

@ -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,

View File

@ -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;