/* * Copyright(c) 2011-2016 Intel Corporation. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #include <linux/acpi.h> #include "i915_drv.h" #include "gvt.h" /* * Note: Only for GVT-g virtual VBT generation, other usage must * not do like this. */ #define _INTEL_BIOS_PRIVATE #include "display/intel_vbt_defs.h" #define OPREGION_SIGNATURE … #define MBOX_VBT … /* device handle */ #define DEVICE_TYPE_CRT … #define DEVICE_TYPE_EFP1 … #define DEVICE_TYPE_EFP2 … #define DEVICE_TYPE_EFP3 … #define DEVICE_TYPE_EFP4 … struct opregion_header { … } __packed; struct bdb_data_header { … } __packed; /* For supporting windows guest with opregion, here hardcode the emulated * bdb header version as '186', and the corresponding child_device_config * length should be '33' but not '38'. */ struct efp_child_device_config { … } __packed; struct vbt { … }; static void virt_vbt_generation(struct vbt *v) { … } /** * intel_vgpu_init_opregion - initialize the stuff used to emulate opregion * @vgpu: a vGPU * * Returns: * Zero on success, negative error code if failed. */ int intel_vgpu_init_opregion(struct intel_vgpu *vgpu) { … } /** * intel_vgpu_opregion_base_write_handler - Opregion base register write handler * * @vgpu: a vGPU * @gpa: guest physical address of opregion * * Returns: * Zero on success, negative error code if failed. */ int intel_vgpu_opregion_base_write_handler(struct intel_vgpu *vgpu, u32 gpa) { … } /** * intel_vgpu_clean_opregion - clean the stuff used to emulate opregion * @vgpu: a vGPU * */ void intel_vgpu_clean_opregion(struct intel_vgpu *vgpu) { … } #define GVT_OPREGION_FUNC(scic) … #define GVT_OPREGION_SUBFUNC(scic) … static const char *opregion_func_name(u32 func) { … } static const char *opregion_subfunc_name(u32 subfunc) { const char *name = NULL; switch (subfunc) { case 0: name = "Supported Calls"; break; case 1: name = "Requested Callbacks"; break; case 2 ... 3: case 8 ... 9: name = "Reserved"; break; case 5: name = "Boot Display"; break; case 6: name = "TV-Standard/Video-Connector"; break; case 7: name = "Internal Graphics"; break; case 10: name = "Spread Spectrum Clocks"; break; case 11: name = "Get AKSV"; break; default: name = "Unknown"; break; } return name; }; static bool querying_capabilities(u32 scic) { … } /** * intel_vgpu_emulate_opregion_request - emulating OpRegion request * @vgpu: a vGPU * @swsci: SWSCI request * * Returns: * Zero on success, negative error code if failed */ int intel_vgpu_emulate_opregion_request(struct intel_vgpu *vgpu, u32 swsci) { … }