Kaynağa Gözat

[pxe] Modularise PXE API provision

Use the linker table infrastructure to dispatch PXE API calls to the
relevant function.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 13 yıl önce
ebeveyn
işleme
fa410e0a41

+ 47
- 2
src/arch/i386/include/pxe.h Dosyayı Görüntüle

@@ -6,8 +6,12 @@ FILE_LICENCE ( GPL2_OR_LATER );
6 6
 #include "pxe_types.h"
7 7
 #include "pxe_api.h"
8 8
 #include <ipxe/device.h>
9
+#include <ipxe/tables.h>
9 10
 
10
-/* Parameter block for pxenv_unknown() */
11
+/** PXE API invalid function code */
12
+#define PXENV_UNKNOWN 0xffff
13
+
14
+/** Parameter block for pxenv_unknown() */
11 15
 struct s_PXENV_UNKNOWN {
12 16
 	PXENV_STATUS_t Status;			/**< PXE status code */
13 17
 } __attribute__ (( packed ));
@@ -72,6 +76,45 @@ union u_PXENV_ANY {
72 76
 
73 77
 typedef union u_PXENV_ANY PXENV_ANY_t;
74 78
 
79
+/** A PXE API call */
80
+struct pxe_api_call {
81
+	/** Entry point
82
+	 *
83
+	 * @v params		PXE API call parameters
84
+	 * @ret exit		PXE API call exit code
85
+	 */
86
+	PXENV_EXIT_t ( * entry ) ( union u_PXENV_ANY *params );
87
+	/** Length of parameters */
88
+	uint16_t params_len;
89
+	/** Opcode */
90
+	uint16_t opcode;
91
+};
92
+
93
+/** PXE API call table */
94
+#define PXE_API_CALLS __table ( struct pxe_api_call, "pxe_api_calls" )
95
+
96
+/** Declare a PXE API call */
97
+#define __pxe_api_call __table_entry ( PXE_API_CALLS, 01 )
98
+
99
+/**
100
+ * Define a PXE API call
101
+ *
102
+ * @v _opcode		Opcode
103
+ * @v _entry		Entry point
104
+ * @v _params_type	Type of parameter structure
105
+ * @ret call		PXE API call
106
+ */
107
+#define PXE_API_CALL( _opcode, _entry, _params_type ) {			      \
108
+	.entry = ( ( ( ( PXENV_EXIT_t ( * ) ( _params_type *params ) ) NULL ) \
109
+		    == ( ( typeof ( _entry ) * ) NULL ) )		      \
110
+		   ? ( ( PXENV_EXIT_t ( * )				      \
111
+			 ( union u_PXENV_ANY *params ) ) _entry )	      \
112
+		   : ( ( PXENV_EXIT_t ( * )				      \
113
+			 ( union u_PXENV_ANY *params ) ) _entry ) ),	      \
114
+	.params_len = sizeof ( _params_type ),				      \
115
+	.opcode = _opcode,						      \
116
+	}
117
+
75 118
 /** An UNDI expansion ROM header */
76 119
 struct undi_rom_header {
77 120
 	/** Signature
@@ -144,9 +187,11 @@ struct pcir_header {
144 187
 #define PCIR_SIGNATURE \
145 188
 	( ( 'P' << 0 ) + ( 'C' << 8 ) + ( 'I' << 16 ) + ( 'R' << 24 ) )
146 189
 
147
-
148 190
 extern struct net_device *pxe_netdev;
149 191
 
150 192
 extern void pxe_set_netdev ( struct net_device *netdev );
193
+extern PXENV_EXIT_t pxenv_tftp_read_file ( struct s_PXENV_TFTP_READ_FILE
194
+					   *tftp_read_file );
195
+extern PXENV_EXIT_t undi_loader ( struct s_UNDI_LOADER *undi_loader );
151 196
 
152 197
 #endif /* PXE_H */

+ 0
- 118
src/arch/i386/include/pxe_api.h Dosyayı Görüntüle

@@ -252,9 +252,6 @@ struct s_PXENV_UNLOAD_STACK {
252 252
 
253 253
 typedef struct s_PXENV_UNLOAD_STACK PXENV_UNLOAD_STACK_t;
254 254
 
255
-extern PXENV_EXIT_t pxenv_unload_stack ( struct s_PXENV_UNLOAD_STACK
256
-					 *unload_stack );
257
-
258 255
 /** @} */ /* pxenv_unload_stack */
259 256
 
260 257
 /** @defgroup pxenv_get_cached_info PXENV_GET_CACHED_INFO
@@ -403,9 +400,6 @@ struct bootph {
403 400
 
404 401
 typedef struct bootph BOOTPLAYER_t;
405 402
 
406
-extern PXENV_EXIT_t pxenv_get_cached_info ( struct s_PXENV_GET_CACHED_INFO
407
-					    *get_cached_info );
408
-
409 403
 /** @} */ /* pxenv_get_cached_info */
410 404
 
411 405
 /** @defgroup pxenv_restart_tftp PXENV_RESTART_TFTP
@@ -423,9 +417,6 @@ struct s_PXENV_TFTP_READ_FILE;
423 417
 
424 418
 typedef struct s_PXENV_RESTART_TFTP PXENV_RESTART_TFTP_t;
425 419
 
426
-extern PXENV_EXIT_t pxenv_restart_tftp ( struct s_PXENV_TFTP_READ_FILE
427
-					 *restart_tftp );
428
-
429 420
 /** @} */ /* pxenv_restart_tftp */
430 421
 
431 422
 /** @defgroup pxenv_start_undi PXENV_START_UNDI
@@ -496,8 +487,6 @@ struct s_PXENV_START_UNDI {
496 487
 
497 488
 typedef struct s_PXENV_START_UNDI PXENV_START_UNDI_t;
498 489
 
499
-extern PXENV_EXIT_t pxenv_start_undi ( struct s_PXENV_START_UNDI *start_undi );
500
-
501 490
 /** @} */ /* pxenv_start_undi */
502 491
 
503 492
 /** @defgroup pxenv_stop_undi PXENV_STOP_UNDI
@@ -517,8 +506,6 @@ struct s_PXENV_STOP_UNDI {
517 506
 
518 507
 typedef struct s_PXENV_STOP_UNDI PXENV_STOP_UNDI_t;
519 508
 
520
-extern PXENV_EXIT_t pxenv_stop_undi ( struct s_PXENV_STOP_UNDI *stop_undi );
521
-
522 509
 /** @} */ /* pxenv_stop_undi */
523 510
 
524 511
 /** @defgroup pxenv_start_base PXENV_START_BASE
@@ -538,8 +525,6 @@ struct s_PXENV_START_BASE {
538 525
 
539 526
 typedef struct s_PXENV_START_BASE PXENV_START_BASE_t;
540 527
 
541
-extern PXENV_EXIT_t pxenv_start_base ( struct s_PXENV_START_BASE *start_base );
542
-
543 528
 /** @} */ /* pxenv_start_base */
544 529
 
545 530
 /** @defgroup pxenv_stop_base PXENV_STOP_BASE
@@ -559,8 +544,6 @@ struct s_PXENV_STOP_BASE {
559 544
 
560 545
 typedef struct s_PXENV_STOP_BASE PXENV_STOP_BASE_t;
561 546
 
562
-extern PXENV_EXIT_t pxenv_stop_base ( struct s_PXENV_STOP_BASE *stop_base );
563
-
564 547
 /** @} */ /* pxenv_stop_base */
565 548
 
566 549
 /** @} */ /* pxe_preboot_api */
@@ -600,8 +583,6 @@ struct s_PXENV_TFTP_OPEN {
600 583
 
601 584
 typedef struct s_PXENV_TFTP_OPEN PXENV_TFTP_OPEN_t;
602 585
 
603
-extern PXENV_EXIT_t pxenv_tftp_open ( struct s_PXENV_TFTP_OPEN *tftp_open );
604
-
605 586
 /** @} */ /* pxenv_tftp_open */
606 587
 
607 588
 /** @defgroup pxenv_tftp_close PXENV_TFTP_CLOSE
@@ -621,8 +602,6 @@ struct s_PXENV_TFTP_CLOSE {
621 602
 
622 603
 typedef struct s_PXENV_TFTP_CLOSE PXENV_TFTP_CLOSE_t;
623 604
 
624
-extern PXENV_EXIT_t pxenv_tftp_close ( struct s_PXENV_TFTP_CLOSE *tftp_close );
625
-
626 605
 /** @} */ /* pxenv_tftp_close */
627 606
 
628 607
 /** @defgroup pxenv_tftp_read PXENV_TFTP_READ
@@ -645,8 +624,6 @@ struct s_PXENV_TFTP_READ {
645 624
 
646 625
 typedef struct s_PXENV_TFTP_READ PXENV_TFTP_READ_t;
647 626
 
648
-extern PXENV_EXIT_t pxenv_tftp_read ( struct s_PXENV_TFTP_READ *tftp_read );
649
-
650 627
 /** @} */ /* pxenv_tftp_read */
651 628
 
652 629
 /** @defgroup pxenv_tftp_read_file PXENV_TFTP_READ_FILE
@@ -690,9 +667,6 @@ struct s_PXENV_TFTP_READ_FILE {
690 667
 
691 668
 typedef struct s_PXENV_TFTP_READ_FILE PXENV_TFTP_READ_FILE_t;
692 669
 
693
-extern PXENV_EXIT_t pxenv_tftp_read_file ( struct s_PXENV_TFTP_READ_FILE
694
-					   *tftp_read_file );
695
-
696 670
 /** @} */ /* pxenv_tftp_read_file */
697 671
 
698 672
 /** @defgroup pxenv_tftp_get_fsize PXENV_TFTP_GET_FSIZE
@@ -716,9 +690,6 @@ struct s_PXENV_TFTP_GET_FSIZE {
716 690
 
717 691
 typedef struct s_PXENV_TFTP_GET_FSIZE PXENV_TFTP_GET_FSIZE_t;
718 692
 
719
-extern PXENV_EXIT_t pxenv_tftp_get_fsize ( struct s_PXENV_TFTP_GET_FSIZE
720
-					   *get_fsize );
721
-
722 693
 /** @} */ /* pxenv_tftp_get_fsize */
723 694
 
724 695
 /** @} */ /* pxe_tftp_api */
@@ -748,8 +719,6 @@ struct s_PXENV_UDP_OPEN {
748 719
 
749 720
 typedef struct s_PXENV_UDP_OPEN PXENV_UDP_OPEN_t;
750 721
 
751
-extern PXENV_EXIT_t pxenv_udp_open ( struct s_PXENV_UDP_OPEN *udp_open );
752
-
753 722
 /** @} */ /* pxenv_udp_open */
754 723
 
755 724
 /** @defgroup pxenv_udp_close PXENV_UDP_CLOSE
@@ -769,8 +738,6 @@ struct s_PXENV_UDP_CLOSE {
769 738
 
770 739
 typedef struct s_PXENV_UDP_CLOSE PXENV_UDP_CLOSE_t;
771 740
 
772
-extern PXENV_EXIT_t pxenv_udp_close ( struct s_PXENV_UDP_CLOSE *udp_close );
773
-
774 741
 /** @} */ /* pxenv_udp_close */
775 742
 
776 743
 /** @defgroup pxenv_udp_write PXENV_UDP_WRITE
@@ -796,8 +763,6 @@ struct s_PXENV_UDP_WRITE {
796 763
 
797 764
 typedef struct s_PXENV_UDP_WRITE PXENV_UDP_WRITE_t;
798 765
 
799
-extern PXENV_EXIT_t pxenv_udp_write ( struct s_PXENV_UDP_WRITE *udp_write );
800
-
801 766
 /** @} */ /* pxenv_udp_write */
802 767
 
803 768
 /** @defgroup pxenv_udp_read PXENV_UDP_READ
@@ -823,8 +788,6 @@ struct s_PXENV_UDP_READ {
823 788
 
824 789
 typedef struct s_PXENV_UDP_READ PXENV_UDP_READ_t;
825 790
 
826
-extern PXENV_EXIT_t pxenv_udp_read ( struct s_PXENV_UDP_READ *udp_read );
827
-
828 791
 /** @} */ /* pxenv_udp_read */
829 792
 
830 793
 /** @} */ /* pxe_udp_api */
@@ -860,9 +823,6 @@ struct s_PXENV_UNDI_STARTUP {
860 823
 
861 824
 typedef struct s_PXENV_UNDI_STARTUP PXENV_UNDI_STARTUP_t;
862 825
 
863
-extern PXENV_EXIT_t pxenv_undi_startup ( struct s_PXENV_UNDI_STARTUP
864
-					 *undi_startup );
865
-
866 826
 /** @} */ /* pxenv_undi_startup */
867 827
 
868 828
 /** @defgroup pxenv_undi_cleanup PXENV_UNDI_CLEANUP
@@ -882,9 +842,6 @@ struct s_PXENV_UNDI_CLEANUP {
882 842
 
883 843
 typedef struct s_PXENV_UNDI_CLEANUP PXENV_UNDI_CLEANUP_t;
884 844
 
885
-extern PXENV_EXIT_t pxenv_undi_cleanup ( struct s_PXENV_UNDI_CLEANUP
886
-					 *undi_cleanup );
887
-
888 845
 /** @} */ /* pxenv_undi_cleanup */
889 846
 
890 847
 /** @defgroup pxenv_undi_initialize PXENV_UNDI_INITIALIZE
@@ -913,9 +870,6 @@ struct s_PXENV_UNDI_INITIALIZE {
913 870
 
914 871
 typedef struct s_PXENV_UNDI_INITIALIZE PXENV_UNDI_INITIALIZE_t;
915 872
 
916
-extern PXENV_EXIT_t pxenv_undi_initialize ( struct s_PXENV_UNDI_INITIALIZE
917
-					    *undi_initialize );
918
-
919 873
 /** @} */ /* pxenv_undi_initialize */
920 874
 
921 875
 /** @defgroup pxenv_undi_reset_adapter PXENV_UNDI_RESET_ADAPTER
@@ -950,9 +904,6 @@ struct s_PXENV_UNDI_RESET {
950 904
 
951 905
 typedef struct s_PXENV_UNDI_RESET PXENV_UNDI_RESET_t;
952 906
 
953
-extern PXENV_EXIT_t pxenv_undi_reset_adapter ( struct s_PXENV_UNDI_RESET
954
-					       *undi_reset_adapter );
955
-
956 907
 /** @} */ /* pxenv_undi_reset_adapter */
957 908
 
958 909
 /** @defgroup pxenv_undi_shutdown PXENV_UNDI_SHUTDOWN
@@ -972,9 +923,6 @@ struct s_PXENV_UNDI_SHUTDOWN {
972 923
 
973 924
 typedef struct s_PXENV_UNDI_SHUTDOWN PXENV_UNDI_SHUTDOWN_t;
974 925
 
975
-extern PXENV_EXIT_t pxenv_undi_shutdown ( struct s_PXENV_UNDI_SHUTDOWN
976
-					  *undi_shutdown );
977
-
978 926
 /** @} */ /* pxenv_undi_shutdown */
979 927
 
980 928
 /** @defgroup pxenv_undi_open PXENV_UNDI_OPEN
@@ -1024,8 +972,6 @@ struct s_PXENV_UNDI_OPEN {
1024 972
 
1025 973
 typedef struct s_PXENV_UNDI_OPEN PXENV_UNDI_OPEN_t;
1026 974
 
1027
-extern PXENV_EXIT_t pxenv_undi_open ( struct s_PXENV_UNDI_OPEN *undi_open );
1028
-
1029 975
 /** @} */ /* pxenv_undi_open */
1030 976
 
1031 977
 /** @defgroup pxenv_undi_close PXENV_UNDI_CLOSE
@@ -1045,8 +991,6 @@ struct s_PXENV_UNDI_CLOSE {
1045 991
 
1046 992
 typedef struct s_PXENV_UNDI_CLOSE PXENV_UNDI_CLOSE_t;
1047 993
 
1048
-extern PXENV_EXIT_t pxenv_undi_close ( struct s_PXENV_UNDI_CLOSE *undi_close );
1049
-
1050 994
 /** @} */ /* pxenv_undi_close */
1051 995
 
1052 996
 /** @defgroup pxenv_undi_transmit PXENV_UNDI_TRANSMIT
@@ -1122,9 +1066,6 @@ struct s_PXENV_UNDI_TRANSMIT {
1122 1066
 
1123 1067
 typedef struct s_PXENV_UNDI_TRANSMIT PXENV_UNDI_TRANSMIT_t;
1124 1068
 
1125
-extern PXENV_EXIT_t pxenv_undi_transmit ( struct s_PXENV_UNDI_TRANSMIT
1126
-					  *undi_transmit );
1127
-
1128 1069
 /** @} */ /* pxenv_undi_transmit */
1129 1070
 
1130 1071
 /** @defgroup pxenv_undi_set_mcast_address PXENV_UNDI_SET_MCAST_ADDRESS
@@ -1146,9 +1087,6 @@ struct s_PXENV_UNDI_SET_MCAST_ADDRESS {
1146 1087
 
1147 1088
 typedef struct s_PXENV_UNDI_SET_MCAST_ADDRESS PXENV_UNDI_SET_MCAST_ADDRESS_t;
1148 1089
 
1149
-extern PXENV_EXIT_t pxenv_undi_set_mcast_address (
1150
-	       struct s_PXENV_UNDI_SET_MCAST_ADDRESS *undi_set_mcast_address );
1151
-
1152 1090
 /** @} */ /* pxenv_undi_set_mcast_address */
1153 1091
 
1154 1092
 /** @defgroup pxenv_undi_set_station_address PXENV_UNDI_SET_STATION_ADDRESS
@@ -1169,9 +1107,6 @@ struct s_PXENV_UNDI_SET_STATION_ADDRESS {
1169 1107
 
1170 1108
 typedef struct s_PXENV_UNDI_SET_STATION_ADDRESS PXENV_UNDI_SET_STATION_ADDRESS_t;
1171 1109
 
1172
-extern PXENV_EXIT_t pxenv_undi_set_station_address (
1173
-	   struct s_PXENV_UNDI_SET_STATION_ADDRESS *undi_set_station_address );
1174
-
1175 1110
 /** @} */ /* pxenv_undi_set_station_address */
1176 1111
 
1177 1112
 /** @defgroup pxenv_undi_set_packet_filter PXENV_UNDI_SET_PACKET_FILTER
@@ -1202,9 +1137,6 @@ struct s_PXENV_UNDI_SET_PACKET_FILTER {
1202 1137
 
1203 1138
 typedef struct s_PXENV_UNDI_SET_PACKET_FILTER PXENV_UNDI_SET_PACKET_FILTER_t;
1204 1139
 
1205
-extern PXENV_EXIT_t pxenv_undi_set_packet_filter (
1206
-	       struct s_PXENV_UNDI_SET_PACKET_FILTER *undi_set_packet_filter );
1207
-
1208 1140
 /** @} */ /* pxenv_undi_set_packet_filter */
1209 1141
 
1210 1142
 /** @defgroup pxenv_undi_get_information PXENV_UNDI_GET_INFORMATION
@@ -1248,9 +1180,6 @@ struct s_PXENV_UNDI_GET_INFORMATION {
1248 1180
 
1249 1181
 typedef struct s_PXENV_UNDI_GET_INFORMATION PXENV_UNDI_GET_INFORMATION_t;
1250 1182
 
1251
-extern PXENV_EXIT_t pxenv_undi_get_information (
1252
-		   struct s_PXENV_UNDI_GET_INFORMATION *undi_get_information );
1253
-
1254 1183
 /** @} */ /* pxenv_undi_get_information */
1255 1184
 
1256 1185
 /** @defgroup pxenv_undi_get_statistics PXENV_UNDI_GET_STATISTICS
@@ -1274,9 +1203,6 @@ struct s_PXENV_UNDI_GET_STATISTICS {
1274 1203
 
1275 1204
 typedef struct s_PXENV_UNDI_GET_STATISTICS PXENV_UNDI_GET_STATISTICS_t;
1276 1205
 
1277
-extern PXENV_EXIT_t pxenv_undi_get_statistics (
1278
-		     struct s_PXENV_UNDI_GET_STATISTICS *undi_get_statistics );
1279
-
1280 1206
 /** @} */ /* pxenv_undi_get_statistics */
1281 1207
 
1282 1208
 /** @defgroup pxenv_undi_clear_statistics PXENV_UNDI_CLEAR_STATISTICS
@@ -1296,9 +1222,6 @@ struct s_PXENV_UNDI_CLEAR_STATISTICS {
1296 1222
 
1297 1223
 typedef struct s_PXENV_UNDI_CLEAR_STATISTICS PXENV_UNDI_CLEAR_STATISTICS_t;
1298 1224
 
1299
-extern PXENV_EXIT_t pxenv_undi_clear_statistics (
1300
-		 struct s_PXENV_UNDI_CLEAR_STATISTICS *undi_clear_statistics );
1301
-
1302 1225
 /** @} */ /* pxenv_undi_clear_statistics */
1303 1226
 
1304 1227
 /** @defgroup pxenv_undi_initiate_diags PXENV_UNDI_INITIATE_DIAGS
@@ -1318,9 +1241,6 @@ struct s_PXENV_UNDI_INITIATE_DIAGS {
1318 1241
 
1319 1242
 typedef struct s_PXENV_UNDI_INITIATE_DIAGS PXENV_UNDI_INITIATE_DIAGS_t;
1320 1243
 
1321
-extern PXENV_EXIT_t pxenv_undi_initiate_diags (
1322
-		     struct s_PXENV_UNDI_INITIATE_DIAGS *undi_initiate_diags );
1323
-
1324 1244
 /** @} */ /* pxenv_undi_initiate_diags */
1325 1245
 
1326 1246
 /** @defgroup pxenv_undi_force_interrupt PXENV_UNDI_FORCE_INTERRUPT
@@ -1340,9 +1260,6 @@ struct s_PXENV_UNDI_FORCE_INTERRUPT {
1340 1260
 
1341 1261
 typedef struct s_PXENV_UNDI_FORCE_INTERRUPT PXENV_UNDI_FORCE_INTERRUPT_t;
1342 1262
 
1343
-extern PXENV_EXIT_t pxenv_undi_force_interrupt (
1344
-		   struct s_PXENV_UNDI_FORCE_INTERRUPT *undi_force_interrupt );
1345
-
1346 1263
 /** @} */ /* pxenv_undi_force_interrupt */
1347 1264
 
1348 1265
 /** @defgroup pxenv_undi_get_mcast_address PXENV_UNDI_GET_MCAST_ADDRESS
@@ -1364,9 +1281,6 @@ struct s_PXENV_UNDI_GET_MCAST_ADDRESS {
1364 1281
 
1365 1282
 typedef struct s_PXENV_UNDI_GET_MCAST_ADDRESS PXENV_UNDI_GET_MCAST_ADDRESS_t;
1366 1283
 
1367
-extern PXENV_EXIT_t pxenv_undi_get_mcast_address (
1368
-	       struct s_PXENV_UNDI_GET_MCAST_ADDRESS *undi_get_mcast_address );
1369
-
1370 1284
 /** @} */ /* pxenv_undi_get_mcast_address */
1371 1285
 
1372 1286
 /** @defgroup pxenv_undi_get_nic_type PXENV_UNDI_GET_NIC_TYPE
@@ -1427,9 +1341,6 @@ struct s_PXENV_UNDI_GET_NIC_TYPE {
1427 1341
 
1428 1342
 typedef struct s_PXENV_UNDI_GET_NIC_TYPE PXENV_UNDI_GET_NIC_TYPE_t;
1429 1343
 
1430
-extern PXENV_EXIT_t pxenv_undi_get_nic_type ( 
1431
-			 struct s_PXENV_UNDI_GET_NIC_TYPE *undi_get_nic_type );
1432
-
1433 1344
 /** @} */ /* pxenv_undi_get_nic_type */
1434 1345
 
1435 1346
 /** @defgroup pxenv_undi_get_iface_info PXENV_UNDI_GET_IFACE_INFO
@@ -1488,9 +1399,6 @@ struct s_PXENV_UNDI_GET_IFACE_INFO {
1488 1399
 
1489 1400
 typedef struct s_PXENV_UNDI_GET_IFACE_INFO PXENV_UNDI_GET_IFACE_INFO_t;
1490 1401
 
1491
-extern PXENV_EXIT_t pxenv_undi_get_iface_info (
1492
-		     struct s_PXENV_UNDI_GET_IFACE_INFO *undi_get_iface_info );
1493
-
1494 1402
 /** @} */ /* pxenv_undi_get_iface_info */
1495 1403
 
1496 1404
 /** @defgroup pxenv_undi_get_state PXENV_UNDI_GET_STATE
@@ -1524,9 +1432,6 @@ struct s_PXENV_UNDI_GET_STATE {
1524 1432
 
1525 1433
 typedef struct s_PXENV_UNDI_GET_STATE PXENV_UNDI_GET_STATE_t;
1526 1434
 
1527
-extern PXENV_EXIT_t pxenv_undi_get_state ( struct s_PXENV_UNDI_GET_STATE
1528
-					   *undi_get_state );
1529
-
1530 1435
 /** @} */ /* pxenv_undi_get_state */
1531 1436
 
1532 1437
 /** @defgroup pxenv_undi_isr PXENV_UNDI_ISR
@@ -1595,8 +1500,6 @@ struct s_PXENV_UNDI_ISR {
1595 1500
 
1596 1501
 typedef struct s_PXENV_UNDI_ISR PXENV_UNDI_ISR_t;
1597 1502
 
1598
-extern PXENV_EXIT_t pxenv_undi_isr ( struct s_PXENV_UNDI_ISR *undi_isr );
1599
-
1600 1503
 /** @} */ /* pxenv_undi_isr */
1601 1504
 
1602 1505
 /** @} */ /* pxe_undi_api */
@@ -1628,8 +1531,6 @@ struct s_PXENV_FILE_OPEN {
1628 1531
 
1629 1532
 typedef struct s_PXENV_FILE_OPEN PXENV_FILE_OPEN_t;
1630 1533
 
1631
-extern PXENV_EXIT_t pxenv_file_open ( struct s_PXENV_FILE_OPEN *file_open );
1632
-
1633 1534
 /** @} */ /* pxenv_file_open */
1634 1535
 
1635 1536
 /** @defgroup pxenv_file_close PXENV_FILE_CLOSE
@@ -1650,9 +1551,6 @@ struct s_PXENV_FILE_CLOSE {
1650 1551
 
1651 1552
 typedef struct s_PXENV_FILE_CLOSE PXENV_FILE_CLOSE_t;
1652 1553
 
1653
-extern PXENV_EXIT_t pxenv_file_close ( struct s_PXENV_FILE_CLOSE
1654
-				       *file_close );
1655
-
1656 1554
 /** @} */ /* pxenv_file_close */
1657 1555
 
1658 1556
 /** @defgroup pxenv_file_select PXENV_FILE_SELECT
@@ -1677,9 +1575,6 @@ struct s_PXENV_FILE_SELECT {
1677 1575
 
1678 1576
 typedef struct s_PXENV_FILE_SELECT PXENV_FILE_SELECT_t;
1679 1577
 
1680
-extern PXENV_EXIT_t pxenv_file_select ( struct s_PXENV_FILE_SELECT
1681
-					*file_select );
1682
-
1683 1578
 /** @} */ /* pxenv_file_select */
1684 1579
 
1685 1580
 /** @defgroup pxenv_file_read PXENV_FILE_READ
@@ -1702,8 +1597,6 @@ struct s_PXENV_FILE_READ {
1702 1597
 
1703 1598
 typedef struct s_PXENV_FILE_READ PXENV_FILE_READ_t;
1704 1599
 
1705
-extern PXENV_EXIT_t pxenv_file_read ( struct s_PXENV_FILE_READ *file_read );
1706
-
1707 1600
 /** @} */ /* pxenv_file_read */
1708 1601
 
1709 1602
 /** @defgroup pxenv_get_file_size PXENV_GET_FILE_SIZE
@@ -1725,9 +1618,6 @@ struct s_PXENV_GET_FILE_SIZE {
1725 1618
 
1726 1619
 typedef struct s_PXENV_GET_FILE_SIZE PXENV_GET_FILE_SIZE_t;
1727 1620
 
1728
-extern PXENV_EXIT_t pxenv_get_file_size ( struct s_PXENV_GET_FILE_SIZE
1729
-					  *get_file_size );
1730
-
1731 1621
 /** @} */ /* pxenv_get_file_size */
1732 1622
 
1733 1623
 /** @defgroup pxenv_file_exec PXENV_FILE_EXEC
@@ -1748,8 +1638,6 @@ struct s_PXENV_FILE_EXEC {
1748 1638
 
1749 1639
 typedef struct s_PXENV_FILE_EXEC PXENV_FILE_EXEC_t;
1750 1640
 
1751
-extern PXENV_EXIT_t pxenv_file_exec ( struct s_PXENV_FILE_EXEC *file_exec );
1752
-
1753 1641
 /** @} */ /* pxenv_file_exec */
1754 1642
 
1755 1643
 /** @defgroup pxenv_file_api_check PXENV_FILE_API_CHECK
@@ -1774,8 +1662,6 @@ struct s_PXENV_FILE_API_CHECK {
1774 1662
 
1775 1663
 typedef struct s_PXENV_FILE_API_CHECK PXENV_FILE_API_CHECK_t;
1776 1664
 
1777
-extern PXENV_EXIT_t pxenv_file_api_check ( struct s_PXENV_FILE_API_CHECK *file_api_check );
1778
-
1779 1665
 /** @} */ /* pxenv_file_api_check */
1780 1666
 
1781 1667
 /** @defgroup pxenv_file_exit_hook PXENV_FILE_EXIT_HOOK
@@ -1796,8 +1682,6 @@ struct s_PXENV_FILE_EXIT_HOOK {
1796 1682
 
1797 1683
 typedef struct s_PXENV_FILE_EXIT_HOOK PXENV_FILE_EXIT_HOOK_t;
1798 1684
 
1799
-extern PXENV_EXIT_t pxenv_file_exit_hook ( struct s_PXENV_FILE_EXIT_HOOK *file_exit_hook );
1800
-
1801 1685
 /** @} */ /* pxenv_file_exit_hook */
1802 1686
 
1803 1687
 /** @} */ /* pxe_file_api */
@@ -1847,8 +1731,6 @@ struct s_UNDI_LOADER {
1847 1731
 
1848 1732
 typedef struct s_UNDI_LOADER UNDI_LOADER_t;
1849 1733
 
1850
-extern PXENV_EXIT_t undi_loader ( struct s_UNDI_LOADER *undi_loader );
1851
-
1852 1734
 /** @} */ /* pxe_loader_api */
1853 1735
 
1854 1736
 /** @} */ /* pxe */

+ 41
- 273
src/arch/i386/interface/pxe/pxe_call.c Dosyayı Görüntüle

@@ -41,73 +41,6 @@ extern void pxe_int_1a ( void );
41 41
 /** INT 1A hooked flag */
42 42
 static int int_1a_hooked = 0;
43 43
 
44
-/** A function pointer to hold any PXE API call
45
- *
46
- * Used by pxe_api_call() to avoid large swathes of duplicated code.
47
- */
48
-union pxenv_call {
49
-	PXENV_EXIT_t ( * any ) ( union u_PXENV_ANY * );
50
-	PXENV_EXIT_t ( * unknown ) ( struct s_PXENV_UNKNOWN * );
51
-	PXENV_EXIT_t ( * unload_stack ) ( struct s_PXENV_UNLOAD_STACK * );
52
-	PXENV_EXIT_t ( * get_cached_info )
53
-			( struct s_PXENV_GET_CACHED_INFO * );
54
-	PXENV_EXIT_t ( * restart_tftp ) ( struct s_PXENV_TFTP_READ_FILE * );
55
-	PXENV_EXIT_t ( * start_undi ) ( struct s_PXENV_START_UNDI * );
56
-	PXENV_EXIT_t ( * stop_undi ) ( struct s_PXENV_STOP_UNDI * );
57
-	PXENV_EXIT_t ( * start_base ) ( struct s_PXENV_START_BASE * );
58
-	PXENV_EXIT_t ( * stop_base ) ( struct s_PXENV_STOP_BASE * );
59
-	PXENV_EXIT_t ( * tftp_open ) ( struct s_PXENV_TFTP_OPEN * );
60
-	PXENV_EXIT_t ( * tftp_close ) ( struct s_PXENV_TFTP_CLOSE * );
61
-	PXENV_EXIT_t ( * tftp_read ) ( struct s_PXENV_TFTP_READ * );
62
-	PXENV_EXIT_t ( * tftp_read_file ) ( struct s_PXENV_TFTP_READ_FILE * );
63
-	PXENV_EXIT_t ( * tftp_get_fsize ) ( struct s_PXENV_TFTP_GET_FSIZE * );
64
-	PXENV_EXIT_t ( * udp_open ) ( struct s_PXENV_UDP_OPEN * );
65
-	PXENV_EXIT_t ( * udp_close ) ( struct s_PXENV_UDP_CLOSE * );
66
-	PXENV_EXIT_t ( * udp_write ) ( struct s_PXENV_UDP_WRITE * );
67
-	PXENV_EXIT_t ( * udp_read ) ( struct s_PXENV_UDP_READ * );
68
-	PXENV_EXIT_t ( * undi_startup ) ( struct s_PXENV_UNDI_STARTUP * );
69
-	PXENV_EXIT_t ( * undi_cleanup ) ( struct s_PXENV_UNDI_CLEANUP * );
70
-	PXENV_EXIT_t ( * undi_initialize )
71
-			( struct s_PXENV_UNDI_INITIALIZE * );
72
-	PXENV_EXIT_t ( * undi_reset_adapter ) ( struct s_PXENV_UNDI_RESET * );
73
-	PXENV_EXIT_t ( * undi_shutdown ) ( struct s_PXENV_UNDI_SHUTDOWN * );
74
-	PXENV_EXIT_t ( * undi_open ) ( struct s_PXENV_UNDI_OPEN * );
75
-	PXENV_EXIT_t ( * undi_close ) ( struct s_PXENV_UNDI_CLOSE * );
76
-	PXENV_EXIT_t ( * undi_transmit ) ( struct s_PXENV_UNDI_TRANSMIT * );
77
-	PXENV_EXIT_t ( * undi_set_mcast_address )
78
-			( struct s_PXENV_UNDI_SET_MCAST_ADDRESS * );
79
-	PXENV_EXIT_t ( * undi_set_station_address )
80
-			( struct s_PXENV_UNDI_SET_STATION_ADDRESS * );
81
-	PXENV_EXIT_t ( * undi_set_packet_filter )
82
-			( struct s_PXENV_UNDI_SET_PACKET_FILTER * );
83
-	PXENV_EXIT_t ( * undi_get_information )
84
-			( struct s_PXENV_UNDI_GET_INFORMATION * );
85
-	PXENV_EXIT_t ( * undi_get_statistics )
86
-			( struct s_PXENV_UNDI_GET_STATISTICS * );
87
-	PXENV_EXIT_t ( * undi_clear_statistics )
88
-			( struct s_PXENV_UNDI_CLEAR_STATISTICS * );
89
-	PXENV_EXIT_t ( * undi_initiate_diags )
90
-			( struct s_PXENV_UNDI_INITIATE_DIAGS * );
91
-	PXENV_EXIT_t ( * undi_force_interrupt )
92
-			( struct s_PXENV_UNDI_FORCE_INTERRUPT * );
93
-	PXENV_EXIT_t ( * undi_get_mcast_address )
94
-			( struct s_PXENV_UNDI_GET_MCAST_ADDRESS * );
95
-	PXENV_EXIT_t ( * undi_get_nic_type )
96
-			( struct s_PXENV_UNDI_GET_NIC_TYPE * );
97
-	PXENV_EXIT_t ( * undi_get_iface_info )
98
-			( struct s_PXENV_UNDI_GET_IFACE_INFO * );
99
-	PXENV_EXIT_t ( * undi_get_state ) ( struct s_PXENV_UNDI_GET_STATE * );
100
-	PXENV_EXIT_t ( * undi_isr ) ( struct s_PXENV_UNDI_ISR * );
101
-	PXENV_EXIT_t ( * file_open ) ( struct s_PXENV_FILE_OPEN * );
102
-	PXENV_EXIT_t ( * file_close ) ( struct s_PXENV_FILE_CLOSE * );
103
-	PXENV_EXIT_t ( * file_select ) ( struct s_PXENV_FILE_SELECT * );
104
-	PXENV_EXIT_t ( * file_read ) ( struct s_PXENV_FILE_READ * );
105
-	PXENV_EXIT_t ( * get_file_size ) ( struct s_PXENV_GET_FILE_SIZE * );
106
-	PXENV_EXIT_t ( * file_exec ) ( struct s_PXENV_FILE_EXEC * );
107
-	PXENV_EXIT_t ( * file_api_check ) ( struct s_PXENV_FILE_API_CHECK * );
108
-	PXENV_EXIT_t ( * file_exit_hook ) ( struct s_PXENV_FILE_EXIT_HOOK * );
109
-};
110
-
111 44
 /**
112 45
  * Handle an unknown PXE API call
113 46
  *
@@ -120,6 +53,26 @@ static PXENV_EXIT_t pxenv_unknown ( struct s_PXENV_UNKNOWN *pxenv_unknown ) {
120 53
 	return PXENV_EXIT_FAILURE;
121 54
 }
122 55
 
56
+/** Unknown PXE API call list */
57
+struct pxe_api_call pxenv_unknown_api __pxe_api_call =
58
+	PXE_API_CALL ( PXENV_UNKNOWN, pxenv_unknown, struct s_PXENV_UNKNOWN );
59
+
60
+/**
61
+ * Locate PXE API call
62
+ *
63
+ * @v opcode		Opcode
64
+ * @ret call		PXE API call, or NULL
65
+ */
66
+static struct pxe_api_call * find_pxe_api_call ( uint16_t opcode ) {
67
+	struct pxe_api_call *call;
68
+
69
+	for_each_table_entry ( call, PXE_API_CALLS ) {
70
+		if ( call->opcode == opcode )
71
+			return call;
72
+	}
73
+	return NULL;
74
+}
75
+
123 76
 /**
124 77
  * Dispatch PXE API call
125 78
  *
@@ -128,220 +81,30 @@ static PXENV_EXIT_t pxenv_unknown ( struct s_PXENV_UNKNOWN *pxenv_unknown ) {
128 81
  * @ret ax		PXE exit code
129 82
  */
130 83
 __asmcall void pxe_api_call ( struct i386_all_regs *ix86 ) {
131
-	int opcode = ix86->regs.bx;
132
-	userptr_t parameters = real_to_user ( ix86->segs.es, ix86->regs.di );
133
-	size_t param_len;
134
-	union u_PXENV_ANY pxenv_any;
135
-	union pxenv_call pxenv_call;
84
+	uint16_t opcode = ix86->regs.bx;
85
+	userptr_t uparams = real_to_user ( ix86->segs.es, ix86->regs.di );
86
+	struct pxe_api_call *call;
87
+	union u_PXENV_ANY params;
136 88
 	PXENV_EXIT_t ret;
137 89
 
138
-	switch ( opcode ) {
139
-	case PXENV_UNLOAD_STACK:
140
-		pxenv_call.unload_stack = pxenv_unload_stack;
141
-		param_len = sizeof ( pxenv_any.unload_stack );
142
-		break;
143
-	case PXENV_GET_CACHED_INFO:
144
-		pxenv_call.get_cached_info = pxenv_get_cached_info;
145
-		param_len = sizeof ( pxenv_any.get_cached_info );
146
-		break;
147
-	case PXENV_RESTART_TFTP:
148
-		pxenv_call.restart_tftp = pxenv_restart_tftp;
149
-		param_len = sizeof ( pxenv_any.restart_tftp );
150
-		break;
151
-	case PXENV_START_UNDI:
152
-		pxenv_call.start_undi = pxenv_start_undi;
153
-		param_len = sizeof ( pxenv_any.start_undi );
154
-		break;
155
-	case PXENV_STOP_UNDI:
156
-		pxenv_call.stop_undi = pxenv_stop_undi;
157
-		param_len = sizeof ( pxenv_any.stop_undi );
158
-		break;
159
-	case PXENV_START_BASE:
160
-		pxenv_call.start_base = pxenv_start_base;
161
-		param_len = sizeof ( pxenv_any.start_base );
162
-		break;
163
-	case PXENV_STOP_BASE:
164
-		pxenv_call.stop_base = pxenv_stop_base;
165
-		param_len = sizeof ( pxenv_any.stop_base );
166
-		break;
167
-	case PXENV_TFTP_OPEN:
168
-		pxenv_call.tftp_open = pxenv_tftp_open;
169
-		param_len = sizeof ( pxenv_any.tftp_open );
170
-		break;
171
-	case PXENV_TFTP_CLOSE:
172
-		pxenv_call.tftp_close = pxenv_tftp_close;
173
-		param_len = sizeof ( pxenv_any.tftp_close );
174
-		break;
175
-	case PXENV_TFTP_READ:
176
-		pxenv_call.tftp_read = pxenv_tftp_read;
177
-		param_len = sizeof ( pxenv_any.tftp_read );
178
-		break;
179
-	case PXENV_TFTP_READ_FILE:
180
-		pxenv_call.tftp_read_file = pxenv_tftp_read_file;
181
-		param_len = sizeof ( pxenv_any.tftp_read_file );
182
-		break;
183
-	case PXENV_TFTP_GET_FSIZE:
184
-		pxenv_call.tftp_get_fsize = pxenv_tftp_get_fsize;
185
-		param_len = sizeof ( pxenv_any.tftp_get_fsize );
186
-		break;
187
-	case PXENV_UDP_OPEN:
188
-		pxenv_call.udp_open = pxenv_udp_open;
189
-		param_len = sizeof ( pxenv_any.udp_open );
190
-		break;
191
-	case PXENV_UDP_CLOSE:
192
-		pxenv_call.udp_close = pxenv_udp_close;
193
-		param_len = sizeof ( pxenv_any.udp_close );
194
-		break;
195
-	case PXENV_UDP_WRITE:
196
-		pxenv_call.udp_write = pxenv_udp_write;
197
-		param_len = sizeof ( pxenv_any.udp_write );
198
-		break;
199
-	case PXENV_UDP_READ:
200
-		pxenv_call.udp_read = pxenv_udp_read;
201
-		param_len = sizeof ( pxenv_any.udp_read );
202
-		break;
203
-	case PXENV_UNDI_STARTUP:
204
-		pxenv_call.undi_startup = pxenv_undi_startup;
205
-		param_len = sizeof ( pxenv_any.undi_startup );
206
-		break;
207
-	case PXENV_UNDI_CLEANUP:
208
-		pxenv_call.undi_cleanup = pxenv_undi_cleanup;
209
-		param_len = sizeof ( pxenv_any.undi_cleanup );
210
-		break;
211
-	case PXENV_UNDI_INITIALIZE:
212
-		pxenv_call.undi_initialize = pxenv_undi_initialize;
213
-		param_len = sizeof ( pxenv_any.undi_initialize );
214
-		break;
215
-	case PXENV_UNDI_RESET_ADAPTER:
216
-		pxenv_call.undi_reset_adapter = pxenv_undi_reset_adapter;
217
-		param_len = sizeof ( pxenv_any.undi_reset_adapter );
218
-		break;
219
-	case PXENV_UNDI_SHUTDOWN:
220
-		pxenv_call.undi_shutdown = pxenv_undi_shutdown;
221
-		param_len = sizeof ( pxenv_any.undi_shutdown );
222
-		break;
223
-	case PXENV_UNDI_OPEN:
224
-		pxenv_call.undi_open = pxenv_undi_open;
225
-		param_len = sizeof ( pxenv_any.undi_open );
226
-		break;
227
-	case PXENV_UNDI_CLOSE:
228
-		pxenv_call.undi_close = pxenv_undi_close;
229
-		param_len = sizeof ( pxenv_any.undi_close );
230
-		break;
231
-	case PXENV_UNDI_TRANSMIT:
232
-		pxenv_call.undi_transmit = pxenv_undi_transmit;
233
-		param_len = sizeof ( pxenv_any.undi_transmit );
234
-		break;
235
-	case PXENV_UNDI_SET_MCAST_ADDRESS:
236
-		pxenv_call.undi_set_mcast_address =
237
-			pxenv_undi_set_mcast_address;
238
-		param_len = sizeof ( pxenv_any.undi_set_mcast_address );
239
-		break;
240
-	case PXENV_UNDI_SET_STATION_ADDRESS:
241
-		pxenv_call.undi_set_station_address =
242
-			pxenv_undi_set_station_address;
243
-		param_len = sizeof ( pxenv_any.undi_set_station_address );
244
-		break;
245
-	case PXENV_UNDI_SET_PACKET_FILTER:
246
-		pxenv_call.undi_set_packet_filter =
247
-			pxenv_undi_set_packet_filter;
248
-		param_len = sizeof ( pxenv_any.undi_set_packet_filter );
249
-		break;
250
-	case PXENV_UNDI_GET_INFORMATION:
251
-		pxenv_call.undi_get_information = pxenv_undi_get_information;
252
-		param_len = sizeof ( pxenv_any.undi_get_information );
253
-		break;
254
-	case PXENV_UNDI_GET_STATISTICS:
255
-		pxenv_call.undi_get_statistics = pxenv_undi_get_statistics;
256
-		param_len = sizeof ( pxenv_any.undi_get_statistics );
257
-		break;
258
-	case PXENV_UNDI_CLEAR_STATISTICS:
259
-		pxenv_call.undi_clear_statistics = pxenv_undi_clear_statistics;
260
-		param_len = sizeof ( pxenv_any.undi_clear_statistics );
261
-		break;
262
-	case PXENV_UNDI_INITIATE_DIAGS:
263
-		pxenv_call.undi_initiate_diags = pxenv_undi_initiate_diags;
264
-		param_len = sizeof ( pxenv_any.undi_initiate_diags );
265
-		break;
266
-	case PXENV_UNDI_FORCE_INTERRUPT:
267
-		pxenv_call.undi_force_interrupt = pxenv_undi_force_interrupt;
268
-		param_len = sizeof ( pxenv_any.undi_force_interrupt );
269
-		break;
270
-	case PXENV_UNDI_GET_MCAST_ADDRESS:
271
-		pxenv_call.undi_get_mcast_address =
272
-			pxenv_undi_get_mcast_address;
273
-		param_len = sizeof ( pxenv_any.undi_get_mcast_address );
274
-		break;
275
-	case PXENV_UNDI_GET_NIC_TYPE:
276
-		pxenv_call.undi_get_nic_type = pxenv_undi_get_nic_type;
277
-		param_len = sizeof ( pxenv_any.undi_get_nic_type );
278
-		break;
279
-	case PXENV_UNDI_GET_IFACE_INFO:
280
-		pxenv_call.undi_get_iface_info = pxenv_undi_get_iface_info;
281
-		param_len = sizeof ( pxenv_any.undi_get_iface_info );
282
-		break;
283
-	case PXENV_UNDI_ISR:
284
-		pxenv_call.undi_isr = pxenv_undi_isr;
285
-		param_len = sizeof ( pxenv_any.undi_isr );
286
-		break;
287
-	case PXENV_FILE_OPEN:
288
-		pxenv_call.file_open = pxenv_file_open;
289
-		param_len = sizeof ( pxenv_any.file_open );
290
-		break;
291
-	case PXENV_FILE_CLOSE:
292
-		pxenv_call.file_close = pxenv_file_close;
293
-		param_len = sizeof ( pxenv_any.file_close );
294
-		break;
295
-	case PXENV_FILE_SELECT:
296
-		pxenv_call.file_select = pxenv_file_select;
297
-		param_len = sizeof ( pxenv_any.file_select );
298
-		break;
299
-	case PXENV_FILE_READ:
300
-		pxenv_call.file_read = pxenv_file_read;
301
-		param_len = sizeof ( pxenv_any.file_read );
302
-		break;
303
-	case PXENV_GET_FILE_SIZE:
304
-		pxenv_call.get_file_size = pxenv_get_file_size;
305
-		param_len = sizeof ( pxenv_any.get_file_size );
306
-		break;
307
-	case PXENV_FILE_EXEC:
308
-		pxenv_call.file_exec = pxenv_file_exec;
309
-		param_len = sizeof ( pxenv_any.file_exec );
310
-		break;
311
-	case PXENV_FILE_API_CHECK:
312
-		pxenv_call.file_api_check = pxenv_file_api_check;
313
-		param_len = sizeof ( pxenv_any.file_api_check );
314
-		break;
315
-	case PXENV_FILE_EXIT_HOOK:
316
-		pxenv_call.file_exit_hook = pxenv_file_exit_hook;
317
-		param_len = sizeof ( pxenv_any.file_exit_hook );
318
-		break;
319
-	default:
320
-		DBG ( "PXENV_UNKNOWN_%hx", opcode );
321
-		pxenv_call.unknown = pxenv_unknown;
322
-		param_len = sizeof ( pxenv_any.unknown );
323
-		break;
90
+	/* Locate API call */
91
+	call = find_pxe_api_call ( opcode );
92
+	if ( ! call ) {
93
+		DBGC ( &pxe_netdev, "PXENV_UNKNOWN_%04x\n", opcode );
94
+		call = &pxenv_unknown_api;
324 95
 	}
325 96
 
326 97
 	/* Copy parameter block from caller */
327
-	copy_from_user ( &pxenv_any, parameters, 0, param_len );
98
+	copy_from_user ( &params, uparams, 0, call->params_len );
328 99
 
329 100
 	/* Set default status in case child routine fails to do so */
330
-	pxenv_any.Status = PXENV_STATUS_FAILURE;
101
+	params.Status = PXENV_STATUS_FAILURE;
331 102
 
332 103
 	/* Hand off to relevant API routine */
333
-	DBG ( "[" );
334
-	ret = pxenv_call.any ( &pxenv_any );
335
-	if ( pxenv_any.Status != PXENV_STATUS_SUCCESS ) {
336
-		DBG ( " %02x", pxenv_any.Status );
337
-	}
338
-	if ( ret != PXENV_EXIT_SUCCESS ) {
339
-		DBG ( ret == PXENV_EXIT_FAILURE ? " err" : " ??" );
340
-	}
341
-	DBG ( "]" );
342
-	
104
+	ret = call->entry ( &params );
105
+
343 106
 	/* Copy modified parameter block back to caller and return */
344
-	copy_to_user ( parameters, 0, &pxenv_any, param_len );
107
+	copy_to_user ( uparams, 0, &params, call->params_len );
345 108
 	ix86->regs.ax = ret;
346 109
 }
347 110
 
@@ -351,8 +114,7 @@ __asmcall void pxe_api_call ( struct i386_all_regs *ix86 ) {
351 114
  * @v ix86		Registers for PXE call
352 115
  * @ret present		Zero (PXE stack present)
353 116
  */
354
-int pxe_api_call_weak ( struct i386_all_regs *ix86 )
355
-{
117
+int pxe_api_call_weak ( struct i386_all_regs *ix86 ) {
356 118
 	pxe_api_call ( ix86 );
357 119
 	return 0;
358 120
 }
@@ -519,3 +281,9 @@ int pxe_start_nbp ( void ) {
519 281
 
520 282
 	return rc;
521 283
 }
284
+
285
+REQUIRE_OBJECT ( pxe_preboot );
286
+REQUIRE_OBJECT ( pxe_undi );
287
+REQUIRE_OBJECT ( pxe_udp );
288
+REQUIRE_OBJECT ( pxe_tftp );
289
+REQUIRE_OBJECT ( pxe_file );

+ 31
- 10
src/arch/i386/interface/pxe/pxe_file.c Dosyayı Görüntüle

@@ -49,7 +49,7 @@ FEATURE ( FEATURE_MISC, "PXEXT", DHCP_EB_FEATURE_PXE_EXT, 2 );
49 49
  * @ret s_PXENV_FILE_OPEN::FileHandle	Handle of opened file
50 50
  *
51 51
  */
52
-PXENV_EXIT_t pxenv_file_open ( struct s_PXENV_FILE_OPEN *file_open ) {
52
+static PXENV_EXIT_t pxenv_file_open ( struct s_PXENV_FILE_OPEN *file_open ) {
53 53
 	userptr_t filename;
54 54
 	size_t filename_len;
55 55
 	int fd;
@@ -91,7 +91,7 @@ PXENV_EXIT_t pxenv_file_open ( struct s_PXENV_FILE_OPEN *file_open ) {
91 91
  * @ret s_PXENV_FILE_CLOSE::Status	PXE status code
92 92
  *
93 93
  */
94
-PXENV_EXIT_t pxenv_file_close ( struct s_PXENV_FILE_CLOSE *file_close ) {
94
+static PXENV_EXIT_t pxenv_file_close ( struct s_PXENV_FILE_CLOSE *file_close ) {
95 95
 
96 96
 	DBG ( "PXENV_FILE_CLOSE %d", file_close->FileHandle );
97 97
 
@@ -111,7 +111,8 @@ PXENV_EXIT_t pxenv_file_close ( struct s_PXENV_FILE_CLOSE *file_close ) {
111 111
  * @ret s_PXENV_FILE_SELECT::Ready	Indication of readiness
112 112
  *
113 113
  */
114
-PXENV_EXIT_t pxenv_file_select ( struct s_PXENV_FILE_SELECT *file_select ) {
114
+static PXENV_EXIT_t
115
+pxenv_file_select ( struct s_PXENV_FILE_SELECT *file_select ) {
115 116
 	fd_set fdset;
116 117
 	int ready;
117 118
 
@@ -143,7 +144,7 @@ PXENV_EXIT_t pxenv_file_select ( struct s_PXENV_FILE_SELECT *file_select ) {
143 144
  * @ret s_PXENV_FILE_READ::BufferSize	Length of data read
144 145
  *
145 146
  */
146
-PXENV_EXIT_t pxenv_file_read ( struct s_PXENV_FILE_READ *file_read ) {
147
+static PXENV_EXIT_t pxenv_file_read ( struct s_PXENV_FILE_READ *file_read ) {
147 148
 	userptr_t buffer;
148 149
 	ssize_t len;
149 150
 
@@ -176,8 +177,8 @@ PXENV_EXIT_t pxenv_file_read ( struct s_PXENV_FILE_READ *file_read ) {
176 177
  * @ret s_PXENV_GET_FILE_SIZE::Status	PXE status code
177 178
  * @ret s_PXENV_GET_FILE_SIZE::FileSize	Size of file
178 179
  */
179
-PXENV_EXIT_t pxenv_get_file_size ( struct s_PXENV_GET_FILE_SIZE
180
-				   *get_file_size ) {
180
+static PXENV_EXIT_t
181
+pxenv_get_file_size ( struct s_PXENV_GET_FILE_SIZE *get_file_size ) {
181 182
 	ssize_t filesize;
182 183
 
183 184
 	DBG ( "PXENV_GET_FILE_SIZE %d", get_file_size->FileHandle );
@@ -205,7 +206,7 @@ PXENV_EXIT_t pxenv_get_file_size ( struct s_PXENV_GET_FILE_SIZE
205 206
  * @ret s_PXENV_FILE_EXEC::Status	PXE status code
206 207
  *
207 208
  */
208
-PXENV_EXIT_t pxenv_file_exec ( struct s_PXENV_FILE_EXEC *file_exec ) {
209
+static PXENV_EXIT_t pxenv_file_exec ( struct s_PXENV_FILE_EXEC *file_exec ) {
209 210
 	userptr_t command;
210 211
 	size_t command_len;
211 212
 	int rc;
@@ -250,7 +251,8 @@ segoff_t __data16 ( pxe_exit_hook ) = { 0, 0 };
250 251
  * @ret s_PXENV_FILE_API_CHECK::Flags	Reserved
251 252
  *
252 253
  */
253
-PXENV_EXIT_t pxenv_file_api_check ( struct s_PXENV_FILE_API_CHECK *file_api_check ) {
254
+static PXENV_EXIT_t
255
+pxenv_file_api_check ( struct s_PXENV_FILE_API_CHECK *file_api_check ) {
254 256
 	DBG ( "PXENV_FILE_API_CHECK" );
255 257
 
256 258
 	if ( file_api_check->Magic != 0x91d447b2 ) {
@@ -286,8 +288,8 @@ PXENV_EXIT_t pxenv_file_api_check ( struct s_PXENV_FILE_API_CHECK *file_api_chec
286 288
  * @ret s_PXENV_FILE_EXIT_HOOK::Status	PXE status code
287 289
  *
288 290
  */
289
-PXENV_EXIT_t pxenv_file_exit_hook ( struct s_PXENV_FILE_EXIT_HOOK
290
-					*file_exit_hook ) {
291
+static PXENV_EXIT_t
292
+pxenv_file_exit_hook ( struct s_PXENV_FILE_EXIT_HOOK *file_exit_hook ) {
291 293
 	DBG ( "PXENV_FILE_EXIT_HOOK" );
292 294
 
293 295
 	/* Check to see if we have a PXE exit hook */
@@ -304,3 +306,22 @@ PXENV_EXIT_t pxenv_file_exit_hook ( struct s_PXENV_FILE_EXIT_HOOK
304 306
 	return PXENV_EXIT_FAILURE;
305 307
 }
306 308
 
309
+/** PXE file API */
310
+struct pxe_api_call pxe_file_api[] __pxe_api_call = {
311
+	PXE_API_CALL ( PXENV_FILE_OPEN, pxenv_file_open,
312
+		       struct s_PXENV_FILE_OPEN ),
313
+	PXE_API_CALL ( PXENV_FILE_CLOSE, pxenv_file_close,
314
+		       struct s_PXENV_FILE_CLOSE ),
315
+	PXE_API_CALL ( PXENV_FILE_SELECT, pxenv_file_select,
316
+		       struct s_PXENV_FILE_SELECT ),
317
+	PXE_API_CALL ( PXENV_FILE_READ, pxenv_file_read,
318
+		       struct s_PXENV_FILE_READ ),
319
+	PXE_API_CALL ( PXENV_GET_FILE_SIZE, pxenv_get_file_size,
320
+		       struct s_PXENV_GET_FILE_SIZE ),
321
+	PXE_API_CALL ( PXENV_FILE_EXEC, pxenv_file_exec,
322
+		       struct s_PXENV_FILE_EXEC ),
323
+	PXE_API_CALL ( PXENV_FILE_API_CHECK, pxenv_file_api_check,
324
+		       struct s_PXENV_FILE_API_CHECK ),
325
+	PXE_API_CALL ( PXENV_FILE_EXIT_HOOK, pxenv_file_exit_hook,
326
+		       struct s_PXENV_FILE_EXIT_HOOK ),
327
+};

+ 28
- 9
src/arch/i386/interface/pxe/pxe_preboot.c Dosyayı Görüntüle

@@ -130,7 +130,8 @@ static union pxe_cached_info __bss16_array ( cached_info, [NUM_CACHED_INFOS] );
130 130
  * @ret ...
131 131
  *
132 132
  */
133
-PXENV_EXIT_t pxenv_unload_stack ( struct s_PXENV_UNLOAD_STACK *unload_stack ) {
133
+static PXENV_EXIT_t
134
+pxenv_unload_stack ( struct s_PXENV_UNLOAD_STACK *unload_stack ) {
134 135
 	DBGC ( &pxe_netdev, "PXENV_UNLOAD_STACK\n" );
135 136
 
136 137
 	unload_stack->Status = PXENV_STATUS_SUCCESS;
@@ -141,8 +142,8 @@ PXENV_EXIT_t pxenv_unload_stack ( struct s_PXENV_UNLOAD_STACK *unload_stack ) {
141 142
  *
142 143
  * Status: working
143 144
  */
144
-PXENV_EXIT_t pxenv_get_cached_info ( struct s_PXENV_GET_CACHED_INFO
145
-				     *get_cached_info ) {
145
+static PXENV_EXIT_t
146
+pxenv_get_cached_info ( struct s_PXENV_GET_CACHED_INFO *get_cached_info ) {
146 147
 	struct pxe_dhcp_packet_creator *creator;
147 148
 	union pxe_cached_info *info;
148 149
 	unsigned int idx;
@@ -244,8 +245,8 @@ PXENV_EXIT_t pxenv_get_cached_info ( struct s_PXENV_GET_CACHED_INFO
244 245
  *
245 246
  * Status: working
246 247
  */
247
-PXENV_EXIT_t pxenv_restart_tftp ( struct s_PXENV_TFTP_READ_FILE
248
-				  *restart_tftp ) {
248
+static PXENV_EXIT_t
249
+pxenv_restart_tftp ( struct s_PXENV_TFTP_READ_FILE *restart_tftp ) {
249 250
 	PXENV_EXIT_t tftp_exit;
250 251
 
251 252
 	DBGC ( &pxe_netdev, "PXENV_RESTART_TFTP\n" );
@@ -267,7 +268,7 @@ PXENV_EXIT_t pxenv_restart_tftp ( struct s_PXENV_TFTP_READ_FILE
267 268
  *
268 269
  * Status: working
269 270
  */
270
-PXENV_EXIT_t pxenv_start_undi ( struct s_PXENV_START_UNDI *start_undi ) {
271
+static PXENV_EXIT_t pxenv_start_undi ( struct s_PXENV_START_UNDI *start_undi ) {
271 272
 	unsigned int bus_type;
272 273
 	unsigned int location;
273 274
 	struct net_device *netdev;
@@ -316,7 +317,7 @@ PXENV_EXIT_t pxenv_start_undi ( struct s_PXENV_START_UNDI *start_undi ) {
316 317
  *
317 318
  * Status: working
318 319
  */
319
-PXENV_EXIT_t pxenv_stop_undi ( struct s_PXENV_STOP_UNDI *stop_undi ) {
320
+static PXENV_EXIT_t pxenv_stop_undi ( struct s_PXENV_STOP_UNDI *stop_undi ) {
320 321
 	DBGC ( &pxe_netdev, "PXENV_STOP_UNDI\n" );
321 322
 
322 323
 	/* Deactivate PXE */
@@ -341,7 +342,7 @@ PXENV_EXIT_t pxenv_stop_undi ( struct s_PXENV_STOP_UNDI *stop_undi ) {
341 342
  *
342 343
  * Status: won't implement (requires major structural changes)
343 344
  */
344
-PXENV_EXIT_t pxenv_start_base ( struct s_PXENV_START_BASE *start_base ) {
345
+static PXENV_EXIT_t pxenv_start_base ( struct s_PXENV_START_BASE *start_base ) {
345 346
 	DBGC ( &pxe_netdev, "PXENV_START_BASE\n" );
346 347
 
347 348
 	start_base->Status = PXENV_STATUS_UNSUPPORTED;
@@ -352,7 +353,7 @@ PXENV_EXIT_t pxenv_start_base ( struct s_PXENV_START_BASE *start_base ) {
352 353
  *
353 354
  * Status: working
354 355
  */
355
-PXENV_EXIT_t pxenv_stop_base ( struct s_PXENV_STOP_BASE *stop_base ) {
356
+static PXENV_EXIT_t pxenv_stop_base ( struct s_PXENV_STOP_BASE *stop_base ) {
356 357
 	DBGC ( &pxe_netdev, "PXENV_STOP_BASE\n" );
357 358
 
358 359
 	/* The only time we will be called is when the NBP is trying
@@ -363,3 +364,21 @@ PXENV_EXIT_t pxenv_stop_base ( struct s_PXENV_STOP_BASE *stop_base ) {
363 364
 	stop_base->Status = PXENV_STATUS_SUCCESS;
364 365
 	return PXENV_EXIT_SUCCESS;
365 366
 }
367
+
368
+/** PXE preboot API */
369
+struct pxe_api_call pxe_preboot_api[] __pxe_api_call = {
370
+	PXE_API_CALL ( PXENV_UNLOAD_STACK, pxenv_unload_stack,
371
+		       struct s_PXENV_UNLOAD_STACK ),
372
+	PXE_API_CALL ( PXENV_GET_CACHED_INFO, pxenv_get_cached_info,
373
+		       struct s_PXENV_GET_CACHED_INFO ),
374
+	PXE_API_CALL ( PXENV_RESTART_TFTP, pxenv_restart_tftp,
375
+		       struct s_PXENV_TFTP_READ_FILE ),
376
+	PXE_API_CALL ( PXENV_START_UNDI, pxenv_start_undi,
377
+		       struct s_PXENV_START_UNDI ),
378
+	PXE_API_CALL ( PXENV_STOP_UNDI, pxenv_stop_undi,
379
+		       struct s_PXENV_STOP_UNDI ),
380
+	PXE_API_CALL ( PXENV_START_BASE, pxenv_start_base,
381
+		       struct s_PXENV_START_BASE ),
382
+	PXE_API_CALL ( PXENV_STOP_BASE, pxenv_stop_base,
383
+		       struct s_PXENV_STOP_BASE ),
384
+};

+ 19
- 5
src/arch/i386/interface/pxe/pxe_tftp.c Dosyayı Görüntüle

@@ -233,7 +233,7 @@ static int pxe_tftp_open ( uint32_t ipaddress, unsigned int port,
233 233
  * view of the PXE API, it is conceptually impossible to issue any
234 234
  * other PXE API call "if an MTFTP connection is active".
235 235
  */
236
-PXENV_EXIT_t pxenv_tftp_open ( struct s_PXENV_TFTP_OPEN *tftp_open ) {
236
+static PXENV_EXIT_t pxenv_tftp_open ( struct s_PXENV_TFTP_OPEN *tftp_open ) {
237 237
 	int rc;
238 238
 
239 239
 	DBG ( "PXENV_TFTP_OPEN" );
@@ -285,7 +285,7 @@ PXENV_EXIT_t pxenv_tftp_open ( struct s_PXENV_TFTP_OPEN *tftp_open ) {
285 285
  * call this function with a 32-bit stack segment.  (See the relevant
286 286
  * @ref pxe_x86_pmode16 "implementation note" for more details.)
287 287
  */
288
-PXENV_EXIT_t pxenv_tftp_close ( struct s_PXENV_TFTP_CLOSE *tftp_close ) {
288
+static PXENV_EXIT_t pxenv_tftp_close ( struct s_PXENV_TFTP_CLOSE *tftp_close ) {
289 289
 	DBG ( "PXENV_TFTP_CLOSE" );
290 290
 
291 291
 	pxe_tftp_close ( &pxe_tftp, 0 );
@@ -354,7 +354,7 @@ PXENV_EXIT_t pxenv_tftp_close ( struct s_PXENV_TFTP_CLOSE *tftp_close ) {
354 354
  * call this function with a 32-bit stack segment.  (See the relevant
355 355
  * @ref pxe_x86_pmode16 "implementation note" for more details.)
356 356
  */
357
-PXENV_EXIT_t pxenv_tftp_read ( struct s_PXENV_TFTP_READ *tftp_read ) {
357
+static PXENV_EXIT_t pxenv_tftp_read ( struct s_PXENV_TFTP_READ *tftp_read ) {
358 358
 	int rc;
359 359
 
360 360
 	DBG ( "PXENV_TFTP_READ to %04x:%04x",
@@ -531,8 +531,8 @@ PXENV_EXIT_t pxenv_tftp_read_file ( struct s_PXENV_TFTP_READ_FILE
531 531
  * a file from a TFTP server listening on the standard TFTP port.
532 532
  * "Consistency" is not a word in Intel's vocabulary.
533 533
  */
534
-PXENV_EXIT_t pxenv_tftp_get_fsize ( struct s_PXENV_TFTP_GET_FSIZE
535
-				    *tftp_get_fsize ) {
534
+static PXENV_EXIT_t pxenv_tftp_get_fsize ( struct s_PXENV_TFTP_GET_FSIZE
535
+					   *tftp_get_fsize ) {
536 536
 	int rc;
537 537
 
538 538
 	DBG ( "PXENV_TFTP_GET_FSIZE" );
@@ -562,3 +562,17 @@ PXENV_EXIT_t pxenv_tftp_get_fsize ( struct s_PXENV_TFTP_GET_FSIZE
562 562
 	tftp_get_fsize->Status = PXENV_STATUS ( rc );
563 563
 	return ( rc ? PXENV_EXIT_FAILURE : PXENV_EXIT_SUCCESS );
564 564
 }
565
+
566
+/** PXE TFTP API */
567
+struct pxe_api_call pxe_tftp_api[] __pxe_api_call = {
568
+	PXE_API_CALL ( PXENV_TFTP_OPEN, pxenv_tftp_open,
569
+		       struct s_PXENV_TFTP_OPEN ),
570
+	PXE_API_CALL ( PXENV_TFTP_CLOSE, pxenv_tftp_close,
571
+		       struct s_PXENV_TFTP_CLOSE ),
572
+	PXE_API_CALL ( PXENV_TFTP_READ, pxenv_tftp_read,
573
+		       struct s_PXENV_TFTP_READ ),
574
+	PXE_API_CALL ( PXENV_TFTP_READ_FILE, pxenv_tftp_read_file,
575
+		       struct s_PXENV_TFTP_READ_FILE ),
576
+	PXE_API_CALL ( PXENV_TFTP_GET_FSIZE, pxenv_tftp_get_fsize,
577
+		       struct s_PXENV_TFTP_GET_FSIZE ),
578
+};

+ 18
- 4
src/arch/i386/interface/pxe/pxe_udp.c Dosyayı Görüntüle

@@ -159,7 +159,7 @@ static struct pxe_udp_connection pxe_udp = {
159 159
  * parameter.
160 160
  *
161 161
  */
162
-PXENV_EXIT_t pxenv_udp_open ( struct s_PXENV_UDP_OPEN *pxenv_udp_open ) {
162
+static PXENV_EXIT_t pxenv_udp_open ( struct s_PXENV_UDP_OPEN *pxenv_udp_open ) {
163 163
 	int rc;
164 164
 
165 165
 	DBG ( "PXENV_UDP_OPEN" );
@@ -202,7 +202,8 @@ PXENV_EXIT_t pxenv_udp_open ( struct s_PXENV_UDP_OPEN *pxenv_udp_open ) {
202 202
  * @ref pxe_x86_pmode16 "implementation note" for more details.)
203 203
  *
204 204
  */
205
-PXENV_EXIT_t pxenv_udp_close ( struct s_PXENV_UDP_CLOSE *pxenv_udp_close ) {
205
+static PXENV_EXIT_t
206
+pxenv_udp_close ( struct s_PXENV_UDP_CLOSE *pxenv_udp_close ) {
206 207
 	DBG ( "PXENV_UDP_CLOSE\n" );
207 208
 
208 209
 	/* Close UDP connection */
@@ -253,7 +254,8 @@ PXENV_EXIT_t pxenv_udp_close ( struct s_PXENV_UDP_CLOSE *pxenv_udp_close ) {
253 254
  * parameter.
254 255
  *
255 256
  */
256
-PXENV_EXIT_t pxenv_udp_write ( struct s_PXENV_UDP_WRITE *pxenv_udp_write ) {
257
+static PXENV_EXIT_t
258
+pxenv_udp_write ( struct s_PXENV_UDP_WRITE *pxenv_udp_write ) {
257 259
 	struct sockaddr_in dest;
258 260
 	struct xfer_metadata meta = {
259 261
 		.src = ( struct sockaddr * ) &pxe_udp.local,
@@ -359,7 +361,7 @@ PXENV_EXIT_t pxenv_udp_write ( struct s_PXENV_UDP_WRITE *pxenv_udp_write ) {
359 361
  * expects us to do so, and will fail if we don't.
360 362
  *
361 363
  */
362
-PXENV_EXIT_t pxenv_udp_read ( struct s_PXENV_UDP_READ *pxenv_udp_read ) {
364
+static PXENV_EXIT_t pxenv_udp_read ( struct s_PXENV_UDP_READ *pxenv_udp_read ) {
363 365
 	struct in_addr dest_ip_wanted = { .s_addr = pxenv_udp_read->dest_ip };
364 366
 	struct in_addr dest_ip;
365 367
 	uint16_t d_port_wanted = pxenv_udp_read->d_port;
@@ -405,3 +407,15 @@ PXENV_EXIT_t pxenv_udp_read ( struct s_PXENV_UDP_READ *pxenv_udp_read ) {
405 407
 	pxenv_udp_read->Status = PXENV_STATUS_FAILURE;
406 408
 	return PXENV_EXIT_FAILURE;
407 409
 }
410
+
411
+/** PXE UDP API */
412
+struct pxe_api_call pxe_udp_api[] __pxe_api_call = {
413
+	PXE_API_CALL ( PXENV_UDP_OPEN, pxenv_udp_open,
414
+		       struct s_PXENV_UDP_OPEN ),
415
+	PXE_API_CALL ( PXENV_UDP_CLOSE, pxenv_udp_close,
416
+		       struct s_PXENV_UDP_CLOSE ),
417
+	PXE_API_CALL ( PXENV_UDP_WRITE, pxenv_udp_write,
418
+		       struct s_PXENV_UDP_WRITE ),
419
+	PXE_API_CALL ( PXENV_UDP_READ, pxenv_udp_read,
420
+		       struct s_PXENV_UDP_READ ),
421
+};

+ 88
- 47
src/arch/i386/interface/pxe/pxe_undi.c Dosyayı Görüntüle

@@ -121,7 +121,8 @@ static void pxe_dump_mcast_list ( struct s_PXENV_UNDI_MCAST_ADDRESS *mcast ) {
121 121
  *
122 122
  * Status: working
123 123
  */
124
-PXENV_EXIT_t pxenv_undi_startup ( struct s_PXENV_UNDI_STARTUP *undi_startup ) {
124
+static PXENV_EXIT_t
125
+pxenv_undi_startup ( struct s_PXENV_UNDI_STARTUP *undi_startup ) {
125 126
 	DBGC ( &pxe_netdev, "PXENV_UNDI_STARTUP\n" );
126 127
 
127 128
 	/* Sanity check */
@@ -140,7 +141,8 @@ PXENV_EXIT_t pxenv_undi_startup ( struct s_PXENV_UNDI_STARTUP *undi_startup ) {
140 141
  *
141 142
  * Status: working
142 143
  */
143
-PXENV_EXIT_t pxenv_undi_cleanup ( struct s_PXENV_UNDI_CLEANUP *undi_cleanup ) {
144
+static PXENV_EXIT_t
145
+pxenv_undi_cleanup ( struct s_PXENV_UNDI_CLEANUP *undi_cleanup ) {
144 146
 	DBGC ( &pxe_netdev, "PXENV_UNDI_CLEANUP\n" );
145 147
 
146 148
 	/* Sanity check */
@@ -162,8 +164,8 @@ PXENV_EXIT_t pxenv_undi_cleanup ( struct s_PXENV_UNDI_CLEANUP *undi_cleanup ) {
162 164
  *
163 165
  * Status: working
164 166
  */
165
-PXENV_EXIT_t pxenv_undi_initialize ( struct s_PXENV_UNDI_INITIALIZE
166
-				     *undi_initialize ) {
167
+static PXENV_EXIT_t
168
+pxenv_undi_initialize ( struct s_PXENV_UNDI_INITIALIZE *undi_initialize ) {
167 169
 	DBGC ( &pxe_netdev, "PXENV_UNDI_INITIALIZE protocolini %08x\n",
168 170
 	       undi_initialize->ProtocolIni );
169 171
 
@@ -183,8 +185,8 @@ PXENV_EXIT_t pxenv_undi_initialize ( struct s_PXENV_UNDI_INITIALIZE
183 185
  *
184 186
  * Status: working
185 187
  */
186
-PXENV_EXIT_t pxenv_undi_reset_adapter ( struct s_PXENV_UNDI_RESET
187
-					*undi_reset_adapter ) {
188
+static PXENV_EXIT_t
189
+pxenv_undi_reset_adapter ( struct s_PXENV_UNDI_RESET *undi_reset_adapter ) {
188 190
 	int rc;
189 191
 
190 192
 	DBGC ( &pxe_netdev, "PXENV_UNDI_RESET_ADAPTER" );
@@ -216,8 +218,8 @@ PXENV_EXIT_t pxenv_undi_reset_adapter ( struct s_PXENV_UNDI_RESET
216 218
  *
217 219
  * Status: working
218 220
  */
219
-PXENV_EXIT_t pxenv_undi_shutdown ( struct s_PXENV_UNDI_SHUTDOWN
220
-				   *undi_shutdown ) {
221
+static PXENV_EXIT_t
222
+pxenv_undi_shutdown ( struct s_PXENV_UNDI_SHUTDOWN *undi_shutdown ) {
221 223
 	DBGC ( &pxe_netdev, "PXENV_UNDI_SHUTDOWN\n" );
222 224
 
223 225
 	/* Sanity check */
@@ -239,7 +241,7 @@ PXENV_EXIT_t pxenv_undi_shutdown ( struct s_PXENV_UNDI_SHUTDOWN
239 241
  *
240 242
  * Status: working
241 243
  */
242
-PXENV_EXIT_t pxenv_undi_open ( struct s_PXENV_UNDI_OPEN *undi_open ) {
244
+static PXENV_EXIT_t pxenv_undi_open ( struct s_PXENV_UNDI_OPEN *undi_open ) {
243 245
 	int rc;
244 246
 
245 247
 	DBGC ( &pxe_netdev, "PXENV_UNDI_OPEN flag %04x filter %04x",
@@ -271,7 +273,7 @@ PXENV_EXIT_t pxenv_undi_open ( struct s_PXENV_UNDI_OPEN *undi_open ) {
271 273
  *
272 274
  * Status: working
273 275
  */
274
-PXENV_EXIT_t pxenv_undi_close ( struct s_PXENV_UNDI_CLOSE *undi_close ) {
276
+static PXENV_EXIT_t pxenv_undi_close ( struct s_PXENV_UNDI_CLOSE *undi_close ) {
275 277
 	DBGC ( &pxe_netdev, "PXENV_UNDI_CLOSE\n" );
276 278
 
277 279
 	/* Sanity check */
@@ -293,8 +295,8 @@ PXENV_EXIT_t pxenv_undi_close ( struct s_PXENV_UNDI_CLOSE *undi_close ) {
293 295
  *
294 296
  * Status: working
295 297
  */
296
-PXENV_EXIT_t pxenv_undi_transmit ( struct s_PXENV_UNDI_TRANSMIT
297
-				   *undi_transmit ) {
298
+static PXENV_EXIT_t
299
+pxenv_undi_transmit ( struct s_PXENV_UNDI_TRANSMIT *undi_transmit ) {
298 300
 	struct s_PXENV_UNDI_TBD tbd;
299 301
 	struct DataBlk *datablk;
300 302
 	struct io_buffer *iobuf;
@@ -426,7 +428,7 @@ PXENV_EXIT_t pxenv_undi_transmit ( struct s_PXENV_UNDI_TRANSMIT
426 428
  *
427 429
  * Status: working (for NICs that support receive-all-multicast)
428 430
  */
429
-PXENV_EXIT_t
431
+static PXENV_EXIT_t
430 432
 pxenv_undi_set_mcast_address ( struct s_PXENV_UNDI_SET_MCAST_ADDRESS
431 433
 			       *undi_set_mcast_address ) {
432 434
 	DBGC ( &pxe_netdev, "PXENV_UNDI_SET_MCAST_ADDRESS" );
@@ -450,7 +452,7 @@ pxenv_undi_set_mcast_address ( struct s_PXENV_UNDI_SET_MCAST_ADDRESS
450 452
  *
451 453
  * Status: working
452 454
  */
453
-PXENV_EXIT_t 
455
+static PXENV_EXIT_t
454 456
 pxenv_undi_set_station_address ( struct s_PXENV_UNDI_SET_STATION_ADDRESS
455 457
 				 *undi_set_station_address ) {
456 458
 	struct ll_protocol *ll_protocol;
@@ -493,7 +495,7 @@ pxenv_undi_set_station_address ( struct s_PXENV_UNDI_SET_STATION_ADDRESS
493 495
  * Status: won't implement (would require driver API changes for no
494 496
  * real benefit)
495 497
  */
496
-PXENV_EXIT_t
498
+static PXENV_EXIT_t
497 499
 pxenv_undi_set_packet_filter ( struct s_PXENV_UNDI_SET_PACKET_FILTER
498 500
 			       *undi_set_packet_filter ) {
499 501
 
@@ -522,8 +524,9 @@ pxenv_undi_set_packet_filter ( struct s_PXENV_UNDI_SET_PACKET_FILTER
522 524
  *
523 525
  * Status: working
524 526
  */
525
-PXENV_EXIT_t pxenv_undi_get_information ( struct s_PXENV_UNDI_GET_INFORMATION
526
-					  *undi_get_information ) {
527
+static PXENV_EXIT_t
528
+pxenv_undi_get_information ( struct s_PXENV_UNDI_GET_INFORMATION
529
+			     *undi_get_information ) {
527 530
 	struct device *dev;
528 531
 	struct ll_protocol *ll_protocol;
529 532
 
@@ -574,8 +577,9 @@ PXENV_EXIT_t pxenv_undi_get_information ( struct s_PXENV_UNDI_GET_INFORMATION
574 577
  *
575 578
  * Status: working
576 579
  */
577
-PXENV_EXIT_t pxenv_undi_get_statistics ( struct s_PXENV_UNDI_GET_STATISTICS
578
-					 *undi_get_statistics ) {
580
+static PXENV_EXIT_t
581
+pxenv_undi_get_statistics ( struct s_PXENV_UNDI_GET_STATISTICS
582
+			    *undi_get_statistics ) {
579 583
 
580 584
 	/* Sanity check */
581 585
 	if ( ! pxe_netdev ) {
@@ -606,8 +610,9 @@ PXENV_EXIT_t pxenv_undi_get_statistics ( struct s_PXENV_UNDI_GET_STATISTICS
606 610
  *
607 611
  * Status: working
608 612
  */
609
-PXENV_EXIT_t pxenv_undi_clear_statistics ( struct s_PXENV_UNDI_CLEAR_STATISTICS
610
-					   *undi_clear_statistics ) {
613
+static PXENV_EXIT_t
614
+pxenv_undi_clear_statistics ( struct s_PXENV_UNDI_CLEAR_STATISTICS
615
+			      *undi_clear_statistics ) {
611 616
 	DBGC ( &pxe_netdev, "PXENV_UNDI_CLEAR_STATISTICS\n" );
612 617
 
613 618
 	/* Sanity check */
@@ -631,8 +636,9 @@ PXENV_EXIT_t pxenv_undi_clear_statistics ( struct s_PXENV_UNDI_CLEAR_STATISTICS
631 636
  * Status: won't implement (would require driver API changes for no
632 637
  * real benefit)
633 638
  */
634
-PXENV_EXIT_t pxenv_undi_initiate_diags ( struct s_PXENV_UNDI_INITIATE_DIAGS
635
-					 *undi_initiate_diags ) {
639
+static PXENV_EXIT_t
640
+pxenv_undi_initiate_diags ( struct s_PXENV_UNDI_INITIATE_DIAGS
641
+			    *undi_initiate_diags ) {
636 642
 	DBGC ( &pxe_netdev, "PXENV_UNDI_INITIATE_DIAGS failed: unsupported\n" );
637 643
 
638 644
 	/* Sanity check */
@@ -652,8 +658,9 @@ PXENV_EXIT_t pxenv_undi_initiate_diags ( struct s_PXENV_UNDI_INITIATE_DIAGS
652 658
  * Status: won't implement (would require driver API changes for no
653 659
  * perceptible benefit)
654 660
  */
655
-PXENV_EXIT_t pxenv_undi_force_interrupt ( struct s_PXENV_UNDI_FORCE_INTERRUPT
656
-					  *undi_force_interrupt ) {
661
+static PXENV_EXIT_t
662
+pxenv_undi_force_interrupt ( struct s_PXENV_UNDI_FORCE_INTERRUPT
663
+			     *undi_force_interrupt ) {
657 664
 	DBGC ( &pxe_netdev,
658 665
 	       "PXENV_UNDI_FORCE_INTERRUPT failed: unsupported\n" );
659 666
 
@@ -673,7 +680,7 @@ PXENV_EXIT_t pxenv_undi_force_interrupt ( struct s_PXENV_UNDI_FORCE_INTERRUPT
673 680
  *
674 681
  * Status: working
675 682
  */
676
-PXENV_EXIT_t
683
+static PXENV_EXIT_t
677 684
 pxenv_undi_get_mcast_address ( struct s_PXENV_UNDI_GET_MCAST_ADDRESS
678 685
 			       *undi_get_mcast_address ) {
679 686
 	struct ll_protocol *ll_protocol;
@@ -711,8 +718,8 @@ pxenv_undi_get_mcast_address ( struct s_PXENV_UNDI_GET_MCAST_ADDRESS
711 718
  *
712 719
  * Status: working
713 720
  */
714
-PXENV_EXIT_t pxenv_undi_get_nic_type ( struct s_PXENV_UNDI_GET_NIC_TYPE
715
-				       *undi_get_nic_type ) {
721
+static PXENV_EXIT_t pxenv_undi_get_nic_type ( struct s_PXENV_UNDI_GET_NIC_TYPE
722
+					      *undi_get_nic_type ) {
716 723
 	struct device *dev;
717 724
 
718 725
 	/* Sanity check */
@@ -782,8 +789,9 @@ PXENV_EXIT_t pxenv_undi_get_nic_type ( struct s_PXENV_UNDI_GET_NIC_TYPE
782 789
  *
783 790
  * Status: working
784 791
  */
785
-PXENV_EXIT_t pxenv_undi_get_iface_info ( struct s_PXENV_UNDI_GET_IFACE_INFO
786
-					 *undi_get_iface_info ) {
792
+static PXENV_EXIT_t
793
+pxenv_undi_get_iface_info ( struct s_PXENV_UNDI_GET_IFACE_INFO
794
+			    *undi_get_iface_info ) {
787 795
 
788 796
 	/* Sanity check */
789 797
 	if ( ! pxe_netdev ) {
@@ -819,29 +827,14 @@ PXENV_EXIT_t pxenv_undi_get_iface_info ( struct s_PXENV_UNDI_GET_IFACE_INFO
819 827
 
820 828
 /* PXENV_UNDI_GET_STATE
821 829
  *
822
- * Status: impossible
830
+ * Status: impossible due to opcode collision
823 831
  */
824
-PXENV_EXIT_t pxenv_undi_get_state ( struct s_PXENV_UNDI_GET_STATE
825
-				    *undi_get_state ) {
826
-	DBGC ( &pxe_netdev, "PXENV_UNDI_GET_STATE failed: unsupported\n" );
827
-
828
-	/* Sanity check */
829
-	if ( ! pxe_netdev ) {
830
-		DBGC ( &pxe_netdev, "PXENV_UNDI_GET_STATE called with "
831
-		       "no network device\n" );
832
-		undi_get_state->Status = PXENV_STATUS_UNDI_INVALID_STATE;
833
-		return PXENV_EXIT_FAILURE;
834
-	}
835
-
836
-	undi_get_state->Status = PXENV_STATUS_UNSUPPORTED;
837
-	return PXENV_EXIT_FAILURE;
838
-};
839 832
 
840 833
 /* PXENV_UNDI_ISR
841 834
  *
842 835
  * Status: working
843 836
  */
844
-PXENV_EXIT_t pxenv_undi_isr ( struct s_PXENV_UNDI_ISR *undi_isr ) {
837
+static PXENV_EXIT_t pxenv_undi_isr ( struct s_PXENV_UNDI_ISR *undi_isr ) {
845 838
 	struct io_buffer *iobuf;
846 839
 	size_t len;
847 840
 	struct ll_protocol *ll_protocol;
@@ -1025,3 +1018,51 @@ PXENV_EXIT_t pxenv_undi_isr ( struct s_PXENV_UNDI_ISR *undi_isr ) {
1025 1018
 	undi_isr->Status = PXENV_STATUS_SUCCESS;
1026 1019
 	return PXENV_EXIT_SUCCESS;
1027 1020
 }
1021
+
1022
+/** PXE UNDI API */
1023
+struct pxe_api_call pxe_undi_api[] __pxe_api_call = {
1024
+	PXE_API_CALL ( PXENV_UNDI_STARTUP, pxenv_undi_startup,
1025
+		       struct s_PXENV_UNDI_STARTUP ),
1026
+	PXE_API_CALL ( PXENV_UNDI_CLEANUP, pxenv_undi_cleanup,
1027
+		       struct s_PXENV_UNDI_CLEANUP ),
1028
+	PXE_API_CALL ( PXENV_UNDI_INITIALIZE, pxenv_undi_initialize,
1029
+		       struct s_PXENV_UNDI_INITIALIZE ),
1030
+	PXE_API_CALL ( PXENV_UNDI_RESET_ADAPTER, pxenv_undi_reset_adapter,
1031
+		       struct s_PXENV_UNDI_RESET ),
1032
+	PXE_API_CALL ( PXENV_UNDI_SHUTDOWN, pxenv_undi_shutdown,
1033
+		       struct s_PXENV_UNDI_SHUTDOWN ),
1034
+	PXE_API_CALL ( PXENV_UNDI_OPEN, pxenv_undi_open,
1035
+		       struct s_PXENV_UNDI_OPEN ),
1036
+	PXE_API_CALL ( PXENV_UNDI_CLOSE, pxenv_undi_close,
1037
+		       struct s_PXENV_UNDI_CLOSE ),
1038
+	PXE_API_CALL ( PXENV_UNDI_TRANSMIT, pxenv_undi_transmit,
1039
+		       struct s_PXENV_UNDI_TRANSMIT ),
1040
+	PXE_API_CALL ( PXENV_UNDI_SET_MCAST_ADDRESS,
1041
+		       pxenv_undi_set_mcast_address,
1042
+		       struct s_PXENV_UNDI_SET_MCAST_ADDRESS ),
1043
+	PXE_API_CALL ( PXENV_UNDI_SET_STATION_ADDRESS,
1044
+		       pxenv_undi_set_station_address,
1045
+		       struct s_PXENV_UNDI_SET_STATION_ADDRESS ),
1046
+	PXE_API_CALL ( PXENV_UNDI_SET_PACKET_FILTER,
1047
+		       pxenv_undi_set_packet_filter,
1048
+		       struct s_PXENV_UNDI_SET_PACKET_FILTER ),
1049
+	PXE_API_CALL ( PXENV_UNDI_GET_INFORMATION, pxenv_undi_get_information,
1050
+		       struct s_PXENV_UNDI_GET_INFORMATION ),
1051
+	PXE_API_CALL ( PXENV_UNDI_GET_STATISTICS, pxenv_undi_get_statistics,
1052
+		       struct s_PXENV_UNDI_GET_STATISTICS ),
1053
+	PXE_API_CALL ( PXENV_UNDI_CLEAR_STATISTICS, pxenv_undi_clear_statistics,
1054
+		       struct s_PXENV_UNDI_CLEAR_STATISTICS ),
1055
+	PXE_API_CALL ( PXENV_UNDI_INITIATE_DIAGS, pxenv_undi_initiate_diags,
1056
+		       struct s_PXENV_UNDI_INITIATE_DIAGS ),
1057
+	PXE_API_CALL ( PXENV_UNDI_FORCE_INTERRUPT, pxenv_undi_force_interrupt,
1058
+		       struct s_PXENV_UNDI_FORCE_INTERRUPT ),
1059
+	PXE_API_CALL ( PXENV_UNDI_GET_MCAST_ADDRESS,
1060
+		       pxenv_undi_get_mcast_address,
1061
+		       struct s_PXENV_UNDI_GET_MCAST_ADDRESS ),
1062
+	PXE_API_CALL ( PXENV_UNDI_GET_NIC_TYPE, pxenv_undi_get_nic_type,
1063
+		       struct s_PXENV_UNDI_GET_NIC_TYPE ),
1064
+	PXE_API_CALL ( PXENV_UNDI_GET_IFACE_INFO, pxenv_undi_get_iface_info,
1065
+		       struct s_PXENV_UNDI_GET_IFACE_INFO ),
1066
+	PXE_API_CALL ( PXENV_UNDI_ISR, pxenv_undi_isr,
1067
+		       struct s_PXENV_UNDI_ISR ),
1068
+};

Loading…
İptal
Kaydet