Quellcode durchsuchen

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

tags/v0.9.3
Michael Brown vor 19 Jahren
Ursprung
Commit
236a195257
1 geänderte Dateien mit 40 neuen und 26 gelöschten Zeilen
  1. 40
    26
      src/core/pxe_export.c

+ 40
- 26
src/core/pxe_export.c Datei anzeigen

@@ -29,9 +29,9 @@
29 29
 #include "pxe.h"
30 30
 #include "pxe_export.h"
31 31
 #include "pxe_callbacks.h"
32
+#include "dev.h"
32 33
 #include "nic.h"
33 34
 #include "pci.h"
34
-#include "dev.h"
35 35
 #include "cpu.h"
36 36
 #include "timer.h"
37 37
 
@@ -121,10 +121,13 @@ pxe_stack_t *pxe_stack = NULL;
121 121
 int pxe_initialise_nic ( void ) {
122 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 128
 	 * when disable() is called, so we use this.
126 129
 	 */
127
-	if ( nic.dev.disable ) {
130
+	if ( dev.disable ) {
128 131
 		/* NIC may have been initialised independently
129 132
 		 * (e.g. when we set up the stack prior to calling the
130 133
 		 * NBP).
@@ -137,22 +140,26 @@ int pxe_initialise_nic ( void ) {
137 140
 	 * PROBE_AWAKE.  If one was specifed via PXENV_START_UNDI, try
138 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 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 148
 		DBG ( " reinitialising NIC" );
145
-		nic.dev.how_probe = PROBE_AWAKE;
149
+		dev.how_probe = PROBE_AWAKE;
146 150
 	} else {
147 151
 		DBG ( " probing for any NIC" );
148
-		nic.dev.how_probe = PROBE_FIRST;
152
+		dev.how_probe = PROBE_FIRST;
149 153
 	}
150
-	
154
+
151 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 157
 		DBG ( " failed" );
154 158
 		return 0;
155 159
 	}
160
+#endif
161
+	
162
+
156 163
 	pxe_stack->state = READY;
157 164
 	return 1;
158 165
 }
@@ -204,8 +211,6 @@ int ensure_pxe_state ( pxe_stack_state_t wanted ) {
204 211
  */
205 212
 PXENV_EXIT_t pxenv_start_undi ( t_PXENV_START_UNDI *start_undi ) {
206 213
 	unsigned char bus, devfn;
207
-	struct pci_probe_state *pci = &nic.dev.state.pci;
208
-	struct dev *dev = &nic.dev;
209 214
 
210 215
 	DBG ( "PXENV_START_UNDI" );
211 216
 	ENSURE_MIDWAY(start_undi);
@@ -220,6 +225,8 @@ PXENV_EXIT_t pxenv_start_undi ( t_PXENV_START_UNDI *start_undi ) {
220 225
 	bus = ( start_undi->ax >> 8 ) & 0xff;
221 226
 	devfn = start_undi->ax & 0xff;
222 227
 
228
+#warning "device probing mechanism has completely changed"
229
+#if 0
223 230
 	if ( ( pci->dev.driver == NULL ) ||
224 231
 	     ( pci->dev.bus != bus ) || ( pci->dev.devfn != devfn ) ) {
225 232
 		/* This is quite a bit of a hack and relies on
@@ -236,6 +243,7 @@ PXENV_EXIT_t pxenv_start_undi ( t_PXENV_START_UNDI *start_undi ) {
236 243
 		pci->dev.bus = bus;
237 244
 		pci->dev.devfn = devfn;
238 245
 	}
246
+#endif
239 247
 
240 248
 	start_undi->Status = PXENV_STATUS_SUCCESS;
241 249
 	return PXENV_EXIT_SUCCESS;
@@ -424,7 +432,7 @@ PXENV_EXIT_t pxenv_undi_set_station_address ( t_PXENV_UNDI_SET_STATION_ADDRESS
424 432
 	 * the current value anyway then return success, otherwise
425 433
 	 * return UNSUPPORTED.
426 434
 	 */
427
-	if ( memcmp ( nic.node_addr,
435
+	if ( memcmp ( nic->node_addr,
428 436
 		      &undi_set_station_address->StationAddress,
429 437
 		      ETH_ALEN ) == 0 ) {
430 438
 		undi_set_station_address->Status = PXENV_STATUS_SUCCESS;
@@ -456,8 +464,8 @@ PXENV_EXIT_t pxenv_undi_get_information ( t_PXENV_UNDI_GET_INFORMATION
456 464
 	DBG ( "PXENV_UNDI_GET_INFORMATION" );
457 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 469
 	/* Cheat: assume all cards can cope with this */
462 470
 	undi_get_information->MaxTranUnit = ETH_MAX_MTU;
463 471
 	/* Cheat: we only ever have Ethernet cards */
@@ -467,11 +475,12 @@ PXENV_EXIT_t pxenv_undi_get_information ( t_PXENV_UNDI_GET_INFORMATION
467 475
 	 * node address.  This is a valid assumption within Etherboot
468 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 479
 		 ETH_ALEN );
472
-	memcpy ( &undi_get_information->PermNodeAddress, nic.node_addr,
480
+	memcpy ( &undi_get_information->PermNodeAddress, nic->node_addr,
473 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 484
 	/* We only provide the ability to receive or transmit a single
476 485
 	 * packet at a time.  This is a bootloader, not an OS.
477 486
 	 */
@@ -552,7 +561,10 @@ PXENV_EXIT_t pxenv_undi_get_mcast_address ( t_PXENV_UNDI_GET_MCAST_ADDRESS
552 561
  */
553 562
 PXENV_EXIT_t pxenv_undi_get_nic_type ( t_PXENV_UNDI_GET_NIC_TYPE
554 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 569
 	DBG ( "PXENV_UNDI_GET_NIC_TYPE" );
558 570
 	ENSURE_READY ( undi_get_nic_type );
@@ -594,6 +606,8 @@ PXENV_EXIT_t pxenv_undi_get_nic_type ( t_PXENV_UNDI_GET_NIC_TYPE
594 606
 	}
595 607
 	undi_get_nic_type->Status = PXENV_STATUS_SUCCESS;
596 608
 	return PXENV_EXIT_SUCCESS;
609
+
610
+#endif
597 611
 }
598 612
 
599 613
 /* PXENV_UNDI_GET_IFACE_INFO
@@ -622,7 +636,7 @@ PXENV_EXIT_t pxenv_undi_get_iface_info ( t_PXENV_UNDI_GET_IFACE_INFO
622 636
  * Status: working
623 637
  */
624 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 641
 	DBG ( "PXENV_UNDI_ISR" );
628 642
 	/* We can't call ENSURE_READY, because this could be being
@@ -668,8 +682,8 @@ PXENV_EXIT_t pxenv_undi_isr ( t_PXENV_UNDI_ISR *undi_isr ) {
668 682
 		 */
669 683
 		DBG ( " PROCESS" );
670 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 687
 				/* Should never happen */
674 688
 				undi_isr->FuncFlag = PXENV_UNDI_ISR_OUT_DONE;
675 689
 				undi_isr->Status =
@@ -677,10 +691,10 @@ PXENV_EXIT_t pxenv_undi_isr ( t_PXENV_UNDI_ISR *undi_isr ) {
677 691
 				return PXENV_EXIT_FAILURE;
678 692
 			}
679 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 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 698
 			PTR_TO_SEGOFF16 ( pxe_stack->packet, undi_isr->Frame );
685 699
 			switch ( ntohs(media_header->nstype) ) {
686 700
 			case IP :	undi_isr->ProtType = P_IP;	break;
@@ -1011,7 +1025,7 @@ PXENV_EXIT_t pxenv_udp_read ( t_PXENV_UDP_READ *udp_read ) {
1011 1025
 PXENV_EXIT_t pxenv_udp_write ( t_PXENV_UDP_WRITE *udp_write ) {
1012 1026
 	uint16_t src_port;
1013 1027
 	uint16_t dst_port;
1014
-	struct udppacket *packet = (struct udppacket *)nic.packet;
1028
+	struct udppacket *packet = (struct udppacket *)nic->packet;
1015 1029
 	int packet_size;
1016 1030
 
1017 1031
 	DBG ( "PXENV_UDP_WRITE" );

Laden…
Abbrechen
Speichern