This source file includes following definitions.
- find_ibft_in_mem
- find_ibft_region
1
2
3
4
5
6
7
8
9
10
11
12
13 #include <linux/memblock.h>
14 #include <linux/blkdev.h>
15 #include <linux/ctype.h>
16 #include <linux/device.h>
17 #include <linux/efi.h>
18 #include <linux/err.h>
19 #include <linux/init.h>
20 #include <linux/limits.h>
21 #include <linux/module.h>
22 #include <linux/pci.h>
23 #include <linux/stat.h>
24 #include <linux/string.h>
25 #include <linux/types.h>
26 #include <linux/acpi.h>
27 #include <linux/iscsi_ibft.h>
28
29 #include <asm/mmzone.h>
30
31
32
33
34 struct acpi_table_ibft *ibft_addr;
35 EXPORT_SYMBOL_GPL(ibft_addr);
36
37 static const struct {
38 char *sign;
39 } ibft_signs[] = {
40 { "iBFT" },
41 { "BIFT" },
42 };
43
44 #define IBFT_SIGN_LEN 4
45 #define IBFT_START 0x80000
46 #define IBFT_END 0x100000
47 #define VGA_MEM 0xA0000
48 #define VGA_SIZE 0x20000
49
50 static int __init find_ibft_in_mem(void)
51 {
52 unsigned long pos;
53 unsigned int len = 0;
54 void *virt;
55 int i;
56
57 for (pos = IBFT_START; pos < IBFT_END; pos += 16) {
58
59
60 if (pos == VGA_MEM)
61 pos += VGA_SIZE;
62 virt = isa_bus_to_virt(pos);
63
64 for (i = 0; i < ARRAY_SIZE(ibft_signs); i++) {
65 if (memcmp(virt, ibft_signs[i].sign, IBFT_SIGN_LEN) ==
66 0) {
67 unsigned long *addr =
68 (unsigned long *)isa_bus_to_virt(pos + 4);
69 len = *addr;
70
71
72 if (pos + len <= (IBFT_END-1)) {
73 ibft_addr = (struct acpi_table_ibft *)virt;
74 pr_info("iBFT found at 0x%lx.\n", pos);
75 goto done;
76 }
77 }
78 }
79 }
80 done:
81 return len;
82 }
83
84
85
86
87 unsigned long __init find_ibft_region(unsigned long *sizep)
88 {
89 ibft_addr = NULL;
90
91
92
93
94 if (!efi_enabled(EFI_BOOT))
95 find_ibft_in_mem();
96
97 if (ibft_addr) {
98 *sizep = PAGE_ALIGN(ibft_addr->header.length);
99 return (u64)virt_to_phys(ibft_addr);
100 }
101
102 *sizep = 0;
103 return 0;
104 }