public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Bin Meng <bmeng.cn@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 4/6] dm: pci: Enable VGA address forwarding on bridges
Date: Thu,  1 Oct 2015 00:36:02 -0700	[thread overview]
Message-ID: <1443684964-342-5-git-send-email-bmeng.cn@gmail.com> (raw)
In-Reply-To: <1443684964-342-1-git-send-email-bmeng.cn@gmail.com>

To support graphics card behind a PCI bridge, the bridge control
register (offset 0x3e) in the configuration space must turn on
VGA address forwarding.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
---

 drivers/pci/pci-uclass.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
index 0035ac7..7b01a13 100644
--- a/drivers/pci/pci-uclass.c
+++ b/drivers/pci/pci-uclass.c
@@ -364,9 +364,23 @@ int dm_pci_read_config32(struct udevice *dev, int offset, u32 *valuep)
 	return 0;
 }
 
+static void set_vga_bridge_bits(struct udevice *dev)
+{
+	struct udevice *parent = dev->parent;
+	u16 bc;
+
+	while (parent->seq != 0) {
+		dm_pci_read_config16(parent, PCI_BRIDGE_CONTROL, &bc);
+		bc |= PCI_BRIDGE_CTL_VGA;
+		dm_pci_write_config16(parent, PCI_BRIDGE_CONTROL, bc);
+		parent = parent->parent;
+	}
+}
+
 int pci_auto_config_devices(struct udevice *bus)
 {
 	struct pci_controller *hose = bus->uclass_priv;
+	struct pci_child_platdata *pplat;
 	unsigned int sub_bus;
 	struct udevice *dev;
 	int ret;
@@ -382,6 +396,10 @@ int pci_auto_config_devices(struct udevice *bus)
 		debug("%s: device %s\n", __func__, dev->name);
 		max_bus = pciauto_config_device(hose, pci_get_bdf(dev));
 		sub_bus = max(sub_bus, max_bus);
+
+		pplat = dev_get_parent_platdata(dev);
+		if (pplat->class == (PCI_CLASS_DISPLAY_VGA << 8))
+			set_vga_bridge_bits(dev);
 	}
 	debug("%s: done\n", __func__);
 
-- 
1.8.2.1

  parent reply	other threads:[~2015-10-01  7:36 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-01  7:35 [U-Boot] [PATCH 0/6] x86: pci: Various bug fixes/enhancements Bin Meng
2015-10-01  7:35 ` [U-Boot] [PATCH 1/6] pci: Set PCI_COMMAND_IO bit for VGA device Bin Meng
2015-10-03 14:29   ` Simon Glass
2015-10-18 21:36     ` Simon Glass
2015-10-01  7:36 ` [U-Boot] [PATCH 2/6] video: vesa_fb: Fix wrong return value check of pci_find_class() Bin Meng
2015-10-03 14:29   ` Simon Glass
2015-10-07 18:40   ` Anatolij Gustschin
2015-10-18 21:36     ` Simon Glass
2015-10-01  7:36 ` [U-Boot] [PATCH 3/6] dm: pci: Fix pci_last_busno() to return the real last bus no Bin Meng
2015-10-03 14:29   ` Simon Glass
2015-10-18 21:36     ` Simon Glass
2015-10-01  7:36 ` Bin Meng [this message]
2015-10-03 14:29   ` [U-Boot] [PATCH 4/6] dm: pci: Enable VGA address forwarding on bridges Simon Glass
2015-10-18 21:36     ` Simon Glass
2015-10-01  7:36 ` [U-Boot] [PATCH 5/6] x86: ivybridge: Remove the dead codes that programs pci bridge Bin Meng
2015-10-03 14:29   ` Simon Glass
2015-10-18 21:37     ` Simon Glass
2015-10-01  7:36 ` [U-Boot] [PATCH 6/6] x86: Allow disabling IGD on Intel Queensbay Bin Meng
2015-10-03 14:29   ` Simon Glass
2015-10-07  8:24     ` Bin Meng
2015-10-09  9:36       ` Simon Glass
2015-10-18 21:37     ` Simon Glass

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=1443684964-342-5-git-send-email-bmeng.cn@gmail.com \
    --to=bmeng.cn@gmail.com \
    --cc=u-boot@lists.denx.de \
    /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