aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firmware
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-05-18 18:30:04 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-05-18 18:30:04 -0400
commitd974f09ea4970d0299a8267111312b80adbd20e6 (patch)
tree2b8874872d0fb1fd5e1f5addc343ec29cc98b3cd /drivers/firmware
parent4a5219edcdae52bfb5eea0dfc2a7bd575961dad7 (diff)
parentb3c8eb50383178f3a4dcf1dc867001156da6473d (diff)
Merge branch 'stable/for-linus-4.7' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/ibft
Pull iscsi_ibft updates from Konrad Rzeszutek Wilk: "The pull has two features - both of them expand the SysFS entries: - 'prefix-len' - which is subnet_mask_prefix of the iBFT header. - 'acpi_header' dir with: 'iBFT', OEM-ID (whatever it extracts from the iBFT header) and OEM_TABLE_ID (also whatever it extracts from the iBFT header). This is to help NIC drivers to figure out during bootup how to deal with BIOS created iBFT tables (like by TianoCore UEFI implemenation)" * 'stable/for-linus-4.7' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/ibft: ibft: Expose iBFT acpi header via sysfs iscsi_ibft: Add prefix-len attr and display netmask
Diffstat (limited to 'drivers/firmware')
-rw-r--r--drivers/firmware/iscsi_ibft.c66
1 files changed, 65 insertions, 1 deletions
diff --git a/drivers/firmware/iscsi_ibft.c b/drivers/firmware/iscsi_ibft.c
index 81037e5fe301..14042a64bdd5 100644
--- a/drivers/firmware/iscsi_ibft.c
+++ b/drivers/firmware/iscsi_ibft.c
@@ -418,6 +418,31 @@ static ssize_t ibft_attr_show_target(void *data, int type, char *buf)
418 return str - buf; 418 return str - buf;
419} 419}
420 420
421static ssize_t ibft_attr_show_acpitbl(void *data, int type, char *buf)
422{
423 struct ibft_kobject *entry = data;
424 char *str = buf;
425
426 switch (type) {
427 case ISCSI_BOOT_ACPITBL_SIGNATURE:
428 str += sprintf_string(str, ACPI_NAME_SIZE,
429 entry->header->header.signature);
430 break;
431 case ISCSI_BOOT_ACPITBL_OEM_ID:
432 str += sprintf_string(str, ACPI_OEM_ID_SIZE,
433 entry->header->header.oem_id);
434 break;
435 case ISCSI_BOOT_ACPITBL_OEM_TABLE_ID:
436 str += sprintf_string(str, ACPI_OEM_TABLE_ID_SIZE,
437 entry->header->header.oem_table_id);
438 break;
439 default:
440 break;
441 }
442
443 return str - buf;
444}
445
421static int __init ibft_check_device(void) 446static int __init ibft_check_device(void)
422{ 447{
423 int len; 448 int len;
@@ -576,6 +601,24 @@ static umode_t __init ibft_check_initiator_for(void *data, int type)
576 return rc; 601 return rc;
577} 602}
578 603
604static umode_t __init ibft_check_acpitbl_for(void *data, int type)
605{
606
607 umode_t rc = 0;
608
609 switch (type) {
610 case ISCSI_BOOT_ACPITBL_SIGNATURE:
611 case ISCSI_BOOT_ACPITBL_OEM_ID:
612 case ISCSI_BOOT_ACPITBL_OEM_TABLE_ID:
613 rc = S_IRUGO;
614 break;
615 default:
616 break;
617 }
618
619 return rc;
620}
621
579static void ibft_kobj_release(void *data) 622static void ibft_kobj_release(void *data)
580{ 623{
581 kfree(data); 624 kfree(data);
@@ -699,6 +742,8 @@ free_ibft_obj:
699static int __init ibft_register_kobjects(struct acpi_table_ibft *header) 742static int __init ibft_register_kobjects(struct acpi_table_ibft *header)
700{ 743{
701 struct ibft_control *control = NULL; 744 struct ibft_control *control = NULL;
745 struct iscsi_boot_kobj *boot_kobj;
746 struct ibft_kobject *ibft_kobj;
702 void *ptr, *end; 747 void *ptr, *end;
703 int rc = 0; 748 int rc = 0;
704 u16 offset; 749 u16 offset;
@@ -726,6 +771,25 @@ static int __init ibft_register_kobjects(struct acpi_table_ibft *header)
726 break; 771 break;
727 } 772 }
728 } 773 }
774 if (rc)
775 return rc;
776
777 ibft_kobj = kzalloc(sizeof(*ibft_kobj), GFP_KERNEL);
778 if (!ibft_kobj)
779 return -ENOMEM;
780
781 ibft_kobj->header = header;
782 ibft_kobj->hdr = NULL; /*for ibft_unregister*/
783
784 boot_kobj = iscsi_boot_create_acpitbl(boot_kset, 0,
785 ibft_kobj,
786 ibft_attr_show_acpitbl,
787 ibft_check_acpitbl_for,
788 ibft_kobj_release);
789 if (!boot_kobj) {
790 kfree(ibft_kobj);
791 rc = -ENOMEM;
792 }
729 793
730 return rc; 794 return rc;
731} 795}
@@ -738,7 +802,7 @@ static void ibft_unregister(void)
738 list_for_each_entry_safe(boot_kobj, tmp_kobj, 802 list_for_each_entry_safe(boot_kobj, tmp_kobj,
739 &boot_kset->kobj_list, list) { 803 &boot_kset->kobj_list, list) {
740 ibft_kobj = boot_kobj->data; 804 ibft_kobj = boot_kobj->data;
741 if (ibft_kobj->hdr->id == id_nic) 805 if (ibft_kobj->hdr && ibft_kobj->hdr->id == id_nic)
742 sysfs_remove_link(&boot_kobj->kobj, "device"); 806 sysfs_remove_link(&boot_kobj->kobj, "device");
743 }; 807 };
744} 808}