/* * Copyright 2021 Advanced Micro Devices, Inc. * * 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 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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: AMD *
*/
/* FILE POLICY AND INTENDED USAGE: * * This file implements basic dpcd read/write functionality. It also does basic * dpcd range check to ensure that every dpcd request is compliant with specs * range requirements.
*/
/* * find current partition * this loop spins forever if partition map above is not surjective
*/ while (!do_addresses_intersect_with_range(&mandatory_dpcd_partitions[partition_iterator],
address, end_address))
partition_iterator++; if (end_address < mandatory_dpcd_partitions[partition_iterator].end) return size; return ADDRESS_RANGE_SIZE(address, mandatory_dpcd_partitions[partition_iterator].end);
}
/* * Ranges of DPCD addresses that must be read in a single transaction * XXX: Do not allow any two address ranges in this array to overlap
*/ staticconststruct dpcd_address_range mandatory_dpcd_blocks[] = {
{ DP_LT_TUNABLE_PHY_REPEATER_FIELD_DATA_STRUCTURE_REV, DP_PHY_REPEATER_128B132B_RATES }};
/* * Reduce the AUX reply down to the values the caller requested
*/ staticvoid dpcd_reduce_address_range( const uint32_t extended_address,
uint8_t * const extended_data, const uint32_t extended_size, const uint32_t reduced_address,
uint8_t * const reduced_data, const uint32_t reduced_size)
{ const uint32_t offset = reduced_address - extended_address;
/* * If the address is same, address was not extended. * So we do not need to free any memory. * The data is in original buffer(reduced_data).
*/ if (extended_data == reduced_data) return;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.