[RFC 06/15] drm/i915: Classify vbt type based on its residence

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Vbt can be read from different sources viz. firmware, opregion,
oprom or spi. This will be useful for us to handle the vbt cleanup
during bios remove phase.

Signed-off-by: Radhakrishna Sripada <radhakrishna.sripada@xxxxxxxxx>
---
 drivers/gpu/drm/i915/display/intel_bios.c         | 15 ++++++++++++---
 drivers/gpu/drm/i915/display/intel_display_core.h |  8 ++++++++
 drivers/gpu/drm/i915/display/intel_opregion.c     |  3 +++
 3 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
index 0944802ecbd5..bd46a14a04f5 100644
--- a/drivers/gpu/drm/i915/display/intel_bios.c
+++ b/drivers/gpu/drm/i915/display/intel_bios.c
@@ -2996,6 +2996,7 @@ static struct vbt_header *spi_oprom_get_vbt(struct drm_i915_private *i915)
 
 	i915->display.vbt.vbt = vbt;
 	i915->display.vbt.vbt_size = vbt_size;
+	i915->display.vbt.type = I915_VBT_SPI;
 	drm_dbg_kms(&i915->drm, "Found valid VBT in SPI flash\n");
 
 	return (struct vbt_header *)vbt;
@@ -3057,6 +3058,7 @@ static struct vbt_header *oprom_get_vbt(struct drm_i915_private *i915)
 
 	i915->display.vbt.vbt = vbt;
 	i915->display.vbt.vbt_size = vbt_size;
+	i915->display.vbt.type = I915_VBT_OPROM;
 	drm_dbg_kms(&i915->drm, "Found valid VBT in PCI ROM\n");
 
 	return vbt;
@@ -3082,6 +3084,13 @@ void intel_bios_init(struct drm_i915_private *i915)
 	const struct vbt_header *vbt = i915->display.vbt.vbt;
 	struct vbt_header *oprom_vbt = NULL;
 	const struct bdb_header *bdb;
+	const char * const vbt_type[] = {
+		[I915_VBT_NONE] = "None",
+		[I915_VBT_FIRMWARE] = "Firmware",
+		[I915_VBT_OPREGION] = "Opregion",
+		[I915_VBT_OPROM] = "Oprom",
+		[I915_VBT_SPI] = "SPI",
+	};
 
 	INIT_LIST_HEAD(&i915->display.vbt.data.display_devices);
 	INIT_LIST_HEAD(&i915->display.vbt.data.bdb_blocks);
@@ -3114,9 +3123,9 @@ void intel_bios_init(struct drm_i915_private *i915)
 	bdb = get_bdb_header(vbt);
 	i915->display.vbt.data.version = bdb->version;
 
-	drm_dbg_kms(&i915->drm,
-		    "VBT signature \"%.*s\", BDB version %d\n",
-		    (int)sizeof(vbt->signature), vbt->signature, i915->display.vbt.data.version);
+	drm_dbg_kms(&i915->drm, "%s VBT signature \"%.*s\", BDB version %d\n",
+		    vbt_type[i915->display.vbt.type], (int)sizeof(vbt->signature),
+		    vbt->signature, i915->display.vbt.data.version);
 
 	init_bdb_blocks(i915, bdb);
 
diff --git a/drivers/gpu/drm/i915/display/intel_display_core.h b/drivers/gpu/drm/i915/display/intel_display_core.h
index 9e134b08aea0..4807edc88f81 100644
--- a/drivers/gpu/drm/i915/display/intel_display_core.h
+++ b/drivers/gpu/drm/i915/display/intel_display_core.h
@@ -236,6 +236,14 @@ struct intel_vbt {
 	void *vbt_firmware;
 	const void *vbt;
 	u32 vbt_size;
+	enum {
+		I915_VBT_NONE = 0,
+		I915_VBT_FIRMWARE,
+		I915_VBT_OPREGION,
+		I915_VBT_OPROM,
+		I915_VBT_SPI
+	} type;
+
 	struct intel_vbt_data data;
 };
 
diff --git a/drivers/gpu/drm/i915/display/intel_opregion.c b/drivers/gpu/drm/i915/display/intel_opregion.c
index cf7312cfd94a..5c4a5ddba01d 100644
--- a/drivers/gpu/drm/i915/display/intel_opregion.c
+++ b/drivers/gpu/drm/i915/display/intel_opregion.c
@@ -862,6 +862,7 @@ static int intel_load_vbt_firmware(struct drm_i915_private *dev_priv)
 				    "Found valid VBT firmware \"%s\"\n", name);
 			vbt->vbt = vbt->vbt_firmware;
 			vbt->vbt_size = fw->size;
+			vbt->type = I915_VBT_FIRMWARE;
 			ret = 0;
 		} else {
 			ret = -ENOMEM;
@@ -918,6 +919,7 @@ static int intel_load_opregion_vbt(struct drm_i915_private *i915,
 				    "Found valid VBT in ACPI OpRegion (RVDA)\n");
 			vbt->vbt = vbt_data;
 			vbt->vbt_size = vbt_size;
+			vbt->type = I915_VBT_OPREGION;
 			goto out;
 		} else {
 			drm_dbg_kms(&i915->drm,
@@ -943,6 +945,7 @@ static int intel_load_opregion_vbt(struct drm_i915_private *i915,
 			    "Found valid VBT in ACPI OpRegion (Mailbox #4)\n");
 		vbt->vbt = vbt_data;
 		vbt->vbt_size = vbt_size;
+		vbt->type = I915_VBT_OPREGION;
 	} else {
 		drm_dbg_kms(&i915->drm,
 			    "Invalid VBT in ACPI OpRegion (Mailbox #4)\n");
-- 
2.34.1




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux