Skip to contentSkip to conversation

x86: introduce pci_map_biosrom()

PATCH In review Dan Williams 1 participant 3 messages Mar 8, 2011 – Mar 16, 2011

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

PATCH 1/1 x86: introduce pci_map_biosrom()

The isci driver needs to retrieve its preboot orom image which contains necessary runtime parameters like platform specific sas addresses and phy configuration. There is no rom bar associated with this area, instead we need to scan legacy expansion rom space.

1/ Promote the probe_roms_32 implementation to x86-64
2/ Add a facility to find and map an adapter rom by pci device (according to
PCI Firmware Specification Revision 3.0)

---

Here is the updated rom scanning implementation as initially presented here [1]. Dave has been able to verify this implementation on his platform. This is modelled loosely on the interface provided by pci_map_rom().

--
Dan

[1]: http://marc.info/?l=linux-scsi&m=129862745115270&w=2

 arch/x86/include/asm/probe_roms.h |    8 +++
 arch/x86/include/asm/setup.h      |    3 +
 arch/x86/kernel/Makefile          |    2 -
 arch/x86/kernel/head32.c          |    1 
 arch/x86/kernel/probe_roms.c      |  101 +++++++++++++++++++++++++++++++++++++
 arch/x86/kernel/x86_init.c        |    2 -
 6 files changed, 113 insertions(+), 4 deletions(-)
 create mode 100644 arch/x86/include/asm/probe_roms.h
 rename arch/x86/kernel/{probe_roms_32.c => probe_roms.c} (65%)
arch/x86/include/asm/probe_roms.h new file +8 -0
new file mode 100644
index 0000000..4950a0b
@@ -0,0 +1,8 @@
+#ifndef _PROBE_ROMS_H_
+#define _PROBE_ROMS_H_
+struct pci_dev;
+
+extern void __iomem *pci_map_biosrom(struct pci_dev *pdev);
+extern void pci_unmap_biosrom(void __iomem *rom);
+extern size_t pci_biosrom_size(struct pci_dev *pdev);
+#endif
arch/x86/include/asm/setup.h +2 -1
index ef292c7..52edb6d 100644
@@ -93,10 +93,11 @@ void *extend_brk(size_t size, size_t align);
 			: : "i" (sz));					\
 	}
 
+extern void probe_roms(void);
+
 #ifdef __i386__
 
 void __init i386_start_kernel(void);
-extern void probe_roms(void);
 
 #else
 void __init x86_64_start_kernel(char *real_mode);
arch/x86/kernel/Makefile +1 -1
index fedf32a..f31ae9b 100644
@@ -36,7 +36,7 @@ obj-y			+= traps.o irq.o irq_$(BITS).o dumpstack_$(BITS).o
 obj-y			+= time.o ioport.o ldt.o dumpstack.o
 obj-y			+= setup.o x86_init.o i8259.o irqinit.o
 obj-$(CONFIG_X86_VISWS)	+= visws_quirks.o
-obj-$(CONFIG_X86_32)	+= probe_roms_32.o
+obj-y			+= probe_roms.o
 obj-$(CONFIG_X86_32)	+= sys_i386_32.o i386_ksyms_32.o
 obj-$(CONFIG_X86_64)	+= sys_x86_64.o x8664_ksyms_64.o
 obj-$(CONFIG_X86_64)	+= syscall_64.o vsyscall_64.o
arch/x86/kernel/head32.c +0 -1
index 784360c..e7605ed 100644
@@ -21,7 +21,6 @@
 static void __init i386_default_early_setup(void)
 {
 	/* Initialize 32bit specific setup functions */
-	x86_init.resources.probe_roms = probe_roms;
 	x86_init.resources.reserve_resources = i386_reserve_resources;
 	x86_init.mpparse.setup_ioapic_ids = setup_ioapic_ids_from_mpc;
 
arch/x86/kernel/probe_roms.c renamed from arch/x86/kernel/probe_roms_32.c +101 -0

107 lines not on this page · raw message

arch/x86/kernel/x86_init.c +1 -1
index cd6da6b..1bc104f 100644
@@ -33,7 +33,7 @@ void iommu_shutdown_noop(void) { }
 struct x86_init_ops x86_init __initdata = {
 
 	.resources = {
-		.probe_roms		= x86_init_noop,
+		.probe_roms		= probe_roms,
 		.reserve_resources	= reserve_standard_io_resources,
 		.memory_setup		= default_machine_specific_memory_setup,
 	},
#1 lore raw
Quoted 1 line

From 2d9dae6870bbed75a94bc3b7478da7418e2a4d6a Mon Sep 17 00:00:00 2001

From: Dan Williams <[email protected]>
Date: Mon, 14 Mar 2011 17:01:55 -0700
Subject: [PATCH v2] x86: introduce pci_map_biosrom()

The isci driver needs to retrieve its preboot orom image which contains necessary runtime parameters like platform specific sas addresses and phy configuration. There is no rom bar associated with this area, instead we need to scan legacy expansion rom space.

1/ Promote the probe_roms_32 implementation to x86-64
2/ Add a facility to find and map an adapter rom by pci device (according to
PCI Firmware Specification Revision 3.0)

---
Here is an updated version rebased on tip/master. Aside from fixing up the merge conflicts in Makefile and setup.h this is identical to the last release.

--
Dan

 arch/x86/include/asm/probe_roms.h                 |    8 ++
 arch/x86/include/asm/setup.h                      |    2 +-
 arch/x86/kernel/Makefile                          |    2 +-
 arch/x86/kernel/head32.c                          |    1 -
 arch/x86/kernel/{probe_roms_32.c => probe_roms.c} |  101 +++++++++++++++++++++
 arch/x86/kernel/x86_init.c                        |    2 +-
 6 files changed, 112 insertions(+), 4 deletions(-)
 create mode 100644 arch/x86/include/asm/probe_roms.h
 rename arch/x86/kernel/{probe_roms_32.c => probe_roms.c} (65%)
arch/x86/include/asm/probe_roms.h new file +8 -0
new file mode 100644
index 0000000..4950a0b
@@ -0,0 +1,8 @@
+#ifndef _PROBE_ROMS_H_
+#define _PROBE_ROMS_H_
+struct pci_dev;
+
+extern void __iomem *pci_map_biosrom(struct pci_dev *pdev);
+extern void pci_unmap_biosrom(void __iomem *rom);
+extern size_t pci_biosrom_size(struct pci_dev *pdev);
+#endif
arch/x86/include/asm/setup.h +1 -1
index db8aa19..03d3a32 100644
@@ -104,10 +104,10 @@ void *extend_brk(size_t size, size_t align);
 	type *name;					\
 	RESERVE_BRK(name, sizeof(type) * entries)
 
+extern void probe_roms(void);
 #ifdef __i386__
 
 void __init i386_start_kernel(void);
-extern void probe_roms(void);
 
 #else
 void __init x86_64_start_kernel(char *real_mode);
arch/x86/kernel/Makefile +1 -1
index 743642f..78eeffb 100644
@@ -36,7 +36,7 @@ obj-y			+= traps.o irq.o irq_$(BITS).o dumpstack_$(BITS).o
 obj-y			+= time.o ioport.o ldt.o dumpstack.o
 obj-y			+= setup.o x86_init.o i8259.o irqinit.o jump_label.o
 obj-$(CONFIG_IRQ_WORK)  += irq_work.o
-obj-$(CONFIG_X86_32)	+= probe_roms_32.o
+obj-y			+= probe_roms.o
 obj-$(CONFIG_X86_32)	+= sys_i386_32.o i386_ksyms_32.o
 obj-$(CONFIG_X86_64)	+= sys_x86_64.o x8664_ksyms_64.o
 obj-$(CONFIG_X86_64)	+= syscall_64.o vsyscall_64.o
arch/x86/kernel/head32.c +0 -1
index d6d6bb3..3bb0850 100644
@@ -23,7 +23,6 @@
 static void __init i386_default_early_setup(void)
 {
 	/* Initialize 32bit specific setup functions */
-	x86_init.resources.probe_roms = probe_roms;
 	x86_init.resources.reserve_resources = i386_reserve_resources;
 	x86_init.mpparse.setup_ioapic_ids = setup_ioapic_ids_from_mpc;
 
arch/x86/kernel/probe_roms.c renamed from arch/x86/kernel/probe_roms_32.c +101 -0

107 lines not on this page · raw message

arch/x86/kernel/x86_init.c +1 -1
index c11514e..6eee082 100644
@@ -35,7 +35,7 @@ void iommu_shutdown_noop(void) { }
 struct x86_init_ops x86_init __initdata = {
 
 	.resources = {
-		.probe_roms		= x86_init_noop,
+		.probe_roms		= probe_roms,
 		.reserve_resources	= reserve_standard_io_resources,
 		.memory_setup		= default_machine_specific_memory_setup,
 	},
Signature · 1 line
1.7.3.4
#2 lore raw

[tip:x86/platform] x86: Introduce pci_map_biosrom()

In reply to Dan Williams
Commit-ID:  5d94e81f69d4b1d1102d3ab557ce0a817c11fbbb
Gitweb:     http://git.kernel.org/tip/5d94e81f69d4b1d1102d3ab557ce0a817c11fbbb
Author:     Dan Williams <[email protected]>
AuthorDate: Tue, 8 Mar 2011 10:36:19 -0800
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Tue, 15 Mar 2011 15:34:15 -0700

x86: Introduce pci_map_biosrom()

The isci driver needs to retrieve its preboot OROM image which contains necessary runtime parameters like platform specific sas addresses and phy configuration. There is no ROM BAR associated with this area, instead we will need to scan legacy expansion ROM space.

1/ Promote the probe_roms_32 implementation to x86-64
2/ Add a facility to find and map an adapter rom by pci device (according to
PCI Firmware Specification Revision 3.0)

LKML-Reference: <[email protected]>

---
 arch/x86/include/asm/probe_roms.h |    8 +
 arch/x86/include/asm/setup.h      |    2 +-
 arch/x86/kernel/Makefile          |    2 +-
 arch/x86/kernel/head32.c          |    1 -
 arch/x86/kernel/probe_roms.c      |  267 +++++++++++++++++++++++++++++++++++++
 arch/x86/kernel/probe_roms_32.c   |  166 -----------------------
 arch/x86/kernel/x86_init.c        |    2 +-
 7 files changed, 278 insertions(+), 170 deletions(-)
arch/x86/include/asm/probe_roms.h new file +8 -0
new file mode 100644
index 0000000..4950a0b
@@ -0,0 +1,8 @@
+#ifndef _PROBE_ROMS_H_
+#define _PROBE_ROMS_H_
+struct pci_dev;
+
+extern void __iomem *pci_map_biosrom(struct pci_dev *pdev);
+extern void pci_unmap_biosrom(void __iomem *rom);
+extern size_t pci_biosrom_size(struct pci_dev *pdev);
+#endif
arch/x86/include/asm/setup.h +1 -1
index db8aa19..03d3a32 100644
@@ -104,10 +104,10 @@ void *extend_brk(size_t size, size_t align);
 	type *name;					\
 	RESERVE_BRK(name, sizeof(type) * entries)
 
+extern void probe_roms(void);
 #ifdef __i386__
 
 void __init i386_start_kernel(void);
-extern void probe_roms(void);
 
 #else
 void __init x86_64_start_kernel(char *real_mode);
arch/x86/kernel/Makefile +1 -1
index 62445ba..f33d738 100644
@@ -36,7 +36,7 @@ obj-y			+= traps.o irq.o irq_$(BITS).o dumpstack_$(BITS).o
 obj-y			+= time.o ioport.o ldt.o dumpstack.o
 obj-y			+= setup.o x86_init.o i8259.o irqinit.o jump_label.o
 obj-$(CONFIG_IRQ_WORK)  += irq_work.o
-obj-$(CONFIG_X86_32)	+= probe_roms_32.o
+obj-y			+= probe_roms.o
 obj-$(CONFIG_X86_32)	+= sys_i386_32.o i386_ksyms_32.o
 obj-$(CONFIG_X86_64)	+= sys_x86_64.o x8664_ksyms_64.o
 obj-$(CONFIG_X86_64)	+= syscall_64.o vsyscall_64.o
arch/x86/kernel/head32.c +0 -1
index 7f138b3..eab4940 100644
@@ -23,7 +23,6 @@
 static void __init i386_default_early_setup(void)
 {
 	/* Initialize 32bit specific setup functions */
-	x86_init.resources.probe_roms = probe_roms;
 	x86_init.resources.reserve_resources = i386_reserve_resources;
 	x86_init.mpparse.setup_ioapic_ids = setup_ioapic_ids_from_mpc;
 
arch/x86/kernel/probe_roms.c new file +267 -0

267 lines not on this page · raw message

arch/x86/kernel/probe_roms_32.c deleted +0 -166

166 lines not on this page · raw message

arch/x86/kernel/x86_init.c +1 -1
index c11514e..6eee082 100644
@@ -35,7 +35,7 @@ void iommu_shutdown_noop(void) { }
 struct x86_init_ops x86_init __initdata = {
 
 	.resources = {
-		.probe_roms		= x86_init_noop,
+		.probe_roms		= probe_roms,
 		.reserve_resources	= reserve_standard_io_resources,
 		.memory_setup		= default_machine_specific_memory_setup,
 	},