| 1 | /*
|
|---|
| 2 | * Copyright (c) 2011 Martin Decky
|
|---|
| 3 | * All rights reserved.
|
|---|
| 4 | *
|
|---|
| 5 | * Redistribution and use in source and binary forms, with or without
|
|---|
| 6 | * modification, are permitted provided that the following conditions
|
|---|
| 7 | * are met:
|
|---|
| 8 | *
|
|---|
| 9 | * - Redistributions of source code must retain the above copyright
|
|---|
| 10 | * notice, this list of conditions and the following disclaimer.
|
|---|
| 11 | * - Redistributions in binary form must reproduce the above copyright
|
|---|
| 12 | * notice, this list of conditions and the following disclaimer in the
|
|---|
| 13 | * documentation and/or other materials provided with the distribution.
|
|---|
| 14 | * - The name of the author may not be used to endorse or promote products
|
|---|
| 15 | * derived from this software without specific prior written permission.
|
|---|
| 16 | *
|
|---|
| 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|---|
| 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|---|
| 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|---|
| 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|---|
| 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|---|
| 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|---|
| 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|---|
| 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|---|
| 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|---|
| 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|---|
| 27 | */
|
|---|
| 28 |
|
|---|
| 29 | #include <abi/asmtool.h>
|
|---|
| 30 | #include <arch/boot/boot.h>
|
|---|
| 31 | #include <arch/pm.h>
|
|---|
| 32 | #include <arch/cpuid.h>
|
|---|
| 33 | #include <genarch/multiboot/multiboot2.h>
|
|---|
| 34 |
|
|---|
| 35 | .section K_TEXT_START, "ax"
|
|---|
| 36 |
|
|---|
| 37 | .code32
|
|---|
| 38 |
|
|---|
| 39 | .align 8
|
|---|
| 40 | multiboot2_header_start:
|
|---|
| 41 | .long MULTIBOOT2_HEADER_MAGIC
|
|---|
| 42 | .long MULTIBOOT2_HEADER_ARCH_I386
|
|---|
| 43 | .long multiboot2_header_end - multiboot2_header_start
|
|---|
| 44 | .long -(MULTIBOOT2_HEADER_MAGIC + MULTIBOOT2_HEADER_ARCH_I386 + (multiboot2_header_end - multiboot2_header_start))
|
|---|
| 45 |
|
|---|
| 46 | /* Information request tag */
|
|---|
| 47 | .align 8
|
|---|
| 48 | tag_info_req_start:
|
|---|
| 49 | .word MULTIBOOT2_TAG_INFO_REQ
|
|---|
| 50 | .word MULTIBOOT2_FLAGS_REQUIRED
|
|---|
| 51 | .long tag_info_req_end - tag_info_req_start
|
|---|
| 52 | .long MULTIBOOT2_TAG_CMDLINE
|
|---|
| 53 | .long MULTIBOOT2_TAG_MODULE
|
|---|
| 54 | .long MULTIBOOT2_TAG_MEMMAP
|
|---|
| 55 | #ifdef CONFIG_FB
|
|---|
| 56 | .long MULTIBOOT2_TAG_FBINFO
|
|---|
| 57 | #endif
|
|---|
| 58 | tag_info_req_end:
|
|---|
| 59 |
|
|---|
| 60 | /* Address tag */
|
|---|
| 61 | .align 8
|
|---|
| 62 | tag_address_start:
|
|---|
| 63 | .word MULTIBOOT2_TAG_ADDRESS
|
|---|
| 64 | .word MULTIBOOT2_FLAGS_REQUIRED
|
|---|
| 65 | .long tag_address_end - tag_address_start
|
|---|
| 66 | .long multiboot2_header_start
|
|---|
| 67 | .long unmapped_start
|
|---|
| 68 | .long 0
|
|---|
| 69 | .long 0
|
|---|
| 70 | tag_address_end:
|
|---|
| 71 |
|
|---|
| 72 | /* Entry address tag */
|
|---|
| 73 | .align 8
|
|---|
| 74 | tag_entry_address_start:
|
|---|
| 75 | .word MULTIBOOT2_TAG_ENTRY_ADDRESS
|
|---|
| 76 | .word MULTIBOOT2_FLAGS_REQUIRED
|
|---|
| 77 | .long tag_entry_address_end - tag_entry_address_start
|
|---|
| 78 | .long multiboot_image_start
|
|---|
| 79 | tag_entry_address_end:
|
|---|
| 80 |
|
|---|
| 81 | /* Flags tag */
|
|---|
| 82 | .align 8
|
|---|
| 83 | tag_flags_start:
|
|---|
| 84 | .word MULTIBOOT2_TAG_FLAGS
|
|---|
| 85 | .word MULTIBOOT2_FLAGS_REQUIRED
|
|---|
| 86 | .long tag_flags_end - tag_flags_start
|
|---|
| 87 | .long MULTIBOOT2_FLAGS_CONSOLE
|
|---|
| 88 | tag_flags_end:
|
|---|
| 89 |
|
|---|
| 90 | #ifdef CONFIG_FB
|
|---|
| 91 | /* Framebuffer tag */
|
|---|
| 92 | .align 8
|
|---|
| 93 | tag_framebuffer_start:
|
|---|
| 94 | .word MULTIBOOT2_TAG_FRAMEBUFFER
|
|---|
| 95 | .word MULTIBOOT2_FLAGS_REQUIRED
|
|---|
| 96 | .long tag_framebuffer_end - tag_framebuffer_start
|
|---|
| 97 | .long CONFIG_BFB_WIDTH
|
|---|
| 98 | .long CONFIG_BFB_HEIGHT
|
|---|
| 99 | .long CONFIG_BFB_BPP
|
|---|
| 100 | tag_framebuffer_end:
|
|---|
| 101 | #endif
|
|---|
| 102 |
|
|---|
| 103 | /* Module alignment tag */
|
|---|
| 104 | .align 8
|
|---|
| 105 | tag_module_align_start:
|
|---|
| 106 | .word MULTIBOOT2_TAG_MODULE_ALIGN
|
|---|
| 107 | .word MULTIBOOT2_FLAGS_REQUIRED
|
|---|
| 108 | .long tag_module_align_end - tag_module_align_start
|
|---|
| 109 | .long 0
|
|---|
| 110 | tag_module_align_end:
|
|---|
| 111 |
|
|---|
| 112 | /* Tag terminator */
|
|---|
| 113 | .align 8
|
|---|
| 114 | tag_terminator_start:
|
|---|
| 115 | .word MULTIBOOT2_TAG_TERMINATOR
|
|---|
| 116 | .word MULTIBOOT2_FLAGS_REQUIRED
|
|---|
| 117 | .long tag_terminator_end - tag_terminator_start
|
|---|
| 118 | tag_terminator_end:
|
|---|
| 119 | multiboot2_header_end:
|
|---|