|
|
@@ -46,6 +46,8 @@ struct efi_snp_device {
|
|
46
|
46
|
struct list_head list;
|
|
47
|
47
|
/** The underlying iPXE network device */
|
|
48
|
48
|
struct net_device *netdev;
|
|
|
49
|
+ /** The underlying EFI PCI device */
|
|
|
50
|
+ struct efi_pci_device *efipci;
|
|
49
|
51
|
/** EFI device handle */
|
|
50
|
52
|
EFI_HANDLE handle;
|
|
51
|
53
|
/** The SNP structure itself */
|
|
|
@@ -795,6 +797,7 @@ static int efi_snp_probe ( struct net_device *netdev ) {
|
|
795
|
797
|
goto err_alloc_snp;
|
|
796
|
798
|
}
|
|
797
|
799
|
snpdev->netdev = netdev_get ( netdev );
|
|
|
800
|
+ snpdev->efipci = efipci;
|
|
798
|
801
|
|
|
799
|
802
|
/* Sanity check */
|
|
800
|
803
|
if ( netdev->ll_protocol->ll_addr_len > sizeof ( EFI_MAC_ADDRESS ) ) {
|
|
|
@@ -865,6 +868,15 @@ static int efi_snp_probe ( struct net_device *netdev ) {
|
|
865
|
868
|
goto err_install_protocol_interface;
|
|
866
|
869
|
}
|
|
867
|
870
|
|
|
|
871
|
+ /* Add as child of PCI device */
|
|
|
872
|
+ if ( ( efirc = efipci_child_add ( efipci, snpdev->handle ) ) != 0 ) {
|
|
|
873
|
+ DBGC ( snpdev, "SNPDEV %p could not become child of " PCI_FMT
|
|
|
874
|
+ ": %s\n", snpdev, PCI_ARGS ( &efipci->pci ),
|
|
|
875
|
+ efi_strerror ( efirc ) );
|
|
|
876
|
+ rc = EFIRC_TO_RC ( efirc );
|
|
|
877
|
+ goto err_efipci_child_add;
|
|
|
878
|
+ }
|
|
|
879
|
+
|
|
868
|
880
|
/* Add to list of SNP devices */
|
|
869
|
881
|
list_add ( &snpdev->list, &efi_snp_devices );
|
|
870
|
882
|
|
|
|
@@ -872,6 +884,8 @@ static int efi_snp_probe ( struct net_device *netdev ) {
|
|
872
|
884
|
snpdev, netdev->name, snpdev->handle );
|
|
873
|
885
|
return 0;
|
|
874
|
886
|
|
|
|
887
|
+ efipci_child_del ( efipci, snpdev->handle );
|
|
|
888
|
+ err_efipci_child_add:
|
|
875
|
889
|
bs->UninstallMultipleProtocolInterfaces (
|
|
876
|
890
|
snpdev->handle,
|
|
877
|
891
|
&efi_simple_network_protocol_guid, &snpdev->snp,
|
|
|
@@ -916,6 +930,7 @@ static void efi_snp_remove ( struct net_device *netdev ) {
|
|
916
|
930
|
}
|
|
917
|
931
|
|
|
918
|
932
|
/* Uninstall the SNP */
|
|
|
933
|
+ efipci_child_del ( snpdev->efipci, snpdev->handle );
|
|
919
|
934
|
list_del ( &snpdev->list );
|
|
920
|
935
|
bs->UninstallMultipleProtocolInterfaces (
|
|
921
|
936
|
snpdev->handle,
|