diff options
Diffstat (limited to 'platform-intel.c')
-rw-r--r-- | platform-intel.c | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/platform-intel.c b/platform-intel.c index ac282bc5..40e8fb82 100644 --- a/platform-intel.c +++ b/platform-intel.c @@ -32,6 +32,63 @@ #define NVME_SUBSYS_PATH "/sys/devices/virtual/nvme-subsystem/" +static bool imsm_orom_has_raid0(const struct imsm_orom *orom) +{ + return imsm_rlc_has_bit(orom, IMSM_OROM_RLC_RAID0); +} + +static bool imsm_orom_has_raid1(const struct imsm_orom *orom) +{ + return imsm_rlc_has_bit(orom, IMSM_OROM_RLC_RAID1); +} + +static bool imsm_orom_has_raid10(const struct imsm_orom *orom) +{ + return imsm_rlc_has_bit(orom, IMSM_OROM_RLC_RAID10); +} + +static bool imsm_orom_has_raid5(const struct imsm_orom *orom) +{ + return imsm_rlc_has_bit(orom, IMSM_OROM_RLC_RAID5); +} + +/* IMSM platforms do not define how many disks are allowed for each level, + * but there are some global limitations we need to follow. + */ +static bool imsm_orom_support_raid_disks_count_raid0(const int raid_disks) +{ + return true; +} + +static bool imsm_orom_support_raid_disks_count_raid1(const int raid_disks) +{ + if (raid_disks == 2) + return true; + return false; +} + +static bool imsm_orom_support_raid_disks_count_raid5(const int raid_disks) +{ + if (raid_disks > 2) + return true; + return false; +} + +static bool imsm_orom_support_raid_disks_count_raid10(const int raid_disks) +{ + if (raid_disks == 4) + return true; + return false; +} + +struct imsm_level_ops imsm_level_ops[] = { + {0, imsm_orom_has_raid0, imsm_orom_support_raid_disks_count_raid0, "raid0"}, + {1, imsm_orom_has_raid1, imsm_orom_support_raid_disks_count_raid1, "raid1"}, + {5, imsm_orom_has_raid5, imsm_orom_support_raid_disks_count_raid5, "raid5"}, + {10, imsm_orom_has_raid10, imsm_orom_support_raid_disks_count_raid10, "raid10"}, + {-1, NULL, NULL, NULL} +}; + static int devpath_to_ll(const char *dev_path, const char *entry, unsigned long long *val); |