aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firmware
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2010-04-29 19:53:17 -0400
committerH. Peter Anvin <hpa@zytor.com>2010-04-29 19:53:17 -0400
commitd9c5841e22231e4e49fd0a1004164e6fce59b7a6 (patch)
treee1f589c46b3ff79bbe7b1b2469f6362f94576da6 /drivers/firmware
parentb701a47ba48b698976fb2fe05fb285b0edc1d26a (diff)
parent5967ed87ade85a421ef814296c3c7f182b08c225 (diff)
Merge branch 'x86/asm' into x86/atomic
Merge reason: Conflict between LOCK_PREFIX_HERE and relative alternatives pointers Resolved Conflicts: arch/x86/include/asm/alternative.h arch/x86/kernel/alternative.c Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'drivers/firmware')
-rw-r--r--drivers/firmware/dcdbas.c1
-rw-r--r--drivers/firmware/dell_rbu.c1
-rw-r--r--drivers/firmware/dmi-id.c1
-rw-r--r--drivers/firmware/dmi_scan.c1
-rw-r--r--drivers/firmware/edd.c2
-rw-r--r--drivers/firmware/efivars.c3
-rw-r--r--drivers/firmware/iscsi_ibft.c16
-rw-r--r--drivers/firmware/iscsi_ibft_find.c12
-rw-r--r--drivers/firmware/memmap.c60
9 files changed, 57 insertions, 40 deletions
diff --git a/drivers/firmware/dcdbas.c b/drivers/firmware/dcdbas.c
index 18d65fb42ee7..fb09bb3c0ad6 100644
--- a/drivers/firmware/dcdbas.c
+++ b/drivers/firmware/dcdbas.c
@@ -23,6 +23,7 @@
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24#include <linux/dma-mapping.h> 24#include <linux/dma-mapping.h>
25#include <linux/errno.h> 25#include <linux/errno.h>
26#include <linux/gfp.h>
26#include <linux/init.h> 27#include <linux/init.h>
27#include <linux/kernel.h> 28#include <linux/kernel.h>
28#include <linux/mc146818rtc.h> 29#include <linux/mc146818rtc.h>
diff --git a/drivers/firmware/dell_rbu.c b/drivers/firmware/dell_rbu.c
index b3a0cf57442e..3a4460265b10 100644
--- a/drivers/firmware/dell_rbu.c
+++ b/drivers/firmware/dell_rbu.c
@@ -36,6 +36,7 @@
36 */ 36 */
37#include <linux/init.h> 37#include <linux/init.h>
38#include <linux/module.h> 38#include <linux/module.h>
39#include <linux/slab.h>
39#include <linux/string.h> 40#include <linux/string.h>
40#include <linux/errno.h> 41#include <linux/errno.h>
41#include <linux/blkdev.h> 42#include <linux/blkdev.h>
diff --git a/drivers/firmware/dmi-id.c b/drivers/firmware/dmi-id.c
index dbdf6fadfc79..a777a35381d2 100644
--- a/drivers/firmware/dmi-id.c
+++ b/drivers/firmware/dmi-id.c
@@ -11,6 +11,7 @@
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/dmi.h> 12#include <linux/dmi.h>
13#include <linux/device.h> 13#include <linux/device.h>
14#include <linux/slab.h>
14 15
15struct dmi_device_attribute{ 16struct dmi_device_attribute{
16 struct device_attribute dev_attr; 17 struct device_attribute dev_attr;
diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
index 31b983d9462c..d46467271349 100644
--- a/drivers/firmware/dmi_scan.c
+++ b/drivers/firmware/dmi_scan.c
@@ -5,7 +5,6 @@
5#include <linux/dmi.h> 5#include <linux/dmi.h>
6#include <linux/efi.h> 6#include <linux/efi.h>
7#include <linux/bootmem.h> 7#include <linux/bootmem.h>
8#include <linux/slab.h>
9#include <asm/dmi.h> 8#include <asm/dmi.h>
10 9
11/* 10/*
diff --git a/drivers/firmware/edd.c b/drivers/firmware/edd.c
index 9e4f59dc7f1e..110e24e50883 100644
--- a/drivers/firmware/edd.c
+++ b/drivers/firmware/edd.c
@@ -122,7 +122,7 @@ edd_attr_show(struct kobject * kobj, struct attribute *attr, char *buf)
122 return ret; 122 return ret;
123} 123}
124 124
125static struct sysfs_ops edd_attr_ops = { 125static const struct sysfs_ops edd_attr_ops = {
126 .show = edd_attr_show, 126 .show = edd_attr_show,
127}; 127};
128 128
diff --git a/drivers/firmware/efivars.c b/drivers/firmware/efivars.c
index f4f709d1370b..81b70bd07586 100644
--- a/drivers/firmware/efivars.c
+++ b/drivers/firmware/efivars.c
@@ -77,6 +77,7 @@
77#include <linux/sysfs.h> 77#include <linux/sysfs.h>
78#include <linux/kobject.h> 78#include <linux/kobject.h>
79#include <linux/device.h> 79#include <linux/device.h>
80#include <linux/slab.h>
80 81
81#include <asm/uaccess.h> 82#include <asm/uaccess.h>
82 83
@@ -362,7 +363,7 @@ static ssize_t efivar_attr_store(struct kobject *kobj, struct attribute *attr,
362 return ret; 363 return ret;
363} 364}
364 365
365static struct sysfs_ops efivar_attr_ops = { 366static const struct sysfs_ops efivar_attr_ops = {
366 .show = efivar_attr_show, 367 .show = efivar_attr_show,
367 .store = efivar_attr_store, 368 .store = efivar_attr_store,
368}; 369};
diff --git a/drivers/firmware/iscsi_ibft.c b/drivers/firmware/iscsi_ibft.c
index 051d1ebbd287..ed2801c378de 100644
--- a/drivers/firmware/iscsi_ibft.c
+++ b/drivers/firmware/iscsi_ibft.c
@@ -380,8 +380,7 @@ static ssize_t ibft_attr_show_nic(struct ibft_kobject *entry,
380 struct ibft_nic *nic = entry->nic; 380 struct ibft_nic *nic = entry->nic;
381 void *ibft_loc = entry->header; 381 void *ibft_loc = entry->header;
382 char *str = buf; 382 char *str = buf;
383 char *mac; 383 __be32 val;
384 int val;
385 384
386 if (!nic) 385 if (!nic)
387 return 0; 386 return 0;
@@ -397,10 +396,8 @@ static ssize_t ibft_attr_show_nic(struct ibft_kobject *entry,
397 str += sprintf_ipaddr(str, nic->ip_addr); 396 str += sprintf_ipaddr(str, nic->ip_addr);
398 break; 397 break;
399 case ibft_eth_subnet_mask: 398 case ibft_eth_subnet_mask:
400 val = ~((1 << (32-nic->subnet_mask_prefix))-1); 399 val = cpu_to_be32(~((1 << (32-nic->subnet_mask_prefix))-1));
401 str += sprintf(str, NIPQUAD_FMT, 400 str += sprintf(str, "%pI4", &val);
402 (u8)(val >> 24), (u8)(val >> 16),
403 (u8)(val >> 8), (u8)(val));
404 break; 401 break;
405 case ibft_eth_origin: 402 case ibft_eth_origin:
406 str += sprintf(str, "%d\n", nic->origin); 403 str += sprintf(str, "%d\n", nic->origin);
@@ -421,10 +418,7 @@ static ssize_t ibft_attr_show_nic(struct ibft_kobject *entry,
421 str += sprintf(str, "%d\n", nic->vlan); 418 str += sprintf(str, "%d\n", nic->vlan);
422 break; 419 break;
423 case ibft_eth_mac: 420 case ibft_eth_mac:
424 mac = nic->mac; 421 str += sprintf(str, "%pM\n", nic->mac);
425 str += sprintf(str, "%02x:%02x:%02x:%02x:%02x:%02x\n",
426 (u8)mac[0], (u8)mac[1], (u8)mac[2],
427 (u8)mac[3], (u8)mac[4], (u8)mac[5]);
428 break; 422 break;
429 case ibft_eth_hostname: 423 case ibft_eth_hostname:
430 str += sprintf_string(str, nic->hostname_len, 424 str += sprintf_string(str, nic->hostname_len,
@@ -525,7 +519,7 @@ static ssize_t ibft_show_attribute(struct kobject *kobj,
525 return ret; 519 return ret;
526} 520}
527 521
528static struct sysfs_ops ibft_attr_ops = { 522static const struct sysfs_ops ibft_attr_ops = {
529 .show = ibft_show_attribute, 523 .show = ibft_show_attribute,
530}; 524};
531 525
diff --git a/drivers/firmware/iscsi_ibft_find.c b/drivers/firmware/iscsi_ibft_find.c
index dfb15c06c88f..d6470ef36e4a 100644
--- a/drivers/firmware/iscsi_ibft_find.c
+++ b/drivers/firmware/iscsi_ibft_find.c
@@ -27,7 +27,6 @@
27#include <linux/limits.h> 27#include <linux/limits.h>
28#include <linux/module.h> 28#include <linux/module.h>
29#include <linux/pci.h> 29#include <linux/pci.h>
30#include <linux/slab.h>
31#include <linux/stat.h> 30#include <linux/stat.h>
32#include <linux/string.h> 31#include <linux/string.h>
33#include <linux/types.h> 32#include <linux/types.h>
@@ -52,7 +51,7 @@ EXPORT_SYMBOL_GPL(ibft_addr);
52 * Routine used to find the iSCSI Boot Format Table. The logical 51 * Routine used to find the iSCSI Boot Format Table. The logical
53 * kernel address is set in the ibft_addr global variable. 52 * kernel address is set in the ibft_addr global variable.
54 */ 53 */
55void __init reserve_ibft_region(void) 54unsigned long __init find_ibft_region(unsigned long *sizep)
56{ 55{
57 unsigned long pos; 56 unsigned long pos;
58 unsigned int len = 0; 57 unsigned int len = 0;
@@ -78,6 +77,11 @@ void __init reserve_ibft_region(void)
78 } 77 }
79 } 78 }
80 } 79 }
81 if (ibft_addr) 80 if (ibft_addr) {
82 reserve_bootmem(pos, PAGE_ALIGN(len), BOOTMEM_DEFAULT); 81 *sizep = PAGE_ALIGN(len);
82 return pos;
83 }
84
85 *sizep = 0;
86 return 0;
83} 87}
diff --git a/drivers/firmware/memmap.c b/drivers/firmware/memmap.c
index 56f9234781fa..adc07102a20d 100644
--- a/drivers/firmware/memmap.c
+++ b/drivers/firmware/memmap.c
@@ -20,6 +20,7 @@
20#include <linux/module.h> 20#include <linux/module.h>
21#include <linux/types.h> 21#include <linux/types.h>
22#include <linux/bootmem.h> 22#include <linux/bootmem.h>
23#include <linux/slab.h>
23 24
24/* 25/*
25 * Data types ------------------------------------------------------------------ 26 * Data types ------------------------------------------------------------------
@@ -74,7 +75,7 @@ static struct attribute *def_attrs[] = {
74 NULL 75 NULL
75}; 76};
76 77
77static struct sysfs_ops memmap_attr_ops = { 78static const struct sysfs_ops memmap_attr_ops = {
78 .show = memmap_attr_show, 79 .show = memmap_attr_show,
79}; 80};
80 81
@@ -122,29 +123,53 @@ static int firmware_map_add_entry(u64 start, u64 end,
122 return 0; 123 return 0;
123} 124}
124 125
126/*
127 * Add memmap entry on sysfs
128 */
129static int add_sysfs_fw_map_entry(struct firmware_map_entry *entry)
130{
131 static int map_entries_nr;
132 static struct kset *mmap_kset;
133
134 if (!mmap_kset) {
135 mmap_kset = kset_create_and_add("memmap", NULL, firmware_kobj);
136 if (!mmap_kset)
137 return -ENOMEM;
138 }
139
140 entry->kobj.kset = mmap_kset;
141 if (kobject_add(&entry->kobj, NULL, "%d", map_entries_nr++))
142 kobject_put(&entry->kobj);
143
144 return 0;
145}
146
125/** 147/**
126 * firmware_map_add() - Adds a firmware mapping entry. 148 * firmware_map_add_hotplug() - Adds a firmware mapping entry when we do
149 * memory hotplug.
127 * @start: Start of the memory range. 150 * @start: Start of the memory range.
128 * @end: End of the memory range (inclusive). 151 * @end: End of the memory range (inclusive).
129 * @type: Type of the memory range. 152 * @type: Type of the memory range.
130 * 153 *
131 * This function uses kmalloc() for memory 154 * Adds a firmware mapping entry. This function is for memory hotplug, it is
132 * allocation. Use firmware_map_add_early() if you want to use the bootmem 155 * similar to function firmware_map_add_early(). The only difference is that
133 * allocator. 156 * it will create the syfs entry dynamically.
134 *
135 * That function must be called before late_initcall.
136 * 157 *
137 * Returns 0 on success, or -ENOMEM if no memory could be allocated. 158 * Returns 0 on success, or -ENOMEM if no memory could be allocated.
138 **/ 159 **/
139int firmware_map_add(u64 start, u64 end, const char *type) 160int __meminit firmware_map_add_hotplug(u64 start, u64 end, const char *type)
140{ 161{
141 struct firmware_map_entry *entry; 162 struct firmware_map_entry *entry;
142 163
143 entry = kmalloc(sizeof(struct firmware_map_entry), GFP_ATOMIC); 164 entry = kzalloc(sizeof(struct firmware_map_entry), GFP_ATOMIC);
144 if (!entry) 165 if (!entry)
145 return -ENOMEM; 166 return -ENOMEM;
146 167
147 return firmware_map_add_entry(start, end, type, entry); 168 firmware_map_add_entry(start, end, type, entry);
169 /* create the memmap entry */
170 add_sysfs_fw_map_entry(entry);
171
172 return 0;
148} 173}
149 174
150/** 175/**
@@ -154,7 +179,7 @@ int firmware_map_add(u64 start, u64 end, const char *type)
154 * @type: Type of the memory range. 179 * @type: Type of the memory range.
155 * 180 *
156 * Adds a firmware mapping entry. This function uses the bootmem allocator 181 * Adds a firmware mapping entry. This function uses the bootmem allocator
157 * for memory allocation. Use firmware_map_add() if you want to use kmalloc(). 182 * for memory allocation.
158 * 183 *
159 * That function must be called before late_initcall. 184 * That function must be called before late_initcall.
160 * 185 *
@@ -214,19 +239,10 @@ static ssize_t memmap_attr_show(struct kobject *kobj,
214 */ 239 */
215static int __init memmap_init(void) 240static int __init memmap_init(void)
216{ 241{
217 int i = 0;
218 struct firmware_map_entry *entry; 242 struct firmware_map_entry *entry;
219 struct kset *memmap_kset;
220
221 memmap_kset = kset_create_and_add("memmap", NULL, firmware_kobj);
222 if (WARN_ON(!memmap_kset))
223 return -ENOMEM;
224 243
225 list_for_each_entry(entry, &map_entries, list) { 244 list_for_each_entry(entry, &map_entries, list)
226 entry->kobj.kset = memmap_kset; 245 add_sysfs_fw_map_entry(entry);
227 if (kobject_add(&entry->kobj, NULL, "%d", i++))
228 kobject_put(&entry->kobj);
229 }
230 246
231 return 0; 247 return 0;
232} 248}