Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mtlp boot fix #4

Merged
merged 4 commits into from
Jul 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 52 additions & 33 deletions drivers/gpu/drm/i915/display/intel_bios.c
Original file line number Diff line number Diff line change
Expand Up @@ -2785,14 +2785,64 @@ static void parse_ddi_ports(struct drm_i915_private *i915)
}
}

static int child_device_expected_size(u16 version)
{
BUILD_BUG_ON(sizeof(struct child_device_config) < 40);

if (version > 256)
return -ENOENT;
else if (version >= 256)
return 40;
else if (version >= 216)
return 39;
else if (version >= 196)
return 38;
else if (version >= 195)
return 37;
else if (version >= 111)
return LEGACY_CHILD_DEVICE_CONFIG_SIZE;
else if (version >= 106)
return 27;
else
return 22;
}

static bool child_device_size_valid(struct drm_i915_private *i915, int size)
{
int expected_size;

expected_size = child_device_expected_size(i915->display.vbt.version);
if (expected_size < 0) {
expected_size = sizeof(struct child_device_config);
drm_dbg(&i915->drm,
"Expected child device config size for VBT version %u not known; assuming %d\n",
i915->display.vbt.version, expected_size);
}

/* Flag an error for unexpected size, but continue anyway. */
if (size != expected_size)
drm_err(&i915->drm,
"Unexpected child device config size %d (expected %d for VBT version %u)\n",
size, expected_size, i915->display.vbt.version);

/* The legacy sized child device config is the minimum we need. */
if (size < LEGACY_CHILD_DEVICE_CONFIG_SIZE) {
drm_dbg_kms(&i915->drm,
"Child device config size %d is too small.\n",
size);
return false;
}

return true;
}

static void
parse_general_definitions(struct drm_i915_private *i915)
{
const struct bdb_general_definitions *defs;
struct intel_bios_encoder_data *devdata;
const struct child_device_config *child;
int i, child_device_num;
u8 expected_size;
u16 block_size;
int bus_pin;

Expand All @@ -2816,39 +2866,8 @@ parse_general_definitions(struct drm_i915_private *i915)
if (intel_gmbus_is_valid_pin(i915, bus_pin))
i915->display.vbt.crt_ddc_pin = bus_pin;

if (i915->display.vbt.version < 106) {
expected_size = 22;
} else if (i915->display.vbt.version < 111) {
expected_size = 27;
} else if (i915->display.vbt.version < 195) {
expected_size = LEGACY_CHILD_DEVICE_CONFIG_SIZE;
} else if (i915->display.vbt.version == 195) {
expected_size = 37;
} else if (i915->display.vbt.version <= 215) {
expected_size = 38;
} else if (i915->display.vbt.version <= 250) {
expected_size = 39;
} else {
expected_size = sizeof(*child);
BUILD_BUG_ON(sizeof(*child) < 39);
drm_dbg(&i915->drm,
"Expected child device config size for VBT version %u not known; assuming %u\n",
i915->display.vbt.version, expected_size);
}

/* Flag an error for unexpected size, but continue anyway. */
if (defs->child_dev_size != expected_size)
drm_err(&i915->drm,
"Unexpected child device config size %u (expected %u for VBT version %u)\n",
defs->child_dev_size, expected_size, i915->display.vbt.version);

/* The legacy sized child device config is the minimum we need. */
if (defs->child_dev_size < LEGACY_CHILD_DEVICE_CONFIG_SIZE) {
drm_dbg_kms(&i915->drm,
"Child device config size %u is too small.\n",
defs->child_dev_size);
if (!child_device_size_valid(i915, defs->child_dev_size))
return;
}

/* get the number of child device */
child_device_num = (block_size - sizeof(*defs)) / defs->child_dev_size;
Expand Down
5 changes: 1 addition & 4 deletions drivers/gpu/drm/i915/display/intel_plane_initial.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,7 @@ initial_plane_vma(struct drm_i915_private *i915,
"Using phys_base=%pa, based on initial plane programming\n",
&phys_base);
} else {
if (IS_METEORLAKE_P(i915))
phys_base = 0;
else
phys_base = base;
phys_base = base;
mem = i915->mm.stolen_region;
}

Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/i915/display/intel_vbt_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,7 @@ struct child_device_config {
u8 hdmi_iboost_level:4; /* 196+ */
u8 dp_max_link_rate:3; /* 216+ */
u8 dp_max_link_rate_reserved:5; /* 216+ */
u8 efp_index; /* 256+ */
} __packed;

struct bdb_general_definitions {
Expand Down
Loading