iPXE
pxe_types.h
Go to the documentation of this file.
1#ifndef PXE_TYPES_H
2#define PXE_TYPES_H
3
4/** @file
5 *
6 * PXE data types
7 *
8 */
9
10FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11
12#include <stdint.h>
13#include <errno.h> /* PXE status codes */
14
15/** @addtogroup pxe Preboot eXecution Environment (PXE) API
16 * @{
17 */
18
19/** @defgroup pxe_types PXE data types
20 *
21 * Basic PXE data types such as #UINT16_t, #ADDR32_t, #SEGSEL_t etc.
22 *
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.
26 *
27 * @{
28 */
29
30/** An 8-bit unsigned integer */
32
33/** A 16-bit unsigned integer */
35
36/** A 32-bit unsigned integer */
38
39/** A PXE exit code.
40 *
41 * Permitted values are #PXENV_EXIT_SUCCESS and #PXENV_EXIT_FAILURE.
42 *
43 */
45#define PXENV_EXIT_SUCCESS 0x0000 /**< No error occurred */
46#define PXENV_EXIT_FAILURE 0x0001 /**< An error occurred */
47
48/** A PXE status code.
49 *
50 * Status codes are defined in errno.h.
51 *
52 */
54
55/** An IPv4 address.
56 *
57 * @note This data type is in network (big-endian) byte order.
58 *
59 */
61
62/** A UDP port.
63 *
64 * @note This data type is in network (big-endian) byte order.
65 *
66 */
68
69/** Maximum length of a MAC address */
70#define MAC_ADDR_LEN 16
71
72/** A MAC address */
74
75#ifndef HAVE_ARCH_ADDR32
76/** A physical address.
77 *
78 * For x86, this is a 32-bit physical address, and is therefore
79 * limited to the low 4GB.
80 *
81 */
83#endif
84
85#ifndef HAVE_ARCH_SEGSEL
86/** A segment selector.
87 *
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
90 * segment register.
91 *
92 */
94#endif
95
96#ifndef HAVE_ARCH_OFF16
97/** An offset within a segment identified by #SEGSEL
98 *
99 * For x86, this is a 16-bit offset.
100 *
101 */
103#endif
104
105/** A segment:offset address
106 *
107 * For x86, this is a 16-bit real-mode or protected-mode
108 * segment:offset address.
109 *
110 */
111typedef struct s_SEGOFF16 {
112 OFF16_t offset; /**< Offset within the segment */
113 SEGSEL_t segment; /**< Segment selector */
114} __attribute__ (( packed )) SEGOFF16_t;
115
116/** A segment descriptor */
117typedef 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;
122
123/** @} */ /* pxe_types */
124
125/** @} */ /* pxe */
126
127#endif /* PXE_TYPES_H */
unsigned short uint16_t
Definition stdint.h:11
unsigned int uint32_t
Definition stdint.h:12
unsigned char uint8_t
Definition stdint.h:10
Error codes.
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
UINT16_t OFF16_t
An offset within a segment identified by SEGSEL.
Definition pxe_types.h:102
UINT16_t PXENV_EXIT_t
A PXE exit code.
Definition pxe_types.h:44
uint32_t UINT32_t
A 32-bit unsigned integer.
Definition pxe_types.h:37
uint8_t UINT8_t
An 8-bit unsigned integer.
Definition pxe_types.h:31
UINT32_t IP4_t
An IPv4 address.
Definition pxe_types.h:60
UINT16_t UDP_PORT_t
A UDP port.
Definition pxe_types.h:67
UINT16_t PXENV_STATUS_t
A PXE status code.
Definition pxe_types.h:53
uint16_t UINT16_t
A 16-bit unsigned integer.
Definition pxe_types.h:34
UINT32_t ADDR32_t
A physical address.
Definition pxe_types.h:82
UINT16_t SEGSEL_t
A segment selector.
Definition pxe_types.h:93
UINT8_t MAC_ADDR_t[MAC_ADDR_LEN]
A MAC address.
Definition pxe_types.h:73
#define __attribute__(x)
Definition compiler.h:10
#define MAC_ADDR_LEN
A segment descriptor.
Definition pxe_types.h:117
SEGSEL_t segment_address
Segment selector.
Definition pxe_types.h:118
ADDR32_t Physical_address
Segment base address.
Definition pxe_types.h:119
OFF16_t Seg_size
Size of the segment.
Definition pxe_types.h:120
A segment:offset address.
Definition pxe_types.h:111
OFF16_t offset
Offset within the segment.
Definition pxe_types.h:112
SEGSEL_t segment
Segment selector.
Definition pxe_types.h:113