.. | .. |
---|
346 | 346 | switch (mode) { |
---|
347 | 347 | case EDDEVID_IMPL_FULL: |
---|
348 | 348 | drvdata->edvidsr_present = true; |
---|
349 | | - /* Fall through */ |
---|
| 349 | + fallthrough; |
---|
350 | 350 | case EDDEVID_IMPL_EDPCSR_EDCIDSR: |
---|
351 | 351 | drvdata->edcidsr_present = true; |
---|
352 | | - /* Fall through */ |
---|
| 352 | + fallthrough; |
---|
353 | 353 | case EDDEVID_IMPL_EDPCSR: |
---|
354 | 354 | /* |
---|
355 | 355 | * In ARM DDI 0487A.k, the EDDEVID1.PCSROffset is used to |
---|
.. | .. |
---|
379 | 379 | int cpu; |
---|
380 | 380 | struct debug_drvdata *drvdata; |
---|
381 | 381 | |
---|
382 | | - mutex_lock(&debug_lock); |
---|
| 382 | + /* Bail out if we can't acquire the mutex or the functionality is off */ |
---|
| 383 | + if (!mutex_trylock(&debug_lock)) |
---|
| 384 | + return NOTIFY_DONE; |
---|
383 | 385 | |
---|
384 | | - /* Bail out if the functionality is disabled */ |
---|
385 | 386 | if (!debug_enable) |
---|
386 | 387 | goto skip_dump; |
---|
387 | 388 | |
---|
.. | .. |
---|
400 | 401 | |
---|
401 | 402 | skip_dump: |
---|
402 | 403 | mutex_unlock(&debug_lock); |
---|
403 | | - return 0; |
---|
| 404 | + return NOTIFY_DONE; |
---|
404 | 405 | } |
---|
405 | 406 | |
---|
406 | 407 | static struct notifier_block debug_notifier = { |
---|
.. | .. |
---|
525 | 526 | |
---|
526 | 527 | static int debug_func_init(void) |
---|
527 | 528 | { |
---|
528 | | - struct dentry *file; |
---|
529 | 529 | int ret; |
---|
530 | 530 | |
---|
531 | 531 | /* Create debugfs node */ |
---|
532 | 532 | debug_debugfs_dir = debugfs_create_dir("coresight_cpu_debug", NULL); |
---|
533 | | - if (!debug_debugfs_dir) { |
---|
534 | | - pr_err("%s: unable to create debugfs directory\n", __func__); |
---|
535 | | - return -ENOMEM; |
---|
536 | | - } |
---|
537 | | - |
---|
538 | | - file = debugfs_create_file("enable", 0644, debug_debugfs_dir, NULL, |
---|
539 | | - &debug_func_knob_fops); |
---|
540 | | - if (!file) { |
---|
541 | | - pr_err("%s: unable to create enable knob file\n", __func__); |
---|
542 | | - ret = -ENOMEM; |
---|
543 | | - goto err; |
---|
544 | | - } |
---|
| 533 | + debugfs_create_file("enable", 0644, debug_debugfs_dir, NULL, |
---|
| 534 | + &debug_func_knob_fops); |
---|
545 | 535 | |
---|
546 | 536 | /* Register function to be called for panic */ |
---|
547 | 537 | ret = atomic_notifier_chain_register(&panic_notifier_list, |
---|
.. | .. |
---|
572 | 562 | struct device *dev = &adev->dev; |
---|
573 | 563 | struct debug_drvdata *drvdata; |
---|
574 | 564 | struct resource *res = &adev->res; |
---|
575 | | - struct device_node *np = adev->dev.of_node; |
---|
576 | 565 | int ret; |
---|
577 | 566 | |
---|
578 | 567 | drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL); |
---|
579 | 568 | if (!drvdata) |
---|
580 | 569 | return -ENOMEM; |
---|
581 | 570 | |
---|
582 | | - drvdata->cpu = np ? of_coresight_get_cpu(np) : 0; |
---|
| 571 | + drvdata->cpu = coresight_get_cpu(dev); |
---|
| 572 | + if (drvdata->cpu < 0) |
---|
| 573 | + return drvdata->cpu; |
---|
| 574 | + |
---|
583 | 575 | if (per_cpu(debug_drvdata, drvdata->cpu)) { |
---|
584 | 576 | dev_err(dev, "CPU%d drvdata has already been initialized\n", |
---|
585 | 577 | drvdata->cpu); |
---|
.. | .. |
---|
636 | 628 | return ret; |
---|
637 | 629 | } |
---|
638 | 630 | |
---|
639 | | -static int debug_remove(struct amba_device *adev) |
---|
| 631 | +static void debug_remove(struct amba_device *adev) |
---|
640 | 632 | { |
---|
641 | 633 | struct device *dev = &adev->dev; |
---|
642 | 634 | struct debug_drvdata *drvdata = amba_get_drvdata(adev); |
---|
.. | .. |
---|
651 | 643 | |
---|
652 | 644 | if (!--debug_count) |
---|
653 | 645 | debug_func_exit(); |
---|
654 | | - |
---|
655 | | - return 0; |
---|
656 | 646 | } |
---|
657 | 647 | |
---|
658 | | -static const struct amba_id debug_ids[] = { |
---|
659 | | - { /* Debug for Cortex-A53 */ |
---|
660 | | - .id = 0x000bbd03, |
---|
661 | | - .mask = 0x000fffff, |
---|
662 | | - }, |
---|
663 | | - { /* Debug for Cortex-A57 */ |
---|
664 | | - .id = 0x000bbd07, |
---|
665 | | - .mask = 0x000fffff, |
---|
666 | | - }, |
---|
667 | | - { /* Debug for Cortex-A72 */ |
---|
668 | | - .id = 0x000bbd08, |
---|
669 | | - .mask = 0x000fffff, |
---|
670 | | - }, |
---|
671 | | - { /* Debug for Cortex-A73 */ |
---|
672 | | - .id = 0x000bbd09, |
---|
673 | | - .mask = 0x000fffff, |
---|
674 | | - }, |
---|
675 | | - { 0, 0 }, |
---|
| 648 | +static const struct amba_cs_uci_id uci_id_debug[] = { |
---|
| 649 | + { |
---|
| 650 | + /* CPU Debug UCI data */ |
---|
| 651 | + .devarch = 0x47706a15, |
---|
| 652 | + .devarch_mask = 0xfff0ffff, |
---|
| 653 | + .devtype = 0x00000015, |
---|
| 654 | + } |
---|
676 | 655 | }; |
---|
677 | 656 | |
---|
| 657 | +static const struct amba_id debug_ids[] = { |
---|
| 658 | + CS_AMBA_ID(0x000bbd03), /* Cortex-A53 */ |
---|
| 659 | + CS_AMBA_ID(0x000bbd07), /* Cortex-A57 */ |
---|
| 660 | + CS_AMBA_ID(0x000bbd08), /* Cortex-A72 */ |
---|
| 661 | + CS_AMBA_ID(0x000bbd09), /* Cortex-A73 */ |
---|
| 662 | + CS_AMBA_UCI_ID(0x000f0205, uci_id_debug), /* Qualcomm Kryo */ |
---|
| 663 | + CS_AMBA_UCI_ID(0x000f0211, uci_id_debug), /* Qualcomm Kryo */ |
---|
| 664 | + {}, |
---|
| 665 | +}; |
---|
| 666 | + |
---|
| 667 | +MODULE_DEVICE_TABLE(amba, debug_ids); |
---|
| 668 | + |
---|
678 | 669 | static struct amba_driver debug_driver = { |
---|
679 | 670 | .drv = { |
---|
680 | 671 | .name = "coresight-cpu-debug", |
---|