[PATCH] sticon/parisc: Detect default STI graphics card for console output

Helge Deller <[email protected]>
Newsgroups org.freedesktop.lists.dri-devel,org.kernel.vger.linux-fbdev
Message-ID <[email protected]>
From: Helge Deller <[email protected]>

If a machine has multiple graphic cards, detect that graphic card
which is used to display firmware messages and use that one as default
graphic card for sticon and fbcon.

On parisc machines the default graphic card used for BCH (boot console
handler, aka BIOS menu) is stored in the stable storage (equivalent to
CMOS storage on x86) or in the console path in page zero. Extract that
path and store it as default STI path for later comparism.

Signed-off-by: Helge Deller <[email protected]>
---
 drivers/video/sticore.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/video/sticore.c b/drivers/video/sticore.c
index 0d37e4b10447..4eac672a4713 100644
--- a/drivers/video/sticore.c
+++ b/drivers/video/sticore.c
@@ -1148,6 +1148,25 @@ static void sti_init_roms(void)
 	pr_info("STI GSC/PCI core graphics driver "
 			STI_DRIVERVERSION "\n");
 
+	/*
+	 * Find default console by hardware path which is either stored in
+	 * console entry in stable storage or alternatively from console path
+	 * in PAGE0 used by BCH and PDC.
+	 */
+	if (!default_sti_path[0]) {
+		struct pdc_module_path conspath;
+		struct device *dev = NULL;
+
+		if (pdc_stable_read(0x60, &conspath, sizeof(conspath)) == PDC_OK)
+			dev = hwpath_to_device(&conspath.path);
+		if (!dev)
+			dev = hwpath_to_device(&PAGE0->mem_cons.dp.path);
+		if (dev)
+			print_pa_hwpath(to_parisc_device(dev),
+					default_sti_path);
+		pr_debug("default graphic card: %s\n", default_sti_path);
+	}
+
 	/* Register drivers for native & PCI cards */
 	register_parisc_driver(&pa_sti_driver);
 	WARN_ON(pci_register_driver(&pci_sti_driver));
-- 
2.54.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.