You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

efi_snp.h 2.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #ifndef _IPXE_EFI_SNP_H
  2. #define _IPXE_EFI_SNP_H
  3. /** @file
  4. *
  5. * iPXE EFI SNP interface
  6. *
  7. */
  8. #include <ipxe/list.h>
  9. #include <ipxe/netdevice.h>
  10. #include <ipxe/efi/efi.h>
  11. #include <ipxe/efi/Protocol/SimpleNetwork.h>
  12. #include <ipxe/efi/Protocol/NetworkInterfaceIdentifier.h>
  13. #include <ipxe/efi/Protocol/ComponentName2.h>
  14. #include <ipxe/efi/Protocol/DevicePath.h>
  15. #include <ipxe/efi/Protocol/HiiConfigAccess.h>
  16. #include <ipxe/efi/Protocol/HiiDatabase.h>
  17. #include <ipxe/efi/Protocol/LoadFile.h>
  18. /** SNP transmit completion ring size */
  19. #define EFI_SNP_NUM_TX 32
  20. /** An SNP device */
  21. struct efi_snp_device {
  22. /** List of SNP devices */
  23. struct list_head list;
  24. /** The underlying iPXE network device */
  25. struct net_device *netdev;
  26. /** The underlying EFI device */
  27. struct efi_device *efidev;
  28. /** EFI device handle */
  29. EFI_HANDLE handle;
  30. /** The SNP structure itself */
  31. EFI_SIMPLE_NETWORK_PROTOCOL snp;
  32. /** The SNP "mode" (parameters) */
  33. EFI_SIMPLE_NETWORK_MODE mode;
  34. /** Started flag */
  35. int started;
  36. /** Pending interrupt status */
  37. unsigned int interrupts;
  38. /** Transmit completion ring */
  39. VOID *tx[EFI_SNP_NUM_TX];
  40. /** Transmit completion ring producer counter */
  41. unsigned int tx_prod;
  42. /** Transmit completion ring consumer counter */
  43. unsigned int tx_cons;
  44. /** Receive queue */
  45. struct list_head rx;
  46. /** The network interface identifier */
  47. EFI_NETWORK_INTERFACE_IDENTIFIER_PROTOCOL nii;
  48. /** Component name protocol */
  49. EFI_COMPONENT_NAME2_PROTOCOL name2;
  50. /** Load file protocol handle */
  51. EFI_LOAD_FILE_PROTOCOL load_file;
  52. /** HII configuration access protocol */
  53. EFI_HII_CONFIG_ACCESS_PROTOCOL hii;
  54. /** HII package list */
  55. EFI_HII_PACKAGE_LIST_HEADER *package_list;
  56. /** EFI child handle for HII association */
  57. EFI_HANDLE hii_child_handle;
  58. /** Device path of HII child handle */
  59. EFI_DEVICE_PATH_PROTOCOL *hii_child_path;
  60. /** HII handle */
  61. EFI_HII_HANDLE hii_handle;
  62. /** Device name */
  63. wchar_t name[ sizeof ( ( ( struct net_device * ) NULL )->name ) ];
  64. /** Driver name */
  65. wchar_t driver_name[16];
  66. /** Controller name */
  67. wchar_t controller_name[64];
  68. /** The device path */
  69. EFI_DEVICE_PATH_PROTOCOL *path;
  70. };
  71. extern int efi_snp_hii_install ( struct efi_snp_device *snpdev );
  72. extern void efi_snp_hii_uninstall ( struct efi_snp_device *snpdev );
  73. extern struct efi_snp_device * find_snpdev ( EFI_HANDLE handle );
  74. extern struct efi_snp_device * last_opened_snpdev ( void );
  75. extern void efi_snp_add_claim ( int delta );
  76. /**
  77. * Claim network devices for use by iPXE
  78. *
  79. */
  80. static inline void efi_snp_claim ( void ) {
  81. efi_snp_add_claim ( +1 );
  82. }
  83. /**
  84. * Release network devices for use via SNP
  85. *
  86. */
  87. static inline void efi_snp_release ( void ) {
  88. efi_snp_add_claim ( -1 );
  89. }
  90. #endif /* _IPXE_EFI_SNP_H */