diff options
-rw-r--r-- | arch/sparc64/kernel/pci_common.c | 25 | ||||
-rw-r--r-- | drivers/sbus/sbus.c | 18 |
2 files changed, 41 insertions, 2 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 | ||
134 | static ssize_t | ||
135 | show_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 | |||
146 | static 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 | ||
220 | void __init pci_fill_in_pbm_cookies(struct pci_bus *pbus, | 243 | void __init pci_fill_in_pbm_cookies(struct pci_bus *pbus, |
diff --git a/drivers/sbus/sbus.c b/drivers/sbus/sbus.c index 98fcbb3d5560..6349dd617f85 100644 --- a/drivers/sbus/sbus.c +++ b/drivers/sbus/sbus.c | |||
@@ -7,6 +7,7 @@ | |||
7 | #include <linux/slab.h> | 7 | #include <linux/slab.h> |
8 | #include <linux/init.h> | 8 | #include <linux/init.h> |
9 | #include <linux/pci.h> | 9 | #include <linux/pci.h> |
10 | #include <linux/device.h> | ||
10 | 11 | ||
11 | #include <asm/system.h> | 12 | #include <asm/system.h> |
12 | #include <asm/sbus.h> | 13 | #include <asm/sbus.h> |
@@ -17,13 +18,25 @@ | |||
17 | #include <asm/bpp.h> | 18 | #include <asm/bpp.h> |
18 | #include <asm/irq.h> | 19 | #include <asm/irq.h> |
19 | 20 | ||
21 | static ssize_t | ||
22 | show_sbusobppath_attr(struct device * dev, struct device_attribute * attr, char * buf) | ||
23 | { | ||
24 | struct sbus_dev *sbus; | ||
25 | |||
26 | sbus = to_sbus_device(dev); | ||
27 | |||
28 | return snprintf (buf, PAGE_SIZE, "%s\n", sbus->ofdev.node->full_name); | ||
29 | } | ||
30 | |||
31 | static DEVICE_ATTR(obppath, S_IRUSR | S_IRGRP | S_IROTH, show_sbusobppath_attr, NULL); | ||
32 | |||
20 | struct sbus_bus *sbus_root; | 33 | struct sbus_bus *sbus_root; |
21 | 34 | ||
22 | static void __init fill_sbus_device(struct device_node *dp, struct sbus_dev *sdev) | 35 | static void __init fill_sbus_device(struct device_node *dp, struct sbus_dev *sdev) |
23 | { | 36 | { |
24 | unsigned long base; | 37 | unsigned long base; |
25 | void *pval; | 38 | void *pval; |
26 | int len; | 39 | int len, err; |
27 | 40 | ||
28 | sdev->prom_node = dp->node; | 41 | sdev->prom_node = dp->node; |
29 | strcpy(sdev->prom_name, dp->name); | 42 | strcpy(sdev->prom_name, dp->name); |
@@ -66,6 +79,9 @@ static void __init fill_sbus_device(struct device_node *dp, struct sbus_dev *sde | |||
66 | if (of_device_register(&sdev->ofdev) != 0) | 79 | if (of_device_register(&sdev->ofdev) != 0) |
67 | printk(KERN_DEBUG "sbus: device registration error for %s!\n", | 80 | printk(KERN_DEBUG "sbus: device registration error for %s!\n", |
68 | dp->path_component_name); | 81 | dp->path_component_name); |
82 | |||
83 | /* WE HAVE BEEN INVADED BY ALIENS! */ | ||
84 | err = sysfs_create_file(&sdev->ofdev.dev.kobj, &dev_attr_obppath.attr); | ||
69 | } | 85 | } |
70 | 86 | ||
71 | static void __init sbus_bus_ranges_init(struct device_node *dp, struct sbus_bus *sbus) | 87 | static void __init sbus_bus_ranges_init(struct device_node *dp, struct sbus_bus *sbus) |