| 1 | #ifndef __CB_BDK_WARN_H__ |
| 2 | #define __CB_BDK_WARN_H__ |
| 3 | |
| 4 | /***********************license start*********************************** |
| 5 | * Copyright (c) 2003-2017 Cavium Inc. ([email protected]). All rights |
| 6 | * reserved. |
| 7 | * |
| 8 | * |
| 9 | * Redistribution and use in source and binary forms, with or without |
| 10 | * modification, are permitted provided that the following conditions are |
| 11 | * met: |
| 12 | * |
| 13 | * * Redistributions of source code must retain the above copyright |
| 14 | * notice, this list of conditions and the following disclaimer. |
| 15 | * |
| 16 | * * Redistributions in binary form must reproduce the above |
| 17 | * copyright notice, this list of conditions and the following |
| 18 | * disclaimer in the documentation and/or other materials provided |
| 19 | * with the distribution. |
| 20 | * |
| 21 | * * Neither the name of Cavium Inc. nor the names of |
| 22 | * its contributors may be used to endorse or promote products |
| 23 | * derived from this software without specific prior written |
| 24 | * permission. |
| 25 | * |
| 26 | * This Software, including technical data, may be subject to U.S. export |
| 27 | * control laws, including the U.S. Export Administration Act and its |
| 28 | * associated regulations, and may be subject to export or import |
| 29 | * regulations in other countries. |
| 30 | * |
| 31 | * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" |
| 32 | * AND WITH ALL FAULTS AND CAVIUM INC. MAKES NO PROMISES, REPRESENTATIONS OR |
| 33 | * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT |
| 34 | * TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY |
| 35 | * REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT |
| 36 | * DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES |
| 37 | * OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR |
| 38 | * PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, |
| 39 | * QUIET POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK |
| 40 | * ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU. |
| 41 | ***********************license end**************************************/ |
| 42 | |
| 43 | #include <console/console.h> |
| 44 | |
| 45 | /** |
| 46 | * @file |
| 47 | * |
| 48 | * Functions for reporting errors and warnings. |
| 49 | * |
| 50 | * <hr>$Revision: 49448 $<hr> |
| 51 | * |
| 52 | * @defgroup stdio Standard IO related functions |
| 53 | * @{ |
| 54 | */ |
| 55 | |
| 56 | #define bdk_warn(format, ...) printk(BIOS_WARNING, format, ##__VA_ARGS__) |
| 57 | #define bdk_error(format, ...) printk(BIOS_ERR, format, ##__VA_ARGS__) |
| 58 | #define bdk_fatal(format, ...) \ |
| 59 | do { \ |
| 60 | printk(BIOS_CRIT, format, ##__VA_ARGS__); \ |
| 61 | while (1) \ |
| 62 | ; \ |
| 63 | } while (0) |
| 64 | |
| 65 | /* The following defines control detailed tracing of various parts of the |
| 66 | BDK. Each one can be enabled(1) or disabled(0) independently. These |
| 67 | should be disabled unless you are trying to debug something specific */ |
| 68 | |
| 69 | typedef enum |
| 70 | { |
| 71 | BDK_TRACE_ENABLE_BGX, /* BGX networking block */ |
| 72 | BDK_TRACE_ENABLE_DRAM, /* DRAM initialzation */ |
| 73 | BDK_TRACE_ENABLE_DRAM_TEST, /* DRAM test code */ |
| 74 | BDK_TRACE_ENABLE_INIT, /* Early initialization, before main() */ |
| 75 | BDK_TRACE_ENABLE_ECAM, /* ECAM initialization */ |
| 76 | BDK_TRACE_ENABLE_QLM, /* QLM related debug */ |
| 77 | BDK_TRACE_ENABLE_EMMC, /* eMMC related debug */ |
| 78 | BDK_TRACE_ENABLE_PCIE, /* PCIe link init */ |
| 79 | BDK_TRACE_ENABLE_PCIE_CONFIG, /* PCIe config space reads / writes */ |
| 80 | BDK_TRACE_ENABLE_SATA, /* SATA/AHCI related debug */ |
| 81 | BDK_TRACE_ENABLE_CCPI, /* Multi-node related debug */ |
| 82 | BDK_TRACE_ENABLE_FATFS, /* FatFs related debug */ |
| 83 | BDK_TRACE_ENABLE_MPI, /* MPI related debug */ |
| 84 | BDK_TRACE_ENABLE_ENV, /* Environment variables related debug */ |
| 85 | BDK_TRACE_ENABLE_FPA, /* Free Pool Allocator */ |
| 86 | BDK_TRACE_ENABLE_PKI, /* Packet Input */ |
| 87 | BDK_TRACE_ENABLE_PKO, /* Packet Output */ |
| 88 | BDK_TRACE_ENABLE_SSO, /* SSO */ |
| 89 | BDK_TRACE_ENABLE_DEVICE, /* ECAM based device framework */ |
| 90 | BDK_TRACE_ENABLE_DEVICE_SCAN, /* ECAM based device scanning detail */ |
| 91 | BDK_TRACE_ENABLE_NIC, /* Virtual NIC */ |
| 92 | BDK_TRACE_ENABLE_FDT_OS, /* Device tree passed to OS */ |
| 93 | BDK_TRACE_ENABLE_USB_XHCI, /* USB XHCI block */ |
| 94 | BDK_TRACE_ENABLE_PHY, /* Ethernet Phy drivers debug */ |
| 95 | __BDK_TRACE_ENABLE_LAST, /* Must always be last value */ |
| 96 | } bdk_trace_enable_t; |
| 97 | |
| 98 | /** |
| 99 | * Macro for low level tracing of BDK functions. When enabled, |
| 100 | * these translate to printf() calls. The "area" is a string |
| 101 | * that is appended to "BDK_TRACE_ENABLE_" to figure out which |
| 102 | * enable macro to use. The macro expects a ';' after it. |
| 103 | */ |
| 104 | #define BDK_TRACE(area, format, ...) do { \ |
| 105 | if ((BDK_TRACE_ENABLE_INIT == BDK_TRACE_ENABLE_##area && \ |
| 106 | CONFIG(CAVIUM_BDK_VERBOSE_INIT)) || \ |
| 107 | (BDK_TRACE_ENABLE_DRAM == BDK_TRACE_ENABLE_##area && \ |
| 108 | CONFIG(CAVIUM_BDK_VERBOSE_DRAM)) || \ |
| 109 | (BDK_TRACE_ENABLE_DRAM_TEST == BDK_TRACE_ENABLE_##area && \ |
| 110 | CONFIG(CAVIUM_BDK_VERBOSE_DRAM_TEST)) || \ |
| 111 | (BDK_TRACE_ENABLE_QLM == BDK_TRACE_ENABLE_##area && \ |
| 112 | CONFIG(CAVIUM_BDK_VERBOSE_QLM)) || \ |
| 113 | (BDK_TRACE_ENABLE_PCIE_CONFIG == BDK_TRACE_ENABLE_##area && \ |
| 114 | CONFIG(CAVIUM_BDK_VERBOSE_PCIE_CONFIG)) || \ |
| 115 | (BDK_TRACE_ENABLE_PCIE == BDK_TRACE_ENABLE_##area && \ |
| 116 | CONFIG(CAVIUM_BDK_VERBOSE_PCIE)) || \ |
| 117 | (BDK_TRACE_ENABLE_PHY == BDK_TRACE_ENABLE_##area && \ |
| 118 | CONFIG(CAVIUM_BDK_VERBOSE_PHY))) \ |
| 119 | printk(BIOS_DEBUG, #area ": " format, ##__VA_ARGS__); \ |
| 120 | } while (0) |
| 121 | |
| 122 | /** @} */ |
| 123 | #endif |