+
+/*
+ * find and allocate hba and OROM/EFI based on valid fd of RAID component device
+ */
+static int find_intel_hba_capability(int fd, struct intel_super *super, int verbose)
+{
+ struct sys_dev *hba_name;
+ int rv = 0;
+
+ if ((fd < 0) || check_env("IMSM_NO_PLATFORM")) {
+ super->hba = NULL;
+ return 0;
+ }
+ hba_name = find_disk_attached_hba(fd, NULL);
+ if (!hba_name) {
+ if (verbose) {
+ char str[256];
+
+ fd2devname(fd, str);
+ fprintf(stderr,
+ Name ": %s is not attached to Intel(R) RAID controller.\n",
+ str);
+ }
+ return 1;
+ }
+ rv = attach_hba_to_super(super, hba_name);
+ if (rv == 2) {
+ if (verbose) {
+ char str[256];
+
+ fd2devname(fd, str);
+ fprintf(stderr, Name ": %s is attached to Intel(R) %s RAID "
+ "controller (%s),\n"
+ " but the container is assigned to Intel(R) "
+ "%s RAID controller (",
+ str,
+ hba_name->path,
+ hba_name->pci_id ? : "Err!",
+ get_sys_dev_type(hba_name->type));
+
+ struct intel_hba *hba = super->hba;
+ while (hba) {
+ fprintf(stderr, "%s", hba->pci_id ? : "Err!");
+ if (hba->next)
+ fprintf(stderr, ", ");
+ hba = hba->next;
+ }
+
+ fprintf(stderr, ").\n"
+ " Mixing devices attached to different controllers "
+ "is not allowed.\n");
+ }
+ free_sys_dev(&hba_name);
+ return 2;
+ }
+ free_sys_dev(&hba_name);
+ return 0;
+}
+
+