MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / psci_ofw_init

Function psci_ofw_init

libcpu/aarch64/common/psci.c:338–385  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

336}
337
338static rt_err_t psci_ofw_init(struct rt_platform_device *pdev)
339{
340 rt_err_t err = RT_EOK;
341 const char *method;
342 const struct rt_ofw_node_id *id = pdev->id;
343 struct rt_ofw_node *np = pdev->parent.ofw_node;
344
345 if (!rt_ofw_prop_read_string(np, "method", &method))
346 {
347 if (!rt_strcmp(method, "smc"))
348 {
349 psci_call = psci_smc_call;
350 }
351 else if (!rt_strcmp(method, "hvc"))
352 {
353 psci_call = psci_hvc_call;
354 }
355 else
356 {
357 LOG_E("Invalid \"method\" property: %s", method);
358 err = -RT_EINVAL;
359 }
360
361 if (!err)
362 {
363 psci_init_ofw_handle psci_init = (psci_init_ofw_handle)id->data;
364
365 err = psci_init(np);
366
367 if (!err)
368 {
369 rt_uint32_t version = rt_psci_get_version();
370
371 rt_ofw_data(np) = &_psci_ops;
372
373 RT_UNUSED(version);
374
375 LOG_I("Using PSCI v%d.%d Function IDs", PSCI_VERSION_MAJOR(version), PSCI_VERSION_MINOR(version));
376 }
377 }
378 }
379 else
380 {
381 err = -RT_ENOSYS;
382 }
383
384 return err;
385}
386
387static rt_err_t psci_probe(struct rt_platform_device *pdev)
388{

Callers 1

psci_probeFunction · 0.85

Calls 3

rt_ofw_prop_read_stringFunction · 0.85
rt_strcmpFunction · 0.85
rt_psci_get_versionFunction · 0.85

Tested by

no test coverage detected