linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ppc64: add MODALIAS= for vio bus
@ 2005-10-30 21:39 Olaf Hering
  2005-10-31  2:48 ` Stephen Rothwell
  2005-11-05 12:13 ` Olaf Hering
  0 siblings, 2 replies; 4+ messages in thread
From: Olaf Hering @ 2005-10-30 21:39 UTC (permalink / raw)
  To: Paul Mackeras, Andrew Morton; +Cc: linuxppc64-dev, linux-kernel

A non-broken udev would autoload also the drivers for devices on the
pseries vio bus, like ibmveth, ibmvscsic and hvsc. This is similar to
pci, usb and ieee1394:

 /lib/modules/`uname -r`/modules.alias
alias vio:TvscsiSIBM,v-scsi* ibmvscsic
alias vio:TnetworkSIBM,l-lan* ibmveth
alias vio:Tserial-serverShvterm2* hvcs

/events/debug.00004.pci.add.1394:MODALIAS='pci:v00001014d00000188sv00000000sd00000000bc06sc04i0f'
/events/debug.00005.pci.add.1509:MODALIAS='pci:v00008086d00001229sv00001014sd000001FFbc02sc00i00'
/events/debug.00026.vio.add.1519:MODALIAS='vio:TserialShvterm1'
/events/debug.00027.vio.add.1446:MODALIAS='vio:TvscsiSIBM,v-scsi'
/events/debug.00028.vio.add.1451:MODALIAS='vio:TnetworkSIBM,l-lan'

 modprobe -v vio:TnetworkSIBM,l-lan
insmod /lib/modules/2.6.14-20051030_vio-ppc64/kernel/drivers/net/ibmveth.ko 


Signed-off-by: Olaf Hering <olh@suse.de>

 arch/ppc64/kernel/vio.c |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+)

Index: linux-2.6.14-olh/arch/ppc64/kernel/vio.c
===================================================================
--- linux-2.6.14-olh.orig/arch/ppc64/kernel/vio.c
+++ linux-2.6.14-olh/arch/ppc64/kernel/vio.c
@@ -21,6 +21,7 @@
 #include <asm/iommu.h>
 #include <asm/dma.h>
 #include <asm/vio.h>
+#include <asm/prom.h>
 
 static const struct vio_device_id *vio_match_device(
 		const struct vio_device_id *, const struct vio_dev *);
@@ -255,7 +256,33 @@ static int vio_bus_match(struct device *
 	return (ids != NULL) && (vio_match_device(ids, vio_dev) != NULL);
 }
 
+static int pseries_vio_hotplug (struct device *dev, char **envp, int num_envp,
+                          char *buffer, int buffer_size)
+{
+	const struct vio_dev *vio_dev = to_vio_dev(dev);
+	char *cp;
+	int length;
+
+	if (!num_envp)
+		return -ENOMEM;
+
+	if (!vio_dev->dev.platform_data)
+		return -ENODEV;
+	cp = (char *)get_property(vio_dev->dev.platform_data, "compatible", &length);
+	if (!cp)
+		return -ENODEV;
+
+	envp[0] = buffer;
+	length = scnprintf (buffer, buffer_size, "MODALIAS=vio:T%sS%s",
+	                     vio_dev->type, cp);
+	if (buffer_size - length <= 0)
+		return -ENOMEM;
+	envp[1] = NULL;
+	return 0;
+}
+
 struct bus_type vio_bus_type = {
 	.name = "vio",
+	.hotplug = pseries_vio_hotplug,
 	.match = vio_bus_match,
 };
-- 
short story of a lazy sysadmin:
 alias appserv=wotan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ppc64: add MODALIAS= for vio bus
  2005-10-30 21:39 [PATCH] ppc64: add MODALIAS= for vio bus Olaf Hering
@ 2005-10-31  2:48 ` Stephen Rothwell
  2005-10-31  7:38   ` Olaf Hering
  2005-11-05 12:13 ` Olaf Hering
  1 sibling, 1 reply; 4+ messages in thread
From: Stephen Rothwell @ 2005-10-31  2:48 UTC (permalink / raw)
  To: Olaf Hering; +Cc: paulus, akpm, linuxppc64-dev, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 653 bytes --]

Hi Olaf,

This patch breaks lagacy iSeries i.e. it won't link (iSeries has no get_property()).
It may be easier to redo this patch against Paulus' merge tree.

A couple of trivial comments:

On Sun, 30 Oct 2005 22:39:00 +0100 Olaf Hering <olh@suse.de> wrote:
>
> +static int pseries_vio_hotplug (struct device *dev, char **envp, int num_envp,
                                 ^
No space here, please.

> +	length = scnprintf (buffer, buffer_size, "MODALIAS=vio:T%sS%s",
                          ^
No space here either, please.

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ppc64: add MODALIAS= for vio bus
  2005-10-31  2:48 ` Stephen Rothwell
@ 2005-10-31  7:38   ` Olaf Hering
  0 siblings, 0 replies; 4+ messages in thread
From: Olaf Hering @ 2005-10-31  7:38 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: paulus, akpm, linuxppc64-dev, linux-kernel

 On Mon, Oct 31, Stephen Rothwell wrote:

> Hi Olaf,
> 
> This patch breaks lagacy iSeries i.e. it won't link (iSeries has no get_property()).
> It may be easier to redo this patch against Paulus' merge tree.

Can you fix it up, why is there no get_property for iseries, yet?
iseries_veth should be autoloaded in a similar way.
Maybe it should just go into a CONFIG_PSERIES or whatever.

> A couple of trivial comments:
> 
> On Sun, 30 Oct 2005 22:39:00 +0100 Olaf Hering <olh@suse.de> wrote:
> >
> > +static int pseries_vio_hotplug (struct device *dev, char **envp, int num_envp,
>                                  ^
> No space here, please.
> 
> > +	length = scnprintf (buffer, buffer_size, "MODALIAS=vio:T%sS%s",
>                           ^
> No space here either, please.

I copied it from macio_asic.c.


-- 
short story of a lazy sysadmin:
 alias appserv=wotan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ppc64: add MODALIAS= for vio bus
  2005-10-30 21:39 [PATCH] ppc64: add MODALIAS= for vio bus Olaf Hering
  2005-10-31  2:48 ` Stephen Rothwell
@ 2005-11-05 12:13 ` Olaf Hering
  1 sibling, 0 replies; 4+ messages in thread
From: Olaf Hering @ 2005-11-05 12:13 UTC (permalink / raw)
  To: Paul Mackeras, Andrew Morton; +Cc: linuxppc64-dev, linux-kernel


A non-broken udev would autoload also the drivers for devices on the
pseries vio bus, like ibmveth, ibmvscsic and hvsc. This is similar to
pci, usb and ieee1394:

 /lib/modules/`uname -r`/modules.alias
alias vio:TvscsiSIBM,v-scsi* ibmvscsic
alias vio:TnetworkSIBM,l-lan* ibmveth
alias vio:Tserial-serverShvterm2* hvcs

/events/debug.00004.pci.add.1394:MODALIAS='pci:v00001014d00000188sv00000000sd00000000bc06sc04i0f'
/events/debug.00005.pci.add.1509:MODALIAS='pci:v00008086d00001229sv00001014sd000001FFbc02sc00i00'
/events/debug.00026.vio.add.1519:MODALIAS='vio:TserialShvterm1'
/events/debug.00027.vio.add.1446:MODALIAS='vio:TvscsiSIBM,v-scsi'
/events/debug.00028.vio.add.1451:MODALIAS='vio:TnetworkSIBM,l-lan'

 modprobe -v vio:TnetworkSIBM,l-lan
insmod /lib/modules/2.6.14-20051030_vio-ppc64/kernel/drivers/net/ibmveth.ko 



Signed-off-by: Olaf Hering <olh@suse.de>

 arch/powerpc/kernel/vio.c |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+)

Index: linux-2.6.14-olh/arch/powerpc/kernel/vio.c
===================================================================
--- linux-2.6.14-olh.orig/arch/powerpc/kernel/vio.c
+++ linux-2.6.14-olh/arch/powerpc/kernel/vio.c
@@ -21,6 +21,7 @@
 #include <asm/iommu.h>
 #include <asm/dma.h>
 #include <asm/vio.h>
+#include <asm/prom.h>
 
 static const struct vio_device_id *vio_match_device(
 		const struct vio_device_id *, const struct vio_dev *);
@@ -265,7 +266,33 @@ static int vio_bus_match(struct device *
 	return (ids != NULL) && (vio_match_device(ids, vio_dev) != NULL);
 }
 
+static int vio_hotplug(struct device *dev, char **envp, int num_envp,
+			char *buffer, int buffer_size)
+{
+	const struct vio_dev *vio_dev = to_vio_dev(dev);
+	char *cp;
+	int length;
+
+	if (!num_envp)
+		return -ENOMEM;
+
+	if (!vio_dev->dev.platform_data)
+		return -ENODEV;
+	cp = (char *)get_property(vio_dev->dev.platform_data, "compatible", &length);
+	if (!cp)
+		return -ENODEV;
+
+	envp[0] = buffer;
+	length = scnprintf(buffer, buffer_size, "MODALIAS=vio:T%sS%s",
+				vio_dev->type, cp);
+	if (buffer_size - length <= 0)
+		return -ENOMEM;
+	envp[1] = NULL;
+	return 0;
+}
+
 struct bus_type vio_bus_type = {
 	.name = "vio",
+	.hotplug = vio_hotplug,
 	.match = vio_bus_match,
 };
-- 
short story of a lazy sysadmin:
 alias appserv=wotan

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-11-05 12:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-30 21:39 [PATCH] ppc64: add MODALIAS= for vio bus Olaf Hering
2005-10-31  2:48 ` Stephen Rothwell
2005-10-31  7:38   ` Olaf Hering
2005-11-05 12:13 ` Olaf Hering

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).