summaryrefslogtreecommitdiffstats
path: root/src/arch
diff options
context:
space:
mode:
authorMichael Brown2009-06-28 20:40:16 +0200
committerMichael Brown2009-06-28 20:40:16 +0200
commitc2965b0fe72ea6b2a9efb7f852682226d60bee7f (patch)
treed41f321ef08a8334b3a85e83204289a6008ccf12 /src/arch
parent[pxe] Update UNDI transmit count before transmitting packet (diff)
downloadipxe-c2965b0fe72ea6b2a9efb7f852682226d60bee7f.tar.gz
ipxe-c2965b0fe72ea6b2a9efb7f852682226d60bee7f.tar.xz
ipxe-c2965b0fe72ea6b2a9efb7f852682226d60bee7f.zip
[pxe] Make pxe_init_structures() an initialisation function
pxe_init_structures() fills in the fields of the !PXE and PXENV+ structures that aren't known until gPXE starts up. Once gPXE is started, these values will never change. Make pxe_init_structures() an initialisation function so that PXE users don't have to worry about calling it.
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/i386/image/pxe_image.c1
-rw-r--r--src/arch/i386/include/pxe_call.h1
-rw-r--r--src/arch/i386/interface/pxe/pxe_call.c8
-rw-r--r--src/arch/i386/interface/pxe/pxe_loader.c3
4 files changed, 7 insertions, 6 deletions
diff --git a/src/arch/i386/image/pxe_image.c b/src/arch/i386/image/pxe_image.c
index 68f8d4bf..fde8f09b 100644
--- a/src/arch/i386/image/pxe_image.c
+++ b/src/arch/i386/image/pxe_image.c
@@ -47,7 +47,6 @@ static int pxe_exec ( struct image *image ) {
int rc;
/* Ensure that PXE stack is ready to use */
- pxe_init_structures();
pxe_hook_int1a();
/* Arbitrarily pick the most recently opened network device */
diff --git a/src/arch/i386/include/pxe_call.h b/src/arch/i386/include/pxe_call.h
index f60686ca..05d70516 100644
--- a/src/arch/i386/include/pxe_call.h
+++ b/src/arch/i386/include/pxe_call.h
@@ -30,7 +30,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 );
extern __asmcall void pxe_api_call ( struct i386_all_regs *ix86 );
diff --git a/src/arch/i386/interface/pxe/pxe_call.c b/src/arch/i386/interface/pxe/pxe_call.c
index 925dd335..e15a8c14 100644
--- a/src/arch/i386/interface/pxe/pxe_call.c
+++ b/src/arch/i386/interface/pxe/pxe_call.c
@@ -19,6 +19,7 @@
FILE_LICENCE ( GPL2_OR_LATER );
#include <gpxe/uaccess.h>
+#include <gpxe/init.h>
#include <registers.h>
#include <biosint.h>
#include <pxe.h>
@@ -403,7 +404,7 @@ static uint8_t pxe_checksum ( void *data, size_t size ) {
* Initialise !PXE and PXENV+ structures
*
*/
-void pxe_init_structures ( void ) {
+static void pxe_init_structures ( void ) {
uint32_t rm_cs_phys = ( rm_cs << 4 );
uint32_t rm_ds_phys = ( rm_ds << 4 );
@@ -429,6 +430,11 @@ void pxe_init_structures ( void ) {
pxenv.Checksum -= pxe_checksum ( &pxenv, sizeof ( pxenv ) );
}
+/** PXE structure initialiser */
+struct init_fn pxe_init_fn __init_fn ( INIT_NORMAL ) = {
+ .initialise = pxe_init_structures,
+};
+
/**
* Start PXE NBP at 0000:7c00
*
diff --git a/src/arch/i386/interface/pxe/pxe_loader.c b/src/arch/i386/interface/pxe/pxe_loader.c
index bebae028..b35caf77 100644
--- a/src/arch/i386/interface/pxe/pxe_loader.c
+++ b/src/arch/i386/interface/pxe/pxe_loader.c
@@ -39,9 +39,6 @@ PXENV_EXIT_t undi_loader ( struct s_UNDI_LOADER *undi_loader ) {
DBG ( "[PXENV_UNDI_LOADER to CS %04x DS %04x]",
undi_loader->UNDI_CS, undi_loader->UNDI_DS );
- /* Set up PXE data structures */
- pxe_init_structures();
-
/* Fill in UNDI loader structure */
undi_loader->PXEptr.segment = rm_cs;
undi_loader->PXEptr.offset = __from_text16 ( &ppxe );