|
@@ -1,11 +1,5 @@
|
1
|
|
-/** @file
|
2
|
|
- *
|
3
|
|
- * PXE UNDI loader
|
4
|
|
- *
|
5
|
|
- */
|
6
|
|
-
|
7
|
1
|
/*
|
8
|
|
- * Copyright (C) 2004 Michael Brown <mbrown@fensystems.co.uk>.
|
|
2
|
+ * Copyright (C) 2007 Michael Brown <mbrown@fensystems.co.uk>.
|
9
|
3
|
*
|
10
|
4
|
* This program is free software; you can redistribute it and/or
|
11
|
5
|
* modify it under the terms of the GNU General Public License as
|
|
@@ -22,65 +16,37 @@
|
22
|
16
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
23
|
17
|
*/
|
24
|
18
|
|
25
|
|
-#warning "Currently broken"
|
26
|
|
-#if 0
|
|
19
|
+#include <gpxe/init.h>
|
27
|
20
|
#include "pxe.h"
|
|
21
|
+#include "pxe_call.h"
|
28
|
22
|
|
29
|
|
-/* PXENV_UNDI_LOADER
|
|
23
|
+/** @file
|
|
24
|
+ *
|
|
25
|
+ * PXE UNDI loader
|
30
|
26
|
*
|
31
|
|
- * Status: working
|
|
27
|
+ */
|
|
28
|
+
|
|
29
|
+/* PXENV_UNDI_LOADER
|
32
|
30
|
*
|
33
|
|
- * NOTE: This is not a genuine PXE API call; the loader has a separate
|
34
|
|
- * entry point. However, to simplify the mapping of the PXE API to
|
35
|
|
- * the internal Etherboot API, both are directed through the same
|
36
|
|
- * interface.
|
37
|
31
|
*/
|
38
|
32
|
PXENV_EXIT_t undi_loader ( struct s_UNDI_LOADER *undi_loader ) {
|
39
|
|
- uint32_t loader_phys = virt_to_phys ( undi_loader );
|
40
|
|
-
|
41
|
|
- DBG ( "PXENV_UNDI_LOADER" );
|
42
|
|
-
|
43
|
|
- /* Set UNDI DS as our real-mode stack */
|
44
|
|
- use_undi_ds_for_rm_stack ( undi_loader->undi_ds );
|
45
|
|
-
|
46
|
|
- /* FIXME: These lines are borrowed from main.c. There should
|
47
|
|
- * probably be a single initialise() function that does all
|
48
|
|
- * this, but it's currently split interestingly between main()
|
49
|
|
- * and main_loop()...
|
50
|
|
- */
|
51
|
|
-
|
52
|
|
-
|
53
|
|
- /* CHECKME: Our init functions have probably already been
|
54
|
|
- called by the ROM prefix's call to setup(), haven't
|
55
|
|
- they? */
|
56
|
|
-
|
57
|
33
|
|
|
34
|
+ DBG ( "[PXENV_UNDI_LOADER]" );
|
58
|
35
|
|
59
|
|
- /* We have relocated; the loader pointer is now invalid */
|
60
|
|
- undi_loader = phys_to_virt ( loader_phys );
|
|
36
|
+ /* Perform one-time initialisation (e.g. heap) */
|
|
37
|
+ initialise();
|
61
|
38
|
|
62
|
|
- /* Install PXE stack to area specified by NBP */
|
63
|
|
- install_pxe_stack ( VIRTUAL ( undi_loader->undi_cs, 0 ) );
|
64
|
|
-
|
65
|
|
- /* Call pxenv_start_undi to set parameters. Why the hell PXE
|
66
|
|
- * requires these parameters to be provided twice is beyond
|
67
|
|
- * the wit of any sane man. Don't worry if it fails; the NBP
|
68
|
|
- * should call PXENV_START_UNDI separately anyway.
|
69
|
|
- */
|
70
|
|
- pxenv_start_undi ( &undi_loader->u.start_undi );
|
71
|
|
- /* Unhook stack; the loader is not meant to hook int 1a etc,
|
72
|
|
- * but the call the pxenv_start_undi will cause it to happen.
|
73
|
|
- */
|
|
39
|
+ /* Set up PXE data structures */
|
|
40
|
+ pxe_init_structures();
|
74
|
41
|
|
75
|
|
- /* FIXME: can't use ENSURE_CAN_UNLOAD() thanks to newer gcc's
|
76
|
|
- * barfing on unnamed struct/unions. */
|
77
|
|
- /* ENSURE_CAN_UNLOAD ( undi_loader ); */
|
|
42
|
+ /* Fill in UNDI loader structure */
|
|
43
|
+ undi_loader->PXEptr.segment = rm_ds;
|
|
44
|
+ undi_loader->PXEptr.offset =
|
|
45
|
+ ( ( unsigned ) & __from_text16 ( ppxe ) );
|
|
46
|
+ undi_loader->PXENVptr.segment = rm_ds;
|
|
47
|
+ undi_loader->PXENVptr.offset =
|
|
48
|
+ ( ( unsigned ) & __from_text16 ( pxenv ) );
|
78
|
49
|
|
79
|
|
- /* Fill in addresses of !PXE and PXENV+ structures */
|
80
|
|
- PTR_TO_SEGOFF16 ( &pxe_stack->pxe, undi_loader->pxe_ptr );
|
81
|
|
- PTR_TO_SEGOFF16 ( &pxe_stack->pxenv, undi_loader->pxenv_ptr );
|
82
|
|
-
|
83
|
|
- undi_loader->u.Status = PXENV_STATUS_SUCCESS;
|
|
50
|
+ undi_loader->Status = PXENV_STATUS_SUCCESS;
|
84
|
51
|
return PXENV_EXIT_SUCCESS;
|
85
|
52
|
}
|
86
|
|
-#endif
|