Subversion Repositories Kolibri OS

Rev

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

Rev 2220 Rev 2304
Line 428... Line 428...
428
;
428
;
429
;***************************************************************************
429
;***************************************************************************
430
align 4
430
align 4
431
probe:
431
probe:
Line -... Line 432...
-
 
432
 
-
 
433
	movzx	eax, [device.pci_bus]
432
 
434
	movzx	edx, [device.pci_dev]
Line 433... Line 435...
433
	stdcall PciWrite8, dword [device.pci_bus], dword [device.pci_dev], 0x40, 0	; Wake Up Chip
435
	stdcall PciWrite8, eax, edx, 0x40, 0	; Wake Up Chip
Line 434... Line 436...
434
 
436
 
-
 
437
	make_bus_master [device.pci_bus], [device.pci_dev]
-
 
438
 
435
	make_bus_master [device.pci_bus], [device.pci_dev]
439
; Get Card Revision
436
 
440
	movzx	eax, [device.pci_bus]
Line 437... Line 441...
437
; Get Card Revision
441
	movzx	edx, [device.pci_dev]
438
	stdcall PciRead8, dword [device.pci_bus], dword [device.pci_dev], 0x08
442
	stdcall PciRead8, eax, edx, 0x08
439
	mov	[device.pci_revision], al						       ; save the revision for later use
443
	mov	[device.pci_revision], al	; save the revision for later use
Line 454... Line 458...
454
	ret
458
	ret
Line 455... Line 459...
455
 
459
 
456
; Find Get Mac Function
460
; Find Get Mac Function
457
  .ok:
461
  .ok:
458
	mov	eax, [esi+4]		; Get pointer to "get MAC" function
462
	mov	eax, [esi+4]		; Get pointer to "get MAC" function
459
	mov	[get_mac_func], eax
463
	mov	[device.get_MAC], eax
460
	mov	eax, [esi+8]		; Get pointer to special initialization fn
464
	mov	eax, [esi+8]		; Get pointer to special initialization fn
Line 461... Line 465...
461
	mov	[special_func], eax
465
	mov	[device.special_func], eax
462
 
466
 
Line 463... Line 467...
463
; Get MAC
467
; Get MAC
Line 464... Line 468...
464
	call	[get_mac_func]
468
	call	[device.get_MAC]
465
 
469
 
466
; Call special initialization fn if requested
470
; Call special initialization fn if requested
467
 
471
 
Line 468... Line 472...
468
	cmp	[special_func],0
472
	cmp	[device.special_func],0
Line 469... Line 473...
469
	je	@f
473
	je	@f
470
	call	[special_func]
474
	call	[device.special_func]
471
       @@:
475
       @@:
472
 
476
 
473
; Set table entries
477
; Set table entries
474
 
478
 
475
	mov	 byte [table_entries], 16
479
	mov	 [device.table_entries], 16
Line 476... Line 480...
476
	cmp	 [pci_revision], SIS635A_900_REV
480
	cmp	 [device.pci_revision], SIS635A_900_REV
Line 569... Line 573...
569
;------------------------------------------------------
573
;------------------------------------------------------
570
; Set Configuration Register depending on Card Revision
574
; Set Configuration Register depending on Card Revision
Line 571... Line 575...
571
 
575
 
572
	set_io	cfg
576
	set_io	cfg
573
	mov	eax, PESEL			; Configuration Register Bit
577
	mov	eax, PESEL			; Configuration Register Bit
574
	cmp	[pci_revision], SIS635A_900_REV
578
	cmp	[device.pci_revision], SIS635A_900_REV
575
	je	.match
579
	je	.match
576
	cmp	[pci_revision], SIS900B_900_REV ; Check card revision
580
	cmp	[device.pci_revision], SIS900B_900_REV ; Check card revision
577
	je	.match
581
	je	.match
578
	out	dx, eax 			; no revision match
582
	out	dx, eax 			; no revision match
Line 579... Line 583...
579
	jmp	.done
583
	jmp	.done
Line 795... Line 799...
795
	set_io	 rfdr			; Receive Filter Control Reg offset
799
	set_io	 rfdr			; Receive Filter Control Reg offset
796
	mov	 eax, 0xffff		; entry value
800
	mov	 eax, 0xffff		; entry value
797
	out	 dx, ax 		; write value to table in card
801
	out	 dx, ax 		; write value to table in card
Line 798... Line 802...
798
 
802
 
799
	inc	 cl			; next entry
803
	inc	 cl			; next entry
800
	cmp	 cl, [table_entries]
804
	cmp	 cl, [device.table_entries]
Line 801... Line 805...
801
	jl	 .loop
805
	jl	 .loop
802
 
806
 
Line 919... Line 923...
919
;
923
;
920
; Older SiS900 and friends, use EEPROM to store MAC address.
924
; Older SiS900 and friends, use EEPROM to store MAC address.
921
;
925
;
922
;***************************************************************************
926
;***************************************************************************
923
align 4
927
align 4
924
get_mac_addr:
928
SIS900_get_mac_addr:
Line 925... Line 929...
925
 
929
 
926
;------------------------------------
930
;------------------------------------
Line 927... Line 931...
927
; check to see if we have sane EEPROM
931
; check to see if we have sane EEPROM
Line 945... Line 949...
945
	push	ecx
949
	push	ecx
946
	call	read_eeprom	      ;try to read 16 bits
950
	call	read_eeprom		; try to read 16 bits
947
	pop	ecx
951
	pop	ecx
948
	mov	word [device.mac+ecx*2], ax	   ;save 16 bits to the MAC ID storage
952
	mov	word [device.mac+ecx*2], ax	; save 16 bits to the MAC ID storage
949
	dec	ecx			     ;one less word to read
953
	dec	ecx				; one less word to read
950
	jns	mac_read_loop	      ;if more read more
954
	jns	.loop				; if more read more
Line 951... Line 955...
951
 
955
 
Line 952... Line 956...
952
	DEBUGF	2,"%x-%x-%x-%x-%x-%x\n",[device.mac]:2,[device.mac+1]:2,[device.mac+2]:2,[device.mac+3]:2,[device.mac+4]:2,[device.mac+5]:2
956
	DEBUGF	2,"%x-%x-%x-%x-%x-%x\n",[device.mac]:2,[device.mac+1]:2,[device.mac+2]:2,[device.mac+3]:2,[device.mac+4]:2,[device.mac+5]:2
953
 
957
 
Line 1211... Line 1215...
1211
	jmp	.no_rx
1215
	jmp	.no_rx
Line 1212... Line 1216...
1212
 
1216
 
Line 1213... Line 1217...
1213
  .error_status:
1217
  .error_status:
1214
 
1218
 
Line 1215... Line 1219...
1215
	DEBUGF	1, "Packet error: %x\n", ecx
1219
	DEBUGF	1, "Packet error: %x\n", ecx
Line 1216... Line 1220...
1216
	jmp	.continue
1220
	jmp	.fail
1217
 
1221
 
Line 1218... Line 1222...
1218
  .error_size:
1222
  .error_size:
1219
 
1223
 
1220
	DEBUGF	1, "Packet too large/small\n"
1224
	DEBUGF	1, "Packet too large/small\n"
Line 1221... Line 1225...
1221
	jmp	.continue
1225
	jmp	.fail
1222
 
1226
 
Line 1223... Line 1227...
1223
  .no_rx:
1227
  .no_rx:
Line 1224... Line 1228...
1224
	test	ax, TxOk
1228
    ;;    test    ax, TxOk
Line -... Line 1229...
-
 
1229
   ;;     jz      .no_tx
-
 
1230
 
-
 
1231
	;;; TODO: free all unused buffers
-
 
1232
     ;;   stdcall   KernelFree, eax
-
 
1233
 
Line 1225... Line 1234...
1225
	jz	.no_tx
1234
  .no_tx:
1226
 
1235
 
1227
	;;; TODO: free all unused buffers
1236
	ret
1228
	stdcall   KernelFree, eax
1237
 
Line 1247... Line 1256...
1247
;***************************************************************************
1256
;***************************************************************************
1248
align 4
1257
align 4
1249
transmit:
1258
transmit:
Line 1250... Line 1259...
1250
 
1259
 
1251
	cmp	dword [esp+8], MAX_ETH_FRAME_SIZE
1260
	cmp	dword [esp+8], MAX_ETH_FRAME_SIZE
Line 1252... Line 1261...
1252
	jg	transmit_finish
1261
	ja	.finish
1253
 
1262
 
Line 1254... Line 1263...
1254
	cmp	dword [esp+8], 60
1263
	cmp	dword [esp+8], 60
1255
	jl	transmit_finish
1264
	jb	.finish
1256
 
1265
 
Line 1274... Line 1283...
1274
; update stats
1283
; update stats
1275
	inc	[device.packets_tx]
1284
	inc	[device.packets_tx]
1276
	add	dword [device.bytes_tx], ecx
1285
	add	dword [device.bytes_tx], ecx
1277
	adc	dword [device.bytes_tx+4], 0
1286
	adc	dword [device.bytes_tx+4], 0
Line -... Line 1287...
-
 
1287
 
-
 
1288
  .finish:
1278
 
1289
 
Line 1279... Line 1290...
1279
	ret	8
1290
	ret	8
Line 1291... Line 1302...
1291
    dd SIS630S_900_REV,Get_Mac_SIS635_900_REV,0
1302
    dd SIS630S_900_REV,Get_Mac_SIS635_900_REV,0
1292
    dd SIS630EA1_900_REV,Get_Mac_SIS635_900_REV,0
1303
    dd SIS630EA1_900_REV,Get_Mac_SIS635_900_REV,0
1293
    dd SIS630ET_900_REV,Get_Mac_SIS635_900_REV,0;SIS630ET_900_REV_SpecialFN
1304
    dd SIS630ET_900_REV,Get_Mac_SIS635_900_REV,0;SIS630ET_900_REV_SpecialFN
1294
    dd SIS635A_900_REV,Get_Mac_SIS635_900_REV,0
1305
    dd SIS635A_900_REV,Get_Mac_SIS635_900_REV,0
1295
    dd SIS900_960_REV,SIS960_get_mac_addr,0
1306
    dd SIS900_960_REV,SIS960_get_mac_addr,0
1296
    dd SIS900B_900_REV,get_mac_addr,0
1307
    dd SIS900B_900_REV,SIS900_get_mac_addr,0
1297
    dd 0					; end of list
1308
    dd 0					; end of list
Line 1298... Line 1309...
1298
 
1309
 
1299
version 	dd (DRIVER_VERSION shl 16) or (API_VERSION and 0xFFFF)
1310
version 	dd (DRIVER_VERSION shl 16) or (API_VERSION and 0xFFFF)