]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[efi] Add last_opened_snpdev()
authorMichael Brown <mcb30@ipxe.org>
Wed, 13 Mar 2013 22:34:06 +0000 (22:34 +0000)
committerMichael Brown <mcb30@ipxe.org>
Wed, 13 Mar 2013 22:42:15 +0000 (22:42 +0000)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/include/ipxe/efi/efi_snp.h
src/interface/efi/efi_snp.c

index c86760908b36c8906d80c7d7bcefc302a8857f0d..074d1b27dff261a8d38322ec28cf624588a1215c 100644 (file)
@@ -71,5 +71,6 @@ struct efi_snp_device {
 
 extern int efi_snp_hii_install ( struct efi_snp_device *snpdev );
 extern void efi_snp_hii_uninstall ( struct efi_snp_device *snpdev );
+extern struct efi_snp_device * last_opened_snpdev ( void );
 
 #endif /* _IPXE_EFI_SNP_H */
index 200275966d1c4059bb0959b8a3ad4b2cec3c3810..48a6f397eddd080984759d65dec1f85e110766a0 100644 (file)
@@ -1005,3 +1005,18 @@ struct net_driver efi_snp_driver __net_driver = {
        .notify = efi_snp_notify,
        .remove = efi_snp_remove,
 };
+
+/**
+ * Get most recently opened SNP device
+ *
+ * @ret snpdev         Most recently opened SNP device, or NULL
+ */
+struct efi_snp_device * last_opened_snpdev ( void ) {
+       struct net_device *netdev;
+
+       netdev = last_opened_netdev();
+       if ( ! netdev )
+               return NULL;
+
+       return efi_snp_demux ( netdev );
+}