mirror of
https://github.com/xcat2/xNBA.git
synced 2024-12-15 07:41:45 +00:00
Separate out pxe_start_nbp() from pxe_image.c into pxe_call.c
Implement PXENV_RESTART_TFTP.
This commit is contained in:
parent
acd598b4f9
commit
8130443f9f
@ -30,12 +30,6 @@
|
||||
#include <gpxe/segment.h>
|
||||
#include <gpxe/netdevice.h>
|
||||
|
||||
/** PXE load address segment */
|
||||
#define PXE_LOAD_SEGMENT 0
|
||||
|
||||
/** PXE load address offset */
|
||||
#define PXE_LOAD_OFFSET 0x7c00
|
||||
|
||||
struct image_type pxe_image_type __image_type ( PROBE_PXE );
|
||||
|
||||
/**
|
||||
@ -46,8 +40,6 @@ struct image_type pxe_image_type __image_type ( PROBE_PXE );
|
||||
*/
|
||||
static int pxe_exec ( struct image *image __unused ) {
|
||||
struct net_device *netdev;
|
||||
int discard_b, discard_c;
|
||||
uint16_t rc;
|
||||
|
||||
/* Ensure that PXE stack is ready to use */
|
||||
pxe_init_structures();
|
||||
@ -59,20 +51,7 @@ static int pxe_exec ( struct image *image __unused ) {
|
||||
break;
|
||||
}
|
||||
|
||||
/* Far call to PXE NBP */
|
||||
__asm__ __volatile__ ( REAL_CODE ( "pushw %%cx\n\t"
|
||||
"pushw %%ax\n\t"
|
||||
"movw %%cx, %%es\n\t"
|
||||
"lcall $0, $0x7c00\n\t"
|
||||
"addw $4, %%sp\n\t" )
|
||||
: "=a" ( rc ), "=b" ( discard_b ),
|
||||
"=c" ( discard_c )
|
||||
: "a" ( & __from_text16 ( ppxe ) ),
|
||||
"b" ( & __from_text16 ( pxenv ) ),
|
||||
"c" ( rm_cs )
|
||||
: "edx", "esi", "edi", "ebp", "memory" );
|
||||
|
||||
return rc;
|
||||
return pxe_start_nbp();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -9,6 +9,15 @@
|
||||
#include <pxe_api.h>
|
||||
#include <realmode.h>
|
||||
|
||||
/** PXE load address segment */
|
||||
#define PXE_LOAD_SEGMENT 0
|
||||
|
||||
/** PXE load address offset */
|
||||
#define PXE_LOAD_OFFSET 0x7c00
|
||||
|
||||
/** PXE physical load address */
|
||||
#define PXE_LOAD_PHYS ( ( PXE_LOAD_SEGMENT << 4 ) + PXE_LOAD_OFFSET )
|
||||
|
||||
/** !PXE structure */
|
||||
extern struct s_PXE __text16 ( ppxe );
|
||||
#define ppxe __use_text16 ( ppxe )
|
||||
@ -20,5 +29,6 @@ extern struct s_PXENV __text16 ( pxenv );
|
||||
extern void pxe_hook_int1a ( void );
|
||||
extern int pxe_unhook_int1a ( void );
|
||||
extern void pxe_init_structures ( void );
|
||||
extern int pxe_start_nbp ( void );
|
||||
|
||||
#endif /* _PXE_CALL_H */
|
||||
|
@ -1,32 +0,0 @@
|
||||
/* Header for pxe_callbacks.c.
|
||||
*/
|
||||
|
||||
#ifndef PXE_CALLBACKS_H
|
||||
#define PXE_CALLBACKS_H
|
||||
|
||||
#include "etherboot.h"
|
||||
#include "pxe_types.h"
|
||||
|
||||
typedef struct {
|
||||
SEGOFF16_t orig_retaddr;
|
||||
UINT16_t opcode;
|
||||
SEGOFF16_t segoff;
|
||||
} PACKED pxe_call_params_t;
|
||||
|
||||
/*
|
||||
* These values are hard-coded into the PXE spec
|
||||
*/
|
||||
#define PXE_LOAD_SEGMENT (0x0000)
|
||||
#define PXE_LOAD_OFFSET (0x7c00)
|
||||
#define PXE_LOAD_ADDRESS ( ( PXE_LOAD_SEGMENT << 4 ) + PXE_LOAD_OFFSET )
|
||||
|
||||
/* Function prototypes
|
||||
*/
|
||||
extern struct pxe_stack * install_pxe_stack ( void *base );
|
||||
extern void use_undi_ds_for_rm_stack ( uint16_t ds );
|
||||
extern int hook_pxe_stack ( void );
|
||||
extern int unhook_pxe_stack ( void );
|
||||
extern void remove_pxe_stack ( void );
|
||||
extern int xstartpxe ( void );
|
||||
|
||||
#endif /* PXE_CALLBACKS_H */
|
@ -363,3 +363,28 @@ void pxe_init_structures ( void ) {
|
||||
ppxe.StructCksum -= pxe_checksum ( &ppxe, sizeof ( ppxe ) );
|
||||
pxenv.Checksum -= pxe_checksum ( &pxenv, sizeof ( pxenv ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Start PXE NBP at 0000:7c00
|
||||
*
|
||||
* @ret rc Return status code
|
||||
*/
|
||||
int pxe_start_nbp ( void ) {
|
||||
int discard_b, discard_c;
|
||||
uint16_t rc;
|
||||
|
||||
/* Far call to PXE NBP */
|
||||
__asm__ __volatile__ ( REAL_CODE ( "pushw %%cx\n\t"
|
||||
"pushw %%ax\n\t"
|
||||
"movw %%cx, %%es\n\t"
|
||||
"lcall $0, $0x7c00\n\t"
|
||||
"addw $4, %%sp\n\t" )
|
||||
: "=a" ( rc ), "=b" ( discard_b ),
|
||||
"=c" ( discard_c )
|
||||
: "a" ( & __from_text16 ( ppxe ) ),
|
||||
"b" ( & __from_text16 ( pxenv ) ),
|
||||
"c" ( rm_cs )
|
||||
: "edx", "esi", "edi", "ebp", "memory" );
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include <gpxe/dhcp.h>
|
||||
#include <dhcp_basemem.h>
|
||||
#include "pxe.h"
|
||||
#include "pxe_callbacks.h"
|
||||
#include "pxe_call.h"
|
||||
|
||||
/**
|
||||
* UNLOAD BASE CODE STACK
|
||||
@ -146,22 +146,21 @@ PXENV_EXIT_t pxenv_get_cached_info ( struct s_PXENV_GET_CACHED_INFO
|
||||
*/
|
||||
PXENV_EXIT_t pxenv_restart_tftp ( struct s_PXENV_TFTP_READ_FILE
|
||||
*restart_tftp ) {
|
||||
DBG ( "PXENV_RESTART_TFTP" );
|
||||
PXENV_EXIT_t tftp_exit;
|
||||
|
||||
DBG ( "PXENV_RESTART_TFTP " );
|
||||
|
||||
#if 0
|
||||
/* Words cannot describe the complete mismatch between the PXE
|
||||
* specification and any possible version of reality...
|
||||
*/
|
||||
restart_tftp->Buffer = PXE_LOAD_ADDRESS; /* Fixed by spec, apparently */
|
||||
restart_tftp->BufferSize = get_free_base_memory() - PXE_LOAD_ADDRESS; /* Near enough */
|
||||
DBG ( "(" );
|
||||
tftp_exit = pxe_api_call ( PXENV_TFTP_READ_FILE, (union u_PXENV_ANY*)restart_tftp );
|
||||
DBG ( ")" );
|
||||
if ( tftp_exit != PXENV_EXIT_SUCCESS ) return tftp_exit;
|
||||
restart_tftp->Buffer = PXE_LOAD_PHYS; /* Fixed by spec, apparently */
|
||||
restart_tftp->BufferSize = ( 0xa0000 - PXE_LOAD_PHYS ); /* Near enough */
|
||||
tftp_exit = pxenv_tftp_read_file ( restart_tftp );
|
||||
if ( tftp_exit != PXENV_EXIT_SUCCESS )
|
||||
return tftp_exit;
|
||||
|
||||
/* Fire up the new NBP */
|
||||
restart_tftp->Status = xstartpxe();
|
||||
#endif
|
||||
restart_tftp->Status = pxe_start_nbp();
|
||||
|
||||
/* Not sure what "SUCCESS" actually means, since we can only
|
||||
* return if the new NBP failed to boot...
|
||||
|
Loading…
Reference in New Issue
Block a user