dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

Blame SOURCES/mdadm-3.3.2-imsm-support-for-second-and-combined-AHCI-controller.patch

2ddfcf
From 81188ef870ead9121d66287eb2ced28a25a1e8d4 Mon Sep 17 00:00:00 2001
2ddfcf
From: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
2ddfcf
Date: Wed, 19 Nov 2014 13:53:27 +0100
2ddfcf
Subject: [PATCH] imsm: support for second and combined AHCI controllers in
2ddfcf
 UEFI mode
2ddfcf
2ddfcf
Grantly platform introduces a second AHCI controller (sSATA) and two new
2ddfcf
UEFI variables for the RSTe firmware. This patch adds support for those
2ddfcf
variables in order to correctly determine IMSM platform capabilities in
2ddfcf
UEFI mode.
2ddfcf
2ddfcf
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
2ddfcf
Signed-off-by: NeilBrown <neilb@suse.de>
2ddfcf
---
2ddfcf
 platform-intel.c | 24 +++++++++++++++++++++++-
2ddfcf
 1 file changed, 23 insertions(+), 1 deletion(-)
2ddfcf
2ddfcf
diff --git a/platform-intel.c b/platform-intel.c
2ddfcf
index f779d02..c5a0aa4 100644
2ddfcf
--- a/platform-intel.c
2ddfcf
+++ b/platform-intel.c
2ddfcf
@@ -401,6 +401,8 @@ static const struct imsm_orom *find_imsm_hba_orom(struct sys_dev *hba)
2ddfcf
 #define SYS_EFI_VAR_PATH "/sys/firmware/efi/vars"
2ddfcf
 #define SCU_PROP "RstScuV"
2ddfcf
 #define AHCI_PROP "RstSataV"
2ddfcf
+#define AHCI_SSATA_PROP "RstsSatV"
2ddfcf
+#define AHCI_CSATA_PROP "RstCSatV"
2ddfcf
 
2ddfcf
 #define VENDOR_GUID \
2ddfcf
 	EFI_GUID(0x193dfefa, 0xa445, 0x4302, 0x99, 0xd8, 0xef, 0x3a, 0xad, 0x1a, 0x04, 0xc6)
2ddfcf
@@ -455,6 +457,7 @@ const struct imsm_orom *find_imsm_efi(struct sys_dev *hba)
2ddfcf
 {
2ddfcf
 	struct imsm_orom orom;
2ddfcf
 	const struct imsm_orom *ret;
2ddfcf
+	int err;
2ddfcf
 
2ddfcf
 	if (check_env("IMSM_TEST_AHCI_EFI") || check_env("IMSM_TEST_SCU_EFI"))
2ddfcf
 		return imsm_platform_test(hba);
2ddfcf
@@ -466,7 +469,26 @@ const struct imsm_orom *find_imsm_efi(struct sys_dev *hba)
2ddfcf
 	if (hba->type == SYS_DEV_SATA && hba->class != PCI_CLASS_RAID_CNTRL)
2ddfcf
 		return NULL;
2ddfcf
 
2ddfcf
-	if (read_efi_variable(&orom, sizeof(orom), hba->type == SYS_DEV_SAS ? SCU_PROP : AHCI_PROP, VENDOR_GUID))
2ddfcf
+	err = read_efi_variable(&orom, sizeof(orom), hba->type == SYS_DEV_SAS ? SCU_PROP : AHCI_PROP, VENDOR_GUID);
2ddfcf
+
2ddfcf
+	/* try to read variable for second AHCI controller */
2ddfcf
+	if (err && hba->type == SYS_DEV_SATA)
2ddfcf
+		err = read_efi_variable(&orom, sizeof(orom), AHCI_SSATA_PROP, VENDOR_GUID);
2ddfcf
+
2ddfcf
+	/* try to read variable for combined AHCI controllers */
2ddfcf
+	if (err && hba->type == SYS_DEV_SATA) {
2ddfcf
+		static const struct imsm_orom *csata;
2ddfcf
+
2ddfcf
+		err = read_efi_variable(&orom, sizeof(orom), AHCI_CSATA_PROP, VENDOR_GUID);
2ddfcf
+		if (!err) {
2ddfcf
+			if (!csata)
2ddfcf
+				csata = add_orom(&orom;;
2ddfcf
+			add_orom_device_id(csata, hba->dev_id);
2ddfcf
+			return csata;
2ddfcf
+		}
2ddfcf
+	}
2ddfcf
+
2ddfcf
+	if (err)
2ddfcf
 		return NULL;
2ddfcf
 
2ddfcf
 	ret = add_orom(&orom;;
2ddfcf
-- 
2ddfcf
2.4.3
2ddfcf