1 /* ----------------------------------------------------------------------- *
3 * Copyright 2009 Erwan Velu - All Rights Reserved
5 * Permission is hereby granted, free of charge, to any person
6 * obtaining a copy of this software and associated documentation
7 * files (the "Software"), to deal in the Software without
8 * restriction, including without limitation the rights to use,
9 * copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom
11 * the Software is furnished to do so, subject to the following
14 * The above copyright notice and this permission notice shall
15 * be included in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24 * OTHER DEALINGS IN THE SOFTWARE.
26 * -----------------------------------------------------------------------
30 #include "hdt-common.h"
36 void main_show_vesa(int argc __unused
, char **argv __unused
,
37 struct s_hardware
*hardware
)
40 if (hardware
->is_vesa_valid
== false) {
41 more_printf("No VESA BIOS detected\n");
44 more_printf("VESA\n");
45 more_printf(" Vesa version : %d.%d\n", hardware
->vesa
.major_version
,
46 hardware
->vesa
.minor_version
);
47 more_printf(" Vendor : %s\n", hardware
->vesa
.vendor
);
48 more_printf(" Product : %s\n", hardware
->vesa
.product
);
49 more_printf(" Product rev. : %s\n", hardware
->vesa
.product_revision
);
50 more_printf(" Software rev.: %d\n", hardware
->vesa
.software_rev
);
51 more_printf(" Memory (KB) : %d\n", hardware
->vesa
.total_memory
* 64);
52 more_printf(" Modes : %d\n", hardware
->vesa
.vmi_count
);
55 static void show_vesa_modes(int argc __unused
, char **argv __unused
,
56 struct s_hardware
*hardware
)
59 if (hardware
->is_vesa_valid
== false) {
60 more_printf("No VESA BIOS detected\n");
63 more_printf(" ResH. x ResV x Bits : vga= : Vesa Mode\n");
64 more_printf("----------------------------------------\n");
66 for (int i
= 0; i
< hardware
->vesa
.vmi_count
; i
++) {
67 struct vesa_mode_info
*mi
= &hardware
->vesa
.vmi
[i
].mi
;
69 * Sometimes, vesa bios reports 0x0 modes.
70 * We don't need to display that ones.
72 if ((mi
->h_res
== 0) || (mi
->v_res
== 0))
74 more_printf("%5u %5u %3u %3d 0x%04x\n",
75 mi
->h_res
, mi
->v_res
, mi
->bpp
,
76 hardware
->vesa
.vmi
[i
].mode
+ 0x200,
77 hardware
->vesa
.vmi
[i
].mode
);
81 static void enable_vesa(int argc __unused
, char **argv __unused
,
82 struct s_hardware
*hardware
)
85 max_console_lines
= MAX_VESA_CLI_LINES
;
86 init_console(hardware
);
89 static void disable_vesa(int argc __unused
, char **argv __unused
,
90 struct s_hardware
*hardware
)
93 max_console_lines
= MAX_CLI_LINES
;
94 init_console(hardware
);
97 struct cli_callback_descr list_vesa_show_modules
[] = {
100 .exec
= show_vesa_modes
,
108 struct cli_callback_descr list_vesa_commands
[] = {
115 .exec
= disable_vesa
,
124 struct cli_module_descr vesa_show_modules
= {
125 .modules
= list_vesa_show_modules
,
126 .default_callback
= main_show_vesa
,
129 struct cli_module_descr vesa_commands
= {
130 .modules
= list_vesa_commands
,
131 .default_callback
= enable_vesa
,
134 struct cli_mode_descr vesa_mode
= {
137 .default_modules
= &vesa_commands
,
138 .show_modules
= &vesa_show_modules
,