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.5KB

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