Changeset 1f5c9c96 in mainline for kernel/arch/ia32/src


Ignore:
Timestamp:
2011-12-02T17:29:43Z (14 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b8b1e631, c3887ad
Parents:
c48f6ab
Message:

implement multiboot v2 specification and use it in GRUB for UEFI

  • improve multiboot v1 code, move defines to a common location
  • rename VESA framebuffer stuff to generic "boot framebuffer"
  • small collateral changes
Location:
kernel/arch/ia32/src
Files:
1 added
4 edited
1 moved

Legend:

Unmodified
Added
Removed
  • kernel/arch/ia32/src/boot/memmap.c

    rc48f6ab r1f5c9c96  
    3535#include <arch/boot/memmap.h>
    3636
    37 uint8_t e820counter = 0xffU;
     37uint8_t e820counter = 0;
    3838e820memmap_t e820table[MEMMAP_E820_MAX_RECORDS];
    3939
  • kernel/arch/ia32/src/boot/multiboot.S

    rc48f6ab r1f5c9c96  
    3030
    3131#include <arch/boot/boot.h>
    32 #include <arch/boot/memmap.h>
    3332#include <arch/mm/page.h>
    3433#include <arch/pm.h>
     34#include <genarch/multiboot/multiboot.h>
    3535#include <arch/cpuid.h>
    3636
     
    9292        multiboot_meeting_point:
    9393       
    94         /* Save GRUB arguments */
    95         movl %eax, grub_eax
    96         movl %ebx, grub_ebx
     94        /* Save multiboot arguments */
     95        movl %eax, multiboot_eax
     96        movl %ebx, multiboot_ebx
    9797       
    9898        pm_status $status_prot
     
    135135        pm2_status $status_prot3
    136136       
    137         /* Call arch_pre_main(grub_eax, grub_ebx) */
    138         pushl grub_ebx
    139         pushl grub_eax
     137        /* Call arch_pre_main(multiboot_eax, multiboot_ebx) */
     138        pushl multiboot_ebx
     139        pushl multiboot_eax
    140140        call arch_pre_main
    141141       
     
    196196 *
    197197 */
     198.global map_kernel_non_pse
    198199map_kernel_non_pse:
    199200        /* Paging features */
     
    299300find_mem_for_pt:
    300301        /* Check if multiboot info is present */
    301         cmpl $MULTIBOOT_LOADER_MAGIC, grub_eax
     302        cmpl $MULTIBOOT_LOADER_MAGIC, multiboot_eax
    302303        je check_multiboot_map
    303304               
     
    307308               
    308309                /* Copy address of the multiboot info to ebx */
    309                 movl grub_ebx, %ebx
     310                movl multiboot_ebx, %ebx
    310311               
    311312                /* Check if memory map flag is present */
     
    701702        .space 4096, 0
    702703
     704.global bootstrap_gdtr
    703705bootstrap_gdtr:
    704706        .word GDT_SELECTOR(GDT_ITEMS)
    705707        .long KA2PA(gdt)
    706708
    707 grub_eax:
     709.global multiboot_eax
     710multiboot_eax:
    708711        .long 0
    709 grub_ebx:
     712
     713.global multiboot_ebx
     714multiboot_ebx:
    710715        .long 0
    711716
     
    725730status_vesa_copy:
    726731        .asciz "[vesa_copy] "
    727 status_grub_cmdline:
    728         .asciz "[grub_cmdline] "
     732status_multiboot_cmdline:
     733        .asciz "[multiboot_cmdline] "
    729734status_vesa_real:
    730735        .asciz "[vesa_real] "
  • kernel/arch/ia32/src/boot/vesa_prot.inc

    rc48f6ab r1f5c9c96  
    11#ifdef CONFIG_FB
    22
    3 #define MULTIBOOT_LOADER_MAGIC  0x2BADB002
    43#define MBINFO_BIT_CMDLINE      2
    54#define MBINFO_OFFSET_CMDLINE   16
     
    1413        rep movsb
    1514       
    16         /* Check for GRUB command line */
     15        /* Check for multiboot command line */
    1716       
    18         pm_status $status_grub_cmdline
     17        pm_status $status_multiboot_cmdline
    1918       
    20         mov grub_eax, %eax
     19        mov multiboot_eax, %eax
    2120        cmp $MULTIBOOT_LOADER_MAGIC, %eax
    2221        jne no_cmdline
    2322       
    24         mov grub_ebx, %ebx
     23        mov multiboot_ebx, %ebx
    2524        mov (%ebx), %eax
    2625        bt $MBINFO_BIT_CMDLINE, %eax
     
    8988                /* Returned back to protected mode */
    9089               
    91                 mov %ax, KA2PA(vesa_scanline)
     90                movzx %ax, %ecx
     91                mov %ecx, KA2PA(bfb_scanline)
     92               
    9293                shr $16, %eax
    93                 mov %ax, KA2PA(vesa_bpp)
     94                mov %ax, KA2PA(bfb_bpp)
    9495               
    95                 mov %bx, KA2PA(vesa_height)
     96                movzx %bx, %ecx
     97                mov %ecx, KA2PA(bfb_height)
     98               
    9699                shr $16, %ebx
    97                 mov %bx, KA2PA(vesa_width)
     100                mov %ebx, KA2PA(bfb_width)
    98101               
    99                 mov %dl, KA2PA(vesa_green_pos)
     102                mov %dl, KA2PA(bfb_green_pos)
     103               
    100104                shr $8, %edx
    101                 mov %dl, KA2PA(vesa_green_mask)
     105                mov %dl, KA2PA(bfb_green_size)
     106               
    102107                shr $8, %edx
    103                 mov %dl, KA2PA(vesa_red_pos)
     108                mov %dl, KA2PA(bfb_red_pos)
     109               
    104110                shr $8, %edx
    105                 mov %dl, KA2PA(vesa_red_mask)
     111                mov %dl, KA2PA(bfb_red_size)
    106112               
    107113                mov %esi, %edx
    108                 mov %dl, KA2PA(vesa_blue_pos)
     114                mov %dl, KA2PA(bfb_blue_pos)
     115               
    109116                shr $8, %edx
    110                 mov %dl, KA2PA(vesa_blue_mask)
     117                mov %dl, KA2PA(bfb_blue_size)
    111118               
    112                 mov %edi, KA2PA(vesa_ph_addr)
     119                mov %edi, KA2PA(bfb_addr)
    113120#endif
  • kernel/arch/ia32/src/boot/vesa_real.inc

    rc48f6ab r1f5c9c96  
    304304                /*
    305305                 * Store mode parameters:
    306                  *  eax = bpp[8] scanline[16]
     306                 *  eax = bpp[16] scanline[16]
    307307                 *  ebx = width[16]  height[16]
    308308                 *  edx = red_mask[8] red_pos[8] green_mask[8] green_pos[8]
     
    328328                shl $8, %edx
    329329                mov VESA_MODE_RED_POS_OFFSET(%di), %dl
     330               
    330331                shl $8, %edx
    331332                mov VESA_MODE_GREEN_MASK_OFFSET(%di), %dl
     
    369370                mov $0x0003, %ax
    370371                int $0x10
     372               
     373                xor %eax, %eax
     374                xor %ebx, %ebx
     375                xor %edx, %edx
    371376                mov $0xffffffff, %edi
    372                 xor %ax, %ax
     377               
    373378                jz vesa_leave_real  /* force relative jump */
    374379
     
    386391
    387392default_mode:
    388         .ascii STRING(CONFIG_VESA_MODE)
     393        .ascii STRING(CONFIG_BFB_MODE)
    389394        .ascii "-"
    390         .asciz STRING(CONFIG_VESA_BPP)
     395        .asciz STRING(CONFIG_BFB_BPP)
    391396        .fill 24
    392397
  • kernel/arch/ia32/src/ia32.c

    rc48f6ab r1f5c9c96  
    4242
    4343#include <genarch/multiboot/multiboot.h>
     44#include <genarch/multiboot/multiboot2.h>
    4445#include <genarch/drivers/legacy/ia32/io.h>
    4546#include <genarch/drivers/ega/ega.h>
    46 #include <arch/drivers/vesa.h>
     47#include <genarch/fb/bfb.h>
    4748#include <genarch/drivers/i8042/i8042.h>
    4849#include <genarch/kbrd/kbrd.h>
     
    7677/** Perform ia32-specific initialization before main_bsp() is called.
    7778 *
    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 */
     83void arch_pre_main(uint32_t signature, void *info)
    8284{
    8385        /* 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);
    8588       
    8689#ifdef CONFIG_SMP
     
    114117               
    115118#if (defined(CONFIG_FB) || defined(CONFIG_EGA))
    116                 bool vesa = false;
     119                bool bfb = false;
    117120#endif
    118121               
    119122#ifdef CONFIG_FB
    120                 vesa = vesa_init();
     123                bfb = bfb_init();
    121124#endif
    122125               
    123126#ifdef CONFIG_EGA
    124                 if (!vesa) {
     127                if (!bfb) {
    125128                        outdev_t *egadev = ega_init(EGA_BASE, EGA_VIDEORAM);
    126129                        if (egadev)
Note: See TracChangeset for help on using the changeset viewer.