Subversion Repositories Kolibri OS

Rev

Rev 2437 | Rev 2441 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2437 Rev 2439
Line 39... Line 39...
39
IOAPIC_ID               equ  0x0
39
IOAPIC_ID               equ  0x0
40
IOAPIC_VER              equ  0x1
40
IOAPIC_VER              equ  0x1
41
IOAPIC_ARB              equ  0x2
41
IOAPIC_ARB              equ  0x2
42
IOAPIC_REDTBL           equ  0x10
42
IOAPIC_REDTBL           equ  0x10
Line 43... Line 43...
43
 
43
 
-
 
44
IPI_INIT                equ  (0x5 shl 8)
44
IPI_INIT                equ  (0x6 shl 8)
45
IPI_START               equ  (0x6 shl 8)
45
IPI_LEVEL_ASSERT        equ  (0x1 shl 14)
46
IPI_LEVEL_ASSERT        equ  (0x1 shl 14)
Line 46... Line 47...
46
SHORTHAND_ALL_EXCL      equ  (0x3 shl 18)
47
SHORTHAND_ALL_EXCL      equ  (0x3 shl 18)
Line 127... Line 128...
127
        ret
128
        ret
Line 128... Line 129...
128
 
129
 
129
;===========================================================
130
;===========================================================
130
align 4
131
align 4
131
LAPIC_init:
-
 
132
	; Check MSR support
-
 
133
	;....
-
 
134
	; Get LAPIC base address
-
 
135
 ;mov ecx, 0x1b
-
 
136
 ;rdmsr       ; it may be replaced to
-
 
Line 137... Line 132...
137
 ;and ax, 0xf000    ; mov eax, 0xfee00000
132
LAPIC_init:
138
 
133
 
Line 139... Line 134...
139
        mov [acpi_lapic_base], 0xfee00000
134
        cmp     [LAPIC_BASE], 0
140
 ;       xchg bx, bx
135
        jne     .done
141
 
136
 
Line 209... Line 204...
209
;        shr eax, 6          ; eax /= 64; APIC ticks per 0.01 sec
204
;        shr eax, 6          ; eax /= 64; APIC ticks per 0.01 sec
Line 210... Line 205...
210
 
205
 
211
	; Start (every 0.01 sec)
206
	; Start (every 0.01 sec)
212
;        mov     dword[esi + APIC_LVT_timer], 0x30020; periodic int 0x20
207
;        mov     dword[esi + APIC_LVT_timer], 0x30020; periodic int 0x20
213
;        mov dword[esi + APIC_timer_init], eax
-
 
214
        xchg bx, bx
-
 
215
 
-
 
216
;        mov     al, 0x0F
-
 
217
;        out     0x70, al
-
 
218
;        mov     al, 0x0A
-
 
219
;        out     0x71, al
-
 
220
 
-
 
221
;        mov     [OS_BASE+0x469], word (__ap_start_16) shr 4
-
 
222
;        mov     [OS_BASE+0x469], word 0
-
 
223
 
-
 
224
        mov     [esi+APIC_ICRH], dword 0
-
 
225
        mov     [esi+APIC_ICRL], dword 0xc4500
-
 
226
 
-
 
227
        mov ecx, 1000
-
 
228
@@:
-
 
229
        loop @B
-
 
230
 
-
 
231
        mov     [esi+APIC_ICRH], dword 0
-
 
232
        mov     [esi+APIC_ICRL], dword 0xC4600+((0x10000+__ap_start_16) shr 12)
-
 
233
;        mov     [esi+APIC_ICRL], dword 0xC4612
-
 
234
 
-
 
235
;        mov     [esi+APIC_ICRH], dword 0
-
 
236
;        mov     [esi+APIC_ICRL], dword CMD_IPI_INIT+IPI_LEVEL_ASSERT+16
-
 
237
 
-
 
Line -... Line 208...
-
 
208
;        mov dword[esi + APIC_timer_init], eax
238
 
209
 
Line 239... Line 210...
239
 
210
.done:
240
        ret
211
        ret
241
 
212
 
Line 446... Line 417...
446
.done:
417
.done:
447
.fail:
418
.fail:
448
        pop ebp
419
        pop ebp
449
        ret
420
        ret
Line -... Line 421...
-
 
421
 
-
 
422
align 4
-
 
423
start_ap:
-
 
424
;eax= cpu id
-
 
425
 
-
 
426
;        xchg bx, bx
-
 
427
 
-
 
428
        test    eax, eax              ;do not start self
-
 
429
        jz      .exit
-
 
430
 
-
 
431
        cmp     eax, [cpu_count]
-
 
432
        ja      .exit
-
 
433
 
-
 
434
        mov     eax, [smpt+eax*4]
-
 
435
        shl     eax, 24
-
 
436
 
-
 
437
        mov     [esi+APIC_ICRH], eax
-
 
438
        mov     [esi+APIC_ICRL], dword (IPI_INIT+IPI_LEVEL_ASSERT)
-
 
439
 
-
 
440
        mov     ecx, 10000
-
 
441
@@:
-
 
442
        loop    @B
-
 
443
 
-
 
444
CMD_IPI_START equ (IPI_START+IPI_LEVEL_ASSERT)+((0x10000+__ap_start_16) shr 12)
-
 
445
 
-
 
446
        mov     [esi+APIC_ICRH], eax
-
 
447
        mov     [esi+APIC_ICRL], dword CMD_IPI_START
-
 
448
.exit: