nb/intel/gm45/gma: Probe PCI resource once and first
The PCI resource should only be probed as part of the device .init process. We can simply do that first and know that we can use the global `gtt_res` from then on. This simplifies the signature of gm45_get_lvds_edid_str(), and makes changes to the API user (lenovo/x200) necessary. Change-Id: I6c96f715abfa56dcb1cd89fde0fbaef3f1cb63ae Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/75376 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
This commit is contained in:
@@ -38,8 +38,7 @@ int get_blc_values(const struct blc_pwm_t **entries)
|
|||||||
|
|
||||||
const char *mainboard_vbt_filename(void)
|
const char *mainboard_vbt_filename(void)
|
||||||
{
|
{
|
||||||
struct device *gma = pcidev_path_on_root(PCI_DEVFN(0x2, 0));
|
u16 pwm_freq = get_blc_pwm_freq_value(gm45_get_lvds_edid_str());
|
||||||
u16 pwm_freq = gma ? get_blc_pwm_freq_value(gm45_get_lvds_edid_str(gma)) : 0;
|
|
||||||
|
|
||||||
if (pwm_freq == 0) {
|
if (pwm_freq == 0) {
|
||||||
printk(BIOS_DEBUG,
|
printk(BIOS_DEBUG,
|
||||||
|
@@ -449,7 +449,7 @@ u16 get_blc_pwm_freq_value(const char *edid_ascii_string);
|
|||||||
#include <device/device.h>
|
#include <device/device.h>
|
||||||
#include <edid.h>
|
#include <edid.h>
|
||||||
|
|
||||||
const char *gm45_get_lvds_edid_str(struct device *dev);
|
const char *gm45_get_lvds_edid_str(void);
|
||||||
|
|
||||||
struct acpi_rsdp;
|
struct acpi_rsdp;
|
||||||
unsigned long northbridge_write_acpi_tables(const struct device *device, unsigned long start,
|
unsigned long northbridge_write_acpi_tables(const struct device *device, unsigned long start,
|
||||||
|
@@ -143,7 +143,7 @@ static void gma_pm_init_post_vbios(struct device *const dev,
|
|||||||
reg8));
|
reg8));
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *gm45_get_lvds_edid_str(struct device *dev)
|
const char *gm45_get_lvds_edid_str(void)
|
||||||
{
|
{
|
||||||
u8 *mmio;
|
u8 *mmio;
|
||||||
u8 edid_data_lvds[128];
|
u8 edid_data_lvds[128];
|
||||||
@@ -152,10 +152,10 @@ const char *gm45_get_lvds_edid_str(struct device *dev)
|
|||||||
|
|
||||||
if (edid_str[0])
|
if (edid_str[0])
|
||||||
return edid_str;
|
return edid_str;
|
||||||
if (!gtt_res)
|
if (!gtt_res) {
|
||||||
gtt_res = probe_resource(dev, PCI_BASE_ADDRESS_0);
|
printk(BIOS_ERR, "Never call %s() outside dev.init() context.\n", __func__);
|
||||||
if (!gtt_res)
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
mmio = res2mmio(gtt_res, 0, 0);
|
mmio = res2mmio(gtt_res, 0, 0);
|
||||||
|
|
||||||
printk(BIOS_DEBUG, "LVDS EDID\n");
|
printk(BIOS_DEBUG, "LVDS EDID\n");
|
||||||
@@ -176,15 +176,18 @@ static void gma_func0_init(struct device *dev)
|
|||||||
const struct northbridge_intel_gm45_config *const conf = dev->chip_info;
|
const struct northbridge_intel_gm45_config *const conf = dev->chip_info;
|
||||||
const char *edid_str;
|
const char *edid_str;
|
||||||
|
|
||||||
|
/* Probe MMIO resource first. It's needed even for
|
||||||
|
intel_gma_init_igd_opregion() which may call back. */
|
||||||
|
gtt_res = probe_resource(dev, PCI_BASE_ADDRESS_0);
|
||||||
|
if (!gtt_res)
|
||||||
|
return;
|
||||||
|
|
||||||
intel_gma_init_igd_opregion();
|
intel_gma_init_igd_opregion();
|
||||||
|
|
||||||
edid_str = gm45_get_lvds_edid_str(dev);
|
edid_str = gm45_get_lvds_edid_str();
|
||||||
if (!edid_str)
|
if (!edid_str)
|
||||||
printk(BIOS_ERR, "Failed to obtain LVDS EDID string!\n");
|
printk(BIOS_ERR, "Failed to obtain LVDS EDID string!\n");
|
||||||
|
|
||||||
/* gtt_res should have been inited in gm45_get_lvds_edid_str() */
|
|
||||||
if (!gtt_res)
|
|
||||||
return;
|
|
||||||
mmio = res2mmio(gtt_res, 0, 0);
|
mmio = res2mmio(gtt_res, 0, 0);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user