aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonrad Rzeszutek <ketuzsezr@darnok.org>2008-04-09 22:50:41 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2008-04-19 22:10:28 -0400
commit138fe4e069798d9aa948a5402ff15e58f483ee4e (patch)
tree413ab0c86618df7dba7724c1945fd46cd33298b9
parent95bc6a10830de469eee94c17fb1c37b3b1430715 (diff)
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>
-rw-r--r--Documentation/ABI/testing/sysfs-ibft23
-rw-r--r--arch/x86/kernel/setup_32.c3
-rw-r--r--arch/x86/kernel/setup_64.c4
-rw-r--r--drivers/firmware/Kconfig20
-rw-r--r--drivers/firmware/Makefile2
-rw-r--r--drivers/firmware/iscsi_ibft.c982
-rw-r--r--drivers/firmware/iscsi_ibft_find.c84
-rw-r--r--include/linux/iscsi_ibft.h50
8 files changed, 1168 insertions, 0 deletions
diff --git a/Documentation/ABI/testing/sysfs-ibft b/Documentation/ABI/testing/sysfs-ibft
new file mode 100644
index 000000000000..c2b7d1154bec
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-ibft
@@ -0,0 +1,23 @@
1What: /sys/firmware/ibft/initiator
2Date: November 2007
3Contact: Konrad Rzeszutek <ketuzsezr@darnok.org>
4Description: 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
8What: /sys/firmware/ibft/targetX
9Date: November 2007
10Contact: Konrad Rzeszutek <ketuzsezr@darnok.org>
11Description: 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
18What: /sys/firmware/ibft/ethernetX
19Date: November 2007
20Contact: Konrad Rzeszutek <ketuzsezr@darnok.org>
21Description: 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.
diff --git a/arch/x86/kernel/setup_32.c b/arch/x86/kernel/setup_32.c
index 5b0bffb7fcc9..4ef91749959e 100644
--- a/arch/x86/kernel/setup_32.c
+++ b/arch/x86/kernel/setup_32.c
@@ -39,6 +39,7 @@
39#include <linux/efi.h> 39#include <linux/efi.h>
40#include <linux/init.h> 40#include <linux/init.h>
41#include <linux/edd.h> 41#include <linux/edd.h>
42#include <linux/iscsi_ibft.h>
42#include <linux/nodemask.h> 43#include <linux/nodemask.h>
43#include <linux/kexec.h> 44#include <linux/kexec.h>
44#include <linux/crash_dump.h> 45#include <linux/crash_dump.h>
@@ -689,6 +690,8 @@ void __init setup_bootmem_allocator(void)
689#endif 690#endif
690 numa_kva_reserve(); 691 numa_kva_reserve();
691 reserve_crashkernel(); 692 reserve_crashkernel();
693
694 reserve_ibft_region();
692} 695}
693 696
694/* 697/*
diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c
index 674ef3510cdf..216c93bd9993 100644
--- a/arch/x86/kernel/setup_64.c
+++ b/arch/x86/kernel/setup_64.c
@@ -33,6 +33,7 @@
33#include <linux/acpi.h> 33#include <linux/acpi.h>
34#include <linux/kallsyms.h> 34#include <linux/kallsyms.h>
35#include <linux/edd.h> 35#include <linux/edd.h>
36#include <linux/iscsi_ibft.h>
36#include <linux/mmzone.h> 37#include <linux/mmzone.h>
37#include <linux/kexec.h> 38#include <linux/kexec.h>
38#include <linux/cpufreq.h> 39#include <linux/cpufreq.h>
@@ -434,6 +435,9 @@ void __init setup_arch(char **cmdline_p)
434 } 435 }
435#endif 436#endif
436 reserve_crashkernel(); 437 reserve_crashkernel();
438
439 reserve_ibft_region();
440
437 paging_init(); 441 paging_init();
438 map_vsyscall(); 442 map_vsyscall();
439 443
diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig
index 05f02a326f1c..40ffd767647d 100644
--- a/drivers/firmware/Kconfig
+++ b/drivers/firmware/Kconfig
@@ -93,4 +93,24 @@ config DMIID
93 information from userspace through /sys/class/dmi/id/ or if you want 93 information from userspace through /sys/class/dmi/id/ or if you want
94 DMI-based module auto-loading. 94 DMI-based module auto-loading.
95 95
96config 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
106config 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
96endmenu 116endmenu
diff --git a/drivers/firmware/Makefile b/drivers/firmware/Makefile
index 8d4ebc805a50..4c9147154df8 100644
--- a/drivers/firmware/Makefile
+++ b/drivers/firmware/Makefile
@@ -8,3 +8,5 @@ obj-$(CONFIG_EFI_PCDP) += pcdp.o
8obj-$(CONFIG_DELL_RBU) += dell_rbu.o 8obj-$(CONFIG_DELL_RBU) += dell_rbu.o
9obj-$(CONFIG_DCDBAS) += dcdbas.o 9obj-$(CONFIG_DCDBAS) += dcdbas.o
10obj-$(CONFIG_DMIID) += dmi-id.o 10obj-$(CONFIG_DMIID) += dmi-id.o
11obj-$(CONFIG_ISCSI_IBFT_FIND) += iscsi_ibft_find.o
12obj-$(CONFIG_ISCSI_IBFT) += iscsi_ibft.o
diff --git a/drivers/firmware/iscsi_ibft.c b/drivers/firmware/iscsi_ibft.c
new file mode 100644
index 000000000000..8024e3bfd877
--- /dev/null
+++ b/drivers/firmware/iscsi_ibft.c
@@ -0,0 +1,982 @@
1/*
2 * Copyright 2007 Red Hat, Inc.
3 * by Peter Jones <pjones@redhat.com>
4 * Copyright 2008 IBM, Inc.
5 * by Konrad Rzeszutek <konradr@linux.vnet.ibm.com>
6 * Copyright 2008
7 * by Konrad Rzeszutek <ketuzsezr@darnok.org>
8 *
9 * This code exposes the iSCSI Boot Format Table to userland via sysfs.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License v2.0 as published by
13 * the Free Software Foundation
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * Changelog:
21 *
22 * 14 Mar 2008 - Konrad Rzeszutek <ketuzsezr@darnok.org>
23 * Updated comments and copyrights. (v0.4.9)
24 *
25 * 11 Feb 2008 - Konrad Rzeszutek <konradr@linux.vnet.ibm.com>
26 * Converted to using ibft_addr. (v0.4.8)
27 *
28 * 8 Feb 2008 - Konrad Rzeszutek <konradr@linux.vnet.ibm.com>
29 * Combined two functions in one: reserve_ibft_region. (v0.4.7)
30 *
31 * 30 Jan 2008 - Konrad Rzeszutek <konradr@linux.vnet.ibm.com>
32 * Added logic to handle IPv6 addresses. (v0.4.6)
33 *
34 * 25 Jan 2008 - Konrad Rzeszutek <konradr@linux.vnet.ibm.com>
35 * Added logic to handle badly not-to-spec iBFT. (v0.4.5)
36 *
37 * 4 Jan 2008 - Konrad Rzeszutek <konradr@linux.vnet.ibm.com>
38 * Added __init to function declarations. (v0.4.4)
39 *
40 * 21 Dec 2007 - Konrad Rzeszutek <konradr@linux.vnet.ibm.com>
41 * Updated kobject registration, combined unregister functions in one
42 * and code and style cleanup. (v0.4.3)
43 *
44 * 5 Dec 2007 - Konrad Rzeszutek <konradr@linux.vnet.ibm.com>
45 * Added end-markers to enums and re-organized kobject registration. (v0.4.2)
46 *
47 * 4 Dec 2007 - Konrad Rzeszutek <konradr@linux.vnet.ibm.com>
48 * Created 'device' sysfs link to the NIC and style cleanup. (v0.4.1)
49 *
50 * 28 Nov 2007 - Konrad Rzeszutek <konradr@linux.vnet.ibm.com>
51 * Added sysfs-ibft documentation, moved 'find_ibft' function to
52 * in its own file and added text attributes for every struct field. (v0.4)
53 *
54 * 21 Nov 2007 - Konrad Rzeszutek <konradr@linux.vnet.ibm.com>
55 * Added text attributes emulating OpenFirmware /proc/device-tree naming.
56 * Removed binary /sysfs interface (v0.3)
57 *
58 * 29 Aug 2007 - Konrad Rzeszutek <konradr@linux.vnet.ibm.com>
59 * Added functionality in setup.c to reserve iBFT region. (v0.2)
60 *
61 * 27 Aug 2007 - Konrad Rzeszutek <konradr@linux.vnet.ibm.com>
62 * First version exposing iBFT data via a binary /sysfs. (v0.1)
63 *