diff options
Diffstat (limited to 'drivers/firmware')
-rw-r--r-- | drivers/firmware/dcdbas.c | 12 | ||||
-rw-r--r-- | drivers/firmware/dmi_scan.c | 74 | ||||
-rw-r--r-- | drivers/firmware/iscsi_ibft.c | 4 |
3 files changed, 65 insertions, 25 deletions
diff --git a/drivers/firmware/dcdbas.c b/drivers/firmware/dcdbas.c index 777fba48d2d..3009e0171e5 100644 --- a/drivers/firmware/dcdbas.c +++ b/drivers/firmware/dcdbas.c | |||
@@ -244,7 +244,7 @@ static ssize_t host_control_on_shutdown_store(struct device *dev, | |||
244 | */ | 244 | */ |
245 | int dcdbas_smi_request(struct smi_cmd *smi_cmd) | 245 | int dcdbas_smi_request(struct smi_cmd *smi_cmd) |
246 | { | 246 | { |
247 | cpumask_t old_mask; | 247 | cpumask_var_t old_mask; |
248 | int ret = 0; | 248 | int ret = 0; |
249 | 249 | ||
250 | if (smi_cmd->magic != SMI_CMD_MAGIC) { | 250 | if (smi_cmd->magic != SMI_CMD_MAGIC) { |
@@ -254,8 +254,11 @@ int dcdbas_smi_request(struct smi_cmd *smi_cmd) | |||
254 | } | 254 | } |
255 | 255 | ||
256 | /* SMI requires CPU 0 */ | 256 | /* SMI requires CPU 0 */ |
257 | old_mask = current->cpus_allowed; | 257 | if (!alloc_cpumask_var(&old_mask, GFP_KERNEL)) |
258 | set_cpus_allowed_ptr(current, &cpumask_of_cpu(0)); | 258 | return -ENOMEM; |
259 | |||
260 | cpumask_copy(old_mask, ¤t->cpus_allowed); | ||
261 | set_cpus_allowed_ptr(current, cpumask_of(0)); | ||
259 | if (smp_processor_id() != 0) { | 262 | if (smp_processor_id() != 0) { |
260 | dev_dbg(&dcdbas_pdev->dev, "%s: failed to get CPU 0\n", | 263 | dev_dbg(&dcdbas_pdev->dev, "%s: failed to get CPU 0\n", |
261 | __func__); | 264 | __func__); |
@@ -275,7 +278,8 @@ int dcdbas_smi_request(struct smi_cmd *smi_cmd) | |||
275 | ); | 278 | ); |
276 | 279 | ||
277 | out: | 280 | out: |
278 | set_cpus_allowed_ptr(current, &old_mask); | 281 | set_cpus_allowed_ptr(current, old_mask); |
282 | free_cpumask_var(old_mask); | ||
279 | return ret; | 283 | return ret; |
280 | } | 284 | } |
281 | 285 | ||
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c index d76adfea5df..8f0f7c44930 100644 --- a/drivers/firmware/dmi_scan.c +++ b/drivers/firmware/dmi_scan.c | |||
@@ -415,6 +415,29 @@ void __init dmi_scan_machine(void) | |||
415 | } | 415 | } |
416 | 416 | ||
417 | /** | 417 | /** |
418 | * dmi_matches - check if dmi_system_id structure matches system DMI data | ||
419 | * @dmi: pointer to the dmi_system_id structure to check | ||
420 | */ | ||
421 | static bool dmi_matches(const struct dmi_system_id *dmi) | ||
422 | { | ||
423 | int i; | ||
424 | |||
425 | WARN(!dmi_initialized, KERN_ERR "dmi check: not initialized yet.\n"); | ||
426 | |||
427 | for (i = 0; i < ARRAY_SIZE(dmi->matches); i++) { | ||
428 | int s = dmi->matches[i].slot; | ||
429 | if (s == DMI_NONE) | ||
430 | continue; | ||
431 | if (dmi_ident[s] | ||
432 | && strstr(dmi_ident[s], dmi->matches[i].substr)) | ||
433 | continue; | ||
434 | /* No match */ | ||
435 | return false; | ||
436 | } | ||
437 | return true; | ||
438 | } | ||
439 | |||
440 | /** | ||
418 | * dmi_check_system - check system DMI data | 441 | * dmi_check_system - check system DMI data |
419 | * @list: array of dmi_system_id structures to match against | 442 | * @list: array of dmi_system_id structures to match against |
420 | * All non-null elements of the list must match | 443 | * All non-null elements of the list must match |
@@ -429,32 +452,45 @@ void __init dmi_scan_machine(void) | |||
429 | */ | 452 | */ |
430 | int dmi_check_system(const struct dmi_system_id *list) | 453 | int dmi_check_system(const struct dmi_system_id *list) |
431 | { | 454 | { |
432 | int i, count = 0; | 455 | int count = 0; |
433 | const struct dmi_system_id *d = list; | 456 | const struct dmi_system_id *d; |
434 | 457 | ||
435 | WARN(!dmi_initialized, KERN_ERR "dmi check: not initialized yet.\n"); | 458 | for (d = list; d->ident; d++) |
436 | 459 | if (dmi_matches(d)) { | |
437 | while (d->ident) { | 460 | count++; |
438 | for (i = 0; i < ARRAY_SIZE(d->matches); i++) { | 461 | if (d->callback && d->callback(d)) |
439 | int s = d->matches[i].slot; | 462 | break; |
440 | if (s == DMI_NONE) | ||
441 | continue; | ||
442 | if (dmi_ident[s] && strstr(dmi_ident[s], d->matches[i].substr)) | ||
443 | continue; | ||
444 | /* No match */ | ||
445 | goto fail; | ||
446 | } | 463 | } |
447 | count++; | ||
448 | if (d->callback && d->callback(d)) | ||
449 | break; | ||
450 | fail: d++; | ||
451 | } | ||
452 | 464 | ||
453 | return count; | 465 | return count; |
454 | } | 466 | } |
455 | EXPORT_SYMBOL(dmi_check_system); | 467 | EXPORT_SYMBOL(dmi_check_system); |
456 | 468 | ||
457 | /** | 469 | /** |
470 | * dmi_first_match - find dmi_system_id structure matching system DMI data | ||
471 | * @list: array of dmi_system_id structures to match against | ||
472 | * All non-null elements of the list must match | ||
473 | * their slot's (field index's) data (i.e., each | ||
474 | * list string must be a substring of the specified | ||
475 | * DMI slot's string data) to be considered a | ||
476 | * successful match. | ||
477 | * | ||
478 | * Walk the blacklist table until the first match is found. Return the | ||
479 | * pointer to the matching entry or NULL if there's no match. | ||
480 | */ | ||
481 | const struct dmi_system_id *dmi_first_match(const struct dmi_system_id *list) | ||
482 | { | ||
483 | const struct dmi_system_id *d; | ||
484 | |||
485 | for (d = list; d->ident; d++) | ||
486 | if (dmi_matches(d)) | ||
487 | return d; | ||
488 | |||
489 | return NULL; | ||
490 | } | ||
491 | EXPORT_SYMBOL(dmi_first_match); | ||
492 | |||
493 | /** | ||
458 | * dmi_get_system_info - return DMI data value | 494 | * dmi_get_system_info - return DMI data value |
459 | * @field: data index (see enum dmi_field) | 495 | * @field: data index (see enum dmi_field) |
460 | * | 496 | * |
diff --git a/drivers/firmware/iscsi_ibft.c b/drivers/firmware/iscsi_ibft.c index 3ab3e4a41d6..7b7ddc2d51c 100644 --- a/drivers/firmware/iscsi_ibft.c +++ b/drivers/firmware/iscsi_ibft.c | |||
@@ -938,8 +938,8 @@ static int __init ibft_init(void) | |||
938 | return -ENOMEM; | 938 | return -ENOMEM; |
939 | 939 | ||
940 | if (ibft_addr) { | 940 | if (ibft_addr) { |
941 | printk(KERN_INFO "iBFT detected at 0x%lx.\n", | 941 | printk(KERN_INFO "iBFT detected at 0x%llx.\n", |
942 | virt_to_phys((void *)ibft_addr)); | 942 | (u64)virt_to_phys((void *)ibft_addr)); |
943 | 943 | ||
944 | rc = ibft_check_device(); | 944 | rc = ibft_check_device(); |
945 | if (rc) | 945 | if (rc) |