make mmio_pci_addr compile-time var, disable all the code by default

git-svn-id: svn://kolibrios.org@1354 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Evgeny Grechnikov (Diamond) 2010-01-03 23:39:15 +00:00
parent 10f720429e
commit 75ee22d259
2 changed files with 8 additions and 8 deletions

View File

@ -74,13 +74,14 @@ pci_fn_3:
cmp al,10 cmp al,10
jz pci_write_reg ;dword jz pci_write_reg ;dword
if defined mmio_pci_addr
cmp al,11 ; <<< user-level MMIO functions <<< NEW! cmp al,11 ; <<< user-level MMIO functions <<< NEW!
jz pci_mmio_init jz pci_mmio_init
cmp al,12 cmp al,12
jz pci_mmio_map jz pci_mmio_map
cmp al,13 cmp al,13
jz pci_mmio_unmap jz pci_mmio_unmap
end if
no_pci_access_for_applications: no_pci_access_for_applications:
@ -374,6 +375,7 @@ pci_write_reg_err:
dec eax dec eax
ret ret
if defined mmio_pci_addr
;*************************************************************************** ;***************************************************************************
; Function ; Function
; pci_mmio_init ; NEW! ; pci_mmio_init ; NEW!
@ -386,9 +388,8 @@ pci_write_reg_err:
; eax = -2 : device not registered for uMMIO service ; eax = -2 : device not registered for uMMIO service
; eax = -3 : user heap initialization failure ; eax = -3 : user heap initialization failure
;*************************************************************************** ;***************************************************************************
align 4
pci_mmio_init: pci_mmio_init:
cmp bx, word [mmio_pci_addr] ; must be set in kernel/data32.inc cmp bx, mmio_pci_addr ; must be set in kernel/data32.inc
jz @f jz @f
mov eax,-2 mov eax,-2
ret ret
@ -427,7 +428,6 @@ pci_mmio_init:
; eax = -5 : dynamic userspace allocation problem ; eax = -5 : dynamic userspace allocation problem
;*************************************************************************** ;***************************************************************************
align 4
pci_mmio_map: pci_mmio_map:
and edx,0x0ffff and edx,0x0ffff
cmp ah,6 cmp ah,6
@ -446,7 +446,7 @@ pci_mmio_map:
shl bl, 1 shl bl, 1
shl bl, 1 shl bl, 1
add bl, 0x10 ; now bl = BAR offset in PCI config. space add bl, 0x10 ; now bl = BAR offset in PCI config. space
mov ax,word [mmio_pci_addr] mov ax, mmio_pci_addr
mov bh, al ; bh = dddddfff mov bh, al ; bh = dddddfff
mov al, 2 ; al : DW to read mov al, 2 ; al : DW to read
call pci_read_reg call pci_read_reg
@ -504,11 +504,11 @@ mmio_map_over:
; eax = 0 if unmapping failed ; eax = 0 if unmapping failed
;*************************************************************************** ;***************************************************************************
align 4
pci_mmio_unmap: pci_mmio_unmap:
stdcall user_free, ebx stdcall user_free, ebx
ret ret
end if
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

View File

@ -7,6 +7,8 @@
$Revision$ $Revision$
;mmio_pci_addr = -1; set actual PCI address (word) here to activate user-MMIO
keymap: keymap:
db '6',27 db '6',27
@ -463,6 +465,4 @@ BiosDisksData rb 200h
BiosDiskCaches rb 80h*(cache_ide1-cache_ide0) BiosDiskCaches rb 80h*(cache_ide1-cache_ide0)
BiosDiskPartitions rd 80h BiosDiskPartitions rd 80h
mmio_pci_addr dw -1; set actual PCI address here to activate user-MMIO
IncludeUGlobals IncludeUGlobals