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.

pxe.h 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #ifndef PXE_H
  2. #define PXE_H
  3. #include "pxe_types.h"
  4. #include "pxe_api.h"
  5. /* Parameter block for pxenv_unknown() */
  6. struct s_PXENV_UNKNOWN {
  7. PXENV_STATUS_t Status; /**< PXE status code */
  8. } PACKED;
  9. typedef struct s_PXENV_UNKNOWN PXENV_UNKNOWN_t;
  10. /* Union used for PXE API calls; we don't know the type of the
  11. * structure until we interpret the opcode. Also, Status is available
  12. * in the same location for any opcode, and it's convenient to have
  13. * non-specific access to it.
  14. */
  15. union u_PXENV_ANY {
  16. /* Make it easy to read status for any operation */
  17. PXENV_STATUS_t Status;
  18. struct s_PXENV_UNKNOWN unknown;
  19. struct s_PXENV_UNLOAD_STACK unload_stack;
  20. struct s_PXENV_GET_CACHED_INFO get_cached_info;
  21. struct s_PXENV_TFTP_READ_FILE restart_tftp;
  22. struct s_PXENV_START_UNDI start_undi;
  23. struct s_PXENV_STOP_UNDI stop_undi;
  24. struct s_PXENV_START_BASE start_base;
  25. struct s_PXENV_STOP_BASE stop_base;
  26. struct s_PXENV_TFTP_OPEN tftp_open;
  27. struct s_PXENV_TFTP_CLOSE tftp_close;
  28. struct s_PXENV_TFTP_READ tftp_read;
  29. struct s_PXENV_TFTP_READ_FILE tftp_read_file;
  30. struct s_PXENV_TFTP_GET_FSIZE tftp_get_fsize;
  31. struct s_PXENV_UDP_OPEN udp_open;
  32. struct s_PXENV_UDP_CLOSE udp_close;
  33. struct s_PXENV_UDP_WRITE udp_write;
  34. struct s_PXENV_UDP_READ udp_read;
  35. struct s_PXENV_UNDI_STARTUP undi_startup;
  36. struct s_PXENV_UNDI_CLEANUP undi_cleanup;
  37. struct s_PXENV_UNDI_INITIALIZE undi_initialize;
  38. struct s_PXENV_UNDI_RESET undi_reset_adapter;
  39. struct s_PXENV_UNDI_SHUTDOWN undi_shutdown;
  40. struct s_PXENV_UNDI_OPEN undi_open;
  41. struct s_PXENV_UNDI_CLOSE undi_close;
  42. struct s_PXENV_UNDI_TRANSMIT undi_transmit;
  43. struct s_PXENV_UNDI_SET_MCAST_ADDRESS undi_set_mcast_address;
  44. struct s_PXENV_UNDI_SET_STATION_ADDRESS undi_set_station_address;
  45. struct s_PXENV_UNDI_SET_PACKET_FILTER undi_set_packet_filter;
  46. struct s_PXENV_UNDI_GET_INFORMATION undi_get_information;
  47. struct s_PXENV_UNDI_GET_STATISTICS undi_get_statistics;
  48. struct s_PXENV_UNDI_CLEAR_STATISTICS undi_clear_statistics;
  49. struct s_PXENV_UNDI_INITIATE_DIAGS undi_initiate_diags;
  50. struct s_PXENV_UNDI_FORCE_INTERRUPT undi_force_interrupt;
  51. struct s_PXENV_UNDI_GET_MCAST_ADDRESS undi_get_mcast_address;
  52. struct s_PXENV_UNDI_GET_NIC_TYPE undi_get_nic_type;
  53. struct s_PXENV_UNDI_GET_IFACE_INFO undi_get_iface_info;
  54. struct s_PXENV_UNDI_GET_STATE undi_get_state;
  55. struct s_PXENV_UNDI_ISR undi_isr;
  56. };
  57. typedef union u_PXENV_ANY PXENV_ANY_t;
  58. /* PXE stack status indicator. See pxe_export.c for further
  59. * explanation.
  60. */
  61. typedef enum {
  62. CAN_UNLOAD = 0,
  63. MIDWAY,
  64. READY
  65. } pxe_stack_state_t;
  66. #define ENSURE_CAN_UNLOAD(structure) if ( ! ensure_pxe_state(CAN_UNLOAD) ) { \
  67. structure->Status = PXENV_STATUS_UNDI_INVALID_STATE; \
  68. return PXENV_EXIT_FAILURE; }
  69. #define ENSURE_MIDWAY(structure) if ( ! ensure_pxe_state(MIDWAY) ) { \
  70. structure->Status = PXENV_STATUS_UNDI_INVALID_STATE; \
  71. return PXENV_EXIT_FAILURE; }
  72. #define ENSURE_READY(structure) if ( ! ensure_pxe_state(READY) ) { \
  73. structure->Status = PXENV_STATUS_UNDI_INVALID_STATE; \
  74. return PXENV_EXIT_FAILURE; }
  75. /* Data structures installed as part of a PXE stack. Architectures
  76. * will have extra information to append to the end of this.
  77. */
  78. #define PXE_TFTP_MAGIC_COOKIE ( ( 'P'<<24 ) | ( 'x'<<16 ) | ( 'T'<<8 ) | 'f' )
  79. typedef struct pxe_stack {
  80. struct s_PXE pxe __attribute__ ((aligned(16)));
  81. struct s_PXENV pxenv __attribute__ ((aligned(16)));
  82. pxe_stack_state_t state;
  83. } pxe_stack_t;
  84. extern int ensure_pxe_state ( pxe_stack_state_t wanted );
  85. extern pxe_stack_t *pxe_stack;
  86. extern struct net_device *pxe_netdev;
  87. #endif /* PXE_H */