From: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [RFC 12/15] drm/i915: Make spi_oprom_get_vbt operate on intel_vbt
Date: Mon, 8 Jan 2024 15:05:14 -0800 [thread overview]
Message-ID: <20240108230517.1497504-13-radhakrishna.sripada@intel.com> (raw)
In-Reply-To: <20240108230517.1497504-1-radhakrishna.sripada@intel.com>
intel_vbt newly introduced, should be used to cache in the vbt
read from spi. Pass intel_vbt to spi read variant to cache intel_vbt
for future reference.
Signed-off-by: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
---
drivers/gpu/drm/i915/display/intel_bios.c | 32 +++++++++++------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
index 31183ac36c57..5a06879d6825 100644
--- a/drivers/gpu/drm/i915/display/intel_bios.c
+++ b/drivers/gpu/drm/i915/display/intel_bios.c
@@ -2997,13 +2997,14 @@ static u32 intel_spi_read(struct intel_uncore *uncore, u32 offset)
return intel_uncore_read(uncore, PRIMARY_SPI_TRIGGER);
}
-static struct vbt_header *spi_oprom_get_vbt(struct drm_i915_private *i915)
+static void spi_oprom_get_vbt(struct drm_i915_private *i915,
+ struct intel_vbt *vbt)
{
u32 count, data, found, store = 0;
u32 static_region, oprom_offset;
u32 oprom_size = 0x200000;
u16 vbt_size;
- u32 *vbt;
+ u32 *header;
static_region = intel_uncore_read(&i915->uncore, SPI_STATIC_REGIONS);
static_region &= OPTIONROM_SPI_REGIONID_MASK;
@@ -3028,27 +3029,29 @@ static struct vbt_header *spi_oprom_get_vbt(struct drm_i915_private *i915)
found + offsetof(struct vbt_header, vbt_size));
vbt_size &= 0xffff;
- vbt = kzalloc(round_up(vbt_size, 4), GFP_KERNEL);
- if (!vbt)
+ header = kzalloc(round_up(vbt_size, 4), GFP_KERNEL);
+ if (!header)
goto err_not_found;
for (count = 0; count < vbt_size; count += 4)
- *(vbt + store++) = intel_spi_read(&i915->uncore, found + count);
+ *(header + store++) = intel_spi_read(&i915->uncore, found + count);
- if (!intel_bios_is_valid_vbt(vbt, vbt_size))
+ if (!intel_bios_is_valid_vbt(header, vbt_size))
goto err_free_vbt;
- i915->display.vbt.vbt = vbt;
- i915->display.vbt.vbt_size = vbt_size;
- i915->display.vbt.type = I915_VBT_SPI;
+ vbt->vbt = header;
+ vbt->vbt_size = vbt_size;
+ vbt->type = I915_VBT_SPI;
drm_dbg_kms(&i915->drm, "Found valid VBT in SPI flash\n");
- return (struct vbt_header *)vbt;
+ return;
err_free_vbt:
kfree(vbt);
err_not_found:
- return NULL;
+ vbt->vbt = NULL;
+
+ return;
}
static void oprom_get_vbt(struct drm_i915_private *i915,
@@ -3129,7 +3132,6 @@ void intel_bios_init(struct drm_i915_private *i915)
{
struct intel_vbt *vbt = &i915->display.vbt;
struct intel_opregion *opregion = &i915->display.opregion;
- struct vbt_header *oprom_vbt = NULL;
struct vbt_header *header = NULL;
const struct bdb_header *bdb;
const char * const vbt_type[] = {
@@ -3159,10 +3161,8 @@ void intel_bios_init(struct drm_i915_private *i915)
* If the OpRegion does not have VBT, look in SPI flash through MMIO or
* PCI mapping
*/
- if (!vbt->vbt && IS_DGFX(i915)) {
- oprom_vbt = spi_oprom_get_vbt(i915);
- vbt->vbt = oprom_vbt;
- }
+ if (!vbt->vbt && IS_DGFX(i915))
+ spi_oprom_get_vbt(i915, vbt);
if (!vbt->vbt)
oprom_get_vbt(i915, vbt);
--
2.34.1
next prev parent reply other threads:[~2024-01-08 23:07 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-08 23:05 [RFC 00/15] VBT read Cleanup Radhakrishna Sripada
2024-01-08 23:05 ` [RFC 01/15] drm/i915: Extract display->vbt_data to a new vbt structure Radhakrishna Sripada
2024-01-08 23:05 ` [RFC 02/15] drm/i915: Move vbt fields from opregion to its own structure Radhakrishna Sripada
2024-01-08 23:05 ` [RFC 03/15] drm/i915: Cache opregion asls pointer Radhakrishna Sripada
2024-01-08 23:05 ` [RFC 04/15] drm/i915: Extract opregion vbt capture to its own function Radhakrishna Sripada
2024-01-08 23:05 ` [RFC 05/15] drm/i915: Init vbt fields when read from oprom/spi Radhakrishna Sripada
2024-01-08 23:05 ` [RFC 06/15] drm/i915: Classify vbt type based on its residence Radhakrishna Sripada
2024-01-08 23:05 ` [RFC 07/15] drm/i915: Collate vbt cleanup for different types Radhakrishna Sripada
2024-01-08 23:05 ` [RFC 08/15] drm/i915: Make intel_bios_init operate on intel_vbt Radhakrishna Sripada
2024-01-08 23:05 ` [RFC 09/15] drm/i915: Move vbt load from opregion to bios init Radhakrishna Sripada
2024-01-08 23:05 ` [RFC 10/15] drm/i915: Move vbt firmware load into intel_bios_init Radhakrishna Sripada
2024-01-08 23:05 ` [RFC 11/15] drm/i915: Make oprom_get_vbt operate on intel_vbt Radhakrishna Sripada
2024-01-08 23:05 ` Radhakrishna Sripada [this message]
2024-01-08 23:05 ` [RFC 13/15] drm/i915: Make intel_load_vbt_firmware " Radhakrishna Sripada
2024-01-08 23:05 ` [RFC 14/15] drm/i915: Kill reduntant vbt_firmware from intel_vbt Radhakrishna Sripada
2024-01-08 23:05 ` [RFC 15/15] drm/i915: Use vbt type to determine its validity Radhakrishna Sripada
2024-01-09 1:58 ` ✗ Fi.CI.SPARSE: warning for VBT read Cleanup Patchwork
2024-01-09 2:17 ` ✓ Fi.CI.BAT: success " Patchwork
2024-01-09 11:57 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-01-10 12:33 ` [RFC 00/15] " Jani Nikula
2024-01-11 22:46 ` Sripada, Radhakrishna
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240108230517.1497504-13-radhakrishna.sripada@intel.com \
--to=radhakrishna.sripada@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox