[coreboot-gerrit] Change in coreboot[master]: drivers/nvidia: Add PCI mapped option rom driver
Patrick Rudolph (Code Review)
gerrit at coreboot.org
Sat Nov 17 23:15:35 CET 2018
Patrick Rudolph has uploaded this change for review. ( https://review.coreboot.org/29676
Change subject: drivers/nvidia: Add PCI mapped option rom driver
......................................................................
drivers/nvidia: Add PCI mapped option rom driver
Map the Nvidia PCI ids for easy PCI option rom integration.
Change-Id: Idd85ed1fe9b5ffe4c9b7944d5360a2898dbb07f8
Signed-off-by: Patrick Rudolph <patrick.rudolph at 9elements.com>
---
M src/device/pci_rom.c
A src/drivers/nvidia/Kconfig
A src/drivers/nvidia/Makefile.inc
A src/drivers/nvidia/nvidia.c
M src/include/device/pci_rom.h
M src/mainboard/lenovo/t420/Kconfig
M src/mainboard/lenovo/t420s/Kconfig
M src/mainboard/lenovo/t430/Kconfig
M src/mainboard/lenovo/t520/Kconfig
M src/mainboard/lenovo/t530/Kconfig
10 files changed, 51 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/76/29676/1
diff --git a/src/device/pci_rom.c b/src/device/pci_rom.c
index 65989d4..ecbe340 100644
--- a/src/device/pci_rom.c
+++ b/src/device/pci_rom.c
@@ -30,6 +30,7 @@
/* Rmodules don't like weak symbols. */
u32 __weak map_oprom_vendev(u32 vendev) { return vendev; }
+u32 __weak map_oprom_vendev_nvidia(u32 vendev) { return vendev; }
struct rom_header *pci_rom_probe(struct device *dev)
{
@@ -43,6 +44,7 @@
u32 mapped_vendev;
mapped_vendev = map_oprom_vendev(vendev);
+ mapped_vendev = map_oprom_vendev_nvidia(mapped_vendev);
if (!rom_header) {
if (vendev != mapped_vendev) {
diff --git a/src/drivers/nvidia/Kconfig b/src/drivers/nvidia/Kconfig
new file mode 100644
index 0000000..7e49473
--- /dev/null
+++ b/src/drivers/nvidia/Kconfig
@@ -0,0 +1,4 @@
+config DRIVERS_NVIDIA
+ bool
+ help
+ Select this driver when using Nvidia graphics cards.
diff --git a/src/drivers/nvidia/Makefile.inc b/src/drivers/nvidia/Makefile.inc
new file mode 100644
index 0000000..59bb61b
--- /dev/null
+++ b/src/drivers/nvidia/Makefile.inc
@@ -0,0 +1 @@
+ramstage-$(CONFIG_DRIVERS_NVIDIA) += nvidia.c
diff --git a/src/drivers/nvidia/nvidia.c b/src/drivers/nvidia/nvidia.c
new file mode 100644
index 0000000..f43a18e
--- /dev/null
+++ b/src/drivers/nvidia/nvidia.c
@@ -0,0 +1,37 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2011 Chromium OS Authors
+ * Copyright (C) 2018 Patrick Rudolph <siro at das-labor.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <device/pci_rom.h>
+
+/**
+ * Some vga option roms are used for several chipsets but they only have one
+ * PCI ID in their header. If we encounter such an option rom, we need to do
+ * the mapping ourselves
+ */
+u32 map_oprom_vendev_nvidia(u32 vendev)
+{
+ u32 new_vendev = vendev;
+
+ switch (vendev) {
+ case 0x10de0ffb: /* Nvidia Quadro K2000M */
+ case 0x10de0ffc: /* Nvidia Quadro K1000M */
+ new_vendev = 0x10de0ffc; /* Nvidia Quadro K1000M */
+ break;
+ }
+
+ return new_vendev;
+}
+
diff --git a/src/include/device/pci_rom.h b/src/include/device/pci_rom.h
index a4aa52a..f84e888 100644
--- a/src/include/device/pci_rom.h
+++ b/src/include/device/pci_rom.h
@@ -46,5 +46,5 @@
void pci_rom_ssdt(struct device *device);
u32 map_oprom_vendev(u32 vendev);
-
+u32 map_oprom_vendev_nvidia(u32 vendev);
#endif
diff --git a/src/mainboard/lenovo/t420/Kconfig b/src/mainboard/lenovo/t420/Kconfig
index 41c0d37..52e1d9f 100644
--- a/src/mainboard/lenovo/t420/Kconfig
+++ b/src/mainboard/lenovo/t420/Kconfig
@@ -25,6 +25,7 @@
select GFX_GMA_INTERNAL_IS_LVDS
select DRIVERS_LENOVO_HYBRID_GRAPHICS
select INTEL_GMA_HAVE_VBT
+ select DRIVERS_NVIDIA
# Workaround for EC/KBC IRQ1.
select SERIRQ_CONTINUOUS_MODE
diff --git a/src/mainboard/lenovo/t420s/Kconfig b/src/mainboard/lenovo/t420s/Kconfig
index 8eb241a..753032a 100644
--- a/src/mainboard/lenovo/t420s/Kconfig
+++ b/src/mainboard/lenovo/t420s/Kconfig
@@ -21,6 +21,7 @@
select MAINBOARD_HAS_TPM1
select DRIVERS_LENOVO_HYBRID_GRAPHICS
select INTEL_GMA_HAVE_VBT
+ select DRIVERS_NVIDIA
# Workaround for EC/KBC IRQ1.
select SERIRQ_CONTINUOUS_MODE
diff --git a/src/mainboard/lenovo/t430/Kconfig b/src/mainboard/lenovo/t430/Kconfig
index 242412f..57d0614 100644
--- a/src/mainboard/lenovo/t430/Kconfig
+++ b/src/mainboard/lenovo/t430/Kconfig
@@ -26,6 +26,8 @@
select MAINBOARD_HAS_LIBGFXINIT
select GFX_GMA_INTERNAL_IS_LVDS
select INTEL_GMA_HAVE_VBT
+ select DRIVERS_NVIDIA
+
config MAINBOARD_DIR
string
diff --git a/src/mainboard/lenovo/t520/Kconfig b/src/mainboard/lenovo/t520/Kconfig
index 79455e2..80976db 100644
--- a/src/mainboard/lenovo/t520/Kconfig
+++ b/src/mainboard/lenovo/t520/Kconfig
@@ -20,6 +20,7 @@
select MAINBOARD_HAS_TPM1
select DRIVERS_LENOVO_HYBRID_GRAPHICS
select INTEL_GMA_HAVE_VBT if BOARD_LENOVO_T520
+ select DRIVERS_NVIDIA
# Workaround for EC/KBC IRQ1.
select SERIRQ_CONTINUOUS_MODE
diff --git a/src/mainboard/lenovo/t530/Kconfig b/src/mainboard/lenovo/t530/Kconfig
index d107504..e394fd0 100644
--- a/src/mainboard/lenovo/t530/Kconfig
+++ b/src/mainboard/lenovo/t530/Kconfig
@@ -22,6 +22,7 @@
select MAINBOARD_HAS_LIBGFXINIT
select GFX_GMA_INTERNAL_IS_LVDS
select INTEL_GMA_HAVE_VBT
+ select DRIVERS_NVIDIA
# Workaround for EC/KBC IRQ1.
select SERIRQ_CONTINUOUS_MODE
--
To view, visit https://review.coreboot.org/29676
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Idd85ed1fe9b5ffe4c9b7944d5360a2898dbb07f8
Gerrit-Change-Number: 29676
Gerrit-PatchSet: 1
Gerrit-Owner: Patrick Rudolph <patrick.rudolph at 9elements.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20181117/71083785/attachment.html>
More information about the coreboot-gerrit
mailing list