Browse Source

All code related to the device probe logic is ifdeffed 0 out.

tags/v0.9.3
Michael Brown 19 years ago
parent
commit
236a195257
1 changed files with 40 additions and 26 deletions
  1. 40
    26
      src/core/pxe_export.c

+ 40
- 26
src/core/pxe_export.c View File

29
 #include "pxe.h"
29
 #include "pxe.h"
30
 #include "pxe_export.h"
30
 #include "pxe_export.h"
31
 #include "pxe_callbacks.h"
31
 #include "pxe_callbacks.h"
32
+#include "dev.h"
32
 #include "nic.h"
33
 #include "nic.h"
33
 #include "pci.h"
34
 #include "pci.h"
34
-#include "dev.h"
35
 #include "cpu.h"
35
 #include "cpu.h"
36
 #include "timer.h"
36
 #include "timer.h"
37
 
37
 
121
 int pxe_initialise_nic ( void ) {
121
 int pxe_initialise_nic ( void ) {
122
 	if ( pxe_stack->state >= READY ) return 1;
122
 	if ( pxe_stack->state >= READY ) return 1;
123
 
123
 
124
-	/* Check if NIC is initialised.  nic.dev.disable is set to 0
124
+#warning "device probing mechanism has completely changed"
125
+#if 0
126
+
127
+	/* Check if NIC is initialised.  dev.disable is set to 0
125
 	 * when disable() is called, so we use this.
128
 	 * when disable() is called, so we use this.
126
 	 */
129
 	 */
127
-	if ( nic.dev.disable ) {
130
+	if ( dev.disable ) {
128
 		/* NIC may have been initialised independently
131
 		/* NIC may have been initialised independently
129
 		 * (e.g. when we set up the stack prior to calling the
132
 		 * (e.g. when we set up the stack prior to calling the
130
 		 * NBP).
133
 		 * NBP).
137
 	 * PROBE_AWAKE.  If one was specifed via PXENV_START_UNDI, try
140
 	 * PROBE_AWAKE.  If one was specifed via PXENV_START_UNDI, try
138
 	 * that one first.  Otherwise, set PROBE_FIRST.
141
 	 * that one first.  Otherwise, set PROBE_FIRST.
139
 	 */
142
 	 */
140
-	if ( nic.dev.state.pci.dev.use_specified == 1 ) {
141
-		nic.dev.how_probe = PROBE_NEXT;
143
+
144
+	if ( dev.state.pci.dev.use_specified == 1 ) {
145
+		dev.how_probe = PROBE_NEXT;
142
 		DBG ( " initialising NIC specified via START_UNDI" );
146
 		DBG ( " initialising NIC specified via START_UNDI" );
143
-	} else if ( nic.dev.state.pci.dev.driver ) {
147
+	} else if ( dev.state.pci.dev.driver ) {
144
 		DBG ( " reinitialising NIC" );
148
 		DBG ( " reinitialising NIC" );
145
-		nic.dev.how_probe = PROBE_AWAKE;
149
+		dev.how_probe = PROBE_AWAKE;
146
 	} else {
150
 	} else {
147
 		DBG ( " probing for any NIC" );
151
 		DBG ( " probing for any NIC" );
148
-		nic.dev.how_probe = PROBE_FIRST;
152
+		dev.how_probe = PROBE_FIRST;
149
 	}
153
 	}
150
-	
154
+
151
 	/* Call probe routine to bring up the NIC */
155
 	/* Call probe routine to bring up the NIC */
152
-	if ( eth_probe ( &nic.dev ) != PROBE_WORKED ) {
156
+	if ( eth_probe ( &dev ) != PROBE_WORKED ) {
153
 		DBG ( " failed" );
157
 		DBG ( " failed" );
154
 		return 0;
158
 		return 0;
155
 	}
159
 	}
160
+#endif
161
+	
162
+
156
 	pxe_stack->state = READY;
163
 	pxe_stack->state = READY;
157
 	return 1;
164
 	return 1;
158
 }
165
 }
204
  */
211
  */
205
 PXENV_EXIT_t pxenv_start_undi ( t_PXENV_START_UNDI *start_undi ) {
212
 PXENV_EXIT_t pxenv_start_undi ( t_PXENV_START_UNDI *start_undi ) {
206
 	unsigned char bus, devfn;
213
 	unsigned char bus, devfn;
207
-	struct pci_probe_state *pci = &nic.dev.state.pci;
208
-	struct dev *dev = &nic.dev;
209
 
214
 
210
 	DBG ( "PXENV_START_UNDI" );
215
 	DBG ( "PXENV_START_UNDI" );
211
 	ENSURE_MIDWAY(start_undi);
216
 	ENSURE_MIDWAY(start_undi);
220
 	bus = ( start_undi->ax >> 8 ) & 0xff;
225
 	bus = ( start_undi->ax >> 8 ) & 0xff;
221
 	devfn = start_undi->ax & 0xff;
226
 	devfn = start_undi->ax & 0xff;
222
 
227
 
228
+#warning "device probing mechanism has completely changed"
229
+#if 0
223
 	if ( ( pci->dev.driver == NULL ) ||
230
 	if ( ( pci->dev.driver == NULL ) ||
224
 	     ( pci->dev.bus != bus ) || ( pci->dev.devfn != devfn ) ) {
231
 	     ( pci->dev.bus != bus ) || ( pci->dev.devfn != devfn ) ) {
225
 		/* This is quite a bit of a hack and relies on
232
 		/* This is quite a bit of a hack and relies on
236
 		pci->dev.bus = bus;
243
 		pci->dev.bus = bus;
237
 		pci->dev.devfn = devfn;
244
 		pci->dev.devfn = devfn;
238
 	}
245
 	}
246
+#endif
239
 
247
 
240
 	start_undi->Status = PXENV_STATUS_SUCCESS;
248
 	start_undi->Status = PXENV_STATUS_SUCCESS;
241
 	return PXENV_EXIT_SUCCESS;
249
 	return PXENV_EXIT_SUCCESS;
424
 	 * the current value anyway then return success, otherwise
432
 	 * the current value anyway then return success, otherwise
425
 	 * return UNSUPPORTED.
433
 	 * return UNSUPPORTED.
426
 	 */
434
 	 */
427
-	if ( memcmp ( nic.node_addr,
435
+	if ( memcmp ( nic->node_addr,
428
 		      &undi_set_station_address->StationAddress,
436
 		      &undi_set_station_address->StationAddress,
429
 		      ETH_ALEN ) == 0 ) {
437
 		      ETH_ALEN ) == 0 ) {
430
 		undi_set_station_address->Status = PXENV_STATUS_SUCCESS;
438
 		undi_set_station_address->Status = PXENV_STATUS_SUCCESS;
456
 	DBG ( "PXENV_UNDI_GET_INFORMATION" );
464
 	DBG ( "PXENV_UNDI_GET_INFORMATION" );
457
 	ENSURE_READY ( undi_get_information );
465
 	ENSURE_READY ( undi_get_information );
458
 
466
 
459
-	undi_get_information->BaseIo = nic.ioaddr;
460
-	undi_get_information->IntNumber = nic.irqno;
467
+	undi_get_information->BaseIo = nic->ioaddr;
468
+	undi_get_information->IntNumber = nic->irqno;
461
 	/* Cheat: assume all cards can cope with this */
469
 	/* Cheat: assume all cards can cope with this */
462
 	undi_get_information->MaxTranUnit = ETH_MAX_MTU;
470
 	undi_get_information->MaxTranUnit = ETH_MAX_MTU;
463
 	/* Cheat: we only ever have Ethernet cards */
471
 	/* Cheat: we only ever have Ethernet cards */
467
 	 * node address.  This is a valid assumption within Etherboot
475
 	 * node address.  This is a valid assumption within Etherboot
468
 	 * at the time of writing.
476
 	 * at the time of writing.
469
 	 */
477
 	 */
470
-	memcpy ( &undi_get_information->CurrentNodeAddress, nic.node_addr,
478
+	memcpy ( &undi_get_information->CurrentNodeAddress, nic->node_addr,
471
 		 ETH_ALEN );
479
 		 ETH_ALEN );
472
-	memcpy ( &undi_get_information->PermNodeAddress, nic.node_addr,
480
+	memcpy ( &undi_get_information->PermNodeAddress, nic->node_addr,
473
 		 ETH_ALEN );
481
 		 ETH_ALEN );
474
-	undi_get_information->ROMAddress = nic.rom_info->rom_segment;
482
+	undi_get_information->ROMAddress = 0;
483
+		/* nic->rom_info->rom_segment; */
475
 	/* We only provide the ability to receive or transmit a single
484
 	/* We only provide the ability to receive or transmit a single
476
 	 * packet at a time.  This is a bootloader, not an OS.
485
 	 * packet at a time.  This is a bootloader, not an OS.
477
 	 */
486
 	 */
552
  */
561
  */
553
 PXENV_EXIT_t pxenv_undi_get_nic_type ( t_PXENV_UNDI_GET_NIC_TYPE
562
 PXENV_EXIT_t pxenv_undi_get_nic_type ( t_PXENV_UNDI_GET_NIC_TYPE
554
 				       *undi_get_nic_type ) {
563
 				       *undi_get_nic_type ) {
555
-	struct dev *dev = &nic.dev;
564
+#warning "device probing mechanism has changed completely"
565
+
566
+#if 0
567
+	struct dev *dev = &dev;
556
 	
568
 	
557
 	DBG ( "PXENV_UNDI_GET_NIC_TYPE" );
569
 	DBG ( "PXENV_UNDI_GET_NIC_TYPE" );
558
 	ENSURE_READY ( undi_get_nic_type );
570
 	ENSURE_READY ( undi_get_nic_type );
594
 	}
606
 	}
595
 	undi_get_nic_type->Status = PXENV_STATUS_SUCCESS;
607
 	undi_get_nic_type->Status = PXENV_STATUS_SUCCESS;
596
 	return PXENV_EXIT_SUCCESS;
608
 	return PXENV_EXIT_SUCCESS;
609
+
610
+#endif
597
 }
611
 }
598
 
612
 
599
 /* PXENV_UNDI_GET_IFACE_INFO
613
 /* PXENV_UNDI_GET_IFACE_INFO
622
  * Status: working
636
  * Status: working
623
  */
637
  */
624
 PXENV_EXIT_t pxenv_undi_isr ( t_PXENV_UNDI_ISR *undi_isr ) {
638
 PXENV_EXIT_t pxenv_undi_isr ( t_PXENV_UNDI_ISR *undi_isr ) {
625
-	media_header_t *media_header = (media_header_t*)nic.packet;
639
+	media_header_t *media_header = (media_header_t*)nic->packet;
626
 
640
 
627
 	DBG ( "PXENV_UNDI_ISR" );
641
 	DBG ( "PXENV_UNDI_ISR" );
628
 	/* We can't call ENSURE_READY, because this could be being
642
 	/* We can't call ENSURE_READY, because this could be being
668
 		 */
682
 		 */
669
 		DBG ( " PROCESS" );
683
 		DBG ( " PROCESS" );
670
 		if ( eth_poll ( 1 ) ) {
684
 		if ( eth_poll ( 1 ) ) {
671
-			DBG ( " RECEIVE %d", nic.packetlen );
672
-			if ( nic.packetlen > sizeof(pxe_stack->packet) ) {
685
+			DBG ( " RECEIVE %d", nic->packetlen );
686
+			if ( nic->packetlen > sizeof(pxe_stack->packet) ) {
673
 				/* Should never happen */
687
 				/* Should never happen */
674
 				undi_isr->FuncFlag = PXENV_UNDI_ISR_OUT_DONE;
688
 				undi_isr->FuncFlag = PXENV_UNDI_ISR_OUT_DONE;
675
 				undi_isr->Status =
689
 				undi_isr->Status =
677
 				return PXENV_EXIT_FAILURE;
691
 				return PXENV_EXIT_FAILURE;
678
 			}
692
 			}
679
 			undi_isr->FuncFlag = PXENV_UNDI_ISR_OUT_RECEIVE;
693
 			undi_isr->FuncFlag = PXENV_UNDI_ISR_OUT_RECEIVE;
680
-			undi_isr->BufferLength = nic.packetlen;
681
-			undi_isr->FrameLength = nic.packetlen;
694
+			undi_isr->BufferLength = nic->packetlen;
695
+			undi_isr->FrameLength = nic->packetlen;
682
 			undi_isr->FrameHeaderLength = ETH_HLEN;
696
 			undi_isr->FrameHeaderLength = ETH_HLEN;
683
-			memcpy ( pxe_stack->packet, nic.packet, nic.packetlen);
697
+			memcpy ( pxe_stack->packet, nic->packet, nic->packetlen);
684
 			PTR_TO_SEGOFF16 ( pxe_stack->packet, undi_isr->Frame );
698
 			PTR_TO_SEGOFF16 ( pxe_stack->packet, undi_isr->Frame );
685
 			switch ( ntohs(media_header->nstype) ) {
699
 			switch ( ntohs(media_header->nstype) ) {
686
 			case IP :	undi_isr->ProtType = P_IP;	break;
700
 			case IP :	undi_isr->ProtType = P_IP;	break;
1011
 PXENV_EXIT_t pxenv_udp_write ( t_PXENV_UDP_WRITE *udp_write ) {
1025
 PXENV_EXIT_t pxenv_udp_write ( t_PXENV_UDP_WRITE *udp_write ) {
1012
 	uint16_t src_port;
1026
 	uint16_t src_port;
1013
 	uint16_t dst_port;
1027
 	uint16_t dst_port;
1014
-	struct udppacket *packet = (struct udppacket *)nic.packet;
1028
+	struct udppacket *packet = (struct udppacket *)nic->packet;
1015
 	int packet_size;
1029
 	int packet_size;
1016
 
1030
 
1017
 	DBG ( "PXENV_UDP_WRITE" );
1031
 	DBG ( "PXENV_UDP_WRITE" );

Loading…
Cancel
Save