forked from KolibriOS/kolibrios
merge acpi
git-svn-id: svn://kolibrios.org@2466 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
c3da687125
commit
791845236e
@ -387,7 +387,7 @@ sayerr:
|
||||
|
||||
push 0
|
||||
pop es
|
||||
and word [es:0x9031], 0
|
||||
and word [es:BOOT_IDE_BASE_ADDR], 0
|
||||
; \begin{Mario79}
|
||||
; find HDD IDE DMA PCI device
|
||||
; check for PCI BIOS
|
||||
@ -424,7 +424,7 @@ sayerr:
|
||||
int 0x1A
|
||||
jc .nopci
|
||||
and cx, 0xFFF0 ; clear address decode type
|
||||
mov [es:0x9031], cx
|
||||
mov [es:BOOT_IDE_BASE_ADDR], cx
|
||||
.nopci:
|
||||
; \end{Mario79}
|
||||
|
||||
@ -456,15 +456,15 @@ wait_loop: ; variant 2
|
||||
loopnz @b
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; --------------- APM ---------------------
|
||||
and word [es:0x9044], 0 ; ver = 0.0 (APM not found)
|
||||
and word [es:BOOT_APM_VERSION], 0 ; ver = 0.0 (APM not found)
|
||||
mov ax, 0x5300
|
||||
xor bx, bx
|
||||
int 0x15
|
||||
jc apm_end ; APM not found
|
||||
test cx, 2
|
||||
jz apm_end ; APM 32-bit protected-mode interface not supported
|
||||
mov [es:0x9044], ax ; Save APM Version
|
||||
mov [es:0x9046], cx ; Save APM flags
|
||||
mov [es:BOOT_APM_VERSION], ax ; Save APM Version
|
||||
mov [es:BOOT_APM_FLAGS], cx ; Save APM flags
|
||||
|
||||
; Write APM ver ----
|
||||
and ax, 0xf0f
|
||||
@ -483,10 +483,10 @@ wait_loop: ; variant 2
|
||||
xor bx, bx
|
||||
int 0x15
|
||||
|
||||
mov [es:0x9040], ebx
|
||||
mov [es:0x9050], ax
|
||||
mov [es:0x9052], cx
|
||||
mov [es:0x9054], dx
|
||||
mov [es:BOOT_APM_ENTRY], ebx
|
||||
mov [es:BOOT_APM_CODE_32], ax
|
||||
mov [es:BOOT_APM_CODE_16], cx
|
||||
mov [es:BOOT_APM_DATA_16], dx
|
||||
|
||||
apm_end:
|
||||
_setcursor d80x25_top_num, 0
|
||||
@ -947,18 +947,17 @@ end if
|
||||
|
||||
; GRAPHICS ACCELERATION
|
||||
; force yes
|
||||
mov [es:0x901C], byte 1
|
||||
mov [es:BOOT_MTRR], byte 1
|
||||
|
||||
; DMA ACCESS TO HD
|
||||
|
||||
mov al, [preboot_dma]
|
||||
mov [es:0x901F], al
|
||||
mov [es:BOOT_DMA], al
|
||||
|
||||
;; VRR_M USE
|
||||
;
|
||||
; mov al,[preboot_vrrm]
|
||||
; mov [es:0x9030], al
|
||||
mov [es:0x901E], byte 1
|
||||
|
||||
; BOOT DEVICE
|
||||
|
||||
@ -1337,7 +1336,7 @@ end if
|
||||
xor ax, ax
|
||||
mov es, ax
|
||||
|
||||
mov ax, [es:0x9008] ; vga & 320x200
|
||||
mov ax, [es:BOOT_VESA_MODE] ; vga & 320x200
|
||||
mov bx, ax
|
||||
cmp ax, 0x13
|
||||
je setgr
|
||||
|
@ -726,9 +726,9 @@ set_vmode:
|
||||
mov bx, word [es:si+2] ; resolution Y
|
||||
|
||||
|
||||
mov word [es:0x900A], ax ; resolution X
|
||||
mov word [es:0x900C], bx ; resolution Y
|
||||
mov word [es:0x9008], cx ; number of mode
|
||||
mov word [es:BOOT_X_RES], ax ; resolution X
|
||||
mov word [es:BOOT_Y_RES], bx ; resolution Y
|
||||
mov word [es:BOOT_VESA_MODE], cx ; number of mode
|
||||
|
||||
cmp cx, 0x12
|
||||
je .mode0x12_0x13
|
||||
@ -747,11 +747,11 @@ set_vmode:
|
||||
int 0x10
|
||||
; LFB
|
||||
mov eax, [es:mi.PhysBasePtr];di+0x28]
|
||||
mov [es:0x9018], eax
|
||||
mov [es:BOOT_LFB], eax
|
||||
; ---- vbe voodoo
|
||||
BytesPerLine equ 0x10
|
||||
mov ax, [es:di+BytesPerLine]
|
||||
mov [es:0x9001], ax
|
||||
mov [es:BOOT_PITCH], ax
|
||||
; BPP
|
||||
cmp [es:mi.BitsPerPixel], 16
|
||||
jne .l0
|
||||
@ -760,12 +760,12 @@ set_vmode:
|
||||
mov [es:mi.BitsPerPixel], 15
|
||||
.l0:
|
||||
mov al, byte [es:di+0x19]
|
||||
mov [es:0x9000], al
|
||||
mov [es:BOOT_BPP], al
|
||||
jmp .exit
|
||||
|
||||
.mode0x12_0x13:
|
||||
mov byte [es:0x9000], 32
|
||||
or dword [es:0x9018], 0xFFFFFFFF; 0x800000
|
||||
mov byte [es:BOOT_BPP], 32
|
||||
or dword [es:BOOT_LFB], 0xFFFFFFFF; 0x800000
|
||||
|
||||
|
||||
; VESA 1.2 PM BANK SWITCH ADDRESS
|
||||
@ -788,10 +788,6 @@ set_vmode:
|
||||
.exit:
|
||||
ret
|
||||
|
||||
|
||||
; mov dword[es:0x9018],0x000A0000
|
||||
; ret
|
||||
|
||||
;=============================================================================
|
||||
;=============================================================================
|
||||
;=============================================================================
|
||||
|
@ -363,22 +363,30 @@ PG_SHARED equ 0x200
|
||||
|
||||
;;;;;;;;;;;boot time variables
|
||||
|
||||
;BOOT_BPP equ 0x9000 ;byte bits per pixel
|
||||
BOOT_SCANLINE equ 0x9001 ;word scanline length
|
||||
BOOT_BPP equ 0x9000 ;byte bits per pixel
|
||||
BOOT_PITCH equ 0x9001 ;word scanline length
|
||||
BOOT_VESA_MODE equ 0x9008 ;word vesa video mode
|
||||
;;BOOT_X_RES equ 0x900A ;word X res
|
||||
;;BOOT_Y_RES equ 0x900C ;word Y res
|
||||
BOOT_X_RES equ 0x900A ;word X res
|
||||
BOOT_Y_RES equ 0x900C ;word Y res
|
||||
;;BOOT_MOUSE_PORT equ 0x9010 ;byte mouse port - not used
|
||||
BOOT_BANK_SW equ 0x9014 ;dword Vesa 1.2 pm bank switch
|
||||
BOOT_LFB equ 0x9018 ;dword Vesa 2.0 LFB address
|
||||
BOOT_MTRR equ 0x901C ;byte 0 or 1 : enable MTRR graphics acceleration
|
||||
BOOT_LOG equ 0x901D ;byte not used anymore (0 or 1 : enable system log display)
|
||||
BOOT_DIRECT_LFB equ 0x901E ;byte 0 or 1 : enable direct lfb write, paging disabled
|
||||
;BOOT_DIRECT_LFB equ 0x901E ;byte 0 or 1 : enable direct lfb write, paging disabled
|
||||
BOOT_DMA equ 0x901F ;
|
||||
BOOT_PCI_DATA equ 0x9020 ;8bytes pci data
|
||||
BOOT_VRR equ 0x9030 ;byte VRR start enabled 1, 2-no
|
||||
BOOT_IDE_BASE_ADDR equ 0x9031 ;word IDEContrRegsBaseAddr
|
||||
BOOT_MEM_AMOUNT equ 0x9034 ;dword memory amount
|
||||
|
||||
BOOT_APM_ENTRY equ 0x9040
|
||||
BOOT_APM_VERSION equ 0x9044
|
||||
BOOT_APM_FLAGS equ 0x9046 ;unused
|
||||
BOOT_APM_CODE_32 equ 0x9050
|
||||
BOOT_APM_CODE_16 equ 0x9052
|
||||
BOOT_APM_DATA_16 equ 0x9054
|
||||
|
||||
TMP_FILE_NAME equ 0
|
||||
TMP_CMD_LINE equ 1024
|
||||
TMP_ICON_OFFS equ 1280
|
||||
|
@ -358,7 +358,7 @@ proc init_LFB
|
||||
|
||||
cmp dword [LFBAddress], -1
|
||||
jne @f
|
||||
mov [BOOT_VAR+0x901c], byte 2
|
||||
mov [BOOT_VAR+BOOT_MTRR], byte 2
|
||||
; max VGA=640*480*4=1228800 bytes
|
||||
; + 32*640*4=81920 bytes for mouse pointer
|
||||
stdcall alloc_pages, ((1228800+81920)/4096)
|
||||
@ -378,7 +378,7 @@ proc init_LFB
|
||||
@@:
|
||||
test [SCR_MODE], word 0100000000000000b
|
||||
jnz @f
|
||||
mov [BOOT_VAR+0x901c], byte 2
|
||||
mov [BOOT_VAR+BOOT_MTRR], byte 2
|
||||
ret
|
||||
@@:
|
||||
call init_mtrr
|
||||
@ -1364,7 +1364,7 @@ endp
|
||||
align 4
|
||||
proc init_mtrr
|
||||
|
||||
cmp [BOOT_VAR+0x901c], byte 2
|
||||
cmp [BOOT_VAR+BOOT_MTRR], byte 2
|
||||
je .exit
|
||||
|
||||
bt [cpu_caps], CAPS_MTRR
|
||||
@ -1554,3 +1554,27 @@ proc create_ring_buffer stdcall, size:dword, flags:dword
|
||||
.fail:
|
||||
ret
|
||||
endp
|
||||
|
||||
|
||||
align 4
|
||||
proc print_mem
|
||||
mov edi, BOOT_VAR + 0x9104
|
||||
mov ecx, [edi-4]
|
||||
test ecx, ecx
|
||||
jz .done
|
||||
|
||||
@@:
|
||||
mov eax, [edi]
|
||||
mov edx, [edi+4]
|
||||
add eax, [edi+8]
|
||||
adc edx, [edi+12]
|
||||
|
||||
DEBUGF 1, "K : E820 %x%x - %x%x type %d\n", \
|
||||
[edi+4], [edi],\
|
||||
edx, eax, [edi+16]
|
||||
add edi, 20
|
||||
dec ecx
|
||||
jnz @b
|
||||
.done:
|
||||
ret
|
||||
endp
|
||||
|
@ -23,8 +23,8 @@
|
||||
cmp eax, 0x534D4150
|
||||
jnz no_E820
|
||||
e820_mem_loop:
|
||||
cmp byte [di+16], 1 ; ignore non-free areas
|
||||
jnz e820_mem_next
|
||||
; cmp byte [di+16], 1 ; ignore non-free areas
|
||||
; jnz e820_mem_next
|
||||
inc byte [0x9100]
|
||||
add di, 20
|
||||
e820_mem_next:
|
||||
|
@ -55,6 +55,9 @@ proc init_mem
|
||||
.calcmax:
|
||||
; round all to pages
|
||||
mov eax, [edi]
|
||||
cmp [edi+16], byte 1
|
||||
jne .unusable
|
||||
|
||||
test eax, 0xFFF
|
||||
jz @f
|
||||
neg eax
|
||||
@ -87,7 +90,7 @@ proc init_mem
|
||||
add esi, eax
|
||||
jmp .usable
|
||||
.unusable:
|
||||
and dword [edi+8], 0
|
||||
; and dword [edi+8], 0
|
||||
.usable:
|
||||
add edi, 20
|
||||
loop .calcmax
|
||||
@ -195,6 +198,9 @@ proc init_page_map
|
||||
mov ebx, BOOT_VAR-OS_BASE + 0x9104
|
||||
mov edx, [ebx-4]
|
||||
.scanmap:
|
||||
cmp [ebx+16], byte 1
|
||||
jne .next
|
||||
|
||||
mov ecx, [ebx+8]
|
||||
shr ecx, 12; ecx = number of pages
|
||||
jz .next
|
||||
|
@ -333,17 +333,17 @@ high_code:
|
||||
call mutex_init
|
||||
|
||||
; SAVE REAL MODE VARIABLES
|
||||
mov ax, [BOOT_VAR + 0x9031]
|
||||
mov ax, [BOOT_VAR + BOOT_IDE_BASE_ADDR]
|
||||
mov [IDEContrRegsBaseAddr], ax
|
||||
; --------------- APM ---------------------
|
||||
|
||||
; init selectors
|
||||
mov ebx, [BOOT_VAR+0x9040] ; offset of APM entry point
|
||||
movzx eax, word [BOOT_VAR+0x9050]; real-mode segment base address of
|
||||
mov ebx, [BOOT_VAR+BOOT_APM_ENTRY] ; offset of APM entry point
|
||||
movzx eax, word [BOOT_VAR+BOOT_APM_CODE_32] ; real-mode segment base address of
|
||||
; protected-mode 32-bit code segment
|
||||
movzx ecx, word [BOOT_VAR+0x9052]; real-mode segment base address of
|
||||
movzx ecx, word [BOOT_VAR+BOOT_APM_CODE_16]; real-mode segment base address of
|
||||
; protected-mode 16-bit code segment
|
||||
movzx edx, word [BOOT_VAR+0x9054]; real-mode segment base address of
|
||||
movzx edx, word [BOOT_VAR+BOOT_APM_DATA_16]; real-mode segment base address of
|
||||
; protected-mode 16-bit data segment
|
||||
|
||||
shl eax, 4
|
||||
@ -364,30 +364,28 @@ high_code:
|
||||
mov dword[apm_entry], ebx
|
||||
mov word [apm_entry + 4], apm_code_32 - gdts
|
||||
|
||||
mov eax, [BOOT_VAR + 0x9044]; version & flags
|
||||
mov eax, [BOOT_VAR + BOOT_APM_VERSION] ; version & flags
|
||||
mov [apm_vf], eax
|
||||
; -----------------------------------------
|
||||
; movzx eax,byte [BOOT_VAR+0x9010] ; mouse port
|
||||
; mov [0xF604],byte 1 ;al
|
||||
mov al, [BOOT_VAR+0x901F] ; DMA access
|
||||
mov al, [BOOT_VAR+BOOT_DMA] ; DMA access
|
||||
mov [allow_dma_access], al
|
||||
movzx eax, byte [BOOT_VAR+0x9000] ; bpp
|
||||
movzx eax, byte [BOOT_VAR+BOOT_BPP] ; bpp
|
||||
mov [ScreenBPP], al
|
||||
|
||||
mov [_display.bpp], eax
|
||||
mov [_display.vrefresh], 60
|
||||
|
||||
movzx eax, word [BOOT_VAR+0x900A]; X max
|
||||
movzx eax, word [BOOT_VAR+BOOT_X_RES]; X max
|
||||
mov [_display.width], eax
|
||||
dec eax
|
||||
mov [Screen_Max_X], eax
|
||||
mov [screen_workarea.right], eax
|
||||
movzx eax, word [BOOT_VAR+0x900C]; Y max
|
||||
movzx eax, word [BOOT_VAR+BOOT_Y_RES]; Y max
|
||||
mov [_display.height], eax
|
||||
dec eax
|
||||
mov [Screen_Max_Y], eax
|
||||
mov [screen_workarea.bottom], eax
|
||||
movzx eax, word [BOOT_VAR+0x9008]; screen mode
|
||||
movzx eax, word [BOOT_VAR+BOOT_VESA_MODE]; screen mode
|
||||
mov [SCR_MODE], eax
|
||||
; mov eax, [BOOT_VAR+0x9014] ; Vesa 1.2 bnk sw add
|
||||
; mov [BANK_SWITCH], eax
|
||||
@ -396,7 +394,7 @@ high_code:
|
||||
je @f
|
||||
cmp [SCR_MODE], word 0x12 ; VGA 640x480
|
||||
je @f
|
||||
movzx eax, word[BOOT_VAR+0x9001] ; for other modes
|
||||
movzx eax, word[BOOT_VAR+BOOT_PITCH] ; for other modes
|
||||
mov [BytesPerScanLine], ax
|
||||
mov [_display.pitch], eax
|
||||
@@:
|
||||
@ -414,8 +412,7 @@ high_code:
|
||||
|
||||
; GRAPHICS ADDRESSES
|
||||
|
||||
and byte [BOOT_VAR+0x901e], 0x0
|
||||
mov eax, [BOOT_VAR+0x9018]
|
||||
mov eax, [BOOT_VAR+BOOT_LFB]
|
||||
mov [LFBAddress], eax
|
||||
|
||||
cmp [SCR_MODE], word 0100000000000000b
|
||||
@ -1148,10 +1145,10 @@ set_variables:
|
||||
loop .fl60
|
||||
push eax
|
||||
|
||||
mov ax, [BOOT_VAR+0x900c]
|
||||
mov ax, [BOOT_VAR+BOOT_Y_RES]
|
||||
shr ax, 1
|
||||
shl eax, 16
|
||||
mov ax, [BOOT_VAR+0x900A]
|
||||
mov ax, [BOOT_VAR+BOOT_X_RES]
|
||||
shr ax, 1
|
||||
mov [MOUSE_X], eax
|
||||
|
||||
|
@ -688,9 +688,9 @@ set_vmode:
|
||||
mov bx, word [es:si+2] ; resolution Y
|
||||
|
||||
|
||||
mov word [es:0x900A], ax ; resolution X
|
||||
mov word [es:0x900C], bx ; resolution Y
|
||||
mov word [es:0x9008], cx ; number of mode
|
||||
mov word [es:BOOT_X_RES], ax ; resolution X
|
||||
mov word [es:BOOT_Y_RES], bx ; resolution Y
|
||||
mov word [es:BOOT_VESA_MODE], cx ; number of mode
|
||||
|
||||
cmp cx, 0x12
|
||||
je .mode0x12_0x13
|
||||
@ -709,11 +709,11 @@ set_vmode:
|
||||
int 0x10
|
||||
; LFB
|
||||
mov eax, [es:mi.PhysBasePtr];di+0x28]
|
||||
mov [es:0x9018], eax
|
||||
mov [es:BOOT_LFB], eax
|
||||
; ---- vbe voodoo
|
||||
BytesPerLine equ 0x10
|
||||
mov ax, [es:di+BytesPerLine]
|
||||
mov [es:0x9001], ax
|
||||
mov [es:BOOT_PITCH], ax
|
||||
; BPP
|
||||
cmp [es:mi.BitsPerPixel], 16
|
||||
jne .l0
|
||||
@ -722,12 +722,12 @@ set_vmode:
|
||||
mov [es:mi.BitsPerPixel], 15
|
||||
.l0:
|
||||
mov al, byte [es:di+0x19]
|
||||
mov [es:0x9000], al
|
||||
mov [es:BOOT_BPP], al
|
||||
jmp .exit
|
||||
|
||||
.mode0x12_0x13:
|
||||
mov byte [es:0x9000], 32
|
||||
or dword [es:0x9018], 0xFFFFFFFF; 0x800000
|
||||
mov byte [es:BOOT_BPP], 32
|
||||
or dword [es:BOOT_LFB], 0xFFFFFFFF; 0x800000
|
||||
|
||||
|
||||
; VESA 1.2 PM BANK SWITCH ADDRESS
|
||||
@ -753,9 +753,6 @@ set_vmode:
|
||||
ret
|
||||
|
||||
|
||||
; mov dword[es:0x9018],0x000A0000
|
||||
; ret
|
||||
|
||||
;=============================================================================
|
||||
;=============================================================================
|
||||
;=============================================================================
|
||||
|
@ -157,7 +157,7 @@ sayerr:
|
||||
|
||||
push 0
|
||||
pop es
|
||||
and word [es:0x9031], 0
|
||||
and word [es:BOOT_IDE_BASE_ADDR], 0
|
||||
; \begin{Mario79}
|
||||
; find HDD IDE DMA PCI device
|
||||
; check for PCI BIOS
|
||||
@ -194,7 +194,7 @@ sayerr:
|
||||
int 0x1A
|
||||
jc .nopci
|
||||
and cx, 0xFFF0 ; clear address decode type
|
||||
mov [es:0x9031], cx
|
||||
mov [es:BOOT_IDE_BASE_ADDR], cx
|
||||
.nopci:
|
||||
; \end{Mario79}
|
||||
|
||||
@ -226,15 +226,15 @@ wait_loop: ; variant 2
|
||||
loopnz @b
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; --------------- APM ---------------------
|
||||
and word [es:0x9044], 0 ; ver = 0.0 (APM not found)
|
||||
and word [es:BOOT_APM_VERSION], 0 ; ver = 0.0 (APM not found)
|
||||
mov ax, 0x5300
|
||||
xor bx, bx
|
||||
int 0x15
|
||||
jc apm_end ; APM not found
|
||||
test cx, 2
|
||||
jz apm_end ; APM 32-bit protected-mode interface not supported
|
||||
mov [es:0x9044], ax ; Save APM Version
|
||||
mov [es:0x9046], cx ; Save APM flags
|
||||
mov [es:BOOT_APM_VERSION], ax ; Save APM Version
|
||||
mov [es:BOOT_APM_FLAGS], cx ; Save APM flags
|
||||
|
||||
; Write APM ver ----
|
||||
and ax, 0xf0f
|
||||
@ -253,10 +253,10 @@ wait_loop: ; variant 2
|
||||
xor bx, bx
|
||||
int 0x15
|
||||
|
||||
mov [es:0x9040], ebx
|
||||
mov [es:0x9050], ax
|
||||
mov [es:0x9052], cx
|
||||
mov [es:0x9054], dx
|
||||
mov [es:BOOT_APM_ENTRY], ebx
|
||||
mov [es:BOOT_APM_CODE_32], ax
|
||||
mov [es:BOOT_APM_CODE_16], cx
|
||||
mov [es:BOOT_APM_DATA_16], dx
|
||||
|
||||
apm_end:
|
||||
_setcursor d80x25_top_num, 0
|
||||
@ -670,18 +670,17 @@ end if
|
||||
|
||||
; GRAPHICS ACCELERATION
|
||||
; force yes
|
||||
mov [es:0x901C], byte 1
|
||||
mov [es:BOOT_MTRR], byte 1
|
||||
|
||||
; DMA ACCESS TO HD
|
||||
|
||||
mov al, [preboot_dma]
|
||||
mov [es:0x901F], al
|
||||
mov [es:BOOT_DMA], al
|
||||
|
||||
; VRR_M USE
|
||||
|
||||
mov al, [preboot_vrrm]
|
||||
mov [es:0x9030], al
|
||||
mov [es:0x901E], byte 1
|
||||
; mov al, [preboot_vrrm]
|
||||
; mov [es:0x9030], al
|
||||
|
||||
; BOOT DEVICE
|
||||
|
||||
@ -698,7 +697,7 @@ end if
|
||||
xor ax, ax
|
||||
mov es, ax
|
||||
|
||||
mov ax, [es:0x9008] ; vga & 320x200
|
||||
mov ax, [es:BOOT_VESA_MODE] ; vga & 320x200
|
||||
mov bx, ax
|
||||
cmp ax, 0x13
|
||||
je setgr
|
||||
|
Loading…
Reference in New Issue
Block a user