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_types.h 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. #ifndef PXE_TYPES_H
  2. #define PXE_TYPES_H
  3. /** @file
  4. *
  5. * PXE data types
  6. *
  7. */
  8. FILE_LICENCE ( GPL2_OR_LATER );
  9. #include <stdint.h>
  10. #include <errno.h> /* PXE status codes */
  11. /** @addtogroup pxe Preboot eXecution Environment (PXE) API
  12. * @{
  13. */
  14. /** @defgroup pxe_types PXE data types
  15. *
  16. * Basic PXE data types such as #UINT16_t, #ADDR32_t, #SEGSEL_t etc.
  17. *
  18. * These definitions are based on Table 1-1 ("Data Type Definitions")
  19. * in the Intel PXE specification version 2.1. They have been
  20. * generalised to non-x86 architectures where possible.
  21. *
  22. * @{
  23. */
  24. /** An 8-bit unsigned integer */
  25. typedef uint8_t UINT8_t;
  26. /** A 16-bit unsigned integer */
  27. typedef uint16_t UINT16_t;
  28. /** A 32-bit unsigned integer */
  29. typedef uint32_t UINT32_t;
  30. /** A PXE exit code.
  31. *
  32. * Permitted values are #PXENV_EXIT_SUCCESS and #PXENV_EXIT_FAILURE.
  33. *
  34. */
  35. typedef UINT16_t PXENV_EXIT_t;
  36. #define PXENV_EXIT_SUCCESS 0x0000 /**< No error occurred */
  37. #define PXENV_EXIT_FAILURE 0x0001 /**< An error occurred */
  38. /** A PXE status code.
  39. *
  40. * Status codes are defined in errno.h.
  41. *
  42. */
  43. typedef UINT16_t PXENV_STATUS_t;
  44. /** An IPv4 address.
  45. *
  46. * @note This data type is in network (big-endian) byte order.
  47. *
  48. */
  49. typedef UINT32_t IP4_t;
  50. /** A UDP port.
  51. *
  52. * @note This data type is in network (big-endian) byte order.
  53. *
  54. */
  55. typedef UINT16_t UDP_PORT_t;
  56. /** Maximum length of a MAC address */
  57. #define MAC_ADDR_LEN 16
  58. /** A MAC address */
  59. typedef UINT8_t MAC_ADDR_t[MAC_ADDR_LEN];
  60. #ifndef HAVE_ARCH_ADDR32
  61. /** A physical address.
  62. *
  63. * For x86, this is a 32-bit physical address, and is therefore
  64. * limited to the low 4GB.
  65. *
  66. */
  67. typedef UINT32_t ADDR32_t;
  68. #endif
  69. #ifndef HAVE_ARCH_SEGSEL
  70. /** A segment selector.
  71. *
  72. * For x86, this is a real mode segment (0x0000-0xffff), or a
  73. * protected-mode segment selector, such as could be loaded into a
  74. * segment register.
  75. *
  76. */
  77. typedef UINT16_t SEGSEL_t;
  78. #endif
  79. #ifndef HAVE_ARCH_OFF16
  80. /** An offset within a segment identified by #SEGSEL
  81. *
  82. * For x86, this is a 16-bit offset.
  83. *
  84. */
  85. typedef UINT16_t OFF16_t;
  86. #endif
  87. /** A segment:offset address
  88. *
  89. * For x86, this is a 16-bit real-mode or protected-mode
  90. * segment:offset address.
  91. *
  92. */
  93. typedef struct s_SEGOFF16 {
  94. OFF16_t offset; /**< Offset within the segment */
  95. SEGSEL_t segment; /**< Segment selector */
  96. } __attribute__ (( packed )) SEGOFF16_t;
  97. /** A segment descriptor */
  98. typedef struct s_SEGDESC {
  99. SEGSEL_t segment_address; /**< Segment selector */
  100. ADDR32_t Physical_address; /**< Segment base address */
  101. OFF16_t Seg_size; /**< Size of the segment */
  102. } __attribute__ (( packed )) SEGDESC_t;
  103. /** @} */ /* pxe_types */
  104. /** @} */ /* pxe */
  105. #endif /* PXE_TYPES_H */