| [1f5c9c96] | 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 |
|
|---|
| [8844e70] | 29 | #include <abi/asmtool.h>
|
|---|
| [1f5c9c96] | 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))
|
|---|
| [a35b458] | 45 |
|
|---|
| [1f5c9c96] | 46 | /* Information request tag */
|
|---|
| [cfb1217] | 47 | .align 8
|
|---|
| [1f5c9c96] | 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
|
|---|
| [9ef1fade] | 52 | .long MULTIBOOT2_TAG_CMDLINE
|
|---|
| [1f5c9c96] | 53 | .long MULTIBOOT2_TAG_MODULE
|
|---|
| 54 | .long MULTIBOOT2_TAG_MEMMAP
|
|---|
| [40898df] | 55 | #ifdef CONFIG_FB
|
|---|
| [1f5c9c96] | 56 | .long MULTIBOOT2_TAG_FBINFO
|
|---|
| [40898df] | 57 | #endif
|
|---|
| [1f5c9c96] | 58 | tag_info_req_end:
|
|---|
| [a35b458] | 59 |
|
|---|
| [1f5c9c96] | 60 | /* Flags tag */
|
|---|
| [cfb1217] | 61 | .align 8
|
|---|
| [1f5c9c96] | 62 | tag_flags_start:
|
|---|
| 63 | .word MULTIBOOT2_TAG_FLAGS
|
|---|
| 64 | .word MULTIBOOT2_FLAGS_REQUIRED
|
|---|
| 65 | .long tag_flags_end - tag_flags_start
|
|---|
| 66 | .long MULTIBOOT2_FLAGS_CONSOLE
|
|---|
| 67 | tag_flags_end:
|
|---|
| [a35b458] | 68 |
|
|---|
| [40898df] | 69 | #ifdef CONFIG_FB
|
|---|
| [1f5c9c96] | 70 | /* Framebuffer tag */
|
|---|
| [cfb1217] | 71 | .align 8
|
|---|
| [1f5c9c96] | 72 | tag_framebuffer_start:
|
|---|
| 73 | .word MULTIBOOT2_TAG_FRAMEBUFFER
|
|---|
| 74 | .word MULTIBOOT2_FLAGS_REQUIRED
|
|---|
| 75 | .long tag_framebuffer_end - tag_framebuffer_start
|
|---|
| 76 | .long CONFIG_BFB_WIDTH
|
|---|
| 77 | .long CONFIG_BFB_HEIGHT
|
|---|
| 78 | .long CONFIG_BFB_BPP
|
|---|
| 79 | tag_framebuffer_end:
|
|---|
| [40898df] | 80 | #endif
|
|---|
| [a35b458] | 81 |
|
|---|
| [1f5c9c96] | 82 | /* Module alignment tag */
|
|---|
| [cfb1217] | 83 | .align 8
|
|---|
| [1f5c9c96] | 84 | tag_module_align_start:
|
|---|
| 85 | .word MULTIBOOT2_TAG_MODULE_ALIGN
|
|---|
| 86 | .word MULTIBOOT2_FLAGS_REQUIRED
|
|---|
| 87 | .long tag_module_align_end - tag_module_align_start
|
|---|
| 88 | .long 0
|
|---|
| 89 | tag_module_align_end:
|
|---|
| [a35b458] | 90 |
|
|---|
| [1f5c9c96] | 91 | /* Tag terminator */
|
|---|
| [cfb1217] | 92 | .align 8
|
|---|
| [1f5c9c96] | 93 | tag_terminator_start:
|
|---|
| 94 | .word MULTIBOOT2_TAG_TERMINATOR
|
|---|
| 95 | .word MULTIBOOT2_FLAGS_REQUIRED
|
|---|
| 96 | .long tag_terminator_end - tag_terminator_start
|
|---|
| 97 | tag_terminator_end:
|
|---|
| 98 | multiboot2_header_end:
|
|---|