summaryrefslogtreecommitdiffstats
path: root/private/ntos/ndis/odimac/odihsm.h
blob: 0d17f1c0cd8ed159d7f6b7ece3d67a219d915d35 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
/*++

Copyright (c) 1990  Microsoft Corporation

Module Name:

    odihsm.h

Abstract:

    This contains all the definitions for the ODI HSM structures.

Author:

    Sean Selitrennikoff (seanse) 15-Jan-92

Environment:

    Kernel mode, FSD

Revision History:


--*/


typedef struct _ADAPTER_STRUC{

    UCHAR bus_type;             // 0 = ISA, 1 = MCA

    UCHAR mc_slot_num;          // MCA bus only

    USHORT pos_id;              // Adapter POS ID (Mca only)

    USHORT io_base;             // Adapter I/O Base

    PUCHAR adapter_text_ptr;    // See LM_Get_Config

    USHORT irq_value;           // IRQ line used by hardware

    USHORT rom_size;            // num of 1K blocks

    ULONG rom_base;             // physical address of ROM

    PVOID rom_access;           // Pointer into VM of rom_base

    USHORT ram_size;            // num of 1K blocks

    ULONG ram_base;             // physical address of RAM

    PVOID ram_access;           // Pointer into VM of ram_base

    USHORT ram_usable;          // num of 1K blocks that can be accessed at once

    USHORT io_base_new;         // new i/o base addr for LM_Put_Config

    UCHAR node_address[6];      // network address

    UCHAR permanent_node_address[6];      // network address burned into card.

    UCHAR multi_address[6];     // multicase address

    USHORT max_packet_size;     // for this MAC driver

    USHORT buffer_page_size;    // size of adapters RAM TX/RX buffer pages.

    USHORT num_of_tx_buffs;     // TX bufss in adapter RAM

    USHORT receive_lookahead_size;

    USHORT receive_mask;

    USHORT adapter_status;

    USHORT media_type;

    USHORT bic_type;

    USHORT nic_type;

    USHORT adapter_type;

    NDIS_HANDLE NdisAdapterHandle;

    NDIS_MCA_POS_DATA PosData;

    BOOLEAN TokenRing;

    //
    // Token Ring Specific stuff
    //


    USHORT ring_status;

    UCHAR funct_address[4];

    UCHAR group_address[6];

    //
    // These counters must be initialized by the upper layer.
    //


    //
    // Common counters...
    //

    PULONG ptr_rx_CRC_errors;

    PULONG ptr_rx_lost_pkts;


    //
    // Token Ring counters
    //

    PULONG ptr_rx_congestion;

    PULONG ptr_FCS_error;

    PULONG ptr_burst_error;

    PULONG ptr_AC_error;

    PULONG ptr_tx_abort_delimiter;

    PULONG ptr_tx_failed_return;

    PULONG ptr_frames_copied;

    PULONG ptr_frequency_error;

    PULONG ptr_monitor_gen_count;

    PULONG ptr_DMA_underruns;

    //
    // Ethernet specific counters.  Must be initialized by upper layer.
    //

    PULONG ptr_rx_too_big;

    PULONG ptr_rx_align_errors;

    PULONG ptr_rx_overruns;

    PULONG ptr_tx_deferred;

    PULONG ptr_tx_max_collisions;

    PULONG ptr_tx_one_collision;

    PULONG ptr_tx_mult_collisions;

    PULONG ptr_tx_ow_collision;

    PULONG ptr_tx_CD_heartbeat;

    PULONG ptr_tx_carrier_lost;

    PULONG ptr_tx_underruns;




    ULONG board_id;

    USHORT mode_bits;

    USHORT status_bits;

    USHORT xmit_buf_size;

    USHORT config_mode;                 // 1 == Store config in EEROM




    UCHAR State;

    BOOLEAN BufferOverflow;             // does an overflow need to be handled

    UCHAR InterruptMask;

    BOOLEAN UMRequestedInterrupt;       // Has LM_Interrupt() been called.



    NDIS_INTERRUPT NdisInterrupt;    // interrupt info used by wrapper

    UCHAR Current;

    //
    // Transmit information.
    //

    XMIT_BUF NextBufToFill;             // where to copy next packet to
    XMIT_BUF NextBufToXmit;             // valid if CurBufXmitting is -1
    XMIT_BUF CurBufXmitting;            // -1 if none is
    BOOLEAN TransmitInterruptPending;   // transmit interrupt and overwrite error?
    UINT PacketLens[MAX_XMIT_BUFS];
    BUFFER_STATUS BufferStatus[MAX_XMIT_BUFS];

    PUCHAR ReceiveStart;                // start of card receive area
    PUCHAR ReceiveStop;                 // end of card receive area


    //
    // Loopback information
    //

    PNDIS_PACKET LoopbackQueue;         // queue of packets to loop back
    PNDIS_PACKET LoopbackQTail;
    PNDIS_PACKET LoopbackPacket;        // current one we are looping back

    //
    // Receive information
    //

    PUCHAR IndicatingPacket;
    BOOLEAN OverWriteHandling;          // Currently handling an overwrite
    BOOLEAN OverWriteStartTransmit;
    UCHAR StartBuffer;                  // Start buffer number to receive into
    UCHAR LastBuffer;                   // Last buffer number + 1
    UINT PacketLen;

    //
    // Interrupt Information
    //

    UCHAR LaarHold;

    //
    // Pointer to the filter database for the MAC.
    //
    PETH_FILTER FilterDB;

}Adapter_Struc, *Ptr_Adapter_Struc;




//
// LMI Status and Return codes
//

typedef USHORT LM_STATUS;

#define SUCCESS              0x0
#define ADAPTER_AND_CONFIG   0x1    // Adapter found and config info gotten
#define ADAPTER_NO_CONFIG    0x2    // Adapter found, no config info found
#define NOT_MY_INTERRUPT     0x3    // No interrupt found in LM_Service_Events
#define FRAME_REJECTED       0x4
#define EVENTS_DISABLED      0x5    // Disables LM_Service_Events from reporting
                                    // any further interrupts.
#define OUT_OF_RESOURCES     0x6
#define OPEN_FAILED          0x7
#define HARDWARE_FAILED      0x8
#define INITIALIZE_FAILED    0x9
#define CLOSE_FAILED         0xA
#define MAX_COLLISIONS       0xB
#define FIFO_UNDERRUN        0xC
#define BUFFER_TOO_SMALL     0xD
#define ADAPTER_CLOSED       0xE
#define FAILURE              0xF

#define REQUEUE_LATER        0x12

#define INVALID_FUNCTION     0x80
#define INVALID_PARAMETER    0x81

#define ADAPTER_NOT_FOUND    0xFFFF



//
// Function Definitions.
//


extern
LM_STATUS
LM_Send(
    PNDIS_PACKET Packet,
    Ptr_Adapter_Struc Adapter
    );



extern
LM_STATUS
LM_Interrupt_req(
    Ptr_Adapter_Struc Adapter
    );


extern
LM_STATUS
LM_Service_Receive_Events(
    Ptr_Adapter_Struc Adapter
    );

extern
LM_STATUS
LM_Service_Transmit_Events(
    Ptr_Adapter_Struc Adapter
    );


extern
LM_STATUS
LM_Receive_Copy(
    PULONG Bytes_Transferred,
    ULONG Byte_Count,
    ULONG Offset,
    PNDIS_PACKET Packet,
    Ptr_Adapter_Struc Adapter
    );


extern
LM_STATUS
LM_Receive_Lookahead(
    ULONG Byte_Count,
    ULONG Offset,
    PUCHAR Buffer,
    Ptr_Adapter_Struc Adapter
    );

extern
LM_STATUS
LM_Get_Mca_Io_Base_Address(
    IN  Ptr_Adapter_Struc Adapt,
    IN  NDIS_HANDLE ConfigurationHandle,
    OUT USHORT *IoBaseAddress
    );

extern
LM_STATUS
LM_Get_Config(
    Ptr_Adapter_Struc Adapter
    );

extern
LM_STATUS
LM_Free_Resources(
    Ptr_Adapter_Struc Adapt
    );

extern
LM_STATUS
LM_Initialize_Adapter(
    Ptr_Adapter_Struc Adapter
    );


extern
LM_STATUS
LM_Open_Adapter(
    Ptr_Adapter_Struc Adapter
    );


extern
LM_STATUS
LM_Close_Adapter(
    Ptr_Adapter_Struc Adapter
    );


extern
LM_STATUS
LM_Disable_Adapter(
    Ptr_Adapter_Struc Adapter
    );

extern
LM_STATUS
LM_Disable_Adapter_Receives(
    Ptr_Adapter_Struc Adapt
    );

extern
LM_STATUS
LM_Disable_Adapter_Transmits(
    Ptr_Adapter_Struc Adapt
    );

extern
LM_STATUS
LM_Enable_Adapter(
    Ptr_Adapter_Struc Adapter
    );


extern
LM_STATUS
LM_Enable_Adapter_Receives(
    Ptr_Adapter_Struc Adapt
    );

extern
LM_STATUS
LM_Enable_Adapter_Transmits(
    Ptr_Adapter_Struc Adapt
    );

#define LM_Set_Multi_Address(Addresses, Count, Adapter) (SUCCESS)


extern
LM_STATUS
LM_Set_Receive_Mask(
    Ptr_Adapter_Struc Adapter
    );