kolibri-acpi: add some checks in hpet initialization code

git-svn-id: svn://kolibrios.org@5645 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2015-08-02 07:43:48 +00:00
parent 297d78909d
commit 4ba939d3c8
3 changed files with 32 additions and 5 deletions

View File

@ -441,11 +441,16 @@ pci_irq_fixup:
align 4 align 4
get_clock_ns: get_clock_ns:
mov eax, [hpet_base]
test eax, eax
jz .old_tics
push ebx push ebx
pushfd pushfd
cli cli
mov ebx, [hpet_base] mov ebx, eax
@@: @@:
mov edx, [ebx+0xF4] mov edx, [ebx+0xF4]
mov eax, [ebx+0xF0] mov eax, [ebx+0xF0]
@ -463,3 +468,9 @@ get_clock_ns:
pop ebx pop ebx
ret ret
.old_tics:
mov eax, [timer_ticks]
mov edx, 10000000
mul edx
ret

View File

@ -438,6 +438,7 @@ acpi_ioapic_base rd 1
acpi_hpet_base rd 1 acpi_hpet_base rd 1
hpet_base rd 1 hpet_base rd 1
hpet_period rd 1 hpet_period rd 1
hpet_timers rd 1
cpu_count rd 1 cpu_count rd 1
smpt rd 16 smpt rd 16
@ -605,6 +606,14 @@ HPET_CFG equ 0x010
align 4 align 4
init_hpet: init_hpet:
mov ebx, [hpet_base-OS_BASE] mov ebx, [hpet_base-OS_BASE]
test ebx, ebx
jz @F
mov eax, [ebx]
and ah, 0x1F
inc ah
movzx eax, ah
mov [hpet_timers-OS_BASE], eax
mov eax, [ebx+HPET_PERIOD] mov eax, [ebx+HPET_PERIOD]
mov edx, 0x431BDE83 mov edx, 0x431BDE83
@ -622,6 +631,7 @@ init_hpet:
or eax, HPET_CFG_ENABLE or eax, HPET_CFG_ENABLE
mov [ebx+HPET_CFG], eax ;and start again mov [ebx+HPET_CFG], eax ;and start again
@@:
ret ret

View File

@ -698,17 +698,23 @@ setvideomode:
@@: @@:
mov [clipboard_main_list], eax mov [clipboard_main_list], eax
mov eax, [acpi_hpet_base] mov eax, [hpet_base]
DEBUGF 1, "K : ACPI HPET base %x\n", eax test eax, eax
mov eax, [hpet_base] jz @F
DEBUGF 1, "K : HPET base %x\n", eax DEBUGF 1, "K : HPET base %x\n", eax
mov eax, [hpet_period] mov eax, [hpet_period]
DEBUGF 1, "K : HPET period %d\n", eax DEBUGF 1, "K : HPET period %d\n", eax
mov eax, [hpet_timers]
DEBUGF 1, "K : HPET timers %d\n", eax
mov eax, [hpet_base] mov eax, [hpet_base]
stdcall map_io_mem, [hpet_base], 1024, PG_GLOBAL+PAT_UC+PG_SWR stdcall map_io_mem, [hpet_base], 1024, PG_GLOBAL+PAT_UC+PG_SWR
mov [hpet_base], eax mov [hpet_base], eax
mov eax, [eax]
DEBUGF 1, "K : HPET caps %x\n", eax
@@:
; SET UP OS TASK ; SET UP OS TASK
mov esi, boot_setostask mov esi, boot_setostask