- Removed unnecessary casts.
[AROS.git] / arch / all-native / bootconsole / init_multiboot2.c
blob474531164a7cfe5cb9f5a02305fb5efaada409ac
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id: init_multiboot.c 37861 2011-03-28 09:16:54Z sonic $
5 Desc: Parse multiboot data and init console.
6 */
8 #include <aros/macros.h>
9 #include <aros/multiboot2.h>
10 #include <exec/types.h>
12 #include <bootconsole.h>
14 #include "console.h"
16 void con_InitMultiboot2(void *mb)
18 struct mb2_tag *tag;
19 struct mb2_tag_framebuffer_common *fb = NULL;
20 struct mb2_tag_vbe *vbe = NULL;
23 * Iterate all tags and retrieve console information.
24 * If we have command line supplied, we may also have serial console.
25 * The supplied pointer points to an UQUAD value specifying total length of the
26 * whole data array. We just skip it.
27 * Size doesn't include padding needed to align the next tag at 8-byte boundary.
29 for (tag = mb + 8; tag->type != MB2_TAG_END; tag = (void *)tag + AROS_ROUNDUP2(tag->size, 8))
31 switch (tag->type)
33 case MB2_TAG_CMDLINE:
34 con_InitSerial(((struct mb2_tag_string *)tag)->string);
35 break;
37 case MB2_TAG_FRAMEBUFFER:
38 fb = (struct mb2_tag_framebuffer_common *)tag;
39 break;
41 case MB2_TAG_VBE:
42 vbe = (struct mb2_tag_vbe *)tag;
43 break;
47 if (fb)
49 /* Framebuffer was given, use it */
50 scr_FrameBuffer = (void *)fb->framebuffer_addr;
52 switch (fb->framebuffer_type)
54 case MB2_FRAMEBUFFER_TEXT:
55 /* Text framebuffer, size in characters */
56 scr_Width = fb->framebuffer_width;
57 scr_Height = fb->framebuffer_height;
58 scr_Type = SCR_TEXT;
59 txt_Clear();
60 break;
62 default:
63 /* Graphical framebuffer, size in pixels */
64 scr_Type = SCR_GFX;
65 fb_Init(fb->framebuffer_width, fb->framebuffer_height, fb->framebuffer_bpp, fb->framebuffer_pitch);
68 else if (vbe)
69 con_InitVESA(vbe->vbe_control_info.version, &vbe->vbe_mode_info);
70 else
71 /* Fallback to default, VGA text mode */
72 con_InitVGA();