| /* |
| * Copyright 2017 NXP |
| * |
| * SPDX-License-Identifier: BSD-3-Clause |
| */ |
| |
| #include <debug.h> |
| #include <stdlib.h> |
| #include <stdint.h> |
| #include <std_svc.h> |
| #include <stdbool.h> |
| #include <string.h> |
| #include <uuid.h> |
| #include <bl_common.h> |
| #include <platform_def.h> |
| #include <sci/sci.h> |
| #include <runtime_svc.h> |
| #include <imx_sip.h> |
| |
| static uint64_t imx_get_commit_hash(u_register_t x2, |
| u_register_t x3, |
| u_register_t x4) |
| { |
| /* Parse the version_string */ |
| char* parse = (char*)version_string; |
| uint64_t hash = 0; |
| |
| do { |
| parse = strchr(parse, '-'); |
| if (parse) { |
| parse += 1; |
| if (*(parse) == 'g') { |
| /* Default is 7 hexadecimal digits */ |
| memcpy((void *)&hash, (void *)(parse + 1), 7); |
| break; |
| } |
| } |
| |
| } while (parse != NULL); |
| |
| return hash; |
| } |
| |
| uint64_t imx_buildinfo_handler(uint32_t smc_fid, |
| u_register_t x1, |
| u_register_t x2, |
| u_register_t x3, |
| u_register_t x4) |
| { |
| uint64_t ret; |
| |
| switch(x1) { |
| case IMX_SIP_BUILDINFO_GET_COMMITHASH: |
| ret = imx_get_commit_hash(x2, x3, x4); |
| break; |
| default: |
| return SMC_UNK; |
| } |
| |
| return ret; |
| } |