[PATCH 06/17] drm/amd/display: remove dead dc vbios code
Alex Deucher
alexdeucher at gmail.com
Fri Aug 31 04:23:30 UTC 2018
On Thu, Aug 30, 2018 at 5:34 PM Bhawanpreet Lakha
<Bhawanpreet.Lakha at amd.com> wrote:
>
> From: Dmytro Laktyushkin <Dmytro.Laktyushkin at amd.com>
>
> Change-Id: Id1e7c39db419f13cf478c6a0c6f4b84c039acffe
> Signed-off-by: Dmytro Laktyushkin <Dmytro.Laktyushkin at amd.com>
> Reviewed-by: Charlene Liu <Charlene.Liu at amd.com>
> Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha at amd.com>
> ---
> drivers/gpu/drm/amd/display/dc/bios/bios_parser.c | 1177 --------------------
> drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c | 312 +-----
> drivers/gpu/drm/amd/display/dc/dc_bios_types.h | 64 --
> 3 files changed, 39 insertions(+), 1514 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c b/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c
> index bfa5816cfc92..0e1dc1b1a48d 100644
> --- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c
> +++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c
> @@ -52,24 +52,13 @@
> #define DC_LOGGER \
> bp->base.ctx->logger
>
> -/* GUID to validate external display connection info table (aka OPM module) */
> -static const uint8_t ext_display_connection_guid[NUMBER_OF_UCHAR_FOR_GUID] = {
> - 0x91, 0x6E, 0x57, 0x09,
> - 0x3F, 0x6D, 0xD2, 0x11,
> - 0x39, 0x8E, 0x00, 0xA0,
> - 0xC9, 0x69, 0x72, 0x3B};
> -
> #define DATA_TABLES(table) (bp->master_data_tbl->ListOfDataTables.table)
>
> static void get_atom_data_table_revision(
> ATOM_COMMON_TABLE_HEADER *atom_data_tbl,
> struct atom_data_revision *tbl_revision);
> -static uint32_t get_dst_number_from_object(struct bios_parser *bp,
> - ATOM_OBJECT *object);
> static uint32_t get_src_obj_list(struct bios_parser *bp, ATOM_OBJECT *object,
> uint16_t **id_list);
> -static uint32_t get_dest_obj_list(struct bios_parser *bp,
> - ATOM_OBJECT *object, uint16_t **id_list);
> static ATOM_OBJECT *get_bios_object(struct bios_parser *bp,
> struct graphics_object_id id);
> static enum bp_result get_gpio_i2c_info(struct bios_parser *bp,
> @@ -163,29 +152,6 @@ static uint8_t bios_parser_get_connectors_number(struct dc_bios *dcb)
> le16_to_cpu(bp->object_info_tbl.v1_1->usConnectorObjectTableOffset));
> }
>
> -static struct graphics_object_id bios_parser_get_encoder_id(
> - struct dc_bios *dcb,
> - uint32_t i)
> -{
> - struct bios_parser *bp = BP_FROM_DCB(dcb);
> - struct graphics_object_id object_id = dal_graphics_object_id_init(
> - 0, ENUM_ID_UNKNOWN, OBJECT_TYPE_UNKNOWN);
> -
> - uint32_t encoder_table_offset = bp->object_info_tbl_offset
> - + le16_to_cpu(bp->object_info_tbl.v1_1->usEncoderObjectTableOffset);
> -
> - ATOM_OBJECT_TABLE *tbl =
> - GET_IMAGE(ATOM_OBJECT_TABLE, encoder_table_offset);
> -
> - if (tbl && tbl->ucNumberOfObjects > i) {
> - const uint16_t id = le16_to_cpu(tbl->asObjects[i].usObjectID);
> -
> - object_id = object_id_from_bios_object_id(id);
> - }
> -
> - return object_id;
> -}
> -
> static struct graphics_object_id bios_parser_get_connector_id(
> struct dc_bios *dcb,
> uint8_t i)
> @@ -217,15 +183,6 @@ static struct graphics_object_id bios_parser_get_connector_id(
> return object_id;
> }
>
> -static uint32_t bios_parser_get_dst_number(struct dc_bios *dcb,
> - struct graphics_object_id id)
> -{
> - struct bios_parser *bp = BP_FROM_DCB(dcb);
> - ATOM_OBJECT *object = get_bios_object(bp, id);
> -
> - return get_dst_number_from_object(bp, object);
> -}
> -
> static enum bp_result bios_parser_get_src_obj(struct dc_bios *dcb,
> struct graphics_object_id object_id, uint32_t index,
> struct graphics_object_id *src_object_id)
> @@ -255,30 +212,6 @@ static enum bp_result bios_parser_get_src_obj(struct dc_bios *dcb,
> return BP_RESULT_OK;
> }
>
> -static enum bp_result bios_parser_get_dst_obj(struct dc_bios *dcb,
> - struct graphics_object_id object_id, uint32_t index,
> - struct graphics_object_id *dest_object_id)
> -{
> - uint32_t number;
> - uint16_t *id = NULL;
> - ATOM_OBJECT *object;
> - struct bios_parser *bp = BP_FROM_DCB(dcb);
> -
> - if (!dest_object_id)
> - return BP_RESULT_BADINPUT;
> -
> - object = get_bios_object(bp, object_id);
> -
> - number = get_dest_obj_list(bp, object, &id);
> -
> - if (number <= index || !id)
> - return BP_RESULT_BADINPUT;
> -
> - *dest_object_id = object_id_from_bios_object_id(id[index]);
> -
> - return BP_RESULT_OK;
> -}
> -
> static enum bp_result bios_parser_get_i2c_info(struct dc_bios *dcb,
> struct graphics_object_id id,
> struct graphics_object_i2c_info *info)
> @@ -325,196 +258,6 @@ static enum bp_result bios_parser_get_i2c_info(struct dc_bios *dcb,
> return BP_RESULT_NORECORD;
> }
>
> -static enum bp_result get_voltage_ddc_info_v1(uint8_t *i2c_line,
> - ATOM_COMMON_TABLE_HEADER *header,
> - uint8_t *address)
> -{
> - enum bp_result result = BP_RESULT_NORECORD;
> - ATOM_VOLTAGE_OBJECT_INFO *info =
> - (ATOM_VOLTAGE_OBJECT_INFO *) address;
> -
> - uint8_t *voltage_current_object = (uint8_t *) &info->asVoltageObj[0];
> -
> - while ((address + le16_to_cpu(header->usStructureSize)) > voltage_current_object) {
> - ATOM_VOLTAGE_OBJECT *object =
> - (ATOM_VOLTAGE_OBJECT *) voltage_current_object;
> -
> - if ((object->ucVoltageType == SET_VOLTAGE_INIT_MODE) &&
> - (object->ucVoltageType &
> - VOLTAGE_CONTROLLED_BY_I2C_MASK)) {
> -
> - *i2c_line = object->asControl.ucVoltageControlI2cLine
> - ^ 0x90;
> - result = BP_RESULT_OK;
> - break;
> - }
> -
> - voltage_current_object += object->ucSize;
> - }
> - return result;
> -}
> -
> -static enum bp_result get_voltage_ddc_info_v3(uint8_t *i2c_line,
> - uint32_t index,
> - ATOM_COMMON_TABLE_HEADER *header,
> - uint8_t *address)
> -{
> - enum bp_result result = BP_RESULT_NORECORD;
> - ATOM_VOLTAGE_OBJECT_INFO_V3_1 *info =
> - (ATOM_VOLTAGE_OBJECT_INFO_V3_1 *) address;
> -
> - uint8_t *voltage_current_object =
> - (uint8_t *) (&(info->asVoltageObj[0]));
> -
> - while ((address + le16_to_cpu(header->usStructureSize)) > voltage_current_object) {
> - ATOM_I2C_VOLTAGE_OBJECT_V3 *object =
> - (ATOM_I2C_VOLTAGE_OBJECT_V3 *) voltage_current_object;
> -
> - if (object->sHeader.ucVoltageMode ==
> - ATOM_INIT_VOLTAGE_REGULATOR) {
> - if (object->sHeader.ucVoltageType == index) {
> - *i2c_line = object->ucVoltageControlI2cLine
> - ^ 0x90;
> - result = BP_RESULT_OK;
> - break;
> - }
> - }
> -
> - voltage_current_object += le16_to_cpu(object->sHeader.usSize);
> - }
> - return result;
> -}
> -
> -static enum bp_result bios_parser_get_thermal_ddc_info(
> - struct dc_bios *dcb,
> - uint32_t i2c_channel_id,
> - struct graphics_object_i2c_info *info)
> -{
> - struct bios_parser *bp = BP_FROM_DCB(dcb);
> - ATOM_I2C_ID_CONFIG_ACCESS *config;
> - ATOM_I2C_RECORD record;
> -
> - if (!info)
> - return BP_RESULT_BADINPUT;
> -
> - config = (ATOM_I2C_ID_CONFIG_ACCESS *) &i2c_channel_id;
> -
> - record.sucI2cId.bfHW_Capable = config->sbfAccess.bfHW_Capable;
> - record.sucI2cId.bfI2C_LineMux = config->sbfAccess.bfI2C_LineMux;
> - record.sucI2cId.bfHW_EngineID = config->sbfAccess.bfHW_EngineID;
> -
> - return get_gpio_i2c_info(bp, &record, info);
> -}
> -
> -static enum bp_result bios_parser_get_voltage_ddc_info(struct dc_bios *dcb,
> - uint32_t index,
> - struct graphics_object_i2c_info *info)
> -{
> - uint8_t i2c_line = 0;
> - enum bp_result result = BP_RESULT_NORECORD;
> - uint8_t *voltage_info_address;
> - ATOM_COMMON_TABLE_HEADER *header;
> - struct atom_data_revision revision = {0};
> - struct bios_parser *bp = BP_FROM_DCB(dcb);
> -
> - if (!DATA_TABLES(VoltageObjectInfo))
> - return result;
> -
> - voltage_info_address = bios_get_image(&bp->base, DATA_TABLES(VoltageObjectInfo), sizeof(ATOM_COMMON_TABLE_HEADER));
> -
> - header = (ATOM_COMMON_TABLE_HEADER *) voltage_info_address;
> -
> - get_atom_data_table_revision(header, &revision);
> -
> - switch (revision.major) {
> - case 1:
> - case 2:
> - result = get_voltage_ddc_info_v1(&i2c_line, header,
> - voltage_info_address);
> - break;
> - case 3:
> - if (revision.minor != 1)
> - break;
> - result = get_voltage_ddc_info_v3(&i2c_line, index, header,
> - voltage_info_address);
> - break;
> - }
> -
> - if (result == BP_RESULT_OK)
> - result = bios_parser_get_thermal_ddc_info(dcb,
> - i2c_line, info);
> -
> - return result;
> -}
> -
> -/* TODO: temporary commented out to suppress 'defined but not used' warning */
> -#if 0
> -static enum bp_result bios_parser_get_ddc_info_for_i2c_line(
> - struct bios_parser *bp,
> - uint8_t i2c_line, struct graphics_object_i2c_info *info)
> -{
> - uint32_t offset;
> - ATOM_OBJECT *object;
> - ATOM_OBJECT_TABLE *table;
> - uint32_t i;
> -
> - if (!info)
> - return BP_RESULT_BADINPUT;
> -
> - offset = le16_to_cpu(bp->object_info_tbl.v1_1->usConnectorObjectTableOffset);
> -
> - offset += bp->object_info_tbl_offset;
> -
> - table = GET_IMAGE(ATOM_OBJECT_TABLE, offset);
> -
> - if (!table)
> - return BP_RESULT_BADBIOSTABLE;
> -
> - for (i = 0; i < table->ucNumberOfObjects; i++) {
> - object = &table->asObjects[i];
> -
> - if (!object) {
> - BREAK_TO_DEBUGGER(); /* Invalid object id */
> - return BP_RESULT_BADINPUT;
> - }
> -
> - offset = le16_to_cpu(object->usRecordOffset)
> - + bp->object_info_tbl_offset;
> -
> - for (;;) {
> - ATOM_COMMON_RECORD_HEADER *header =
> - GET_IMAGE(ATOM_COMMON_RECORD_HEADER, offset);
> -
> - if (!header)
> - return BP_RESULT_BADBIOSTABLE;
> -
> - offset += header->ucRecordSize;
> -
> - if (LAST_RECORD_TYPE == header->ucRecordType ||
> - !header->ucRecordSize)
> - break;
> -
> - if (ATOM_I2C_RECORD_TYPE == header->ucRecordType
> - && sizeof(ATOM_I2C_RECORD) <=
> - header->ucRecordSize) {
> - ATOM_I2C_RECORD *record =
> - (ATOM_I2C_RECORD *) header;
> -
> - if (i2c_line != record->sucI2cId.bfI2C_LineMux)
> - continue;
> -
> - /* get the I2C info */
> - if (get_gpio_i2c_info(bp, record, info) ==
> - BP_RESULT_OK)
> - return BP_RESULT_OK;
> - }
> - }
> - }
> -
> - return BP_RESULT_NORECORD;
> -}
> -#endif
> -
> static enum bp_result bios_parser_get_hpd_info(struct dc_bios *dcb,
> struct graphics_object_id id,
> struct graphics_object_hpd_info *info)
> @@ -1129,62 +872,6 @@ static bool bios_parser_is_device_id_supported(
> return (le16_to_cpu(bp->object_info_tbl.v1_1->usDeviceSupport) & mask) != 0;
> }
>
> -static enum bp_result bios_parser_crt_control(
> - struct dc_bios *dcb,
> - enum engine_id engine_id,
> - bool enable,
> - uint32_t pixel_clock)
> -{
> - struct bios_parser *bp = BP_FROM_DCB(dcb);
> - uint8_t standard;
> -
> - if (!bp->cmd_tbl.dac1_encoder_control &&
> - engine_id == ENGINE_ID_DACA)
> - return BP_RESULT_FAILURE;
> - if (!bp->cmd_tbl.dac2_encoder_control &&
> - engine_id == ENGINE_ID_DACB)
> - return BP_RESULT_FAILURE;
> - /* validate params */
> - switch (engine_id) {
> - case ENGINE_ID_DACA:
> - case ENGINE_ID_DACB:
> - break;
> - default:
> - /* unsupported engine */
> - return BP_RESULT_FAILURE;
> - }
> -
> - standard = ATOM_DAC1_PS2; /* == ATOM_DAC2_PS2 */
> -
> - if (enable) {
> - if (engine_id == ENGINE_ID_DACA) {
> - bp->cmd_tbl.dac1_encoder_control(bp, enable,
> - pixel_clock, standard);
> - if (bp->cmd_tbl.dac1_output_control != NULL)
> - bp->cmd_tbl.dac1_output_control(bp, enable);
> - } else {
> - bp->cmd_tbl.dac2_encoder_control(bp, enable,
> - pixel_clock, standard);
> - if (bp->cmd_tbl.dac2_output_control != NULL)
> - bp->cmd_tbl.dac2_output_control(bp, enable);
> - }
> - } else {
> - if (engine_id == ENGINE_ID_DACA) {
> - if (bp->cmd_tbl.dac1_output_control != NULL)
> - bp->cmd_tbl.dac1_output_control(bp, enable);
> - bp->cmd_tbl.dac1_encoder_control(bp, enable,
> - pixel_clock, standard);
> - } else {
> - if (bp->cmd_tbl.dac2_output_control != NULL)
> - bp->cmd_tbl.dac2_output_control(bp, enable);
> - bp->cmd_tbl.dac2_encoder_control(bp, enable,
> - pixel_clock, standard);
> - }
> - }
> -
> - return BP_RESULT_OK;
> -}
> -
I have vague plans to add DAC support for CIK parts at some point, but
I suppose I can just resurrect this function at that time...
Alex
More information about the amd-gfx
mailing list