intel/gma: Only enable bus mastering if we are going to use it
Also fix wrong 32-bit writes. Change-Id: Ib038f0cd558223536da08ba2264774db11cd8357 Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/40727 Reviewed-by: Angel Pons <th3fanbus@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
dfdf102000
commit
dd59762729
@ -144,7 +144,6 @@ static void gma_pm_init_post_vbios(struct device *const dev,
|
|||||||
|
|
||||||
static void gma_func0_init(struct device *dev)
|
static void gma_func0_init(struct device *dev)
|
||||||
{
|
{
|
||||||
u32 reg32;
|
|
||||||
u8 *mmio;
|
u8 *mmio;
|
||||||
u8 edid_data_lvds[128];
|
u8 edid_data_lvds[128];
|
||||||
struct edid edid_lvds;
|
struct edid edid_lvds;
|
||||||
@ -152,16 +151,13 @@ static void gma_func0_init(struct device *dev)
|
|||||||
|
|
||||||
intel_gma_init_igd_opregion();
|
intel_gma_init_igd_opregion();
|
||||||
|
|
||||||
/* IGD needs to be Bus Master */
|
|
||||||
reg32 = pci_read_config32(dev, PCI_COMMAND);
|
|
||||||
reg32 |= PCI_COMMAND_MASTER;
|
|
||||||
pci_write_config32(dev, PCI_COMMAND, reg32);
|
|
||||||
|
|
||||||
gtt_res = find_resource(dev, PCI_BASE_ADDRESS_0);
|
gtt_res = find_resource(dev, PCI_BASE_ADDRESS_0);
|
||||||
if (gtt_res == NULL)
|
if (gtt_res == NULL)
|
||||||
return;
|
return;
|
||||||
mmio = res2mmio(gtt_res, 0, 0);
|
mmio = res2mmio(gtt_res, 0, 0);
|
||||||
|
|
||||||
|
if (!CONFIG(NO_GFX_INIT))
|
||||||
|
pci_or_config16(dev, PCI_COMMAND, PCI_COMMAND_MASTER);
|
||||||
|
|
||||||
if (!CONFIG(MAINBOARD_USE_LIBGFXINIT)) {
|
if (!CONFIG(MAINBOARD_USE_LIBGFXINIT)) {
|
||||||
/* PCI Init, will run VBIOS */
|
/* PCI Init, will run VBIOS */
|
||||||
|
@ -458,21 +458,18 @@ static void gma_enable_swsci(void)
|
|||||||
static void gma_func0_init(struct device *dev)
|
static void gma_func0_init(struct device *dev)
|
||||||
{
|
{
|
||||||
int lightup_ok = 0;
|
int lightup_ok = 0;
|
||||||
u32 reg32;
|
|
||||||
|
|
||||||
intel_gma_init_igd_opregion();
|
intel_gma_init_igd_opregion();
|
||||||
|
|
||||||
/* IGD needs to be Bus Master */
|
|
||||||
reg32 = pci_read_config32(dev, PCI_COMMAND);
|
|
||||||
reg32 |= PCI_COMMAND_MASTER;
|
|
||||||
pci_write_config32(dev, PCI_COMMAND, reg32);
|
|
||||||
|
|
||||||
/* Init graphics power management */
|
/* Init graphics power management */
|
||||||
gma_pm_init_pre_vbios(dev);
|
gma_pm_init_pre_vbios(dev);
|
||||||
|
|
||||||
/* Pre panel init */
|
/* Pre panel init */
|
||||||
gma_setup_panel(dev);
|
gma_setup_panel(dev);
|
||||||
|
|
||||||
|
if (!CONFIG(NO_GFX_INIT))
|
||||||
|
pci_or_config16(dev, PCI_COMMAND, PCI_COMMAND_MASTER);
|
||||||
|
|
||||||
int vga_disable = (pci_read_config16(dev, GGC) & 2) >> 1;
|
int vga_disable = (pci_read_config16(dev, GGC) & 2) >> 1;
|
||||||
|
|
||||||
if (CONFIG(MAINBOARD_USE_LIBGFXINIT)) {
|
if (CONFIG(MAINBOARD_USE_LIBGFXINIT)) {
|
||||||
|
@ -660,8 +660,6 @@ static void gma_ngi(struct device *const dev)
|
|||||||
|
|
||||||
static void gma_func0_init(struct device *dev)
|
static void gma_func0_init(struct device *dev)
|
||||||
{
|
{
|
||||||
u32 reg32;
|
|
||||||
|
|
||||||
intel_gma_init_igd_opregion();
|
intel_gma_init_igd_opregion();
|
||||||
|
|
||||||
/* Unconditionally reset graphics */
|
/* Unconditionally reset graphics */
|
||||||
@ -672,9 +670,8 @@ static void gma_func0_init(struct device *dev)
|
|||||||
while (pci_read_config8(dev, GDRST) & 1)
|
while (pci_read_config8(dev, GDRST) & 1)
|
||||||
;
|
;
|
||||||
|
|
||||||
/* IGD needs to be Bus Master */
|
if (!CONFIG(NO_GFX_INIT))
|
||||||
reg32 = pci_read_config32(dev, PCI_COMMAND);
|
pci_or_config16(dev, PCI_COMMAND, PCI_COMMAND_MASTER);
|
||||||
pci_write_config32(dev, PCI_COMMAND, reg32 | PCI_COMMAND_MASTER);
|
|
||||||
|
|
||||||
if (CONFIG(MAINBOARD_DO_NATIVE_VGA_INIT)) {
|
if (CONFIG(MAINBOARD_DO_NATIVE_VGA_INIT)) {
|
||||||
int vga_disable = (pci_read_config16(dev, GGC) & 2) >> 1;
|
int vga_disable = (pci_read_config16(dev, GGC) & 2) >> 1;
|
||||||
@ -713,12 +710,10 @@ static void gma_func0_disable(struct device *dev)
|
|||||||
|
|
||||||
static void gma_func1_init(struct device *dev)
|
static void gma_func1_init(struct device *dev)
|
||||||
{
|
{
|
||||||
u32 reg32;
|
|
||||||
u8 val;
|
u8 val;
|
||||||
|
|
||||||
/* IGD needs to be Bus Master */
|
if (!CONFIG(NO_GFX_INIT))
|
||||||
reg32 = pci_read_config32(dev, PCI_COMMAND);
|
pci_or_config16(dev, PCI_COMMAND, PCI_COMMAND_MASTER);
|
||||||
pci_write_config32(dev, PCI_COMMAND, reg32 | PCI_COMMAND_MASTER);
|
|
||||||
|
|
||||||
if (get_option(&val, "tft_brightness") == CB_SUCCESS)
|
if (get_option(&val, "tft_brightness") == CB_SUCCESS)
|
||||||
pci_write_config8(dev, 0xf4, val);
|
pci_write_config8(dev, 0xf4, val);
|
||||||
|
@ -135,14 +135,10 @@ static void gma_enable_swsci(void)
|
|||||||
|
|
||||||
static void gma_func0_init(struct device *dev)
|
static void gma_func0_init(struct device *dev)
|
||||||
{
|
{
|
||||||
u32 reg32;
|
|
||||||
|
|
||||||
intel_gma_init_igd_opregion();
|
intel_gma_init_igd_opregion();
|
||||||
|
|
||||||
/* IGD needs to be Bus Master */
|
if (!CONFIG(NO_GFX_INIT))
|
||||||
reg32 = pci_read_config32(dev, PCI_COMMAND);
|
pci_or_config16(dev, PCI_COMMAND, PCI_COMMAND_MASTER);
|
||||||
reg32 |= PCI_COMMAND_MASTER;
|
|
||||||
pci_write_config32(dev, PCI_COMMAND, reg32);
|
|
||||||
|
|
||||||
gtt_res = find_resource(dev, PCI_BASE_ADDRESS_0);
|
gtt_res = find_resource(dev, PCI_BASE_ADDRESS_0);
|
||||||
if (!gtt_res || !gtt_res->base)
|
if (!gtt_res || !gtt_res->base)
|
||||||
|
@ -218,14 +218,10 @@ static void intel_gma_init(const struct northbridge_intel_pineview_config *info,
|
|||||||
|
|
||||||
static void gma_func0_init(struct device *dev)
|
static void gma_func0_init(struct device *dev)
|
||||||
{
|
{
|
||||||
u32 reg32;
|
|
||||||
|
|
||||||
intel_gma_init_igd_opregion();
|
intel_gma_init_igd_opregion();
|
||||||
|
|
||||||
/* IGD needs to be Bus Master */
|
if (!CONFIG(NO_GFX_INIT))
|
||||||
reg32 = pci_read_config32(dev, PCI_COMMAND);
|
pci_or_config16(dev, PCI_COMMAND, PCI_COMMAND_MASTER);
|
||||||
reg32 |= PCI_COMMAND_MASTER;
|
|
||||||
pci_write_config32(dev, PCI_COMMAND, reg32);
|
|
||||||
|
|
||||||
if (!CONFIG(MAINBOARD_DO_NATIVE_VGA_INIT)) {
|
if (!CONFIG(MAINBOARD_DO_NATIVE_VGA_INIT)) {
|
||||||
/* PCI init, will run VBIOS */
|
/* PCI init, will run VBIOS */
|
||||||
|
@ -585,18 +585,14 @@ static void gma_enable_swsci(void)
|
|||||||
|
|
||||||
static void gma_func0_init(struct device *dev)
|
static void gma_func0_init(struct device *dev)
|
||||||
{
|
{
|
||||||
u32 reg32;
|
|
||||||
|
|
||||||
intel_gma_init_igd_opregion();
|
intel_gma_init_igd_opregion();
|
||||||
|
|
||||||
/* IGD needs to be Bus Master */
|
|
||||||
reg32 = pci_read_config32(dev, PCI_COMMAND);
|
|
||||||
reg32 |= PCI_COMMAND_MASTER;
|
|
||||||
pci_write_config32(dev, PCI_COMMAND, reg32);
|
|
||||||
|
|
||||||
/* Init graphics power management */
|
/* Init graphics power management */
|
||||||
gma_pm_init_pre_vbios(dev);
|
gma_pm_init_pre_vbios(dev);
|
||||||
|
|
||||||
|
if (!CONFIG(NO_GFX_INIT))
|
||||||
|
pci_or_config16(dev, PCI_COMMAND, PCI_COMMAND_MASTER);
|
||||||
|
|
||||||
if (!CONFIG(MAINBOARD_USE_LIBGFXINIT))
|
if (!CONFIG(MAINBOARD_USE_LIBGFXINIT))
|
||||||
/* PCI Init, will run VBIOS */
|
/* PCI Init, will run VBIOS */
|
||||||
pci_dev_init(dev);
|
pci_dev_init(dev);
|
||||||
|
@ -22,14 +22,10 @@
|
|||||||
|
|
||||||
static void gma_func0_init(struct device *dev)
|
static void gma_func0_init(struct device *dev)
|
||||||
{
|
{
|
||||||
u32 reg32;
|
|
||||||
|
|
||||||
intel_gma_init_igd_opregion();
|
intel_gma_init_igd_opregion();
|
||||||
|
|
||||||
/* IGD needs to be Bus Master */
|
if (!CONFIG(NO_GFX_INIT))
|
||||||
reg32 = pci_read_config32(dev, PCI_COMMAND);
|
pci_or_config16(dev, PCI_COMMAND, PCI_COMMAND_MASTER);
|
||||||
reg32 |= PCI_COMMAND_MASTER;
|
|
||||||
pci_write_config32(dev, PCI_COMMAND, reg32);
|
|
||||||
|
|
||||||
/* configure GMBUSFREQ */
|
/* configure GMBUSFREQ */
|
||||||
pci_update_config16(dev, 0xcc, ~0x1ff, 0xbc);
|
pci_update_config16(dev, 0xcc, ~0x1ff, 0xbc);
|
||||||
|
@ -496,15 +496,13 @@ static void igd_init(struct device *dev)
|
|||||||
|
|
||||||
intel_gma_init_igd_opregion();
|
intel_gma_init_igd_opregion();
|
||||||
|
|
||||||
/* IGD needs to be Bus Master */
|
|
||||||
u32 reg32 = pci_read_config32(dev, PCI_COMMAND);
|
|
||||||
reg32 |= PCI_COMMAND_MASTER;
|
|
||||||
pci_write_config32(dev, PCI_COMMAND, reg32);
|
|
||||||
|
|
||||||
gtt_res = find_resource(dev, PCI_BASE_ADDRESS_0);
|
gtt_res = find_resource(dev, PCI_BASE_ADDRESS_0);
|
||||||
if (!gtt_res || !gtt_res->base)
|
if (!gtt_res || !gtt_res->base)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!CONFIG(NO_GFX_INIT))
|
||||||
|
pci_or_config16(dev, PCI_COMMAND, PCI_COMMAND_MASTER);
|
||||||
|
|
||||||
/* Wait for any configured pre-graphics delay */
|
/* Wait for any configured pre-graphics delay */
|
||||||
if (!acpi_is_wakeup_s3()) {
|
if (!acpi_is_wakeup_s3()) {
|
||||||
#if CONFIG(CHROMEOS)
|
#if CONFIG(CHROMEOS)
|
||||||
|
@ -45,10 +45,8 @@ static void gma_init(struct device *const dev)
|
|||||||
if (CONFIG(RUN_FSP_GOP))
|
if (CONFIG(RUN_FSP_GOP))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* IGD needs to Bus Master */
|
if (!CONFIG(NO_GFX_INIT))
|
||||||
u32 reg32 = pci_read_config32(dev, PCI_COMMAND);
|
pci_or_config16(dev, PCI_COMMAND, PCI_COMMAND_MASTER);
|
||||||
reg32 |= PCI_COMMAND_MASTER;
|
|
||||||
pci_write_config32(dev, PCI_COMMAND, reg32);
|
|
||||||
|
|
||||||
if (CONFIG(MAINBOARD_USE_LIBGFXINIT)) {
|
if (CONFIG(MAINBOARD_USE_LIBGFXINIT)) {
|
||||||
if (!acpi_is_wakeup_s3() && display_init_required()) {
|
if (!acpi_is_wakeup_s3() && display_init_required()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user