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

If a machine has multiple graphic cards, detect the graphic card which is used
to display firmware messages and use that one as the 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. Take care that the graphic
card can be a GSC or a PCI card which use different path strings.

Increase max string size for default_sti_path to 32 chars as the
print_pa_hwpath() function formats a hardware path using unbounded sprintf
calls for up to 6 bus converter components and 1 module component (e.g.,
255/255/...), which can produce a string up to 28 bytes long.

Signed-off-by: Helge Deller <deller@gmx.de>
Cc: stable@vger.kernel.org
This commit is contained in:
Helge Deller
2026-08-06 17:04:15 +02:00
parent 9ad709afdf
commit de508ece1d

View File

@@ -325,7 +325,7 @@ static void sti_rom_copy(unsigned long base, unsigned long count, void *dest)
static char default_sti_path[21] __read_mostly;
static char default_sti_path[32] __read_mostly;
#ifndef MODULE
static int __init sti_setup(char *str)
@@ -1148,6 +1148,26 @@ 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 && dev_is_pci(dev))
print_pci_hwpath(to_pci_dev(dev), default_sti_path);
else if (dev && !dev_is_pci(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));