File 1005-mdadm-enable-Intel-Alderlake-RSTe-configuration.patch of Package mdadm.28825

From 449c8b62164880ab132ad6eec86a8d53f793af69 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Tue, 19 Jul 2022 13:18:23 +0800
Subject: [PATCH 19/23] mdadm: enable Intel Alderlake RSTe configuration
Patch-mainline: N/A, SUSE only patch
References: bsc#1201297, bsc#1207868

Alderlake has a slightly different RST configuration; the UEFI
variable is name 'RstVmdV', and the AHCI controller shows up as
a child device of the VMD bridge, but continues to use the 'AHCI HBA'
PCI class (and not the RAID class as RSTe would normally do).

Signed-off-by: Hannes Reinecke <hare@suse.de>
Acked-by: Coly Li <colyli@suse.de>
---
 platform-intel.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

Index: mdadm-4.1/platform-intel.c
===================================================================
--- mdadm-4.1.orig/platform-intel.c
+++ mdadm-4.1/platform-intel.c
@@ -489,12 +489,14 @@ static const struct imsm_orom *find_imsm
 #define AHCI_PROP "RstSataV"
 #define AHCI_SSATA_PROP "RstsSatV"
 #define AHCI_TSATA_PROP "RsttSatV"
+#define AHCI_RST_PROP "RstVmdV"
 #define VMD_PROP "RstUefiV"
 
 #define VENDOR_GUID \
 	EFI_GUID(0x193dfefa, 0xa445, 0x4302, 0x99, 0xd8, 0xef, 0x3a, 0xad, 0x1a, 0x04, 0xc6)
 
 #define PCI_CLASS_RAID_CNTRL 0x010400
+#define PCI_CLASS_SATA_HBA 0x010601
 
 static int read_efi_var(void *buffer, ssize_t buf_size,
 			const char *variable_name, struct efi_guid guid)
@@ -581,7 +583,8 @@ const struct imsm_orom *find_imsm_efi(struct sys_dev *hba)
 	struct imsm_orom orom;
 	struct orom_entry *ret;
 	static const char * const sata_efivars[] = {AHCI_PROP, AHCI_SSATA_PROP,
-						    AHCI_TSATA_PROP};
+						    AHCI_TSATA_PROP,
+						    AHCI_RST_PROP};
 	unsigned long i;
 
 	if (check_env("IMSM_TEST_AHCI_EFI") || check_env("IMSM_TEST_SCU_EFI"))
@@ -599,7 +602,8 @@ const struct imsm_orom *find_imsm_efi(struct sys_dev *hba)
 
 		return NULL;
 	case SYS_DEV_SATA:
-		if (hba->class != PCI_CLASS_RAID_CNTRL)
+		if (hba->class != PCI_CLASS_RAID_CNTRL &&
+		    hba->class != PCI_CLASS_SATA_HBA)
 			return NULL;
 
 		for (i = 0; i < ARRAY_SIZE(sata_efivars); i++) {
@@ -616,6 +620,9 @@ const struct imsm_orom *find_imsm_efi(struct sys_dev *hba)
 		if (!read_efi_variable(&orom, sizeof(orom), VMD_PROP,
 				       VENDOR_GUID))
 			break;
+		if (!read_efi_variable(&orom, sizeof(orom), AHCI_RST_PROP,
+				       VENDOR_GUID))
+			break;
 		return NULL;
 	default:
 		return NULL;
openSUSE Build Service is sponsored by