diff options
author | Kevin Friedberg <kev.friedberg@gmail.com> | 2023-02-16 05:41:34 +0100 |
---|---|---|
committer | Jes Sorensen <jes@trained-monkey.org> | 2023-05-08 22:28:15 +0200 |
commit | 75350d87c86001c47076e1f62478079bdc072223 (patch) | |
tree | 738f5a17d7ec1bb2fb3d881950c3cf681eacb9ea /platform-intel.c | |
parent | mdadm: numbered names verification (diff) | |
download | mdadm-75350d87c86001c47076e1f62478079bdc072223.tar.xz mdadm-75350d87c86001c47076e1f62478079bdc072223.zip |
enable RAID for SATA under VMD
Detect when a SATA controller has been mapped under Intel Alderlake RST
VMD, so that it can use the VMD controller's RAID capabilities. Create
new device type SYS_DEV_SATA_VMD and list separate controller to prevent
mixing with the NVMe SYS_DEV_VMD devices on the same VMD domain.
Signed-off-by: Kevin Friedberg <kev.friedberg@gmail.com>
Signed-off-by: Jes Sorensen <jes@trained-monkey.org>
Diffstat (limited to 'platform-intel.c')
-rw-r--r-- | platform-intel.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/platform-intel.c b/platform-intel.c index 757f0b1b..914164c0 100644 --- a/platform-intel.c +++ b/platform-intel.c @@ -64,9 +64,10 @@ struct sys_dev *find_driver_devices(const char *bus, const char *driver) if (strcmp(driver, "isci") == 0) type = SYS_DEV_SAS; - else if (strcmp(driver, "ahci") == 0) + else if (strcmp(driver, "ahci") == 0) { + vmd = find_driver_devices("pci", "vmd"); type = SYS_DEV_SATA; - else if (strcmp(driver, "nvme") == 0) { + } else if (strcmp(driver, "nvme") == 0) { /* if looking for nvme devs, first look for vmd */ vmd = find_driver_devices("pci", "vmd"); type = SYS_DEV_NVME; @@ -115,6 +116,17 @@ struct sys_dev *find_driver_devices(const char *bus, const char *driver) free(rp); } + /* change sata type if under a vmd controller */ + if (type == SYS_DEV_SATA) { + struct sys_dev *dev; + char *rp = realpath(path, NULL); + for (dev = vmd; dev; dev = dev->next) { + if ((strncmp(dev->path, rp, strlen(dev->path)) == 0)) + type = SYS_DEV_SATA_VMD; + } + free(rp); + } + /* if it's not Intel device or mark as VMD connected - skip it. */ if (devpath_to_vendor(path) != 0x8086 || skip == 1) continue; @@ -166,7 +178,8 @@ struct sys_dev *find_driver_devices(const char *bus, const char *driver) } closedir(driver_dir); - if (vmd) { + /* nvme vmd needs a list separate from sata vmd */ + if (vmd && type == SYS_DEV_NVME) { if (list) list->next = vmd; else @@ -273,6 +286,7 @@ struct sys_dev *find_intel_devices(void) free_sys_dev(&intel_devices); isci = find_driver_devices("pci", "isci"); + /* Searching for AHCI will return list of SATA and SATA VMD controllers */ ahci = find_driver_devices("pci", "ahci"); /* Searching for NVMe will return list of NVMe and VMD controllers */ nvme = find_driver_devices("pci", "nvme"); @@ -638,6 +652,7 @@ const struct imsm_orom *find_imsm_efi(struct sys_dev *hba) break; case SYS_DEV_VMD: + case SYS_DEV_SATA_VMD: for (i = 0; i < ARRAY_SIZE(vmd_efivars); i++) { if (!read_efi_variable(&orom, sizeof(orom), vmd_efivars[i], VENDOR_GUID)) |