@@ -1,2 +1,2 @@
obj-$(CONFIG_SCSI_HISI_SAS) += hisi_sas.o
-hisi_sas-y+= hisi_sas_init.o
+hisi_sas-y+= hisi_sas_init.o hisi_sas_main.o
@@ -257,4 +257,6 @@ union hisi_sas_command_table {
struct hisi_sas_command_table_smp smp;
struct hisi_sas_command_table_stp stp;
};
+
+void hisi_sas_slot_index_init(struct hisi_hba *hisi_hba);
#endif
@@ -131,6 +131,8 @@ static int hisi_sas_alloc(struct hisi_hba *hisi_hba, struct Scsi_Host *shost)
goto err_out;
memset(hisi_hba->sata_breakpoint, 0, s);
+ hisi_sas_slot_index_init(hisi_hba);
+
return 0;
err_out:
return -ENOMEM;
new file mode 100644
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2015 Linaro Ltd.
+ * Copyright (c) 2015 Hisilicon Limited.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ */
+
+#include "hisi_sas.h"
+
+
+static void hisi_sas_slot_index_clear(struct hisi_hba *hisi_hba, int slot_idx)
+{
+ void *bitmap = hisi_hba->slot_index_tags;
+
+ clear_bit(slot_idx, bitmap);
+}
+
+void hisi_sas_slot_index_init(struct hisi_hba *hisi_hba)
+{
+ int i;
+
+ for (i = 0; i < hisi_hba->slot_index_count; ++i)
+ hisi_sas_slot_index_clear(hisi_hba, i);
+}
Add functionality to init slot indexing. Slot indexing is for the host to track which slots (or tags) are free and which are used. Signed-off-by: John Garry <john.garry@huawei.com> --- drivers/scsi/hisi_sas/Makefile | 2 +- drivers/scsi/hisi_sas/hisi_sas.h | 2 ++ drivers/scsi/hisi_sas/hisi_sas_init.c | 2 ++ drivers/scsi/hisi_sas/hisi_sas_main.c | 28 ++++++++++++++++++++++++++++ 4 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 drivers/scsi/hisi_sas/hisi_sas_main.c