Subversion Repositories Kolibri OS

Rev

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

Rev 3500 Rev 3908
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
 
-
 
44
IPI_INIT                equ  (0x5 shl 8)
-
 
45
IPI_START               equ  (0x6 shl 8)
-
 
46
IPI_LEVEL_ASSERT        equ  (0x1 shl 14)
-
 
47
SHORTHAND_ALL_EXCL      equ  (0x3 shl 18)
-
 
48
 
-
 
49
CMD_IPI_INIT            equ  (IPI_INIT+SHORTHAND_ALL_EXCL)
-
 
50
 
-
 
51
 
-
 
52
 
43
 
53
align 4
44
align 4
54
APIC_init:
45
APIC_init:
Line 55... Line 46...
55
        mov     [irq_mode], IRQ_PIC
46
        mov     [irq_mode], IRQ_PIC
Line 89... Line 80...
89
        xor     ecx, ecx
80
        xor     ecx, ecx
90
        mov     eax, IOAPIC_REDTBL
81
        mov     eax, IOAPIC_REDTBL
91
@@:
82
@@:
92
        mov     ebx, eax
83
        mov     ebx, eax
93
        call    IOAPIC_read
84
        call    IOAPIC_read
94
        mov     ah, 0x09; Delivery Mode: Lowest Priority, Destination Mode: Logical
85
        mov     ah, 0x08; Delivery Mode: Fixed, Destination Mode: Logical
95
        mov     al, cl
86
        mov     al, cl
96
        add     al, 0x20; vector
87
        add     al, 0x20; vector
97
        or      eax, 0x10000; Mask Interrupt
88
        or      eax, 0x10000; Mask Interrupt
98
        cmp     ecx, 16
89
        cmp     ecx, 16
99
        jb      .set
90
        jb      .set
Line 191... Line 182...
191
        or      eax, 0x10000; bit 16
182
        or      eax, 0x10000; bit 16
192
        mov     [esi + APIC_LVT_err], eax
183
        mov     [esi + APIC_LVT_err], eax
Line 193... Line 184...
193
 
184
 
194
	; LAPIC timer
185
        ; LAPIC timer
195
	; pre init
186
        ; pre init
196
;        mov     dword[esi + APIC_timer_div], 1011b; 1
187
        mov     dword[esi + APIC_timer_div], 1011b; 1
197
;        mov     dword[esi + APIC_timer_init], 0xffffffff; max val
188
        mov     dword[esi + APIC_timer_init], 0xffffffff; max val
198
;        push  esi
189
        push    esi
199
;        mov esi, 640        ; wait 0.64 sec
190
        mov     esi, 640    ; wait 0.64 sec
200
;        call  delay_ms
191
        call    delay_ms
201
;        pop esi
192
        pop     esi
202
;        mov     eax, [esi + APIC_timer_cur]; read current tick couner
193
        mov     eax, [esi + APIC_timer_cur]; read current tick couner
203
;        xor eax, 0xffffffff       ; eax = 0xffffffff - eax
194
        xor     eax, 0xffffffff   ; eax = 0xffffffff - eax
Line 204... Line 195...
204
;        shr eax, 6          ; eax /= 64; APIC ticks per 0.01 sec
195
        shr     eax, 6      ; eax /= 64; APIC ticks per 0.01 sec
205
 
196
 
206
	; Start (every 0.01 sec)
197
        ; Start (every 0.01 sec)
Line 207... Line 198...
207
;        mov     dword[esi + APIC_LVT_timer], 0x30020; periodic int 0x20
198
        mov     dword[esi + APIC_LVT_timer], 0x30020; periodic int 0x20
208
;        mov dword[esi + APIC_timer_init], eax
199
        mov     dword[esi + APIC_timer_init], eax
Line 209... Line 200...
209
 
200
 
Line 444... Line 435...
444
.done:
435
.done:
445
.fail:
436
.fail:
446
        pop ebp
437
        pop     ebp
447
        ret
438
        ret
Line 448... Line -...
448
 
-
 
449
if 0
-
 
450
align 4
-
 
451
start_ap:
-
 
452
;eax= cpu id
-
 
453
 
-
 
454
;        xchg bx, bx
-
 
455
 
-
 
456
        test    eax, eax              ;do not start self
-
 
457
        jz      .exit
-
 
458
 
-
 
459
        cmp     eax, [cpu_count]
-
 
460
        jae     .exit
-
 
461
 
-
 
462
        mov     eax, [smpt+eax*4]
-
 
463
        shl     eax, 24
-
 
464
 
-
 
465
        mov     [esi+APIC_ICRH], eax
-
 
466
        mov     [esi+APIC_ICRL], dword (IPI_INIT+IPI_LEVEL_ASSERT)
-
 
467
 
-
 
468
        mov     ecx, 10000
-
 
469
@@:
-
 
470
        loop    @B
-
 
471
 
-
 
472
CMD_IPI_START equ (IPI_START+IPI_LEVEL_ASSERT)+((0x10000+__ap_start_16) shr 12)
-
 
473
 
-
 
474
        mov     [esi+APIC_ICRH], eax
-
 
475
        mov     [esi+APIC_ICRL], dword CMD_IPI_START
-
 
476
.exit:
-
 
477
        ret
-
 
478
 
-