Changeset 1f5c9c96 in mainline
- Timestamp:
- 2011-12-02T17:29:43Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b8b1e631, c3887ad
- Parents:
- c48f6ab
- Files:
-
- 4 added
- 20 edited
- 4 moved
Legend:
- Unmodified
- Added
- Removed
-
HelenOS.config
rc48f6ab r1f5c9c96 520 520 @ "1920x1080" 521 521 @ "1920x1200" 522 ! [(PLATFORM=ia32|PLATFORM=amd64)&CONFIG_HID_OUT!=none&CONFIG_FB=y] CONFIG_ VESA_MODE (choice)522 ! [(PLATFORM=ia32|PLATFORM=amd64)&CONFIG_HID_OUT!=none&CONFIG_FB=y] CONFIG_BFB_MODE (choice) 523 523 524 524 % Default framebuffer depth … … 526 526 @ "16" 527 527 @ "24" 528 ! [(PLATFORM=ia32|PLATFORM=amd64)&CONFIG_HID_OUT!=none&CONFIG_FB=y] CONFIG_ VESA_BPP (choice)528 ! [(PLATFORM=ia32|PLATFORM=amd64)&CONFIG_HID_OUT!=none&CONFIG_FB=y] CONFIG_BFB_BPP (choice) 529 529 530 530 % Start AP processors by the loader -
boot/Makefile.grub
rc48f6ab r1f5c9c96 39 39 ifeq ($(GRUB_ARCH),pc) 40 40 BOOT_CONFIG = $(BOOT)/grub/i386-pc/grub.cfg 41 MULTIBOOT_CMD = multiboot 42 MODULE_CMD = module 41 43 endif 42 44 ifeq ($(GRUB_ARCH),efi) 43 45 BOOT_CONFIG = $(BOOT)/grub/grub.cfg 46 MULTIBOOT_CMD = multiboot2 47 MODULE_CMD = module2 44 48 endif 45 49 … … 69 73 echo "" >> $(BOOT_CONFIG) 70 74 75 ifeq ($(GRUB_ARCH),pc) 76 echo "insmod vbe" >> $(BOOT_CONFIG) 77 echo "insmod vga" >> $(BOOT_CONFIG) 78 endif 79 ifeq ($(GRUB_ARCH),efi) 80 echo "insmod efi_gop" >> $(BOOT_CONFIG) 81 echo "insmod efi_uga" >> $(BOOT_CONFIG) 82 endif 83 echo "" >> $(BOOT_CONFIG) 84 71 85 echo "menuentry 'HelenOS $(RELEASE)' --class helenos --class os {" >> $(BOOT_CONFIG) 72 86 for module in $(MODULES) ; do \ 73 87 echo " echo 'Loading $$module'" >> $(BOOT_CONFIG) ; \ 74 88 if [ "$$module" = "kernel.bin" ] ; then \ 75 echo " multiboot/boot/$$module" >> $(BOOT_CONFIG) ; \89 echo " $(MULTIBOOT_CMD) /boot/$$module" >> $(BOOT_CONFIG) ; \ 76 90 else \ 77 echo " module/boot/$$module" >> $(BOOT_CONFIG) ; \91 echo " $(MODULE_CMD) /boot/$$module" >> $(BOOT_CONFIG) ; \ 78 92 fi \ 79 93 done -
defaults/amd64/Makefile.config
rc48f6ab r1f5c9c96 54 54 55 55 # Default framebuffer mode 56 CONFIG_ VESA_MODE = 800x60056 CONFIG_BFB_MODE = 800x600 57 57 58 58 # Default framebuffer depth 59 CONFIG_ VESA_BPP = 1659 CONFIG_BFB_BPP = 16 60 60 61 61 # Load disk drivers on startup -
defaults/ia32/Makefile.config
rc48f6ab r1f5c9c96 60 60 61 61 # Default framebuffer mode 62 CONFIG_ VESA_MODE = 800x60062 CONFIG_BFB_MODE = 800x600 63 63 64 64 # Default framebuffer depth 65 CONFIG_ VESA_BPP = 1665 CONFIG_BFB_BPP = 16 66 66 67 67 # Load disk drivers on startup -
kernel/arch/amd64/Makefile.inc
rc48f6ab r1f5c9c96 72 72 ARCH_SOURCES = \ 73 73 arch/$(KARCH)/src/fpu_context.c \ 74 arch/$(KARCH)/src/boot/boot.S \ 74 arch/$(KARCH)/src/boot/multiboot.S \ 75 arch/$(KARCH)/src/boot/multiboot2.S \ 75 76 arch/$(KARCH)/src/boot/memmap.c \ 76 77 arch/$(KARCH)/src/debug/stacktrace.c \ … … 79 80 arch/$(KARCH)/src/context.S \ 80 81 arch/$(KARCH)/src/ddi/ddi.c \ 81 arch/$(KARCH)/src/drivers/vesa.c \82 82 arch/$(KARCH)/src/drivers/i8254.c \ 83 83 arch/$(KARCH)/src/drivers/i8259.c \ -
kernel/arch/amd64/include/arch.h
rc48f6ab r1f5c9c96 38 38 #include <genarch/multiboot/multiboot.h> 39 39 40 extern void arch_pre_main(uint32_t, const multiboot_info_t*);40 extern void arch_pre_main(uint32_t, void *); 41 41 42 42 #endif -
kernel/arch/amd64/include/boot/boot.h
rc48f6ab r1f5c9c96 40 40 #define BOOT_STACK_SIZE 0x000400 41 41 42 #define MULTIBOOT_HEADER_MAGIC 0x1BADB00243 #define MULTIBOOT_HEADER_FLAGS 0x0001000344 45 42 #ifndef __ASM__ 46 43 -
kernel/arch/amd64/src/amd64.c
rc48f6ab r1f5c9c96 41 41 #include <proc/thread.h> 42 42 #include <genarch/multiboot/multiboot.h> 43 #include <genarch/multiboot/multiboot2.h> 43 44 #include <genarch/drivers/legacy/ia32/io.h> 44 45 #include <genarch/drivers/ega/ega.h> 45 #include < arch/drivers/vesa.h>46 #include <genarch/fb/bfb.h> 46 47 #include <genarch/drivers/i8042/i8042.h> 47 48 #include <genarch/kbrd/kbrd.h> … … 101 102 /** Perform amd64-specific initialization before main_bsp() is called. 102 103 * 103 * @param signature Should contain the multiboot signature. 104 * @param mi Pointer to the multiboot information structure. 105 */ 106 void arch_pre_main(uint32_t signature, const multiboot_info_t *mi) 104 * @param signature Multiboot signature. 105 * @param info Multiboot information structure. 106 * 107 */ 108 void arch_pre_main(uint32_t signature, void *info) 107 109 { 108 110 /* Parse multiboot information obtained from the bootloader. */ 109 multiboot_info_parse(signature, mi); 111 multiboot_info_parse(signature, (multiboot_info_t *) info); 112 multiboot2_info_parse(signature, (multiboot2_info_t *) info); 110 113 111 114 #ifdef CONFIG_SMP … … 153 156 154 157 #if (defined(CONFIG_FB) || defined(CONFIG_EGA)) 155 bool vesa= false;158 bool bfb = false; 156 159 #endif 157 160 158 161 #ifdef CONFIG_FB 159 vesa = vesa_init();162 bfb = bfb_init(); 160 163 #endif 161 164 162 165 #ifdef CONFIG_EGA 163 if (! vesa) {166 if (!bfb) { 164 167 outdev_t *egadev = ega_init(EGA_BASE, EGA_VIDEORAM); 165 168 if (egadev) -
kernel/arch/amd64/src/boot/memmap.c
rc48f6ab r1f5c9c96 35 35 #include <arch/boot/memmap.h> 36 36 37 uint8_t e820counter = 0 xffU;37 uint8_t e820counter = 0; 38 38 e820memmap_t e820table[MEMMAP_E820_MAX_RECORDS]; 39 39 -
kernel/arch/amd64/src/boot/multiboot.S
rc48f6ab r1f5c9c96 30 30 31 31 #include <arch/boot/boot.h> 32 #include <arch/boot/memmap.h>33 32 #include <arch/mm/page.h> 34 33 #include <arch/mm/ptl.h> 35 34 #include <arch/pm.h> 35 #include <genarch/multiboot/multiboot.h> 36 #include <arch/cpuid.h> 36 37 #include <arch/cpu.h> 37 #include <arch/cpuid.h>38 38 39 39 #define START_STACK (BOOT_OFFSET - BOOT_STACK_SIZE) … … 101 101 multiboot_meeting_point: 102 102 103 /* Save GRUB arguments */ 104 movl %eax, grub_eax 105 movl %ebx, grub_ebx 103 /* 104 * Protected 32-bit. We want to reuse the code-seg descriptor, 105 * the Default operand size must not be 1 when entering long mode. 106 */ 107 108 /* Save multiboot arguments */ 109 movl %eax, multiboot_eax 110 movl %ebx, multiboot_ebx 106 111 107 112 pm_status $status_prot … … 149 154 150 155 #include "vesa_prot.inc" 151 152 /*153 * Protected 32-bit. We want to reuse the code-seg descriptor,154 * the Default operand size must not be 1 when entering long mode.155 */156 156 157 157 pm2_status $status_prot2 … … 422 422 long_status $status_long 423 423 424 /* Call arch_pre_main( grub_eax, grub_ebx) */424 /* Call arch_pre_main(multiboot_eax, multiboot_ebx) */ 425 425 xorq %rdi, %rdi 426 movl grub_eax, %edi426 movl multiboot_eax, %edi 427 427 xorq %rsi, %rsi 428 movl grub_ebx, %esi428 movl multiboot_ebx, %esi 429 429 430 430 movabsq $arch_pre_main, %rax … … 645 645 .section K_DATA_START, "aw", @progbits 646 646 647 .global bootstrap_gdtr 647 648 bootstrap_gdtr: 648 649 .word GDT_SELECTOR(GDT_ITEMS) 649 650 .long KA2PA(gdt) 650 651 651 grub_eax: 652 .global multiboot_eax 653 multiboot_eax: 652 654 .long 0 653 655 654 grub_ebx: 656 .global multiboot_ebx 657 multiboot_ebx: 655 658 .long 0 656 659 … … 670 673 status_vesa_copy: 671 674 .asciz "[vesa_copy] " 672 status_ grub_cmdline:673 .asciz "[ grub_cmdline] "675 status_multiboot_cmdline: 676 .asciz "[multiboot_cmdline] " 674 677 status_vesa_real: 675 678 .asciz "[vesa_real] " -
kernel/arch/ia32/Makefile.inc
rc48f6ab r1f5c9c96 106 106 arch/$(KARCH)/src/drivers/i8254.c \ 107 107 arch/$(KARCH)/src/drivers/i8259.c \ 108 arch/$(KARCH)/src/ drivers/vesa.c\109 arch/$(KARCH)/src/boot/ boot.S \108 arch/$(KARCH)/src/boot/multiboot.S \ 109 arch/$(KARCH)/src/boot/multiboot2.S \ 110 110 arch/$(KARCH)/src/boot/memmap.c \ 111 111 arch/$(KARCH)/src/fpu_context.c \ -
kernel/arch/ia32/include/arch.h
rc48f6ab r1f5c9c96 36 36 #define KERN_ia32_ARCH_H_ 37 37 38 #include < genarch/multiboot/multiboot.h>38 #include <typedefs.h> 39 39 40 extern void arch_pre_main(uint32_t, const multiboot_info_t*);40 extern void arch_pre_main(uint32_t, void *); 41 41 42 42 #endif -
kernel/arch/ia32/include/boot/boot.h
rc48f6ab r1f5c9c96 40 40 #define BOOT_STACK_SIZE 0x0400 41 41 42 #define MULTIBOOT_HEADER_MAGIC 0x1BADB00243 #define MULTIBOOT_HEADER_FLAGS 0x0001000344 45 #define MULTIBOOT_LOADER_MAGIC 0x2BADB00246 47 42 #ifndef __ASM__ 48 43 -
kernel/arch/ia32/src/boot/memmap.c
rc48f6ab r1f5c9c96 35 35 #include <arch/boot/memmap.h> 36 36 37 uint8_t e820counter = 0 xffU;37 uint8_t e820counter = 0; 38 38 e820memmap_t e820table[MEMMAP_E820_MAX_RECORDS]; 39 39 -
kernel/arch/ia32/src/boot/multiboot.S
rc48f6ab r1f5c9c96 30 30 31 31 #include <arch/boot/boot.h> 32 #include <arch/boot/memmap.h>33 32 #include <arch/mm/page.h> 34 33 #include <arch/pm.h> 34 #include <genarch/multiboot/multiboot.h> 35 35 #include <arch/cpuid.h> 36 36 … … 92 92 multiboot_meeting_point: 93 93 94 /* Save GRUBarguments */95 movl %eax, grub_eax96 movl %ebx, grub_ebx94 /* Save multiboot arguments */ 95 movl %eax, multiboot_eax 96 movl %ebx, multiboot_ebx 97 97 98 98 pm_status $status_prot … … 135 135 pm2_status $status_prot3 136 136 137 /* Call arch_pre_main( grub_eax, grub_ebx) */138 pushl grub_ebx139 pushl grub_eax137 /* Call arch_pre_main(multiboot_eax, multiboot_ebx) */ 138 pushl multiboot_ebx 139 pushl multiboot_eax 140 140 call arch_pre_main 141 141 … … 196 196 * 197 197 */ 198 .global map_kernel_non_pse 198 199 map_kernel_non_pse: 199 200 /* Paging features */ … … 299 300 find_mem_for_pt: 300 301 /* Check if multiboot info is present */ 301 cmpl $MULTIBOOT_LOADER_MAGIC, grub_eax302 cmpl $MULTIBOOT_LOADER_MAGIC, multiboot_eax 302 303 je check_multiboot_map 303 304 … … 307 308 308 309 /* Copy address of the multiboot info to ebx */ 309 movl grub_ebx, %ebx310 movl multiboot_ebx, %ebx 310 311 311 312 /* Check if memory map flag is present */ … … 701 702 .space 4096, 0 702 703 704 .global bootstrap_gdtr 703 705 bootstrap_gdtr: 704 706 .word GDT_SELECTOR(GDT_ITEMS) 705 707 .long KA2PA(gdt) 706 708 707 grub_eax: 709 .global multiboot_eax 710 multiboot_eax: 708 711 .long 0 709 grub_ebx: 712 713 .global multiboot_ebx 714 multiboot_ebx: 710 715 .long 0 711 716 … … 725 730 status_vesa_copy: 726 731 .asciz "[vesa_copy] " 727 status_ grub_cmdline:728 .asciz "[ grub_cmdline] "732 status_multiboot_cmdline: 733 .asciz "[multiboot_cmdline] " 729 734 status_vesa_real: 730 735 .asciz "[vesa_real] " -
kernel/arch/ia32/src/boot/vesa_prot.inc
rc48f6ab r1f5c9c96 1 1 #ifdef CONFIG_FB 2 2 3 #define MULTIBOOT_LOADER_MAGIC 0x2BADB0024 3 #define MBINFO_BIT_CMDLINE 2 5 4 #define MBINFO_OFFSET_CMDLINE 16 … … 14 13 rep movsb 15 14 16 /* Check for GRUBcommand line */15 /* Check for multiboot command line */ 17 16 18 pm_status $status_ grub_cmdline17 pm_status $status_multiboot_cmdline 19 18 20 mov grub_eax, %eax19 mov multiboot_eax, %eax 21 20 cmp $MULTIBOOT_LOADER_MAGIC, %eax 22 21 jne no_cmdline 23 22 24 mov grub_ebx, %ebx23 mov multiboot_ebx, %ebx 25 24 mov (%ebx), %eax 26 25 bt $MBINFO_BIT_CMDLINE, %eax … … 89 88 /* Returned back to protected mode */ 90 89 91 mov %ax, KA2PA(vesa_scanline) 90 movzx %ax, %ecx 91 mov %ecx, KA2PA(bfb_scanline) 92 92 93 shr $16, %eax 93 mov %ax, KA2PA( vesa_bpp)94 mov %ax, KA2PA(bfb_bpp) 94 95 95 mov %bx, KA2PA(vesa_height) 96 movzx %bx, %ecx 97 mov %ecx, KA2PA(bfb_height) 98 96 99 shr $16, %ebx 97 mov % bx, KA2PA(vesa_width)100 mov %ebx, KA2PA(bfb_width) 98 101 99 mov %dl, KA2PA(vesa_green_pos) 102 mov %dl, KA2PA(bfb_green_pos) 103 100 104 shr $8, %edx 101 mov %dl, KA2PA(vesa_green_mask) 105 mov %dl, KA2PA(bfb_green_size) 106 102 107 shr $8, %edx 103 mov %dl, KA2PA(vesa_red_pos) 108 mov %dl, KA2PA(bfb_red_pos) 109 104 110 shr $8, %edx 105 mov %dl, KA2PA( vesa_red_mask)111 mov %dl, KA2PA(bfb_red_size) 106 112 107 113 mov %esi, %edx 108 mov %dl, KA2PA(vesa_blue_pos) 114 mov %dl, KA2PA(bfb_blue_pos) 115 109 116 shr $8, %edx 110 mov %dl, KA2PA( vesa_blue_mask)117 mov %dl, KA2PA(bfb_blue_size) 111 118 112 mov %edi, KA2PA( vesa_ph_addr)119 mov %edi, KA2PA(bfb_addr) 113 120 #endif -
kernel/arch/ia32/src/boot/vesa_real.inc
rc48f6ab r1f5c9c96 304 304 /* 305 305 * Store mode parameters: 306 * eax = bpp[ 8] scanline[16]306 * eax = bpp[16] scanline[16] 307 307 * ebx = width[16] height[16] 308 308 * edx = red_mask[8] red_pos[8] green_mask[8] green_pos[8] … … 328 328 shl $8, %edx 329 329 mov VESA_MODE_RED_POS_OFFSET(%di), %dl 330 330 331 shl $8, %edx 331 332 mov VESA_MODE_GREEN_MASK_OFFSET(%di), %dl … … 369 370 mov $0x0003, %ax 370 371 int $0x10 372 373 xor %eax, %eax 374 xor %ebx, %ebx 375 xor %edx, %edx 371 376 mov $0xffffffff, %edi 372 xor %ax, %ax377 373 378 jz vesa_leave_real /* force relative jump */ 374 379 … … 386 391 387 392 default_mode: 388 .ascii STRING(CONFIG_ VESA_MODE)393 .ascii STRING(CONFIG_BFB_MODE) 389 394 .ascii "-" 390 .asciz STRING(CONFIG_ VESA_BPP)395 .asciz STRING(CONFIG_BFB_BPP) 391 396 .fill 24 392 397 -
kernel/arch/ia32/src/ia32.c
rc48f6ab r1f5c9c96 42 42 43 43 #include <genarch/multiboot/multiboot.h> 44 #include <genarch/multiboot/multiboot2.h> 44 45 #include <genarch/drivers/legacy/ia32/io.h> 45 46 #include <genarch/drivers/ega/ega.h> 46 #include < arch/drivers/vesa.h>47 #include <genarch/fb/bfb.h> 47 48 #include <genarch/drivers/i8042/i8042.h> 48 49 #include <genarch/kbrd/kbrd.h> … … 76 77 /** Perform ia32-specific initialization before main_bsp() is called. 77 78 * 78 * @param signature Should contain the multiboot signature. 79 * @param mi Pointer to the multiboot information structure. 80 */ 81 void arch_pre_main(uint32_t signature, const multiboot_info_t *mi) 79 * @param signature Multiboot signature. 80 * @param info Multiboot information structure. 81 * 82 */ 83 void arch_pre_main(uint32_t signature, void *info) 82 84 { 83 85 /* Parse multiboot information obtained from the bootloader. */ 84 multiboot_info_parse(signature, mi); 86 multiboot_info_parse(signature, (multiboot_info_t *) info); 87 multiboot2_info_parse(signature, (multiboot2_info_t *) info); 85 88 86 89 #ifdef CONFIG_SMP … … 114 117 115 118 #if (defined(CONFIG_FB) || defined(CONFIG_EGA)) 116 bool vesa= false;119 bool bfb = false; 117 120 #endif 118 121 119 122 #ifdef CONFIG_FB 120 vesa = vesa_init();123 bfb = bfb_init(); 121 124 #endif 122 125 123 126 #ifdef CONFIG_EGA 124 if (! vesa) {127 if (!bfb) { 125 128 outdev_t *egadev = ega_init(EGA_BASE, EGA_VIDEORAM); 126 129 if (egadev) -
kernel/genarch/Makefile.inc
rc48f6ab r1f5c9c96 67 67 genarch/src/fb/font-8x16.c \ 68 68 genarch/src/fb/logo-196x66.c \ 69 genarch/src/fb/fb.c 69 genarch/src/fb/fb.c \ 70 genarch/src/fb/bfb.c 70 71 endif 71 72 … … 143 144 ifeq ($(CONFIG_MULTIBOOT), y) 144 145 GENARCH_SOURCES += \ 145 genarch/src/multiboot/multiboot.c 146 genarch/src/multiboot/multiboot.c \ 147 genarch/src/multiboot/multiboot2.c 146 148 endif 147 149 -
kernel/genarch/include/fb/bfb.h
rc48f6ab r1f5c9c96 27 27 */ 28 28 29 /** @addtogroup ia3229 /** @addtogroup genarch 30 30 * @{ 31 31 */ … … 33 33 */ 34 34 35 #ifndef KERN_ ia32_VESA_H_36 #define KERN_ ia32_VESA_H_35 #ifndef KERN_BFB_H_ 36 #define KERN_BFB_H_ 37 37 38 38 #include <typedefs.h> 39 39 40 extern bool vesa_init(void); 40 extern uintptr_t bfb_addr; 41 extern uint32_t bfb_width; 42 extern uint32_t bfb_height; 43 extern uint16_t bfb_bpp; 44 extern uint32_t bfb_scanline; 45 46 extern uint8_t bfb_red_pos; 47 extern uint8_t bfb_red_size; 48 49 extern uint8_t bfb_green_pos; 50 extern uint8_t bfb_green_size; 51 52 extern uint8_t bfb_blue_pos; 53 extern uint8_t bfb_blue_size; 54 55 extern bool bfb_init(void); 41 56 42 57 #endif -
kernel/genarch/include/multiboot/multiboot.h
rc48f6ab r1f5c9c96 36 36 #define KERN_MULTIBOOT_H_ 37 37 38 #define MULTIBOOT_HEADER_MAGIC 0x1badb002 39 #define MULTIBOOT_HEADER_FLAGS 0x00010003 40 41 #define MULTIBOOT_LOADER_MAGIC 0x2badb002 42 43 #ifndef __ASM__ 44 38 45 #include <typedefs.h> 39 46 #include <arch/boot/memmap.h> 47 48 /** Convert 32-bit multiboot address to a pointer. */ 49 #define MULTIBOOT_PTR(mba) ((void *) (uintptr_t) (mba)) 40 50 41 51 /** Multiboot 32-bit address. */ 42 52 typedef uint32_t mbaddr_t; 43 53 44 /** Multiboot mod structure */54 /** Multiboot module structure */ 45 55 typedef struct { 46 56 mbaddr_t start; … … 48 58 mbaddr_t string; 49 59 uint32_t reserved; 50 } __attribute__ ((packed)) multiboot_mod_t;60 } __attribute__((packed)) multiboot_module_t; 51 61 52 62 /** Multiboot mmap structure */ … … 54 64 uint32_t size; 55 65 e820memmap_t mm_info; 56 } __attribute__ ((packed)) multiboot_mmap_t;66 } __attribute__((packed)) multiboot_memmap_t; 57 67 58 68 /** Multiboot information structure */ … … 74 84 75 85 /* ... */ 76 } __attribute__ 86 } __attribute__((packed)) multiboot_info_t; 77 87 78 88 enum multiboot_info_flags { 79 M BINFO_FLAGS_MEM = 0x01,80 M BINFO_FLAGS_BOOT = 0x02,81 M BINFO_FLAGS_CMDLINE = 0x04,82 M BINFO_FLAGS_MODS = 0x08,83 M BINFO_FLAGS_SYMS1 = 0x10,84 M BINFO_FLAGS_SYMS2 = 0x20,85 M BINFO_FLAGS_MMAP = 0x4089 MULTIBOOT_INFO_FLAGS_MEM = 0x01, 90 MULTIBOOT_INFO_FLAGS_BOOT = 0x02, 91 MULTIBOOT_INFO_FLAGS_CMDLINE = 0x04, 92 MULTIBOOT_INFO_FLAGS_MODS = 0x08, 93 MULTIBOOT_INFO_FLAGS_SYMS1 = 0x10, 94 MULTIBOOT_INFO_FLAGS_SYMS2 = 0x20, 95 MULTIBOOT_INFO_FLAGS_MMAP = 0x40 86 96 87 97 /* ... */ 88 98 }; 89 99 90 #define MULTIBOOT_LOADER_MAGIC 0x2BADB002 100 extern void multiboot_extract_command(char *, size_t, const char *); 101 extern void multiboot_info_parse(uint32_t, const multiboot_info_t *); 91 102 92 /** Convert 32-bit multiboot address to a pointer. */ 93 #define MULTIBOOT_PTR(mba) ((void *)(uintptr_t) (mba)) 94 95 extern void multiboot_info_parse(uint32_t, const multiboot_info_t *); 103 #endif /* __ASM__ */ 96 104 97 105 #endif -
kernel/genarch/src/fb/bfb.c
rc48f6ab r1f5c9c96 27 27 */ 28 28 29 /** @addtogroup ia3229 /** @addtogroup genarch 30 30 * @{ 31 31 */ 32 32 /** 33 33 * @file 34 * @brief VESA framebuffer driver.34 * @brief Boot framebuffer driver. 35 35 */ 36 36 37 #ifdef CONFIG_FB 37 #include <typedefs.h> 38 #include <genarch/fb/fb.h> 39 #include <genarch/fb/bfb.h> 40 #include <console/console.h> 38 41 39 #include <genarch/fb/fb.h> 40 #include <arch/drivers/vesa.h> 41 #include <console/chardev.h> 42 #include <console/console.h> 43 #include <putchar.h> 44 #include <mm/page.h> 45 #include <mm/frame.h> 46 #include <mm/as.h> 47 #include <arch/mm/page.h> 48 #include <synch/spinlock.h> 49 #include <arch/asm.h> 50 #include <typedefs.h> 51 #include <memstr.h> 52 #include <bitops.h> 42 uintptr_t bfb_addr = (uintptr_t) -1; 43 uint32_t bfb_width = 0; 44 uint32_t bfb_height = 0; 45 uint16_t bfb_bpp = 0; 46 uint32_t bfb_scanline = 0; 53 47 54 uint32_t vesa_ph_addr; 55 uint16_t vesa_width; 56 uint16_t vesa_height; 57 uint16_t vesa_bpp; 58 uint16_t vesa_scanline; 48 uint8_t bfb_red_pos = 0; 49 uint8_t bfb_red_size = 0; 59 50 60 uint8_t vesa_red_mask;61 uint8_t vesa_red_pos;51 uint8_t bfb_green_pos = 0; 52 uint8_t bfb_green_size = 0; 62 53 63 uint8_t vesa_green_mask;64 uint8_t vesa_green_pos;54 uint8_t bfb_blue_pos = 0; 55 uint8_t bfb_blue_size = 0; 65 56 66 uint8_t vesa_blue_mask; 67 uint8_t vesa_blue_pos; 68 69 bool vesa_init(void) 57 bool bfb_init(void) 70 58 { 71 if (( vesa_width == 0xffffU) || (vesa_height == 0xffffU))59 if ((bfb_width == 0) || (bfb_height == 0)) 72 60 return false; 73 61 74 visual_t visual; 62 fb_properties_t bfb_props = { 63 .addr = bfb_addr, 64 .offset = 0, 65 .x = bfb_width, 66 .y = bfb_height, 67 .scan = bfb_scanline 68 }; 75 69 76 switch ( vesa_bpp) {70 switch (bfb_bpp) { 77 71 case 8: 78 visual = VISUAL_INDIRECT_8;72 bfb_props.visual = VISUAL_INDIRECT_8; 79 73 break; 80 74 case 16: 81 if (( vesa_red_mask == 5) && (vesa_red_pos == 10)82 && (vesa_green_mask == 5) && (vesa_green_pos == 5)83 && (vesa_blue_mask == 5) && (vesa_blue_pos == 0))84 visual = VISUAL_RGB_5_5_5_LE;75 if ((bfb_red_pos == 10) && (bfb_red_size == 5) && 76 (bfb_green_pos == 5) && (bfb_green_size == 5) && 77 (bfb_blue_pos == 0) && (bfb_blue_size == 5)) 78 bfb_props.visual = VISUAL_RGB_5_5_5_LE; 85 79 else 86 visual = VISUAL_RGB_5_6_5_LE;80 bfb_props.visual = VISUAL_RGB_5_6_5_LE; 87 81 break; 88 82 case 24: 89 visual = VISUAL_BGR_8_8_8;83 bfb_props.visual = VISUAL_BGR_8_8_8; 90 84 break; 91 85 case 32: 92 visual = VISUAL_BGR_8_8_8_0;86 bfb_props.visual = VISUAL_BGR_8_8_8_0; 93 87 break; 94 88 default: … … 97 91 } 98 92 99 fb_properties_t vesa_props = { 100 .addr = vesa_ph_addr, 101 .offset = 0, 102 .x = vesa_width, 103 .y = vesa_height, 104 .scan = vesa_scanline, 105 .visual = visual, 106 }; 107 108 outdev_t *fbdev = fb_init(&vesa_props); 93 outdev_t *fbdev = fb_init(&bfb_props); 109 94 if (!fbdev) 110 95 return false; … … 114 99 } 115 100 116 #endif117 118 101 /** @} 119 102 */ -
kernel/genarch/src/multiboot/multiboot.c
rc48f6ab r1f5c9c96 33 33 */ 34 34 35 #include <typedefs.h> 35 36 #include <genarch/multiboot/multiboot.h> 36 #include <typedefs.h>37 37 #include <config.h> 38 38 #include <str.h> 39 #include <macros.h>40 39 41 40 /** Extract command name from the multiboot module command line. 42 41 * 43 * @param buf Destination buffer (will always NULL-terminate).44 * @param s zSize of destination buffer (in bytes).42 * @param buf Destination buffer (will be always NULL-terminated). 43 * @param size Size of destination buffer (in bytes). 45 44 * @param cmd_line Input string (the command line). 46 45 * 47 46 */ 48 static void extract_command(char *buf, size_t sz, const char *cmd_line)47 void multiboot_extract_command(char *buf, size_t size, const char *cmd_line) 49 48 { 50 49 /* Find the first space. */ … … 69 68 70 69 /* Copy the command. */ 71 str_ncpy(buf, sz, start, (size_t) (end - start)); 70 str_ncpy(buf, size, start, (size_t) (end - start)); 71 } 72 73 static void multiboot_modules(uint32_t count, multiboot_module_t *mods) 74 { 75 for (uint32_t i = 0; i < count; i++) { 76 if (init.cnt >= CONFIG_INIT_TASKS) 77 break; 78 79 init.tasks[init.cnt].addr = PA2KA(mods[i].start); 80 init.tasks[init.cnt].size = mods[i].end - mods[i].start; 81 82 /* Copy command line, if available. */ 83 if (mods[i].string) { 84 multiboot_extract_command(init.tasks[init.cnt].name, 85 CONFIG_TASK_NAME_BUFLEN, MULTIBOOT_PTR(mods[i].string)); 86 } else 87 init.tasks[init.cnt].name[0] = 0; 88 89 init.cnt++; 90 } 91 } 92 93 static void multiboot_memmap(uint32_t length, multiboot_memmap_t *memmap) 94 { 95 uint32_t pos = 0; 96 97 while ((pos < length) && (e820counter < MEMMAP_E820_MAX_RECORDS)) { 98 e820table[e820counter] = memmap->mm_info; 99 100 /* Compute address of next structure. */ 101 uint32_t size = sizeof(memmap->size) + memmap->size; 102 memmap = (multiboot_memmap_t *) ((uintptr_t) memmap + size); 103 pos += size; 104 105 e820counter++; 106 } 72 107 } 73 108 … … 78 113 * 79 114 * @param signature Should contain the multiboot signature. 80 * @param mi Pointer to the multiboot information structure. 115 * @param info Multiboot information structure. 116 * 81 117 */ 82 void multiboot_info_parse(uint32_t signature, const multiboot_info_t * mi)118 void multiboot_info_parse(uint32_t signature, const multiboot_info_t *info) 83 119 { 84 uint32_t flags; 120 if (signature != MULTIBOOT_LOADER_MAGIC) 121 return; 85 122 86 if (signature == MULTIBOOT_LOADER_MAGIC) 87 flags = mi->flags; 88 else { 89 /* No multiboot info available. */ 90 flags = 0; 91 } 92 93 /* Copy module information. */ 94 uint32_t i; 95 if ((flags & MBINFO_FLAGS_MODS) != 0) { 96 init.cnt = min(mi->mods_count, CONFIG_INIT_TASKS); 97 multiboot_mod_t *mods 98 = (multiboot_mod_t *) MULTIBOOT_PTR(mi->mods_addr); 99 100 for (i = 0; i < init.cnt; i++) { 101 init.tasks[i].addr = PA2KA(mods[i].start); 102 init.tasks[i].size = mods[i].end - mods[i].start; 103 104 /* Copy command line, if available. */ 105 if (mods[i].string) { 106 extract_command(init.tasks[i].name, 107 CONFIG_TASK_NAME_BUFLEN, 108 MULTIBOOT_PTR(mods[i].string)); 109 } else 110 init.tasks[i].name[0] = 0; 111 } 112 } else 113 init.cnt = 0; 123 /* Copy modules information. */ 124 if ((info->flags & MULTIBOOT_INFO_FLAGS_MODS) != 0) 125 multiboot_modules(info->mods_count, 126 (multiboot_module_t *) MULTIBOOT_PTR(info->mods_addr)); 114 127 115 128 /* Copy memory map. */ 116 117 if ((flags & MBINFO_FLAGS_MMAP) != 0) { 118 int32_t mmap_length = mi->mmap_length; 119 multiboot_mmap_t *mme = MULTIBOOT_PTR(mi->mmap_addr); 120 e820counter = 0; 121 122 i = 0; 123 while ((mmap_length > 0) && (i < MEMMAP_E820_MAX_RECORDS)) { 124 e820table[i++] = mme->mm_info; 125 126 /* Compute address of next structure. */ 127 uint32_t size = sizeof(mme->size) + mme->size; 128 mme = ((void *) mme) + size; 129 mmap_length -= size; 130 } 131 132 e820counter = i; 133 } else 134 e820counter = 0; 129 if ((info->flags & MULTIBOOT_INFO_FLAGS_MMAP) != 0) 130 multiboot_memmap(info->mmap_length, 131 (multiboot_memmap_t *) MULTIBOOT_PTR(info->mmap_addr)); 135 132 } 136 133 -
tools/config.py
rc48f6ab r1f5c9c96 85 85 if ctype == 'cnf': 86 86 return True 87 87 88 return False 88 89 … … 242 243 243 244 default = get_default_rule(rule) 244 245 245 246 # 246 247 # If we don't have a value but we do have … … 344 345 return True 345 346 347 def preprocess_config(config, rules): 348 "Preprocess configuration" 349 350 varname_mode = 'CONFIG_BFB_MODE' 351 varname_width = 'CONFIG_BFB_WIDTH' 352 varname_height = 'CONFIG_BFB_HEIGHT' 353 354 if varname_mode in config: 355 mode = config[varname_mode].partition('x') 356 357 config[varname_width] = mode[0] 358 rules.append((varname_width, 'choice', 'Default framebuffer width', None, None)) 359 360 config[varname_height] = mode[2] 361 rules.append((varname_height, 'choice', 'Default framebuffer height', None, None)) 362 346 363 def create_output(mkname, mcname, config, rules): 347 364 "Create output configuration" … … 504 521 if (len(sys.argv) >= 3) and (sys.argv[2] == 'default'): 505 522 if (infer_verify_choices(config, rules)): 523 preprocess_config(config, rules) 506 524 create_output(MAKEFILE, MACROS, config, rules) 507 525 return 0 … … 517 535 518 536 if (infer_verify_choices(config, rules)): 537 preprocess_config(config, rules) 519 538 create_output(MAKEFILE, MACROS, config, rules) 520 539 return 0 … … 564 583 565 584 default = get_default_rule(rule) 566 585 567 586 # 568 587 # If we don't have a value but we do have … … 626 645 xtui.screen_done(screen) 627 646 647 preprocess_config(config, rules) 628 648 create_output(MAKEFILE, MACROS, config, rules) 629 649 return 0
Note:
See TracChangeset
for help on using the changeset viewer.