aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/ipmi/ipmi_si_intf.c
diff options
context:
space:
mode:
authorMatthew Garrett <mjg@redhat.com>2010-05-26 17:43:49 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-05-27 12:12:50 -0400
commit06ee459402434aabed0c6d03c4cc10bfe4a3a65b (patch)
tree810654dc80af9bcf1cfd11d0bad4bf21c500e736 /drivers/char/ipmi/ipmi_si_intf.c
parent3326f4f2276791561af1fd5f2020be0186459813 (diff)
ipmi: attempt to register multiple SIs of the same type
Some odd systems may have multiple BMCs, and we want to be able to support them. Let's make the assumption that if a system legitimately has multiple BMCs then each BMC's SI will be of the same type, and also that we won't see multiple SIs of the same type unless we have multiple BMCs. If these hold true then we should register all SIs of the same type. Signed-off-by: Matthew Garrett <mjg@redhat.com> Signed-off-by: Corey Minyard <cminyard@mvista.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/ipmi/ipmi_si_intf.c')
-rw-r--r--drivers/char/ipmi/ipmi_si_intf.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index 46bf2a97d6cb..6503d995b727 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -3278,6 +3278,7 @@ static __devinit int init_ipmi_si(void)
3278 char *str; 3278 char *str;
3279 int rv; 3279 int rv;
3280 struct smi_info *e; 3280 struct smi_info *e;
3281 enum ipmi_addr_src type = SI_INVALID;
3281 3282
3282 if (initialized) 3283 if (initialized)
3283 return 0; 3284 return 0;
@@ -3344,30 +3345,43 @@ static __devinit int init_ipmi_si(void)
3344 of_register_platform_driver(&ipmi_of_platform_driver); 3345 of_register_platform_driver(&ipmi_of_platform_driver);
3345#endif 3346#endif
3346 3347
3347 /* Try to register something with interrupts first */ 3348 /* We prefer devices with interrupts, but in the case of a machine
3349 with multiple BMCs we assume that there will be several instances
3350 of a given type so if we succeed in registering a type then also
3351 try to register everything else of the same type */
3348 3352
3349 mutex_lock(&smi_infos_lock); 3353 mutex_lock(&smi_infos_lock);
3350 list_for_each_entry(e, &smi_infos, link) { 3354 list_for_each_entry(e, &smi_infos, link) {
3351 if (e->irq) { 3355 /* Try to register a device if it has an IRQ and we either
3356 haven't successfully registered a device yet or this
3357 device has the same type as one we successfully registered */
3358 if (e->irq && (!type || e->addr_source == type)) {
3352 if (!try_smi_init(e)) { 3359 if (!try_smi_init(e)) {
3353 mutex_unlock(&smi_infos_lock); 3360 type = e->addr_source;
3354 return 0;
3355 } 3361 }
3356 } 3362 }
3357 } 3363 }
3358 3364
3365 /* type will only have been set if we successfully registered an si */
3366 if (type) {
3367 mutex_unlock(&smi_infos_lock);
3368 return 0;
3369 }
3370
3359 /* Fall back to the preferred device */ 3371 /* Fall back to the preferred device */
3360 3372
3361 list_for_each_entry(e, &smi_infos, link) { 3373 list_for_each_entry(e, &smi_infos, link) {
3362 if (!e->irq) { 3374 if (!e->irq && (!type || e->addr_source == type)) {
3363 if (!try_smi_init(e)) { 3375 if (!try_smi_init(e)) {
3364 mutex_unlock(&smi_infos_lock); 3376 type = e->addr_source;
3365 return 0;
3366 } 3377 }
3367 } 3378 }
3368 } 3379 }
3369 mutex_unlock(&smi_infos_lock); 3380 mutex_unlock(&smi_infos_lock);
3370 3381
3382 if (type)
3383 return 0;
3384
3371 if (si_trydefaults) { 3385 if (si_trydefaults) {
3372 mutex_lock(&smi_infos_lock); 3386 mutex_lock(&smi_infos_lock);
3373 if (list_empty(&smi_infos)) { 3387 if (list_empty(&smi_infos)) {