[pxe] Move all PXE files to arch/i386

The initial PXE implementation in Etherboot had the goal of being
architecture-agnostic, but this goal has not been realised.
This commit is contained in:
Michael Brown
2008-11-18 22:27:02 +00:00
parent fca2dcabb8
commit 446b6d5fdd
10 changed files with 0 additions and 0 deletions

151
src/arch/i386/include/pxe.h Normal file
View File

@@ -0,0 +1,151 @@
#ifndef PXE_H
#define PXE_H
#include "pxe_types.h"
#include "pxe_api.h"
#include <gpxe/device.h>
/* Parameter block for pxenv_unknown() */
struct s_PXENV_UNKNOWN {
PXENV_STATUS_t Status; /**< PXE status code */
} PACKED;
typedef struct s_PXENV_UNKNOWN PXENV_UNKNOWN_t;
/* Union used for PXE API calls; we don't know the type of the
* structure until we interpret the opcode. Also, Status is available
* in the same location for any opcode, and it's convenient to have
* non-specific access to it.
*/
union u_PXENV_ANY {
/* Make it easy to read status for any operation */
PXENV_STATUS_t Status;
struct s_PXENV_UNKNOWN unknown;
struct s_PXENV_UNLOAD_STACK unload_stack;
struct s_PXENV_GET_CACHED_INFO get_cached_info;
struct s_PXENV_TFTP_READ_FILE restart_tftp;
struct s_PXENV_START_UNDI start_undi;
struct s_PXENV_STOP_UNDI stop_undi;
struct s_PXENV_START_BASE start_base;
struct s_PXENV_STOP_BASE stop_base;
struct s_PXENV_TFTP_OPEN tftp_open;
struct s_PXENV_TFTP_CLOSE tftp_close;
struct s_PXENV_TFTP_READ tftp_read;
struct s_PXENV_TFTP_READ_FILE tftp_read_file;
struct s_PXENV_TFTP_GET_FSIZE tftp_get_fsize;
struct s_PXENV_UDP_OPEN udp_open;
struct s_PXENV_UDP_CLOSE udp_close;
struct s_PXENV_UDP_WRITE udp_write;
struct s_PXENV_UDP_READ udp_read;
struct s_PXENV_UNDI_STARTUP undi_startup;
struct s_PXENV_UNDI_CLEANUP undi_cleanup;
struct s_PXENV_UNDI_INITIALIZE undi_initialize;
struct s_PXENV_UNDI_RESET undi_reset_adapter;
struct s_PXENV_UNDI_SHUTDOWN undi_shutdown;
struct s_PXENV_UNDI_OPEN undi_open;
struct s_PXENV_UNDI_CLOSE undi_close;
struct s_PXENV_UNDI_TRANSMIT undi_transmit;
struct s_PXENV_UNDI_SET_MCAST_ADDRESS undi_set_mcast_address;
struct s_PXENV_UNDI_SET_STATION_ADDRESS undi_set_station_address;
struct s_PXENV_UNDI_SET_PACKET_FILTER undi_set_packet_filter;
struct s_PXENV_UNDI_GET_INFORMATION undi_get_information;
struct s_PXENV_UNDI_GET_STATISTICS undi_get_statistics;
struct s_PXENV_UNDI_CLEAR_STATISTICS undi_clear_statistics;
struct s_PXENV_UNDI_INITIATE_DIAGS undi_initiate_diags;
struct s_PXENV_UNDI_FORCE_INTERRUPT undi_force_interrupt;
struct s_PXENV_UNDI_GET_MCAST_ADDRESS undi_get_mcast_address;
struct s_PXENV_UNDI_GET_NIC_TYPE undi_get_nic_type;
struct s_PXENV_UNDI_GET_IFACE_INFO undi_get_iface_info;
struct s_PXENV_UNDI_GET_STATE undi_get_state;
struct s_PXENV_UNDI_ISR undi_isr;
struct s_PXENV_FILE_OPEN file_open;
struct s_PXENV_FILE_CLOSE file_close;
struct s_PXENV_FILE_SELECT file_select;
struct s_PXENV_FILE_READ file_read;
struct s_PXENV_GET_FILE_SIZE get_file_size;
struct s_PXENV_FILE_EXEC file_exec;
struct s_PXENV_FILE_API_CHECK file_api_check;
};
typedef union u_PXENV_ANY PXENV_ANY_t;
/** An UNDI expansion ROM header */
struct undi_rom_header {
/** Signature
*
* Must be equal to @c ROM_SIGNATURE
*/
UINT16_t Signature;
/** ROM length in 512-byte blocks */
UINT8_t ROMLength;
/** Unused */
UINT8_t unused[0x13];
/** Offset of the PXE ROM ID structure */
UINT16_t PXEROMID;
/** Offset of the PCI ROM structure */
UINT16_t PCIRHeader;
} PACKED;
/** Signature for an expansion ROM */
#define ROM_SIGNATURE 0xaa55
/** An UNDI ROM ID structure */
struct undi_rom_id {
/** Signature
*
* Must be equal to @c UNDI_ROM_ID_SIGNATURE
*/
UINT32_t Signature;
/** Length of structure */
UINT8_t StructLength;
/** Checksum */
UINT8_t StructCksum;
/** Structure revision
*
* Must be zero.
*/
UINT8_t StructRev;
/** UNDI revision
*
* Version 2.1.0 is encoded as the byte sequence 0x00, 0x01, 0x02.
*/
UINT8_t UNDIRev[3];
/** Offset to UNDI loader */
UINT16_t UNDILoader;
/** Minimum required stack segment size */
UINT16_t StackSize;
/** Minimum required data segment size */
UINT16_t DataSize;
/** Minimum required code segment size */
UINT16_t CodeSize;
} PACKED;
/** Signature for an UNDI ROM ID structure */
#define UNDI_ROM_ID_SIGNATURE \
( ( 'U' << 0 ) + ( 'N' << 8 ) + ( 'D' << 16 ) + ( 'I' << 24 ) )
/** A PCI expansion header */
struct pcir_header {
/** Signature
*
* Must be equal to @c PCIR_SIGNATURE
*/
uint32_t signature;
/** PCI vendor ID */
uint16_t vendor_id;
/** PCI device ID */
uint16_t device_id;
} PACKED;
/** Signature for an UNDI ROM ID structure */
#define PCIR_SIGNATURE \
( ( 'P' << 0 ) + ( 'C' << 8 ) + ( 'I' << 16 ) + ( 'R' << 24 ) )
extern struct net_device *pxe_netdev;
extern void pxe_set_netdev ( struct net_device *netdev );
extern void pxe_set_cached_filename ( const unsigned char *filename );
#endif /* PXE_H */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,125 @@
#ifndef PXE_TYPES_H
#define PXE_TYPES_H
/** @file
*
* PXE data types
*
*/
#include <stdint.h>
#include <errno.h> /* PXE status codes */
/** @addtogroup pxe Preboot eXecution Environment (PXE) API
* @{
*/
/** @defgroup pxe_types PXE data types
*
* Basic PXE data types such as #UINT16_t, #ADDR32_t, #SEGSEL_t etc.
*
* These definitions are based on Table 1-1 ("Data Type Definitions")
* in the Intel PXE specification version 2.1. They have been
* generalised to non-x86 architectures where possible.
*
* @{
*/
/** An 8-bit unsigned integer */
typedef uint8_t UINT8_t;
/** A 16-bit unsigned integer */
typedef uint16_t UINT16_t;
/** A 32-bit unsigned integer */
typedef uint32_t UINT32_t;
/** A PXE exit code.
*
* Permitted values are #PXENV_EXIT_SUCCESS and #PXENV_EXIT_FAILURE.
*
*/
typedef UINT16_t PXENV_EXIT_t;
#define PXENV_EXIT_SUCCESS 0x0000 /**< No error occurred */
#define PXENV_EXIT_FAILURE 0x0001 /**< An error occurred */
/** A PXE status code.
*
* Status codes are defined in errno.h.
*
*/
typedef UINT16_t PXENV_STATUS_t;
/** An IPv4 address.
*
* @note This data type is in network (big-endian) byte order.
*
*/
typedef UINT32_t IP4_t;
/** A UDP port.
*
* @note This data type is in network (big-endian) byte order.
*
*/
typedef UINT16_t UDP_PORT_t;
/** Maximum length of a MAC address */
#define MAC_ADDR_LEN 16
/** A MAC address */
typedef UINT8_t MAC_ADDR_t[MAC_ADDR_LEN];
#ifndef HAVE_ARCH_ADDR32
/** A physical address.
*
* For x86, this is a 32-bit physical address, and is therefore
* limited to the low 4GB.
*
*/
typedef UINT32_t ADDR32_t;
#endif
#ifndef HAVE_ARCH_SEGSEL
/** A segment selector.
*
* For x86, this is a real mode segment (0x0000-0xffff), or a
* protected-mode segment selector, such as could be loaded into a
* segment register.
*
*/
typedef UINT16_t SEGSEL_t;
#endif
#ifndef HAVE_ARCH_OFF16
/** An offset within a segment identified by #SEGSEL
*
* For x86, this is a 16-bit offset.
*
*/
typedef UINT16_t OFF16_t;
#endif
/** A segment:offset address
*
* For x86, this is a 16-bit real-mode or protected-mode
* segment:offset address.
*
*/
typedef struct s_SEGOFF16 {
OFF16_t offset; /**< Offset within the segment */
SEGSEL_t segment; /**< Segment selector */
} PACKED SEGOFF16_t;
/** A segment descriptor */
typedef struct s_SEGDESC {
SEGSEL_t segment_address; /**< Segment selector */
ADDR32_t Physical_address; /**< Segment base address */
OFF16_t Seg_size; /**< Size of the segment */
} PACKED SEGDESC_t;
/** @} */ /* pxe_types */
/** @} */ /* pxe */
#endif /* PXE_TYPES_H */