1 /* SPDX-License-Identifier: MIT */ 2 /* 3 * Copyright © 2025 Intel Corporation 4 */ 5 6 #ifndef _ABI_GUC_LFD_ABI_H_ 7 #define _ABI_GUC_LFD_ABI_H_ 8 9 #include <linux/types.h> 10 11 #include "guc_lic_abi.h" 12 13 /* The current major version of GuC-Log-File format. */ 14 #define GUC_LFD_FORMAT_VERSION_MAJOR 0x0001 15 /* The current minor version of GuC-Log-File format. */ 16 #define GUC_LFD_FORMAT_VERSION_MINOR 0x0000 17 18 /** enum guc_lfd_type - Log format descriptor type */ 19 enum guc_lfd_type { 20 /** 21 * @GUC_LFD_TYPE_FW_REQUIRED_RANGE_START: Start of range for 22 * required LFDs from GuC 23 * @GUC_LFD_TYPE_FW_VERSION: GuC Firmware Version structure. 24 * @GUC_LFD_TYPE_GUC_DEVICE_ID: GuC microcontroller device ID. 25 * @GUC_LFD_TYPE_TSC_FREQUENCY: Frequency of GuC timestamps. 26 * @GUC_LFD_TYPE_GMD_ID: HW GMD ID. 27 * @GUC_LFD_TYPE_BUILD_PLATFORM_ID: GuC build platform ID. 28 * @GUC_LFD_TYPE_FW_REQUIRED_RANGE_END: End of range for 29 * required LFDs from GuC 30 */ 31 GUC_LFD_TYPE_FW_REQUIRED_RANGE_START = 0x1, 32 GUC_LFD_TYPE_FW_VERSION = 0x1, 33 GUC_LFD_TYPE_GUC_DEVICE_ID = 0x2, 34 GUC_LFD_TYPE_TSC_FREQUENCY = 0x3, 35 GUC_LFD_TYPE_GMD_ID = 0x4, 36 GUC_LFD_TYPE_BUILD_PLATFORM_ID = 0x5, 37 GUC_LFD_TYPE_FW_REQUIRED_RANGE_END = 0x1FFF, 38 39 /** 40 * @GUC_LFD_TYPE_FW_OPTIONAL_RANGE_START: Start of range for 41 * optional LFDs from GuC 42 * @GUC_LFD_TYPE_LOG_EVENTS_BUFFER: Log-event-entries buffer. 43 * @GUC_LFD_TYPE_FW_CRASH_DUMP: GuC generated crash-dump blob. 44 * @GUC_LFD_TYPE_FW_OPTIONAL_RANGE_END: End of range for 45 * optional LFDs from GuC 46 */ 47 GUC_LFD_TYPE_FW_OPTIONAL_RANGE_START = 0x2000, 48 GUC_LFD_TYPE_LOG_EVENTS_BUFFER = 0x2000, 49 GUC_LFD_TYPE_FW_CRASH_DUMP = 0x2001, 50 GUC_LFD_TYPE_FW_OPTIONAL_RANGE_END = 0x3FFF, 51 52 /** 53 * @GUC_LFD_TYPE_KMD_REQUIRED_RANGE_START: Start of range for 54 * required KMD LFDs 55 * @GUC_LFD_TYPE_OS_ID: An identifier for the OS. 56 * @GUC_LFD_TYPE_KMD_REQUIRED_RANGE_END: End of this range for 57 * required KMD LFDs 58 */ 59 GUC_LFD_TYPE_KMD_REQUIRED_RANGE_START = 0x4000, 60 GUC_LFD_TYPE_OS_ID = 0x4000, 61 GUC_LFD_TYPE_KMD_REQUIRED_RANGE_END = 0x5FFF, 62 63 /** 64 * @GUC_LFD_TYPE_KMD_OPTIONAL_RANGE_START: Start of range for 65 * optional KMD LFDs 66 * @GUC_LFD_TYPE_BINARY_SCHEMA_FORMAT: Binary representation of 67 * GuC log-events schema. 68 * @GUC_LFD_TYPE_HOST_COMMENT: ASCII string containing comments 69 * from the host/KMD. 70 * @GUC_LFD_TYPE_TIMESTAMP_ANCHOR: A timestamp anchor, to convert 71 * between host and GuC timestamp. 72 * @GUC_LFD_TYPE_TIMESTAMP_ANCHOR_CONFIG: Timestamp anchor 73 * configuration, definition of timestamp frequency and bit width. 74 * @GUC_LFD_TYPE_KMD_OPTIONAL_RANGE_END: End of this range for 75 * optional KMD LFDs 76 */ 77 GUC_LFD_TYPE_KMD_OPTIONAL_RANGE_START = 0x6000, 78 GUC_LFD_TYPE_BINARY_SCHEMA_FORMAT = 0x6000, 79 GUC_LFD_TYPE_HOST_COMMENT = 0x6001, 80 GUC_LFD_TYPE_TIMESTAMP_ANCHOR = 0x6002, 81 GUC_LFD_TYPE_TIMESTAMP_ANCHOR_CONFIG = 0x6003, 82 GUC_LFD_TYPE_KMD_OPTIONAL_RANGE_END = 0x7FFF, 83 84 /* 85 * @GUC_LFD_TYPE_RESERVED_RANGE_START: Start of reserved range 86 * @GUC_LFD_TYPE_RESERVED_RANGE_END: End of reserved range 87 */ 88 GUC_LFD_TYPE_RESERVED_RANGE_START = 0x8000, 89 GUC_LFD_TYPE_RESERVED_RANGE_END = 0xFFFF, 90 }; 91 92 /** enum guc_lfd_os_type - OS Type LFD-ID */ 93 enum guc_lfd_os_type { 94 /** @GUC_LFD_OS_TYPE_OSID_WIN: Windows OS */ 95 GUC_LFD_OS_TYPE_OSID_WIN = 0x1, 96 /** @GUC_LFD_OS_TYPE_OSID_LIN: Linux OS */ 97 GUC_LFD_OS_TYPE_OSID_LIN = 0x2, 98 /** @GUC_LFD_OS_TYPE_OSID_VMW: VMWare OS */ 99 GUC_LFD_OS_TYPE_OSID_VMW = 0x3, 100 /** @GUC_LFD_OS_TYPE_OSID_OTHER: Other */ 101 GUC_LFD_OS_TYPE_OSID_OTHER = 0x4, 102 }; 103 104 /** struct guc_lfd_data - A generic header structure for all LFD blocks */ 105 struct guc_lfd_data { 106 /** @header: A 32 bits dword, contains multiple bit fields */ 107 u32 header; 108 /* LFD type. See guc_lfd_type */ 109 #define GUC_LFD_DATA_HEADER_MASK_TYPE GENMASK(31, 16) 110 #define GUC_LFD_DATA_HEADER_MASK_MAGIC GENMASK(15, 0) 111 112 /** @data_count: Number of dwords the `data` field contains. */ 113 u32 data_count; 114 /** @data: Data defined by GUC_LFD_DATA_HEADER_MASK_TYPE */ 115 u32 data[] __counted_by(data_count); 116 } __packed; 117 118 /** 119 * struct guc_lfd_data_log_events_buf - GuC Log Events Buffer. 120 * This is optional fw LFD data 121 */ 122 struct guc_lfd_data_log_events_buf { 123 /** 124 * @log_events_format_version: version of GuC log format of buffer 125 */ 126 u32 log_events_format_version; 127 /** 128 * @log_event: The log event data. 129 * Size in dwords is LFD block size - 1. 130 */ 131 u32 log_event[]; 132 } __packed; 133 134 /** struct guc_lfd_data_os_info - OS Version Information. */ 135 struct guc_lfd_data_os_info { 136 /** 137 * @os_id: enum values to identify the OS brand. 138 * See guc_lfd_os_type for the range of types 139 */ 140 u32 os_id; 141 /** 142 * @build_version: ASCII string containing OS build version 143 * information based on os_id. String is padded with null 144 * characters to ensure its DWORD aligned. 145 * Size in dwords is LFD block size - 1. 146 */ 147 char build_version[]; 148 } __packed; 149 150 /** 151 * struct guc_lfd_file_header - Header of GuC Log Streaming-LFD-File Format. 152 * This structure encapsulates the layout of the guc-log-file format 153 */ 154 struct guc_lfd_file_header { 155 /** 156 * @magic: A magic number set by producer of a GuC log file to 157 * identify that file is a valid guc-log-file containing a stream 158 * of LFDs. 159 */ 160 u64 magic; 161 /** @version: Version of this file format layout */ 162 u32 version; 163 #define GUC_LFD_FILE_HEADER_VERSION_MASK_MAJOR GENMASK(31, 16) 164 #define GUC_LFD_FILE_HEADER_VERSION_MASK_MINOR GENMASK(15, 0) 165 166 /** @stream: A stream of one or more guc_lfd_data LFD blocks */ 167 u32 stream[]; 168 } __packed; 169 170 #endif 171