mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-15 09:46:46 +07:00
drm/i915/bios: have get_blocksize() support MIPI sequence block v3+
Have get_blocksize() support the special case of MIPI sequence block v3+ which has a separate field for size. Provide and use abstractions for getting the blocksize given a pointer to the block "envelope", i.e. pointer to the block id, and given a pointer to the block payload data. Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Jani Nikula <jani.nikula@intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/e935bd5e119a83dd91214c47e6cd4f6ce8b2a17e.1450702954.git.jani.nikula@intel.com
This commit is contained in:
parent
0f8689f5bb
commit
08c0888b28
@ -58,6 +58,22 @@
|
||||
|
||||
static int panel_type;
|
||||
|
||||
/* Get BDB block size given a pointer to Block ID. */
|
||||
static u32 _get_blocksize(const u8 *block_base)
|
||||
{
|
||||
/* The MIPI Sequence Block v3+ has a separate size field. */
|
||||
if (*block_base == BDB_MIPI_SEQUENCE && *(block_base + 3) >= 3)
|
||||
return *((const u32 *)(block_base + 4));
|
||||
else
|
||||
return *((const u16 *)(block_base + 1));
|
||||
}
|
||||
|
||||
/* Get BDB block size give a pointer to data after Block ID and Block Size. */
|
||||
static u32 get_blocksize(const void *block_data)
|
||||
{
|
||||
return _get_blocksize(block_data - 3);
|
||||
}
|
||||
|
||||
static const void *
|
||||
find_section(const void *_bdb, int section_id)
|
||||
{
|
||||
@ -74,14 +90,8 @@ find_section(const void *_bdb, int section_id)
|
||||
/* walk the sections looking for section_id */
|
||||
while (index + 3 < total) {
|
||||
current_id = *(base + index);
|
||||
index++;
|
||||
|
||||
current_size = *((const u16 *)(base + index));
|
||||
index += 2;
|
||||
|
||||
/* The MIPI Sequence Block v3+ has a separate size field. */
|
||||
if (current_id == BDB_MIPI_SEQUENCE && *(base + index) >= 3)
|
||||
current_size = *((const u32 *)(base + index + 1));
|
||||
current_size = _get_blocksize(base + index);
|
||||
index += 3;
|
||||
|
||||
if (index + current_size > total)
|
||||
return NULL;
|
||||
@ -95,16 +105,6 @@ find_section(const void *_bdb, int section_id)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static u16
|
||||
get_blocksize(const void *p)
|
||||
{
|
||||
u16 *block_ptr, block_size;
|
||||
|
||||
block_ptr = (u16 *)((char *)p - 2);
|
||||
block_size = *block_ptr;
|
||||
return block_size;
|
||||
}
|
||||
|
||||
static void
|
||||
fill_detail_timing_data(struct drm_display_mode *panel_fixed_mode,
|
||||
const struct lvds_dvo_timing *dvo_timing)
|
||||
|
Loading…
Reference in New Issue
Block a user