Subversion Repositories Kolibri OS

Rev

Rev 5363 | Rev 5498 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5363 Rev 5494
Line 245... Line 245...
245
        pci_bus         dd ?
245
        pci_bus         dd ?
246
        pci_dev         dd ?
246
        pci_dev         dd ?
247
        irq_line        db ?
247
        irq_line        db ?
248
                        rb 3 ; align 4
248
                        rb 3 ; align 4
249
        mmio_addr       dd ? ; memory map physical address
249
        mmio_addr       dd ? ; memory map physical address
250
        chipset         dd ?
-
 
251
        pcfg            dd ?
250
        pcfg            dd ?
252
        mcfg            dd ?
251
        mcfg            dd ?
253
        cur_rx          dd ? ; Index into the Rx descriptor buffer of next Rx pkt
252
        cur_rx          dd ? ; Index into the Rx descriptor buffer of next Rx pkt
254
        cur_tx          dd ? ; Index into the Tx descriptor buffer of next Rx pkt
253
        cur_tx          dd ? ; Index into the Tx descriptor buffer of next Rx pkt
255
        TxDescArrays    dd ? ; Index of Tx Descriptor buffer
254
        TxDescArrays    dd ? ; Index of Tx Descriptor buffer
256
        RxDescArrays    dd ? ; Index of Rx Descriptor buffer
255
        RxDescArrays    dd ? ; Index of Rx Descriptor buffer
257
        TxDescArray     dd ? ; Index of 256-alignment Tx Descriptor buffer
256
        TxDescArray     dd ? ; Index of 256-alignment Tx Descriptor buffer
258
        RxDescArray     dd ? ; Index of 256-alignment Rx Descriptor buffer
257
        RxDescArray     dd ? ; Index of 256-alignment Rx Descriptor buffer
-
 
258
        mac_version     dd ?
Line 259... Line 259...
259
 
259
 
260
        rb 0x100-($ and 0xff)   ; align 256
260
        rb 0x100-($ and 0xff)   ; align 256
Line 261... Line 261...
261
        tx_ring         rb NUM_TX_DESC * sizeof.tx_desc * 2
261
        tx_ring         rb NUM_TX_DESC * sizeof.tx_desc * 2
Line 534... Line 534...
534
        out     dx, al
534
        out     dx, al
Line 535... Line 535...
535
 
535
 
536
        ; Check that the chip has finished the reset
536
        ; Check that the chip has finished the reset
537
        mov     ecx, 1000
537
        mov     ecx, 1000
-
 
538
        set_io  [ebx + device.io_addr], REG_ChipCmd
538
        set_io  [ebx + device.io_addr], REG_ChipCmd
539
  @@:
539
    @@: in      al, dx
540
        in      al, dx
540
        test    al, CMD_Reset
541
        test    al, CMD_Reset
541
        jz      @f
542
        jz      @f
542
        udelay  10
543
        udelay  10
543
        loop    @b
544
        loop    @b
544
    @@:
-
 
-
 
545
  @@:
-
 
546
 
545
        ; identify config method
547
 
546
        set_io  [ebx + device.io_addr], REG_TxConfig
548
        set_io  [ebx + device.io_addr], REG_TxConfig
547
        in      eax, dx
-
 
548
        and     eax, 0x7c800000
-
 
549
        DEBUGF  1,"init_board: TxConfig & 0x7c800000 = 0x%x\n", eax
549
        in      eax, dx
550
        mov     esi, mac_info-8
550
        mov     esi, MAC_VERSION_LIST
551
    @@: add     esi, 8
551
  @@:
552
        mov     ecx, eax
552
        mov     ecx, eax
553
        and     ecx, [esi]
553
        and     ecx, dword[esi]
554
        cmp     ecx, [esi]
-
 
555
        jne     @b
-
 
556
        mov     eax, [esi+4]
-
 
557
        mov     [ebx + device.mcfg], eax
-
 
558
 
-
 
559
        mov     [ebx + device.pcfg], PCFG_METHOD_3
-
 
560
        READ_GMII_REG 3
-
 
561
        and     al, 0x0f
-
 
562
        or      al, al
554
        cmp     ecx, dword[esi+4]
563
        jnz     @f
-
 
564
        mov     [ebx + device.pcfg], PCFG_METHOD_1
-
 
565
        jmp     .pconf
-
 
566
    @@: dec     al
-
 
567
        jnz     .pconf
-
 
568
        mov     [ebx + device.pcfg], PCFG_METHOD_2
-
 
569
  .pconf:
-
 
570
 
-
 
571
        ; identify chip attached to board
555
        je      @f
572
        mov     ecx, 10
-
 
573
        mov     eax, [ebx + device.mcfg]
-
 
574
    @@: dec     ecx
-
 
575
        js      @f
-
 
576
        cmp     eax, [rtl_chip_info + ecx*8]
556
        add     esi, 4*4
577
        jne     @b
-
 
578
        mov     [ebx + device.chipset], ecx
-
 
579
        jmp     .match
557
        jmp     @r
580
    @@:
-
 
581
        ; if unknown chip, assume array element #0, original RTL-8169 in this case
-
 
582
        DEBUGF  1,"init_board: PCI device: unknown chip version, assuming RTL-8169\n"
-
 
583
        set_io  [ebx + device.io_addr], REG_TxConfig
-
 
584
        in      eax, dx
-
 
585
        DEBUGF  1,"init_board: PCI device: TxConfig = 0x%x\n", eax
-
 
586
 
-
 
Line 587... Line 558...
587
        mov     [ebx + device.chipset],  0
558
  @@:
-
 
559
 
588
 
560
        mov     eax, [esi+8]
589
        xor     eax, eax
561
        mov     [ebx + device.mac_version], eax
Line 590... Line -...
590
        inc     eax
-
 
591
        ret
-
 
592
 
562
        mov     eax, [esi+12]
593
  .match:
563
        mov     [ebx + device.name], eax
Line 804... Line 774...
804
        ; IFF_ALLMULTI
774
        ; IFF_ALLMULTI
805
        ; Too many to filter perfectly -- accept all multicasts
775
        ; Too many to filter perfectly -- accept all multicasts
806
        set_io  [ebx + device.io_addr], 0
776
        set_io  [ebx + device.io_addr], 0
807
        set_io  [ebx + device.io_addr], REG_RxConfig
777
        set_io  [ebx + device.io_addr], REG_RxConfig
808
        in      eax, dx
778
        in      eax, dx
809
        mov     ecx, [ebx + device.chipset]
779
        and     eax, 0xff7e1880
810
        and     eax, [rtl_chip_info + ecx * 8 + 4] ; RxConfigMask
-
 
811
        or      eax, rx_config or (RXM_AcceptBroadcast or RXM_AcceptMulticast or RXM_AcceptMyPhys)
780
        or      eax, rx_config or (RXM_AcceptBroadcast or RXM_AcceptMulticast or RXM_AcceptMyPhys)
812
        out     dx, eax
781
        out     dx, eax
Line 813... Line 782...
813
 
782
 
814
        ; Multicast hash filter
783
        ; Multicast hash filter
Line 908... Line 877...
908
        out     dx, ax
877
        out     dx, ax
Line 909... Line 878...
909
 
878
 
910
        ; Set Rx Config register
879
        ; Set Rx Config register
911
        set_io  [ebx + device.io_addr], REG_RxConfig
880
        set_io  [ebx + device.io_addr], REG_RxConfig
912
        in      ax, dx
881
        in      ax, dx
913
        mov     ecx, [ebx + device.chipset]
-
 
914
        and     eax, [rtl_chip_info + ecx * 8 + 4] ; RxConfigMask
882
        and     eax, 0xff7e1880
915
        or      eax, rx_config
883
        or      eax, rx_config
Line 916... Line 884...
916
        out     dx, eax
884
        out     dx, eax
917
 
885
 
Line 1287... Line 1255...
1287
 
1255
 
Line 1288... Line 1256...
1288
my_service    db 'RTL8169',0                    ; max 16 chars include zero
1256
my_service    db 'RTL8169',0                    ; max 16 chars include zero
Line 1289... Line 1257...
1289
 
1257
 
1290
include_debug_strings                           ; All data wich FDO uses will be included here
-
 
1291
 
-
 
1292
rtl_chip_info dd \
-
 
1293
  MCFG_METHOD_01, 0xff7e1880, \ ; RTL8169
-
 
1294
  MCFG_METHOD_02, 0xff7e1880, \ ; RTL8169s/8110s
-
 
1295
  MCFG_METHOD_03, 0xff7e1880, \ ; RTL8169s/8110s
-
 
1296
  MCFG_METHOD_04, 0xff7e1880, \ ; RTL8169sb/8110sb
-
 
1297
  MCFG_METHOD_05, 0xff7e1880, \ ; RTL8169sc/8110sc
-
 
1298
  MCFG_METHOD_11, 0xff7e1880, \ ; RTL8168b/8111b   // PCI-E
-
 
1299
  MCFG_METHOD_12, 0xff7e1880, \ ; RTL8168b/8111b   // PCI-E
-
 
1300
  MCFG_METHOD_13, 0xff7e1880, \ ; RTL8101e         // PCI-E 8139
-
 
1301
  MCFG_METHOD_14, 0xff7e1880, \ ; RTL8100e         // PCI-E 8139
-
 
1302
  MCFG_METHOD_15, 0xff7e1880    ; RTL8100e         // PCI-E 8139
-
 
1303
 
-
 
1304
mac_info dd \
-
 
1305
  0x38800000, MCFG_METHOD_15, \
-
 
1306
  0x38000000, MCFG_METHOD_12, \
-
 
1307
  0x34000000, MCFG_METHOD_13, \
-
 
1308
  0x30800000, MCFG_METHOD_14, \
-
 
1309
  0x30000000, MCFG_METHOD_11, \
-
 
1310
  0x18000000, MCFG_METHOD_05, \
-
 
1311
  0x10000000, MCFG_METHOD_04, \
-
 
Line -... Line 1258...
-
 
1258
include_debug_strings                           ; All data wich FDO uses will be included here
-
 
1259
 
-
 
1260
MAC_VERSION_LIST:
-
 
1261
 
-
 
1262
; 8168EP family.
-
 
1263
dd 0x7cf00000, 0x50200000, 51, name_49
-
 
1264
dd 0x7cf00000, 0x50100000, 50, name_49
-
 
1265
dd 0x7cf00000, 0x50000000, 49, name_49
-
 
1266
 
-
 
1267
; 8168H family.
-
 
1268
dd 0x7cf00000, 0x54100000, 46, name_45
-
 
1269
dd 0x7cf00000, 0x54000000, 45, name_45
-
 
1270
 
-
 
1271
; 8168G family.
-
 
1272
dd 0x7cf00000, 0x5c800000, 44, name_44
-
 
1273
dd 0x7cf00000, 0x50900000, 42, name_40
-
 
1274
dd 0x7cf00000, 0x4c100000, 41, name_40
-
 
1275
dd 0x7cf00000, 0x4c000000, 40, name_40
-
 
1276
 
-
 
1277
; 8168F family.
-
 
1278
dd 0x7c800000, 0x48800000, 38, name_38
-
 
1279
dd 0x7cf00000, 0x48100000, 36, name_35
-
 
1280
dd 0x7cf00000, 0x48000000, 35, name_35
-
 
1281
 
-
 
1282
; 8168E family.
-
 
1283
dd 0x7c800000, 0x2c800000, 34, name_34
-
 
1284
dd 0x7cf00000, 0x2c200000, 33, name_32
-
 
1285
dd 0x7cf00000, 0x2c100000, 32, name_32
-
 
1286
dd 0x7c800000, 0x2c000000, 33, name_32
-
 
1287
 
-
 
1288
; 8168D family.
-
 
1289
dd 0x7cf00000, 0x28300000, 26, name_25
-
 
1290
dd 0x7cf00000, 0x28100000, 25, name_25
-
 
1291
dd 0x7c800000, 0x28000000, 26, name_25
-
 
1292
 
-
 
1293
; 8168DP family.
-
 
1294
dd 0x7cf00000, 0x28800000, 27, name_27
-
 
1295
dd 0x7cf00000, 0x28a00000, 28, name_27
-
 
1296
 
-
 
1297
; 8168C family.
-
 
1298
dd 0x7cf00000, 0x3cb00000, 24, name_23
-
 
1299
dd 0x7cf00000, 0x3c900000, 23, name_23
-
 
1300
dd 0x7cf00000, 0x3c800000, 18, name_18
-
 
1301
dd 0x7c800000, 0x3c800000, 24, name_23
-
 
1302
dd 0x7cf00000, 0x3c000000, 19, name_19
-
 
1303
dd 0x7cf00000, 0x3c200000, 20, name_19
-
 
1304
dd 0x7cf00000, 0x3c300000, 21, name_19
-
 
1305
dd 0x7cf00000, 0x3c400000, 22, name_19
-
 
1306
dd 0x7c800000, 0x3c000000, 22, name_19
-
 
1307
 
-
 
1308
; 8168B family.
-
 
1309
dd 0x7cf00000, 0x38000000, 12, name_11
-
 
1310
dd 0x7cf00000, 0x38500000, 17, name_10
-
 
1311
dd 0x7c800000, 0x38000000, 17, name_10
-
 
1312
dd 0x7c800000, 0x30000000, 11, name_11
-
 
1313
 
-
 
1314
; 8101 family.
-
 
1315
dd 0x7cf00000, 0x34a00000, 09, name_07
-
 
1316
dd 0x7cf00000, 0x24a00000, 09, name_07
-
 
1317
dd 0x7cf00000, 0x34900000, 08, name_07
-
 
1318
dd 0x7cf00000, 0x24900000, 08, name_07
-
 
1319
dd 0x7cf00000, 0x34800000, 07, name_07
-
 
1320
dd 0x7cf00000, 0x24800000, 07, name_07
-
 
1321
dd 0x7cf00000, 0x34000000, 13, name_10
-
 
1322
dd 0x7cf00000, 0x34300000, 10, name_10
-
 
1323
dd 0x7cf00000, 0x34200000, 16, name_11
-
 
1324
dd 0x7c800000, 0x34800000, 09, name_07
-
 
1325
dd 0x7c800000, 0x24800000, 09, name_07
-
 
1326
dd 0x7c800000, 0x34000000, 16, name_11
-
 
1327
dd 0xfc800000, 0x38800000, 15, name_14
-
 
1328
dd 0xfc800000, 0x30800000, 14, name_14
-
 
1329
 
-
 
1330
; 8110 family.
-
 
1331
dd 0xfc800000, 0x98000000, 06, name_05
-
 
1332
dd 0xfc800000, 0x18000000, 05, name_05
-
 
1333
dd 0xfc800000, 0x10000000, 04, name_04
-
 
1334
dd 0xfc800000, 0x04000000, 03, name_03
-
 
1335
dd 0xfc800000, 0x00800000, 02, name_02
-
 
1336
dd 0xfc800000, 0x00000000, 01, name_01
-
 
1337
 
1312
  0x04000000, MCFG_METHOD_03, \
1338
; Catch-all
-
 
1339
dd 0x00000000, 0x00000000, 0, name_unknown
1313
  0x00800000, MCFG_METHOD_02, \
1340
 
1314
  0x00000000, MCFG_METHOD_01    ; catch-all
1341
; PCI-devices
1315
 
1342
name_01 db "RTL8169",0
-
 
1343
name_02 db "RTL8169s",0
-
 
1344
name_03 db "RTL8110s",0
-
 
1345
name_04 db "RTL8169sb/8110sb",0
-
 
1346
name_05 db "RTL8169sc/8110sc",0
-
 
1347
;name_06 db "RTL8169sc/8110sc",0
-
 
1348
 
-
 
1349
; PCI-E devices
1316
name_01         db "RTL8169", 0
1350
name_07 db "RTL8102e",0
-
 
1351
;name_08 db "RTL8102e",0
1317
name_02_03      db "RTL8169s/8110s", 0
1352
;name_09 db "RTL8102e",0
1318
name_04         db "RTL8169sb/8110sb", 0
1353
name_10 db "RTL8101e",0
-
 
1354
name_11 db "RTL8168b/8111b",0
-
 
1355
;name_12 db "RTL8168b/8111b",0
-
 
1356
;name_13 db "RTL8101e",0
-
 
1357
name_14 db "RTL8100e",0
-
 
1358
;name_15 db "RTL8100e",0
-
 
1359
;name_16 db "RTL8168b/8111b",0
-
 
1360
;name_17 db "RTL8101e",0
-
 
1361
name_18 db "RTL8168cp/8111cp",0
-
 
1362
name_19 db "RTL8168c/8111c",0
-
 
1363
;name_20 db "RTL8168c/8111c",0
-
 
1364
;name_21 db "RTL8168c/8111c",0
-
 
1365
;name_22 db "RTL8168c/8111c",0
-
 
1366
name_23 db "RTL8168cp/8111cp",0
-
 
1367
;name_24 db "RTL8168cp/8111cp",0
-
 
1368
name_25 db "RTL8168d/8111d",0
-
 
1369
;name_26 db "RTL8168d/8111d",0
-
 
1370
name_27 db "RTL8168dp/8111dp",0
-
 
1371
;name_28 db "RTL8168dp/8111dp",0
-
 
1372
name_29 db "RTL8105e",0
-
 
1373
;name_30 db "RTL8105e",0
-
 
1374
;name_31 db "RTL8168dp/8111dp",0
-
 
1375
name_32 db "RTL8168e/8111e",0
-
 
1376
;name_33 db "RTL8168e/8111e",0
-
 
1377
name_34 db "RTL8168evl/8111evl",0
-
 
1378
name_35 db "RTL8168f/8111f",0
-
 
1379
;name_36 db "RTL8168f/8111f",0
-
 
1380
name_37 db "RTL8402",0
-
 
1381
name_38 db "RTL8411",0
-
 
1382
name_39 db "RTL8106e",0
-
 
1383
name_40 db "RTL8168g/8111g",0
-
 
1384
;name_41 db "RTL8168g/8111g",0
-
 
1385
;name_42 db "RTL8168g/8111g",0
-
 
1386
;name_43 db "RTL8106e",0
-
 
1387
name_44 db "RTL8411",0
-
 
1388
name_45 db "RTL8168h/8111h",0
-
 
1389
;name_46 db "RTL8168h/8111h",0
-
 
1390
name_47 db "RTL8107e",0
-
 
1391
;name_48 db "RTL8107e",0
-
 
1392
name_49 db "RTL8168ep/8111ep",0
Line 1319... Line 1393...
1319
name_05         db "RTL8169sc/8110sc", 0
1393
;name_50 db "RTL8168ep/8111ep",0
1320
name_11_12      db "RTL8168b/8111b", 0  ; PCI-E
1394
;name_51 db "RTL8168ep/8111ep",0
1321
name_13         db "RTL8101e", 0        ; PCI-E 8139
1395