iPXE
pxe.h
Go to the documentation of this file.
1#ifndef PXE_H
2#define PXE_H
3
4FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
5
6#include "pxe_types.h"
7#include "pxe_error.h"
8#include "pxe_api.h"
9#include <ipxe/device.h>
10#include <ipxe/tables.h>
11
12/** PXE API invalid function code */
13#define PXENV_UNKNOWN 0xffff
14
15/** Parameter block for pxenv_unknown() */
17 PXENV_STATUS_t Status; /**< PXE status code */
18} __attribute__ (( packed ));
19
21
22/* Union used for PXE API calls; we don't know the type of the
23 * structure until we interpret the opcode. Also, Status is available
24 * in the same location for any opcode, and it's convenient to have
25 * non-specific access to it.
26 */
28 /* Make it easy to read status for any operation */
76};
77
79
80/** A PXE API call */
82 /** Entry point
83 *
84 * @v params PXE API call parameters
85 * @ret exit PXE API call exit code
86 */
87 PXENV_EXIT_t ( * entry ) ( union u_PXENV_ANY *params );
88 /** Opcode */
90};
91
92/** PXE API call table */
93#define PXE_API_CALLS __table ( struct pxe_api_call, "pxe_api_calls" )
94
95/** Declare a PXE API call */
96#define __pxe_api_call __table_entry ( PXE_API_CALLS, 01 )
97
98/**
99 * Define a PXE API call
100 *
101 * @v _opcode Opcode
102 * @v _entry Entry point
103 * @v _params_type Type of parameter structure
104 * @ret call PXE API call
105 */
106#define PXE_API_CALL( _opcode, _entry, _params_type ) { \
107 .entry = ( ( ( ( PXENV_EXIT_t ( * ) ( _params_type *params ) ) NULL ) \
108 == ( ( typeof ( _entry ) * ) NULL ) ) \
109 ? ( ( PXENV_EXIT_t ( * ) \
110 ( union u_PXENV_ANY *params ) ) _entry ) \
111 : ( ( PXENV_EXIT_t ( * ) \
112 ( union u_PXENV_ANY *params ) ) _entry ) ), \
113 .opcode = _opcode, \
114 }
115
116/** An UNDI expansion ROM header */
118 /** Signature
119 *
120 * Must be equal to @c ROM_SIGNATURE
121 */
123 /** ROM length in 512-byte blocks */
125 /** Unused */
127 /** Offset of the PXE ROM ID structure */
129 /** Offset of the PCI ROM structure */
131} __attribute__ (( packed ));
132
133/** Signature for an expansion ROM */
134#define ROM_SIGNATURE 0xaa55
135
136/** An UNDI ROM ID structure */
138 /** Signature
139 *
140 * Must be equal to @c UNDI_ROM_ID_SIGNATURE
141 */
143 /** Length of structure */
145 /** Checksum */
147 /** Structure revision
148 *
149 * Must be zero.
150 */
152 /** UNDI revision
153 *
154 * Version 2.1.0 is encoded as the byte sequence 0x00, 0x01, 0x02.
155 */
157 /** Offset to UNDI loader */
159 /** Minimum required stack segment size */
161 /** Minimum required data segment size */
163 /** Minimum required code segment size */
165} __attribute__ (( packed ));
166
167/** Signature for an UNDI ROM ID structure */
168#define UNDI_ROM_ID_SIGNATURE \
169 ( ( 'U' << 0 ) + ( 'N' << 8 ) + ( 'D' << 16 ) + ( 'I' << 24 ) )
170
171/** A PCI expansion header */
173 /** Signature
174 *
175 * Must be equal to @c PCIR_SIGNATURE
176 */
178 /** PCI vendor ID */
180 /** PCI device ID */
182} __attribute__ (( packed ));
183
184/** Signature for an UNDI ROM ID structure */
185#define PCIR_SIGNATURE \
186 ( ( 'P' << 0 ) + ( 'C' << 8 ) + ( 'I' << 16 ) + ( 'R' << 24 ) )
187
188extern struct net_device *pxe_netdev;
189extern const char *pxe_cmdline;
190
191extern void pxe_set_netdev ( struct net_device *netdev );
192extern void pxe_fake_cached_info ( void );
194 *tftp_read_file );
196
197#endif /* PXE_H */
unsigned short uint16_t
Definition stdint.h:11
unsigned int uint32_t
Definition stdint.h:12
Device model.
static struct net_device * netdev
Definition gdbudp.c:53
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
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
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
#define __attribute__(x)
Definition compiler.h:10
struct s_PXENV_UNKNOWN PXENV_UNKNOWN_t
Definition pxe.h:20
void pxe_set_netdev(struct net_device *netdev)
Set network device as current PXE network device.
Definition pxe_undi.c:69
PXENV_EXIT_t pxenv_tftp_read_file(struct s_PXENV_TFTP_READ_FILE *tftp_read_file)
TFTP/MTFTP read file.
Definition pxe_tftp.c:478
union u_PXENV_ANY PXENV_ANY_t
Definition pxe.h:78
void pxe_fake_cached_info(void)
Construct cached DHCP packets.
Preboot eXecution Environment (PXE) API.
Preboot eXecution Environment (PXE) error definitions.
const char * pxe_cmdline
PXE command line.
Definition pxe_image.c:48
PXE data types.
struct net_device * pxe_netdev
Definition pxe_undi.c:59
A network device.
Definition netdevice.h:353
A PCI expansion header.
Definition pxe.h:172
uint32_t signature
Signature.
Definition pxe.h:177
uint16_t device_id
PCI device ID.
Definition pxe.h:181
uint16_t vendor_id
PCI vendor ID.
Definition pxe.h:179
A PXE API call.
Definition pxe.h:81
uint16_t opcode
Opcode.
Definition pxe.h:89
PXENV_EXIT_t(* entry)(union u_PXENV_ANY *params)
Entry point.
Definition pxe.h:87
Parameter block for pxenv_file_api_check()
Definition pxe_api.h:1665
Parameter block for pxenv_file_close()
Definition pxe_api.h:1558
Parameter block for pxenv_file_exec()
Definition pxe_api.h:1645
Parameter block for pxenv_file_exit_hook()
Definition pxe_api.h:1689
Parameter block for pxenv_file_open()
Definition pxe_api.h:1536
Parameter block for pxenv_file_read()
Definition pxe_api.h:1602
Parameter block for pxenv_file_select()
Definition pxe_api.h:1581
Parameter block for pxenv_get_cached_info()
Definition pxe_api.h:286
Parameter block for pxenv_get_file_size()
Definition pxe_api.h:1624
Parameter block for pxenv_start_base()
Definition pxe_api.h:527
Parameter block for pxenv_start_undi()
Definition pxe_api.h:438
Parameter block for pxenv_stop_base()
Definition pxe_api.h:546
Parameter block for pxenv_stop_undi()
Definition pxe_api.h:508
Parameter block for pxenv_tftp_close()
Definition pxe_api.h:604
Parameter block for pxenv_tftp_get_fsize()
Definition pxe_api.h:688
Parameter block for pxenv_tftp_open()
Definition pxe_api.h:574
Parameter block for pxenv_tftp_read_file()
Definition pxe_api.h:645
Parameter block for pxenv_tftp_read()
Definition pxe_api.h:623
Parameter block for pxenv_udp_close()
Definition pxe_api.h:740
Parameter block for pxenv_udp_open()
Definition pxe_api.h:720
Parameter block for pxenv_udp_read()
Definition pxe_api.h:784
Parameter block for pxenv_udp_write()
Definition pxe_api.h:759
Parameter block for pxenv_undi_cleanup()
Definition pxe_api.h:844
Parameter block for pxenv_undi_clear_statistics()
Definition pxe_api.h:1224
Parameter block for pxenv_undi_close()
Definition pxe_api.h:993
Parameter block for pxenv_undi_force_interrupt()
Definition pxe_api.h:1262
Parameter block for pxenv_undi_get_iface_info()
Definition pxe_api.h:1381
Parameter block for pxenv_undi_get_information()
Definition pxe_api.h:1166
Parameter block for pxenv_undi_get_mcast_address()
Definition pxe_api.h:1281
Parameter block for pxenv_undi_get_nic_type()
Definition pxe_api.h:1329
Parameter block for pxenv_undi_get_state()
Definition pxe_api.h:1427
Parameter block for pxenv_undi_get_statistics()
Definition pxe_api.h:1201
Parameter block for pxenv_undi_initialize()
Definition pxe_api.h:863
Parameter block for pxenv_undi_initiate_diags()
Definition pxe_api.h:1243
Parameter block for pxenv_undi_isr()
Definition pxe_api.h:1479
Parameter block for pxenv_undi_open()
Definition pxe_api.h:958
Parameter block for pxenv_undi_reset_adapter()
Definition pxe_api.h:904
Parameter block for pxenv_undi_set_mcast_address()
Definition pxe_api.h:1087
Parameter block for pxenv_undi_set_packet_filter()
Definition pxe_api.h:1128
Parameter block for pxenv_undi_set_station_address()
Definition pxe_api.h:1108
Parameter block for pxenv_undi_shutdown()
Definition pxe_api.h:925
Parameter block for pxenv_undi_startup()
Definition pxe_api.h:825
Parameter block for pxenv_undi_transmit()
Definition pxe_api.h:1049
Parameter block for pxenv_unknown()
Definition pxe.h:16
PXENV_STATUS_t Status
PXE status code.
Definition pxe.h:17
Parameter block for pxenv_unload_stack()
Definition pxe_api.h:253
Parameter block for undi_loader()
Definition pxe_api.h:1729
An UNDI expansion ROM header.
Definition pxe.h:117
UINT16_t PCIRHeader
Offset of the PCI ROM structure.
Definition pxe.h:130
UINT8_t ROMLength
ROM length in 512-byte blocks.
Definition pxe.h:124
UINT16_t PXEROMID
Offset of the PXE ROM ID structure.
Definition pxe.h:128
UINT8_t unused[0x13]
Unused.
Definition pxe.h:126
UINT16_t Signature
Signature.
Definition pxe.h:122
An UNDI ROM ID structure.
Definition pxe.h:137
UINT16_t UNDILoader
Offset to UNDI loader.
Definition pxe.h:158
UINT16_t StackSize
Minimum required stack segment size.
Definition pxe.h:160
UINT32_t Signature
Signature.
Definition pxe.h:142
UINT16_t CodeSize
Minimum required code segment size.
Definition pxe.h:164
UINT8_t StructRev
Structure revision.
Definition pxe.h:151
UINT8_t UNDIRev[3]
UNDI revision.
Definition pxe.h:156
UINT8_t StructLength
Length of structure.
Definition pxe.h:144
UINT16_t DataSize
Minimum required data segment size.
Definition pxe.h:162
UINT8_t StructCksum
Checksum.
Definition pxe.h:146
Linker tables.
#define undi_loader
Definition undiload.c:53
struct s_PXENV_UNDI_INITIALIZE undi_initialize
Definition pxe.h:49
struct s_PXENV_UNDI_GET_MCAST_ADDRESS undi_get_mcast_address
Definition pxe.h:63
struct s_PXENV_UNDI_FORCE_INTERRUPT undi_force_interrupt
Definition pxe.h:62
struct s_PXENV_TFTP_READ_FILE tftp_read_file
Definition pxe.h:41
struct s_PXENV_UNDI_GET_STATISTICS undi_get_statistics
Definition pxe.h:59
struct s_PXENV_UNDI_CLEAR_STATISTICS undi_clear_statistics
Definition pxe.h:60
struct s_PXENV_UDP_WRITE udp_write
Definition pxe.h:45
struct s_PXENV_START_UNDI start_undi
Definition pxe.h:34
struct s_PXENV_UNDI_INITIATE_DIAGS undi_initiate_diags
Definition pxe.h:61
struct s_PXENV_FILE_READ file_read
Definition pxe.h:71
struct s_PXENV_UNDI_GET_IFACE_INFO undi_get_iface_info
Definition pxe.h:65
struct s_PXENV_UNDI_GET_INFORMATION undi_get_information
Definition pxe.h:58
PXENV_STATUS_t Status
Definition pxe.h:29
struct s_PXENV_UDP_CLOSE udp_close
Definition pxe.h:44
struct s_PXENV_UNDI_SET_PACKET_FILTER undi_set_packet_filter
Definition pxe.h:57
struct s_PXENV_STOP_BASE stop_base
Definition pxe.h:37
struct s_PXENV_FILE_EXIT_HOOK file_exit_hook
Definition pxe.h:75
struct s_PXENV_UNKNOWN unknown
Definition pxe.h:30
struct s_PXENV_UDP_READ udp_read
Definition pxe.h:46
struct s_PXENV_TFTP_GET_FSIZE tftp_get_fsize
Definition pxe.h:42
struct s_PXENV_UNDI_SHUTDOWN undi_shutdown
Definition pxe.h:51
struct s_PXENV_FILE_SELECT file_select
Definition pxe.h:70
struct s_PXENV_FILE_EXEC file_exec
Definition pxe.h:73
struct s_PXENV_FILE_CLOSE file_close
Definition pxe.h:69
struct s_PXENV_TFTP_READ tftp_read
Definition pxe.h:40
struct s_PXENV_UNDI_SET_MCAST_ADDRESS undi_set_mcast_address
Definition pxe.h:55
struct s_PXENV_UNDI_STARTUP undi_startup
Definition pxe.h:47
struct s_PXENV_FILE_OPEN file_open
Definition pxe.h:68
struct s_PXENV_STOP_UNDI stop_undi
Definition pxe.h:35
struct s_PXENV_GET_FILE_SIZE get_file_size
Definition pxe.h:72
struct s_PXENV_TFTP_CLOSE tftp_close
Definition pxe.h:39
struct s_PXENV_GET_CACHED_INFO get_cached_info
Definition pxe.h:32
struct s_PXENV_UNDI_TRANSMIT undi_transmit
Definition pxe.h:54
struct s_PXENV_FILE_API_CHECK file_api_check
Definition pxe.h:74
struct s_PXENV_UNDI_OPEN undi_open
Definition pxe.h:52
struct s_PXENV_UNDI_RESET undi_reset_adapter
Definition pxe.h:50
struct s_PXENV_UNDI_GET_NIC_TYPE undi_get_nic_type
Definition pxe.h:64
struct s_PXENV_UNDI_SET_STATION_ADDRESS undi_set_station_address
Definition pxe.h:56
struct s_PXENV_UDP_OPEN udp_open
Definition pxe.h:43
struct s_PXENV_UNDI_ISR undi_isr
Definition pxe.h:67
struct s_PXENV_TFTP_READ_FILE restart_tftp
Definition pxe.h:33
struct s_PXENV_UNLOAD_STACK unload_stack
Definition pxe.h:31
struct s_PXENV_TFTP_OPEN tftp_open
Definition pxe.h:38
struct s_PXENV_UNDI_GET_STATE undi_get_state
Definition pxe.h:66
struct s_PXENV_UNDI_CLOSE undi_close
Definition pxe.h:53
struct s_PXENV_UNDI_CLEANUP undi_cleanup
Definition pxe.h:48
struct s_PXENV_START_BASE start_base
Definition pxe.h:36