Skip to content

Commit 024f5b5

Browse files
committed
parisc: Add qemu fw_cfg interface
When running on qemu, SeaBIOS-hppa stores the iomem address for the emulated fw_cfg port in PAGE0_>pad0[2/3]. Let the Linux driver auto-configure the fw_cfg interface with it, so that the fw_cfg info shows up in /sys/firmware/qemu_fw_cfg. Signed-off-by: Helge Deller <deller@gmx.de>
1 parent 6b69871 commit 024f5b5

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

‎arch/parisc/Kconfig‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,5 +376,6 @@ config KEXEC_FILE
376376

377377
endmenu
378378

379+
source "drivers/firmware/Kconfig"
379380

380381
source "drivers/parisc/Kconfig"

‎arch/parisc/kernel/inventory.c‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <linux/init.h>
2020
#include <linux/slab.h>
2121
#include <linux/mm.h>
22+
#include <linux/platform_device.h>
2223
#include <asm/hardware.h>
2324
#include <asm/io.h>
2425
#include <asm/mmzone.h>
@@ -641,4 +642,33 @@ void __init do_device_inventory(void)
641642
if (pa_serialize_tlb_flushes)
642643
pr_info("Merced bus found: Enable PxTLB serialization.\n");
643644
#endif
645+
646+
#if defined(CONFIG_FW_CFG_SYSFS)
647+
if (running_on_qemu) {
648+
struct resource res[3] = {0,};
649+
unsigned int base;
650+
651+
base = ((unsigned long long) PAGE0->pad0[2] << 32)
652+
| PAGE0->pad0[3]; /* SeaBIOS stored it here */
653+
654+
res[0].name = "fw_cfg";
655+
res[0].start = base;
656+
res[0].end = base + 8 - 1;
657+
res[0].flags = IORESOURCE_MEM;
658+
659+
res[1].name = "ctrl";
660+
res[1].start = 0;
661+
res[1].flags = IORESOURCE_REG;
662+
663+
res[2].name = "data";
664+
res[2].start = 4;
665+
res[2].flags = IORESOURCE_REG;
666+
667+
if (base) {
668+
pr_info("Found qemu fw_cfg interface at %#08x\n", base);
669+
platform_device_register_simple("fw_cfg",
670+
PLATFORM_DEVID_NONE, res, 3);
671+
}
672+
}
673+
#endif
644674
}

0 commit comments

Comments
 (0)