drm/i915/skl: Added a check for the hardware status of csr fw before loading.
drm/i915/skl: Added a check for the hardware status of csr fw before loading.

Dmc will restore the csr program except DC9, cold boot,
warm reset, PCI function level reset, and hibernate/suspend.

intel_csr_load_program() function is used to load the firmware
data from kernel memory to csr address space.

All values of csr address space will be zero if it got reset and
the first byte of csr program is always a non-zero if firmware
is loaded successfuly. Based on hardware status will load the
firmware.

Without this condition check if we overwrite the firmware data the
counters exposed for dc5/dc6 (help for debugging) will be nullified.

Note: Above commit message seems to be confused and the real problem
apparently going on is that for suspend-to-idle and system standby the
firmware survives (it's like runtime pm), but it doesn't for
suspend-to-mem and hibernate-to-disk. All the other talking about DC9
and pci reset are irrelevant for the path touched here (only driver
load and system resume functions) and might not be true statements.

v1: Initial version.

v2: Based on review comments from Daniel,
- Added a check to know hardware status and load the firmware if not loaded.

Cc: Daniel Vetter <c1b6782c4af8f0673da8923a0702a1832e5940f4@intel.com>
Cc: Damien Lespiau <64bd3cb94f359c1a3ce68dae5e26b40578526277@intel.com>
Cc: Imre Deak <fbd5edba1988036c8923f0cca0cce6ac4811db29@intel.com>
Cc: Sunil Kamath <f7e3b21b9c94d692c9dc69c41b50af291a4a19d8@intel.com>
Signed-off-by: Animesh Manna <3037d29327d3a5685a266f32126997e50c136bb4@intel.com>
Signed-off-by: Vathsala Nagaraju <960e71ccf15d2c770c460f7c0718bd8b4fa85865@intel.com>
Reviewed-by: A.Sunil Kamath <f7e3b21b9c94d692c9dc69c41b50af291a4a19d8@intel.com>
[danvet: Explain clearly in the code comment when we need to reload
and when not and make it a FIXME. Also deconfuse the commit message
with a note. Also: Make. it. compile.]
Signed-off-by: Daniel Vetter <c1b6782c4af8f0673da8923a0702a1832e5940f4@ffwll.ch>

KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs