Kaynağa Gözat

Finished documenting the UNDI API.

tags/v0.9.3
Michael Brown 19 yıl önce
ebeveyn
işleme
442ba12b9e
1 değiştirilmiş dosya ile 239 ekleme ve 12 silme
  1. 239
    12
      src/include/pxe_api.h

+ 239
- 12
src/include/pxe_api.h Dosyayı Görüntüle

@@ -85,14 +85,6 @@ typedef struct s_PXENV_GET_CACHED_INFO PXENV_GET_CACHED_INFO_t;
85 85
 #define BOOTP_REQ	1	/**< A BOOTP request packet */
86 86
 #define BOOTP_REP	2	/**< A BOOTP reply packet */
87 87
 
88
-#define HWTYPE_ETHER		1	/**< Ethernet (10Mb) */
89
-#define HWTYPE_EXP_ETHER	2	/**< Experimental Ethernet (3Mb) */
90
-#define HWTYPE_AX25		3	/**< Amateur Radio AX.25 */
91
-#define HWTYPE_TOKEN_RING	4	/**< Proteon ProNET Token Ring */
92
-#define HWTYPE_CHAOS		5	/**< Chaos */
93
-#define HWTYPE_IEEE		6	/**< IEEE 802 Networks */
94
-#define HWTYPE_ARCNET		7	/**< ARCNET */
95
-
96 88
 /** DHCP broadcast flag
97 89
  *
98 90
  * Request a broadcast response (DHCPOFFER or DHCPACK) from the DHCP
@@ -116,10 +108,7 @@ struct bootph {
116 108
 	UINT8_t opcode;
117 109
 	/** NIC hardware type.
118 110
 	 *
119
-	 * Valid values are defined in RFC1010 ("Assigned numbers"),
120
-	 * and are #HWTYPE_ETHER, #HWTYPE_EXP_ETHER, #HWTYPE_AX25,
121
-	 * #HWTYPE_TOKEN_RING, #HWTYPE_CHAOS, #HWTYPE_IEEE and
122
-	 * #HWTYPE_ARCNET.
111
+	 * Valid values are as for s_PXENV_UNDI_GET_INFORMATION::HwType.
123 112
 	 */
124 113
 	UINT8_t Hardware;
125 114
 	UINT8_t Hardlen;		/**< MAC address length */
@@ -837,8 +826,65 @@ extern PXENV_EXIT_t pxenv_undi_close ( struct s_PXENV_UNDI_CLOSE *undi_close );
837 826
 /** PXE API function code for pxenv_undi_transmit() */
838 827
 #define	PXENV_UNDI_TRANSMIT		0x0008
839 828
 
829
+#define P_UNKNOWN	0		/**< Media header already filled in */
830
+#define P_IP		1		/**< IP protocol */
831
+#define P_ARP		2		/**< ARP protocol */
832
+#define P_RARP		3		/**< RARP protocol */
833
+#define P_OTHER		4		/**< Other protocol */
834
+
835
+#define XMT_DESTADDR	0x0000		/**< Unicast packet */
836
+#define XMT_BROADCAST	0x0001		/**< Broadcast packet */
837
+
838
+/** Maximum number of data blocks in a transmit buffer descriptor */
839
+#define MAX_DATA_BLKS	8
840
+
841
+/** A transmit buffer descriptor, as pointed to by s_PXENV_UNDI_TRANSMIT::TBD
842
+ */
843
+struct s_PXENV_UNDI_TBD {
844
+	UINT16_t ImmedLength;		/**< Length of the transmit buffer */
845
+	SEGOFF16_t Xmit;		/**< Address of the transmit buffer */
846
+	UINT16_t DataBlkCount;
847
+	/** Array of up to #MAX_DATA_BLKS additional transmit buffers */
848
+	struct DataBlk {
849
+		/** Always 1
850
+		 *
851
+		 * A value of 0 would indicate that #TDDataPtr were an
852
+		 * #ADDR32_t rather than a #SEGOFF16_t.  The PXE
853
+		 * specification version 2.1 explicitly states that
854
+		 * this is not supported; #TDDataPtr will always be a
855
+		 * #SEGOFF16_t.
856
+		 */
857
+		UINT8_t TDPtrType;
858
+		UINT8_t TDRsvdByte;	/**< Must be zero */
859
+		UINT16_t TDDataLen;	/**< Length of this transmit buffer */
860
+		SEGOFF16_t TDDataPtr;	/**< Address of this transmit buffer */
861
+	} DataBlock[MAX_DATA_BLKS];
862
+} PACKED;
863
+
864
+typedef struct s_PXENV_UNDI_TBD PXENV_UNDI_TBD_t;
865
+
840 866
 /** Parameter block for pxenv_undi_transmit() */
841 867
 struct s_PXENV_UNDI_TRANSMIT {
868
+	PXENV_STATUS_t	Status;		/**< PXE status code */
869
+	/** Protocol
870
+	 *
871
+	 * Valid values are #P_UNKNOWN, #P_IP, #P_ARP or #P_RARP.  If
872
+	 * the caller has already filled in the media header, this
873
+	 * field must be set to #P_UNKNOWN.
874
+	 */
875
+	UINT8_t Protocol;
876
+	/** Unicast/broadcast flag
877
+	 *
878
+	 * Valid values are #XMT_DESTADDR or #XMT_BROADCAST.
879
+	 */
880
+	UINT8_t XmitFlag;
881
+	SEGOFF16_t DestAddr;		/**< Destination MAC address */
882
+	/** Address of the Transmit Buffer Descriptor
883
+	 *
884
+	 * This is a pointer to a struct s_PXENV_UNDI_TBD.
885
+	 */
886
+	SEGOFF16_t TBD;
887
+	UINT32_t Reserved[2];		/**< Must be zero */
842 888
 } PACKED;
843 889
 
844 890
 typedef struct s_PXENV_UNDI_TRANSMIT PXENV_UNDI_TRANSMIT_t;
@@ -860,6 +906,9 @@ extern PXENV_EXIT_t pxenv_undi_transmit ( struct s_PXENV_UNDI_TRANSMIT
860 906
 
861 907
 /** Parameter block for pxenv_undi_set_mcast_address() */
862 908
 struct s_PXENV_UNDI_SET_MCAST_ADDRESS {
909
+	PXENV_STATUS_t	Status;		/**< PXE status code */
910
+	/** List of multicast addresses */
911
+	struct s_PXENV_UNDI_MCAST_ADDRESS R_Mcast_Buf;
863 912
 } PACKED;
864 913
 
865 914
 typedef struct s_PXENV_UNDI_SET_MCAST_ADDRESS PXENV_UNDI_SET_MCAST_ADDRESS_t;
@@ -881,6 +930,8 @@ extern PXENV_EXIT_t pxenv_undi_set_mcast_address (
881 930
 
882 931
 /** Parameter block for pxenv_undi_set_station_address() */
883 932
 struct s_PXENV_UNDI_SET_STATION_ADDRESS {
933
+	PXENV_STATUS_t	Status;		/**< PXE status code */
934
+	MAC_ADDR_t StationAddress;	/**< Station MAC address */
884 935
 } PACKED;
885 936
 
886 937
 typedef struct s_PXENV_UNDI_SET_STATION_ADDRESS PXENV_UNDI_SET_STATION_ADDRESS_t;
@@ -902,6 +953,18 @@ extern PXENV_EXIT_t pxenv_undi_set_station_address (
902 953
 
903 954
 /** Parameter block for pxenv_undi_set_packet_filter() */
904 955
 struct s_PXENV_UNDI_SET_PACKET_FILTER {
956
+	PXENV_STATUS_t	Status;		/**< PXE status code */
957
+	/** Receive packet filter
958
+	 *
959
+	 * This field takes the same values as
960
+	 * s_PXENV_UNDI_OPEN::PktFilter.
961
+	 *
962
+	 * @note Yes, this field is a different size to
963
+	 * s_PXENV_UNDI_OPEN::PktFilter.  Blame "the managers at Intel
964
+	 * who apparently let a consultant come up with the spec
965
+	 * without any kind of adult supervision" (quote from hpa).
966
+	 */
967
+	UINT8_t filter;
905 968
 } PACKED;
906 969
 
907 970
 typedef struct s_PXENV_UNDI_SET_PACKET_FILTER PXENV_UNDI_SET_PACKET_FILTER_t;
@@ -921,8 +984,33 @@ extern PXENV_EXIT_t pxenv_undi_set_packet_filter (
921 984
 /** PXE API function code for pxenv_undi_get_information() */
922 985
 #define	PXENV_UNDI_GET_INFORMATION	0x000c
923 986
 
987
+#define ETHER_TYPE		1	/**< Ethernet (10Mb) */
988
+#define EXP_ETHER_TYPE		2	/**< Experimental Ethernet (3Mb) */
989
+#define AX25_TYPE		3	/**< Amateur Radio AX.25 */
990
+#define TOKEN_RING_TYPE		4	/**< Proteon ProNET Token Ring */
991
+#define CHAOS_TYPE		5	/**< Chaos */
992
+#define IEEE_TYPE		6	/**< IEEE 802 Networks */
993
+#define ARCNET_TYPE		7	/**< ARCNET */
994
+
924 995
 /** Parameter block for pxenv_undi_get_information() */
925 996
 struct s_PXENV_UNDI_GET_INFORMATION {
997
+	PXENV_STATUS_t	Status;		/**< PXE status code */
998
+	UINT16_t BaseIo;		/**< I/O base address */
999
+	UINT16_t IntNumber;		/**< IRQ number */
1000
+	UINT16_t MaxTranUnit;		/**< Adapter MTU */
1001
+	/** Hardware type
1002
+	 *
1003
+	 * Valid values are defined in RFC1010 ("Assigned numbers"),
1004
+	 * and are #ETHER_TYPE, #EXP_ETHER_TYPE, #AX25_TYPE,
1005
+	 * #TOKEN_RING_TYPE, #CHAOS_TYPE, #IEEE_TYPE or #ARCNET_TYPE.
1006
+	 */
1007
+	UINT16_t HwType;
1008
+	UINT16_t HwAddrLen;		/**< MAC address length */
1009
+	MAC_ADDR_t CurrentNodeAddress;	/**< Current MAC address */
1010
+	MAC_ADDR_t PermNodeAddress;	/**< Permanent (EEPROM) MAC address */
1011
+	SEGSEL_t ROMAddress;		/**< Real-mode ROM segment address */
1012
+	UINT16_t RxBufCt;		/**< Receive queue length */
1013
+	UINT16_t TxBufCt;		/**< Transmit queue length */
926 1014
 } PACKED;
927 1015
 
928 1016
 typedef struct s_PXENV_UNDI_GET_INFORMATION PXENV_UNDI_GET_INFORMATION_t;
@@ -944,6 +1032,11 @@ extern PXENV_EXIT_t pxenv_undi_get_information (
944 1032
 
945 1033
 /** Parameter block for pxenv_undi_get_statistics() */
946 1034
 struct s_PXENV_UNDI_GET_STATISTICS {
1035
+	PXENV_STATUS_t	Status;		/**< PXE status code */
1036
+	UINT32_t XmtGoodFrames;		/**< Successful transmission count */
1037
+	UINT32_t RcvGoodFrames;		/**< Successful reception count */
1038
+	UINT32_t RcvCRCErrors;		/**< Receive CRC error count */
1039
+	UINT32_t RcvResourceErrors;	/**< Receive queue overflow count */
947 1040
 } PACKED;
948 1041
 
949 1042
 typedef struct s_PXENV_UNDI_GET_STATISTICS PXENV_UNDI_GET_STATISTICS_t;
@@ -965,6 +1058,7 @@ extern PXENV_EXIT_t pxenv_undi_get_statistics (
965 1058
 
966 1059
 /** Parameter block for pxenv_undi_clear_statistics() */
967 1060
 struct s_PXENV_UNDI_CLEAR_STATISTICS {
1061
+	PXENV_STATUS_t	Status;		/**< PXE status code */
968 1062
 } PACKED;
969 1063
 
970 1064
 typedef struct s_PXENV_UNDI_CLEAR_STATISTICS PXENV_UNDI_CLEAR_STATISTICS_t;
@@ -986,6 +1080,7 @@ extern PXENV_EXIT_t pxenv_undi_clear_statistics (
986 1080
 
987 1081
 /** Parameter block for pxenv_undi_initiate_diags() */
988 1082
 struct s_PXENV_UNDI_INITIATE_DIAGS {
1083
+	PXENV_STATUS_t	Status;		/**< PXE status code */
989 1084
 } PACKED;
990 1085
 
991 1086
 typedef struct s_PXENV_UNDI_INITIATE_DIAGS PXENV_UNDI_INITIATE_DIAGS_t;
@@ -1007,6 +1102,7 @@ extern PXENV_EXIT_t pxenv_undi_initiate_diags (
1007 1102
 
1008 1103
 /** Parameter block for pxenv_undi_force_interrupt() */
1009 1104
 struct s_PXENV_UNDI_FORCE_INTERRUPT {
1105
+	PXENV_STATUS_t	Status;		/**< PXE status code */
1010 1106
 } PACKED;
1011 1107
 
1012 1108
 typedef struct s_PXENV_UNDI_FORCE_INTERRUPT PXENV_UNDI_FORCE_INTERRUPT_t;
@@ -1028,6 +1124,9 @@ extern PXENV_EXIT_t pxenv_undi_force_interrupt (
1028 1124
 
1029 1125
 /** Parameter block for pxenv_undi_get_mcast_address() */
1030 1126
 struct s_PXENV_UNDI_GET_MCAST_ADDRESS {
1127
+	PXENV_STATUS_t	Status;		/**< PXE status code */
1128
+	IP4_t InetAddr;			/**< Multicast IP address */
1129
+	MAC_ADDR_t MediaAddr;		/**< Multicast MAC address */
1031 1130
 } PACKED;
1032 1131
 
1033 1132
 typedef struct s_PXENV_UNDI_GET_MCAST_ADDRESS PXENV_UNDI_GET_MCAST_ADDRESS_t;
@@ -1047,8 +1146,50 @@ extern PXENV_EXIT_t pxenv_undi_get_mcast_address (
1047 1146
 /** PXE API function code for pxenv_undi_get_nic_type() */
1048 1147
 #define	PXENV_UNDI_GET_NIC_TYPE		0x0012
1049 1148
 
1149
+#define PCI_NIC		2		/**< PCI network card */
1150
+#define PnP_NIC		3		/**< ISAPnP network card */
1151
+#define CardBus_NIC	4		/**< CardBus network card */
1152
+
1153
+/** Information for a PCI or equivalent NIC */
1154
+struct pci_nic_info {
1155
+	UINT16_t Vendor_ID;		/**< PCI vendor ID */
1156
+	UINT16_t Dev_ID;		/**< PCI device ID */
1157
+	UINT8_t Base_Class;		/**< PCI base class */
1158
+	UINT8_t Sub_Class;		/**< PCI sub class */
1159
+	UINT8_t Prog_Intf;		/**< PCI programming interface */
1160
+	UINT8_t Rev;			/**< PCI revision */
1161
+	UINT16_t BusDevFunc;		/**< PCI bus:dev:fn address */
1162
+	UINT16_t SubVendor_ID;		/**< PCI subvendor ID */
1163
+	UINT16_t SubDevice_ID;		/**< PCI subdevice ID */
1164
+} PACKED;
1165
+ 
1166
+/** Information for an ISAPnP or equivalent NIC */
1167
+struct pnp_nic_info {
1168
+	UINT32_t EISA_Dev_ID;		/**< EISA device ID */
1169
+	UINT8_t Base_Class;		/**< Base class */
1170
+	UINT8_t Sub_Class;		/**< Sub class */
1171
+	UINT8_t Prog_Intf;		/**< Programming interface */
1172
+	/** Card Select Number assigned to card */
1173
+	UINT16_t CardSelNum;
1174
+} PACKED;
1175
+
1050 1176
 /** Parameter block for pxenv_undi_get_nic_type() */
1051 1177
 struct s_PXENV_UNDI_GET_NIC_TYPE {
1178
+	PXENV_STATUS_t	Status;		/**< PXE status code */
1179
+	/** NIC type
1180
+	 *
1181
+	 * Valid values are #PCI_NIC, #PnP_NIC or #CardBus_NIC.
1182
+	 */
1183
+	UINT8_t NicType;
1184
+	/** NIC information */
1185
+	union nic_type_info {
1186
+		/** NIC information (if #NicType==#PCI_NIC) */
1187
+		struct pci_nic_info pci;
1188
+		/** NIC information (if #NicType==#CardBus_NIC) */
1189
+		struct pci_nic_info cardbus;
1190
+		/** NIC information (if #NicType==#PnP_NIC) */
1191
+		struct pnp_nic_info pnp;
1192
+	} info;
1052 1193
 } PACKED;
1053 1194
 
1054 1195
 typedef struct s_PXENV_UNDI_GET_NIC_TYPE PXENV_UNDI_GET_NIC_TYPE_t;
@@ -1070,6 +1211,27 @@ extern PXENV_EXIT_t pxenv_undi_get_nic_type (
1070 1211
 
1071 1212
 /** Parameter block for pxenv_undi_get_iface_info() */
1072 1213
 struct s_PXENV_UNDI_GET_IFACE_INFO {
1214
+	PXENV_STATUS_t	Status;		/**< PXE status code */
1215
+	/** Interface type
1216
+	 *
1217
+	 * This is defined in the NDIS 2.0 specification to be one of
1218
+	 * the strings "802.3", "802.4", "802.5", "802.6", "DIX",
1219
+	 * "DIX+802.3", "APPLETALK", "ARCNET", "FDDI", "SDLC", "BSC",
1220
+	 * "HDLC", or "ISDN".
1221
+	 *
1222
+	 * "Normal" Ethernet, for various historical reasons, is
1223
+	 * "DIX+802.3".
1224
+	 */
1225
+	UINT8_t IfaceType[16];
1226
+	UINT32_t LinkSpeed;		/**< Link speed, in bits per second */
1227
+	/** Service flags
1228
+	 *
1229
+	 * These are the "service flags" defined in the "MAC
1230
+	 * Service-Specific Characteristics" table in the NDIS 2.0
1231
+	 * specification.  Almost all of them are irrelevant to PXE.
1232
+	 */
1233
+	UINT32_t ServiceFlags;
1234
+	UINT32_t Reserved[4];		/**< Must be zero */
1073 1235
 } PACKED;
1074 1236
 
1075 1237
 typedef struct s_PXENV_UNDI_GET_IFACE_INFO PXENV_UNDI_GET_IFACE_INFO_t;
@@ -1089,8 +1251,23 @@ extern PXENV_EXIT_t pxenv_undi_get_iface_info (
1089 1251
 /** PXE API function code for pxenv_undi_get_state() */
1090 1252
 #define PXENV_UNDI_GET_STATE		0x0015
1091 1253
 
1254
+/** pxenv_start_undi() has been called */
1255
+#define PXE_UNDI_GET_STATE_STARTED	1
1256
+/** pxenv_undi_initialize() has been called */
1257
+#define PXE_UNDI_GET_STATE_INITIALIZED	2
1258
+/** pxenv_undi_open() has been called */
1259
+#define PXE_UNDI_GET_STATE_OPENED	3
1260
+
1092 1261
 /** Parameter block for pxenv_undi_get_state() */
1093 1262
 struct s_PXENV_UNDI_GET_STATE {
1263
+	PXENV_STATUS_t	Status;		/**< PXE status code */
1264
+	/** Current state of the UNDI driver
1265
+	 *
1266
+	 * Valid values are #PXE_UNDI_GET_STATE_STARTED,
1267
+	 * #PXE_UNDI_GET_STATE_INITIALIZED or
1268
+	 * #PXE_UNDI_GET_STATE_OPENED.
1269
+	 */
1270
+	UINT8_t UNDIstate;
1094 1271
 } PACKED;
1095 1272
 
1096 1273
 typedef struct s_PXENV_UNDI_GET_STATE PXENV_UNDI_GET_STATE_t;
@@ -1110,8 +1287,58 @@ extern PXENV_EXIT_t pxenv_undi_get_state ( struct s_PXENV_UNDI_GET_STATE
1110 1287
 /** PXE API function code for pxenv_undi_isr() */
1111 1288
 #define	PXENV_UNDI_ISR			0x0014
1112 1289
 
1290
+/** Determine whether or not this is our interrupt */
1291
+#define PXENV_UNDI_ISR_IN_START		1
1292
+/** Start processing interrupt */
1293
+#define PXENV_UNDI_ISR_IN_PROCESS	2
1294
+/** Continue processing interrupt */
1295
+#define PXENV_UNDI_ISR_IN_GET_NEXT	3
1296
+/** This interrupt was ours */
1297
+#define PXENV_UNDI_ISR_OUT_OURS		0
1298
+/** This interrupt was not ours */
1299
+#define PXENV_UNDI_ISR_OUT_NOT_OURS	1
1300
+/** Finished processing interrupt */
1301
+#define PXENV_UNDI_ISR_OUT_DONE		0
1302
+/** A packet transmission has completed */
1303
+#define PXENV_UNDI_ISR_OUT_TRANSMIT	2
1304
+/** A packet has been received */
1305
+#define PXENV_UNDI_ISR_OUT_RECEIVE	3
1306
+/** We are already in the middle of processing an interrupt */
1307
+#define PXENV_UNDI_ISR_OUT_BUSY		4
1308
+
1309
+/** Unicast packet (or packet captured in promiscuous mode) */
1310
+#define P_DIRECTED	0
1311
+/** Broadcast packet */
1312
+#define P_BROADCAST	1
1313
+/** Multicast packet */
1314
+#define P_MULTICAST	2
1315
+
1113 1316
 /** Parameter block for pxenv_undi_isr() */
1114 1317
 struct s_PXENV_UNDI_ISR {
1318
+	PXENV_STATUS_t	Status;		/**< PXE status code */
1319
+	/** Function flag
1320
+	 *
1321
+	 * Valid values are #PXENV_UNDI_ISR_IN_START,
1322
+	 * #PXENV_UNDI_ISR_IN_PROCESS, #PXENV_UNDI_ISR_IN_GET_NEXT,
1323
+	 * #PXENV_UNDI_ISR_OUT_OURS, #PXENV_UNDI_ISR_OUT_NOT_OURS,
1324
+	 * #PXENV_UNDI_ISR_OUT_DONE, #PXENV_UNDI_ISR_OUT_TRANSMIT,
1325
+	 * #PXENV_UNDI_ISR_OUT_RECEIVE or #PXENV_UNDI_ISR_OUT_BUSY.
1326
+	 */
1327
+	UINT16_t FuncFlag;
1328
+	UINT16_t BufferLength;		/**< Data buffer length */
1329
+	UINT16_t FrameLength;		/**< Total frame length */
1330
+	UINT16_t FrameHeaderLength;	/**< Frame header length */
1331
+	SEGOFF16_t Frame;		/**< Data buffer address */
1332
+	/** Protocol type
1333
+	 *
1334
+	 * Valid values are #P_IP, #P_ARP, #P_RARP or #P_OTHER.
1335
+	 */
1336
+	UINT8_t ProtType;
1337
+	/** Packet type
1338
+	 *
1339
+	 * Valid values are #P_DIRECTED, #P_BROADCAST or #P_MULTICAST.
1340
+	 */
1341
+	UINT8_t PktType;
1115 1342
 } PACKED;
1116 1343
 
1117 1344
 typedef struct s_PXENV_UNDI_ISR PXENV_UNDI_ISR_t;

Loading…
İptal
Kaydet