Skip to contentSkip to conversation

ARM: expose PB1176 ROM in debugfs

PATCH New Linus Walleij 4 participants 5 messages Jul 7, 2010 – Sep 4, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: expose PB1176 ROM in debugfs

This exposes the PB1176 ROM as a simple 16KiB file in debugfs so that it can be copied out and disassembled with some objcopy+objdump massage for example. I used this to find out how the ROM handled the CharLCD.

---
 arch/arm/mach-realview/include/mach/board-pb1176.h |    1 +
 arch/arm/mach-realview/realview_pb1176.c           |   31 ++++++++++++++++++++
 2 files changed, 32 insertions(+), 0 deletions(-)
arch/arm/mach-realview/include/mach/board-pb1176.h +1 -0
index 2f5ccb2..9f627d4 100644
@@ -69,6 +69,7 @@
 
 #define REALVIEW_DC1176_GIC_CPU_BASE		0x10120000 /* GIC CPU interface, on devchip */
 #define REALVIEW_DC1176_GIC_DIST_BASE		0x10121000 /* GIC distributor, on devchip */
+#define REALVIEW_DC1176_ROM_BASE		0x10200000 /* 16KiB NRAM preudo-ROM, on devchip */
 #define REALVIEW_PB1176_GIC_CPU_BASE		0x10040000 /* GIC CPU interface, on FPGA */
 #define REALVIEW_PB1176_GIC_DIST_BASE		0x10041000 /* GIC distributor, on FPGA */
 #define REALVIEW_PB1176_L220_BASE		0x10110000 /* L220 registers */
arch/arm/mach-realview/realview_pb1176.c +31 -0
index 099a1f1..cfdfd75 100644
@@ -26,6 +26,7 @@
 #include <linux/amba/pl061.h>
 #include <linux/amba/mmci.h>
 #include <linux/io.h>
+#include <linux/debugfs.h>
 
 #include <mach/hardware.h>
 #include <asm/irq.h>
@@ -323,6 +324,36 @@ static void realview_pb1176_fixup(struct machine_desc *mdesc,
 	meminfo->nr_banks = 1;
 }
 
+#ifdef CONFIG_DEBUG_FS
+/*
+ * This exposes the PB1176 DevChip ROM as a simple file in debugfs
+ * The reference manual states that this is actually a pseudo-ROM
+ * programmed in NVRAM.
+ */
+static struct debugfs_blob_wrapper devchip_rom_blob;
+
+static int __init pb1176_export_rom(void)
+{
+	void __iomem *virtbase;
+	struct dentry *d;
+
+	virtbase = ioremap(REALVIEW_DC1176_ROM_BASE, SZ_16K);
+	if (!virtbase)
+		return -EIO;
+	devchip_rom_blob.data = virtbase;
+	devchip_rom_blob.size = SZ_16K;
+	d = debugfs_create_blob("pb1176-DevChip-ROM",
+				S_IFREG | S_IRUSR,
+				NULL, &devchip_rom_blob);
+	if (!d)
+		return -EIO;
+
+	return 0;
+}
+
+device_initcall(pb1176_export_rom);
+#endif
+
 static void __init realview_pb1176_init(void)
 {
 	int i;
Signature · 1 line
1.7.1
#1 lore raw

PATCH 1/1 ARM: expose PB1176 ROM in debugfs

Quoted 4 lines · Linus Walleij

This exposes the PB1176 ROM as a simple 16KiB file in debugfs so that it can be copied out and disassembled with some objcopy+objdump massage for example. I used this to find out how the ROM handled the CharLCD.

Would it be better to expose this through a mtd ROM mapping (map_rom) ?

#2 lore raw

PATCH 1/1 ARM: expose PB1176 ROM in debugfs

2010/7/18 Russell King - ARM Linux <[email protected]>:

Quoted 7 lines · Linus Walleij
Quoted 4 lines

This exposes the PB1176 ROM as a simple 16KiB file in debugfs so that it can be copied out and disassembled with some objcopy+objdump massage for example. I used this to find out how the ROM handled the CharLCD.

Would it be better to expose this through a mtd ROM mapping (map_rom) ?

This is more convenient I think.

I don't know the actual purpose of MTD ROM mappings, so paging David on this.

It has the small upside of only getting compiled in if you select CONFIG_DEBUG_FS, and getting a distinct name in debugfs rather than /dev/mtdN.

Also I can now cp /debugfs/pb1176-ROM foo.bin
Is this possible with mtdblocks or do you have to dd if=... ?

Yours,
Linus Walleij

#3 lore raw

PATCH 1/1 ARM: expose PB1176 ROM in debugfs

Ping on this David, you have an opinion? debugfs ROM or MTD ROM mapping?

Yours,
Linus Walleij

2010/7/18 Linus Walleij <[email protected]>:

Quoted 25 lines

2010/7/18 Russell King - ARM Linux <[email protected]>:

Quoted 7 lines · Linus Walleij
Quoted 4 lines

This exposes the PB1176 ROM as a simple 16KiB file in debugfs so that it can be copied out and disassembled with some objcopy+objdump massage for example. I used this to find out how the ROM handled the CharLCD.

Would it be better to expose this through a mtd ROM mapping (map_rom) ?

This is more convenient I think.

I don't know the actual purpose of MTD ROM mappings, so paging David on this.

It has the small upside of only getting compiled in if you select CONFIG_DEBUG_FS, and getting a distinct name in debugfs rather than /dev/mtdN.

Also I can now cp /debugfs/pb1176-ROM foo.bin
Is this possible with mtdblocks or do you have to dd if=... ?

Yours,
Linus Walleij

#4 lore raw

PATCH 1/1 ARM: expose PB1176 ROM in debugfs

Dne P? 3. z??? 2010 23:38:54 Linus Walleij napsal(a):

Quoted 2 lines

Ping on this David, you have an opinion? debugfs ROM or MTD ROM mapping?

Hey, I'd be for having this exposed through mtd_rom too. Cheers

Quoted 33 lines

Yours,
Linus Walleij

2010/7/18 Linus Walleij <[email protected]>:

Quoted 18 lines

2010/7/18 Russell King - ARM Linux <[email protected]>:

Quoted 7 lines · Linus Walleij
Quoted 4 lines

This exposes the PB1176 ROM as a simple 16KiB file in debugfs so that it can be copied out and disassembled with some objcopy+objdump massage for example. I used this to find out how the ROM handled the CharLCD.

Would it be better to expose this through a mtd ROM mapping (map_rom) ?

This is more convenient I think.

I don't know the actual purpose of MTD ROM mappings, so paging David on this.

It has the small upside of only getting compiled in if you select CONFIG_DEBUG_FS, and getting a distinct name in debugfs rather than /dev/mtdN.

Quoted 5 lines

Also I can now cp /debugfs/pb1176-ROM foo.bin
Is this possible with mtdblocks or do you have to dd if=... ?

Yours,
Linus Walleij

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel