forked from KolibriOS/kolibrios
kernel: map_io_mem
git-svn-id: svn://kolibrios.org@741 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
2c7785b277
commit
a24875d50b
@ -33,6 +33,7 @@ iglobal
|
||||
szGetPgAddr db 'GetPgAddr',0
|
||||
szMapPage db 'MapPage',0
|
||||
szMapSpace db 'MapSpace',0
|
||||
szMapIoMem db 'MapIoMem',0
|
||||
szCommitPages db 'CommitPages',0
|
||||
szReleasePages db 'ReleasePages',0
|
||||
|
||||
@ -101,6 +102,7 @@ kernel_export:
|
||||
dd szFreePage , free_page
|
||||
dd szMapPage , map_page ;stdcall
|
||||
dd szMapSpace , map_space
|
||||
dd szMapIoMem , map_io_mem ;stdcall
|
||||
dd szGetPgAddr , get_pg_addr
|
||||
dd szCommitPages , commit_pages ;not implemented
|
||||
dd szReleasePages , release_pages
|
||||
|
@ -143,6 +143,45 @@ proc free_page
|
||||
ret
|
||||
endp
|
||||
|
||||
proc map_io_mem stdcall, base:dword, size:dword, flags:dword
|
||||
|
||||
push ebx
|
||||
push edi
|
||||
mov eax, [size]
|
||||
add eax, 4095
|
||||
and eax, -4096
|
||||
mov [size], eax
|
||||
stdcall alloc_kernel_space, eax
|
||||
test eax, eax
|
||||
jz .fail
|
||||
push eax
|
||||
|
||||
mov edi, 0x1000
|
||||
mov ebx, eax
|
||||
mov ecx,[size]
|
||||
mov edx, [base]
|
||||
shr eax, 12
|
||||
shr ecx, 12
|
||||
and edx, -4096
|
||||
or edx, [flags]
|
||||
@@:
|
||||
mov [page_tabs+eax*4], edx
|
||||
invlpg [ebx]
|
||||
inc eax
|
||||
add ebx, edi
|
||||
add edx, edi
|
||||
loop @B
|
||||
|
||||
pop eax
|
||||
mov edx, [base]
|
||||
and edx, 4095
|
||||
add eax, edx
|
||||
.fail:
|
||||
pop edi
|
||||
pop ebx
|
||||
ret
|
||||
endp
|
||||
|
||||
; param
|
||||
; eax= page base + page flags
|
||||
; ebx= liear address
|
||||
@ -150,7 +189,7 @@ endp
|
||||
|
||||
align 4
|
||||
commit_pages:
|
||||
|
||||
push edi
|
||||
test ecx, ecx
|
||||
jz .fail
|
||||
|
||||
@ -171,6 +210,7 @@ commit_pages:
|
||||
jnz @B
|
||||
mov [pg_data.pg_mutex],ecx
|
||||
.fail:
|
||||
pop edi
|
||||
ret
|
||||
|
||||
|
||||
|
@ -275,6 +275,7 @@ __exports:
|
||||
free_kernel_space, 'FreeKernelSpace', \ ; stdcall
|
||||
kernel_alloc, 'KernelAlloc', \ ; stdcall
|
||||
kernel_free, 'KernelFree', \ ; stdcall
|
||||
map_io_mem, 'MapIoMem', \ ; stdcall
|
||||
pci_api, 'PciApi', \
|
||||
pci_read32, 'PciRead32', \ ; stdcall
|
||||
reg_service, 'RegService', \
|
||||
|
@ -344,27 +344,14 @@ endp
|
||||
|
||||
align 4
|
||||
proc init_r200
|
||||
|
||||
stdcall AllocKernelSpace, dword 0x10000
|
||||
stdcall PciRead32, [bus], [devfn], dword 0x18
|
||||
stdcall MapIoMem,eax,0x10000,(PG_SW+PG_NOCACHE)
|
||||
test eax, eax
|
||||
jz .fail
|
||||
|
||||
mov [ati_io], eax
|
||||
mov edi, eax
|
||||
|
||||
stdcall PciRead32, [bus], [devfn], dword 0x18
|
||||
and eax, 0xFFFF0000
|
||||
mov esi, eax
|
||||
|
||||
mov edi, [ati_io]
|
||||
mov edx, 16
|
||||
@@:
|
||||
stdcall MapPage,edi,esi,PG_SW+PG_NOCACHE
|
||||
add edi, 0x1000
|
||||
add esi, 0x1000
|
||||
dec edx
|
||||
jnz @B
|
||||
|
||||
mov edi, [ati_io]
|
||||
mov dword [edi+RD_RB3D_CNTL], 0
|
||||
call engRestore
|
||||
|
||||
@ -397,25 +384,13 @@ end if
|
||||
align 4
|
||||
proc init_r500
|
||||
|
||||
stdcall AllocKernelSpace, dword 0x10000
|
||||
stdcall PciRead32, [bus], [devfn], dword 0x18
|
||||
stdcall MapIoMem,eax,0x10000,(PG_SW+PG_NOCACHE)
|
||||
test eax, eax
|
||||
jz .fail
|
||||
|
||||
mov [ati_io], eax
|
||||
|
||||
stdcall PciRead32, [bus], [devfn], dword 0x18
|
||||
and eax, 0xFFFF0000
|
||||
mov esi, eax
|
||||
|
||||
mov edi, [ati_io]
|
||||
mov edx, 16
|
||||
@@:
|
||||
stdcall MapPage,edi,esi,PG_SW+PG_NOCACHE
|
||||
add edi, 0x1000
|
||||
add esi, 0x1000
|
||||
dec edx
|
||||
jnz @B
|
||||
|
||||
mov [fnSelect], r500_SelectCursor
|
||||
mov [fnSet], r500_SetCursor
|
||||
|
||||
|
@ -35,6 +35,7 @@ kernel_export \
|
||||
FreePage,\
|
||||
MapPage,\
|
||||
MapSpace,\
|
||||
MapIoMem,\
|
||||
GetPgAddr,\
|
||||
CommitPages,\
|
||||
ReleasePages,\
|
||||
|
@ -802,24 +802,12 @@ PG_NOCACHE equ 0x018
|
||||
|
||||
align 4
|
||||
proc set_ICH4
|
||||
stdcall AllocKernelSpace, dword 0x2000
|
||||
mov edi, eax
|
||||
mov ebx, [ctrl.codec_mem_base]
|
||||
and ebx, -4096
|
||||
stdcall MapPage, edi,ebx,PG_SW+PG_NOCACHE
|
||||
mov ebx, [ctrl.codec_mem_base]
|
||||
and ebx, 4095
|
||||
add ebx, edi
|
||||
mov [ctrl.codec_mem_base], ebx
|
||||
add edi, 0x1000
|
||||
|
||||
mov ebx, [ctrl.ctrl_mem_base]
|
||||
and ebx, -4096
|
||||
stdcall MapPage, edi, ebx,PG_SW+PG_NOCACHE
|
||||
mov ebx, [ctrl.ctrl_mem_base]
|
||||
and ebx, 4095
|
||||
add ebx, edi
|
||||
mov [ctrl.ctrl_mem_base], ebx
|
||||
stdcall MapIoMem,[ctrl.codec_mem_base],0x1000,PG_SW+PG_NOCACHE
|
||||
mov [ctrl.codec_mem_base], eax
|
||||
|
||||
stdcall MapIoMem,[ctrl.ctrl_mem_base],0x1000,PG_SW+PG_NOCACHE
|
||||
mov [ctrl.ctrl_mem_base], eax
|
||||
|
||||
mov [ctrl.codec_read16], codec_mem_r16 ;virtual
|
||||
mov [ctrl.codec_write16], codec_mem_w16 ;virtual
|
||||
|
Loading…
Reference in New Issue
Block a user