fix cleanup flow for memfree devices
[etherboot.git] / src / drivers / net / mlx_ipoib / ib_mt25218.c
index 11b25d4..8b6b994 100644 (file)
@@ -89,6 +89,10 @@ static struct dev_pci_struct memfree_pci_dev;
 static struct device_buffers_st *dev_buffers_p;
 static struct device_ib_data_st dev_ib_data;
 
+
+
+struct map_icm_st icm_map_obj;
+
 static int gw_write_cr(__u32 addr, __u32 data)
 {
        writel(htonl(data), memfree_pci_dev.cr_space + addr);
@@ -850,6 +854,8 @@ static int setup_hca(__u8 port, void **eq_p)
                eprintf("");
                goto undo_map_fa;
        }
+       icm_map_obj = map_obj;
+
        phys_mem.offset += (1 << (map_obj.vpm_arr[0].log2_size + 12));
 
        init_hca.log_max_uars = log_max_uars;
@@ -978,6 +984,30 @@ static int setup_hca(__u8 port, void **eq_p)
        return ret;
 }
 
+
+static int unset_hca(void)
+{
+       int rc, ret = 0;
+
+       rc = cmd_unmap_icm(&icm_map_obj);
+       if (rc)
+               eprintf("");
+       ret |= rc;
+
+
+       rc = cmd_unmap_icm_aux();
+       if (rc)
+               eprintf("");
+       ret |= rc;
+
+       rc = cmd_unmap_fa();
+       if (rc)
+               eprintf("");
+       ret |= rc;
+
+       return ret;
+}
+
 static void *get_inprm_buf(void)
 {
        return dev_buffers_p->inprm_buf;