// SPDX-License-Identifier: MIT /* * Copyright © 2022 Intel Corporation */ #include "gt/intel_gt.h" #include "gt/intel_hwconfig.h" #include "i915_drv.h" #include "i915_memcpy.h" /* * GuC has a blob containing hardware configuration information (HWConfig). * This is formatted as a simple and flexible KLV (Key/Length/Value) table. * * For example, a minimal version could be: * enum device_attr { * ATTR_SOME_VALUE = 0, * ATTR_SOME_MASK = 1, * }; * * static const u32 hwconfig[] = { * ATTR_SOME_VALUE, * 1, // Value Length in DWords * 8, // Value * * ATTR_SOME_MASK, * 3, * 0x00FFFFFFFF, 0xFFFFFFFF, 0xFF000000, * }; * * The attribute ids are defined in a hardware spec. */ static int __guc_action_get_hwconfig(struct intel_guc *guc, u32 ggtt_offset, u32 ggtt_size) { … } static int guc_hwconfig_discover_size(struct intel_guc *guc, struct intel_hwconfig *hwconfig) { … } static int guc_hwconfig_fill_buffer(struct intel_guc *guc, struct intel_hwconfig *hwconfig) { … } static bool has_table(struct drm_i915_private *i915) { … } /* * intel_guc_hwconfig_init - Initialize the HWConfig * * Retrieve the HWConfig table from the GuC and save it locally. * It can then be queried on demand by other users later on. */ static int guc_hwconfig_init(struct intel_gt *gt) { … } /* * intel_gt_init_hwconfig - Initialize the HWConfig if available * * Retrieve the HWConfig table if available on the current platform. */ int intel_gt_init_hwconfig(struct intel_gt *gt) { … } /* * intel_gt_fini_hwconfig - Finalize the HWConfig * * Free up the memory allocation holding the table. */ void intel_gt_fini_hwconfig(struct intel_gt *gt) { … }