smccc.c (14b841d4a8e6c25d964f5e3bbda379a1541a27ec) | smccc.c (0600af1ff16041f15633b2263a8ad9525eecd2f1) |
---|---|
1/*- 2 * SPDX-License-Identifier: BSD-2-Clause 3 * 4 * Copyright (c) 2018 Andrew Turner 5 * 6 * This software was developed by SRI International and the University of 7 * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 8 * ("CTSRD"), as part of the DARPA CRASH research programme. --- 33 unchanged lines hidden (view full) --- 42#include <dev/psci/psci.h> 43#include <dev/psci/smccc.h> 44 45#define SMCCC_VERSION_1_0 0x10000 46 47/* Assume 1.0 until we detect a later version */ 48static uint32_t smccc_version = SMCCC_VERSION_1_0; 49 | 1/*- 2 * SPDX-License-Identifier: BSD-2-Clause 3 * 4 * Copyright (c) 2018 Andrew Turner 5 * 6 * This software was developed by SRI International and the University of 7 * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 8 * ("CTSRD"), as part of the DARPA CRASH research programme. --- 33 unchanged lines hidden (view full) --- 42#include <dev/psci/psci.h> 43#include <dev/psci/smccc.h> 44 45#define SMCCC_VERSION_1_0 0x10000 46 47/* Assume 1.0 until we detect a later version */ 48static uint32_t smccc_version = SMCCC_VERSION_1_0; 49 |
50static void 51smccc_init(void *dummy) | 50void 51smccc_init(void) |
52{ 53 int32_t features; 54 uint32_t ret; 55 56 features = psci_features(SMCCC_VERSION); 57 if (features != PSCI_RETVAL_NOT_SUPPORTED) { 58 ret = psci_call(SMCCC_VERSION, 0, 0, 0); 59 /* This should always be the case as we checked it above */ 60 if (ret > 0) 61 smccc_version = ret; 62 } 63 64 if (bootverbose) { 65 printf("Found SMCCC version %u.%u\n", 66 SMCCC_VERSION_MAJOR(smccc_version), 67 SMCCC_VERSION_MINOR(smccc_version)); 68 } 69} | 52{ 53 int32_t features; 54 uint32_t ret; 55 56 features = psci_features(SMCCC_VERSION); 57 if (features != PSCI_RETVAL_NOT_SUPPORTED) { 58 ret = psci_call(SMCCC_VERSION, 0, 0, 0); 59 /* This should always be the case as we checked it above */ 60 if (ret > 0) 61 smccc_version = ret; 62 } 63 64 if (bootverbose) { 65 printf("Found SMCCC version %u.%u\n", 66 SMCCC_VERSION_MAJOR(smccc_version), 67 SMCCC_VERSION_MINOR(smccc_version)); 68 } 69} |
70SYSINIT(smccc_start, SI_SUB_CONFIGURE, SI_ORDER_ANY, smccc_init, NULL); | |
71 | 70 |
71uint32_t 72smccc_get_version(void) 73{ 74 return (smccc_version); 75} 76 |
|
72int32_t 73smccc_arch_features(uint32_t smccc_func_id) 74{ 75 76 if (smccc_version == SMCCC_VERSION_1_0) 77 return (PSCI_RETVAL_NOT_SUPPORTED); 78 79 return (psci_call(SMCCC_ARCH_FEATURES, smccc_func_id, 0, 0)); --- 23 unchanged lines hidden --- | 77int32_t 78smccc_arch_features(uint32_t smccc_func_id) 79{ 80 81 if (smccc_version == SMCCC_VERSION_1_0) 82 return (PSCI_RETVAL_NOT_SUPPORTED); 83 84 return (psci_call(SMCCC_ARCH_FEATURES, smccc_func_id, 0, 0)); --- 23 unchanged lines hidden --- |