Changeset de07bcf in mainline
- Timestamp:
- 2006-05-05T13:42:42Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 203dcd45
- Parents:
- e3c762cd
- Location:
- arch
- Files:
-
- 1 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/amd64/Makefile.inc
re3c762cd rde07bcf 91 91 arch/$(ARCH)/src/ddi/ddi.c \ 92 92 arch/$(ARCH)/src/drivers/ega.c \ 93 arch/$(ARCH)/src/drivers/vesa.c \ 93 94 arch/$(ARCH)/src/drivers/i8254.c \ 94 95 arch/$(ARCH)/src/drivers/i8259.c \ -
arch/amd64/include/pm.h
re3c762cd rde07bcf 37 37 38 38 #define IDT_ITEMS 64 39 #define GDT_ITEMS 8 39 #define GDT_ITEMS 9 40 41 #define VESA_INIT_SEGMENT 0x8000 40 42 41 43 #define NULL_DES 0 … … 48 50 /* EndOfWarning */ 49 51 #define TSS_DES 6 52 #define VESA_INIT_DES 8 50 53 51 54 #define gdtselector(des) ((des)<<3) -
arch/amd64/src/amd64.c
re3c762cd rde07bcf 35 35 #include <proc/thread.h> 36 36 #include <arch/ega.h> 37 #include <arch/vesa.h> 37 38 #include <genarch/i8042/i8042.h> 38 39 #include <arch/i8254.h> … … 133 134 { 134 135 if (config.cpu_active == 1) { 136 #ifdef CONFIG_FB 137 if (vesa_present()) vesa_init(); 138 else 139 #endif 135 140 ega_init(); /* video */ 136 141 /* Enable debugger */ -
arch/amd64/src/boot/boot.S
re3c762cd rde07bcf 73 73 movl %ebx, grub_ebx 74 74 75 #ifdef CONFIG_FB 76 mov $vesa_init,%esi; 77 mov $VESA_INIT_SEGMENT<<4,%edi; 78 mov $e_vesa_init-vesa_init,%ecx; 79 cld; 80 rep movsb; 81 82 mov $VESA_INIT_SEGMENT<<4,%edi; 83 call *%edi; 84 mov %esi,KA2PA(vesa_ph_addr); 85 mov %di,KA2PA(vesa_height); 86 shr $16,%edi; 87 mov %di,KA2PA(vesa_width); 88 mov %bx,KA2PA(vesa_scanline); 89 shr $16,%ebx; 90 mov %bx,KA2PA(vesa_bpp); 91 #endif 92 75 93 # Protected 32-bit. We want to reuse the code-seg descriptor, 76 94 # the Default operand size must not be 1 when entering long mode … … 253 271 cli 254 272 hlt 273 274 #ifdef CONFIG_FB 275 .code32 276 vesa_init: 277 jmp $gdtselector(VESA_INIT_DES),$vesa_init_real-vesa_init; 278 .code16 279 vesa_init_real: 280 281 mov %cr0,%eax; 282 and $~1,%eax; 283 mov %eax,%cr0; 284 285 286 jmp $VESA_INIT_SEGMENT,$vesa_init_real2-vesa_init; 287 288 vesa_init_real2: 289 290 291 mov %esp,%ebp; 292 mov %ss,%cx; 293 mov $VESA_INIT_SEGMENT,%bx; 294 mov %bx,%ss; 295 mov $0x0000fffc,%esp; 296 push %ds; 297 push %es; 298 push %fs; 299 push %gs; 300 push %ebp; 301 push %cx; 302 303 mov %bx,%ds; 304 mov %bx,%es; 305 mov %bx,%fs; 306 mov %bx,%gs; 307 308 309 mov $vesa_idt-vesa_init,%ebx; 310 lidtl (%ebx); 311 312 #define VESA_INFO_SIZE 1024 313 314 #define VESA_MODE_LIST_PTR_OFFSET 14 315 #define VESA_MODE_WIDTH_OFFSET 18 316 #define VESA_MODE_HEIGHT_OFFSET 20 317 #define VESA_MODE_BPP_OFFSET 25 318 #define VESA_MODE_SCANLINE_OFFSET 16 319 #define VESA_MODE_PHADDR_OFFSET 40 320 321 #define VESA_END_OF_MODES 0xffff 322 323 #define VESA_OK 0x4f 324 325 #define VESA_GET_INFO 0x4f00 326 #define VESA_GET_MODE_INFO 0x4f01 327 #define VESA_SET_MODE 0x4f02 328 329 #define CONFIG_VESA_BPP_a 255 330 331 #if CONFIG_VESA_BPP==24 332 #undef CONFIG_VESA_BPP_a 333 #define CONFIG_VESA_BPP_a 32 334 #endif 335 336 337 mov $VESA_GET_INFO,%ax; 338 mov $e_vesa_init-vesa_init,%di 339 push %di; 340 int $0x10; 341 pop %di; 342 cmp $VESA_OK,%al; 343 jnz 0f; 344 mov 2+VESA_MODE_LIST_PTR_OFFSET(%di),%si; 345 mov %si,%gs; 346 mov VESA_MODE_LIST_PTR_OFFSET(%di),%si; 347 348 add $VESA_INFO_SIZE,%di; 349 350 1:# Try next mode 351 mov %gs:(%si),%cx; 352 cmp $VESA_END_OF_MODES,%cx; 353 jz 0f; 354 inc %si; 355 inc %si; 356 push %cx; 357 push %di; 358 push %si; 359 mov $VESA_GET_MODE_INFO,%ax; 360 int $0x10; 361 pop %si; 362 pop %di; 363 pop %cx; 364 cmp $VESA_OK,%al; 365 jnz 0f; 366 367 368 mov $CONFIG_VESA_WIDTH,%ax; 369 cmp VESA_MODE_WIDTH_OFFSET(%di),%ax; 370 jnz 1b; 371 mov $CONFIG_VESA_HEIGHT,%ax; 372 cmp VESA_MODE_HEIGHT_OFFSET(%di),%ax; 373 jnz 1b; 374 mov $CONFIG_VESA_BPP,%al; 375 cmp VESA_MODE_BPP_OFFSET(%di),%al; 376 jz 2f; 377 mov $CONFIG_VESA_BPP_a,%al; 378 cmp VESA_MODE_BPP_OFFSET(%di),%al; 379 jnz 1b; 380 381 2: 382 383 mov %cx,%bx; 384 or $0xC000,%bx; 385 push %di; 386 mov $VESA_SET_MODE,%ax; 387 int $0x10; 388 pop %di; 389 cmp $VESA_OK,%al; 390 jnz 0f; 391 392 mov VESA_MODE_PHADDR_OFFSET(%di),%esi; 393 mov VESA_MODE_WIDTH_OFFSET(%di),%ax; 394 shl $16,%eax; 395 mov VESA_MODE_HEIGHT_OFFSET(%di),%ax; 396 mov VESA_MODE_BPP_OFFSET(%di),%bl; 397 xor %bh,%bh; 398 shl $16,%ebx; 399 mov VESA_MODE_SCANLINE_OFFSET(%di),%bx; 400 mov %eax,%edi; 401 402 403 404 8: 405 406 mov %cr0,%eax; 407 or $1,%eax; 408 mov %eax,%cr0; 409 410 jmp 9f; 411 9: 412 413 pop %cx; 414 pop %ebp; 415 pop %gs; 416 pop %fs; 417 pop %es; 418 pop %ds; 419 mov %cx,%ss; 420 mov %ebp,%esp; 421 422 ljmpl $gdtselector(KTEXT32_DES),$(vesa_init_protect-vesa_init+VESA_INIT_SEGMENT<<4); 423 424 vesa_init_protect: 425 .code32 426 ret; 427 428 0: #Error no Prefered mode found 429 430 mov $0x111,%cx; 431 push %di; 432 push %cx; 433 mov $VESA_GET_MODE_INFO,%ax; 434 int $0x10; 435 pop %cx; 436 pop %di; 437 cmp $VESA_OK,%al; 438 jnz 1f; 439 jmp 2b; 440 441 1:mov $0x0003,%ax; 442 int $0x10; 443 mov $0xffffffff,%edi; /* EGA text mode used, because of problems with VESA */ 444 jmp 8; 445 446 447 vesa_idt: 448 .word 0x03ff 449 .long 0 450 .align 4 451 e_vesa_init: 452 #endif 453 454 255 455 256 456 .section K_DATA_START, "aw", @progbits -
arch/amd64/src/pm.c
re3c762cd rde07bcf 109 109 * on AMD64 it is 64-bit - 2 items in table */ 110 110 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 111 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } 111 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 112 /* VESA Init descriptor */ 113 { 0xffff, 0, VESA_INIT_SEGMENT>>12, AR_PRESENT | AR_CODE | DPL_KERNEL, 0xf, 0, 0, 0, 0, 0 } 112 114 }; 113 115 -
arch/ia32/include/vesa.h
re3c762cd rde07bcf 30 30 #define __VESA_H__ 31 31 32 #define VIDEORAM_LIN_ADDR 0xA000000033 32 34 33 int vesa_present(void); -
arch/ia32/src/drivers/vesa.c
re3c762cd rde07bcf 33 33 #include <putchar.h> 34 34 #include <mm/page.h> 35 #include <mm/frame.h> 35 36 #include <mm/as.h> 36 37 #include <arch/mm/page.h> … … 55 56 56 57 58 static __u32 log2(__u32 x) 59 { 60 __u32 l=2; 61 if(x<=PAGE_SIZE) return PAGE_WIDTH+1; 62 63 x--; 64 while(x>>=1) l++; 65 return l; 66 } 67 57 68 void vesa_init(void) 58 69 { 59 70 int a; 60 71 72 __address videoram_lin_addr; 73 74 videoram_lin_addr=PA2KA(PFN2ADDR(frame_alloc( log2(vesa_scanline*vesa_height) -FRAME_WIDTH,FRAME_KA))); 61 75 /* Map videoram */ 62 76 for(a=0;a<((vesa_scanline*vesa_height+PAGE_SIZE-1)>>PAGE_WIDTH);a++) 63 page_mapping_insert(AS_KERNEL, VIDEORAM_LIN_ADDR+a*4096, vesa_ph_addr+a*4096, PAGE_NOT_CACHEABLE);77 page_mapping_insert(AS_KERNEL, videoram_lin_addr+a*4096, vesa_ph_addr+a*4096, PAGE_NOT_CACHEABLE); 64 78 65 fb_init( VIDEORAM_LIN_ADDR,vesa_width,vesa_height,vesa_bpp,vesa_scanline);79 fb_init( videoram_lin_addr,vesa_width,vesa_height,vesa_bpp,vesa_scanline); 66 80 putchar('\n'); 67 81 } -
arch/ia32/src/pm.c
re3c762cd rde07bcf 69 69 { 0xffff, 0, 0, AR_PRESENT | AR_DATA | AR_WRITABLE | DPL_USER, 0xf, 0, 0, 1, 1, 0 }, 70 70 /* VESA Init descriptor */ 71 { 0xffff, 0, VESA_INIT_SEGMENT>>12, AR_PRESENT | AR_CODE | DPL_KERNEL, 0xf, 0, 0, 0, 0, 0 } ,71 { 0xffff, 0, VESA_INIT_SEGMENT>>12, AR_PRESENT | AR_CODE | DPL_KERNEL, 0xf, 0, 0, 0, 0, 0 } 72 72 73 73 };
Note:
See TracChangeset
for help on using the changeset viewer.