aacraid: AIF raw device remove support
authorMahesh Rajashekhara <Mahesh.Rajashekhara@pmcs.com>
Thu, 26 Mar 2015 14:41:31 +0000 (10:41 -0400)
committerJames Bottomley <JBottomley@Odin.com>
Thu, 9 Apr 2015 23:56:18 +0000 (16:56 -0700)
Signed-off-by: Mahesh Rajashekhara <Mahesh.Rajashekhara@pmcs.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Murthy Bhat <Murthy.Bhat@pmcs.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
drivers/scsi/aacraid/aacraid.h
drivers/scsi/aacraid/commsup.c

index 2ba158b50fa21b5d0303ddc89b4ee6ee2445690c..fe014a6e69f9f60ac862e515c080e083d3186945 100644 (file)
@@ -2065,6 +2065,9 @@ extern struct aac_common aac_config;
 /* PMC NEW COMM: Request the event data */
 #define                AifReqEvent             200
 
+/* RAW device deleted */
+#define                AifRawDeviceRemove      203
+
 /*
  *     Adapter Initiated FIB command structures. Start with the adapter
  *     initiated FIBs that really come from the adapter, and get responded
index 1a3c0e0068de09060737f6d6b0d3e59e70aaeeef..4da574925284454cdba9cd6d6cc036bffc3dcdea 100644 (file)
@@ -883,6 +883,39 @@ static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr)
        switch (le32_to_cpu(aifcmd->command)) {
        case AifCmdDriverNotify:
                switch (le32_to_cpu(((__le32 *)aifcmd->data)[0])) {
+               case AifRawDeviceRemove:
+                       container = le32_to_cpu(((__le32 *)aifcmd->data)[1]);
+                       if ((container >> 28)) {
+                               container = (u32)-1;
+                               break;
+                       }
+                       channel = (container >> 24) & 0xF;
+                       if (channel >= dev->maximum_num_channels) {
+                               container = (u32)-1;
+                               break;
+                       }
+                       id = container & 0xFFFF;
+                       if (id >= dev->maximum_num_physicals) {
+                               container = (u32)-1;
+                               break;
+                       }
+                       lun = (container >> 16) & 0xFF;
+                       container = (u32)-1;
+                       channel = aac_phys_to_logical(channel);
+                       device_config_needed =
+                         (((__le32 *)aifcmd->data)[0] ==
+                           cpu_to_le32(AifRawDeviceRemove)) ? DELETE : ADD;
+
+                       if (device_config_needed == ADD) {
+                               device = scsi_device_lookup(
+                                       dev->scsi_host_ptr,
+                                       channel, id, lun);
+                               if (device) {
+                                       scsi_remove_device(device);
+                                       scsi_device_put(device);
+                               }
+                       }
+                       break;
                /*
                 *      Morph or Expand complete
                 */