forked from KolibriOS/kolibrios
Net-branch: another work in progress: dec21x4x driver.
Only works in MS Virtual-PC for now. (not on real hardware yet) git-svn-id: svn://kolibrios.org@1502 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
e454817cbc
commit
ba3fb040e1
1467
kernel/branches/net/drivers/dec21x4x.asm
Normal file
1467
kernel/branches/net/drivers/dec21x4x.asm
Normal file
File diff suppressed because it is too large
Load Diff
@ -15,9 +15,9 @@
|
|||||||
PCI_REG_CAPABILITY_ID equ 0x0 ; capapility ID in pm register block
|
PCI_REG_CAPABILITY_ID equ 0x0 ; capapility ID in pm register block
|
||||||
PCI_REG_PM_STATUS equ 0x4 ; power management status register
|
PCI_REG_PM_STATUS equ 0x4 ; power management status register
|
||||||
PCI_REG_PM_CTRL equ 0x4 ; power management control register
|
PCI_REG_PM_CTRL equ 0x4 ; power management control register
|
||||||
PCI_BIT_PIO equ 0 ; bit0: io space control
|
PCI_BIT_PIO equ 1 ; bit0: io space control
|
||||||
PCI_BIT_MMIO equ 1 ; bit1: memory space control
|
PCI_BIT_MMIO equ 2 ; bit1: memory space control
|
||||||
PCI_BIT_MASTER equ 2 ; bit2: device acts as a PCI master
|
PCI_BIT_MASTER equ 4 ; bit2: device acts as a PCI master
|
||||||
|
|
||||||
|
|
||||||
PAGESIZE equ 4096
|
PAGESIZE equ 4096
|
||||||
@ -66,7 +66,6 @@ macro allocate_and_clear dest, size, err {
|
|||||||
end if
|
end if
|
||||||
|
|
||||||
; Clear the allocated buffer
|
; Clear the allocated buffer
|
||||||
;mov edi, eax
|
|
||||||
mov ecx, size/4 ; divide by 4 because of DWORD
|
mov ecx, size/4 ; divide by 4 because of DWORD
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
rep stosd
|
rep stosd
|
||||||
@ -77,28 +76,21 @@ macro allocate_and_clear dest, size, err {
|
|||||||
|
|
||||||
macro find_io bus, dev, io {
|
macro find_io bus, dev, io {
|
||||||
|
|
||||||
|
|
||||||
local .check, .inc, .got
|
local .check, .inc, .got
|
||||||
|
|
||||||
|
|
||||||
xor eax, eax
|
xor eax, eax
|
||||||
mov esi, PCI_BASE_ADDRESS_0
|
mov esi, PCI_BASE_ADDRESS_0
|
||||||
movzx ecx, bus
|
movzx ecx, bus
|
||||||
movzx edx, dev
|
movzx edx, dev
|
||||||
.check:
|
.check:
|
||||||
stdcall PciRead16, ecx ,edx ,esi
|
stdcall PciRead32, ecx ,edx ,esi
|
||||||
|
|
||||||
mov io , eax
|
test eax, PCI_BASE_ADDRESS_IO_MASK
|
||||||
and eax, PCI_BASE_ADDRESS_IO_MASK
|
|
||||||
test eax, eax
|
|
||||||
jz .inc
|
jz .inc
|
||||||
|
|
||||||
mov eax, io
|
test eax, PCI_BASE_ADDRESS_SPACE_IO
|
||||||
and eax, PCI_BASE_ADDRESS_SPACE_IO
|
|
||||||
test eax, eax
|
|
||||||
jz .inc
|
jz .inc
|
||||||
|
|
||||||
mov eax, io
|
|
||||||
and eax, PCI_BASE_ADDRESS_IO_MASK
|
and eax, PCI_BASE_ADDRESS_IO_MASK
|
||||||
mov io , eax
|
mov io , eax
|
||||||
jmp .got
|
jmp .got
|
||||||
@ -106,7 +98,7 @@ macro find_io bus, dev, io {
|
|||||||
.inc:
|
.inc:
|
||||||
add esi, 4
|
add esi, 4
|
||||||
cmp esi, PCI_BASE_ADDRESS_5
|
cmp esi, PCI_BASE_ADDRESS_5
|
||||||
jbe .check
|
jle .check
|
||||||
|
|
||||||
.got:
|
.got:
|
||||||
|
|
||||||
@ -124,6 +116,18 @@ macro find_irq bus, dev, irq {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
macro find_rev bus, dev, rev {
|
||||||
|
|
||||||
|
push eax edx ecx
|
||||||
|
movzx ecx, bus
|
||||||
|
movzx edx, dev
|
||||||
|
stdcall PciRead8, ecx ,edx ,0x8
|
||||||
|
mov rev, al
|
||||||
|
pop ecx edx eax
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
macro make_bus_master bus, dev {
|
macro make_bus_master bus, dev {
|
||||||
|
|
||||||
@ -131,14 +135,12 @@ macro make_bus_master bus, dev {
|
|||||||
movzx edx, dev
|
movzx edx, dev
|
||||||
stdcall PciRead32, ecx ,edx, PCI_REG_COMMAND
|
stdcall PciRead32, ecx ,edx, PCI_REG_COMMAND
|
||||||
|
|
||||||
or al, (1 shl PCI_BIT_MASTER) or (1 shl PCI_BIT_PIO)
|
or al, PCI_BIT_MASTER or PCI_BIT_PIO
|
||||||
and al, not (1 shl PCI_BIT_MMIO)
|
and al, not PCI_BIT_MMIO
|
||||||
stdcall PciWrite32, ecx, edx, PCI_REG_COMMAND, eax
|
stdcall PciWrite32, ecx, edx, PCI_REG_COMMAND, eax
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
struc IOCTL {
|
struc IOCTL {
|
||||||
.handle dd ?
|
.handle dd ?
|
||||||
.io_code dd ?
|
.io_code dd ?
|
||||||
@ -197,3 +199,32 @@ macro ETH_DEVICE {
|
|||||||
.mac dp ?
|
.mac dp ?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
macro SLIP_DEVICE {
|
||||||
|
; pointers to procedures
|
||||||
|
.unload dd ?
|
||||||
|
.reset dd ?
|
||||||
|
.transmit dd ?
|
||||||
|
.set_mode dd ?
|
||||||
|
.get_mode dd ?
|
||||||
|
; status
|
||||||
|
.bytes_tx dq ?
|
||||||
|
.bytes_rx dq ?
|
||||||
|
.packets_tx dd ?
|
||||||
|
.packets_rx dd ?
|
||||||
|
.mode dd ?
|
||||||
|
.name dd ?
|
||||||
|
}
|
||||||
|
|
||||||
|
macro GetRealAddr {
|
||||||
|
|
||||||
|
push eax
|
||||||
|
call GetPgAddr
|
||||||
|
and dword [esp], (PAGESIZE - 1)
|
||||||
|
add eax, dword [esp]
|
||||||
|
add esp, 4
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user