2010-08-07 23:04:24 +02:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; ;;
|
|
|
|
;; Copyright (C) KolibriOS team 2004-2010. All rights reserved. ;;
|
|
|
|
;; Distributed under terms of the GNU General Public License ;;
|
|
|
|
;; ;;
|
|
|
|
;; MTD80x driver for KolibriOS ;;
|
|
|
|
;; ;;
|
|
|
|
;; Based on mtd80x.c from the etherboot project ;;
|
|
|
|
;; ;;
|
|
|
|
;; Written by hidnplayr@kolibrios.org ;;
|
|
|
|
;; ;;
|
|
|
|
;; GNU GENERAL PUBLIC LICENSE ;;
|
|
|
|
;; Version 2, June 1991 ;;
|
|
|
|
;; ;;
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
format MS COFF
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
API_VERSION equ 0x01000100
|
|
|
|
DRIVER_VERSION equ 5
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
MAX_DEVICES equ 16
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
DEBUG equ 1
|
|
|
|
__DEBUG__ equ 1
|
|
|
|
__DEBUG_LEVEL__ equ 1
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
NUM_TX_DESC equ 4
|
|
|
|
NUM_RX_DESC equ 4
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
include 'proc32.inc'
|
|
|
|
include 'imports.inc'
|
|
|
|
include 'fdo.inc'
|
|
|
|
include 'netdrv.inc'
|
|
|
|
|
|
|
|
public START
|
|
|
|
public service_proc
|
|
|
|
public version
|
|
|
|
|
|
|
|
|
|
|
|
; for different PHY
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
MysonPHY equ 1
|
|
|
|
AhdocPHY equ 2
|
|
|
|
SeeqPHY equ 3
|
|
|
|
MarvellPHY equ 4
|
|
|
|
Myson981 equ 5
|
|
|
|
LevelOnePHY equ 6
|
|
|
|
OtherPHY equ 10
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
; Offsets to the Command and Status Registers.
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
PAR0 equ 0x0 ; physical address 0-3
|
|
|
|
PAR1 equ 0x04 ; physical address 4-5
|
|
|
|
MAR0 equ 0x08 ; multicast address 0-3
|
|
|
|
MAR1 equ 0x0C ; multicast address 4-7
|
|
|
|
FAR0 equ 0x10 ; flow-control address 0-3
|
|
|
|
FAR1 equ 0x14 ; flow-control address 4-5
|
|
|
|
TCRRCR equ 0x18 ; receive & transmit configuration
|
|
|
|
BCR equ 0x1C ; bus command
|
|
|
|
TXPDR equ 0x20 ; transmit polling demand
|
|
|
|
RXPDR equ 0x24 ; receive polling demand
|
|
|
|
RXCWP equ 0x28 ; receive current word pointer
|
|
|
|
TXLBA equ 0x2C ; transmit list base address
|
|
|
|
RXLBA equ 0x30 ; receive list base address
|
|
|
|
ISR equ 0x34 ; interrupt status
|
|
|
|
IMR equ 0x38 ; interrupt mask
|
|
|
|
FTH equ 0x3C ; flow control high/low threshold
|
|
|
|
MANAGEMENT equ 0x40 ; bootrom/eeprom and mii management
|
|
|
|
TALLY equ 0x44 ; tally counters for crc and mpa
|
|
|
|
TSR equ 0x48 ; tally counter for transmit status
|
|
|
|
BMCRSR equ 0x4c ; basic mode control and status
|
|
|
|
PHYIDENTIFIER equ 0x50 ; phy identifier
|
|
|
|
ANARANLPAR equ 0x54 ; auto-negotiation advertisement and link partner ability
|
|
|
|
ANEROCR equ 0x58 ; auto-negotiation expansion and pci conf.
|
|
|
|
BPREMRPSR equ 0x5c ; bypass & receive error mask and phy status
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
; Bits in the interrupt status/enable registers.
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
RFCON equ 0x00020000 ; receive flow control xon packet
|
|
|
|
RFCOFF equ 0x00010000 ; receive flow control xoff packet
|
|
|
|
LSCStatus equ 0x00008000 ; link status change
|
|
|
|
ANCStatus equ 0x00004000 ; autonegotiation completed
|
|
|
|
FBE equ 0x00002000 ; fatal bus error
|
|
|
|
FBEMask equ 0x00001800 ; mask bit12-11
|
|
|
|
ParityErr equ 0x00000000 ; parity error
|
|
|
|
TargetErr equ 0x00001000 ; target abort
|
|
|
|
MasterErr equ 0x00000800 ; master error
|
|
|
|
TUNF equ 0x00000400 ; transmit underflow
|
|
|
|
ROVF equ 0x00000200 ; receive overflow
|
|
|
|
ETI equ 0x00000100 ; transmit early int
|
|
|
|
ERI equ 0x00000080 ; receive early int
|
|
|
|
CNTOVF equ 0x00000040 ; counter overflow
|
|
|
|
RBU equ 0x00000020 ; receive buffer unavailable
|
|
|
|
TBU equ 0x00000010 ; transmit buffer unavilable
|
|
|
|
TI equ 0x00000008 ; transmit interrupt
|
|
|
|
RI equ 0x00000004 ; receive interrupt
|
|
|
|
RxErr equ 0x00000002 ; receive error
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
; Bits in the NetworkConfig register.
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
RxModeMask equ 0xe0
|
|
|
|
AcceptAllPhys equ 0x80 ; promiscuous mode
|
|
|
|
AcceptBroadcast equ 0x40 ; accept broadcast
|
|
|
|
AcceptMulticast equ 0x20 ; accept mutlicast
|
|
|
|
AcceptRunt equ 0x08 ; receive runt pkt
|
|
|
|
ALP equ 0x04 ; receive long pkt
|
|
|
|
AcceptErr equ 0x02 ; receive error pkt
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
AcceptMyPhys equ 0x00000000
|
|
|
|
RxEnable equ 0x00000001
|
|
|
|
RxFlowCtrl equ 0x00002000
|
|
|
|
TxEnable equ 0x00040000
|
|
|
|
TxModeFDX equ 0x00100000
|
|
|
|
TxThreshold equ 0x00e00000
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
PS1000 equ 0x00010000
|
|
|
|
PS10 equ 0x00080000
|
|
|
|
FD equ 0x00100000
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
; Bits in network_desc.status
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
RXOWN equ 0x80000000 ; own bit
|
|
|
|
FLNGMASK equ 0x0fff0000 ; frame length
|
|
|
|
FLNGShift equ 16
|
|
|
|
MARSTATUS equ 0x00004000 ; multicast address received
|
|
|
|
BARSTATUS equ 0x00002000 ; broadcast address received
|
|
|
|
PHYSTATUS equ 0x00001000 ; physical address received
|
|
|
|
RXFSD equ 0x00000800 ; first descriptor
|
|
|
|
RXLSD equ 0x00000400 ; last descriptor
|
|
|
|
ErrorSummary equ 0x80 ; error summary
|
|
|
|
RUNT equ 0x40 ; runt packet received
|
|
|
|
LONG equ 0x20 ; long packet received
|
|
|
|
FAE equ 0x10 ; frame align error
|
|
|
|
CRC equ 0x08 ; crc error
|
|
|
|
RXER equ 0x04 ; receive error
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
; rx_desc_control_bits
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
RXIC equ 0x00800000 ; interrupt control
|
|
|
|
RBSShift equ 0
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
; tx_desc_status_bits
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
TXOWN equ 0x80000000 ; own bit
|
|
|
|
JABTO equ 0x00004000 ; jabber timeout
|
|
|
|
CSL equ 0x00002000 ; carrier sense lost
|
|
|
|
LC equ 0x00001000 ; late collision
|
|
|
|
EC equ 0x00000800 ; excessive collision
|
|
|
|
UDF equ 0x00000400 ; fifo underflow
|
|
|
|
DFR equ 0x00000200 ; deferred
|
|
|
|
HF equ 0x00000100 ; heartbeat fail
|
|
|
|
NCRMask equ 0x000000ff ; collision retry count
|
|
|
|
NCRShift equ 0
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
; tx_desc_control_bits
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
TXIC equ 0x80000000 ; interrupt control
|
|
|
|
ETIControl equ 0x40000000 ; early transmit interrupt
|
|
|
|
TXLD equ 0x20000000 ; last descriptor
|
|
|
|
TXFD equ 0x10000000 ; first descriptor
|
|
|
|
CRCEnable equ 0x08000000 ; crc control
|
|
|
|
PADEnable equ 0x04000000 ; padding control
|
|
|
|
RetryTxLC equ 0x02000000 ; retry late collision
|
|
|
|
PKTSMask equ 0x3ff800 ; packet size bit21-11
|
|
|
|
PKTSShift equ 11
|
|
|
|
TBSMask equ 0x000007ff ; transmit buffer bit 10-0
|
|
|
|
TBSShift equ 0
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
; BootROM/EEPROM/MII Management Register
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
MASK_MIIR_MII_READ equ 0x00000000
|
2010-08-07 23:04:24 +02:00
|
|
|
MASK_MIIR_MII_WRITE equ 0x00000008
|
2012-04-02 20:49:13 +02:00
|
|
|
MASK_MIIR_MII_MDO equ 0x00000004
|
|
|
|
MASK_MIIR_MII_MDI equ 0x00000002
|
|
|
|
MASK_MIIR_MII_MDC equ 0x00000001
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
; ST+OP+PHYAD+REGAD+TA
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
OP_READ equ 0x6000 ; ST:01+OP:10+PHYAD+REGAD+TA:Z0
|
|
|
|
OP_WRITE equ 0x5002 ; ST:01+OP:01+PHYAD+REGAD+TA:10
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
; -------------------------------------------------------------------------
|
|
|
|
; Constants for Myson PHY
|
|
|
|
; -------------------------------------------------------------------------
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
MysonPHYID equ 0xd0000302
|
|
|
|
MysonPHYID0 equ 0x0302
|
|
|
|
StatusRegister equ 18
|
|
|
|
SPEED100 equ 0x0400 ; bit10
|
|
|
|
FULLMODE equ 0x0800 ; bit11
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
; -------------------------------------------------------------------------
|
|
|
|
; Constants for Seeq 80225 PHY
|
|
|
|
; -------------------------------------------------------------------------
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
SeeqPHYID0 equ 0x0016
|
|
|
|
MIIRegister18 equ 18
|
|
|
|
SPD_DET_100 equ 0x80
|
|
|
|
DPLX_DET_FULL equ 0x40
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
; -------------------------------------------------------------------------
|
|
|
|
; Constants for Ahdoc 101 PHY
|
|
|
|
; -------------------------------------------------------------------------
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
AhdocPHYID0 equ 0x0022
|
|
|
|
DiagnosticReg equ 18
|
|
|
|
DPLX_FULL equ 0x0800
|
|
|
|
Speed_100 equ 0x0400
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
; --------------------------------------------------------------------------
|
|
|
|
; Constants
|
|
|
|
; --------------------------------------------------------------------------
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
MarvellPHYID0 equ 0x0141
|
|
|
|
LevelOnePHYID0 equ 0x0013
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
MII1000BaseTControlReg equ 9
|
|
|
|
MII1000BaseTStatusReg equ 10
|
|
|
|
SpecificReg equ 17
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
; for 1000BaseT Control Register
|
|
|
|
|
|
|
|
PHYAbletoPerform1000FullDuplex equ 0x0200
|
|
|
|
PHYAbletoPerform1000HalfDuplex equ 0x0100
|
2012-04-02 20:49:13 +02:00
|
|
|
PHY1000AbilityMask equ 0x300
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
; for phy specific status register, marvell phy.
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
SpeedMask equ 0x0c000
|
2010-08-07 23:04:24 +02:00
|
|
|
Speed_1000M equ 0x08000
|
2012-04-02 20:49:13 +02:00
|
|
|
Speed_100M equ 0x4000
|
|
|
|
Speed_10M equ 0
|
2010-08-07 23:04:24 +02:00
|
|
|
Full_Duplex equ 0x2000
|
|
|
|
|
|
|
|
; for phy specific status register, levelone phy
|
|
|
|
|
|
|
|
LXT1000_100M equ 0x08000
|
|
|
|
LXT1000_1000M equ 0x0c000
|
|
|
|
LXT1000_Full equ 0x200
|
|
|
|
|
|
|
|
; for PHY
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
LinkIsUp equ 0x0004
|
|
|
|
LinkIsUp2 equ 0x00040000
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
virtual at 0
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
mtd_desc:
|
|
|
|
.status dd ?
|
|
|
|
.control dd ?
|
|
|
|
.buffer dd ?
|
|
|
|
.next_desc dd ?
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
.next_desc_logical dd ?
|
|
|
|
.skbuff dd ?
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
.reserved1 dd ?
|
|
|
|
.reserved2 dd ?
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
.size = $
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
end virtual
|
|
|
|
|
|
|
|
|
|
|
|
virtual at ebx
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
device:
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
ETH_DEVICE
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
.tx_desc rb NUM_TX_DESC*mtd_desc.size
|
|
|
|
.rx_desc rb NUM_RX_DESC*mtd_desc.size
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
.io_addr dd ?
|
|
|
|
.pci_bus db ?
|
|
|
|
.pci_dev db ?
|
|
|
|
.irq_line db ?
|
|
|
|
.dev_id dw ?
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
.flags dd ?
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
.crvalue dd ?
|
|
|
|
.bcrvalue dd ?
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
.cur_rx dd ?
|
|
|
|
.cur_tx dd ?
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
; These values are keep track of the transceiver/media in use.
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
.linkok dd ?
|
|
|
|
.line_speed dd ?
|
|
|
|
.duplexmode dd ?
|
|
|
|
.default_port dd ?
|
|
|
|
.PHYType dd ?
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
; MII transceiver section.
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
.mii_cnt dd ? ; MII device addresses.
|
|
|
|
.phys db ? ; MII device addresses.
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
device_size = $ - device
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
end virtual
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
section '.flat' code readable align 16
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; ;;
|
|
|
|
;; proc START ;;
|
|
|
|
;; ;;
|
|
|
|
;; (standard driver proc) ;;
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
align 4
|
|
|
|
proc START stdcall, state:dword
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
cmp [state], 1
|
|
|
|
jne .exit
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
.entry:
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
DEBUGF 2,"Loading mtd80x driver\n"
|
|
|
|
stdcall RegService, my_service, service_proc
|
|
|
|
ret
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
.fail:
|
|
|
|
.exit:
|
2012-04-02 20:49:13 +02:00
|
|
|
xor eax, eax
|
|
|
|
ret
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
endp
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; ;;
|
|
|
|
;; proc SERVICE_PROC ;;
|
|
|
|
;; ;;
|
|
|
|
;; (standard driver proc) ;;
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
align 4
|
|
|
|
proc service_proc stdcall, ioctl:dword
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
mov edx, [ioctl]
|
|
|
|
mov eax, [IOCTL.io_code]
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
;------------------------------------------------------
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
cmp eax, 0 ;SRV_GETVERSION
|
|
|
|
jne @F
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
cmp [IOCTL.out_size], 4
|
|
|
|
jl .fail
|
|
|
|
mov eax, [IOCTL.output]
|
|
|
|
mov [eax], dword API_VERSION
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
xor eax, eax
|
|
|
|
ret
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
;------------------------------------------------------
|
|
|
|
@@:
|
2012-04-02 20:49:13 +02:00
|
|
|
cmp eax, 1 ;SRV_HOOK
|
|
|
|
jne .fail
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
cmp [IOCTL.inp_size], 3 ; Data input must be at least 3 bytes
|
|
|
|
jl .fail
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
mov eax, [IOCTL.input]
|
|
|
|
cmp byte [eax], 1 ; 1 means device number and bus number (pci) are given
|
|
|
|
jne .fail ; other types arent supported for this card yet
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
; check if the device is already listed
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
mov esi, device_list
|
|
|
|
mov ecx, [devices]
|
|
|
|
test ecx, ecx
|
|
|
|
jz .firstdevice
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
; mov eax, [IOCTL.input] ; get the pci bus and device numbers
|
2012-04-02 20:49:13 +02:00
|
|
|
mov ax , [eax+1] ;
|
2010-08-07 23:04:24 +02:00
|
|
|
.nextdevice:
|
2012-04-02 20:49:13 +02:00
|
|
|
mov ebx, [esi]
|
|
|
|
cmp ax , word [device.pci_bus] ; compare with pci and device num in device list (notice the usage of word instead of byte)
|
|
|
|
je .find_devicenum ; Device is already loaded, let's find it's device number
|
|
|
|
add esi, 4
|
|
|
|
loop .nextdevice
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
; This device doesnt have its own eth_device structure yet, lets create one
|
|
|
|
.firstdevice:
|
2012-04-02 20:49:13 +02:00
|
|
|
cmp [devices], MAX_DEVICES ; First check if the driver can handle one more card
|
|
|
|
jge .fail
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
allocate_and_clear ebx, device_size, .fail
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
; Fill in the direct call addresses into the struct
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
mov [device.reset], reset
|
|
|
|
mov [device.transmit], transmit
|
|
|
|
mov [device.get_MAC], read_mac
|
|
|
|
mov [device.set_MAC], write_mac
|
|
|
|
mov [device.unload], unload
|
|
|
|
mov [device.name], my_service
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
; save the pci bus and device numbers
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
mov eax, [IOCTL.input]
|
|
|
|
mov cl , [eax+1]
|
|
|
|
mov [device.pci_bus], cl
|
|
|
|
mov cl , [eax+2]
|
|
|
|
mov [device.pci_dev], cl
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
; Now, it's time to find the base io addres of the PCI device
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
find_io [device.pci_bus], [device.pci_dev], [device.io_addr]
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
; We've found the io address, find IRQ now
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
find_irq [device.pci_bus], [device.pci_dev], [device.irq_line]
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
DEBUGF 2,"Hooking into device, dev:%x, bus:%x, irq:%x, addr:%x\n",\
|
|
|
|
[device.pci_dev]:1,[device.pci_bus]:1,[device.irq_line]:1,[device.io_addr]:8
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
; Ok, the eth_device structure is ready, let's probe the device
|
|
|
|
; Because initialization fires IRQ, IRQ handler must be aware of this device
|
2012-04-02 20:49:13 +02:00
|
|
|
mov eax, [devices] ; Add the device structure to our device list
|
|
|
|
mov [device_list+4*eax], ebx ; (IRQ handler uses this list to find device)
|
|
|
|
inc [devices] ;
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
call probe ; this function will output in eax
|
|
|
|
test eax, eax
|
|
|
|
jnz .err2 ; If an error occured, exit
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
mov [device.type], NET_TYPE_ETH
|
|
|
|
call NetRegDev
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
cmp eax, -1
|
|
|
|
je .destroy
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
ret
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
; If the device was already loaded, find the device number and return it in eax
|
|
|
|
|
|
|
|
.find_devicenum:
|
2012-04-02 20:49:13 +02:00
|
|
|
DEBUGF 2,"Trying to find device number of already registered device\n"
|
|
|
|
call NetPtrToNum ; This kernel procedure converts a pointer to device struct in ebx
|
|
|
|
; into a device number in edi
|
|
|
|
mov eax, edi ; Application wants it in eax instead
|
|
|
|
DEBUGF 2,"Kernel says: %u\n", eax
|
|
|
|
ret
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
; If an error occured, remove all allocated data and exit (returning -1 in eax)
|
|
|
|
|
|
|
|
.destroy:
|
2012-04-02 20:49:13 +02:00
|
|
|
; todo: reset device into virgin state
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
.err2:
|
2012-04-02 20:49:13 +02:00
|
|
|
dec [devices]
|
2010-08-07 23:04:24 +02:00
|
|
|
.err:
|
2012-04-02 20:49:13 +02:00
|
|
|
DEBUGF 2,"removing device structure\n"
|
|
|
|
stdcall KernelFree, ebx
|
2010-08-07 23:04:24 +02:00
|
|
|
.fail:
|
2012-04-02 20:49:13 +02:00
|
|
|
or eax, -1
|
|
|
|
ret
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
;------------------------------------------------------
|
|
|
|
endp
|
|
|
|
|
|
|
|
|
|
|
|
;;/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\;;
|
|
|
|
;; ;;
|
|
|
|
;; Actual Hardware dependent code starts here ;;
|
|
|
|
;; ;;
|
|
|
|
;;/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\;;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
unload:
|
2012-04-02 20:49:13 +02:00
|
|
|
; TODO: (in this particular order)
|
|
|
|
;
|
|
|
|
; - Stop the device
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
; /* Disable Tx Rx*/
|
|
|
|
; outl( mtdx.crvalue & (~TxEnable) & (~RxEnable), mtdx.ioaddr + TCRRCR );
|
|
|
|
;
|
|
|
|
; /* Reset the chip to erase previous misconfiguration. */
|
|
|
|
; mtd_reset(nic);
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
; - Detach int handler
|
|
|
|
; - Remove device from local list (device_list)
|
|
|
|
; - call unregister function in kernel
|
|
|
|
; - Remove all allocated structures and buffers the card used
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
or eax,-1
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
;-------
|
|
|
|
;
|
|
|
|
; PROBE
|
|
|
|
;
|
|
|
|
;-------
|
|
|
|
align 4
|
|
|
|
probe:
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
DEBUGF 2,"Probing mtd80x device\n"
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
make_bus_master [device.pci_bus], [device.pci_dev]
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
movzx eax, [device.pci_bus]
|
|
|
|
movzx ecx, [device.pci_dev]
|
|
|
|
stdcall PciRead32, eax ,ecx ,0
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
cmp ax , 0x1516
|
|
|
|
jne .notfound
|
|
|
|
shr eax, 16
|
|
|
|
mov [device.dev_id], ax
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
cmp ax, 0x0800
|
|
|
|
je .has_mii_xcvr
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
cmp ax, 0x0803
|
|
|
|
je .has_chip_xcvr
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
cmp ax, 0x0891
|
|
|
|
je .has_mii_xcvr
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
.notfound:
|
2012-04-02 20:49:13 +02:00
|
|
|
DEBUGF 1,"Device not supported!\n"
|
|
|
|
xor eax, eax
|
|
|
|
dec eax
|
|
|
|
ret
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
.has_chip_xcvr:
|
2012-04-02 20:49:13 +02:00
|
|
|
DEBUGF 1,"Device has chip xcvr\n"
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
jmp .xcvr_set
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
.has_mii_xcvr:
|
2012-04-02 20:49:13 +02:00
|
|
|
DEBUGF 1,"Device has mii xcvr\n"
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
.xcvr_set:
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
call read_mac
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
; Reset the chip to erase previous misconfiguration.
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
set_io 0
|
|
|
|
set_io BCR
|
|
|
|
xor eax, eax
|
|
|
|
inc eax
|
|
|
|
out dx, eax
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
; find the connected MII xcvrs
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
cmp [device.dev_id], 0x0803
|
|
|
|
je .is_803
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
; int phy, phy_idx equ 0;
|
|
|
|
;
|
|
|
|
; for (phy equ 1; phy < 32 && phy_idx < 1; phy++) {
|
|
|
|
; int mii_status equ mdio_read(nic, phy, 1);
|
|
|
|
;
|
|
|
|
; if (mii_status !equ 0xffff && mii_status !equ 0x0000) {
|
|
|
|
; mtdx.phys[phy_idx] equ phy;
|
|
|
|
;
|
|
|
|
; DBG ( "%s: MII PHY found at address %d, status "
|
|
|
|
; "0x%4.4x.\n", mtdx.nic_name, phy, mii_status );
|
|
|
|
; /* get phy type */
|
|
|
|
; {
|
|
|
|
; unsigned int data;
|
|
|
|
;
|
|
|
|
; data equ mdio_read(nic, mtdx.phys[phy_idx], 2);
|
|
|
|
; if (data equequ SeeqPHYID0)
|
|
|
|
; mtdx.PHYType equ SeeqPHY;
|
|
|
|
; else if (data equequ AhdocPHYID0)
|
|
|
|
; mtdx.PHYType equ AhdocPHY;
|
|
|
|
; else if (data equequ MarvellPHYID0)
|
|
|
|
; mtdx.PHYType equ MarvellPHY;
|
|
|
|
; else if (data equequ MysonPHYID0)
|
|
|
|
; mtdx.PHYType equ Myson981;
|
|
|
|
; else if (data equequ LevelOnePHYID0)
|
|
|
|
; mtdx.PHYType equ LevelOnePHY;
|
|
|
|
; else
|
|
|
|
; mtdx.PHYType equ OtherPHY;
|
|
|
|
; }
|
|
|
|
; phy_idx++;
|
|
|
|
; }
|
|
|
|
; }
|
|
|
|
;
|
|
|
|
; mtdx.mii_cnt equ phy_idx;
|
|
|
|
; if (phy_idx equequ 0) {
|
|
|
|
; printf("%s: MII PHY not found -- this device may "
|
|
|
|
; "not operate correctly.\n", mtdx.nic_name);
|
|
|
|
; }
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
jmp .no_803
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
.is_803:
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
mov [device.phys], 32
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
; get phy type
|
2012-04-02 20:49:13 +02:00
|
|
|
set_io 0
|
|
|
|
set_io PHYIDENTIFIER
|
|
|
|
in eax, dx
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
cmp eax, MysonPHYID
|
|
|
|
jne @f
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
mov [device.PHYType], MysonPHY
|
|
|
|
DEBUGF 1,"MysonPHY\n"
|
|
|
|
jmp .no_803
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
@@:
|
2012-04-02 20:49:13 +02:00
|
|
|
mov [device.PHYType], OtherPHY
|
|
|
|
DEBUGF 1,"OtherPHY\n"
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
.no_803:
|
|
|
|
|
|
|
|
;-------
|
|
|
|
;
|
|
|
|
; RESET
|
|
|
|
;
|
|
|
|
;-------
|
|
|
|
align 4
|
|
|
|
reset:
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
DEBUGF 1,"Resetting mtd80x\n"
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
;--------------------------------
|
|
|
|
; insert irq handler on given irq
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
movzx eax, [device.irq_line]
|
|
|
|
DEBUGF 1,"Attaching int handler to irq %x\n", eax:1
|
|
|
|
stdcall AttachIntHandler, eax, int_handler, dword 0
|
|
|
|
test eax, eax
|
|
|
|
jnz @f
|
|
|
|
DEBUGF 1,"\nCould not attach int handler!\n"
|
2010-08-07 23:04:24 +02:00
|
|
|
; or eax, -1
|
|
|
|
; ret
|
|
|
|
@@:
|
|
|
|
|
|
|
|
; Reset the chip to erase previous misconfiguration.
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
set_io 0
|
|
|
|
set_io BCR
|
|
|
|
xor eax, eax
|
|
|
|
inc eax
|
|
|
|
out dx, eax
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
call init_ring
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
; Initialize other registers.
|
|
|
|
; Configure the PCI bus bursts and FIFO thresholds.
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
mov [device.bcrvalue], 0x10 ; little-endian, 8 burst length
|
|
|
|
mov [device.crvalue], 0xa00 ; 128 burst length
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
cmp [device.dev_id], 0x891
|
|
|
|
jne @f
|
|
|
|
or [device.bcrvalue], 0x200 ; set PROG bit
|
|
|
|
or [device.crvalue], 0x02000000 ; set enhanced bit
|
2010-08-07 23:04:24 +02:00
|
|
|
@@:
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
or [device.crvalue], RxEnable + TxThreshold + TxEnable
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
call set_rx_mode
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
set_io 0
|
|
|
|
set_io BCR
|
|
|
|
mov eax, [device.bcrvalue]
|
|
|
|
out dx, eax
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
set_io TCRRCR
|
|
|
|
mov eax, [device.crvalue]
|
|
|
|
out dx, eax
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
call getlinkstatus
|
|
|
|
call getlinktype
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
; Restart Rx engine if stopped.
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
set_io 0
|
|
|
|
set_io RXPDR
|
|
|
|
xor eax, eax
|
|
|
|
out dx, eax
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
; Enable interrupts
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
set_io 0
|
|
|
|
set_io ISR
|
|
|
|
mov eax, (FBE or TUNF or CNTOVF or RBU or TI or RI)
|
|
|
|
out dx, eax
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
set_io IMR
|
2010-08-07 23:04:24 +02:00
|
|
|
; mov eax, (FBE or TUNF or CNTOVF or RBU or TI or RI)
|
2012-04-02 20:49:13 +02:00
|
|
|
out dx, eax
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
; clear packet/byte counters
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
xor eax, eax
|
|
|
|
lea edi, [device.bytes_tx]
|
|
|
|
mov ecx, 6
|
|
|
|
rep stosd
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
mov [device.mtu], 1514
|
|
|
|
xor eax, eax
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
ret
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
init_ring:
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
DEBUGF 1,"initializing rx and tx ring\n"
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
; Initialize all Rx descriptors
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
lea esi, [device.rx_desc]
|
|
|
|
mov [device.cur_rx], esi
|
|
|
|
mov ecx, NUM_RX_DESC
|
2010-08-07 23:04:24 +02:00
|
|
|
.rx_desc_loop:
|
2012-04-02 20:49:13 +02:00
|
|
|
mov [esi + mtd_desc.status], RXOWN
|
|
|
|
mov [esi + mtd_desc.control], 1536 shl RBSShift
|
|
|
|
|
|
|
|
lea eax, [esi + mtd_desc.size]
|
|
|
|
mov [esi + mtd_desc.next_desc_logical], eax
|
|
|
|
push ecx esi
|
|
|
|
GetRealAddr
|
|
|
|
mov [esi + mtd_desc.next_desc], eax
|
|
|
|
|
|
|
|
stdcall KernelAlloc, 1536
|
|
|
|
pop esi
|
|
|
|
push esi
|
|
|
|
mov [esi + mtd_desc.skbuff], eax
|
|
|
|
call GetPgAddr
|
|
|
|
pop esi ecx
|
|
|
|
mov [esi + mtd_desc.buffer], eax
|
|
|
|
|
|
|
|
add esi, mtd_desc.size
|
|
|
|
loop .rx_desc_loop
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
; Mark the last entry as wrapping the ring.
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
lea eax, [device.rx_desc]
|
|
|
|
mov [esi - mtd_desc.size + mtd_desc.next_desc_logical], eax
|
|
|
|
push esi
|
|
|
|
GetRealAddr
|
|
|
|
pop esi
|
|
|
|
mov [esi - mtd_desc.size + mtd_desc.next_desc], eax
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
set_io 0
|
|
|
|
set_io RXLBA
|
|
|
|
out dx, eax
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
; Initialize all Tx descriptors
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
lea esi, [device.tx_desc]
|
|
|
|
mov [device.cur_tx], esi
|
|
|
|
mov ecx, NUM_TX_DESC
|
2010-08-07 23:04:24 +02:00
|
|
|
.tx_desc_loop:
|
2012-04-02 20:49:13 +02:00
|
|
|
mov [esi + mtd_desc.status], 0
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
lea eax, [esi + mtd_desc.size]
|
|
|
|
mov [esi + mtd_desc.next_desc_logical], eax
|
|
|
|
push ecx esi
|
|
|
|
GetRealAddr
|
|
|
|
pop esi ecx
|
|
|
|
mov [esi + mtd_desc.next_desc], eax
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
add esi, mtd_desc.size
|
|
|
|
loop .tx_desc_loop
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
; Mark the last entry as wrapping the ring.
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
lea eax, [device.tx_desc]
|
|
|
|
mov [esi - mtd_desc.size + mtd_desc.next_desc_logical], eax
|
|
|
|
push esi
|
|
|
|
GetRealAddr
|
|
|
|
pop esi
|
|
|
|
mov [esi - mtd_desc.size + mtd_desc.next_desc], eax
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
set_io 0
|
|
|
|
set_io TXLBA
|
|
|
|
out dx, eax
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
ret
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
set_rx_mode:
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
DEBUGF 1,"Setting RX mode\n"
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
; Too many to match, or accept all multicasts.
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
set_io 0
|
|
|
|
set_io MAR0
|
|
|
|
xor eax, eax
|
|
|
|
not eax
|
|
|
|
out dx, eax
|
|
|
|
set_io MAR1
|
|
|
|
out dx, eax
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
and [device.crvalue], not (RxModeMask)
|
|
|
|
or [device.crvalue], AcceptBroadcast + AcceptMulticast + AcceptMyPhys
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
ret
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
getlinkstatus:
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
DEBUGF 1,"Getting link status\n"
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
mov [device.linkok], 0
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
cmp [device.PHYType], MysonPHY
|
|
|
|
jne .no_myson_phy
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
set_io 0
|
|
|
|
set_io BMCRSR
|
|
|
|
mov ecx, 1000
|
2010-08-07 23:04:24 +02:00
|
|
|
.loop1:
|
2012-04-02 20:49:13 +02:00
|
|
|
in eax, dx
|
|
|
|
test eax, LinkIsUp2
|
|
|
|
jnz .link_ok
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
push ecx edx ebx
|
|
|
|
mov esi, 10
|
|
|
|
call Sleep
|
|
|
|
pop ebx edx ecx
|
|
|
|
loop .loop1
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
ret
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
.no_myson_phy:
|
|
|
|
|
|
|
|
; for (i equ 0; i < DelayTime; ++i) {
|
|
|
|
; if (mdio_read(nic, mtdx.phys[0], MII_BMSR) & BMSR_LSTATUS) {
|
|
|
|
; mtdx.linkok equ 1;
|
|
|
|
; return;
|
|
|
|
; }
|
|
|
|
; m80x_delay(100);
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
ret
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
.link_ok:
|
2012-04-02 20:49:13 +02:00
|
|
|
DEBUGF 1,"Link is up\n"
|
|
|
|
inc [device.linkok]
|
|
|
|
ret
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
getlinktype:
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
DEBUGF 1,"Getting link type\n"
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
cmp [device.PHYType], MysonPHY
|
|
|
|
jne .no_myson_phy
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
DEBUGF 1,"myson PHY\n"
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
set_io 0
|
|
|
|
set_io TCRRCR
|
|
|
|
in eax, dx
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
mov [device.duplexmode], 1 ; 1 equ half duplex
|
|
|
|
test eax, FD
|
|
|
|
jne @f
|
|
|
|
DEBUGF 1,"full duplex\n"
|
|
|
|
inc [device.duplexmode] ; 2 equ full duplex
|
2010-08-07 23:04:24 +02:00
|
|
|
@@:
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
mov [device.line_speed], 1 ; 1 equ 10M
|
|
|
|
test eax, PS10
|
|
|
|
jne @f
|
|
|
|
DEBUGF 1,"100mbit\n"
|
|
|
|
inc [device.line_speed] ; 2 equ 100M
|
2010-08-07 23:04:24 +02:00
|
|
|
@@:
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
ret
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
.no_myson_phy:
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
DEBUGF 1,"no myson phy\n"
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
; if (mtdx.PHYType equequ SeeqPHY) { /* this PHY is SEEQ 80225 */
|
|
|
|
; unsigned int data;
|
|
|
|
;
|
|
|
|
; data equ mdio_read(dev, mtdx.phys[0], MIIRegister18);
|
|
|
|
; if (data & SPD_DET_100)
|
|
|
|
; mtdx.line_speed equ 2; /* 100M */
|
|
|
|
; else
|
|
|
|
; mtdx.line_speed equ 1; /* 10M */
|
|
|
|
; if (data & DPLX_DET_FULL)
|
|
|
|
; mtdx.duplexmode equ 2; /* full duplex mode */
|
|
|
|
; else
|
|
|
|
; mtdx.duplexmode equ 1; /* half duplex mode */
|
|
|
|
; } else if (mtdx.PHYType equequ AhdocPHY) {
|
|
|
|
; unsigned int data;
|
|
|
|
;
|
|
|
|
; data equ mdio_read(dev, mtdx.phys[0], DiagnosticReg);
|
|
|
|
; if (data & Speed_100)
|
|
|
|
; mtdx.line_speed equ 2; /* 100M */
|
|
|
|
; else
|
|
|
|
; mtdx.line_speed equ 1; /* 10M */
|
|
|
|
; if (data & DPLX_FULL)
|
|
|
|
; mtdx.duplexmode equ 2; /* full duplex mode */
|
|
|
|
; else
|
|
|
|
; mtdx.duplexmode equ 1; /* half duplex mode */
|
|
|
|
; }
|
|
|
|
; else if (mtdx.PHYType equequ MarvellPHY) {
|
|
|
|
; unsigned int data;
|
|
|
|
;
|
|
|
|
; data equ mdio_read(dev, mtdx.phys[0], SpecificReg);
|
|
|
|
; if (data & Full_Duplex)
|
|
|
|
; mtdx.duplexmode equ 2; /* full duplex mode */
|
|
|
|
; else
|
|
|
|
; mtdx.duplexmode equ 1; /* half duplex mode */
|
|
|
|
; data &equ SpeedMask;
|
|
|
|
; if (data equequ Speed_1000M)
|
|
|
|
; mtdx.line_speed equ 3; /* 1000M */
|
|
|
|
; else if (data equequ Speed_100M)
|
|
|
|
; mtdx.line_speed equ 2; /* 100M */
|
|
|
|
; else
|
|
|
|
; mtdx.line_speed equ 1; /* 10M */
|
|
|
|
; }
|
|
|
|
; else if (mtdx.PHYType equequ Myson981) {
|
|
|
|
; unsigned int data;
|
|
|
|
;
|
|
|
|
; data equ mdio_read(dev, mtdx.phys[0], StatusRegister);
|
|
|
|
;
|
|
|
|
; if (data & SPEED100)
|
|
|
|
; mtdx.line_speed equ 2;
|
|
|
|
; else
|
|
|
|
; mtdx.line_speed equ 1;
|
|
|
|
;
|
|
|
|
; if (data & FULLMODE)
|
|
|
|
; mtdx.duplexmode equ 2;
|
|
|
|
; else
|
|
|
|
; mtdx.duplexmode equ 1;
|
|
|
|
; }
|
|
|
|
; else if (mtdx.PHYType equequ LevelOnePHY) {
|
|
|
|
; unsigned int data;
|
|
|
|
;
|
|
|
|
; data equ mdio_read(dev, mtdx.phys[0], SpecificReg);
|
|
|
|
; if (data & LXT1000_Full)
|
|
|
|
; mtdx.duplexmode equ 2; /* full duplex mode */
|
|
|
|
; else
|
|
|
|
; mtdx.duplexmode equ 1; /* half duplex mode */
|
|
|
|
; data &equ SpeedMask;
|
|
|
|
; if (data equequ LXT1000_1000M)
|
|
|
|
; mtdx.line_speed equ 3; /* 1000M */
|
|
|
|
; else if (data equequ LXT1000_100M)
|
|
|
|
; mtdx.line_speed equ 2; /* 100M */
|
|
|
|
; else
|
|
|
|
; mtdx.line_speed equ 1; /* 10M */
|
|
|
|
; }
|
|
|
|
|
|
|
|
; // chage crvalue
|
|
|
|
; // mtdx.crvalue&equ(~PS10)&(~FD);
|
|
|
|
; mtdx.crvalue &equ (~PS10) & (~FD) & (~PS1000);
|
|
|
|
; if (mtdx.line_speed equequ 1)
|
|
|
|
; mtdx.crvalue |equ PS10;
|
|
|
|
; else if (mtdx.line_speed equequ 3)
|
|
|
|
; mtdx.crvalue |equ PS1000;
|
|
|
|
; if (mtdx.duplexmode equequ 2)
|
|
|
|
; mtdx.crvalue |equ FD;
|
|
|
|
;
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
ret
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; ;;
|
|
|
|
;; Transmit ;;
|
|
|
|
;; ;;
|
|
|
|
;; In: buffer pointer in [esp+4] ;;
|
|
|
|
;; size of buffer in [esp+8] ;;
|
|
|
|
;; pointer to device structure in ebx ;;
|
|
|
|
;; ;;
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
align 4
|
|
|
|
transmit:
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
DEBUGF 1,"Transmitting packet, buffer:%x, size:%u\n",[esp+4],[esp+8]
|
|
|
|
mov eax, [esp+4]
|
|
|
|
DEBUGF 1,"To: %x-%x-%x-%x-%x-%x From: %x-%x-%x-%x-%x-%x Type:%x%x\n",\
|
|
|
|
[eax+00]:2,[eax+01]:2,[eax+02]:2,[eax+03]:2,[eax+04]:2,[eax+05]:2,\
|
|
|
|
[eax+06]:2,[eax+07]:2,[eax+08]:2,[eax+09]:2,[eax+10]:2,[eax+11]:2,\
|
|
|
|
[eax+13]:2,[eax+12]:2
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
cmp dword [esp+8], 1514
|
|
|
|
ja .fail
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
mov esi, [device.cur_tx]
|
|
|
|
push [esi + mtd_desc.next_desc_logical]
|
|
|
|
pop [device.cur_tx]
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
; todo: check if descriptor is not owned by the device!
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
mov eax, [esp + 4]
|
|
|
|
mov [esi + mtd_desc.skbuff], eax
|
|
|
|
GetRealAddr
|
|
|
|
mov [esi + mtd_desc.buffer], eax
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
mov eax, [esp + 8]
|
|
|
|
shl eax, PKTSShift ; packet size
|
|
|
|
or eax, TXLD + TXFD + CRCEnable + PADEnable + TXIC + 1536 shl TBSShift ; buffer size
|
|
|
|
mov [esi + mtd_desc.control], eax
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
mov [esi + mtd_desc.status], TXOWN
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
;-------------
|
|
|
|
; Update stats
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
inc [device.packets_tx]
|
|
|
|
mov eax, [esp+8]
|
|
|
|
add dword [device.bytes_tx], eax
|
|
|
|
adc dword [device.bytes_tx + 4], 0
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
; Point to transmit descriptor
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
set_io 0
|
|
|
|
set_io TXLBA
|
|
|
|
mov eax, esi
|
|
|
|
GetRealAddr
|
|
|
|
out dx, eax
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
; set_io TCRRCR
|
|
|
|
; mov eax, [device.crvalue]
|
|
|
|
; out dx, eax
|
|
|
|
|
|
|
|
; Wake the potentially-idle transmit channel.
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
set_io TXPDR ; TX Poll
|
|
|
|
xor eax, eax
|
|
|
|
out dx, eax
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
DEBUGF 1,"transmit ok\n"
|
|
|
|
xor eax, eax
|
|
|
|
ret 8
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
.fail:
|
2012-04-02 20:49:13 +02:00
|
|
|
DEBUGF 1,"transmit failed\n"
|
|
|
|
or eax, -1
|
|
|
|
stdcall KernelFree, [esp + 4]
|
|
|
|
ret 8
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
read_mac:
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
set_io 0
|
|
|
|
set_io PAR0
|
|
|
|
lea edi, [device.mac]
|
|
|
|
insd
|
|
|
|
stosd
|
|
|
|
set_io PAR1
|
|
|
|
insw
|
|
|
|
stosw
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
DEBUGF 1,"MAC = %x-%x-%x-%x-%x-%x\n",\
|
|
|
|
[device.mac+0]:2,[device.mac+1]:2,[device.mac+2]:2,[device.mac+3]:2,[device.mac+4]:2,[device.mac+5]:2
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
ret
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
align 4
|
|
|
|
write_mac:
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
ret
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; ;;
|
|
|
|
;; Interrupt handler ;;
|
|
|
|
;; ;;
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
align 4
|
|
|
|
int_handler:
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
DEBUGF 1,"\nIRQ %x\n",eax:2 ; no, you cant replace 'eax:2' with 'al', this must be a bug in FDO
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
; find pointer of device wich made IRQ occur
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
mov ecx, [devices]
|
|
|
|
test ecx, ecx
|
|
|
|
jz .fail
|
|
|
|
mov esi, device_list
|
2010-08-07 23:04:24 +02:00
|
|
|
.nextdevice:
|
2012-04-02 20:49:13 +02:00
|
|
|
mov ebx, dword [esi]
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
set_io 0
|
|
|
|
set_io ISR
|
|
|
|
in eax, dx
|
|
|
|
out dx , eax ; send it back to ACK
|
2010-08-07 23:04:24 +02:00
|
|
|
; and eax, ; int mask
|
2012-04-02 20:49:13 +02:00
|
|
|
test eax, eax
|
|
|
|
jnz .got_it
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
.continue:
|
2012-04-02 20:49:13 +02:00
|
|
|
add esi, 4
|
|
|
|
dec ecx
|
|
|
|
jnz .nextdevice
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
ret ; If no device was found, abort (The irq was probably for a device, not registered to this driver)
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
.got_it:
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
DEBUGF 1,"Status=%x\n", eax
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
test ax, RI ; receive interrupt
|
|
|
|
jz .no_rx
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
DEBUGF 1,"Receive interrupt\n"
|
2010-08-07 23:04:24 +02:00
|
|
|
.rx:
|
2012-04-02 20:49:13 +02:00
|
|
|
push ax
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
.rx_loop:
|
2012-04-02 20:49:13 +02:00
|
|
|
mov esi, [device.cur_rx]
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
test [esi + mtd_desc.status], RXOWN
|
|
|
|
jnz .fail_rx
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
push .rx_complete
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
mov ecx, [esi + mtd_desc.status]
|
|
|
|
shr ecx, FLNGShift
|
|
|
|
sub ecx, 4 ; we dont need CRC
|
|
|
|
push ecx
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
;-------------
|
|
|
|
; Update stats
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
add dword [device.bytes_rx], ecx
|
|
|
|
adc dword [device.bytes_rx + 4], 0
|
|
|
|
inc dword [device.packets_rx]
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
push [esi + mtd_desc.skbuff]
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
jmp EthReceiver
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
.rx_complete:
|
2012-04-02 20:49:13 +02:00
|
|
|
mov esi, [device.cur_rx]
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
mov [esi + mtd_desc.control], 1536 shl RBSShift
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
stdcall KernelAlloc, 1536
|
|
|
|
mov [esi + mtd_desc.skbuff], eax
|
|
|
|
call GetPgAddr
|
|
|
|
mov [esi + mtd_desc.buffer], eax
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
mov [esi + mtd_desc.status], RXOWN
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
mov eax, [esi + mtd_desc.next_desc_logical]
|
|
|
|
mov [device.cur_rx], eax
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
jmp .rx_loop
|
2010-08-07 23:04:24 +02:00
|
|
|
;
|
|
|
|
; while( ( mtdx.cur_rx->status & RXOWN ) == 0 )
|
|
|
|
; {
|
|
|
|
; mtdx.cur_rx->status = RXOWN;
|
|
|
|
; mtdx.cur_rx = mtdx.cur_rx->next_desc_logical;
|
|
|
|
; }
|
|
|
|
;
|
|
|
|
; /* Restart Rx engine if stopped. */
|
|
|
|
; outl(0, mtdx.ioaddr + RXPDR);
|
|
|
|
|
|
|
|
.fail_rx:
|
2012-04-02 20:49:13 +02:00
|
|
|
DEBUGF 1,"RX failed\n"
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
pop ax
|
2010-08-07 23:04:24 +02:00
|
|
|
.no_rx:
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
test ax, TI ; transmit interrupt
|
|
|
|
jz .no_tx
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
DEBUGF 1,"Transmit interrupt\n"
|
|
|
|
push ax
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
lea esi, [device.tx_desc]
|
|
|
|
mov ecx, NUM_TX_DESC
|
2010-08-07 23:04:24 +02:00
|
|
|
.tx_loop:
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
test [esi + mtd_desc.status], TXOWN
|
|
|
|
jnz .skip_this_one
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
mov eax, [esi + mtd_desc.skbuff]
|
|
|
|
test eax, eax
|
|
|
|
je .skip_this_one
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
mov [esi + mtd_desc.skbuff], 0
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
DEBUGF 1,"freeing buffer:%x\n", eax
|
|
|
|
stdcall KernelFree, eax
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
.skip_this_one:
|
2012-04-02 20:49:13 +02:00
|
|
|
mov esi, [esi + mtd_desc.next_desc_logical]
|
|
|
|
loop .tx_loop
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
pop ax
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
.no_tx:
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
test ax, TBU
|
|
|
|
jz .no_tbu
|
2010-08-07 23:04:24 +02:00
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
DEBUGF 1,"Transmit buffer unavailable!\n"
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
.no_tbu:
|
|
|
|
|
|
|
|
.fail:
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
ret
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
; End of code
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
align 4 ; Place all initialised data here
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
devices dd 0
|
|
|
|
version dd (DRIVER_VERSION shl 16) or (API_VERSION and 0xFFFF)
|
2012-04-02 20:49:13 +02:00
|
|
|
my_service db 'mtd80x',0 ; max 16 chars include zero
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
|
|
|
|
; 0x1516, 0x0800, "MTD800", "Myson MTD800"
|
|
|
|
; 0x1516, 0x0803, "MTD803", "Surecom EP-320X"
|
|
|
|
; 0x1516, 0x0891, "MTD891", "Myson MTD891"
|
|
|
|
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
include_debug_strings ; All data wich FDO uses will be included here
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
section '.data' data readable writable align 16 ; place all uninitialized data place here
|
|
|
|
|
2012-04-02 20:49:13 +02:00
|
|
|
device_list rd MAX_DEVICES ; This list contains all pointers to device structures the driver is handling
|
2010-08-07 23:04:24 +02:00
|
|
|
|
|
|
|
|