summaryrefslogtreecommitdiff
path: root/tools/intel_vbt_decode.c
AgeCommit message (Collapse)Author
2022-06-22tools/intel_vbt_decode: Warn if we lack the full definiton of the BDB blockVille Syrjälä
Warn in case out BDB block definition is smaller than what the VBT has. That is an indication that we are potentially forgetting to decode some useful new data. We exclude blocks 2,11,22 from this since we don't have a sensible min size for them. We also limit this to modernish VBTs (155+) since some old stuff doesn't really conform (eg. my cst with version 134 has a 9 byte block 1 even though our min size for it is 7 bytes, and all the other oldish machines have block 1 only made up of of 4 or 5 bytes). Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2022-06-22tools/intel_vbt_decode: Generate LVDS data table pointes if not providedVille Syrjälä
Modern VBTs (at least observed on TGL machines) no longer provide the LVDS data table pointers block. Thus we can't currently decode the contents of the LVDS data table block. I see two options how to handle this: 1) Just hardocode the offsets/sizes (+ some checks to make sure the hardcoded values makes sense) 2) Deduce the offsets/sizes from the actual LVDS data table block contents I've chosen option 2 here. The fp_timing table 0xffff terminator is what allows us to do this. We just look up the first two of those from the LVDS data block and calculate the offsets/sizes from there. Only the fp_timing entries should have a variable size, and the dvo_timings and panel_pnp_id have fixed size (in fact IIRC they are 1:1 match for the equivalent EDID stuff). This is the same thing we do in the kernel parser as well since commit a87d0a847607 ("drm/i915/bios: Generate LFP data table pointers if the VBT lacks them") Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2022-06-22tools/intel_vbt_decode: Validate LVDS data table pointersVille Syrjälä
Do a reasonably exhaustive check to make sure the LVDS data table pointers are sane. Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2022-06-22tools/intel_vbt_decode: Dump the LVDS data ptrsVille Syrjälä
Decoede the LVDS data pointers. The offsets are specificed from the start of the whole VBT, but we've fixed them up to be relative to the start of the block already. For human parsing printing them as relative from the start of the block seems more useful anywya. Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2022-06-22tools/intel_vbt_decode: Decode the end of the LFP dataVille Syrjälä
Decode the tail end of the LFP data, if available. Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2022-06-22tools/intel_vbt_decode: Dump the panel PNP IDVille Syrjälä
Decode the panel PNP ID from the LVDS data block. Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2022-06-22tools/intel_vbt_decode: Simplify LVDS data block parsingVille Syrjälä
Get rid of the mess in the LVDS data block parsing and juse use the offsets straight from the LVDS data table pointers block. Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2022-06-22tools/intel_vbt_decode: Convert LFP data pointers to be relative to the data ↵Ville Syrjälä
block For some crazy reason the LFP data pointer offsets are specified as relative to the BDB header. That won't work with out private BDB block copies, so let's convert them to be relative to the start of the LFP data block. Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2022-06-22tools/intel_vbt_decode: Specify a minimum size for the BDB block copyVille Syrjälä
Guarantee that we have enough memory allocated for the structure we use to decode the BDB blocks. We no longer have to worry about going out of bounds in case of malformed VBT or incorrect version checks. The BDB_SDVO_PANEL_DTDS and BDB_GENERIC_DTD code looks a bit bit suspicious so those probably need a full review. Also BDB_LVDS_LFP_DATA and BDB_LVDS_LFP_DATA_PTRS will need further work due to the variable size nature of the data. Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2022-06-22tools/intel_vbt_decode: Make copies of the BDB blocksVille Syrjälä
Make a copy of the BDB blocks. For the moment we just do a 1:1 copy but later on we can specify a minimum size for the copy and stop worrying about going out of bounds during parsing in case the version checks are wrong of the VBT is malformed. Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2022-06-22tools/intel_vbt_decode: Include BDB block header in hex dumpVille Syrjälä
Include the block header in the hex dump as well. Might as well have the full data available in case we need to diagnose some decoding failures. Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2022-06-22tools/intel_vbt_decode: Parse the new eDP max link rateVille Syrjälä
VBT version 244 onwards have a new eDP max link rate field. Parse it. Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2022-06-22tools/intel_vbt_decode: Parse the old fast link training rate correctlyVille Syrjälä
We're failing to parse the 5.4 Gbps value of the old fast link training rate. Remedy it. Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2022-06-22tools/intel_vbt_decode: Decode new fast link training rateVille Syrjälä
Decode the fast link training link rate. Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2022-06-22tools/intel_vbt_decode: Dump the LVDS panel optionsVille Syrjälä
Decode per-panel stuff from the LVDS options block. Not at all sure which version have which fields since the spec only goes back to v155. But earlier VBTs do have some of this stuff already so going by block size instead for the older stuff. Here's a quick list from my VBT stash: mgm version 108 -> 4 bytes alv version 120 -> 4 bytes cst version 134 -> 14 bytes pnv version 144 -> 14 bytes cl version 142 -> 16 bytes ctg version 155 -> 24 bytes The pnv VBT is particularly interesting since it has a higher version number that the cl VBT and yet has a smaller LVDS options block. I guess the "Atom==let's not follow any rules" rule started already back then. All the more modern VBTs I have are 24 bytes (or more). Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2022-06-22tools/intel_vbt_decode: Decode the LFP power blockVille Syrjälä
Decode the contents of the LFP power conservation block (44). Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2022-06-22tools/intel_vbt_decode: Dump the block sizeVille Syrjälä
Knowing the size of each block can help in figuring out what should be in there. Let's dump that. Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2022-06-22tools/intel_vbt_decode: Unify panel type handlingVille Syrjälä
Print the panel type(s) the same way in dump_lvds_data() as elsewhere. Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2022-06-22tools/intel_vbt_decode: Decode DP max link rateVille Syrjälä
Decode the child device DP max link rate stuff. Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2022-06-22tools/intel_vbt_decode: Clean up SSC freq decodingVille Syrjälä
Use the same logic as we use in the kernel to decode the SSC frequency. Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2022-06-22tools/intel_vbt_decode: Decode mode HDMI data ratesVille Syrjälä
Decode new HDMI data rates. Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2022-06-22tools/intel_vbt_decode: Decode more DVO portsVille Syrjälä
Decode the DP/HDMI DVO ports up to 'I'. Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2022-06-22tools/intel_vbt_decode: update vbt defs from kernelVille Syrjälä
Sync up the the VBT definitions from kernel commit 24b8b74eb2eb ("drm/i915: Parse max link rate from the eDP BDB block") and adjust the actual code to match. Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2021-10-08lib: Typechecking minmaxChris Wilson
Add typechecking to the min/max macros and make their locals truly unique-ish to reduce the risk of shadowing. v2: small bug fix, write also height coordinate on rotation test. (jheikkil) v3: Fix up a couple of other max/max_t instances (Ashutosh) Signed-off-by: Juha-Pekka Heikkilä <juha-pekka.heikkila@intel.com> Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com> Signed-off-by: Chris Wilson <chris.p.wilson@intel.com> Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
2019-10-29tools/intel_vbt_decode: add decoding of the compression parameters blockJani Nikula
Decode block 56. Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2019-08-23tools/intel_vbt_decode: dump all backlight dataJani Nikula
We were missing the level and control method. Reviewed-by: Simon Ser <simon.ser@intel.com> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2019-08-23tools/intel_vbt_decode: dump backlight data for all panelsJani Nikula
Similar to other panel type indexed arrays. Reviewed-by: Simon Ser <simon.ser@intel.com> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2019-07-19tools/vbt_decode: Print PSR2 training pattern durationDhinakaran Pandiyan
There is a new field for PSR2 training pattern duration in VBT versions >= 226, decode that. v2: Changed to fixed-width types(Ville) Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2019-06-05tools/intel_vbt_decode: update vbt defs from kernelJani Nikula
Sync up to commit f41c615310d2 ("drm/i915/bios: add an enum for BDB block IDs") in kernel intel_vbt_defs.h, and update the tool with the struct renames. Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2019-03-08tools/intel_vbt_decode: check inconsistent sequence element sizeJani Nikula
Cross check against the element dumper return value to catch inconsistencies. Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2019-03-08tools/intel_vbt_decode: Dump the GPIO value/config/flag as a raw hex byteVille Syrjälä
The spec is totally confused when it comes to the GPIO flags byte. To allow us to inspect that the decoded result at least seems sensible let's also dump the raw byte. Should at least show if some bits are set which we're not expecting. Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2019-03-08tools/intel_vbt_decode: Correctly decode v3 GPIO sequenceVille Syrjälä
The v3 GPIO seq is three bytes, not two. Decode it correctly. Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
2018-11-06tools/intel_vbt_decode: Decode HDMI max data rateVille Syrjälä
Decode the HDMI max data rate from the VBT. Cc: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Jani Nikula <jani.nikula@intel.com>
2018-10-24tools/intel_vbt_decode: Dump DSI panel rotationVille Syrjälä
Dump out the rotation field from the MIPI config block. Cc: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Jani Nikula <jani.nikula@intel.com>
2018-05-09tools/vbt_decode: Print DRRS and PSR flagsDhinakaran Pandiyan
These bits are useful for debug. Cc: Rodrigo Vivi <rodrigo.vivi@intel.com> Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
2018-01-23tools/intel_vbt_decode: add --describe optionJani Nikula
Print description of the form <bdb-version>-<vbt-signature> that could be used for e.g. filenames. Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2018-01-23tools/intel_vbt_decode: add --header option to only print headerJani Nikula
Sometimes it's useful just to print the VBT and BDB headers. Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2018-01-23tools/intel_vbt_decode: print child device countJani Nikula
Sometimes useful. Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2018-01-19intel_vbt_decode: Typo fixesAdam Jackson
Signed-off-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2017-10-20tools/intel_vbt_decode: abstract child devices printing moreJani Nikula
Unify the common code for current and legacy blocks. Acked-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2017-10-20tools/intel_vbt_decode: dump more child device data for version < 152Jani Nikula
There's no evidence that this is the limit. Acked-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2017-10-20tools/intel_vbt_decode: unify legacy child device block dumpingJani Nikula
It's the same stuff as in the new child devices. Acked-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2017-10-20tools/intel_vbt_decode: unify child device printing across versionsJani Nikula
Make it easier to compare dumping against the struct definition. v2: Fix version comparison for flags, aux channel and dongle detect, and fix some typos while at it (Ville) Acked-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2017-10-20tools/intel_vbt_decode: abstract DSI bridge type dumpJani Nikula
Cleaner than having it inline. Acked-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2017-10-20tools/intel_vbt_decode: use %.*s instead of duplicating a stringJani Nikula
child->device_id may not be terminated, but we can use %.*s format specifier to define the max length to print. No need to make a copy. Acked-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2017-10-20tools/intel_vbt_decode: update dvo port name dumpingJani Nikula
Add names for new ports, throw out unused macros. Acked-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2017-10-20tools/intel_vbt_decode: make a copy of child devices before dumpingJani Nikula
Take child device size into account, avoid reading past the actual child device. Acked-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2017-08-29tools/intel_vbt_decode: migrate backlight dumping to kernel structJani Nikula
Drop obsolete field dumping. Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2017-08-29tools/intel_vbt_decode: migrate child device type bits decoding to kernel defsJani Nikula
This lets us use the verbatim copy of the kernel intel_vbt_defs.h file after kernel commit 058727ee8d9a ("drm/i915/bios: amend edp block based on intel_vbt_decode"). Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
2017-08-29tools/intel_vbt_decode: migrate edp dumping to kernel structJani Nikula
No functional changes. Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Jani Nikula <jani.nikula@intel.com>