10 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
13 #include <errno.h> /* PXE status codes */
15 /** @addtogroup pxe Preboot eXecution Environment (PXE) API
19 /** @defgroup pxe_types PXE data types
21 * Basic PXE data types such as #UINT16_t, #ADDR32_t, #SEGSEL_t etc.
23 * These definitions are based on Table 1-1 ("Data Type Definitions")
24 * in the Intel PXE specification version 2.1. They have been
25 * generalised to non-x86 architectures where possible.
30 /** An 8-bit unsigned integer */
31 typedef uint8_t UINT8_t;
33 /** A 16-bit unsigned integer */
34 typedef uint16_t UINT16_t;
36 /** A 32-bit unsigned integer */
37 typedef uint32_t UINT32_t;
41 * Permitted values are #PXENV_EXIT_SUCCESS and #PXENV_EXIT_FAILURE.
44 typedef UINT16_t PXENV_EXIT_t;
45 #define PXENV_EXIT_SUCCESS 0x0000 /**< No error occurred */
46 #define PXENV_EXIT_FAILURE 0x0001 /**< An error occurred */
48 /** A PXE status code.
50 * Status codes are defined in errno.h.
53 typedef UINT16_t PXENV_STATUS_t;
57 * @note This data type is in network (big-endian) byte order.
60 typedef UINT32_t IP4_t;
64 * @note This data type is in network (big-endian) byte order.
67 typedef UINT16_t UDP_PORT_t;
69 /** Maximum length of a MAC address */
70 #define MAC_ADDR_LEN 16
73 typedef UINT8_t MAC_ADDR_t[MAC_ADDR_LEN];
75 #ifndef HAVE_ARCH_ADDR32
76 /** A physical address.
78 * For x86, this is a 32-bit physical address, and is therefore
79 * limited to the low 4GB.
82 typedef UINT32_t ADDR32_t;
85 #ifndef HAVE_ARCH_SEGSEL
86 /** A segment selector.
88 * For x86, this is a real mode segment (0x0000-0xffff), or a
89 * protected-mode segment selector, such as could be loaded into a
93 typedef UINT16_t SEGSEL_t;
96 #ifndef HAVE_ARCH_OFF16
97 /** An offset within a segment identified by #SEGSEL
99 * For x86, this is a 16-bit offset.
102 typedef UINT16_t OFF16_t;
105 /** A segment:offset address
107 * For x86, this is a 16-bit real-mode or protected-mode
108 * segment:offset address.
111 typedef struct s_SEGOFF16 {
112 OFF16_t offset; /**< Offset within the segment */
113 SEGSEL_t segment; /**< Segment selector */
114 } __attribute__ (( packed )) SEGOFF16_t;
116 /** A segment descriptor */
117 typedef struct s_SEGDESC {
118 SEGSEL_t segment_address; /**< Segment selector */
119 ADDR32_t Physical_address; /**< Segment base address */
120 OFF16_t Seg_size; /**< Size of the segment */
121 } __attribute__ (( packed )) SEGDESC_t;
123 /** @} */ /* pxe_types */
127 #endif /* PXE_TYPES_H */