diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-02 10:56:44 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-02 10:56:44 -0500 |
commit | b7f3a209e9b09b3110ea084836c75f2cd26b29f2 (patch) | |
tree | b5f77cb3f2eab58a2a2f3705fdd08bd39ea02a3f /arch/sparc/kernel/pci.c | |
parent | 6d6b89bd2e316b78d668f761d380837b81fa71ef (diff) | |
parent | 4b17764737bb4ee3364b8bfa2059f51ebc19ccd6 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next-2.6:
sparc: Support show_unhandled_signals.
sparc: use __ratelimit
sunxvr500: Additional PCI id for sunxvr500 driver
sparc: use asm-generic/scatterlist.h
sparc64: If 'slot-names' property exist, create sysfs PCI slot information.
sparc: remove trailing space in messages
sparc: remove redundant return statements
Diffstat (limited to 'arch/sparc/kernel/pci.c')
-rw-r--r-- | arch/sparc/kernel/pci.c | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c index 37b66c60abe3..5ac539a5930f 100644 --- a/arch/sparc/kernel/pci.c +++ b/arch/sparc/kernel/pci.c | |||
@@ -1095,3 +1095,78 @@ static int __init pcibios_init(void) | |||
1095 | return 0; | 1095 | return 0; |
1096 | } | 1096 | } |
1097 | subsys_initcall(pcibios_init); | 1097 | subsys_initcall(pcibios_init); |
1098 | |||
1099 | #ifdef CONFIG_SYSFS | ||
1100 | static void __devinit pci_bus_slot_names(struct device_node *node, | ||
1101 | struct pci_bus *bus) | ||
1102 | { | ||
1103 | const struct pci_slot_names { | ||
1104 | u32 slot_mask; | ||
1105 | char names[0]; | ||
1106 | } *prop; | ||
1107 | const char *sp; | ||
1108 | int len, i; | ||
1109 | u32 mask; | ||
1110 | |||
1111 | prop = of_get_property(node, "slot-names", &len); | ||
1112 | if (!prop) | ||
1113 | return; | ||
1114 | |||
1115 | mask = prop->slot_mask; | ||
1116 | sp = prop->names; | ||
1117 | |||
1118 | if (ofpci_verbose) | ||
1119 | printk("PCI: Making slots for [%s] mask[0x%02x]\n", | ||
1120 | node->full_name, mask); | ||
1121 | |||
1122 | i = 0; | ||
1123 | while (mask) { | ||
1124 | struct pci_slot *pci_slot; | ||
1125 | u32 this_bit = 1 << i; | ||
1126 | |||
1127 | if (!(mask & this_bit)) { | ||
1128 | i++; | ||
1129 | continue; | ||
1130 | } | ||
1131 | |||
1132 | if (ofpci_verbose) | ||
1133 | printk("PCI: Making slot [%s]\n", sp); | ||
1134 | |||
1135 | pci_slot = pci_create_slot(bus, i, sp, NULL); | ||
1136 | if (IS_ERR(pci_slot)) | ||
1137 | printk(KERN_ERR "PCI: pci_create_slot returned %ld\n", | ||
1138 | PTR_ERR(pci_slot)); | ||
1139 | |||
1140 | sp += strlen(sp) + 1; | ||
1141 | mask &= ~this_bit; | ||
1142 | i++; | ||
1143 | } | ||
1144 | } | ||
1145 | |||
1146 | static int __init of_pci_slot_init(void) | ||
1147 | { | ||
1148 | struct pci_bus *pbus = NULL; | ||
1149 | |||
1150 | while ((pbus = pci_find_next_bus(pbus)) != NULL) { | ||
1151 | struct device_node *node; | ||
1152 | |||
1153 | if (pbus->self) { | ||
1154 | struct dev_archdata *sd = pbus->self->sysdata; | ||
1155 | |||
1156 | /* PCI->PCI bridge */ | ||
1157 | node = sd->prom_node; | ||
1158 | } else { | ||
1159 | struct pci_pbm_info *pbm = pbus->sysdata; | ||
1160 | |||
1161 | /* Host PCI controller */ | ||
1162 | node = pbm->op->node; | ||
1163 | } | ||
1164 | |||
1165 | pci_bus_slot_names(node, pbus); | ||
1166 | } | ||
1167 | |||
1168 | return 0; | ||
1169 | } | ||
1170 | |||
1171 | module_init(of_pci_slot_init); | ||
1172 | #endif | ||