/* * 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. * * Authors: * Ke Yu * Zhiyuan Lv <[email protected]> * * Contributors: * Terrence Xu <[email protected]> * Changbin Du <[email protected]> * Bing Niu <[email protected]> * Zhi Wang <[email protected]> * */ #include "display/intel_dp_aux_regs.h" #include "display/intel_gmbus_regs.h" #include "gvt.h" #include "i915_drv.h" #include "i915_reg.h" #define GMBUS1_TOTAL_BYTES_SHIFT … #define GMBUS1_TOTAL_BYTES_MASK … #define gmbus1_total_byte_count(v) … #define gmbus1_target_addr(v) … #define gmbus1_target_index(v) … #define gmbus1_bus_cycle(v) … /* GMBUS0 bits definitions */ #define _GMBUS_PIN_SEL_MASK … static unsigned char edid_get_byte(struct intel_vgpu *vgpu) { … } static inline int cnp_get_port_from_gmbus0(u32 gmbus0) { … } static inline int bxt_get_port_from_gmbus0(u32 gmbus0) { … } static inline int get_port_from_gmbus0(u32 gmbus0) { … } static void reset_gmbus_controller(struct intel_vgpu *vgpu) { … } /* GMBUS0 */ static int gmbus0_mmio_write(struct intel_vgpu *vgpu, unsigned int offset, void *p_data, unsigned int bytes) { … } static int gmbus1_mmio_write(struct intel_vgpu *vgpu, unsigned int offset, void *p_data, unsigned int bytes) { … } static int gmbus3_mmio_write(struct intel_vgpu *vgpu, unsigned int offset, void *p_data, unsigned int bytes) { … } static int gmbus3_mmio_read(struct intel_vgpu *vgpu, unsigned int offset, void *p_data, unsigned int bytes) { … } static int gmbus2_mmio_read(struct intel_vgpu *vgpu, unsigned int offset, void *p_data, unsigned int bytes) { … } static int gmbus2_mmio_write(struct intel_vgpu *vgpu, unsigned int offset, void *p_data, unsigned int bytes) { … } /** * intel_gvt_i2c_handle_gmbus_read - emulate gmbus register mmio read * @vgpu: a vGPU * @offset: reg offset * @p_data: data return buffer * @bytes: access data length * * This function is used to emulate gmbus register mmio read * * Returns: * Zero on success, negative error code if failed. * */ int intel_gvt_i2c_handle_gmbus_read(struct intel_vgpu *vgpu, unsigned int offset, void *p_data, unsigned int bytes) { … } /** * intel_gvt_i2c_handle_gmbus_write - emulate gmbus register mmio write * @vgpu: a vGPU * @offset: reg offset * @p_data: data return buffer * @bytes: access data length * * This function is used to emulate gmbus register mmio write * * Returns: * Zero on success, negative error code if failed. * */ int intel_gvt_i2c_handle_gmbus_write(struct intel_vgpu *vgpu, unsigned int offset, void *p_data, unsigned int bytes) { … } enum { … }; static inline int get_aux_ch_reg(unsigned int offset) { … } /** * intel_gvt_i2c_handle_aux_ch_write - emulate AUX channel register write * @vgpu: a vGPU * @port_idx: port index * @offset: reg offset * @p_data: write ptr * * This function is used to emulate AUX channel register write * */ void intel_gvt_i2c_handle_aux_ch_write(struct intel_vgpu *vgpu, int port_idx, unsigned int offset, void *p_data) { … } /** * intel_vgpu_init_i2c_edid - initialize vGPU i2c edid emulation * @vgpu: a vGPU * * This function is used to initialize vGPU i2c edid emulation stuffs * */ void intel_vgpu_init_i2c_edid(struct intel_vgpu *vgpu) { … }