]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
imsm: detail_platform_imsm displays AHCI and SAS controller information
authorLabun, Marcin <Marcin.Labun@intel.com>
Thu, 10 Mar 2011 00:46:11 +0000 (11:46 +1100)
committerNeilBrown <neilb@suse.de>
Thu, 10 Mar 2011 00:46:11 +0000 (11:46 +1100)
The function uses find_intel_device and find_imsm_capability to present
AHCI and SAS controller capabilities taken from OROM or EFI.

Signed-off-by: Marcin Labun <marcin.labun@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
super-intel.c

index e5a53a4165c19139803b13fef8741e409c151ee6..200112de89078b207fc1c51a39f1b9b9d54688a8 100644 (file)
@@ -1346,6 +1346,39 @@ static int ahci_get_port_count(const char *hba_path, int *port_count)
        return host_base;
 }
 
+static void print_imsm_capability(const struct imsm_orom *orom)
+{
+       printf("       Platform : Intel(R) Matrix Storage Manager\n");
+       printf("        Version : %d.%d.%d.%d\n", orom->major_ver, orom->minor_ver,
+              orom->hotfix_ver, orom->build);
+       printf("    RAID Levels :%s%s%s%s%s\n",
+              imsm_orom_has_raid0(orom) ? " raid0" : "",
+              imsm_orom_has_raid1(orom) ? " raid1" : "",
+              imsm_orom_has_raid1e(orom) ? " raid1e" : "",
+              imsm_orom_has_raid10(orom) ? " raid10" : "",
+              imsm_orom_has_raid5(orom) ? " raid5" : "");
+       printf("    Chunk Sizes :%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
+              imsm_orom_has_chunk(orom, 2) ? " 2k" : "",
+              imsm_orom_has_chunk(orom, 4) ? " 4k" : "",
+              imsm_orom_has_chunk(orom, 8) ? " 8k" : "",
+              imsm_orom_has_chunk(orom, 16) ? " 16k" : "",
+              imsm_orom_has_chunk(orom, 32) ? " 32k" : "",
+              imsm_orom_has_chunk(orom, 64) ? " 64k" : "",
+              imsm_orom_has_chunk(orom, 128) ? " 128k" : "",
+              imsm_orom_has_chunk(orom, 256) ? " 256k" : "",
+              imsm_orom_has_chunk(orom, 512) ? " 512k" : "",
+              imsm_orom_has_chunk(orom, 1024*1) ? " 1M" : "",
+              imsm_orom_has_chunk(orom, 1024*2) ? " 2M" : "",
+              imsm_orom_has_chunk(orom, 1024*4) ? " 4M" : "",
+              imsm_orom_has_chunk(orom, 1024*8) ? " 8M" : "",
+              imsm_orom_has_chunk(orom, 1024*16) ? " 16M" : "",
+              imsm_orom_has_chunk(orom, 1024*32) ? " 32M" : "",
+              imsm_orom_has_chunk(orom, 1024*64) ? " 64M" : "");
+       printf("      Max Disks : %d\n", orom->tds);
+       printf("    Max Volumes : %d\n", orom->vpa);
+       return;
+}
+
 static int detail_platform_imsm(int verbose, int enumerate_only)
 {
        /* There are two components to imsm platform support, the ahci SATA
@@ -1366,9 +1399,20 @@ static int detail_platform_imsm(int verbose, int enumerate_only)
        int result=0;
 
        if (enumerate_only) {
-               if (check_env("IMSM_NO_PLATFORM") || find_imsm_orom())
+               if (check_env("IMSM_NO_PLATFORM"))
                        return 0;
-               return 2;
+               list = find_intel_devices();
+               if (!list)
+                       return 2;
+               for (hba = list; hba; hba = hba->next) {
+                       orom = find_imsm_capability(hba->type);
+                       if (!orom) {
+                               result = 2;
+                               break;
+                       }
+               }
+               free_sys_dev(&list);
+               return result;
        }
 
        list = find_intel_devices();
@@ -1381,43 +1425,15 @@ static int detail_platform_imsm(int verbose, int enumerate_only)
        } else if (verbose)
                print_found_intel_controllers(list);
 
-       orom = find_imsm_orom();
-       if (!orom) {
-               free_sys_dev(&list);
-               if (verbose)
-                       fprintf(stderr, Name ": imsm option-rom not found\n");
-               return 2;
+       for (hba = list; hba; hba = hba->next) {
+               orom = find_imsm_capability(hba->type);
+               if (!orom)
+                       fprintf(stderr, Name ": imsm capabilities not found for controller: %s (type %s)\n",
+                               hba->path, get_sys_dev_type(hba->type));
+               else
+                       print_imsm_capability(orom);
        }
 
-       printf("       Platform : Intel(R) Matrix Storage Manager\n");
-       printf("        Version : %d.%d.%d.%d\n", orom->major_ver, orom->minor_ver,
-              orom->hotfix_ver, orom->build);
-       printf("    RAID Levels :%s%s%s%s%s\n",
-              imsm_orom_has_raid0(orom) ? " raid0" : "",
-              imsm_orom_has_raid1(orom) ? " raid1" : "",
-              imsm_orom_has_raid1e(orom) ? " raid1e" : "",
-              imsm_orom_has_raid10(orom) ? " raid10" : "",
-              imsm_orom_has_raid5(orom) ? " raid5" : "");
-       printf("    Chunk Sizes :%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
-              imsm_orom_has_chunk(orom, 2) ? " 2k" : "",
-              imsm_orom_has_chunk(orom, 4) ? " 4k" : "",
-              imsm_orom_has_chunk(orom, 8) ? " 8k" : "",
-              imsm_orom_has_chunk(orom, 16) ? " 16k" : "",
-              imsm_orom_has_chunk(orom, 32) ? " 32k" : "",
-              imsm_orom_has_chunk(orom, 64) ? " 64k" : "",
-              imsm_orom_has_chunk(orom, 128) ? " 128k" : "",
-              imsm_orom_has_chunk(orom, 256) ? " 256k" : "",
-              imsm_orom_has_chunk(orom, 512) ? " 512k" : "",
-              imsm_orom_has_chunk(orom, 1024*1) ? " 1M" : "",
-              imsm_orom_has_chunk(orom, 1024*2) ? " 2M" : "",
-              imsm_orom_has_chunk(orom, 1024*4) ? " 4M" : "",
-              imsm_orom_has_chunk(orom, 1024*8) ? " 8M" : "",
-              imsm_orom_has_chunk(orom, 1024*16) ? " 16M" : "",
-              imsm_orom_has_chunk(orom, 1024*32) ? " 32M" : "",
-              imsm_orom_has_chunk(orom, 1024*64) ? " 64M" : "");
-       printf("      Max Disks : %d\n", orom->tds);
-       printf("    Max Volumes : %d\n", orom->vpa);
-
        for (hba = list; hba; hba = hba->next) {
                printf(" I/O Controller : %s (%s)\n",
                        hba->path, get_sys_dev_type(hba->type));
@@ -1430,11 +1446,6 @@ static int detail_platform_imsm(int verbose, int enumerate_only)
                                                "ports on SATA controller at %s.", hba->pci_id);
                                result |= 2;
                        }
-               } else if (hba->type == SYS_DEV_SAS) {
-                               if (verbose)
-                                       fprintf(stderr, Name ": failed to enumerate "
-                                               "devices on SAS controller at %s.", hba->pci_id);
-                               result |= 2;
                }
        }