|
@@ -56,6 +56,10 @@ static EFI_GUID efi_nii31_protocol_guid = {
|
56
|
56
|
{ 0xBC, 0x81, 0x76, 0x7F, 0x1F, 0x97, 0x7A, 0x89 }
|
57
|
57
|
};
|
58
|
58
|
|
|
59
|
+/** EFI component name protocol */
|
|
60
|
+static EFI_GUID efi_component_name2_protocol_guid
|
|
61
|
+ = EFI_COMPONENT_NAME2_PROTOCOL_GUID;
|
|
62
|
+
|
59
|
63
|
/** List of SNP devices */
|
60
|
64
|
static LIST_HEAD ( efi_snp_devices );
|
61
|
65
|
|
|
@@ -701,6 +705,54 @@ static EFI_SIMPLE_NETWORK_PROTOCOL efi_snp_device_snp = {
|
701
|
705
|
.Receive = efi_snp_receive,
|
702
|
706
|
};
|
703
|
707
|
|
|
708
|
+/******************************************************************************
|
|
709
|
+ *
|
|
710
|
+ * Component name protocol
|
|
711
|
+ *
|
|
712
|
+ ******************************************************************************
|
|
713
|
+ */
|
|
714
|
+
|
|
715
|
+/**
|
|
716
|
+ * Look up driver name
|
|
717
|
+ *
|
|
718
|
+ * @v name2 Component name protocol
|
|
719
|
+ * @v language Language to use
|
|
720
|
+ * @v driver_name Driver name to fill in
|
|
721
|
+ * @ret efirc EFI status code
|
|
722
|
+ */
|
|
723
|
+static EFI_STATUS EFIAPI
|
|
724
|
+efi_snp_get_driver_name ( EFI_COMPONENT_NAME2_PROTOCOL *name2,
|
|
725
|
+ CHAR8 *language __unused, CHAR16 **driver_name ) {
|
|
726
|
+ struct efi_snp_device *snpdev =
|
|
727
|
+ container_of ( name2, struct efi_snp_device, name2 );
|
|
728
|
+
|
|
729
|
+ *driver_name = snpdev->driver_name;
|
|
730
|
+ return 0;
|
|
731
|
+}
|
|
732
|
+
|
|
733
|
+/**
|
|
734
|
+ * Look up controller name
|
|
735
|
+ *
|
|
736
|
+ * @v name2 Component name protocol
|
|
737
|
+ * @v device Device
|
|
738
|
+ * @v child Child device, or NULL
|
|
739
|
+ * @v language Language to use
|
|
740
|
+ * @v driver_name Device name to fill in
|
|
741
|
+ * @ret efirc EFI status code
|
|
742
|
+ */
|
|
743
|
+static EFI_STATUS EFIAPI
|
|
744
|
+efi_snp_get_controller_name ( EFI_COMPONENT_NAME2_PROTOCOL *name2,
|
|
745
|
+ EFI_HANDLE device __unused,
|
|
746
|
+ EFI_HANDLE child __unused,
|
|
747
|
+ CHAR8 *language __unused,
|
|
748
|
+ CHAR16 **controller_name ) {
|
|
749
|
+ struct efi_snp_device *snpdev =
|
|
750
|
+ container_of ( name2, struct efi_snp_device, name2 );
|
|
751
|
+
|
|
752
|
+ *controller_name = snpdev->controller_name;
|
|
753
|
+ return 0;
|
|
754
|
+}
|
|
755
|
+
|
704
|
756
|
/******************************************************************************
|
705
|
757
|
*
|
706
|
758
|
* iPXE network driver
|
|
@@ -794,6 +846,19 @@ static int efi_snp_probe ( struct net_device *netdev ) {
|
794
|
846
|
strncpy ( snpdev->nii.StringId, "iPXE",
|
795
|
847
|
sizeof ( snpdev->nii.StringId ) );
|
796
|
848
|
|
|
849
|
+ /* Populate the component name structure */
|
|
850
|
+ efi_snprintf ( snpdev->driver_name,
|
|
851
|
+ ( sizeof ( snpdev->driver_name ) /
|
|
852
|
+ sizeof ( snpdev->driver_name[0] ) ), "%s",
|
|
853
|
+ netdev->dev->driver_name );
|
|
854
|
+ efi_snprintf ( snpdev->controller_name,
|
|
855
|
+ ( sizeof ( snpdev->controller_name ) /
|
|
856
|
+ sizeof ( snpdev->controller_name[0] ) ), "%s (%s)",
|
|
857
|
+ netdev->name, netdev_addr ( netdev ) );
|
|
858
|
+ snpdev->name2.GetDriverName = efi_snp_get_driver_name;
|
|
859
|
+ snpdev->name2.GetControllerName = efi_snp_get_controller_name;
|
|
860
|
+ snpdev->name2.SupportedLanguages = "en";
|
|
861
|
+
|
797
|
862
|
/* Populate the device name */
|
798
|
863
|
efi_snprintf ( snpdev->name, ( sizeof ( snpdev->name ) /
|
799
|
864
|
sizeof ( snpdev->name[0] ) ),
|
|
@@ -822,6 +887,7 @@ static int efi_snp_probe ( struct net_device *netdev ) {
|
822
|
887
|
&efi_device_path_protocol_guid, &snpdev->path,
|
823
|
888
|
&efi_nii_protocol_guid, &snpdev->nii,
|
824
|
889
|
&efi_nii31_protocol_guid, &snpdev->nii,
|
|
890
|
+ &efi_component_name2_protocol_guid, &snpdev->name2,
|
825
|
891
|
NULL ) ) != 0 ) {
|
826
|
892
|
DBGC ( snpdev, "SNPDEV %p could not install protocols: "
|
827
|
893
|
"%s\n", snpdev, efi_strerror ( efirc ) );
|
|
@@ -862,6 +928,7 @@ static int efi_snp_probe ( struct net_device *netdev ) {
|
862
|
928
|
&efi_device_path_protocol_guid, &snpdev->path,
|
863
|
929
|
&efi_nii_protocol_guid, &snpdev->nii,
|
864
|
930
|
&efi_nii31_protocol_guid, &snpdev->nii,
|
|
931
|
+ &efi_component_name2_protocol_guid, &snpdev->name2,
|
865
|
932
|
NULL );
|
866
|
933
|
err_install_protocol_interface:
|
867
|
934
|
bs->CloseEvent ( snpdev->snp.WaitForPacket );
|
|
@@ -922,6 +989,7 @@ static void efi_snp_remove ( struct net_device *netdev ) {
|
922
|
989
|
&efi_device_path_protocol_guid, &snpdev->path,
|
923
|
990
|
&efi_nii_protocol_guid, &snpdev->nii,
|
924
|
991
|
&efi_nii31_protocol_guid, &snpdev->nii,
|
|
992
|
+ &efi_component_name2_protocol_guid, &snpdev->name2,
|
925
|
993
|
NULL );
|
926
|
994
|
bs->CloseEvent ( snpdev->snp.WaitForPacket );
|
927
|
995
|
netdev_put ( snpdev->netdev );
|