diff -Naur b/Documentation/scsi/ChangeLog.megaraid c/Documentation/scsi/ChangeLog.megaraid --- b/Documentation/scsi/ChangeLog.megaraid 2004-12-09 19:05:47.795231320 -0500 +++ c/Documentation/scsi/ChangeLog.megaraid 2004-12-09 19:14:33.662287376 -0500 @@ -1,3 +1,21 @@ +Release Date : Thu Dec 9 19:10:23 EST 2004 - Sreenivas Bagalkote + +Current Version : 2.20.4.2 (scsi module), 2.20.2.4 (cmm module) +Older Version : 2.20.4.1 (scsi module), 2.20.2.3 (cmm module) + +i. Introduced driver ioctl that returns scsi address for a given ld. + + "Why can't the existing sysfs interfaces be used to do this?" + - Brian King (brking@us.ibm.com) + + "I've looked into solving this another way, but I cannot see how + to get this driver-private mapping of logical drive number-> HCTL + without putting code something like this into the driver." + + "...and by providing a mapping a function to userspace, the driver + is free to change its mapping algorithm in the future if necessary .." + - Matt Domsch (Matt_Domsch@dell.com) + Release Date : Thu Dec 9 19:02:14 EST 2004 - Sreenivas Bagalkote Current Version : 2.20.4.1 (scsi module), 2.20.2.3 (cmm module) diff -Naur b/drivers/scsi/megaraid/megaraid_ioctl.h c/drivers/scsi/megaraid/megaraid_ioctl.h --- b/drivers/scsi/megaraid/megaraid_ioctl.h 2004-12-09 19:00:59.000000000 -0500 +++ c/drivers/scsi/megaraid/megaraid_ioctl.h 2004-12-09 19:15:59.524234376 -0500 @@ -51,6 +51,7 @@ #define MEGAIOC_QNADAP 'm' /* Query # of adapters */ #define MEGAIOC_QDRVRVER 'e' /* Query driver version */ #define MEGAIOC_QADAPINFO 'g' /* Query adapter information */ +#define MEGAIOC_GET_SADDR 'a' /* Get SCSI address of an LD */ #define USCSICMD 0x80 #define UIOC_RD 0x00001 @@ -62,6 +63,7 @@ #define GET_ADAP_INFO 0x30000 #define GET_CAP 0x40000 #define GET_STATS 0x50000 +#define GET_LD_SADDR 0x60000 #define GET_IOCTL_VERSION 0x01 #define EXT_IOCTL_SIGN_SZ 16 @@ -217,6 +219,27 @@ } __attribute__ ((packed)) mcontroller_t; +/** + * ld_device_address : SCSI device address for the logical drives + * + * @host_no : host# to which LD belogs; as understood by mid-layer + * @channel : channel on which LD is exported + * @target : target on which the LD is exported + * @lun : lun on which the LD is exported + * @ld : the LD for which this information is sought + * @reserved : reserved fields; must be set to zero + * + * NOTE : Applications set the LD number and expect the + * SCSI address to be returned in the first four fields + */ +struct ld_device_address { + uint32_t host_no; + uint32_t channel; + uint32_t scsi_id; + uint32_t lun; + uint32_t ld; + uint32_t reserved[3]; +}; /** * mm_dmapool_t : Represents one dma pool with just one buffer diff -Naur b/drivers/scsi/megaraid/megaraid_mbox.c c/drivers/scsi/megaraid/megaraid_mbox.c --- b/drivers/scsi/megaraid/megaraid_mbox.c 2004-12-09 18:56:56.000000000 -0500 +++ c/drivers/scsi/megaraid/megaraid_mbox.c 2004-12-09 17:42:33.000000000 -0500 @@ -10,7 +10,7 @@ * 2 of the License, or (at your option) any later version. * * FILE : megaraid_mbox.c - * Version : v2.20.4.1 (Nov 04 2004) + * Version : v2.20.4.2 (Dec 9 2004) * * Authors: * Atul Mukker @@ -3642,6 +3642,7 @@ megaraid_mbox_mm_handler(unsigned long drvr_data, uioc_t *kioc, uint32_t action) { adapter_t *adapter; + struct ld_device_address* lda; if (action != IOCTL_ISSUE) { con_log(CL_ANN, (KERN_WARNING @@ -3670,6 +3671,30 @@ return kioc->status; + case GET_LD_SADDR: + + lda = (struct ld_device_address*)(unsigned long)kioc->buf_vaddr; + + if (lda->ld > MAX_LOGICAL_DRIVES_40LD) { + lda->host_no = 0xffffffff; + lda->channel = 0xffffffff; + lda->scsi_id = 0xffffffff; + lda->lun = 0xffffffff; + kioc->status = -ENODEV; + kioc->done(kioc); + return kioc->status; + } + + lda->host_no = adapter->host->host_no; + lda->channel = adapter->max_channel; + lda->scsi_id = (lda->ld < adapter->init_id) ? + lda->ld : lda->ld + 1; + lda->lun = 0; + kioc->status = 0; + kioc->done(kioc); + + return kioc->status; + case MBOX_CMD: return megaraid_mbox_mm_command(adapter, kioc); diff -Naur b/drivers/scsi/megaraid/megaraid_mbox.h c/drivers/scsi/megaraid/megaraid_mbox.h --- b/drivers/scsi/megaraid/megaraid_mbox.h 2004-12-09 18:56:56.000000000 -0500 +++ c/drivers/scsi/megaraid/megaraid_mbox.h 2004-12-09 19:10:32.381967560 -0500 @@ -21,8 +21,8 @@ #include "megaraid_ioctl.h" -#define MEGARAID_VERSION "2.20.4.1" -#define MEGARAID_EXT_VERSION "(Release Date: Thu Nov 4 17:44:59 EST 2004)" +#define MEGARAID_VERSION "2.20.4.2" +#define MEGARAID_EXT_VERSION "(Release Date: Thu Dec 9 19:10:23 EST 2004)" /* diff -Naur b/drivers/scsi/megaraid/megaraid_mm.c c/drivers/scsi/megaraid/megaraid_mm.c --- b/drivers/scsi/megaraid/megaraid_mm.c 2004-12-09 19:03:27.000000000 -0500 +++ c/drivers/scsi/megaraid/megaraid_mm.c 2004-12-09 19:10:01.449669984 -0500 @@ -10,7 +10,7 @@ * 2 of the License, or (at your option) any later version. * * FILE : megaraid_mm.c - * Version : v2.20.2.3 (Dec 09 2004) + * Version : v2.20.2.4 (Dec 9 2004) * * Common management module */ @@ -373,6 +373,20 @@ if (mraid_mm_attach_buf(adp, kioc, kioc->xferlen)) return (-ENOMEM); } + else if (subopcode == MEGAIOC_GET_SADDR) { + + kioc->opcode = GET_LD_SADDR; + kioc->data_dir = UIOC_RD; + kioc->xferlen = sizeof(struct ld_device_address); + + if (mraid_mm_attach_buf(adp, kioc, kioc->xferlen)) + return (-ENOMEM); + + if (copy_from_user(kioc->buf_vaddr, mimd.data, + kioc->xferlen )) { + return (-EFAULT); + } + } else { con_log(CL_ANN, (KERN_WARNING "megaraid cmm: Invalid subop\n")); @@ -813,6 +827,15 @@ return 0; + case MEGAIOC_GET_SADDR: + + if (copy_to_user(kmimd.data, kioc->buf_vaddr, + sizeof(struct ld_device_address))) { + return (-EFAULT); + } + + return kioc->status; + default: return (-EINVAL); } diff -Naur b/drivers/scsi/megaraid/megaraid_mm.h c/drivers/scsi/megaraid/megaraid_mm.h --- b/drivers/scsi/megaraid/megaraid_mm.h 2004-12-09 19:03:00.000000000 -0500 +++ c/drivers/scsi/megaraid/megaraid_mm.h 2004-12-09 19:12:15.729256384 -0500 @@ -29,9 +29,10 @@ #include "megaraid_ioctl.h" -#define LSI_COMMON_MOD_VERSION "2.20.2.3" +#define LSI_COMMON_MOD_VERSION "2.20.2.4" #define LSI_COMMON_MOD_EXT_VERSION \ - "(Release Date: Thu Dec 9 19:02:14 EST 2004)" + "(Release Date: Thu Dec 9 19:10:23 EST 2004)" + #define LSI_DBGLVL dbglevel