Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 3205 → Rev 3204

/kernel/branches/net/drivers/dec21x4x.asm
57,10 → 57,9
.rx_crt_des dd ? ; Rx current descriptor
 
.io_addr dd ?
.pci_bus dd ?
.pci_dev dd ?
.pci_bus db ?
.pci_dev db ?
.irq_line db ?
rb 3 ; alignment
 
.size = $ - device
 
385,11 → 384,8
mov ax , [eax+1] ;
.nextdevice:
mov ebx, [esi]
cmp al, byte[device.pci_bus]
jne @f
cmp ah, byte[device.pci_dev]
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
 
418,18 → 414,18
; save the pci bus and device numbers
 
mov eax, [IOCTL.input]
movzx ecx, byte[eax+1]
mov [device.pci_bus], ecx
movzx ecx, byte[eax+2]
mov [device.pci_dev], ecx
mov cl, [eax+1]
mov [device.pci_bus], cl
mov cl, [eax+2]
mov [device.pci_dev], cl
 
; Now, it's time to find the base io addres of the PCI device
 
PCI_find_io
find_io [device.pci_bus], [device.pci_dev], [device.io_addr]
 
; We've found the io address, find IRQ now
 
PCI_find_irq
find_irq [device.pci_bus], [device.pci_dev], [device.irq_line]
 
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
529,9 → 525,11
 
DEBUGF 2,"Probing dec21x4x device: "
 
PCI_make_bus_master
make_bus_master [device.pci_bus], [device.pci_dev]
 
stdcall PciRead32, [device.pci_bus], [device.pci_dev], 0 ; get device/vendor id
movzx eax, [device.pci_bus]
movzx ecx, [device.pci_dev]
stdcall PciRead32, eax ,ecx ,0 ; get device/vendor id
DEBUGF 1,"Vendor id: 0x%x\n", ax
 
cmp ax, 0x1011
554,8 → 552,10
 
; wake up the 21143
 
movzx ecx, [device.pci_bus]
movzx edx, [device.pci_dev]
xor eax, eax
stdcall PciWrite32, [device.pci_bus], [device.pci_dev], 0x40, eax
stdcall PciWrite32, ecx, edx, 0x40, eax
 
 
.supported_device:
/kernel/branches/net/drivers/bus/pci.inc
40,14 → 40,18
PCI_BIT_MASTER = 4 ; bit2: device acts as a PCI master
 
 
macro PCI_find_io {
macro find_io bus, dev, io {
 
local .check, .inc, .got
 
xor eax, eax
mov esi, PCI_BASE_ADDRESS_0
movzx ecx, bus
movzx edx, dev
.check:
stdcall PciRead32, [device.pci_bus], [device.pci_dev], esi
push ecx edx
stdcall PciRead32, ecx ,edx ,esi
pop edx ecx
 
test eax, PCI_BASE_ADDRESS_IO_MASK
jz .inc
65,18 → 69,18
xor eax, eax
 
.got:
mov [device.io_addr], eax
mov io, eax
 
}
 
 
macro PCI_find_mmio32 {
macro find_mmio32 bus, dev, io {
 
local .check, .inc, .got
 
mov esi, PCI_BASE_ADDRESS_0
.check:
stdcall PciRead32, [device.pci_bus], [device.pci_dev], esi
stdcall PciRead32, bus, dev, esi
 
test eax, PCI_BASE_ADDRESS_SPACE_IO ; mmio address?
jnz .inc
93,40 → 97,54
xor eax, eax
 
.got:
mov [device.mmio_addr], eax
mov io, eax
}
 
macro PCI_find_irq {
macro find_irq bus, dev, irq {
 
stdcall PciRead8, [device.pci_bus], [device.pci_dev], PCI_REG_IRQ
mov [device.irq_line], al
push eax edx ecx
movzx ecx, bus
movzx edx, dev
stdcall PciRead8, ecx, edx, PCI_REG_IRQ
mov irq, al
pop ecx edx eax
 
}
 
macro PCI_find_rev {
macro find_rev bus, dev, rev {
 
stdcall PciRead8, [device.pci_bus], [device.pci_dev], PCI_REVISION_ID
mov [device.revision], al
push eax edx ecx
movzx ecx, bus
movzx edx, dev
stdcall PciRead8, ecx ,edx ,0x8
mov rev, al
pop ecx edx eax
 
}
 
macro PCI_make_bus_master bus, dev {
macro make_bus_master bus, dev {
 
stdcall PciRead32, [device.pci_bus], [device.pci_dev], PCI_REG_COMMAND
movzx ecx, bus
movzx edx, dev
push ecx edx
stdcall PciRead32, ecx ,edx, PCI_REG_COMMAND
pop edx ecx
or al, PCI_BIT_MASTER
stdcall PciWrite32, [device.pci_bus], [device.pci_dev], PCI_REG_COMMAND, eax
stdcall PciWrite32, ecx, edx, PCI_REG_COMMAND, eax
 
}
 
macro PCI_adjust_latency min {
macro adjust_latency bus, dev, min {
 
local .not
 
stdcall PciRead8, [device.pci_bus], [device.pci_dev], PCI_REG_LATENCY
movzx ecx, bus
movzx edx, dev
push ecx edx
stdcall PciRead8, ecx ,edx, PCI_REG_LATENCY
pop edx ecx
cmp al, min
ja .not
ja @f
mov al, min
stdcall PciWrite8, [device.pci_bus], [device.pci_dev], PCI_REG_LATENCY, eax
.not:
stdcall PciWrite8, ecx, edx, PCI_REG_LATENCY, eax
@@:
 
}
/kernel/branches/net/drivers/pcnet32.asm
316,8 → 316,8
 
.io_addr dd ?
.irq_line db ?
.pci_bus dd ?
.pci_dev dd ?
.pci_bus db ?
.pci_dev db ?
 
.read_csr dd ?
.write_csr dd ?
426,11 → 426,8
mov ax , [eax+1] ;
.nextdevice:
mov ebx, [esi]
cmp al, byte[device.pci_bus]
jne @f
cmp ah, byte[device.pci_dev]
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
 
454,18 → 451,18
; save the pci bus and device numbers
 
mov eax, [IOCTL.input]
movzx ecx, byte[eax+1]
mov [device.pci_bus], ecx
movzx ecx, byte[eax+2]
mov [device.pci_dev], ecx
mov cl, [eax+1]
mov [device.pci_bus], cl
mov cl, [eax+2]
mov [device.pci_dev], cl
 
; Now, it's time to find the base io addres of the PCI device
 
PCI_find_io
find_io [device.pci_bus], [device.pci_dev], [device.io_addr]
 
; We've found the io address, find IRQ now
 
PCI_find_irq
find_irq [device.pci_bus], [device.pci_dev], [device.irq_line]
 
DEBUGF 1,"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]:4
700,7 → 697,7
mov [device.ltint],1
.L11:
 
PCI_make_bus_master
make_bus_master [device.pci_bus], [device.pci_dev]
 
mov [device.options], PORT_ASEL
mov [device.mode_], MODE_RXD + MODE_TXD ; disable receive and transmit
/kernel/branches/net/drivers/RTL8029.asm
40,8 → 40,8
 
.io_addr dd ?
.irq_line db ?
.pci_bus dd ?
.pci_dev dd ?
.pci_bus db ?
.pci_dev db ?
 
.flags db ?
.vendor db ?
238,11 → 238,8
mov ax, [eax+1] ; get the pci bus and device numbers
.nextdevice:
mov ebx, [esi]
cmp al, byte[device.pci_bus]
jne @f
cmp ah, byte[device.pci_dev]
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
 
250,18 → 247,18
call create_new_struct
 
mov eax, [IOCTL.input]
movzx ecx, byte[eax+1]
mov [device.pci_bus], ecx
movzx ecx, byte[eax+2]
mov [device.pci_dev], ecx
mov cl, [eax+1]
mov [device.pci_bus], cl
mov cl, [eax+2]
mov [device.pci_dev], cl
 
; Now, it's time to find the base io addres of the PCI device
 
PCI_find_io
find_io [device.pci_bus], [device.pci_dev], [device.io_addr]
 
; We've found the io address, find IRQ now
 
PCI_find_irq
find_irq [device.pci_bus], [device.pci_dev], [device.irq_line]
 
jmp .hook
 
/kernel/branches/net/drivers/3c59x.asm
342,10 → 342,9
.prev_dpd dd ?
 
.io_addr dd ?
.pci_bus dd ?
.pci_dev dd ?
.pci_bus db ?
.pci_dev db ?
.irq_line db ?
rb 3 ; alignment
 
.prev_tx_frame dd ?
.ver_id db ?
439,11 → 438,8
mov ax , [eax+1] ;
.nextdevice:
mov ebx, [esi]
cmp al, byte[device.pci_bus]
jne @f
cmp ah, byte[device.pci_dev]
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
 
458,11 → 454,8
mov ax , [eax+1] ;
.nextdevice2:
mov ebx, [esi]
cmp al, byte[device.pci_bus]
jne @f
cmp ah, byte[device.pci_dev]
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 .nextdevice2
 
488,16 → 481,16
; save the pci bus and device numbers
 
mov eax, [IOCTL.input]
movzx ecx, byte[eax+1]
mov [device.pci_bus], ecx
movzx ecx, byte[eax+2]
mov [device.pci_dev], ecx
mov cl , [eax+1]
mov [device.pci_bus], cl
mov cl , [eax+2]
mov [device.pci_dev], cl
 
; Now, it's time to find the base io addres of the PCI device
PCI_find_io
find_io [device.pci_bus], [device.pci_dev], [device.io_addr]
 
; We've found the io address, find IRQ now
PCI_find_irq
find_irq [device.pci_bus], [device.pci_dev], [device.irq_line]
 
DEBUGF 1,"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]:4
585,12 → 578,14
 
DEBUGF 1,"Probing 3com card\n"
 
PCI_make_bus_master
make_bus_master [device.pci_bus], [device.pci_dev]
 
; wake up the card
call wake_up
 
stdcall PciRead32, [device.pci_bus], [device.pci_dev], 0 ; get device/vendor id
movzx ecx, [device.pci_bus]
movzx edx, [device.pci_dev]
stdcall PciRead32, ecx ,edx ,0 ; get device/vendor id
 
DEBUGF 1,"Vendor id: 0x%x\n", ax
 
623,7 → 618,9
jz .not_vortex
 
mov eax, 11111000b ; 248 = max latency
stdcall PciWrite32, [device.pci_bus], [device.pci_dev], PCI_REG_LATENCY, eax
movzx ecx, [device.pci_bus]
movzx edx, [device.pci_dev]
stdcall PciWrite32, ecx, edx, PCI_REG_LATENCY, eax
 
.not_vortex:
; set RX/TX functions
1806,13 → 1803,15
 
; wake up - we directly do it by programming PCI
; check if the device is power management capable
stdcall PciRead32, [device.pci_bus], [device.pci_dev], PCI_REG_STATUS
movzx ecx, [device.pci_bus]
movzx edx, [device.pci_dev]
stdcall PciRead32, ecx, edx, PCI_REG_STATUS
 
test al, 10000b ; is there "new capabilities" linked list?
jz .device_awake
 
; search for power management register
stdcall PciRead16, [device.pci_bus], [device.pci_dev], PCI_REG_CAP_PTR
stdcall PciRead16, ecx, edx, PCI_REG_CAP_PTR
cmp al, 0x3f
jbe .device_awake
 
1819,7 → 1818,7
; traverse the list
movzx esi, al
.pm_loop:
stdcall PciRead32, [device.pci_bus], [device.pci_dev], esi
stdcall PciRead32, ecx, edx, esi
 
cmp al , 1
je .set_pm_state
1834,11 → 1833,11
.set_pm_state:
 
add esi, PCI_REG_PM_CTRL
stdcall PciRead32, [device.pci_bus], [device.pci_dev], esi
stdcall PciRead32, ecx, edx, esi
test al, 3
jz .device_awake
and al, not 11b ; set state to D0
stdcall PciWrite32, [device.pci_bus], [device.pci_dev], esi, eax
stdcall PciWrite32, ecx, edx, esi, eax
 
.device_awake:
DEBUGF 1,"Device is awake\n"
/kernel/branches/net/drivers/R6040.asm
192,11 → 192,11
.mcr1 dw ?
.switch_sig dw ?
 
.pci_bus dd ?
.pci_dev dd ?
.pci_bus db ?
.pci_dev db ?
.irq_line db ?
 
rb 3 ; dword alignment
rb 1 ; dword alignment
 
.tx_ring: rb (((x_head.sizeof*TX_RING_SIZE)+32) and 0xfffffff0)
.rx_ring: rb (((x_head.sizeof*RX_RING_SIZE)+32) and 0xfffffff0)
285,11 → 285,8
mov ax , [eax+1] ;
.nextdevice:
mov ebx, [esi]
cmp al, byte[device.pci_bus]
jne @f
cmp ah, byte[device.pci_dev]
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
 
313,18 → 310,18
; save the pci bus and device numbers
 
mov eax, [IOCTL.input]
movzx ecx, byte[eax+1]
mov [device.pci_bus], ecx
movzx ecx, byte[eax+2]
mov [device.pci_dev], ecx
mov cl , [eax+1]
mov [device.pci_bus], cl
mov cl , [eax+2]
mov [device.pci_dev], cl
 
; Now, it's time to find the base io addres of the PCI device
 
PCI_find_io
find_io [device.pci_bus], [device.pci_dev], [device.io_addr]
 
; We've found the io address, find IRQ now
 
PCI_find_irq
find_irq [device.pci_bus], [device.pci_dev], [device.irq_line]
 
DEBUGF 1,"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]:4
419,7 → 416,7
probe:
DEBUGF 2,"Probing R6040 device\n"
 
PCI_make_bus_master
make_bus_master [device.pci_bus], [device.pci_dev]
 
; If PHY status change register is still set to zero
; it means the bootloader didn't initialize it
/kernel/branches/net/drivers/RTL8139.asm
208,8 → 208,8
.io_addr dd ?
 
.curr_tx_desc db ?
.pci_bus dd ?
.pci_dev dd ?
.pci_bus db ?
.pci_dev db ?
.irq_line db ?
.hw_ver_id db ?
 
298,11 → 298,8
mov ax , [eax+1] ; get the pci bus and device numbers
.nextdevice:
mov ebx, [esi]
cmp al, byte[device.pci_bus]
jne @f
cmp ah, byte[device.pci_dev]
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
 
326,18 → 323,18
; save the pci bus and device numbers
 
mov eax, [IOCTL.input]
movzx ecx, byte[eax+1]
mov [device.pci_bus], ecx
movzx ecx, byte[eax+2]
mov [device.pci_dev], ecx
mov cl, [eax+1]
mov [device.pci_bus], cl
mov cl, [eax+2]
mov [device.pci_dev], cl
 
; Now, it's time to find the base io addres of the PCI device
 
PCI_find_io
find_io [device.pci_bus], [device.pci_dev], [device.io_addr]
 
; We've found the io address, find IRQ now
 
PCI_find_irq
find_irq [device.pci_bus], [device.pci_dev], [device.irq_line]
 
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]:4
425,7 → 422,7
probe:
DEBUGF 2, "Probing %s device\n", my_service
 
PCI_make_bus_master
make_bus_master [device.pci_bus], [device.pci_dev]
 
; get chip version
 
/kernel/branches/net/drivers/RTL8169.asm
253,8 → 253,8
ETH_DEVICE
 
.io_addr dd ?
.pci_bus dd ?
.pci_dev dd ?
.pci_bus db ?
.pci_dev db ?
.irq_line db ?
 
rb 256-(($ - device) and 255) ; align 256
442,11 → 442,8
mov ax , [eax+1] ;
.nextdevice:
mov ebx, [esi]
cmp al, byte[device.pci_bus]
jne @f
cmp ah, byte[device.pci_dev]
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
 
470,19 → 467,20
; save the pci bus and device numbers
 
mov eax, [IOCTL.input]
movzx ecx, byte[eax+1]
mov [device.pci_bus], ecx
movzx ecx, byte[eax+2]
mov [device.pci_dev], ecx
mov cl , [eax+1]
mov [device.pci_bus], cl
mov cl , [eax+2]
mov [device.pci_dev], cl
 
; Now, it's time to find the base io addres of the PCI device
 
PCI_find_io
mov [tpc.mmio_addr], eax ; CHECKME
find_io [device.pci_bus], [device.pci_dev], [device.io_addr]
mov eax, [device.io_addr]
mov [tpc.mmio_addr], eax
 
; We've found the io address, find IRQ now
 
PCI_find_irq
find_irq [device.pci_bus], [device.pci_dev], [device.irq_line]
 
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
544,7 → 542,7
 
DEBUGF 1,"init_board\n"
 
PCI_make_bus_master
make_bus_master [device.pci_bus], [device.pci_dev]
 
; Soft reset the chip
set_io 0
/kernel/branches/net/drivers/i8254x.asm
389,7 → 389,7
 
; Now, it's time to find the base mmio addres of the PCI device
 
PCI_find_mmio32
find_mmio32 [device.pci_bus], [device.pci_dev], [device.mmio_addr]
 
; Create virtual mapping of the physical memory
 
401,7 → 401,7
 
; We've found the mmio address, find IRQ now
 
PCI_find_irq
find_irq byte [device.pci_bus], byte [device.pci_dev], [device.irq_line]
 
DEBUGF 1,"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.mmio_addr]:8
484,7 → 484,7
 
DEBUGF 1,"Probe\n"
 
PCI_make_bus_master
make_bus_master byte [device.pci_bus], byte [device.pci_dev]
 
; TODO: validate the device
 
/kernel/branches/net/drivers/mtd80x.asm
276,8 → 276,8
.rx_desc rb NUM_RX_DESC*mtd_desc.size
 
.io_addr dd ?
.pci_bus dd ?
.pci_dev dd ?
.pci_bus db ?
.pci_dev db ?
.irq_line db ?
.dev_id dw ?
 
386,11 → 386,8
mov ax , [eax+1] ;
.nextdevice:
mov ebx, [esi]
cmp al, byte[device.pci_bus]
jne @f
cmp ah, byte[device.pci_dev]
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
 
414,18 → 411,18
; save the pci bus and device numbers
 
mov eax, [IOCTL.input]
movzx ecx, byte[eax+1]
mov [device.pci_bus], ecx
movzx ecx, byte[eax+2]
mov [device.pci_dev], ecx
mov cl , [eax+1]
mov [device.pci_bus], cl
mov cl , [eax+2]
mov [device.pci_dev], cl
 
; Now, it's time to find the base io addres of the PCI device
 
PCI_find_io
find_io [device.pci_bus], [device.pci_dev], [device.io_addr]
 
; We've found the io address, find IRQ now
 
PCI_find_irq
find_irq [device.pci_bus], [device.pci_dev], [device.irq_line]
 
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
516,9 → 513,11
 
DEBUGF 2,"Probing mtd80x device\n"
 
PCI_make_bus_master
make_bus_master [device.pci_bus], [device.pci_dev]
 
stdcall PciRead32, [device.pci_bus], [device.pci_dev], 0
movzx eax, [device.pci_bus]
movzx ecx, [device.pci_dev]
stdcall PciRead32, eax ,ecx ,0
 
cmp ax, 0x1516
jne .notfound
/kernel/branches/net/drivers/rhine.asm
489,8 → 489,8
ETH_DEVICE
 
.io_addr dd ?
.pci_dev dd ?
.pci_bus dd ?
.pci_dev db ?
.pci_bus db ?
.revision db ?
.irq_line db ?
.chip_id dw ?
614,11 → 614,8
mov ax , [eax+1] ;
.nextdevice:
mov ebx, [esi]
cmp al, byte[device.pci_bus]
jne @f
cmp ah, byte[device.pci_dev]
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
 
642,18 → 639,18
; save the pci bus and device numbers
 
mov eax, [IOCTL.input]
movzx ecx, byte[eax+1]
mov [device.pci_bus], ecx
movzx ecx, byte[eax+2]
mov [device.pci_dev], ecx
mov cl , [eax+1]
mov [device.pci_bus], cl
mov cl , [eax+2]
mov [device.pci_dev], cl
 
; Now, it's time to find the base io addres of the PCI device
 
PCI_find_io
find_io [device.pci_bus], [device.pci_dev], [device.io_addr]
 
; We've found the io address, find IRQ now
 
PCI_find_irq
find_irq [device.pci_bus], [device.pci_dev], [device.irq_line]
 
DEBUGF 1,"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]:4
721,14 → 718,16
DEBUGF 1, "Probing card at 0x%x\n", eax
 
; make the card a bus master
PCI_make_bus_master
make_bus_master [device.pci_bus], [device.pci_dev]
 
; get device id
stdcall PciRead16, [device.pci_bus], [device.pci_dev], PCI_DEVICE_ID
movzx ecx, [device.pci_bus]
movzx edx, [device.pci_dev]
stdcall PciRead16, ecx, edx, PCI_DEVICE_ID
mov [device.chip_id], ax
 
; get revision id.
PCI_find_rev
find_rev [device.pci_bus], [device.pci_dev], [device.revision]
 
movzx eax, [device.revision]
DEBUGF 1, "Card revision = 0x%x\n", eax
809,9 → 808,11
out dx, al
 
; turn on bit2 in PCI configuration register 0x53 , only for 3065
stdcall PciRead8, [device.pci_bus], [device.pci_dev], PCI_REG_MODE3
movzx ecx, [device.pci_bus]
movzx edx, [device.pci_dev]
stdcall PciRead8, ecx, edx, PCI_REG_MODE3
or al, MODE3_MIION
stdcall PciWrite8, [device.pci_bus], [device.pci_dev], PCI_REG_MODE3, eax
stdcall PciWrite8, ecx, edx, PCI_REG_MODE3, eax
.not_vt3065:
 
; back off algorithm, disable the right-most 4-bit off CFGD
/kernel/branches/net/drivers/sis900.asm
213,8 → 213,8
ETH_DEVICE
 
.io_addr dd ?
.pci_bus dd ?
.pci_dev dd ?
.pci_bus db ?
.pci_dev db ?
.irq_line db ?
.cur_rx db ?
.cur_tx db ?
221,7 → 221,6
.last_tx db ?
.pci_revision db ?
.table_entries db ?
rb 2 ; alignment
 
.txd rd (4 * NUM_TX_DESC)
.rxd rd (4 * NUM_RX_DESC)
306,11 → 305,8
mov ax, [eax+1] ;
.nextdevice:
mov ebx, [esi]
cmp al, byte[device.pci_bus]
jne @f
cmp ah, byte[device.pci_dev]
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
; 4e. This device doesn't have its own eth_device structure yet, let's create one
323,10 → 319,10
allocate_and_clear ebx, device.size, .fail
; 4i. Save PCI coordinates
mov eax, [IOCTL.input]
movzx ecx, byte[eax+1]
mov [device.pci_bus], ecx
movzx ecx, byte[eax+2]
mov [device.pci_dev], ecx
mov cl, [eax+1]
mov [device.pci_bus], cl
mov cl, [eax+2]
mov [device.pci_dev], cl
; 4j. Fill in the direct call addresses into the struct.
; Note that get_MAC pointer is filled in initialization by probe.
mov [device.reset], reset
339,10 → 335,10
; TODO: implement check if bus and dev exist on this machine
 
; Now, it's time to find the base io addres of the PCI device
PCI_find_io
find_io [device.pci_bus], [device.pci_dev], [device.io_addr]
 
; We've found the io address, find IRQ now
PCI_find_irq
find_irq [device.pci_bus], [device.pci_dev], [device.irq_line]
 
; 4m. Add new device to the list (required for int_handler).
mov eax, [devices]
418,14 → 414,17
DEBUGF 1, "Probe\n"
 
; wake up device CHECKME
stdcall PciWrite8, [device.pci_bus], [device.pci_dev], 0x40, 0
movzx eax, [device.pci_bus]
movzx edx, [device.pci_dev]
stdcall PciWrite8, eax, edx, 0x40, 0
 
PCI_make_bus_master
make_bus_master [device.pci_bus], [device.pci_dev]
adjust_latency [device.pci_bus], [device.pci_dev], 64
 
PCI_adjust_latency 64
 
; Get Card Revision
stdcall PciRead8, [device.pci_bus], [device.pci_dev], 0x08
movzx eax, [device.pci_bus]
movzx edx, [device.pci_dev]
stdcall PciRead8, eax, edx, 0x08
mov [device.pci_revision], al ; save the revision for later use
 
; Look up through the specific_table