1*91f16700Schasinglulu /* 2*91f16700Schasinglulu * Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved. 3*91f16700Schasinglulu * 4*91f16700Schasinglulu * SPDX-License-Identifier: BSD-3-Clause 5*91f16700Schasinglulu */ 6*91f16700Schasinglulu 7*91f16700Schasinglulu #include <common/debug.h> 8*91f16700Schasinglulu #include <plat/common/platform.h> 9*91f16700Schasinglulu 10*91f16700Schasinglulu /* Allow platforms to override the log prefix string */ 11*91f16700Schasinglulu #pragma weak plat_log_get_prefix 12*91f16700Schasinglulu 13*91f16700Schasinglulu static const char *plat_prefix_str[] = { 14*91f16700Schasinglulu "ERROR: ", "NOTICE: ", "WARNING: ", "INFO: ", "VERBOSE: "}; 15*91f16700Schasinglulu 16*91f16700Schasinglulu const char *plat_log_get_prefix(unsigned int log_level) 17*91f16700Schasinglulu { 18*91f16700Schasinglulu unsigned int level; 19*91f16700Schasinglulu 20*91f16700Schasinglulu if (log_level < LOG_LEVEL_ERROR) { 21*91f16700Schasinglulu level = LOG_LEVEL_ERROR; 22*91f16700Schasinglulu } else if (log_level > LOG_LEVEL_VERBOSE) { 23*91f16700Schasinglulu level = LOG_LEVEL_VERBOSE; 24*91f16700Schasinglulu } else { 25*91f16700Schasinglulu level = log_level; 26*91f16700Schasinglulu } 27*91f16700Schasinglulu 28*91f16700Schasinglulu return plat_prefix_str[(level / 10U) - 1U]; 29*91f16700Schasinglulu } 30