xref: /reactos/drivers/network/dd/dc21x4/media.c (revision 10e7643c)
1 /*
2  * PROJECT:     ReactOS DC21x4 Driver
3  * LICENSE:     GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4  * PURPOSE:     Media common code
5  * COPYRIGHT:   Copyright 2023 Dmitry Borisov <di.sean@protonmail.com>
6  */
7 
8 /* INCLUDES *******************************************************************/
9 
10 #include "dc21x4.h"
11 
12 #include <debug.h>
13 
14 /* FUNCTIONS ******************************************************************/
15 
16 VOID
17 MediaIndicateConnect(
18     _In_ PDC21X4_ADAPTER Adapter,
19     _In_ BOOLEAN LinkUp)
20 {
21     /* Nothing to do */
22     if (Adapter->LinkUp == LinkUp)
23         return;
24 
25     Adapter->LinkUp = LinkUp;
26 
27     INFO_VERB("Link %sconnected, media is %s\n",
28               LinkUp ? "" : "dis",
29               MediaNumber2Str(Adapter, Adapter->MediaNumber));
30 
31     NdisDprReleaseSpinLock(&Adapter->ModeLock);
32 
33     NdisMIndicateStatus(Adapter->AdapterHandle,
34                         LinkUp ? NDIS_STATUS_MEDIA_CONNECT : NDIS_STATUS_MEDIA_DISCONNECT,
35                         NULL,
36                         0);
37     NdisMIndicateStatusComplete(Adapter->AdapterHandle);
38 
39     NdisDprAcquireSpinLock(&Adapter->ModeLock);
40 }
41 
42 static
43 ULONG
44 MediaMiiNextMedia(
45     _In_ PDC21X4_ADAPTER Adapter)
46 {
47     Adapter->ModeFlags &= ~(DC_MODE_TEST_PACKET | DC_MODE_AUI_FAILED | DC_MODE_BNC_FAILED);
48     Adapter->LastReceiveActivity = (ULONG)Adapter->Statistics.ReceiveOk;
49 
50     /*
51      * In MII mode, we don't know exactly which port is active.
52      * Switch to the media with a higher priority.
53      */
54     if (Adapter->MediaBitmap & (1 << MEDIA_HMR))
55         return MEDIA_HMR;
56     else if (Adapter->MediaBitmap & (1 << MEDIA_AUI))
57         return MEDIA_AUI;
58     else
59         return MEDIA_BNC;
60 }
61 
62 static
63 VOID
64 MediaMiiSetSpeedAndDuplex(
65     _In_ PDC21X4_ADAPTER Adapter,
66     _In_ BOOLEAN FullDuplex,
67     _In_ BOOLEAN Speed100)
68 {
69     ULONG OpMode = Adapter->OpMode;
70 
71     if (FullDuplex)
72         OpMode |= DC_OPMODE_FULL_DUPLEX;
73     else
74         OpMode &= ~DC_OPMODE_FULL_DUPLEX;
75 
76     if (Speed100)
77         OpMode &= ~DC_OPMODE_PORT_XMIT_10;
78     else
79         OpMode |= DC_OPMODE_PORT_XMIT_10;
80 
81     /* Nothing to do */
82     if (OpMode == Adapter->OpMode)
83         return;
84 
85     INFO_VERB("Configuring MAC from %u %s-duplex to %u %s-duplex\n",
86               Adapter->LinkSpeedMbps,
87               (Adapter->OpMode & DC_OPMODE_FULL_DUPLEX) ? "full" : "half",
88               Speed100 ? 100 : 10,
89               FullDuplex ? "full" : "half");
90 
91     Adapter->LinkSpeedMbps = Speed100 ? 100 : 10;
92 
93     DcStopTxRxProcess(Adapter);
94 
95     Adapter->OpMode = OpMode;
96     DC_WRITE(Adapter, DcCsr6_OpMode, Adapter->OpMode);
97 }
98 
99 static
100 VOID
101 MediaMiiGetSpeedAndDuplex(
102     _In_ PDC21X4_ADAPTER Adapter,
103     _Out_ PBOOLEAN FullDuplex,
104     _Out_ PBOOLEAN Speed100)
105 {
106     ULONG MiiLinkPartnerAbility, AdvLpa;
107 
108     MiiRead(Adapter, Adapter->PhyAddress, MII_AUTONEG_LINK_PARTNER, &MiiLinkPartnerAbility);
109 
110     TRACE("MII LPA %04lx\n", MiiLinkPartnerAbility);
111 
112     AdvLpa = Adapter->MiiMedia.Advertising & MiiLinkPartnerAbility;
113     if (AdvLpa & MII_LP_100T_FD)
114     {
115         *FullDuplex = TRUE;
116         *Speed100 = TRUE;
117     }
118     else if (AdvLpa & MII_LP_100T4)
119     {
120         *FullDuplex = FALSE;
121         *Speed100 = TRUE;
122     }
123     else if (AdvLpa & MII_LP_100T_HD)
124     {
125         *FullDuplex = FALSE;
126         *Speed100 = TRUE;
127     }
128     else if (AdvLpa & MII_LP_10T_FD)
129     {
130         *FullDuplex = TRUE;
131         *Speed100 = FALSE;
132     }
133     else
134     {
135         *FullDuplex = FALSE;
136         *Speed100 = FALSE;
137     }
138 }
139 
140 BOOLEAN
141 MediaMiiCheckLink(
142     _In_ PDC21X4_ADAPTER Adapter)
143 {
144     ULONG MiiStatus;
145     BOOLEAN FullDuplex, Speed100;
146 
147     /* The link status is a latched-low bit, read it twice */
148     if (!MiiRead(Adapter, Adapter->PhyAddress, MII_STATUS, &MiiStatus))
149     {
150         goto NoLink;
151     }
152     if (!(MiiStatus & MII_SR_LINK_STATUS))
153     {
154         MiiRead(Adapter, Adapter->PhyAddress, MII_STATUS, &MiiStatus);
155     }
156     TRACE("MII Status %04lx\n", MiiStatus);
157 
158     /* Check the link status */
159     if (!(MiiStatus & MII_SR_LINK_STATUS))
160     {
161 NoLink:
162         /* No link detected, check the other port */
163         if (Adapter->MediaBitmap & ((1 << MEDIA_HMR) | (1 << MEDIA_AUI) | (1 << MEDIA_BNC)))
164         {
165             if ((Adapter->Features & DC_MII_AUTOSENSE) && !MEDIA_IS_FIXED(Adapter))
166             {
167                 Adapter->MediaNumber = MediaMiiNextMedia(Adapter);
168                 MediaSiaSelect(Adapter);
169             }
170         }
171 
172         return FALSE;
173     }
174 
175     /* If we are forcing speed and duplex */
176     if (MEDIA_IS_FIXED(Adapter))
177     {
178         FullDuplex = !!(Adapter->MiiControl & MII_CR_FULL_DUPLEX);
179         Speed100 = !!(Adapter->MiiControl & MII_CR_SPEED_SELECTION);
180     }
181     else
182     {
183         /* Check auto-negotiation is complete */
184         if (!(MiiStatus & MII_SR_AUTONEG_COMPLETE))
185             return FALSE;
186 
187         MediaMiiGetSpeedAndDuplex(Adapter, &FullDuplex, &Speed100);
188     }
189 
190     /* Set the link speed and duplex */
191     MediaMiiSetSpeedAndDuplex(Adapter, FullDuplex, Speed100);
192 
193     return TRUE;
194 }
195 
196 VOID
197 MediaMiiSelect(
198     _In_ PDC21X4_ADAPTER Adapter)
199 {
200     ULONG MiiControl, MiiAdvertise;
201 
202     MiiRead(Adapter, Adapter->PhyAddress, MII_CONTROL, &MiiControl);
203     MiiControl &= ~(MII_CR_POWER_DOWN | MII_CR_ISOLATE | MII_CR_RESET | MII_CR_SPEED_SELECTION |
204                     MII_CR_FULL_DUPLEX | MII_CR_AUTONEG | MII_CR_AUTONEG_RESTART);
205     MiiWrite(Adapter, Adapter->PhyAddress, MII_CONTROL, MiiControl);
206 
207     MiiControl |= Adapter->MiiControl;
208     MiiAdvertise = Adapter->MiiAdvertising;
209 
210     MiiWrite(Adapter, Adapter->PhyAddress, MII_AUTONEG_ADVERTISE, MiiAdvertise | MII_ADV_CSMA);
211     MiiWrite(Adapter, Adapter->PhyAddress, MII_CONTROL, MiiControl);
212 }
213 
214 VOID
215 MediaSelectMiiPort(
216     _In_ PDC21X4_ADAPTER Adapter,
217     _In_ BOOLEAN ResetPhy)
218 {
219     ULONG OpMode, i;
220 
221     if (Adapter->ChipType != DC21140)
222     {
223         DcWriteSia(Adapter, 0, 0, 0);
224     }
225 
226     OpMode = Adapter->OpMode;
227     OpMode &= ~DC_OPMODE_MEDIA_MASK;
228     OpMode |= DC_OPMODE_PORT_SELECT | DC_OPMODE_PORT_HEARTBEAT_DISABLE;
229     Adapter->OpMode = OpMode;
230 
231     DC_WRITE(Adapter, DcCsr6_OpMode, OpMode);
232 
233     NdisStallExecution(10);
234 
235     if (ResetPhy)
236     {
237         ASSERT(KeGetCurrentIrql() < DISPATCH_LEVEL);
238 
239         /* Execute the GPIO reset sequence */
240         if (Adapter->MiiMedia.ResetStreamLength)
241         {
242             /* Set the GPIO direction */
243             DcWriteGpio(Adapter, Adapter->MiiMedia.SetupStream[0]);
244 
245             for (i = 0; i < Adapter->MiiMedia.ResetStreamLength; ++i)
246             {
247                 NdisMSleep(100);
248                 DcWriteGpio(Adapter, Adapter->MiiMedia.ResetStream[i]);
249             }
250 
251             /* Give the PHY some time to reset */
252             NdisMSleep(5000);
253         }
254     }
255 
256     /* Set the GPIO direction */
257     DcWriteGpio(Adapter, Adapter->MiiMedia.SetupStream[0]);
258 
259     /* Execute the GPIO setup sequence */
260     for (i = 1; i < Adapter->MiiMedia.SetupStreamLength; ++i)
261     {
262         NdisStallExecution(10);
263         DcWriteGpio(Adapter, Adapter->MiiMedia.SetupStream[i]);
264     }
265 }
266 
267 VOID
268 MediaSiaSelect(
269     _In_ PDC21X4_ADAPTER Adapter)
270 {
271     ULONG OpMode;
272     PDC_MEDIA Media;
273 
274     INFO_VERB("Selected media %s\n",
275               MediaNumber2Str(Adapter, Adapter->MediaNumber));
276 
277     Media = &Adapter->Media[Adapter->MediaNumber];
278 
279     DcStopTxRxProcess(Adapter);
280 
281     if (Adapter->ChipType != DC21041)
282     {
283         /* Make sure the reset pulse is wide enough */
284         NdisStallExecution(100);
285         DcWriteGpio(Adapter, Media->GpioCtrl);
286         NdisStallExecution(100);
287         DcWriteGpio(Adapter, Media->GpioData);
288     }
289 
290     DcWriteSia(Adapter, Media->Csr13, Media->Csr14, Media->Csr15);
291 
292     NdisStallExecution(10);
293 
294     OpMode = Adapter->OpMode;
295     OpMode &= ~DC_OPMODE_MEDIA_MASK;
296     OpMode |= Media->OpMode;
297     Adapter->OpMode = OpMode;
298 
299     DC_WRITE(Adapter, DcCsr6_OpMode, OpMode);
300 }
301 
302 VOID
303 MediaGprSelect(
304     _In_ PDC21X4_ADAPTER Adapter)
305 {
306     ULONG OpMode;
307     PDC_MEDIA Media;
308 
309     INFO("Selected media %s\n", MediaNumber2Str(Adapter, Adapter->MediaNumber));
310 
311     Media = &Adapter->Media[Adapter->MediaNumber];
312 
313     DC_WRITE(Adapter, DcCsr12_Gpio, Media->GpioData);
314 
315     OpMode = Adapter->OpMode;
316     OpMode &= ~DC_OPMODE_MEDIA_MASK;
317     OpMode |= Media->OpMode;
318     Adapter->OpMode = OpMode;
319 
320     DC_WRITE(Adapter, DcCsr6_OpMode, OpMode);
321 }
322 
323 CODE_SEG("PAGE")
324 VOID
325 MediaInitDefaultMedia(
326     _In_ PDC21X4_ADAPTER Adapter,
327     _In_ ULONG MediaNumber)
328 {
329     ULONG Csr14, MiiAdvertising, MiiControl, i;
330     BOOLEAN UseMii;
331 
332     PAGED_CODE();
333 
334     /* Media auto-detection */
335     if (MediaNumber == MEDIA_AUTO)
336     {
337         Adapter->Flags |= DC_AUTOSENSE;
338 
339         /* Initial value for all boards */
340         Adapter->DefaultMedia = MEDIA_10T;
341 
342         Adapter->MiiAdvertising = Adapter->MiiMedia.Advertising;
343         Adapter->MiiControl = MII_CR_AUTONEG | MII_CR_AUTONEG_RESTART;
344 
345         switch (Adapter->ChipType)
346         {
347             case DC21041:
348             {
349                 /* Errata: don't enable auto-negotiation */
350                 if (Adapter->RevisionId < 0x20)
351                     break;
352 
353                 /* Advertise 10T HD and 10T FD. The chip chooses the 10T FD mode automatically */
354                 Adapter->Media[MEDIA_10T].Csr14 |= DC_SIA_TXRX_AUTONEG | DC_SIA_TXRX_ADV_10T_HD;
355                 Adapter->Media[MEDIA_10T].OpMode |= DC_OPMODE_FULL_DUPLEX;
356                 break;
357             }
358 
359             case DC21140:
360             {
361                 /* Pick the default media */
362                 if (Adapter->Features & DC_HAS_MII)
363                 {
364                     Adapter->DefaultMedia = MEDIA_MII;
365                     break;
366                 }
367 
368                 /* The final entry in the media list should be checked first */
369                 _BitScanReverse(&Adapter->DefaultMedia, Adapter->MediaBitmap);
370 
371                 /*
372                  * Select the first half-duplex media.
373                  * If you want to be able to use 21140 boards without MII in full-duplex mode,
374                  * you have to manually select the media.
375                  */
376                 for (i = Adapter->DefaultMedia; i > 0; --i)
377                 {
378                     if ((Adapter->MediaBitmap & (1 << i)) && !MEDIA_IS_FD(i))
379                         break;
380                 }
381                 Adapter->DefaultMedia = i;
382                 break;
383             }
384 
385             case DC21143:
386             case DC21145:
387             {
388                 /* Pick the default media */
389                 if (Adapter->Features & DC_HAS_MII)
390                 {
391                     Adapter->DefaultMedia = MEDIA_MII;
392                 }
393                 else if (Adapter->MediaBitmap & (1 << MEDIA_10T))
394                 {
395                     /* Start at 10mbps to do internal auto-negotiation */
396                     Adapter->DefaultMedia = MEDIA_10T;
397                 }
398                 else
399                 {
400                     /* The final entry in the media list should be checked first */
401                     _BitScanReverse(&Adapter->DefaultMedia, Adapter->MediaBitmap);
402                 }
403 
404                 /* Enable the PCS function to do 100mbps parallel detection */
405                 if (Adapter->SymAdvertising & MII_ADV_100)
406                 {
407                     Adapter->Media[MEDIA_10T].OpMode |= DC_OPMODE_PORT_PCS;
408                     Adapter->Media[MEDIA_10T_FD].OpMode |= DC_OPMODE_PORT_PCS;
409                     Adapter->Media[MEDIA_AUI].OpMode |= DC_OPMODE_PORT_PCS;
410                     Adapter->Media[MEDIA_BNC].OpMode |= DC_OPMODE_PORT_PCS;
411                     Adapter->Media[MEDIA_HMR].OpMode |= DC_OPMODE_PORT_PCS;
412                 }
413 
414                 Csr14 = DC_SIA_TXRX_AUTONEG;
415 
416                 if (Adapter->SymAdvertising & MII_ADV_10T_HD)
417                     Csr14 |= DC_SIA_TXRX_ADV_10T_HD;
418 
419                 /* When NWay is turned on, the FDX bit advertises 10T FD */
420                 if (Adapter->SymAdvertising & MII_ADV_10T_FD)
421                     Adapter->Media[MEDIA_10T].OpMode |= DC_OPMODE_FULL_DUPLEX;
422 
423                 if (Adapter->SymAdvertising & MII_ADV_100T_HD)
424                     Csr14 |= DC_SIA_TXRX_ADV_100TX_HD;
425 
426                 if (Adapter->SymAdvertising & MII_ADV_100T_FD)
427                     Csr14 |= DC_SIA_TXRX_ADV_100TX_FD;
428 
429                 if (Adapter->SymAdvertising & MII_ADV_100T4)
430                     Csr14 |= DC_SIA_TXRX_ADV_100T4;
431 
432                 /* Advertise the PHY capability */
433                 Adapter->Media[MEDIA_10T].Csr14 |= Csr14;
434 
435                 /* This media may use GPIO data different from the 10T HD */
436                 Adapter->Media[MEDIA_10T_FD].Csr14 |= Csr14;
437                 break;
438             }
439 
440             default:
441                 break;
442         }
443     }
444     else /* Forced speed and duplex */
445     {
446         UseMii = FALSE;
447 
448         if (Adapter->Features & DC_HAS_MII)
449         {
450             if (!MEDIA_MII_OVERRIDE(MediaNumber))
451             {
452                 UseMii = TRUE;
453             }
454         }
455 
456         if (!UseMii)
457         {
458             Adapter->DefaultMedia = MediaNumber;
459 
460             if (MEDIA_IS_10T(MediaNumber))
461             {
462                 Adapter->InterruptMask &= ~DC_IRQ_LINK_CHANGED;
463                 Adapter->LinkStateChangeMask &= ~DC_IRQ_LINK_CHANGED;
464             }
465 
466             if (MEDIA_IS_100(MediaNumber))
467             {
468                 Adapter->InterruptMask &= ~(DC_IRQ_LINK_FAIL | DC_IRQ_LINK_PASS);
469                 Adapter->LinkStateChangeMask &= ~(DC_IRQ_LINK_FAIL | DC_IRQ_LINK_PASS);
470             }
471         }
472         else
473         {
474             Adapter->DefaultMedia = MEDIA_MII;
475 
476             switch (MediaNumber)
477             {
478                 case MEDIA_10T:
479                     MiiAdvertising = MII_ADV_10T_HD;
480                     break;
481                 case MEDIA_10T_FD:
482                     MiiAdvertising = MII_ADV_10T_FD;
483                     MiiControl = MII_CR_FULL_DUPLEX;
484                     break;
485                 case MEDIA_100TX_HD:
486                     MiiAdvertising = MII_ADV_100T_HD;
487                     MiiControl = MII_CR_SPEED_SELECTION;
488                     break;
489                 case MEDIA_100TX_FD:
490                     MiiAdvertising = MII_ADV_100T_FD;
491                     MiiControl = MII_CR_FULL_DUPLEX | MII_CR_SPEED_SELECTION;
492                     break;
493                 case MEDIA_100T4:
494                     MiiAdvertising = MII_ADV_100T4 | MII_CR_SPEED_SELECTION;
495                     break;
496 
497                 default:
498                     MiiAdvertising = 0;
499                     MiiControl = 0;
500                     break;
501             }
502 
503             if (MiiControl & MII_CR_SPEED_SELECTION)
504                 Adapter->LinkSpeedMbps = 100;
505             else
506                 Adapter->LinkSpeedMbps = 10;
507 
508             Adapter->MiiAdvertising = MiiAdvertising;
509             Adapter->MiiControl = MiiControl;
510         }
511     }
512 
513     INFO("Default media is %s\n", MediaNumber2Str(Adapter, Adapter->DefaultMedia));
514 }
515 
516 static
517 CODE_SEG("PAGE")
518 VOID
519 MediaInitOpMode2114x(
520     _In_ PDC21X4_ADAPTER Adapter)
521 {
522     PAGED_CODE();
523 
524     Adapter->Media[MEDIA_10T     ].OpMode = 0;
525     Adapter->Media[MEDIA_BNC     ].OpMode = 0;
526     Adapter->Media[MEDIA_AUI     ].OpMode = 0;
527     Adapter->Media[MEDIA_100TX_HD].OpMode = DC_OPMODE_PORT_SELECT |
528                                             DC_OPMODE_PORT_HEARTBEAT_DISABLE;
529     Adapter->Media[MEDIA_10T_FD  ].OpMode = DC_OPMODE_FULL_DUPLEX;
530     Adapter->Media[MEDIA_100TX_FD].OpMode = DC_OPMODE_PORT_SELECT | DC_OPMODE_FULL_DUPLEX |
531                                             DC_OPMODE_PORT_HEARTBEAT_DISABLE;
532     Adapter->Media[MEDIA_100T4   ].OpMode = DC_OPMODE_PORT_SELECT |
533                                             DC_OPMODE_PORT_HEARTBEAT_DISABLE;
534     Adapter->Media[MEDIA_100FX_HD].OpMode = DC_OPMODE_PORT_SELECT |
535                                             DC_OPMODE_PORT_HEARTBEAT_DISABLE |
536                                             DC_OPMODE_PORT_PCS;
537     Adapter->Media[MEDIA_100FX_FD].OpMode = DC_OPMODE_PORT_SELECT | DC_OPMODE_FULL_DUPLEX |
538                                             DC_OPMODE_PORT_HEARTBEAT_DISABLE |
539                                             DC_OPMODE_PORT_PCS;
540     Adapter->Media[MEDIA_HMR     ].OpMode = DC_OPMODE_PORT_HEARTBEAT_DISABLE;
541 }
542 
543 CODE_SEG("PAGE")
544 VOID
545 MediaInitMediaList(
546     _In_ PDC21X4_ADAPTER Adapter)
547 {
548     PAGED_CODE();
549 
550     /*
551      * Set the default internal values for the SIA/SYM operating modes.
552      * The SROM parsing code may later overwrite them.
553      */
554     switch (Adapter->ChipType)
555     {
556         case DC21040:
557         {
558             Adapter->Media[MEDIA_10T].Csr13 = 0x8F01;
559             Adapter->Media[MEDIA_10T].Csr14 = 0xFFFF;
560             Adapter->Media[MEDIA_10T].Csr15 = 0x0000;
561 
562             Adapter->Media[MEDIA_BNC].Csr13 = 0x8F09;
563             Adapter->Media[MEDIA_BNC].Csr14 = 0x0705;
564             Adapter->Media[MEDIA_BNC].Csr15 = 0x0006;
565 
566             Adapter->Media[MEDIA_10T_FD].Csr13 = 0x8F01;
567             Adapter->Media[MEDIA_10T_FD].Csr14 = 0xFFFD;
568             Adapter->Media[MEDIA_10T_FD].Csr15 = 0x0000;
569             Adapter->Media[MEDIA_10T_FD].OpMode = DC_OPMODE_FULL_DUPLEX;
570             break;
571         }
572 
573         case DC21041:
574         {
575             Adapter->Media[MEDIA_10T].Csr13 = 0xEF01;
576             Adapter->Media[MEDIA_10T].Csr14 = 0xFF3F;
577             Adapter->Media[MEDIA_10T].Csr15 = 0x0008;
578 
579             Adapter->Media[MEDIA_BNC].Csr13 = 0xEF09;
580             Adapter->Media[MEDIA_BNC].Csr14 = 0xF7FD;
581             Adapter->Media[MEDIA_BNC].Csr15 = 0x0006;
582 
583             Adapter->Media[MEDIA_AUI].Csr13 = 0xEF09;
584             Adapter->Media[MEDIA_AUI].Csr14 = 0xF7FD;
585             Adapter->Media[MEDIA_AUI].Csr15 = 0x000E;
586 
587             Adapter->Media[MEDIA_10T_HD].Csr13 = 0xEF01;
588             Adapter->Media[MEDIA_10T_HD].Csr14 = 0x7F3F;
589             Adapter->Media[MEDIA_10T_HD].Csr15 = 0x0008;
590 
591             Adapter->Media[MEDIA_10T_FD].Csr13 = 0xEF01;
592             Adapter->Media[MEDIA_10T_FD].Csr14 = 0x7F3D;
593             Adapter->Media[MEDIA_10T_FD].Csr15 = 0x0008;
594             Adapter->Media[MEDIA_10T_FD].OpMode = DC_OPMODE_FULL_DUPLEX;
595             break;
596         }
597 
598         case DC21140:
599         {
600             MediaInitOpMode2114x(Adapter);
601             break;
602         }
603 
604         case DC21143:
605         case DC21145:
606         {
607             Adapter->Media[MEDIA_10T].Csr13 = 0x0001;
608             Adapter->Media[MEDIA_10T].Csr14 = 0x7F3F;
609             Adapter->Media[MEDIA_10T].Csr15 = 0x0008;
610 
611             Adapter->Media[MEDIA_BNC].Csr13 = 0x0009;
612             Adapter->Media[MEDIA_BNC].Csr14 = 0x0705;
613             Adapter->Media[MEDIA_BNC].Csr15 = 0x0006;
614 
615             Adapter->Media[MEDIA_AUI].Csr13 = 0x0009;
616             Adapter->Media[MEDIA_AUI].Csr14 = 0x0705;
617             Adapter->Media[MEDIA_AUI].Csr15 = 0x000E;
618 
619             Adapter->Media[MEDIA_10T_FD].Csr13 = 0x0001;
620             Adapter->Media[MEDIA_10T_FD].Csr14 = 0x7F3D;
621             Adapter->Media[MEDIA_10T_FD].Csr15 = 0x0008;
622 
623             Adapter->Media[MEDIA_HMR].Csr13 = 0x0009;
624             Adapter->Media[MEDIA_HMR].Csr14 = 0x0505;
625             Adapter->Media[MEDIA_HMR].Csr15 = 0x0010;
626 
627             MediaInitOpMode2114x(Adapter);
628             break;
629         }
630 
631         default:
632             break;
633     }
634 }
635