Rudolf Marek | 7f0e930 | 2011-09-02 23:23:41 +0200 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2011 Rudolf Marek <r.marek@assembler.cz> |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; version 2 of the License. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
Rudolf Marek | 7f0e930 | 2011-09-02 23:23:41 +0200 | [diff] [blame] | 14 | */ |
| 15 | |
| 16 | #ifndef __TRACE_H |
| 17 | #define __TRACE_H |
| 18 | |
| 19 | |
| 20 | #ifdef __PRE_RAM__ |
| 21 | |
| 22 | #define DISABLE_TRACE |
| 23 | #define ENABLE_TRACE |
| 24 | #define DISABLE_TRACE_ON_FUNCTION |
| 25 | |
| 26 | #else /* !__PRE_RAM__ */ |
| 27 | |
Martin Roth | 9634547 | 2017-06-24 14:13:53 -0600 | [diff] [blame] | 28 | #if IS_ENABLED(CONFIG_TRACE) && !defined(__SMM__) |
Rudolf Marek | 7f0e930 | 2011-09-02 23:23:41 +0200 | [diff] [blame] | 29 | |
Lee Leahy | 91d1e76 | 2017-03-07 14:31:19 -0800 | [diff] [blame] | 30 | void __cyg_profile_func_enter(void *, void *) |
Stefan Reinauer | 6a00113 | 2017-07-13 02:20:27 +0200 | [diff] [blame] | 31 | __attribute__((no_instrument_function)); |
Rudolf Marek | 7f0e930 | 2011-09-02 23:23:41 +0200 | [diff] [blame] | 32 | |
Lee Leahy | 91d1e76 | 2017-03-07 14:31:19 -0800 | [diff] [blame] | 33 | void __cyg_profile_func_exit(void *, void *) |
Stefan Reinauer | 6a00113 | 2017-07-13 02:20:27 +0200 | [diff] [blame] | 34 | __attribute__((no_instrument_function)); |
Rudolf Marek | 7f0e930 | 2011-09-02 23:23:41 +0200 | [diff] [blame] | 35 | |
| 36 | extern volatile int trace_dis; |
| 37 | |
| 38 | #define DISABLE_TRACE do { trace_dis = 1; } while (0); |
| 39 | #define ENABLE_TRACE do { trace_dis = 0; } while (0); |
Stefan Reinauer | 6a00113 | 2017-07-13 02:20:27 +0200 | [diff] [blame] | 40 | #define DISABLE_TRACE_ON_FUNCTION __attribute__((no_instrument_function)); |
Rudolf Marek | 7f0e930 | 2011-09-02 23:23:41 +0200 | [diff] [blame] | 41 | |
| 42 | #else /* !CONFIG_TRACE */ |
| 43 | |
| 44 | #define DISABLE_TRACE |
| 45 | #define ENABLE_TRACE |
| 46 | #define DISABLE_TRACE_ON_FUNCTION |
| 47 | |
| 48 | #endif |
| 49 | #endif |
| 50 | #endif |