iPXE
Macros | Functions | Variables
pxe_call.c File Reference

PXE API entry point. More...

#include <ipxe/uaccess.h>
#include <ipxe/init.h>
#include <ipxe/profile.h>
#include <ipxe/netdevice.h>
#include <rmsetjmp.h>
#include <registers.h>
#include <biosint.h>
#include <pxe.h>
#include <pxe_call.h>

Go to the source code of this file.

Macros

#define EINFO_EPXENBP
 
#define EPXENBP(status)   EPLATFORM ( EINFO_EPXENBP, status )
 
#define pxe_int_1a_vector   __use_text16 ( pxe_int_1a_vector )
 
#define _text16_memsz   ( ( size_t ) _text16_memsz )
 
#define _data16_memsz   ( ( size_t ) _data16_memsz )
 

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 
struct segoff __text16 (pxe_int_1a_vector)
 Vector for chaining INT 1A. More...
 
void pxe_int_1a (void)
 INT 1A handler. More...
 
static PXENV_EXIT_t pxenv_unknown (struct s_PXENV_UNKNOWN *pxenv_unknown)
 Handle an unknown PXE API call. More...
 
static struct pxe_api_callfind_pxe_api_call (uint16_t opcode)
 Locate PXE API call. More...
 
static struct profilerpxe_api_profiler (unsigned int opcode)
 Determine applicable profiler (for debugging) More...
 
__asmcall void pxe_api_call (struct i386_all_regs *ix86)
 Dispatch PXE API call. More...
 
int pxe_api_call_weak (struct i386_all_regs *ix86)
 Dispatch weak PXE API call with PXE stack available. More...
 
__asmcall void pxe_loader_call (struct i386_all_regs *ix86)
 Dispatch PXE loader call. More...
 
static uint8_t pxe_checksum (void *data, size_t size)
 Calculate byte checksum as used by PXE. More...
 
static void pxe_init_structures (void)
 Initialise !PXE and PXENV+ structures. More...
 
struct init_fn pxe_init_fn __init_fn (INIT_NORMAL)
 PXE structure initialiser. More...
 
void pxe_activate (struct net_device *netdev)
 Activate PXE stack. More...
 
int pxe_deactivate (void)
 Deactivate PXE stack. More...
 
int pxe_start_nbp (void)
 Start PXE NBP at 0000:7c00. More...
 
static int pxe_notify (struct net_device *netdev, void *priv __unused)
 Notify BIOS of existence of network device. More...
 
 REQUIRING_SYMBOL (pxe_api_call)
 
 REQUIRE_OBJECT (pxe_preboot)
 
 REQUIRE_OBJECT (pxe_undi)
 
 REQUIRE_OBJECT (pxe_udp)
 
 REQUIRE_OBJECT (pxe_tftp)
 
 REQUIRE_OBJECT (pxe_file)
 

Variables

static int int_1a_hooked = 0
 INT 1A hooked flag. More...
 
char _text16_memsz []
 Real-mode code segment size. More...
 
char _data16_memsz []
 Real-mode data segment size. More...
 
static struct profiler pxe_api_tx_profiler __profiler
 PXENV_UNDI_TRANSMIT API call profiler. More...
 
struct pxe_api_call pxenv_unknown_api __pxe_api_call
 Unknown PXE API call list. More...
 
rmjmp_buf pxe_restart_nbp
 Jump buffer for PXENV_RESTART_TFTP. More...
 
struct net_driver pxe_driver __net_driver
 PXE BIOS notification driver. More...
 

Detailed Description

PXE API entry point.

Definition in file pxe_call.c.

Macro Definition Documentation

◆ EINFO_EPXENBP

#define EINFO_EPXENBP
Value:
"External PXE NBP error" )
#define EINFO_EPLATFORM
Platform-generated base error.
Definition: errno.h:691
#define __einfo_uniqify(einfo_base, uniq, desc)
Declare disambiguated error.
Definition: errno.h:180

Definition at line 42 of file pxe_call.c.

◆ EPXENBP

#define EPXENBP (   status)    EPLATFORM ( EINFO_EPXENBP, status )

Definition at line 45 of file pxe_call.c.

◆ pxe_int_1a_vector

#define pxe_int_1a_vector   __use_text16 ( pxe_int_1a_vector )

Definition at line 49 of file pxe_call.c.

◆ _text16_memsz

#define _text16_memsz   ( ( size_t ) _text16_memsz )

Definition at line 59 of file pxe_call.c.

◆ _data16_memsz

#define _data16_memsz   ( ( size_t ) _data16_memsz )

Definition at line 63 of file pxe_call.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ __text16()

struct segoff __text16 ( pxe_int_1a_vector  )

Vector for chaining INT 1A.

◆ pxe_int_1a()

void pxe_int_1a ( void  )

INT 1A handler.

Referenced by pxe_activate(), and pxe_deactivate().

◆ pxenv_unknown()

static PXENV_EXIT_t pxenv_unknown ( struct s_PXENV_UNKNOWN pxenv_unknown)
static

Handle an unknown PXE API call.

Parameters
pxenv_unknownPointer to a struct s_PXENV_UNKNOWN
Return values
PXENV_EXIT_FAILUREAlways
Exceptions
PXENV_STATUS_UNSUPPORTEDAlways

Definition at line 92 of file pxe_call.c.

92  {
94  return PXENV_EXIT_FAILURE;
95 }
static PXENV_EXIT_t pxenv_unknown(struct s_PXENV_UNKNOWN *pxenv_unknown)
Handle an unknown PXE API call.
Definition: pxe_call.c:92
#define PXENV_EXIT_FAILURE
An error occurred.
Definition: pxe_types.h:46
#define PXENV_STATUS_UNSUPPORTED
Definition: pxe_error.h:22

References PXENV_EXIT_FAILURE, and PXENV_STATUS_UNSUPPORTED.

◆ find_pxe_api_call()

static struct pxe_api_call* find_pxe_api_call ( uint16_t  opcode)
static

Locate PXE API call.

Parameters
opcodeOpcode
Return values
callPXE API call, or NULL

Definition at line 107 of file pxe_call.c.

107  {
108  struct pxe_api_call *call;
109 
111  if ( call->opcode == opcode )
112  return call;
113  }
114  return NULL;
115 }
uint8_t opcode
Opcode.
Definition: ena.h:16
#define PXE_API_CALLS
PXE API call table.
Definition: pxe.h:95
#define for_each_table_entry(pointer, table)
Iterate through all entries within a linker table.
Definition: tables.h:385
uint16_t opcode
Opcode.
Definition: pxe.h:91
A PXE API call.
Definition: pxe.h:81
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321

References for_each_table_entry, NULL, opcode, pxe_api_call::opcode, and PXE_API_CALLS.

Referenced by pxe_api_call().

◆ pxe_api_profiler()

static struct profiler* pxe_api_profiler ( unsigned int  opcode)
static

Determine applicable profiler (for debugging)

Parameters
opcodePXE opcode
Return values
profilerProfiler

Definition at line 123 of file pxe_call.c.

123  {
124 
125  /* Determine applicable profiler */
126  switch ( opcode ) {
127  case PXENV_UNDI_TRANSMIT:
128  return &pxe_api_tx_profiler;
129  case PXENV_UNDI_ISR:
130  return &pxe_api_isr_profiler;
131  case PXENV_UNKNOWN:
132  return &pxe_api_unknown_profiler;
133  default:
134  return &pxe_api_misc_profiler;
135  }
136 }
uint8_t opcode
Opcode.
Definition: ena.h:16
#define PXENV_UNKNOWN
PXE API invalid function code.
Definition: pxe.h:13
#define PXENV_UNDI_TRANSMIT
PXE API function code for pxenv_undi_transmit()
Definition: pxe_api.h:1009
#define PXENV_UNDI_ISR
PXE API function code for pxenv_undi_isr()
Definition: pxe_api.h:1450

References opcode, PXENV_UNDI_ISR, PXENV_UNDI_TRANSMIT, and PXENV_UNKNOWN.

Referenced by pxe_api_call().

◆ pxe_api_call()

__asmcall void pxe_api_call ( struct i386_all_regs ix86)

Dispatch PXE API call.

Parameters
bxPXE opcode
es:diAddress of PXE parameter block
Return values
axPXE exit code

Definition at line 145 of file pxe_call.c.

145  {
146  uint16_t opcode = ix86->regs.bx;
147  userptr_t uparams = real_to_user ( ix86->segs.es, ix86->regs.di );
149  struct pxe_api_call *call;
150  union u_PXENV_ANY params;
151  PXENV_EXIT_t ret;
152 
153  /* Start profiling */
155 
156  /* Locate API call */
157  call = find_pxe_api_call ( opcode );
158  if ( ! call ) {
159  DBGC ( &pxe_netdev, "PXENV_UNKNOWN_%04x\n", opcode );
160  call = &pxenv_unknown_api;
161  }
162 
163  /* Copy parameter block from caller */
164  copy_from_user ( &params, uparams, 0, call->params_len );
165 
166  /* Set default status in case child routine fails to do so */
167  params.Status = PXENV_STATUS_FAILURE;
168 
169  /* Hand off to relevant API routine */
170  ret = call->entry ( &params );
171 
172  /* Copy modified parameter block back to caller and return */
173  copy_to_user ( uparams, 0, &params, call->params_len );
174  ix86->regs.ax = ret;
175 
176  /* Stop profiling, if applicable */
178 }
unsigned short uint16_t
Definition: stdint.h:11
struct i386_seg_regs segs
Definition: registers.h:175
uint8_t opcode
Opcode.
Definition: ena.h:16
uint16_t es
Definition: registers.h:142
static __always_inline void copy_from_user(void *dest, userptr_t src, off_t src_off, size_t len)
Copy data from user buffer.
Definition: uaccess.h:337
#define DBGC(...)
Definition: compiler.h:505
A data structure for storing profiling information.
Definition: profile.h:26
static void profile_stop(struct profiler *profiler)
Stop profiling.
Definition: profile.h:171
static struct profiler * pxe_api_profiler(unsigned int opcode)
Determine applicable profiler (for debugging)
Definition: pxe_call.c:123
UINT16_t PXENV_EXIT_t
A PXE exit code.
Definition: pxe_types.h:44
struct i386_regs regs
Definition: registers.h:176
static void profile_start(struct profiler *profiler)
Start profiling.
Definition: profile.h:158
uint16_t bx
Definition: registers.h:84
struct net_device * pxe_netdev
Definition: pxe_undi.c:59
static __always_inline void copy_to_user(userptr_t dest, off_t dest_off, const void *src, size_t len)
Copy data to user buffer.
Definition: uaccess.h:324
uint16_t params_len
Length of parameters.
Definition: pxe.h:89
A PXE API call.
Definition: pxe.h:81
uint16_t di
Definition: registers.h:64
uint16_t ax
Definition: registers.h:108
static struct pxe_api_call * find_pxe_api_call(uint16_t opcode)
Locate PXE API call.
Definition: pxe_call.c:107
static __always_inline userptr_t real_to_user(unsigned int segment, unsigned int offset)
Convert segment:offset address to user buffer.
Definition: realmode.h:75
PXENV_EXIT_t(* entry)(union u_PXENV_ANY *params)
Entry point.
Definition: pxe.h:87
#define PXENV_STATUS_FAILURE
Definition: pxe_error.h:20
unsigned long userptr_t
A pointer to a user buffer.
Definition: uaccess.h:33

References i386_regs::ax, i386_regs::bx, copy_from_user(), copy_to_user(), DBGC, i386_regs::di, pxe_api_call::entry, i386_seg_regs::es, find_pxe_api_call(), opcode, pxe_api_call::params_len, profile_start(), profile_stop(), pxe_api_profiler(), pxe_netdev, PXENV_STATUS_FAILURE, real_to_user(), i386_all_regs::regs, i386_all_regs::segs, and u_PXENV_ANY::Status.

Referenced by pxe_api_call_weak().

◆ pxe_api_call_weak()

int pxe_api_call_weak ( struct i386_all_regs ix86)

Dispatch weak PXE API call with PXE stack available.

Parameters
ix86Registers for PXE call
Return values
presentZero (PXE stack present)

Definition at line 186 of file pxe_call.c.

186  {
187  pxe_api_call ( ix86 );
188  return 0;
189 }
__asmcall void pxe_api_call(struct i386_all_regs *ix86)
Dispatch PXE API call.
Definition: pxe_call.c:145

References pxe_api_call().

◆ pxe_loader_call()

__asmcall void pxe_loader_call ( struct i386_all_regs ix86)

Dispatch PXE loader call.

Parameters
es:diAddress of PXE parameter block
Return values
axPXE exit code

Definition at line 197 of file pxe_call.c.

197  {
198  userptr_t uparams = real_to_user ( ix86->segs.es, ix86->regs.di );
199  struct s_UNDI_LOADER params;
200  PXENV_EXIT_t ret;
201 
202  /* Copy parameter block from caller */
203  copy_from_user ( &params, uparams, 0, sizeof ( params ) );
204 
205  /* Fill in ROM segment address */
206  ppxe.UNDIROMID.segment = ix86->segs.ds;
207 
208  /* Set default status in case child routine fails to do so */
209  params.Status = PXENV_STATUS_FAILURE;
210 
211  /* Call UNDI loader */
212  ret = undi_loader ( &params );
213 
214  /* Copy modified parameter block back to caller and return */
215  copy_to_user ( uparams, 0, &params, sizeof ( params ) );
216  ix86->regs.ax = ret;
217 }
struct i386_seg_regs segs
Definition: registers.h:175
uint16_t es
Definition: registers.h:142
#define ppxe
Definition: pxe_call.h:28
static __always_inline void copy_from_user(void *dest, userptr_t src, off_t src_off, size_t len)
Copy data from user buffer.
Definition: uaccess.h:337
UINT16_t PXENV_EXIT_t
A PXE exit code.
Definition: pxe_types.h:44
struct i386_regs regs
Definition: registers.h:176
static __always_inline void copy_to_user(userptr_t dest, off_t dest_off, const void *src, size_t len)
Copy data to user buffer.
Definition: uaccess.h:324
uint16_t ds
Definition: registers.h:141
#define undi_loader
Definition: undiload.c:53
uint16_t di
Definition: registers.h:64
uint16_t ax
Definition: registers.h:108
Parameter block for undi_loader()
Definition: pxe_api.h:1729
static __always_inline userptr_t real_to_user(unsigned int segment, unsigned int offset)
Convert segment:offset address to user buffer.
Definition: realmode.h:75
#define PXENV_STATUS_FAILURE
Definition: pxe_error.h:20
unsigned long userptr_t
A pointer to a user buffer.
Definition: uaccess.h:33

References i386_regs::ax, copy_from_user(), copy_to_user(), i386_regs::di, i386_seg_regs::ds, i386_seg_regs::es, ppxe, PXENV_STATUS_FAILURE, real_to_user(), i386_all_regs::regs, i386_all_regs::segs, s_UNDI_LOADER::Status, and undi_loader.

◆ pxe_checksum()

static uint8_t pxe_checksum ( void *  data,
size_t  size 
)
static

Calculate byte checksum as used by PXE.

Parameters
dataData
sizeLength of data
Return values
sumChecksum

Definition at line 226 of file pxe_call.c.

226  {
227  uint8_t *bytes = data;
228  uint8_t sum = 0;
229 
230  while ( size-- ) {
231  sum += *bytes++;
232  }
233  return sum;
234 }
unsigned char uint8_t
Definition: stdint.h:10
uint8_t size
Entry size (in 32-bit words)
Definition: ena.h:16
uint8_t data[48]
Additional event data.
Definition: ena.h:22
uint8_t bytes[64]
Definition: ib_mad.h:16

References bytes, data, and size.

Referenced by pxe_init_structures().

◆ pxe_init_structures()

static void pxe_init_structures ( void  )
static

Initialise !PXE and PXENV+ structures.

Definition at line 240 of file pxe_call.c.

240  {
241  uint32_t rm_cs_phys = ( rm_cs << 4 );
242  uint32_t rm_ds_phys = ( rm_ds << 4 );
243 
244  /* Fill in missing segment fields */
245  ppxe.EntryPointSP.segment = rm_cs;
246  ppxe.EntryPointESP.segment = rm_cs;
247  ppxe.Stack.segment_address = rm_ds;
248  ppxe.Stack.Physical_address = rm_ds_phys;
249  ppxe.UNDIData.segment_address = rm_ds;
250  ppxe.UNDIData.Physical_address = rm_ds_phys;
251  ppxe.UNDICode.segment_address = rm_cs;
252  ppxe.UNDICode.Physical_address = rm_cs_phys;
253  ppxe.UNDICodeWrite.segment_address = rm_cs;
254  ppxe.UNDICodeWrite.Physical_address = rm_cs_phys;
255  pxenv.RMEntry.segment = rm_cs;
256  pxenv.StackSeg = rm_ds;
257  pxenv.UNDIDataSeg = rm_ds;
258  pxenv.UNDICodeSeg = rm_cs;
259  pxenv.PXEPtr.segment = rm_cs;
260 
261  /* Update checksums */
262  ppxe.StructCksum -= pxe_checksum ( &ppxe, sizeof ( ppxe ) );
263  pxenv.Checksum -= pxe_checksum ( &pxenv, sizeof ( pxenv ) );
264 }
#define ppxe
Definition: pxe_call.h:28
#define rm_ds
Definition: libkir.h:39
unsigned int uint32_t
Definition: stdint.h:12
static uint8_t pxe_checksum(void *data, size_t size)
Calculate byte checksum as used by PXE.
Definition: pxe_call.c:226
#define rm_cs
Definition: libkir.h:38
#define pxenv
Definition: pxe_call.h:32

References ppxe, pxe_checksum(), pxenv, rm_cs, and rm_ds.

◆ __init_fn()

struct init_fn pxe_init_fn __init_fn ( INIT_NORMAL  )

PXE structure initialiser.

◆ pxe_activate()

void pxe_activate ( struct net_device netdev)

Activate PXE stack.

Parameters
netdevNet device to use as PXE net device

Definition at line 276 of file pxe_call.c.

276  {
277  uint32_t discard_a;
278  uint32_t discard_b;
279  uint32_t discard_d;
280 
281  /* Ensure INT 1A is hooked */
282  if ( ! int_1a_hooked ) {
285  devices_get();
286  int_1a_hooked = 1;
287  }
288 
289  /* Set PXE network device */
291 
292  /* Notify BIOS of installation */
293  __asm__ __volatile__ ( REAL_CODE ( "pushw %%cs\n\t"
294  "popw %%es\n\t"
295  "int $0x1a\n\t" )
296  : "=a" ( discard_a ), "=b" ( discard_b ),
297  "=d" ( discard_d )
298  : "0" ( 0x564e ),
299  "1" ( __from_text16 ( &pxenv ) ) );
300 }
#define __from_text16(pointer)
Definition: libkir.h:23
void pxe_int_1a(void)
INT 1A handler.
unsigned long intptr_t
Definition: stdint.h:21
void hook_bios_interrupt(unsigned int interrupt, unsigned int handler, struct segoff *chain_vector)
Hook INT vector.
Definition: biosint.c:24
static int int_1a_hooked
INT 1A hooked flag.
Definition: pxe_call.c:55
static void devices_get(void)
Prevent devices from being removed on shutdown.
Definition: device.h:161
#define pxe_int_1a_vector
Definition: pxe_call.c:49
static struct net_device * netdev
Definition: gdbudp.c:52
void pxe_set_netdev(struct net_device *netdev)
Set network device as current PXE network device.
Definition: pxe_undi.c:69
__asm__ __volatile__("\n1:\n\t" "movb -1(%3,%1), %%al\n\t" "stosb\n\t" "loop 1b\n\t" "xorl %%eax, %%eax\n\t" "mov %4, %1\n\t" "rep stosb\n\t" :"=&D"(discard_D), "=&c"(discard_c), "+m"(*value) :"r"(data), "g"(pad_len), "0"(value0), "1"(len) :"eax")
unsigned int uint32_t
Definition: stdint.h:12
__asm__(".section \".rodata\", \"a\", " PROGBITS "\n\t" "\nprivate_key_data:\n\t" ".size private_key_data, ( . - private_key_data )\n\t" ".equ private_key_len, ( . - private_key_data )\n\t" ".previous\n\t")
#define pxenv
Definition: pxe_call.h:32
#define REAL_CODE(asm_code_str)
Definition: libkir.h:226

References __asm__(), __from_text16, __volatile__(), devices_get(), hook_bios_interrupt(), int_1a_hooked, netdev, pxe_int_1a(), pxe_int_1a_vector, pxe_set_netdev(), pxenv, and REAL_CODE.

Referenced by pxe_exec(), pxe_notify(), pxenv_start_undi(), and startpxe_payload().

◆ pxe_deactivate()

int pxe_deactivate ( void  )

Deactivate PXE stack.

Return values
rcReturn status code

Definition at line 307 of file pxe_call.c.

307  {
308  int rc;
309 
310  /* Clear PXE network device */
311  pxe_set_netdev ( NULL );
312 
313  /* Ensure INT 1A is unhooked, if possible */
314  if ( int_1a_hooked ) {
315  if ( ( rc = unhook_bios_interrupt ( 0x1a,
316  ( intptr_t ) pxe_int_1a,
317  &pxe_int_1a_vector ))!= 0){
318  DBGC ( &pxe_netdev, "PXE could not unhook INT 1A: %s\n",
319  strerror ( rc ) );
320  return rc;
321  }
322  devices_put();
323  int_1a_hooked = 0;
324  }
325 
326  return 0;
327 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
static void devices_put(void)
Allow devices to be removed on shutdown.
Definition: device.h:169
void pxe_int_1a(void)
INT 1A handler.
#define DBGC(...)
Definition: compiler.h:505
unsigned long intptr_t
Definition: stdint.h:21
int unhook_bios_interrupt(unsigned int interrupt, unsigned int handler, struct segoff *chain_vector)
Unhook INT vector.
Definition: biosint.c:69
static int int_1a_hooked
INT 1A hooked flag.
Definition: pxe_call.c:55
#define pxe_int_1a_vector
Definition: pxe_call.c:49
void pxe_set_netdev(struct net_device *netdev)
Set network device as current PXE network device.
Definition: pxe_undi.c:69
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
struct net_device * pxe_netdev
Definition: pxe_undi.c:59
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321

References DBGC, devices_put(), int_1a_hooked, NULL, pxe_int_1a(), pxe_int_1a_vector, pxe_netdev, pxe_set_netdev(), rc, strerror(), and unhook_bios_interrupt().

Referenced by pxe_exec(), pxe_notify(), pxenv_stop_undi(), and stoppxe_exec().

◆ pxe_start_nbp()

int pxe_start_nbp ( void  )

Start PXE NBP at 0000:7c00.

Return values
rcReturn status code

Definition at line 337 of file pxe_call.c.

337  {
338  int jmp;
339  int discard_b, discard_c, discard_d, discard_D;
341 
342  DBGC ( &pxe_netdev, "PXE NBP starting with netdev %s, code %04x:%04zx, "
343  "data %04x:%04zx\n", ( pxe_netdev ? pxe_netdev->name : "<none>"),
345 
346  /* Allow restarting NBP via PXENV_RESTART_TFTP */
348  if ( jmp )
349  DBGC ( &pxe_netdev, "PXE NBP restarting (%x)\n", jmp );
350 
351  /* Far call to PXE NBP */
352  __asm__ __volatile__ ( REAL_CODE ( "pushl %%ebp\n\t" /* gcc bug */
353  "movw %%cx, %%es\n\t"
354  "pushw %%es\n\t"
355  "pushw %%di\n\t"
356  "sti\n\t"
357  "lcall $0, $0x7c00\n\t"
358  "popl %%ebp\n\t" /* discard */
359  "popl %%ebp\n\t" /* gcc bug */ )
360  : "=a" ( status ), "=b" ( discard_b ),
361  "=c" ( discard_c ), "=d" ( discard_d ),
362  "=D" ( discard_D )
363  : "a" ( 0 ), "b" ( __from_text16 ( &pxenv ) ),
364  "c" ( rm_cs ),
365  "d" ( virt_to_phys ( &pxenv ) ),
366  "D" ( __from_text16 ( &ppxe ) )
367  : "esi", "memory" );
368  if ( status )
369  return -EPXENBP ( status );
370 
371  return 0;
372 }
unsigned short uint16_t
Definition: stdint.h:11
uint8_t jmp
"jmp" instruction
Definition: librm.h:256
#define ppxe
Definition: pxe_call.h:28
#define __from_text16(pointer)
Definition: libkir.h:23
#define DBGC(...)
Definition: compiler.h:505
#define rm_ds
Definition: libkir.h:39
static __always_inline unsigned long virt_to_phys(volatile const void *addr)
Convert virtual address to a physical address.
Definition: uaccess.h:287
#define _data16_memsz
Definition: pxe_call.c:63
uint8_t status
Status.
Definition: ena.h:16
#define _text16_memsz
Definition: pxe_call.c:59
struct net_device * pxe_netdev
Definition: pxe_undi.c:59
__asm__ __volatile__("\n1:\n\t" "movb -1(%3,%1), %%al\n\t" "stosb\n\t" "loop 1b\n\t" "xorl %%eax, %%eax\n\t" "mov %4, %1\n\t" "rep stosb\n\t" :"=&D"(discard_D), "=&c"(discard_c), "+m"(*value) :"r"(data), "g"(pad_len), "0"(value0), "1"(len) :"eax")
void * discard_D
Definition: bigint.h:31
__asm__(".section \".rodata\", \"a\", " PROGBITS "\n\t" "\nprivate_key_data:\n\t" ".size private_key_data, ( . - private_key_data )\n\t" ".equ private_key_len, ( . - private_key_data )\n\t" ".previous\n\t")
char name[NETDEV_NAME_LEN]
Name of this network device.
Definition: netdevice.h:362
#define rmsetjmp(_env)
Definition: rmsetjmp.h:17
#define rm_cs
Definition: libkir.h:38
long discard_c
Definition: bigint.h:32
#define pxenv
Definition: pxe_call.h:32
#define EPXENBP(status)
Definition: pxe_call.c:45
#define REAL_CODE(asm_code_str)
Definition: libkir.h:226
rmjmp_buf pxe_restart_nbp
Jump buffer for PXENV_RESTART_TFTP.
Definition: pxe_call.c:330

References __asm__(), __from_text16, __volatile__(), _data16_memsz, _text16_memsz, DBGC, discard_c, discard_D, EPXENBP, jmp, net_device::name, ppxe, pxe_netdev, pxe_restart_nbp, pxenv, REAL_CODE, rm_cs, rm_ds, rmsetjmp, status, and virt_to_phys().

Referenced by pxe_exec().

◆ pxe_notify()

static int pxe_notify ( struct net_device netdev,
void *priv  __unused 
)
static

Notify BIOS of existence of network device.

Parameters
netdevNetwork device
privPrivate data
Return values
rcReturn status code

Definition at line 381 of file pxe_call.c.

381  {
382 
383  /* Do nothing if we already have a network device */
384  if ( pxe_netdev )
385  return 0;
386 
387  /* Activate (and deactivate) PXE stack to notify BIOS */
388  pxe_activate ( netdev );
389  pxe_deactivate();
390 
391  return 0;
392 }
void pxe_activate(struct net_device *netdev)
Activate PXE stack.
Definition: pxe_call.c:276
int pxe_deactivate(void)
Deactivate PXE stack.
Definition: pxe_call.c:307
static struct net_device * netdev
Definition: gdbudp.c:52
struct net_device * pxe_netdev
Definition: pxe_undi.c:59

References netdev, pxe_activate(), pxe_deactivate(), and pxe_netdev.

◆ REQUIRING_SYMBOL()

REQUIRING_SYMBOL ( pxe_api_call  )

◆ REQUIRE_OBJECT() [1/5]

REQUIRE_OBJECT ( pxe_preboot  )

◆ REQUIRE_OBJECT() [2/5]

REQUIRE_OBJECT ( pxe_undi  )

◆ REQUIRE_OBJECT() [3/5]

REQUIRE_OBJECT ( pxe_udp  )

◆ REQUIRE_OBJECT() [4/5]

REQUIRE_OBJECT ( pxe_tftp  )

◆ REQUIRE_OBJECT() [5/5]

REQUIRE_OBJECT ( pxe_file  )

Variable Documentation

◆ int_1a_hooked

int int_1a_hooked = 0
static

INT 1A hooked flag.

Definition at line 55 of file pxe_call.c.

Referenced by pxe_activate(), and pxe_deactivate().

◆ _text16_memsz

char _text16_memsz[]

Real-mode code segment size.

◆ _data16_memsz

char _data16_memsz[]

Real-mode data segment size.

◆ __profiler

struct profiler pxe_api_misc_profiler __profiler
static
Initial value:
=
{ .name = "pxeapi.tx" }

PXENV_UNDI_TRANSMIT API call profiler.

Miscellaneous PXE API call profiler.

PXE unknown API call profiler.

PXENV_UNDI_ISR API call profiler.

This profiler can be used to measure the overhead of a dummy PXE API call.

Definition at line 66 of file pxe_call.c.

◆ __pxe_api_call

struct pxe_api_call pxenv_unknown_api __pxe_api_call
Initial value:
=
static PXENV_EXIT_t pxenv_unknown(struct s_PXENV_UNKNOWN *pxenv_unknown)
Handle an unknown PXE API call.
Definition: pxe_call.c:92
#define PXENV_UNKNOWN
PXE API invalid function code.
Definition: pxe.h:13
#define PXE_API_CALL(_opcode, _entry, _params_type)
Define a PXE API call.
Definition: pxe.h:108
Parameter block for pxenv_unknown()
Definition: pxe.h:16

Unknown PXE API call list.

Definition at line 98 of file pxe_call.c.

◆ pxe_restart_nbp

rmjmp_buf pxe_restart_nbp

Jump buffer for PXENV_RESTART_TFTP.

PXENV_RESTART_TFTP jump buffer.

Definition at line 330 of file pxe_call.c.

Referenced by pxe_start_nbp(), and pxenv_restart_tftp().

◆ __net_driver

struct net_driver pxe_driver __net_driver
Initial value:
= {
.name = "PXE",
.probe = pxe_notify,
}
static int pxe_notify(struct net_device *netdev, void *priv __unused)
Notify BIOS of existence of network device.
Definition: pxe_call.c:381

PXE BIOS notification driver.

Definition at line 395 of file pxe_call.c.