diff options
author | Artur Paszkiewicz <artur.paszkiewicz@intel.com> | 2014-11-19 13:53:26 +0100 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2014-11-25 01:34:02 +0100 |
commit | 6b781d331bf52b01b9bafa6409ffb400f8c62895 (patch) | |
tree | b2f03c01cffe4e22ab0cf7b6bf8bb47b02dc6df2 /platform-intel.h | |
parent | Incremental: don't be distracted by partition table when calling try_spare. (diff) | |
download | mdadm-6b781d331bf52b01b9bafa6409ffb400f8c62895.tar.xz mdadm-6b781d331bf52b01b9bafa6409ffb400f8c62895.zip |
imsm: support for OROMs shared by multiple HBAs
The IMSM platform code was based on an assumption that the OROM or UEFI
capability structure (represented by struct imsm_orom) always belongs to
only one HBA. This assumption is no longer valid, because of newer
platforms with dual AHCI HBAs. Each HBA can have a separate OROM, but
some versions have a combined OROM for both HBAs.
This patch implements this HBA-OROM relationship in struct orom_entry,
which matches an OROM with a list of HBA PCI ids. All the detected
orom_entries are stored and retrieved using a global array and the
functions add_orom(), add_orom_device_id() and get_orom_by_device_id().
This replaces the arrays: imsm_orom, populated_orom, imsm_efi,
populated_efi.
The scan() function is extended to find all HBAs for an OROM. The list
of their device ids is retrieved from the PCI Expansion ROM Data
Structure, hence the additional field devListOffset in struct
pciExpDataStructFormat.
In UEFI mode we can't read the PCI Expansion ROM Data Structure and the
imsm_orom structures are stored in UEFI variables. They do not provide a
similar device id list, so we also check the HBA PCI class to make sure
that the HBA has RAID mode enabled.
In super-intel.c there are changes which allow spanning of IMSM
containers over HBAs of the same type, but only if the HBAs share the
same OROM. This is done by comparing imsm_orom pointers, which (outside
of platform-intel.c) always point to the global array containing all the
detected oroms. Additional warnings are added to
validate_container_imsm() to warn about potentially dangerous operations
in all the possible cases, e.g. when an array is assembled using disks
attached to HBAs with separate OROMs.
Signed-off-by: Artur Paszkiewicz <artur.paszkiewicz@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'platform-intel.h')
-rw-r--r-- | platform-intel.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/platform-intel.h b/platform-intel.h index 8226be35..e41f386e 100644 --- a/platform-intel.h +++ b/platform-intel.h @@ -22,6 +22,7 @@ /* The IMSM Capability (IMSM AHCI and ISCU OROM/EFI variable) Version Table definition */ struct imsm_orom { __u8 signature[4]; + #define IMSM_OROM_SIGNATURE "$VER" __u8 table_ver_major; /* Currently 2 (can change with future revs) */ __u8 table_ver_minor; /* Currently 2 (can change with future revs) */ __u16 major_ver; /* Example: 8 as in 8.6.0.1020 */ @@ -180,6 +181,7 @@ struct sys_dev { char *path; char *pci_id; __u16 dev_id; + __u32 class; struct sys_dev *next; }; @@ -201,10 +203,11 @@ static inline char *guid_str(char *buf, struct efi_guid guid) char *diskfd_to_devpath(int fd); struct sys_dev *find_driver_devices(const char *bus, const char *driver); struct sys_dev *find_intel_devices(void); -const struct imsm_orom *find_imsm_capability(enum sys_dev_type hba_id); +const struct imsm_orom *find_imsm_capability(struct sys_dev *hba); const struct imsm_orom *find_imsm_orom(void); int disk_attached_to_hba(int fd, const char *hba_path); int devt_attached_to_hba(dev_t dev, const char *hba_path); char *devt_to_devpath(dev_t dev); int path_attached_to_hba(const char *disk_path, const char *hba_path); const char *get_sys_dev_type(enum sys_dev_type); +const struct imsm_orom *get_orom_by_device_id(__u16 device_id); |