public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PCI / OF linkage in sysfs
@ 2004-02-04  7:12 Benjamin Herrenschmidt
  2004-02-04 22:08 ` Linus Torvalds
  0 siblings, 1 reply; 14+ messages in thread
From: Benjamin Herrenschmidt @ 2004-02-04  7:12 UTC (permalink / raw)
  To: Linux Kernel list; +Cc: Andrew Morton, Greg KH

Hi !

This patch adds a "devspec" property to all PCI entries in sysfs
that provides the full "Open Firmware" path to each device on
PPC and PPC64 platforms that have Open Firmware support.

For various reasons, the OF path is and will still be different than
the sysfs path, and userland needs the OF path for various things,
ranging from bootloader setup to XFree needing to access some OF
properties provided by the graphic card F-Code driver, etc...

The "devspec" name is what we already use for "macio" type devices,
it doesn't clash with anything else.

If you are happy with it, please apply (independently of the rest
of the PowerMac patch), I need that to fix various things in XFree
(among others), so it would be nice to have it in by 2.6.3 final

Regards,
Ben.

diff -urN linux-2.5/drivers/pci/pci-sysfs.c linuxppc-2.5-benh/drivers/pci/pci-sysfs.c
--- linux-2.5/drivers/pci/pci-sysfs.c	2004-02-02 13:09:08.000000000 +1100
+++ linuxppc-2.5-benh/drivers/pci/pci-sysfs.c	2004-02-04 17:57:05.000000000 +1100
@@ -20,6 +20,24 @@
 
 #include "pci.h"
 
+#ifdef CONFIG_PPC_OF
+#include <asm/prom.h>
+#include <asm/pci-bridge.h>
+
+static ssize_t pci_show_devspec(struct device *dev, char *buf)
+{
+	struct pci_dev *pdev;
+	struct device_node *np;
+
+	pdev = to_pci_dev (dev);
+	np = pci_device_to_OF_node(pdev);
+	if (np == NULL || np->full_name == NULL)
+		return 0;
+	return sprintf(buf, "%s", np->full_name);
+}
+static DEVICE_ATTR(devspec, S_IRUGO, pci_show_devspec, NULL);
+#endif /* CONFIG_PPC_OF */
+
 /* show configuration fields */
 #define pci_config_attr(field, format_string)				\
 static ssize_t								\
@@ -179,5 +197,8 @@
 	device_create_file (dev, &dev_attr_class);
 	device_create_file (dev, &dev_attr_irq);
 	device_create_file (dev, &dev_attr_resource);
+#ifdef CONFIG_PPC_OF
+	device_create_file (dev, &dev_attr_devspec);
+#endif
 	sysfs_create_bin_file(&dev->kobj, &pci_config_attr);
 }



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

end of thread, other threads:[~2004-02-05 15:15 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-04  7:12 [PATCH] PCI / OF linkage in sysfs Benjamin Herrenschmidt
2004-02-04 22:08 ` Linus Torvalds
2004-02-04 23:13   ` Greg KH
2004-02-04 23:28     ` Benjamin Herrenschmidt
2004-02-04 23:39       ` Greg KH
2004-02-04 23:28     ` Linus Torvalds
2004-02-04 23:38       ` Greg KH
2004-02-04 23:50       ` Benjamin Herrenschmidt
2004-02-05  0:04         ` Linus Torvalds
2004-02-05  0:13           ` Benjamin Herrenschmidt
2004-02-05  0:39             ` Linus Torvalds
2004-02-05  0:50               ` Benjamin Herrenschmidt
2004-02-05 15:08               ` Eric W. Biederman
2004-02-04 23:26   ` Benjamin Herrenschmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox