Source
54
54
*/
55
55
static int resident_cpu = -1;
56
56
57
57
bool psci_tos_resident_on(int cpu)
58
58
{
59
59
return cpu == resident_cpu;
60
60
}
61
61
62
62
struct psci_operations psci_ops = {
63
63
.conduit = PSCI_CONDUIT_NONE,
64
+
.smccc_version = SMCCC_VERSION_1_0,
64
65
};
65
66
66
67
typedef unsigned long (psci_fn)(unsigned long, unsigned long,
67
68
unsigned long, unsigned long);
68
69
static psci_fn *invoke_psci_fn;
69
70
70
71
enum psci_function {
71
72
PSCI_FN_CPU_SUSPEND,
72
73
PSCI_FN_CPU_ON,
73
74
PSCI_FN_CPU_OFF,
504
505
cpuid);
505
506
return;
506
507
}
507
508
508
509
cpu = get_logical_index(cpuid);
509
510
resident_cpu = cpu >= 0 ? cpu : -1;
510
511
511
512
pr_info("Trusted OS resident on physical CPU 0x%lx\n", cpuid);
512
513
}
513
514
515
+
static void __init psci_init_smccc(void)
516
+
{
517
+
u32 ver = ARM_SMCCC_VERSION_1_0;
518
+
int feature;
519
+
520
+
feature = psci_features(ARM_SMCCC_VERSION_FUNC_ID);
521
+
522
+
if (feature != PSCI_RET_NOT_SUPPORTED) {
523
+
u32 ret;
524
+
ret = invoke_psci_fn(ARM_SMCCC_VERSION_FUNC_ID, 0, 0, 0);
525
+
if (ret == ARM_SMCCC_VERSION_1_1) {
526
+
psci_ops.smccc_version = SMCCC_VERSION_1_1;
527
+
ver = ret;
528
+
}
529
+
}
530
+
531
+
/*
532
+
* Conveniently, the SMCCC and PSCI versions are encoded the
533
+
* same way. No, this isn't accidental.
534
+
*/
535
+
pr_info("SMC Calling Convention v%d.%d\n",
536
+
PSCI_VERSION_MAJOR(ver), PSCI_VERSION_MINOR(ver));
537
+
538
+
}
539
+
514
540
static void __init psci_0_2_set_functions(void)
515
541
{
516
542
pr_info("Using standard PSCI v0.2 function IDs\n");
517
543
psci_ops.get_version = psci_get_version;
518
544
519
545
psci_function_id[PSCI_FN_CPU_SUSPEND] =
520
546
PSCI_FN_NATIVE(0_2, CPU_SUSPEND);
521
547
psci_ops.cpu_suspend = psci_cpu_suspend;
522
548
523
549
psci_function_id[PSCI_FN_CPU_OFF] = PSCI_0_2_FN_CPU_OFF;
552
578
if (PSCI_VERSION_MAJOR(ver) == 0 && PSCI_VERSION_MINOR(ver) < 2) {
553
579
pr_err("Conflicting PSCI version detected.\n");
554
580
return -EINVAL;
555
581
}
556
582
557
583
psci_0_2_set_functions();
558
584
559
585
psci_init_migrate();
560
586
561
587
if (PSCI_VERSION_MAJOR(ver) >= 1) {
588
+
psci_init_smccc();
562
589
psci_init_cpu_suspend();
563
590
psci_init_system_suspend();
564
591
}
565
592
566
593
return 0;
567
594
}
568
595
569
596
typedef int (*psci_initcall_t)(const struct device_node *);
570
597
571
598
/*