From 6e9baa9c88a9f6893d04b4818c85dc9a76cf5bce Mon Sep 17 00:00:00 2001 From: hidnplayr Date: Tue, 14 Jan 2014 14:11:06 +0000 Subject: [PATCH] Proper link detection for RTL8139. git-svn-id: svn://kolibrios.org@4449 a494cfbc-eb01-0410-851d-a64ba20cac60 --- drivers/ethernet/RTL8139.asm | 20 ++++++++++++-------- drivers/netdrv.inc | 8 ++++---- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/drivers/ethernet/RTL8139.asm b/drivers/ethernet/RTL8139.asm index 8e66a1c089..2d27e60aaa 100644 --- a/drivers/ethernet/RTL8139.asm +++ b/drivers/ethernet/RTL8139.asm @@ -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 ;; ;; ;; ;; Realtek 8139 driver for KolibriOS ;; @@ -242,7 +242,7 @@ proc START stdcall, state:dword .entry: - DEBUGF 1, "Loading driver\n" + DEBUGF 2, "Loading driver\n" stdcall RegService, my_service, service_proc ret @@ -957,7 +957,9 @@ int_handler: test ax, ISR_PUN jz @f - DEBUGF 2, "RX:Packet underrun!\n" + DEBUGF 1, "Packet underrun or link changed!\n" + + call cable ;---------------------------------------------------- ; Receive FIFO overflow ? @@ -966,7 +968,7 @@ int_handler: jz @f push ax - DEBUGF 2, "RX:fifo overflow!\n" + DEBUGF 2, "RX fifo overflow!\n" set_io 0 set_io REG_ISR @@ -975,11 +977,13 @@ int_handler: pop ax ;---------------------------------------------------- -; Something about Cable changed ? +; cable length changed ? @@: test ax, ISR_LENCHG jz .fail + DEBUGF 2, "Cable length changed!\n" + call cable .fail: @@ -1015,21 +1019,21 @@ cable: .100mbps: mov [device.state], ETH_LINK_100M call NetLinkChanged - DEBUGF 1, "100 mbit\n" + DEBUGF 2, "link changed to 100 mbit\n" ret .10mbps: mov [device.state], ETH_LINK_10M call NetLinkChanged - DEBUGF 1, "10 mbit\n" + DEBUGF 2, "link changed to 10 mbit\n" ret .notconnected: mov [device.state], ETH_LINK_DOWN call NetLinkChanged - DEBUGF 1, "no link\n" + DEBUGF 2, "no link\n" ret diff --git a/drivers/netdrv.inc b/drivers/netdrv.inc index 9ca268d15b..aee9091885 100644 --- a/drivers/netdrv.inc +++ b/drivers/netdrv.inc @@ -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 ;; ;; ;; ;; 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 ; The driver name is taken from my_service label @@ -22,6 +19,9 @@ if defined my_service end if +include 'pci.inc' +include 'mii.inc' + ; Kernel variables PAGESIZE = 4096