[PATCH] Hotplug support for BusLogic scsi controller

2005-04-08 Thread Juerg Billeter
Hi

This patch adds hotplug support to the driver for BusLogic scsi
controllers. It's required to boot from a BusLogic controller when using
modular kernels with hotplug-based initramfs.

Regards,

Juerg

--
Signed-off-by: Juerg Billeter [EMAIL PROTECTED]

--- linux-2.6.10/drivers/scsi/BusLogic.c.orig   2004-12-25 11:15:23.612408071 
+0100
+++ linux-2.6.10/drivers/scsi/BusLogic.c2004-12-25 11:17:51.639882495 
+0100
@@ -79,6 +79,15 @@
 static struct BusLogic_DriverOptions 
BusLogic_DriverOptions[BusLogic_MaxHostAdapters];
 
 
+static struct pci_device_id buslogic_pci_tbl[] = {
+   { PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER, 
PCI_ANY_ID, PCI_ANY_ID, },
+   { PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC, 
PCI_ANY_ID, PCI_ANY_ID, },
+   { PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_FLASHPOINT, 
PCI_ANY_ID, PCI_ANY_ID, },
+   { } /* Terminating entry */
+};
+MODULE_DEVICE_TABLE(pci, buslogic_pci_tbl);
+
+
 /*
   BusLogic can be assigned a string by insmod.
 */


-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] drivers/scsi: add hotplug with MODNAME env var

2005-03-04 Thread Roman Kagan
  Hi,

The patch below adds hotplug callout to scsi_bus_type, and makes it
generate MODNAME environment variable for use with modprobe.  Also it
adds a few matching MODULE_ALIAS() macros to the appropriate modules.

Two caveats:

 1) I'm not particularly certain about the scsi-type- prefix: it may
resemble cases where request_module() is used;  the reason I used
dashes was that MODULE_ALIAS() macros were put manually into the
code, rather that automatically generated from a corresponding
*_dev_id table;

 2) TYPE_* macros in include/scsi/scsi.h are in hex and can't be
conveniently __stringify()-ed, so I've hardcoded the values and
inserted comments next to them referring to those macros.

It handles only sd, sr, st, and osst cases.  I'd like to leave it to
scsi folks to decide whether sg should be scsi-type-* or the explicit
list of types not handled by other modules.

Roman.

Signed-off-by: Roman Kagan [EMAIL PROTECTED]

 drivers/scsi/scsi_sysfs.c |   16 
 drivers/scsi/sd.c |2 ++
 drivers/scsi/sr.c |3 +++
 drivers/scsi/st.c |2 ++
 drivers/scsi/osst.c   |2 ++
 5 files changed, 25 insertions(+)

diff -rup linux-2.6.11/drivers/scsi/scsi_sysfs.c 
linux-2.6.11.modname/drivers/scsi/scsi_sysfs.c
--- linux-2.6.11/drivers/scsi/scsi_sysfs.c  2005-03-02 10:37:49.0 
+0300
+++ linux-2.6.11.modname/drivers/scsi/scsi_sysfs.c  2005-03-04 
13:18:05.0 +0300
@@ -202,9 +202,25 @@ static int scsi_bus_match(struct device 
return (sdp-inq_periph_qual == SCSI_INQ_PQ_CON)? 1: 0;
 }
 
+static int scsi_hotplug(struct device *dev, char **envp,
+   int num_envp, char *buffer, int buffer_size)
+{
+   struct scsi_device *sdev = to_scsi_device(dev);
+   int i = 0;
+   int length = 0;
+
+   if (add_hotplug_env_var(envp, num_envp, i, buffer, buffer_size, 
length,
+   MODNAME=scsi-type-%d, sdev-type))
+   return -ENOMEM;
+
+   envp[i] = NULL;
+   return 0;
+}
+
 struct bus_type scsi_bus_type = {
 .name  = scsi,
 .match = scsi_bus_match,
+   .hotplug= scsi_hotplug,
 };
 
 int scsi_sysfs_register(void)
diff -rup linux-2.6.11/drivers/scsi/sd.c linux-2.6.11.modname/drivers/scsi/sd.c
--- linux-2.6.11/drivers/scsi/sd.c  2005-03-02 10:38:17.0 +0300
+++ linux-2.6.11.modname/drivers/scsi/sd.c  2005-03-04 13:16:22.0 
+0300
@@ -1653,6 +1653,8 @@ static void __exit exit_sd(void)
 MODULE_LICENSE(GPL);
 MODULE_AUTHOR(Eric Youngdale);
 MODULE_DESCRIPTION(SCSI disk (sd) driver);
+MODULE_ALIAS(scsi-type-0);   /*  TYPE_DISK   */
+MODULE_ALIAS(scsi-type-7);   /*  TYPE_MOD*/
 
 module_init(init_sd);
 module_exit(exit_sd);
diff -rup linux-2.6.11/drivers/scsi/sr.c linux-2.6.11.modname/drivers/scsi/sr.c
--- linux-2.6.11/drivers/scsi/sr.c  2005-03-02 10:38:37.0 +0300
+++ linux-2.6.11.modname/drivers/scsi/sr.c  2005-03-04 13:16:22.0 
+0300
@@ -956,6 +956,9 @@ static void __exit exit_sr(void)
unregister_blkdev(SCSI_CDROM_MAJOR, sr);
 }
 
+MODULE_ALIAS(scsi-type-4);   /*  TYPE_WORM   */
+MODULE_ALIAS(scsi-type-5);   /*  TYPE_ROM*/
+
 module_init(init_sr);
 module_exit(exit_sr);
 MODULE_LICENSE(GPL);
diff -rup linux-2.6.11/drivers/scsi/st.c linux-2.6.11.modname/drivers/scsi/st.c
--- linux-2.6.11/drivers/scsi/st.c  2005-03-02 10:38:12.0 +0300
+++ linux-2.6.11.modname/drivers/scsi/st.c  2005-03-04 13:16:22.0 
+0300
@@ -4090,6 +4090,8 @@ static void __exit exit_st(void)
printk(KERN_INFO st: Unloaded.\n);
 }
 
+MODULE_ALIAS(scsi-type-1);   /*  TYPE_TAPE   */
+
 module_init(init_st);
 module_exit(exit_st);
 
diff -rup linux-2.6.11/drivers/scsi/osst.c 
linux-2.6.11.modname/drivers/scsi/osst.c
--- linux-2.6.11/drivers/scsi/osst.c2005-03-02 10:38:08.0 +0300
+++ linux-2.6.11.modname/drivers/scsi/osst.c2005-03-04 13:20:45.0 
+0300
@@ -5888,5 +5888,7 @@ static void __exit exit_osst (void)
printk(KERN_INFO osst :I: Unloaded.\n);
 }
 
+MODULE_ALIAS(scsi-type-1);   /*  TYPE_TAPE   */
+
 module_init(init_osst);
 module_exit(exit_osst);
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: One question about SCSI device hotplug

2005-03-02 Thread James . Smart
 Thank you, Matt. Then I have another question:
 As we know SCSI mid-layer issue a command to LLDD by 
 host-hostt-queuecommand(cmd, scsi_done); and in the meantime a 
 timer is set. When the timer expires, SCSI mid-layer know the 
 execution of command has failed.
 My question is: when SCSI device is surprise-removed, if SCSI 
 mid-layer
 issue a command to this removed device, will mid-layer has to wait 
 a timeout before it can know the execution of command failed? Or is
 there
 any other mechanism that LLDD can notify mid-layer that execution of
 command failed without waiting for a timeout?

What we did in the FC transport - there's a transport level timeout at
the target level that controls how long we insulate the system from
the device's disappearance. When the device is first removed, the
transport has the midlayer suspend i/o (e.g block) the device, so no
i/o failures, other than timeouts on in-flight i/o's occur. As the
midlayer (for disk devices) typically retries i/o's, even the in-flight
errors don't result in an error to the application, as the retry get's
delayed due the blocked state of the device. If the device returns
within the insulation period, i/o resumes, and the system continues
happily along it's way. If the device does not return, the timeout
fires, and the device is restarted. The i/o then reaches the LLDD, who
is expected to fail the i/o immediately as the target doesn't exist.
The midlayer reacts accordingly and places the device into an offline
state.

If the device is readded, the LLDD sets the target to a good state, but
the midlayer keeps the devices in an offline state until steps are taken
to bring them back online. E.g. The admin takes whatever steps are
necessary to clean up the system for the previous failure of the device,
then brings the device online by writing the device state to running
and rescanning the device.

If multipath solutions are in place, they will want to set the
insulation timeout as low as possible so that access so that it's
alternate pathing can kick in as soon as possible.  The multipathing
solution, upon device re-addition, is required to take the steps to
bring the device back online.

-- james s 

-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: One question about SCSI device hotplug

2005-03-01 Thread James . Smart
 On Tue, Mar 01, 2005 at 05:06:55PM +0800, Zhao, Forrest wrote:
  If I surprisingly hot-remove a SCSI disk from HBA manually 
  without executing echo scsi remove-single-device
   h b t l  /proc/scsi/scsi, can the hotplug
  event be notified to SCSI mid-layer or user space?
  
  I briefly browse some code of LLDD, it seems that LLDD never
  report hotplug event to upper-level layer. Am I right?
 
 I don't think it *can* ... the SCSI protocols don't tell the 
 host hey,
 this device has disappeared.

All depends on what transport it is... In FC, we can detect when
a target is removed. In the most recent FC transport code (not
all integrated yet), it will indeed automagically invoke
scsi_remove_device() for all luns on the target.

-- james s
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [ANNOUNCE] hotplug-ng 001 release

2005-02-18 Thread Patrick Mansfield
[added linux-scsi]

On Wed, Feb 16, 2005 at 11:32:51PM +, Willem Riede wrote:
 On 02/16/2005 06:17:41 PM, Roman Kagan wrote:

I tried out Roman's patch, well at least simple loading of st via
modprobe scsi-type-1, works nicely as expected. (modprobe -r sd is
hanging on down() in device_unregister with 2.6.11-rc4 ... must be a ref
count problem, have not figured anything out, and took me a while before
trying st and sg instead.)

  On Wed, Feb 16, 2005 at 11:02:41PM +, Willem Riede wrote:
   On 02/16/2005 06:07:52 AM, Roman Kagan wrote:
It handles only st, sd_mod and sr_mod cases (as
hotplug-ng-001/module_scsi.c did).  Are there any other?
   
   Not all tapes are supported by st - OnStream drives need osst instead.
  
  As an excuse I can say that I reproduced what was in
  hotplug-ng-001/module_scsi.c, no more, no less :)
  
   How do you suggest that is to be handled?
  
  AFAICS they coexist nicely, so, if you add the same thing to osst.c:
  
  MODULE_ALIAS(scsi-type-1);/*  TYPE_TAPE   */
  
  both osst and st will be loaded (provided Greg convinces Rusty to make
  modprobe load _all_ matching modules as he suggested the other day).
  Then the one whose .probe succeeds will handle the device.
  
  Will that work?
 
 Yes. If we can get that load-all behaviour implemented, everything will be 
 fine.

You could also append the sdev-vendor and sdev-model, and use alias wild
cards.

So OSST would not be loaded for all tape devices found (not a big deal).
st would still load for all tapes (likely the same as we have today, and
not easy to *not* load it for osst devices).

That is, add aliases to osst.c like:

MODULE_ALIAS(scsi-type-1-onStream-SC-*);
MODULE_ALIAS(scsi-type-1-onStream-DI-*);

etc.

The vendor (8 bytes) and model (16 bytes) can have spaces, and the values
are not '\0' terminated. modprobe does not seem to handle spaces in an
alias.

And for st.c:

MODULE_ALIAS(scsi-type-1-*);

sd.c:

MODULE_ALIAS(scsi-type-4-*);
MODULE_ALIAS(scsi-type-5-*);

Also, sg loading would want (along with modprobe load all feature):

MODULE_ALIAS(scsi-type-*);

-- Patrick Mansfield
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [ANNOUNCE] hotplug-ng 001 release

2005-02-18 Thread Roman Kagan
On Fri, Feb 18, 2005 at 09:17:37AM -0800, Patrick Mansfield wrote:
 You could also append the sdev-vendor and sdev-model, and use alias wild
 cards.

String values haven't been used in the aliases so far, and I think for a
reason: with all the unpredictable weird characters and string lengths
they would make maintainance harder, not easier.

 That is, add aliases to osst.c like:
 
 MODULE_ALIAS(scsi-type-1-onStream-SC-*);
 MODULE_ALIAS(scsi-type-1-onStream-DI-*);

I used dashes for the only reason of these aliases being static.  If
they are supposed to grow it may make sense to stick to the convention
used everywhere else, i.e. bus:devspec.

 Also, sg loading would want (along with modprobe load all feature):
 
 MODULE_ALIAS(scsi-type-*);

Is it certain that it can live together with s[dtr]?  I thought these
guys now handled all the ioctls sg was supposed to themselves...

Roman.
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [ANNOUNCE] hotplug-ng 001 release

2005-02-18 Thread Roman Kagan
On Fri, Feb 18, 2005 at 10:33:50AM -0800, Patrick Mansfield wrote:
 The block SG_IO handles the ioctls, but not devices without a SCSI upper
 level driver (i.e. not tape, disk or cdrom).

Then it might make sense to explicitly list in sg.c the TYPE_* not
matched by s[dtr].

 In my experience, there are always applications that want to use the
 standard device driver (/dev/sda etc.) and others that want to use a
 generic driver.

So these drivers can compete for the same device?  Are there
deterministic rules on which one is supposed to win?  And is there a
userspace interface to unbind one driver and bind another?  Otherwise it
may mean that automatic module loading is inappropriate here at all...

Roman.
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [ANNOUNCE] hotplug-ng 001 release

2005-02-18 Thread Patrick Mansfield
On Fri, Feb 18, 2005 at 10:41:35PM +0300, Roman Kagan wrote:
 On Fri, Feb 18, 2005 at 10:33:50AM -0800, Patrick Mansfield wrote:
  The block SG_IO handles the ioctls, but not devices without a SCSI upper
  level driver (i.e. not tape, disk or cdrom).
 
 Then it might make sense to explicitly list in sg.c the TYPE_* not
 matched by s[dtr].

sg can be used even if another scsi upper level driver is loaded.

fedora core tried something like that for a while, I'm not sure what
happened (besides it being really hard to do), and haven't noticed
anything different in recent (2.6.x) fc kernels.

 So these drivers can compete for the same device?  Are there
 deterministic rules on which one is supposed to win?  And is there a
 userspace interface to unbind one driver and bind another?  Otherwise it
 may mean that automatic module loading is inappropriate here at all...

No to all.

It is OK to autoload sg, it has special handling. Even though greg
probably hates it, it is much better than a /proc/bus/scsi ;-)

-- Patrick Mansfield
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC][PATCH 2.6.11-rc2] Linux SCSI hotplug infrastructure

2005-02-08 Thread Matt Domsch
On Mon, Feb 07, 2005 at 12:27:53PM -0600, Matt Domsch wrote:
 Below is a patch to add some hotplug infrastructure to the Linux SCSI
 subsystem.

I've added and reworked the megaraid_mbox driver to make use of this
new infrastructure.  I'll send that patch next.  The rest is unchanged
from yesterday.

I've put this work into a bkbits repo.  This is a clone of Linus's
linux-2.6, not of James' scsi-misc-2.6.
  
bk pull http://mdomsch.bkbits.net/linux-2.6-scsi-hotplug

This will update the following files:

 Documentation/scsi/ChangeLog.megaraid  |  130 
 drivers/scsi/Kconfig   |   10 
 drivers/scsi/Makefile  |1 
 drivers/scsi/megaraid/Kconfig.megaraid |1 
 drivers/scsi/megaraid/mega_common.h|3 
 drivers/scsi/megaraid/megaraid_ioctl.h |1 
 drivers/scsi/megaraid/megaraid_mbox.c  |  500 +++--
 drivers/scsi/megaraid/megaraid_mbox.h  |   28 +
 drivers/scsi/megaraid/megaraid_mm.c|   39 ++
 drivers/scsi/megaraid/megaraid_mm.h|5 
 drivers/scsi/scsi_hotplug.c|  138 +
 include/scsi/scsi_hotplug.h|   41 ++
 12 files changed, 867 insertions, 30 deletions

through these ChangeSets:

[EMAIL PROTECTED] (05/02/08 1.2132.2.3)
   Release Date : Tue Feb 08 12:27:22 EST 2005 - Matt Domsch [EMAIL PROTECTED]
   Current Version  : 2.20.4.6 (scsi module), 2.20.2.5 (cmm module)
   Older Version: 2.20.4.5 (scsi module), 2.20.2.5 (cmm module)
   
   1.   Added two new megaraid_shost_attrs
/sys/class/scsi_host
|-- host0
|   |-- logical_drive_created
|   |-- logical_drive_destroyed

and helper functions for them.  Written to from userspace by
a management application, these invoke SCSI hotplug
infrastructure for informing the kernel that a logical drive
has been created, or will be destroyed quite soon.
echo 2  logical_drive_created
   after creating logical drive #2 in the management app
echo 4  logical_drive_destroyed
immediately before destroying logical drive #4 in the
management app.  Eventually these functions should be called
directly from the management app.
   
   2.   Made class_device_megaraid_mbox_app_hndl and
   dev_attr_megaraid_mbox_ld static.
   
   Signed-off-by: Matt Domsch [EMAIL PROTECTED]

[EMAIL PROTECTED] (05/02/08 1.2132.2.2)
   megaraid_2.20.4.5.patch

[EMAIL PROTECTED] (05/02/07 1.2048.2.1)
   Below is a patch to add some hotplug infrastructure to the Linux SCSI
   subsystem.
   
   New files:
   include/scsi/scsi_hotplug.h
   drivers/scsi/scsi_hotplug.c
   implements a new exported function:
   
   extern int scsi_topology_hctl_action(struct Scsi_Host *shost, unsigned int 
channel,
  unsigned int id, unsigned int lun, enum 
scsi_topology_action action);
   
   which invokes kobject_hotplug() on a temporary scsi_topology
   device.  This device represents a target that exists on a topology
   (i.e. was just inserted into a hot plug enclosure, or was just created
   by a RAID controller management application) but is not yet hooked
   into the kernel.
   
   In addition, two more infrastructure pieces are necessary:
   udev-050-scsi_topology.patch - adds the subsystem name scsi_topology
   to the list of devices *not* to wait for the creation of files in
   sysfs for - scsi_topology devices aren't to be registered in sysfs.
   
   /etc/hotplug/scsi_topology.agent
handles the hotplug call, and invokes /sys/class/scsi_host/hostX/scan
and /sys/class/scsi_device/H:C:T:L:/device/delete as appropriate.
   
   
   The flow is as follows:
   
   # echo 2  /sys/class/scsi_host/host2/logical_drive_created
   (to be done by a management application that knows it just created
   logical drive #2 on the controller)
   
   megaraid_mbox.c sysfs method converts logical drive number to HCTL
   value, calls scsi_topology_hctl_action().
   
   scsi_topology_hctl_action() invokes kobject_hotplug() with a
   scsi_topology subsystem device.
   
   kobject_hotplug() calls /sbin/hotplug or /sbin/udevsend (more likely
   the latter), which invokes /etc/hotplug/scsi_topology.agent with the
   ACTION={add,remove}.
   
   scsi_topology.agent invokes /sys/class/scsi_host/hostX/scan or
/sys/class/scsi_device/H:C:T:L:/device/delete as appropriate.
   
   From this point, we're back into known territory, with the device
   being made known, or deleted from, the kernel's view.
   
   Signed-off-by: Matt Domsch [EMAIL PROTECTED]



-- 
Matt Domsch
Software Architect
Dell Linux Solutions linux.dell.com  www.dell.com/linux
Linux on Dell mailing lists @ http://lists.us.dell.com
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC][PATCH 2.6.11-rc2] Linux SCSI hotplug infrastructure

2005-02-08 Thread Matt Domsch
On Tue, Feb 08, 2005 at 05:19:23PM -0600, Matt Domsch wrote:
 I've added and reworked the megaraid_mbox driver to make use of this
 new infrastructure.  I'll send that patch next.  The rest is unchanged
 from yesterday.

This is the megaraid_mbox 2.20.4.5 patch as submitted by LSI on-list
last week.

Signed-off-by: Matt Domsch [EMAIL PROTECTED]

-- 
Matt Domsch
Software Architect
Dell Linux Solutions linux.dell.com  www.dell.com/linux
Linux on Dell mailing lists @ http://lists.us.dell.com

You can import this changeset into BK by piping this whole message to
'| bk receive [path to repository]' or apply the patch as usual.

===


[EMAIL PROTECTED], 2005-02-08 14:53:12-06:00, [EMAIL PROTECTED]
  megaraid_2.20.4.5.patch


 Documentation/scsi/ChangeLog.megaraid  |  104 
 drivers/scsi/megaraid/Kconfig.megaraid |1 
 drivers/scsi/megaraid/mega_common.h|3 
 drivers/scsi/megaraid/megaraid_ioctl.h |1 
 drivers/scsi/megaraid/megaraid_mbox.c  |  403 -
 drivers/scsi/megaraid/megaraid_mbox.h  |   24 +
 drivers/scsi/megaraid/megaraid_mm.c|   39 +++
 drivers/scsi/megaraid/megaraid_mm.h|5 
 8 files changed, 561 insertions, 19 deletions


diff -Nru a/Documentation/scsi/ChangeLog.megaraid 
b/Documentation/scsi/ChangeLog.megaraid
--- a/Documentation/scsi/ChangeLog.megaraid 2005-02-08 17:16:50 -06:00
+++ b/Documentation/scsi/ChangeLog.megaraid 2005-02-08 17:16:50 -06:00
@@ -1,3 +1,105 @@
+Release Date   : Thu Feb 03 12:27:22 EST 2005 - Seokmann Ju [EMAIL PROTECTED]
+Current Version: 2.20.4.5 (scsi module), 2.20.2.5 (cmm module)
+Older Version  : 2.20.4.4 (scsi module), 2.20.2.4 (cmm module)
+
+1. Modified name of two attributes in scsi_host_template.
+   On Wed, 2005-02-02 at 10:56 -0500, Ju, Seokmann wrote:
++ .sdev_attrs = megaraid_device_attrs,
++ .shost_attrs= megaraid_class_device_attrs,
+
+   These are, perhaps, slightly confusing names.
+   The terms device and class_device have well defined meanings in the
+   generic device model, neither of which is what you mean here.
+   Why not simply megaraid_sdev_attrs and megaraid_shost_attrs?
+
+   Other than this, it looks fine to me too.
+
+Release Date   : Thu Jan 27 00:01:03 EST 2005 - Atul Mukker [EMAIL PROTECTED]
+Current Version: 2.20.4.4 (scsi module), 2.20.2.5 (cmm module)
+Older Version  : 2.20.4.3 (scsi module), 2.20.2.4 (cmm module)
+
+1. Bump up the version of scsi module due to its conflict.
+
+Release Date   : Thu Jan 21 00:01:03 EST 2005 - Atul Mukker [EMAIL PROTECTED]
+Current Version: 2.20.4.3 (scsi module), 2.20.2.5 (cmm module)
+Older Version  : 2.20.4.2 (scsi module), 2.20.2.4 (cmm module)
+
+1. Remove driver ioctl for logical drive to scsi address translation and
+   replace with the sysfs attribute. To remove drives and change
+   capacity, application shall now use the device attribute to get the
+   logical drive number for a scsi device. For adding newly created
+   logical drives, class device attribute would be required to uniquely
+   identify each controller.
+   - Atul Mukker [EMAIL PROTECTED]
+
+   James, I've been thinking about this a little more, and you may be on
+   to something here. Let each driver add files as such:
+
+   - Matt Domsch [EMAIL PROTECTED], 12.15.2004
+linux-scsi mailing list
+
+
+   Then, if you simply publish your LD number as an extra parameter of
+   the device, you can look through /sys to find it.
+
+   - James Bottomley [EMAIL PROTECTED], 01.03.2005
+linux-scsi mailing list
+
+
+   I don't see why not ... it's your driver, you can publish whatever
+   extra information you need as scsi_device attributes; that was one of
+   the designs of the extensible attribute system.
+
+   - James Bottomley [EMAIL PROTECTED], 01.06.2005
+linux-scsi mailing list
+
+2. Add AMI megaraid support - Brian King [EMAIL PROTECTED]
+   PCI_VENDOR_ID_AMI, PCI_DEVICE_ID_AMI_MEGARAID3,
+   PCI_VENDOR_ID_AMI, PCI_SUBSYS_ID_PERC3_DC,
+
+3. Make some code static - Adrian Bunk [EMAIL PROTECTED]
+   Date:   Mon, 15 Nov 2004 03:14:57 +0100
+
+   The patch below makes some needlessly global code static.
+   -wait_queue_head_t wait_q;
+   +static wait_queue_head_t wait_q;
+
+   Signed-off-by: Adrian Bunk [EMAIL PROTECTED]
+
+4. Added NEC ROMB support - NEC MegaRAID PCI Express ROMB controller
+   PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_MEGARAID_NEC_ROMB_2E,
+   PCI_SUBSYS_ID_NEC, PCI_SUBSYS_ID_MEGARAID_NEC_ROMB_2E,
+
+5. Fixed Tape drive issue : For any Direct CDB command to physical device
+   including tape, timeout value set by driver was 10 minutes. With this 

Re: [RFC][PATCH 2.6.11-rc2] Linux SCSI hotplug infrastructure

2005-02-08 Thread Matt Domsch
On Tue, Feb 08, 2005 at 05:19:23PM -0600, Matt Domsch wrote:
 On Mon, Feb 07, 2005 at 12:27:53PM -0600, Matt Domsch wrote:
  Below is a patch to add some hotplug infrastructure to the Linux SCSI
  subsystem.
 
 I've added and reworked the megaraid_mbox driver to make use of this
 new infrastructure.  I'll send that patch next.  The rest is unchanged
 from yesterday.

And these are the changes megaid_mbox to use the new infrastructure.

-- 
Matt Domsch
Software Architect
Dell Linux Solutions linux.dell.com  www.dell.com/linux
Linux on Dell mailing lists @ http://lists.us.dell.com

You can import this changeset into BK by piping this whole message to
'| bk receive [path to repository]' or apply the patch as usual.

===


[EMAIL PROTECTED], 2005-02-08 16:46:03-06:00, [EMAIL PROTECTED]
  Release Date  : Tue Feb 08 12:27:22 EST 2005 - Matt Domsch [EMAIL PROTECTED]
  Current Version   : 2.20.4.6 (scsi module), 2.20.2.5 (cmm module)
  Older Version : 2.20.4.5 (scsi module), 2.20.2.5 (cmm module)
  
  1.Added two new megaraid_shost_attrs
/sys/class/scsi_host
|-- host0
|   |-- logical_drive_created
|   |-- logical_drive_destroyed

and helper functions for them.  Written to from userspace by
a management application, these invoke SCSI hotplug
infrastructure for informing the kernel that a logical drive
has been created, or will be destroyed quite soon.
echo 2  logical_drive_created
  after creating logical drive #2 in the management app
echo 4  logical_drive_destroyed
immediately before destroying logical drive #4 in the
management app.  Eventually these functions should be called
directly from the management app.
  
  2.Made class_device_megaraid_mbox_app_hndl and
  dev_attr_megaraid_mbox_ld static.
  
  Signed-off-by: Matt Domsch [EMAIL PROTECTED]


 Documentation/scsi/ChangeLog.megaraid |   26 +
 drivers/scsi/megaraid/megaraid_mbox.c |   97 ++
 drivers/scsi/megaraid/megaraid_mbox.h |4 -
 3 files changed, 116 insertions, 11 deletions


diff -Nru a/Documentation/scsi/ChangeLog.megaraid 
b/Documentation/scsi/ChangeLog.megaraid
--- a/Documentation/scsi/ChangeLog.megaraid 2005-02-08 17:16:27 -06:00
+++ b/Documentation/scsi/ChangeLog.megaraid 2005-02-08 17:16:27 -06:00
@@ -1,3 +1,29 @@
+Release Date   : Tue Feb 08 12:27:22 EST 2005 - Matt Domsch [EMAIL PROTECTED]
+Current Version: 2.20.4.6 (scsi module), 2.20.2.5 (cmm module)
+Older Version  : 2.20.4.5 (scsi module), 2.20.2.5 (cmm module)
+
+1. Added two new megaraid_shost_attrs
+   /sys/class/scsi_host
+   |-- host0
+   |   |-- logical_drive_created
+   |   |-- logical_drive_destroyed
+   
+   and helper functions for them.  Written to from userspace by
+   a management application, these invoke SCSI hotplug
+   infrastructure for informing the kernel that a logical drive
+   has been created, or will be destroyed quite soon.
+   echo 2  logical_drive_created
+after creating logical drive #2 in the management app
+   echo 4  logical_drive_destroyed
+   immediately before destroying logical drive #4 in the
+   management app.  Eventually these functions should be called
+   directly from the management app.
+
+2. Made class_device_megaraid_mbox_app_hndl and
+dev_attr_megaraid_mbox_ld static.
+
+
+
 Release Date   : Thu Feb 03 12:27:22 EST 2005 - Seokmann Ju [EMAIL PROTECTED]
 Current Version: 2.20.4.5 (scsi module), 2.20.2.5 (cmm module)
 Older Version  : 2.20.4.4 (scsi module), 2.20.2.4 (cmm module)
diff -Nru a/drivers/scsi/megaraid/megaraid_mbox.c 
b/drivers/scsi/megaraid/megaraid_mbox.c
--- a/drivers/scsi/megaraid/megaraid_mbox.c 2005-02-08 17:16:27 -06:00
+++ b/drivers/scsi/megaraid/megaraid_mbox.c 2005-02-08 17:16:27 -06:00
@@ -69,6 +69,7 @@
  * For history of changes, see Documentation/ChangeLog.megaraid
  */
 
+#include scsi/scsi_hotplug.h
 #include megaraid_mbox.h
 
 static int megaraid_init(void);
@@ -470,29 +471,107 @@
}
 };
 
+/*
+ * sysfs class device support
+ * creates two files:
+ * /sys/class/scsi_host
+ * |-- host0
+ * |   |-- logical_drive_created
+ * |   |-- logical_drive_destroyed
+ *
+ * These make the midlayer invoke /sbin/hotplug, which then calls back into 
sysfs
+ * /sys/class/scsi_host
+ * |-- host0
+ * |   |-- scan
+ *
+ * and
+ *
+ * /sys/devices/pci:0x/:0x:0x.0/host0
+ * |-- 0:0:0:0
+ * |   |-- delete
+ *
+ * respectively.  This allows userspace applications to work
+ * using their logical drive number, and lets the driver translate
+ * that into host, channel, id, and lun values which the other
+ * mechanisms require.  This is similar to how hot plug CPU works.
+ */
 
+/**
+ * lda_to_hcil()
+ * @adapter
+ * @lda - logical drive address
+ * @host_no

[RFC][PATCH 2.6.11-rc2] Linux SCSI hotplug infrastructure

2005-02-07 Thread Matt Domsch
Below is a patch to add some hotplug infrastructure to the Linux SCSI
subsystem.

New files:
include/scsi/scsi_hotplug.h
drivers/scsi/scsi_hotplug.c
implements a new exported function:

extern int scsi_topology_hctl_action(struct Scsi_Host *shost, unsigned int 
channel,
  unsigned int id, unsigned int lun, enum 
scsi_topology_action action);

which invokes kobject_hotplug() on a temporary scsi_topology
device.  This device represents a target that exists on a topology
(i.e. was just inserted into a hot plug enclosure, or was just created
by a RAID controller management application) but is not yet hooked
into the kernel.

Modified files:
drivers/scsi/Kconfig
drivers/scsi/Makefile
drivers/scsi/megaraid/megaraid_mbox.c
 (will follow in a separate patch)
 is the user of this new function.

In addition, two more infrastructure pieces are necessary:
udev-050-scsi_topology.patch - adds the subsystem name scsi_topology
to the list of devices *not* to wait for the creation of files in
sysfs for - scsi_topology devices aren't to be registered in sysfs.

/etc/hotplug/scsi_topology.agent
 handles the hotplug call, and invokes /sys/class/scsi_host/hostX/scan
 and /sys/class/scsi_device/H:C:T:L:/device/delete as appropriate.


The flow is as follows:

# echo 2  /sys/class/scsi_host/host2/logical_drive_created
(to be done by a management application that knows it just created
logical drive #2 on the controller)

megaraid_mbox.c sysfs method converts logical drive number to HCTL
value, calls scsi_topology_hctl_action().

scsi_topology_hctl_action() invokes kobject_hotplug() with a
scsi_topology subsystem device.

kobject_hotplug() calls /sbin/hotplug or /sbin/udevsend (more likely
the latter), which invokes /etc/hotplug/scsi_topology.agent with the
ACTION={add,remove}.

scsi_topology.agent invokes /sys/class/scsi_host/hostX/scan or
 /sys/class/scsi_device/H:C:T:L:/device/delete as appropriate.

From this point, we're back into known territory, with the device
being made known, or deleted from, the kernel's view.

Thoughts?

Signed-off-by: Matt Domsch [EMAIL PROTECTED]

-- 
Matt Domsch
Software Architect
Dell Linux Solutions linux.dell.com  www.dell.com/linux
Linux on Dell mailing lists @ http://lists.us.dell.com

= drivers/scsi/Kconfig 1.95 vs edited =
--- 1.95/drivers/scsi/Kconfig   2005-01-28 11:14:29 -06:00
+++ edited/drivers/scsi/Kconfig 2005-02-05 13:58:45 -06:00
@@ -185,6 +185,16 @@
  there should be no noticeable performance impact as long as you have
  logging turned off.
 
+config SCSI_HOTPLUG
+   bool Hot Plug SCSI devices
+   depends on SCSI  EXPERIMENTAL
+   default y
+   help
+ If your driver or management applications know about
+ device hot plugging (insertion/removal of physical disks in
+ a topology, or creation/deletion of logical disks on a RAID
+ controller), say Y here.  Otherwise, say N.
+
 menu SCSI Transport Attributes
depends on SCSI
 
= drivers/scsi/Makefile 1.72 vs edited =
--- 1.72/drivers/scsi/Makefile  2004-11-20 14:26:17 -06:00
+++ edited/drivers/scsi/Makefile2005-02-05 13:58:15 -06:00
@@ -147,6 +147,7 @@
   scsi_devinfo.o
 scsi_mod-$(CONFIG_SYSCTL)  += scsi_sysctl.o
 scsi_mod-$(CONFIG_SCSI_PROC_FS)+= scsi_proc.o
+scsi_mod-$(CONFIG_SCSI_HOTPLUG)+= scsi_hotplug.o
 
 sd_mod-objs:= sd.o
 sr_mod-objs:= sr.o sr_ioctl.o sr_vendor.o
--- /dev/null   Thu Apr 11 09:25:15 2002
+++ include/scsi/scsi_hotplug.h Sun Feb  6 23:29:51 2005
@@ -0,0 +1,41 @@
+/*
+ *  SCSI Hotplug
+ *
+ *  Copyright (c) 2005 Dell, Inc [EMAIL PROTECTED]
+ *
+ *  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.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+#ifndef _SCSI_SCSI_HOTPLUG_H
+#define _SCSI_SCSI_HOTPLUG_H
+
+#include linux/config.h
+#include scsi/scsi_host.h
+#include scsi/scsi_device.h
+
+enum scsi_topology_action {
+   SCSI_TOPOLOGY_ADDED= 1,  /* device added in the topology */
+   SCSI_TOPOLOGY_REMOVED  = 2,  /* device removed from the topology */
+};
+
+#if defined (CONFIG_SCSI_HOTPLUG) || defined(CONFIG_SCSI_HOTPLUG_MODULE)
+extern int scsi_topology_hctl_action(struct Scsi_Host *shost, unsigned int 
channel,
+ unsigned int id, unsigned int lun, enum

Re: [RFC][PATCH 2.6.11-rc2] Linux SCSI hotplug infrastructure

2005-02-07 Thread Matt Domsch
On Mon, Feb 07, 2005 at 12:27:53PM -0600, Matt Domsch wrote:
 Modified files:
 drivers/scsi/megaraid/megaraid_mbox.c
  (will follow in a separate patch)
  is the user of this new function.

For example.  I will rework this to follow the patch submitted last
week by LSI to accomplish something similar in their driver.

-- 
Matt Domsch
Software Architect
Dell Linux Solutions linux.dell.com  www.dell.com/linux
Linux on Dell mailing lists @ http://lists.us.dell.com

= drivers/scsi/megaraid/megaraid_mbox.c 1.12 vs edited =
--- 1.12/drivers/scsi/megaraid/megaraid_mbox.c  2005-01-31 00:33:46 -06:00
+++ edited/drivers/scsi/megaraid/megaraid_mbox.c2005-02-06 23:35:08 
-06:00
@@ -70,6 +70,7 @@
  * For history of changes, see Documentation/ChangeLog.megaraid
  */
 
+#include scsi/scsi_hotplug.h
 #include megaraid_mbox.h
 
 static int megaraid_init(void);
@@ -455,6 +456,100 @@
 
 
 /*
+ * sysfs class device support
+ * creates three files:
+ * /sys/class/scsi_host
+ * |-- host0
+ * |   |-- logical_drive_created
+ * |   |-- logical_drive_destroyed
+ *
+ * These make the midlayer invoke /sbin/hotplug, which then calls back into 
sysfs
+ * /sys/class/scsi_host
+ * |-- host0
+ * |   |-- scan
+ *
+ * and
+ *
+ * /sys/devices/pci:0x/:0x:0x.0/host0
+ * |-- 0:0:0:0
+ * |   |-- delete
+ *
+ * respectively.  This allows userspace applications to work
+ * using their logical drive number, and lets the driver translate
+ * that into host, channel, id, and lun values which the other
+ * mechanisms require.  This is similar to how hot plug CPU works.
+ */
+
+/**
+ * lda_to_hcil()
+ * @adapter
+ * @lda - logical drive address
+ * @host_no
+ * @channel
+ * @id
+ * @lun
+ *
+ * converts a logical drive address into a host, channel id, lun tuple.
+ */
+
+static inline int megaraid_lda_to_hcil(struct Scsi_Host *shost, u32 lda,
+  u32 *host_no, u32 *channel, u32 *id, u32 
*lun)
+{
+   if (lda  MAX_LOGICAL_DRIVES_40LD)
+   return -EINVAL;
+   *host_no = shost-host_no;
+   *channel = shost-max_channel;
+   *id  = (lda  shost-this_id) ? lda : lda + 1;
+   *lun = 0;
+   return 0;
+}
+
+static int megaraid_host_store(struct class_device *class_dev, const char 
*buf, size_t count,
+  enum scsi_topology_action action)
+{
+struct Scsi_Host *shost = class_to_shost(class_dev);
+   int fields=0, rc=-EINVAL;
+   u32 lda=0, host_no=0, channel=0, id=0, lun=0;
+   fields = sscanf(buf, %u, lda);
+   if (fields != 1)
+   return rc;
+   if (lda  MAX_LOGICAL_DRIVES_40LD)
+   return rc;
+   rc = megaraid_lda_to_hcil(shost, lda, host_no, channel, id, lun);
+   if (rc)
+   return rc;
+
+   rc = scsi_topology_hctl_action(shost, channel, id, lun, action);
+
+   if (rc)
+   return rc;
+   return count;
+}
+
+static ssize_t megaraid_host_store_ld_created(struct class_device *class_dev, 
const char *buf, size_t count)
+{
+   return megaraid_host_store(class_dev, buf, count, SCSI_TOPOLOGY_ADDED);
+}
+static ssize_t megaraid_host_store_ld_destroyed(struct class_device 
*class_dev, const char *buf, size_t count)
+{
+   return megaraid_host_store(class_dev, buf, count, 
SCSI_TOPOLOGY_REMOVED);
+}
+
+
+#define MEGARAID_HOST_WOATTR(_name,_store) \
+CLASS_DEVICE_ATTR(_name, S_IWUSR|S_IWGRP, NULL, _store)
+
+static MEGARAID_HOST_WOATTR(logical_drive_created, 
megaraid_host_store_ld_created);
+static MEGARAID_HOST_WOATTR(logical_drive_destroyed, 
megaraid_host_store_ld_destroyed);
+
+/* Host attributes initializer */
+static struct class_device_attribute *megaraid_host_attrs[] = {
+   class_device_attr_logical_drive_created,
+   class_device_attr_logical_drive_destroyed,
+   NULL,
+};
+
+/*
  * Scsi host template for megaraid unified driver
  */
 static struct scsi_host_template megaraid_template_g = {
@@ -467,6 +562,7 @@
.eh_bus_reset_handler   = megaraid_reset_handler,
.eh_host_reset_handler  = megaraid_reset_handler,
.use_clustering = ENABLE_CLUSTERING,
+   .shost_attrs= megaraid_host_attrs,
 };
 
 
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC][PATCH 2.6.11-rc2] Linux SCSI hotplug infrastructure

2005-02-07 Thread Matt Domsch
On Mon, Feb 07, 2005 at 12:27:53PM -0600, Matt Domsch wrote:
 In addition, two more infrastructure pieces are necessary:
 udev-050-scsi_topology.patch - adds the subsystem name scsi_topology
 to the list of devices *not* to wait for the creation of files in
 sysfs for - scsi_topology devices aren't to be registered in sysfs.

Patch follows.

Signed-off-by: Matt Domsch [EMAIL PROTECTED]

-- 
Matt Domsch
Software Architect
Dell Linux Solutions linux.dell.com  www.dell.com/linux
Linux on Dell mailing lists @ http://lists.us.dell.com

--- udev-050/udev_sysfs.c.~1~   2004-12-17 23:53:07.0 -0600
+++ udev-050/udev_sysfs.c   2005-02-07 10:58:45.0 -0600
@@ -56,6 +56,7 @@
{ .subsystem = fc_host,   .file = port_id },
{ .subsystem = spi_transport, .file = width },
{ .subsystem = spi_host,  .file = width },
+   { .subsystem = scsi_topology, .file = NULL },
{ NULL, NULL }
 };
 
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC][PATCH 2.6.11-rc2] Linux SCSI hotplug infrastructure

2005-02-07 Thread Matt Domsch
On Mon, Feb 07, 2005 at 12:27:53PM -0600, Matt Domsch wrote:
 /etc/hotplug/scsi_topology.agent
  handles the hotplug call, and invokes /sys/class/scsi_host/hostX/scan
  and /sys/class/scsi_device/H:C:T:L:/device/delete as appropriate.

And here's scsi_topology.agent.

Signed-off-by: Matt Domsch [EMAIL PROTECTED]

--
Matt Domsch
Software Architect
Dell Linux Solutions linux.dell.com  www.dell.com/linux
Linux on Dell mailing lists @ http://lists.us.dell.com

#!/bin/bash
#
# SCSI Topology hotplug agent.
# Copyright (C) 2005 Dell, Inc.  [EMAIL PROTECTED]
#
# This is invoked when a device, not currently known to the system, is
# added or removed from a SCSI topology.  This includes creation of a
# logical drive on a RAID controller, or manually inserting a disk
# into a SCSI disk enclosure.  This script then invokes the scan
# method of the scsi_host, or the delete method of the scsi_device, to
# inform the kernel of the change made on the topology.
#
# SCSI_TOPOLOGY_EVENT_HCTL is used to know that the data to pass to
# scan is a Host:Controller:Target ID:LUN tuple.  This is to provide
# for future SCSI implmentations that may use a native addressing
# scheme rather than only HCTL.


[ ${SCSI_TOPOLOGY_EVENT} != 1 ]  exit
[ ${SCSI_TOPOLOGY_EVENT_HCTL} != 1 ]  exit

if [ ${ACTION} = add ]; then
MYPATH=/sys/class/scsi_host/host${SCSI_HOST}/scan
[ -f ${MYPATH} ]  echo ${SCSI_CHANNEL} ${SCSI_ID} ${SCSI_LUN}  
${MYPATH}
fi

if [ ${ACTION} = remove ]; then

MYPATH=/sys/class/scsi_device/${SCSI_HOST}:${SCSI_CHANNEL}:${SCSI_ID}:${SCSI_LUN}/device/delete
[ -f ${MYPATH} ]  echo 1  ${MYPATH}
fi
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


<    1   2   3