aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firmware
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
committerAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
commitada47b5fe13d89735805b566185f4885f5a3f750 (patch)
tree644b88f8a71896307d71438e9b3af49126ffb22b /drivers/firmware
parent43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff)
parent3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff)
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'drivers/firmware')
-rw-r--r--drivers/firmware/Kconfig4
-rw-r--r--drivers/firmware/dcdbas.c1
-rw-r--r--drivers/firmware/dell_rbu.c10
-rw-r--r--drivers/firmware/dmi-id.c1
-rw-r--r--drivers/firmware/dmi_scan.c21
-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
10 files changed, 79 insertions, 51 deletions
diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig
index ebb9e51deb0c..1b03ba1d0834 100644
--- a/drivers/firmware/Kconfig
+++ b/drivers/firmware/Kconfig
@@ -7,7 +7,7 @@ menu "Firmware Drivers"
7 7
8config EDD 8config EDD
9 tristate "BIOS Enhanced Disk Drive calls determine boot disk" 9 tristate "BIOS Enhanced Disk Drive calls determine boot disk"
10 depends on !IA64 10 depends on X86
11 help 11 help
12 Say Y or M here if you want to enable BIOS Enhanced Disk Drive 12 Say Y or M here if you want to enable BIOS Enhanced Disk Drive
13 Services real mode BIOS calls to determine which disk 13 Services real mode BIOS calls to determine which disk
@@ -28,7 +28,7 @@ config EDD_OFF
28 28
29config FIRMWARE_MEMMAP 29config FIRMWARE_MEMMAP
30 bool "Add firmware-provided memory map to sysfs" if EMBEDDED 30 bool "Add firmware-provided memory map to sysfs" if EMBEDDED
31 default (X86_64 || X86_32) 31 default X86
32 help 32 help
33 Add the firmware-provided (unmodified) memory map to /sys/firmware/memmap. 33 Add the firmware-provided (unmodified) memory map to /sys/firmware/memmap.
34 That memory map is used for example by kexec to set up parameter area 34 That memory map is used for example by kexec to set up parameter area
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 b4704e150b28..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>
@@ -544,9 +545,12 @@ static void callbackfn_rbu(const struct firmware *fw, void *context)
544{ 545{
545 rbu_data.entry_created = 0; 546 rbu_data.entry_created = 0;
546 547
547 if (!fw || !fw->size) 548 if (!fw)
548 return; 549 return;
549 550
551 if (!fw->size)
552 goto out;
553
550 spin_lock(&rbu_data.lock); 554 spin_lock(&rbu_data.lock);
551 if (!strcmp(image_type, "mono")) { 555 if (!strcmp(image_type, "mono")) {
552 if (!img_update_realloc(fw->size)) 556 if (!img_update_realloc(fw->size))
@@ -568,6 +572,8 @@ static void callbackfn_rbu(const struct firmware *fw, void *context)
568 } else 572 } else
569 pr_debug("invalid image type specified.\n"); 573 pr_debug("invalid image type specified.\n");
570 spin_unlock(&rbu_data.lock); 574 spin_unlock(&rbu_data.lock);
575 out:
576 release_firmware(fw);
571} 577}
572 578
573static ssize_t read_rbu_image_type(struct kobject *kobj, 579static ssize_t read_rbu_image_type(struct kobject *kobj,
@@ -615,7 +621,7 @@ static ssize_t write_rbu_image_type(struct kobject *kobj,
615 spin_unlock(&rbu_data.lock); 621 spin_unlock(&rbu_data.lock);
616 req_firm_rc = request_firmware_nowait(THIS_MODULE, 622 req_firm_rc = request_firmware_nowait(THIS_MODULE,
617 FW_ACTION_NOHOTPLUG, "dell_rbu", 623 FW_ACTION_NOHOTPLUG, "dell_rbu",
618 &rbu_device->dev, &context, 624 &rbu_device->dev, GFP_KERNEL, &context,
619 callbackfn_rbu); 625 callbackfn_rbu);
620 if (req_firm_rc) { 626 if (req_firm_rc) {
621 printk(KERN_ERR 627 printk(KERN_ERR
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 938100f14b16..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/*
@@ -169,10 +168,7 @@ static void __init dmi_save_uuid(const struct dmi_header *dm, int slot, int inde
169 if (!s) 168 if (!s)
170 return; 169 return;
171 170
172 sprintf(s, 171 sprintf(s, "%pUB", d);
173 "%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X",
174 d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7],
175 d[8], d[9], d[10], d[11], d[12], d[13], d[14], d[15]);
176 172
177 dmi_ident[slot] = s; 173 dmi_ident[slot] = s;
178} 174}
@@ -429,7 +425,7 @@ static bool dmi_matches(const struct dmi_system_id *dmi)
429 for (i = 0; i < ARRAY_SIZE(dmi->matches); i++) { 425 for (i = 0; i < ARRAY_SIZE(dmi->matches); i++) {
430 int s = dmi->matches[i].slot; 426 int s = dmi->matches[i].slot;
431 if (s == DMI_NONE) 427 if (s == DMI_NONE)
432 continue; 428 break;
433 if (dmi_ident[s] 429 if (dmi_ident[s]
434 && strstr(dmi_ident[s], dmi->matches[i].substr)) 430 && strstr(dmi_ident[s], dmi->matches[i].substr))
435 continue; 431 continue;
@@ -440,6 +436,15 @@ static bool dmi_matches(const struct dmi_system_id *dmi)
440} 436}
441 437
442/** 438/**
439 * dmi_is_end_of_table - check for end-of-table marker
440 * @dmi: pointer to the dmi_system_id structure to check
441 */
442static bool dmi_is_end_of_table(const struct dmi_system_id *dmi)
443{
444 return dmi->matches[0].slot == DMI_NONE;
445}
446
447/**
443 * dmi_check_system - check system DMI data 448 * dmi_check_system - check system DMI data
444 * @list: array of dmi_system_id structures to match against 449 * @list: array of dmi_system_id structures to match against
445 * All non-null elements of the list must match 450 * All non-null elements of the list must match
@@ -457,7 +462,7 @@ int dmi_check_system(const struct dmi_system_id *list)
457 int count = 0; 462 int count = 0;
458 const struct dmi_system_id *d; 463 const struct dmi_system_id *d;
459 464
460 for (d = list; d->ident; d++) 465 for (d = list; !dmi_is_end_of_table(d); d++)
461 if (dmi_matches(d)) { 466 if (dmi_matches(d)) {
462 count++; 467 count++;
463 if (d->callback && d->callback(d)) 468 if (d->callback && d->callback(d))
@@ -484,7 +489,7 @@ const struct dmi_system_id *dmi_first_match(const struct dmi_system_id *list)
484{ 489{
485 const struct dmi_system_id *d; 490 const struct dmi_system_id *d;
486 491
487 for (d = list; d->ident; d++) 492 for (d = list; !dmi_is_end_of_table(d); d++)
488 if (dmi_matches(d)) 493 if (dmi_matches(d))
489 return d; 494 return d;
490 495
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}