| 1 | /* |
| 2 | * Copyright 2012-16 Advanced Micro Devices, Inc. |
| 3 | * Copyright 2019 Raptor Engineering, LLC |
| 4 | * |
| 5 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 6 | * copy of this software and associated documentation files (the "Software"), |
| 7 | * to deal in the Software without restriction, including without limitation |
| 8 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 9 | * and/or sell copies of the Software, and to permit persons to whom the |
| 10 | * Software is furnished to do so, subject to the following conditions: |
| 11 | * |
| 12 | * The above copyright notice and this permission notice shall be included in |
| 13 | * all copies or substantial portions of the Software. |
| 14 | * |
| 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 18 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR |
| 19 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
| 20 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| 21 | * OTHER DEALINGS IN THE SOFTWARE. |
| 22 | * |
| 23 | * Authors: AMD |
| 24 | * |
| 25 | */ |
| 26 | |
| 27 | #ifndef _OS_TYPES_H_ |
| 28 | #define _OS_TYPES_H_ |
| 29 | |
| 30 | #include <linux/slab.h> |
| 31 | #include <linux/kgdb.h> |
| 32 | #include <linux/delay.h> |
| 33 | #include <linux/mm.h> |
| 34 | #include <linux/vmalloc.h> |
| 35 | |
| 36 | #include <asm/byteorder.h> |
| 37 | |
| 38 | #include <drm/display/drm_dp_helper.h> |
| 39 | #include <drm/drm_device.h> |
| 40 | #include <drm/drm_print.h> |
| 41 | |
| 42 | #include "cgs_common.h" |
| 43 | |
| 44 | #if defined(__BIG_ENDIAN) && !defined(BIGENDIAN_CPU) |
| 45 | #define BIGENDIAN_CPU |
| 46 | #elif defined(__LITTLE_ENDIAN) && !defined(LITTLEENDIAN_CPU) |
| 47 | #define LITTLEENDIAN_CPU |
| 48 | #endif |
| 49 | |
| 50 | #undef FRAME_SIZE |
| 51 | |
| 52 | #define dm_output_to_console(fmt, ...) DRM_DEBUG_KMS(fmt, ##__VA_ARGS__) |
| 53 | |
| 54 | #define dm_error(fmt, ...) DRM_ERROR(fmt, ##__VA_ARGS__) |
| 55 | |
| 56 | #if defined(CONFIG_DRM_AMD_DC_FP) |
| 57 | #include "amdgpu_dm/dc_fpu.h" |
| 58 | #define DC_FP_START() dc_fpu_begin(__func__, __LINE__) |
| 59 | #define DC_FP_END() dc_fpu_end(__func__, __LINE__) |
| 60 | #endif /* CONFIG_DRM_AMD_DC_FP */ |
| 61 | |
| 62 | /* |
| 63 | * |
| 64 | * general debug capabilities |
| 65 | * |
| 66 | */ |
| 67 | #ifdef CONFIG_DEBUG_KERNEL_DC |
| 68 | #define dc_breakpoint() kgdb_breakpoint() |
| 69 | #else |
| 70 | #define dc_breakpoint() do {} while (0) |
| 71 | #endif |
| 72 | |
| 73 | #define ASSERT_CRITICAL(expr) do { \ |
| 74 | if (WARN_ON(!(expr))) \ |
| 75 | dc_breakpoint(); \ |
| 76 | } while (0) |
| 77 | |
| 78 | #define ASSERT(expr) do { \ |
| 79 | if (WARN_ON_ONCE(!(expr))) \ |
| 80 | dc_breakpoint(); \ |
| 81 | } while (0) |
| 82 | |
| 83 | #define BREAK_TO_DEBUGGER() \ |
| 84 | do { \ |
| 85 | DRM_DEBUG_DRIVER("%s():%d\n", __func__, __LINE__); \ |
| 86 | dc_breakpoint(); \ |
| 87 | } while (0) |
| 88 | |
| 89 | #define DC_ERR(...) do { \ |
| 90 | dm_error(__VA_ARGS__); \ |
| 91 | BREAK_TO_DEBUGGER(); \ |
| 92 | } while (0) |
| 93 | |
| 94 | #endif /* _OS_TYPES_H_ */ |
| 95 | |