Subversion Repositories Kolibri OS

Rev

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

Rev 3573 Rev 3934
Line 1... Line 1...
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
2
;;                                                              ;;
3
;; Copyright (C) 2010 KolibriOS team.     All rights reserved.  ;;
3
;; Copyright (C) 2010-13 KolibriOS team.  All rights reserved.  ;;
4
;; Distributed under terms of the GNU General Public License    ;;
4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
5
;;                                                              ;;
6
;;  HT.inc                                                      ;;                                                    ;;
6
;;  HT.inc                                                      ;;                                                    ;;
7
;;                                                              ;;
7
;;                                                              ;;
8
;;  AMD HyperTransport bus control                              ;;
8
;;  AMD HyperTransport bus control                              ;;
Line 111... Line 111...
111
	or	edx, edx
111
	or	edx, edx
112
	jnz	$				; PCIe is in the upper memory. Stop.
112
	jnz	$				; PCIe is in the upper memory. Stop.
113
	xchg	dl, al
113
	xchg	dl, al
114
	mov	dword[mmio_pcie_cfg_addr-OS_BASE], eax	; store the physical address
114
	mov	dword[mmio_pcie_cfg_addr-OS_BASE], eax	; store the physical address
115
	mov	ecx, edx
115
	mov	ecx, edx
-
 
116
 
116
	and	dl, 1
117
	shr	cl, 2
117
	jz	$				; bit[0] = 1 means no PCIe mapping allowed. Stop.
-
 
118
	shr	cl, 2				; ecx = log2(number of buses)
-
 
119
	mov	word[PCIe_bus_range-OS_BASE], cx
118
	mov	word[PCIe_bus_range-OS_BASE], cx
120
	sub	cl, 2
119
	sub	cl, 2
121
	jae	@f
120
	jae	@f
122
	xor	cl, cl
121
	xor	cl, cl
123
@@:
122
@@:
Line 156... Line 155...
156
 
155
 
Line 157... Line 156...
157
.pcie_cfg_mapped:
156
.pcie_cfg_mapped:
158
 
157
 
159
create_mmio_pte:
158
create_mmio_pte:
160
	mov	ecx, mmio_pte				; physical address
159
	mov	ecx, mmio_pte				; physical address
161
	or	ecx, (PG_NOCACHE + PG_SHARED + PG_SW)
160
	or	ecx, (PG_NOCACHE + PG_SHARED + PG_UW)
162
	mov	ebx, FUSION_MMIO			; linear address
161
	mov	ebx, FUSION_MMIO			; linear address
163
	shr	ebx, 20
162
	shr	ebx, 20
Line 164... Line 163...
164
	add	ebx, (sys_pgdir - OS_BASE)		; PgDir entry @
163
	add	ebx, (sys_pgdir - OS_BASE)		; PgDir entry @
165
	mov	dword[ebx], ecx 			; Fusion MMIO tables
164
	mov	dword[ebx], ecx 			; Fusion MMIO tables
166
 
165
 
167
; ---- short page mapping  ----
166
; ---- map APIC regs  ----
168
.map_apic_mmio:
167
.map_apic_mmio:
169
	mov	ecx, 0x01B	; APIC BAR
168
	mov	ecx, 0x01B	; APIC BAR
170
	rdmsr
169
	rdmsr
-
 
170
	and	eax, 0xFFFFF000 			; physical address
-
 
171
	or	eax, (PG_NOCACHE + PG_SHARED + PG_UW)
-
 
172
	mov	ebx, mmio_pte
-
 
173
	mov	[ebx], eax
-
 
174
 
-
 
175
; ---- map GPU MMRegs  ----
-
 
176
.map_gpu_mmr:
-
 
177
	mov	eax, [mmio_pcie_cfg_addr-OS_BASE]	; PCIe space
-
 
178
	add	eax, 0x08018				; b:0, d:1, f:0, reg=18
-
 
179
	mov	eax, [eax]
-
 
180
 
-
 
181
	xor	al, al					; physical address
-
 
182
	or	eax, (PG_NOCACHE + PG_SHARED + PG_UW)
-
 
183
@@:
-
 
184
	add   bl, 4
-
 
185
	mov	[ebx], eax
Line 171... Line 186...
171
	and	eax, 0xFFFFF000 			; physical address
186
	add   eax, 0x01000
Line 172... Line 187...
172
	or	eax, (PG_NOCACHE + PG_SHARED + PG_SW)
187
	cmp   bl, 16*4	  ; map 15 pages
Line 306... Line 321...
306
apic_data:
321
apic_data:
Line 307... Line 322...
307
 
322
 
308
    .counter dd ?
323
    .counter dd ?
309
    .ticks   dd ?
324
    .ticks   dd ?
-
 
325
    .t_freq  dd ?
310
    .t_freq  dd ?
326
    .gpu_r6998 dd ?
Line 311... Line 327...
311
endg
327
endg
312
 
328
 
313
apic_timer_reset:
329
apic_timer_reset:
Line 319... Line 335...
319
 
335
 
320
	mov	ebx, LAPIC_BAR+ 0x320
336
	mov	ebx, LAPIC_BAR+ 0x320
321
	mov	edx, [ebx]
337
	mov	edx, [ebx]
322
	and	edx, 0xFFFEFF00
338
	and	edx, 0xFFFEFF00
323
	or	edx, 0x0002003F 			; int vector + restart
339
	or	edx, 0x0002003F 			; int vector + restart
324
	mov	[ebx], edx
340
;--     mov     [ebx], edx
-
 
341
	mov	dword [LAPIC_BAR + 0x380], eax		; load APICTIC
-
 
342
 
-
 
343
; ret
-
 
344
 
-
 
345
init_hw_cursor:
-
 
346
	call	alloc_page			 ; eax = phys. addr
-
 
347
	push	eax
-
 
348
	or	eax, (PG_NOCACHE + PG_SHARED + PG_UW)	 ; i like dirty hacks
-
 
349
	mov	[mmio_pte + OS_BASE + 15*4], eax ; mapped to the end of GPU MMRegs
-
 
350
	mov	edi, GPU_CURSOR 		 ; lin. addr
-
 
351
	invlpg	[edi]
-
 
352
	xor	ecx, ecx
-
 
353
.fill64pix:
-
 
354
	xor	ebx, ebx
-
 
355
	mov	eax, 0x80000000 		; black, non-transparent
-
 
356
.check_pix:
-
 
357
	cmp	ebx, ecx
-
 
358
	jbe	@f
-
 
359
	xor	eax, eax			; transparent
-
 
360
@@:
-
 
361
	mov	[edi + ebx*4], eax
-
 
362
	inc	ebx
-
 
363
	cmp	bl, 64
-
 
364
	jb	.check_pix
-
 
365
	inc	ecx
-
 
366
	cmp	ecx, 16
-
 
367
	je	@f
-
 
368
	add	edi, 64*4			; new line
-
 
369
	jmp	.fill64pix
-
 
370
@@:
-
 
371
	pop	eax
-
 
372
	mov	dword[GPU_MMR + 0x0699C], eax	     ; cur_surface_addr
-
 
373
	mov	dword[GPU_MMR + 0x069A0], 0x000F000F ; cur_size    = 16x16
-
 
374
	mov	dword[GPU_MMR + 0x069A4], 0	     ; cur_adr_hi
-
 
375
	mov	dword[GPU_MMR + 0x069A8], 0x02000100 ; cur_pos     = 512,256
-
 
376
	mov	dword[GPU_MMR + 0x069AC], 0	     ; cur_hotspot = 0,0
-
 
377
 
-
 
378
	mov	dword[GPU_MMR + 0x06998], 0x00000301 ; set it!
-
 
379
 
-
 
380
 
325
	mov	dword [LAPIC_BAR + 0x380], eax		; load APICTIC
381
 
Line 326... Line 382...
326
	ret
382
	ret
327
 
383