Subversion Repositories Kolibri OS

Rev

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

Rev 1492 Rev 1514
Line 1... Line 1...
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                                 ;;
2
;;                                                                 ;;
3
;; Copyright (C) KolibriOS team 2004-2008. All rights reserved.    ;;
3
;; Copyright (C) KolibriOS team 2004-2010. All rights reserved.    ;;
4
;; Distributed under terms of the GNU General Public License       ;;
4
;; Distributed under terms of the GNU General Public License       ;;
5
;;                                                                 ;;
5
;;                                                                 ;;
6
;; Realtek 8139 driver for KolibriOS                               ;;
6
;; Realtek 8139 driver for KolibriOS                               ;;
7
;;                                                                 ;;
7
;;                                                                 ;;
8
;;    Written by hidnplayr@kolibrios.org                           ;;
8
;;    Written by hidnplayr@kolibrios.org                           ;;
Line 366... Line 366...
366
	mov	eax, [RTL8139_DEV]					; Add the device structure to our device list
366
	mov	eax, [RTL8139_DEV]					; Add the device structure to our device list
367
	mov	[RTL8139_LIST+4*eax], ebx				; (IRQ handler uses this list to find device)
367
	mov	[RTL8139_LIST+4*eax], ebx				; (IRQ handler uses this list to find device)
368
	inc	[RTL8139_DEV]						;
368
	inc	[RTL8139_DEV]						;
Line -... Line 369...
-
 
369
 
369
 
370
 
-
 
371
	mov	[device.type], NET_TYPE_ETH
370
 
372
	call	NetRegDev
371
	call	EthRegDev
373
 
Line 372... Line 374...
372
	cmp	eax, -1
374
	cmp	eax, -1
Line 373... Line 375...
373
	je	.destroy
375
	je	.destroy
Line 374... Line 376...
374
 
376
 
375
	ret
377
	ret
376
 
-
 
377
; If the device was already loaded, find the device number and return it in eax
378
 
378
 
379
; If the device was already loaded, find the device number and return it in eax
379
  .find_devicenum:
380
 
380
	DEBUGF	2,"Trying to find device number of already registered device\n"
381
  .find_devicenum:
381
	mov	ebx, eax
382
	DEBUGF	2,"Trying to find device number of already registered device\n"
Line 443... Line 444...
443
	set_io	REG_TXCONFIG + 2
444
	set_io	REG_TXCONFIG + 2
444
	in	ax , dx
445
	in	ax , dx
445
	shr	ah , 2
446
	shr	ah , 2
446
	shr	ax , 6
447
	shr	ax , 6
447
	and	al , 01111111b
448
	and	al , 01111111b
-
 
449
 
448
	mov	ecx, HW_VER_ARRAY_SIZE-1
450
	mov	ecx, HW_VER_ARRAY_SIZE-1
449
  .chip_ver_loop:
451
  .chip_ver_loop:
450
	cmp	al , [hw_ver_array+ecx]
452
	cmp	al , [hw_ver_array + ecx]
451
	je	.chip_ver_found
453
	je	.chip_ver_found
452
	dec	ecx
454
	dec	ecx
453
	jns	.chip_ver_loop
455
	jns	.chip_ver_loop
-
 
456
  .unknown:
454
	xor	cl , cl ; default RTL8139
457
	mov	ecx, 8
455
  .chip_ver_found:
458
  .chip_ver_found:
-
 
459
	cmp	ecx, 8
-
 
460
	jg	.unknown
-
 
461
 
456
	mov	[device.hw_ver_id], cl
462
	mov	[device.hw_ver_id], cl
Line 457... Line -...
457
 
-
 
458
	shl	ecx, 2
463
 
459
	add	ecx, crosslist
-
 
460
	mov	ecx, [ecx]
464
	mov	ecx, [crosslist + ecx*4]
Line 461... Line 465...
461
	mov	[device.name], ecx
465
	mov	[device.name], ecx
Line 462... Line 466...
462
 
466
 
Line 1221... Line 1225...
1221
device_4      db 'Realtek 8139C',0
1225
device_4      db 'Realtek 8139C',0
1222
device_5      db 'Realtek 8100',0
1226
device_5      db 'Realtek 8100',0
1223
device_6      db 'Realtek 8139D',0
1227
device_6      db 'Realtek 8139D',0
1224
device_7      db 'Realtek 8139CP',0
1228
device_7      db 'Realtek 8139CP',0
1225
device_8      db 'Realtek 8101',0
1229
device_8      db 'Realtek 8101',0
-
 
1230
device_unknown db 'Unknown RTL8139 clone', 0
Line 1226... Line 1231...
1226
 
1231
 
1227
crosslist     dd device_1
1232
crosslist     dd device_1
1228
	      dd device_2
1233
	      dd device_2
1229
	      dd device_3
1234
	      dd device_3
1230
	      dd device_4
1235
	      dd device_4
1231
	      dd device_5
1236
	      dd device_5
1232
	      dd device_6
1237
	      dd device_6
1233
	      dd device_7
1238
	      dd device_7
-
 
1239
	      dd device_8
Line 1234... Line 1240...
1234
	      dd device_8
1240
	      dd device_unknown
1235
 
1241
 
1236
hw_ver_array  db VER_RTL8139			; This array is used by the probe routine to find out wich version of the RTL8139 we are working with
1242
hw_ver_array  db VER_RTL8139			; This array is used by the probe routine to find out wich version of the RTL8139 we are working with
1237
	      db VER_RTL8139A
1243
	      db VER_RTL8139A
1238
	      db VER_RTL8139B
1244
	      db VER_RTL8139B
1239
	      db VER_RTL8139C
1245
	      db VER_RTL8139C
1240
	      db VER_RTL8100
1246
	      db VER_RTL8100
1241
	      db VER_RTL8139D
1247
	      db VER_RTL8139D
-
 
1248
	      db VER_RTL8139CP
Line 1242... Line 1249...
1242
	      db VER_RTL8139CP
1249
	      db VER_RTL8101
Line 1243... Line 1250...
1243
	      db VER_RTL8101
1250
	      db 0