Skip to content

Commit 138fe4e

Browse files
konradwilkgregkh
authored andcommitted
Firmware: add iSCSI iBFT Support
Add /sysfs/firmware/ibft/[initiator|targetX|ethernetX] directories along with text properties which export the the iSCSI Boot Firmware Table (iBFT) structure. What is iSCSI Boot Firmware Table? It is a mechanism for the iSCSI tools to extract from the machine NICs the iSCSI connection information so that they can automagically mount the iSCSI share/target. Currently the iSCSI information is hard-coded in the initrd. The /sysfs entries are read-only one-name-and-value fields. The usual set of data exposed is: # for a in `find /sys/firmware/ibft/ -type f -print`; do echo -n "$a: "; cat $a; done /sys/firmware/ibft/target0/target-name: iqn.2007.com.intel-sbx44:storage-10gb /sys/firmware/ibft/target0/nic-assoc: 0 /sys/firmware/ibft/target0/chap-type: 0 /sys/firmware/ibft/target0/lun: 00000000 /sys/firmware/ibft/target0/port: 3260 /sys/firmware/ibft/target0/ip-addr: 192.168.79.116 /sys/firmware/ibft/target0/flags: 3 /sys/firmware/ibft/target0/index: 0 /sys/firmware/ibft/ethernet0/mac: 00:11:25:9d:8b:01 /sys/firmware/ibft/ethernet0/vlan: 0 /sys/firmware/ibft/ethernet0/gateway: 192.168.79.254 /sys/firmware/ibft/ethernet0/origin: 0 /sys/firmware/ibft/ethernet0/subnet-mask: 255.255.252.0 /sys/firmware/ibft/ethernet0/ip-addr: 192.168.77.41 /sys/firmware/ibft/ethernet0/flags: 7 /sys/firmware/ibft/ethernet0/index: 0 /sys/firmware/ibft/initiator/initiator-name: iqn.2007-07.com:konrad.initiator /sys/firmware/ibft/initiator/flags: 3 /sys/firmware/ibft/initiator/index: 0 For full details of the IBFT structure please take a look at: ftp://ftp.software.ibm.com/systems/support/system_x_pdf/ibm_iscsi_boot_firmware_table_v1.02.pdf [akpm@linux-foundation.org: fix build] Signed-off-by: Konrad Rzeszutek <konradr@linux.vnet.ibm.com> Cc: Mike Christie <michaelc@cs.wisc.edu> Cc: Peter Jones <pjones@redhat.com> Cc: James Bottomley <James.Bottomley@HansenPartnership.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1 parent 95bc6a1 commit 138fe4e

8 files changed

Lines changed: 1168 additions & 0 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
What: /sys/firmware/ibft/initiator
2+
Date: November 2007
3+
Contact: Konrad Rzeszutek <ketuzsezr@darnok.org>
4+
Description: The /sys/firmware/ibft/initiator directory will contain
5+
files that expose the iSCSI Boot Firmware Table initiator data.
6+
Usually this contains the Initiator name.
7+
8+
What: /sys/firmware/ibft/targetX
9+
Date: November 2007
10+
Contact: Konrad Rzeszutek <ketuzsezr@darnok.org>
11+
Description: The /sys/firmware/ibft/targetX directory will contain
12+
files that expose the iSCSI Boot Firmware Table target data.
13+
Usually this contains the target's IP address, boot LUN,
14+
target name, and what NIC it is associated with. It can also
15+
contain the CHAP name (and password), the reverse CHAP
16+
name (and password)
17+
18+
What: /sys/firmware/ibft/ethernetX
19+
Date: November 2007
20+
Contact: Konrad Rzeszutek <ketuzsezr@darnok.org>
21+
Description: The /sys/firmware/ibft/ethernetX directory will contain
22+
files that expose the iSCSI Boot Firmware Table NIC data.
23+
This can this can the IP address, MAC, and gateway of the NIC.

‎arch/x86/kernel/setup_32.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#include <linux/efi.h>
4040
#include <linux/init.h>
4141
#include <linux/edd.h>
42+
#include <linux/iscsi_ibft.h>
4243
#include <linux/nodemask.h>
4344
#include <linux/kexec.h>
4445
#include <linux/crash_dump.h>
@@ -689,6 +690,8 @@ void __init setup_bootmem_allocator(void)
689690
#endif
690691
numa_kva_reserve();
691692
reserve_crashkernel();
693+
694+
reserve_ibft_region();
692695
}
693696

694697
/*

‎arch/x86/kernel/setup_64.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include <linux/acpi.h>
3434
#include <linux/kallsyms.h>
3535
#include <linux/edd.h>
36+
#include <linux/iscsi_ibft.h>
3637
#include <linux/mmzone.h>
3738
#include <linux/kexec.h>
3839
#include <linux/cpufreq.h>
@@ -434,6 +435,9 @@ void __init setup_arch(char **cmdline_p)
434435
}
435436
#endif
436437
reserve_crashkernel();
438+
439+
reserve_ibft_region();
440+
437441
paging_init();
438442
map_vsyscall();
439443

‎drivers/firmware/Kconfig‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,24 @@ config DMIID
9393
information from userspace through /sys/class/dmi/id/ or if you want
9494
DMI-based module auto-loading.
9595

96+
config ISCSI_IBFT_FIND
97+
bool "iSCSI Boot Firmware Table Attributes"
98+
depends on X86
99+
default n
100+
help
101+
This option enables the kernel to find the region of memory
102+
in which the ISCSI Boot Firmware Table (iBFT) resides. This
103+
is necessary for iSCSI Boot Firmware Table Attributes module to work
104+
properly.
105+
106+
config ISCSI_IBFT
107+
tristate "iSCSI Boot Firmware Table Attributes module"
108+
depends on ISCSI_IBFT_FIND
109+
default n
110+
help
111+
This option enables support for detection and exposing of iSCSI
112+
Boot Firmware Table (iBFT) via sysfs to userspace. If you wish to
113+
detect iSCSI boot parameters dynamically during system boot, say Y.
114+
Otherwise, say N.
115+
96116
endmenu

‎drivers/firmware/Makefile‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ obj-$(CONFIG_EFI_PCDP) += pcdp.o
88
obj-$(CONFIG_DELL_RBU) += dell_rbu.o
99
obj-$(CONFIG_DCDBAS) += dcdbas.o
1010
obj-$(CONFIG_DMIID) += dmi-id.o
11+
obj-$(CONFIG_ISCSI_IBFT_FIND) += iscsi_ibft_find.o
12+
obj-$(CONFIG_ISCSI_IBFT) += iscsi_ibft.o

0 commit comments

Comments
 (0)