Jonathan Kollasch has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/42683 )
Change subject: pciexp: retrain PCIe link at lower speed if no link
......................................................................
pciexp: retrain PCIe link at lower speed if no link
Needed for PCIe x4 dual-port Marvell NIC (sky2) on Sandy/Ivy Bridge
and 6-series PCH (if not other chipsets), where the link will not come
up at 5GT/s (or 8GT/s?), but will if explicitly trained at 2.5GT/s.
Change-Id: I7ba15f7c13463356c6417f41b44d045aacfde4cc
---
M src/device/pciexp_device.c
M src/include/device/pci_def.h
2 files changed, 41 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/83/42683/1
diff --git a/src/device/pciexp_device.c b/src/device/pciexp_device.c
index f04d865..aeb44f7 100644
--- a/src/device/pciexp_device.c
+++ b/src/device/pciexp_device.c
@@ -112,6 +112,38 @@
}
}
+static void pciexp_limit_speed(struct device *dev, unsigned int cap)
+{
+ u16 x, y;
+
+ x = pci_read_config16(dev, cap + PCI_EXP_FLAGS);
+
+ /* is this new enough to support LNKCTL2? */
+ if ((x & PCI_EXP_FLAGS_VERS) <= 1)
+ return;
+
+ y = pci_read_config16(dev, cap + PCI_EXP_LNKCTL2);
+ y &= PCI_EXP_LNKCTL2_TLS;
+
+ do {
+ /* link up? */
+ x = pci_read_config16(dev, cap + PCI_EXP_LNKSTA);
+ x = (x & PCI_EXP_LNKSTA_LW) >> 4;
+ if (x > 0)
+ return;
+
+ printk(BIOS_INFO, "%s: link down; retraining at target link speed %u\n",
+ dev_path(dev), y);
+
+ x = pci_read_config16(dev, cap + PCI_EXP_LNKCTL2);
+ x &= ~PCI_EXP_LNKCTL2_TLS;
+ x |= y & PCI_EXP_LNKCTL2_TLS;
+ pci_write_config16(dev, cap + PCI_EXP_LNKCTL2, x);
+
+ pciexp_retrain_link(dev, cap);
+ } while (--y > 0);
+}
+
static void pciexp_enable_clock_power_pm(struct device *endp, unsigned int endp_cap)
{
/* check if per port clk req is supported in device */
@@ -488,6 +520,12 @@
void pciexp_scan_bridge(struct device *dev)
{
+ unsigned int cap;
+
+ cap = pci_find_capability(dev, PCI_CAP_ID_PCIE);
+ if (cap)
+ pciexp_limit_speed(dev, cap);
+
do_pci_scan_bridge(dev, pciexp_scan_bus);
pciexp_enable_ltr(dev);
}
diff --git a/src/include/device/pci_def.h b/src/include/device/pci_def.h
index 07ba4a2..b351e42 100644
--- a/src/include/device/pci_def.h
+++ b/src/include/device/pci_def.h
@@ -432,6 +432,7 @@
#define PCI_EXP_LNKCTL_CCC 0x40 /* Common Clock COnfiguration */
#define PCI_EXP_EN_CLK_PM 0x100 /* Enable Clock Power Management */
#define PCI_EXP_LNKSTA 18 /* Link Status */
+#define PCI_EXP_LNKSTA_LW 0x3F0 /* Link Width */
#define PCI_EXP_LNKSTA_LT 0x800 /* Link Training */
#define PCI_EXP_LNKSTA_SLC 0x1000 /* Slot Clock Configuration */
#define PCI_EXP_SLTCAP 20 /* Slot Capabilities */
@@ -446,6 +447,8 @@
#define PCI_EXP_RTCTL_CRSSVE 0x10 /* CRS Software Visibility Enable */
#define PCI_EXP_RTCAP 30 /* Root Capabilities */
#define PCI_EXP_RTSTA 32 /* Root Status */
+#define PCI_EXP_LNKCTL2 48 /* Link Control 2 */
+#define PCI_EXP_LNKCTL2_TLS 0x000f /* Target Link Speed */
/* Extended Capabilities (PCI-X 2.0 and Express) */
#define PCI_EXT_CAP_ID(header) (header & 0x0000ffff)
--
To view, visit https://review.coreboot.org/c/coreboot/+/42683
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I7ba15f7c13463356c6417f41b44d045aacfde4cc
Gerrit-Change-Number: 42683
Gerrit-PatchSet: 1
Gerrit-Owner: Jonathan Kollasch <jakllsch(a)kollasch.net>
Gerrit-MessageType: newchange
Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/30470
Change subject: mb/intel/dg41wv: Inherit the subsystemid
......................................................................
mb/intel/dg41wv: Inherit the subsystemid
Don't reprogram the same subsystemid for each PCI device.
Change-Id: Ieaeef728e200bfa826c4ae25de3e8532c493c877
Signed-off-by: Arthur Heymans <arthur(a)aheymans.xyz>
---
M src/mainboard/intel/dg41wv/devicetree.cb
1 file changed, 23 insertions(+), 46 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/70/30470/1
diff --git a/src/mainboard/intel/dg41wv/devicetree.cb b/src/mainboard/intel/dg41wv/devicetree.cb
index d96ad95..da91ea2 100644
--- a/src/mainboard/intel/dg41wv/devicetree.cb
+++ b/src/mainboard/intel/dg41wv/devicetree.cb
@@ -24,14 +24,10 @@
end
end
device domain 0 on # PCI domain
- subsystemid 0x1458 0x5000 inherit
- device pci 0.0 on # Host Bridge
- subsystemid 0x8086 0x5756
- end
+ subsystemid 0x8086 0x5756 inherit
+ device pci 0.0 on end # Host Bridge
device pci 1.0 on end # PEG
- device pci 2.0 on # Integrated graphics controller
- subsystemid 0x8086 0x5756
- end
+ device pci 2.0 on end # Integrated graphics controller
chip southbridge/intel/i82801gx # Southbridge
register "pirqa_routing" = "0x0b"
register "pirqb_routing" = "0x0b"
@@ -66,39 +62,24 @@
register "sata_ahci" = "0x0" # AHCI not supported on this ICH7 variant
register "gpe0_en" = "0x440"
- device pci 1b.0 on # Audio
- subsystemid 0x8086 0x5756
+ device pci 1b.0 on end # Audio
+ device pci 1c.0 on end # PCIe 1
+ device pci 1c.1 on # PCIe 2: NIC
+ device pci 00.0 on end
end
- device pci 1c.0 on end # PCIe 1
- device pci 1c.1 on # PCIe 2: NIC
- device pci 00.0 on
- subsystemid 0x8086 0x5756
- end
- end
- device pci 1c.2 off end # PCIe 3
- device pci 1c.3 off end # PCIe 4
- device pci 1c.4 off end # PCIe 5
- device pci 1c.5 off end # PCIe 6
- device pci 1d.0 on # USB
- subsystemid 0x8086 0x5756
- end
- device pci 1d.1 on # USB
- subsystemid 0x8086 0x5756
- end
- device pci 1d.2 on # USB
- subsystemid 0x8086 0x5756
- end
- device pci 1d.3 on # USB
- subsystemid 0x8086 0x5756
- end
- device pci 1d.7 on # USB
- subsystemid 0x8086 0x5756
- end
- device pci 1e.0 on end # PCI bridge
- device pci 1e.2 off end # AC'97 Audio Controller
- device pci 1e.3 off end # AC'97 Modem Controller
- device pci 1f.0 on # ISA bridge
- subsystemid 0x8086 0x5756
+ device pci 1c.2 off end # PCIe 3
+ device pci 1c.3 off end # PCIe 4
+ device pci 1c.4 off end # PCIe 5
+ device pci 1c.5 off end # PCIe 6
+ device pci 1d.0 on end # USB
+ device pci 1d.1 on end # USB
+ device pci 1d.2 on end # USB
+ device pci 1d.3 on end # USB
+ device pci 1d.7 on end # USB
+ device pci 1e.0 on end # PCI bridge
+ device pci 1e.2 off end # AC'97 Audio Controller
+ device pci 1e.3 off end # AC'97 Modem Controller
+ device pci 1f.0 on # ISA bridge
chip superio/winbond/w83627dhg
device pnp 2e.0 on # Floppy
# global
@@ -155,12 +136,9 @@
end
end
device pci 1f.1 off end # PATA/IDE
- device pci 1f.2 on # SATA
- subsystemid 0x8086 0x5756
- end
- device pci 1f.3 on # SMbus
- subsystemid 0x8086 0x5756
- chip drivers/i2c/ck505
+ device pci 1f.2 on end # SATA
+ device pci 1f.3 on # SMbus
+ chip drivers/i2c/ck505
register "mask" = "{ 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff,
@@ -173,7 +151,6 @@
0x06, 0x00, 0xea }"
device i2c 69 on end
end
-
end
end
end
--
To view, visit https://review.coreboot.org/c/coreboot/+/30470
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Ieaeef728e200bfa826c4ae25de3e8532c493c877
Gerrit-Change-Number: 30470
Gerrit-PatchSet: 1
Gerrit-Owner: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-MessageType: newchange