Proper link detection for RTL8139.

git-svn-id: svn://kolibrios.org@4449 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr 2014-01-14 14:11:06 +00:00
parent 6694b236de
commit 6e9baa9c88
2 changed files with 16 additions and 12 deletions

View File

@ -1,6 +1,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; ;; ;;
;; Copyright (C) KolibriOS team 2004-2013. All rights reserved. ;; ;; Copyright (C) KolibriOS team 2004-2014. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;; ;; Distributed under terms of the GNU General Public License ;;
;; ;; ;; ;;
;; Realtek 8139 driver for KolibriOS ;; ;; Realtek 8139 driver for KolibriOS ;;
@ -242,7 +242,7 @@ proc START stdcall, state:dword
.entry: .entry:
DEBUGF 1, "Loading driver\n" DEBUGF 2, "Loading driver\n"
stdcall RegService, my_service, service_proc stdcall RegService, my_service, service_proc
ret ret
@ -957,7 +957,9 @@ int_handler:
test ax, ISR_PUN test ax, ISR_PUN
jz @f jz @f
DEBUGF 2, "RX:Packet underrun!\n" DEBUGF 1, "Packet underrun or link changed!\n"
call cable
;---------------------------------------------------- ;----------------------------------------------------
; Receive FIFO overflow ? ; Receive FIFO overflow ?
@ -966,7 +968,7 @@ int_handler:
jz @f jz @f
push ax push ax
DEBUGF 2, "RX:fifo overflow!\n" DEBUGF 2, "RX fifo overflow!\n"
set_io 0 set_io 0
set_io REG_ISR set_io REG_ISR
@ -975,11 +977,13 @@ int_handler:
pop ax pop ax
;---------------------------------------------------- ;----------------------------------------------------
; Something about Cable changed ? ; cable length changed ?
@@: @@:
test ax, ISR_LENCHG test ax, ISR_LENCHG
jz .fail jz .fail
DEBUGF 2, "Cable length changed!\n"
call cable call cable
.fail: .fail:
@ -1015,21 +1019,21 @@ cable:
.100mbps: .100mbps:
mov [device.state], ETH_LINK_100M mov [device.state], ETH_LINK_100M
call NetLinkChanged call NetLinkChanged
DEBUGF 1, "100 mbit\n" DEBUGF 2, "link changed to 100 mbit\n"
ret ret
.10mbps: .10mbps:
mov [device.state], ETH_LINK_10M mov [device.state], ETH_LINK_10M
call NetLinkChanged call NetLinkChanged
DEBUGF 1, "10 mbit\n" DEBUGF 2, "link changed to 10 mbit\n"
ret ret
.notconnected: .notconnected:
mov [device.state], ETH_LINK_DOWN mov [device.state], ETH_LINK_DOWN
call NetLinkChanged call NetLinkChanged
DEBUGF 1, "no link\n" DEBUGF 2, "no link\n"
ret ret

View File

@ -1,6 +1,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; ;; ;;
;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;; ;; Copyright (C) KolibriOS team 2004-2014. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;; ;; Distributed under terms of the GNU General Public License ;;
;; ;; ;; ;;
;; GNU GENERAL PUBLIC LICENSE ;; ;; GNU GENERAL PUBLIC LICENSE ;;
@ -8,9 +8,6 @@
;; ;; ;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
include 'pci.inc'
include 'mii.inc'
; This macro will prepend driver name to all debug output through DEBUGF macro ; This macro will prepend driver name to all debug output through DEBUGF macro
; The driver name is taken from my_service label ; The driver name is taken from my_service label
@ -22,6 +19,9 @@ if defined my_service
end if end if
include 'pci.inc'
include 'mii.inc'
; Kernel variables ; Kernel variables
PAGESIZE = 4096 PAGESIZE = 4096