aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc64
diff options
context:
space:
mode:
authorFabio Massimo Di Nitto <fabbione@ubuntu.com>2006-12-20 12:22:28 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2007-02-11 02:50:35 -0500
commitcf69eab231bb748b5c34912412a8fc8c763bcf57 (patch)
tree4e1a080b7d33765d9ec62ead60bc3c9004a961a3 /arch/sparc64
parentd18d7682c18b617f523df6beea5ea0bd396ed0bd (diff)
[SPARC64]: Add obppath sysfs attribute for SBUS and PCI devices.
Signed-off-by: Fabio Massimo Di Nitto <fabbione@ubuntu.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64')
-rw-r--r--arch/sparc64/kernel/pci_common.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/arch/sparc64/kernel/pci_common.c b/arch/sparc64/kernel/pci_common.c
index 827ae30aa497..5a92cb90ebe0 100644
--- a/arch/sparc64/kernel/pci_common.c
+++ b/arch/sparc64/kernel/pci_common.c
@@ -7,6 +7,8 @@
7#include <linux/string.h> 7#include <linux/string.h>
8#include <linux/slab.h> 8#include <linux/slab.h>
9#include <linux/init.h> 9#include <linux/init.h>
10#include <linux/pci.h>
11#include <linux/device.h>
10 12
11#include <asm/pbm.h> 13#include <asm/pbm.h>
12#include <asm/prom.h> 14#include <asm/prom.h>
@@ -129,6 +131,20 @@ static void __init fixup_obp_assignments(struct pci_dev *pdev,
129 } 131 }
130} 132}
131 133
134static ssize_t
135show_pciobppath_attr(struct device * dev, struct device_attribute * attr, char * buf)
136{
137 struct pci_dev *pdev;
138 struct pcidev_cookie *sysdata;
139
140 pdev = to_pci_dev(dev);
141 sysdata = pdev->sysdata;
142
143 return snprintf (buf, PAGE_SIZE, "%s\n", sysdata->prom_node->full_name);
144}
145
146static DEVICE_ATTR(obppath, S_IRUSR | S_IRGRP | S_IROTH, show_pciobppath_attr, NULL);
147
132/* Fill in the PCI device cookie sysdata for the given 148/* Fill in the PCI device cookie sysdata for the given
133 * PCI device. This cookie is the means by which one 149 * PCI device. This cookie is the means by which one
134 * can get to OBP and PCI controller specific information 150 * can get to OBP and PCI controller specific information
@@ -142,7 +158,7 @@ static void __init pdev_cookie_fillin(struct pci_pbm_info *pbm,
142 struct pcidev_cookie *pcp; 158 struct pcidev_cookie *pcp;
143 struct device_node *dp; 159 struct device_node *dp;
144 struct property *prop; 160 struct property *prop;
145 int nregs, len; 161 int nregs, len, err;
146 162
147 dp = find_device_prom_node(pbm, pdev, bus_node, 163 dp = find_device_prom_node(pbm, pdev, bus_node,
148 &pregs, &nregs); 164 &pregs, &nregs);
@@ -215,6 +231,13 @@ static void __init pdev_cookie_fillin(struct pci_pbm_info *pbm,
215 fixup_obp_assignments(pdev, pcp); 231 fixup_obp_assignments(pdev, pcp);
216 232
217 pdev->sysdata = pcp; 233 pdev->sysdata = pcp;
234
235 /* we don't really care if we can create this file or not,
236 * but we need to assign the result of the call or the world will fall
237 * under alien invasion and everybody will be frozen on a spaceship
238 * ready to be eaten on alpha centauri by some green and jelly humanoid.
239 */
240 err = sysfs_create_file(&pdev->dev.kobj, &dev_attr_obppath.attr);
218} 241}
219 242
220void __init pci_fill_in_pbm_cookies(struct pci_bus *pbus, 243void __init pci_fill_in_pbm_cookies(struct pci_bus *pbus,