Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP5:GA
mdadm.28032
0122-imsm-support-for-third-Sata-controller.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0122-imsm-support-for-third-Sata-controller.patch of Package mdadm.28032
From f94df5cf83917df50a3436dd067c751504bfc665 Mon Sep 17 00:00:00 2001 From: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> Date: Wed, 17 Mar 2021 13:01:54 +0100 Subject: [PATCH] imsm: support for third Sata controller Git-commit: f94df5cf83917df50a3436dd067c751504bfc665 Patch-mainline: mdadm-4.2-rc1~4 References: bsc#1201297 Add new UEFI TSata variable. Remove CSata variable. This variable has been never exposed by UEFI. Remove vulnerability to match different hbas with SATA variable. Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> Signed-off-by: Jes Sorensen <jsorensen@fb.com> Acked-by: Coly Li <colyli@suse.de> --- platform-intel.c | 58 ++++++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/platform-intel.c b/platform-intel.c index 0e1ec3d..2da152f 100644 --- a/platform-intel.c +++ b/platform-intel.c @@ -488,7 +488,7 @@ static const struct imsm_orom *find_imsm_hba_orom(struct sys_dev *hba) #define SCU_PROP "RstScuV" #define AHCI_PROP "RstSataV" #define AHCI_SSATA_PROP "RstsSatV" -#define AHCI_CSATA_PROP "RstCSatV" +#define AHCI_TSATA_PROP "RsttSatV" #define VMD_PROP "RstUefiV" #define VENDOR_GUID \ @@ -496,7 +496,8 @@ static const struct imsm_orom *find_imsm_hba_orom(struct sys_dev *hba) #define PCI_CLASS_RAID_CNTRL 0x010400 -static int read_efi_var(void *buffer, ssize_t buf_size, char *variable_name, struct efi_guid guid) +static int read_efi_var(void *buffer, ssize_t buf_size, + const char *variable_name, struct efi_guid guid) { char path[PATH_MAX]; char buf[GUID_STR_MAX]; @@ -525,7 +526,8 @@ static int read_efi_var(void *buffer, ssize_t buf_size, char *variable_name, str return 0; } -static int read_efi_variable(void *buffer, ssize_t buf_size, char *variable_name, struct efi_guid guid) +static int read_efi_variable(void *buffer, ssize_t buf_size, + const char *variable_name, struct efi_guid guid) { char path[PATH_MAX]; char buf[GUID_STR_MAX]; @@ -578,7 +580,9 @@ const struct imsm_orom *find_imsm_efi(struct sys_dev *hba) { struct imsm_orom orom; struct orom_entry *ret; - int err; + static const char * const sata_efivars[] = {AHCI_PROP, AHCI_SSATA_PROP, + AHCI_TSATA_PROP}; + unsigned long i; if (check_env("IMSM_TEST_AHCI_EFI") || check_env("IMSM_TEST_SCU_EFI")) return imsm_platform_test(hba); @@ -587,35 +591,35 @@ const struct imsm_orom *find_imsm_efi(struct sys_dev *hba) if (check_env("IMSM_TEST_OROM")) return NULL; - if (hba->type == SYS_DEV_SATA && hba->class != PCI_CLASS_RAID_CNTRL) - return NULL; - - err = read_efi_variable(&orom, sizeof(orom), hba->type == SYS_DEV_SAS ? SCU_PROP : AHCI_PROP, VENDOR_GUID); + switch (hba->type) { + case SYS_DEV_SAS: + if (!read_efi_variable(&orom, sizeof(orom), SCU_PROP, + VENDOR_GUID)) + break; - /* try to read variable for second AHCI controller */ - if (err && hba->type == SYS_DEV_SATA) - err = read_efi_variable(&orom, sizeof(orom), AHCI_SSATA_PROP, VENDOR_GUID); + return NULL; + case SYS_DEV_SATA: + if (hba->class != PCI_CLASS_RAID_CNTRL) + return NULL; - /* try to read variable for combined AHCI controllers */ - if (err && hba->type == SYS_DEV_SATA) { - static struct orom_entry *csata; + for (i = 0; i < ARRAY_SIZE(sata_efivars); i++) { + if (!read_efi_variable(&orom, sizeof(orom), + sata_efivars[i], VENDOR_GUID)) + break; - err = read_efi_variable(&orom, sizeof(orom), AHCI_CSATA_PROP, VENDOR_GUID); - if (!err) { - if (!csata) - csata = add_orom(&orom); - add_orom_device_id(csata, hba->dev_id); - csata->type = hba->type; - return &csata->orom; } - } + if (i == ARRAY_SIZE(sata_efivars)) + return NULL; - if (hba->type == SYS_DEV_VMD) { - err = read_efi_variable(&orom, sizeof(orom), VMD_PROP, VENDOR_GUID); - } - - if (err) + break; + case SYS_DEV_VMD: + if (!read_efi_variable(&orom, sizeof(orom), VMD_PROP, + VENDOR_GUID)) + break; return NULL; + default: + return NULL; + } ret = add_orom(&orom); add_orom_device_id(ret, hba->dev_id); -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor