Procházet zdrojové kódy

Move pxe_netdev and set_pxe_netdev to pxe_undi.c and remove

now-obsolete pxe.c.
tags/v0.9.3
Michael Brown před 17 roky
rodič
revize
5ce5e6d846
2 změnil soubory, kde provedl 15 přidání a 182 odebrání
  1. 0
    182
      src/interface/pxe/pxe.c
  2. 15
    0
      src/interface/pxe/pxe_undi.c

+ 0
- 182
src/interface/pxe/pxe.c Zobrazit soubor

@@ -1,182 +0,0 @@
1
-/** @file
2
- *
3
- * 
4
- *
5
- */
6
-
7
-/*
8
- * Copyright (C) 2004 Michael Brown <mbrown@fensystems.co.uk>.
9
- *
10
- * This program is free software; you can redistribute it and/or
11
- * modify it under the terms of the GNU General Public License as
12
- * published by the Free Software Foundation; either version 2 of the
13
- * License, or any later version.
14
- *
15
- * This program is distributed in the hope that it will be useful, but
16
- * WITHOUT ANY WARRANTY; without even the implied warranty of
17
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18
- * General Public License for more details.
19
- *
20
- * You should have received a copy of the GNU General Public License
21
- * along with this program; if not, write to the Free Software
22
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23
- */
24
-
25
-#include <gpxe/netdevice.h>
26
-#include "pxe.h"
27
-
28
-struct net_device *pxe_netdev = NULL;
29
-
30
-/**
31
- * Set network device as current PXE network device
32
- *
33
- * @v netdev		Network device, or NULL
34
- */
35
-void pxe_set_netdev ( struct net_device *netdev ) {
36
-	if ( pxe_netdev )
37
-		netdev_put ( pxe_netdev );
38
-	pxe_netdev = NULL;
39
-	if ( netdev )
40
-		pxe_netdev = netdev_get ( netdev );
41
-}
42
-
43
-#if 0
44
-
45
-/* Global pointer to currently installed PXE stack */
46
-pxe_stack_t *pxe_stack = NULL;
47
-
48
-/* Various startup/shutdown routines.  The startup/shutdown call
49
- * sequence is incredibly badly defined in the Intel PXE spec, for
50
- * example:
51
- *
52
- *   PXENV_UNDI_INITIALIZE says that the parameters used to initialize
53
- *   the adaptor should be those supplied to the most recent
54
- *   PXENV_UNDI_STARTUP call.  PXENV_UNDI_STARTUP takes no parameters.
55
- *
56
- *   PXENV_UNDI_CLEANUP says that the rest of the API will not be
57
- *   available after making this call.  Figure 3-3 ("Early UNDI API
58
- *   usage") shows a call to PXENV_UNDI_CLEANUP being followed by a
59
- *   call to the supposedly now unavailable PXENV_STOP_UNDI.
60
- *
61
- *   PXENV_UNLOAD_BASE_STACK talks about freeing up the memory
62
- *   occupied by the PXE stack.  Figure 4-3 ("PXE IPL") shows a call
63
- *   to PXENV_STOP_UNDI being made after the call to
64
- *   PXENV_UNLOAD_BASE_STACK, by which time the entire PXE stack
65
- *   should have been freed (and, potentially, zeroed).
66
- *
67
- *   Nothing, anywhere, seems to mention who's responsible for freeing
68
- *   up the base memory allocated for the stack segment.  It's not
69
- *   even clear whether or not this is expected to be in free base
70
- *   memory rather than claimed base memory.
71
- *
72
- * Consequently, we adopt a rather defensive strategy, designed to
73
- * work with any conceivable sequence of initialisation or shutdown
74
- * calls.  We have only two things that we care about:
75
- *
76
- *   1. Have we hooked INT 1A and INT 15,E820(etc.)?
77
- *   2. Is the NIC initialised?
78
- *
79
- * The NIC should never be initialised without the vectors being
80
- * hooked, similarly the vectors should never be unhooked with the NIC
81
- * still initialised.  We do, however, want to be able to have the
82
- * vectors hooked with the NIC shutdown.  We therefore have three
83
- * possible states:
84
- *
85
- *   1. Ready to unload: interrupts unhooked, NIC shutdown.
86
- *   2. Midway: interrupts hooked, NIC shutdown.
87
- *   3. Fully ready: interrupts hooked, NIC initialised.
88
- *
89
- * We provide the three states CAN_UNLOAD, MIDWAY and READY to define
90
- * these, and the call pxe_ensure_state() to ensure that the stack is
91
- * in the specified state.  All our PXE API call implementations
92
- * should use this call to ensure that the state is as required for
93
- * that PXE API call.  This enables us to cope with whatever the
94
- * end-user's interpretation of the PXE spec may be.  It even allows
95
- * for someone calling e.g. PXENV_START_UNDI followed by
96
- * PXENV_UDP_WRITE, without bothering with any of the intervening
97
- * calls.
98
- *
99
- * pxe_ensure_state() returns 1 for success, 0 for failure.  In the
100
- * event of failure (which can arise from e.g. asking for state READY
101
- * when we don't know where our NIC is), the error code
102
- * PXENV_STATUS_UNDI_INVALID_STATE should be returned to the user.
103
- * The macros ENSURE_XXX() can be used to achieve this without lots of
104
- * duplicated code.
105
- */
106
-
107
-/* pxe_[un]hook_stack are architecture-specific and provided in
108
- * pxe_callbacks.c
109
- */
110
-
111
-int pxe_initialise_nic ( void ) {
112
-	if ( pxe_stack->state >= READY ) return 1;
113
-
114
-#warning "device probing mechanism has completely changed"
115
-#if 0
116
-
117
-	/* Check if NIC is initialised.  dev.disable is set to 0
118
-	 * when disable() is called, so we use this.
119
-	 */
120
-	if ( dev.disable ) {
121
-		/* NIC may have been initialised independently
122
-		 * (e.g. when we set up the stack prior to calling the
123
-		 * NBP).
124
-		 */
125
-		pxe_stack->state = READY;
126
-		return 1;
127
-	}
128
-
129
-	/* If we already have a NIC defined, reuse that one with
130
-	 * PROBE_AWAKE.  If one was specifed via PXENV_START_UNDI, try
131
-	 * that one first.  Otherwise, set PROBE_FIRST.
132
-	 */
133
-
134
-	if ( dev.state.pci.dev.use_specified == 1 ) {
135
-		dev.how_probe = PROBE_NEXT;
136
-		DBG ( " initialising NIC specified via START_UNDI" );
137
-	} else if ( dev.state.pci.dev.driver ) {
138
-		DBG ( " reinitialising NIC" );
139
-		dev.how_probe = PROBE_AWAKE;
140
-	} else {
141
-		DBG ( " probing for any NIC" );
142
-		dev.how_probe = PROBE_FIRST;
143
-	}
144
-
145
-	/* Call probe routine to bring up the NIC */
146
-	if ( eth_probe ( &dev ) != PROBE_WORKED ) {
147
-		DBG ( " failed" );
148
-		return 0;
149
-	}
150
-#endif
151
-	
152
-
153
-	pxe_stack->state = READY;
154
-	return 1;
155
-}
156
-
157
-int pxe_shutdown_nic ( void ) {
158
-	if ( pxe_stack->state <= MIDWAY ) return 1;
159
-
160
-	eth_irq ( DISABLE );
161
-	disable ( &dev );
162
-	pxe_stack->state = MIDWAY;
163
-	return 1;
164
-}
165
-
166
-int ensure_pxe_state ( pxe_stack_state_t wanted ) {
167
-	int success = 1;
168
-
169
-	if ( ! pxe_stack ) return 0;
170
-	if ( wanted >= MIDWAY )
171
-		success = success & hook_pxe_stack();
172
-	if ( wanted > MIDWAY ) {
173
-		success = success & pxe_initialise_nic();
174
-	} else {
175
-		success = success & pxe_shutdown_nic();
176
-	}
177
-	if ( wanted < MIDWAY )
178
-		success = success & unhook_pxe_stack();
179
-	return success;
180
-}
181
-
182
-#endif

+ 15
- 0
src/interface/pxe/pxe_undi.c Zobrazit soubor

@@ -48,6 +48,21 @@
48 48
  */
49 49
 static int undi_tx_count = 0;
50 50
 
51
+struct net_device *pxe_netdev = NULL;
52
+
53
+/**
54
+ * Set network device as current PXE network device
55
+ *
56
+ * @v netdev		Network device, or NULL
57
+ */
58
+void pxe_set_netdev ( struct net_device *netdev ) {
59
+	if ( pxe_netdev )
60
+		netdev_put ( pxe_netdev );
61
+	pxe_netdev = NULL;
62
+	if ( netdev )
63
+		pxe_netdev = netdev_get ( netdev );
64
+}
65
+
51 66
 /**
52 67
  * Open PXE network device
53 68
  *

Načítá se…
Zrušit
Uložit