diff options
Diffstat (limited to 'src/drivers')
-rw-r--r-- | src/drivers/intel/gma/Kconfig | 4 | ||||
-rw-r--r-- | src/drivers/intel/gma/opregion.c | 49 |
2 files changed, 24 insertions, 29 deletions
diff --git a/src/drivers/intel/gma/Kconfig b/src/drivers/intel/gma/Kconfig index 47f7617c34..ca0143d86c 100644 --- a/src/drivers/intel/gma/Kconfig +++ b/src/drivers/intel/gma/Kconfig @@ -59,10 +59,6 @@ config INTEL_GMA_SWSMISCI config INTEL_GMA_LIBGFXINIT_EDID bool -config VBT_DATA_SIZE_KB - int - default 8 - config VBT_CBFS_COMPRESSION_DEFAULT_LZ4 def_bool n help diff --git a/src/drivers/intel/gma/opregion.c b/src/drivers/intel/gma/opregion.c index fe333fa674..d5516389e5 100644 --- a/src/drivers/intel/gma/opregion.c +++ b/src/drivers/intel/gma/opregion.c @@ -19,40 +19,39 @@ const char *mainboard_vbt_filename(void) return "vbt.bin"; } -static char vbt_data[CONFIG_VBT_DATA_SIZE_KB * KiB]; -static size_t vbt_data_sz; - void *locate_vbt(size_t *vbt_size) { - uint32_t vbtsig = 0; - - if (vbt_data_sz != 0) { - if (vbt_size) - *vbt_size = vbt_data_sz; - return (void *)vbt_data; - } + static void *data; + static size_t size; - const char *filename = mainboard_vbt_filename(); + if (data) + goto out; - size_t file_size = cbfs_load(filename, vbt_data, sizeof(vbt_data)); + data = cbfs_map(mainboard_vbt_filename(), &size); + if (!data || size == 0) { + printk(BIOS_ERR, "Could not find or load %s CBFS file\n", + mainboard_vbt_filename()); + goto err; + } - if (file_size == 0) - return NULL; + if (*(uint32_t *)data == VBT_SIGNATURE) { + printk(BIOS_INFO, "Found a VBT of %zu bytes\n", size); + goto out; + } - if (vbt_size) - *vbt_size = file_size; + printk(BIOS_ERR, "Missing/invalid signature in VBT data file!\n"); - memcpy(&vbtsig, vbt_data, sizeof(vbtsig)); - if (vbtsig != VBT_SIGNATURE) { - printk(BIOS_ERR, "Missing/invalid signature in VBT data file!\n"); - return NULL; +err: + if (data) { + cbfs_unmap(data); + data = NULL; } + size = 0; - printk(BIOS_INFO, "Found a VBT of %zu bytes after decompression\n", - file_size); - vbt_data_sz = file_size; - - return (void *)vbt_data; +out: + if (vbt_size && size) + *vbt_size = size; + return data; } /* Write ASLS PCI register and prepare SWSCI register. */ |