aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firmware/iscsi_ibft_find.c
diff options
context:
space:
mode:
authorMike Christie <michaelc@cs.wisc.edu>2011-04-14 23:50:57 -0400
committerKonrad Rzeszutek Wilk <konrad@kernel.org>2011-04-14 23:53:09 -0400
commit140363500ddadad0c09cb512cc0c96a4d3efa053 (patch)
tree00c392b4c2082bc3420bcde31f4ed91792e90c58 /drivers/firmware/iscsi_ibft_find.c
parent3c0eee3fe6a3a1c745379547c7e7c904aa64f6d5 (diff)
iscsi_ibft: search for broadcom specific ibft sign (v2)
Broadcom iscsi offload firmware uses a non standard ibft sign of "BIFT". When we added support for boot, the anaconda team and I were using older firmware (I guess 4 years old), so boot does not work on current cards. This patch modifies the ibft search code to search for "BIFT" along with the other possible values. Broadcom has tested the patch and reported it works with their firmware. Mike has tested Chelsio and Intel cards. [v2: - Add ACPI_SIG_IBFT to ibft_signs - replace break with goto in find_ibft_in_mem innner loop.] Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: Peter Jones <pjones@redhat.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad@kernel.org>
Diffstat (limited to 'drivers/firmware/iscsi_ibft_find.c')
-rw-r--r--drivers/firmware/iscsi_ibft_find.c51
1 files changed, 32 insertions, 19 deletions
diff --git a/drivers/firmware/iscsi_ibft_find.c b/drivers/firmware/iscsi_ibft_find.c
index 2192456dfd68..f032e446fc11 100644
--- a/drivers/firmware/iscsi_ibft_find.c
+++ b/drivers/firmware/iscsi_ibft_find.c
@@ -42,7 +42,20 @@
42struct acpi_table_ibft *ibft_addr; 42struct acpi_table_ibft *ibft_addr;
43EXPORT_SYMBOL_GPL(ibft_addr); 43EXPORT_SYMBOL_GPL(ibft_addr);
44 44
45#define IBFT_SIGN "iBFT" 45static const struct {
46 char *sign;
47} ibft_signs[] = {
48#ifdef CONFIG_ACPI
49 /*
50 * One spec says "IBFT", the other says "iBFT". We have to check
51 * for both.
52 */
53 { ACPI_SIG_IBFT },
54#endif
55 { "iBFT" },
56 { "BIFT" }, /* Broadcom iSCSI Offload */
57};
58
46#define IBFT_SIGN_LEN 4 59#define IBFT_SIGN_LEN 4
47#define IBFT_START 0x80000 /* 512kB */ 60#define IBFT_START 0x80000 /* 512kB */
48#define IBFT_END 0x100000 /* 1MB */ 61#define IBFT_END 0x100000 /* 1MB */
@@ -62,6 +75,7 @@ static int __init find_ibft_in_mem(void)
62 unsigned long pos; 75 unsigned long pos;
63 unsigned int len = 0; 76 unsigned int len = 0;
64 void *virt; 77 void *virt;
78 int i;
65 79
66 for (pos = IBFT_START; pos < IBFT_END; pos += 16) { 80 for (pos = IBFT_START; pos < IBFT_END; pos += 16) {
67 /* The table can't be inside the VGA BIOS reserved space, 81 /* The table can't be inside the VGA BIOS reserved space,
@@ -69,18 +83,23 @@ static int __init find_ibft_in_mem(void)
69 if (pos == VGA_MEM) 83 if (pos == VGA_MEM)
70 pos += VGA_SIZE; 84 pos += VGA_SIZE;
71 virt = isa_bus_to_virt(pos); 85 virt = isa_bus_to_virt(pos);
72 if (memcmp(virt, IBFT_SIGN, IBFT_SIGN_LEN) == 0) { 86
73 unsigned long *addr = 87 for (i = 0; i < ARRAY_SIZE(ibft_signs); i++) {
74 (unsigned long *)isa_bus_to_virt(pos + 4); 88 if (memcmp(virt, ibft_signs[i].sign, IBFT_SIGN_LEN) ==
75 len = *addr; 89 0) {
76 /* if the length of the table extends past 1M, 90 unsigned long *addr =
77 * the table cannot be valid. */ 91 (unsigned long *)isa_bus_to_virt(pos + 4);
78 if (pos + len <= (IBFT_END-1)) { 92 len = *addr;
79 ibft_addr = (struct acpi_table_ibft *)virt; 93 /* if the length of the table extends past 1M,
80 break; 94 * the table cannot be valid. */
95 if (pos + len <= (IBFT_END-1)) {
96 ibft_addr = (struct acpi_table_ibft *)virt;
97 goto done;
98 }
81 } 99 }
82 } 100 }
83 } 101 }
102done:
84 return len; 103 return len;
85} 104}
86/* 105/*
@@ -89,18 +108,12 @@ static int __init find_ibft_in_mem(void)
89 */ 108 */
90unsigned long __init find_ibft_region(unsigned long *sizep) 109unsigned long __init find_ibft_region(unsigned long *sizep)
91{ 110{
92 111 int i;
93 ibft_addr = NULL; 112 ibft_addr = NULL;
94 113
95#ifdef CONFIG_ACPI 114#ifdef CONFIG_ACPI
96 /* 115 for (i = 0; i < ARRAY_SIZE(ibft_signs) && !ibft_addr; i++)
97 * One spec says "IBFT", the other says "iBFT". We have to check 116 acpi_table_parse(ibft_signs[i].sign, acpi_find_ibft);
98 * for both.
99 */
100 if (!ibft_addr)
101 acpi_table_parse(ACPI_SIG_IBFT, acpi_find_ibft);
102 if (!ibft_addr)
103 acpi_table_parse(IBFT_SIGN, acpi_find_ibft);
104#endif /* CONFIG_ACPI */ 117#endif /* CONFIG_ACPI */
105 118
106 /* iBFT 1.03 section 1.4.3.1 mandates that UEFI machines will 119 /* iBFT 1.03 section 1.4.3.1 mandates that UEFI machines will