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 detect_vesa(hardware
);
41 if (hardware
->is_vesa_valid
== false) {
42 more_printf("No VESA BIOS detected\n");
45 more_printf("VESA\n");
46 more_printf(" Vesa version : %d.%d\n", hardware
->vesa
.major_version
,
47 hardware
->vesa
.minor_version
);
48 more_printf(" Vendor : %s\n", hardware
->vesa
.vendor
);
49 more_printf(" Product : %s\n", hardware
->vesa
.product
);
50 more_printf(" Product rev. : %s\n", hardware
->vesa
.product_revision
);
51 more_printf(" Software rev.: %d\n", hardware
->vesa
.software_rev
);
52 more_printf(" Memory (KB) : %d\n", hardware
->vesa
.total_memory
* 64);
53 more_printf(" Modes : %d\n", hardware
->vesa
.vmi_count
);
56 static void show_vesa_modes(int argc __unused
, char **argv __unused
,
57 struct s_hardware
*hardware
)
59 detect_vesa(hardware
);
61 if (hardware
->is_vesa_valid
== false) {
62 more_printf("No VESA BIOS detected\n");
65 more_printf(" ResH. x ResV x Bits : vga= : Vesa Mode\n");
66 more_printf("----------------------------------------\n");
68 for (int i
= 0; i
< hardware
->vesa
.vmi_count
; i
++) {
69 struct vesa_mode_info
*mi
= &hardware
->vesa
.vmi
[i
].mi
;
71 * Sometimes, vesa bios reports 0x0 modes.
72 * We don't need to display that ones.
74 if ((mi
->h_res
== 0) || (mi
->v_res
== 0))
76 more_printf("%5u %5u %3u %3d 0x%04x\n",
77 mi
->h_res
, mi
->v_res
, mi
->bpp
,
78 hardware
->vesa
.vmi
[i
].mode
+ 0x200,
79 hardware
->vesa
.vmi
[i
].mode
);
83 static void enable_vesa(int argc __unused
, char **argv __unused
,
84 struct s_hardware
*hardware
)
87 max_console_lines
= MAX_VESA_CLI_LINES
;
88 init_console(hardware
);
91 static void disable_vesa(int argc __unused
, char **argv __unused
,
92 struct s_hardware
*hardware
)
95 max_console_lines
= MAX_CLI_LINES
;
96 init_console(hardware
);
99 struct cli_callback_descr list_vesa_show_modules
[] = {
102 .exec
= show_vesa_modes
,
110 struct cli_callback_descr list_vesa_commands
[] = {
117 .exec
= disable_vesa
,
126 struct cli_module_descr vesa_show_modules
= {
127 .modules
= list_vesa_show_modules
,
128 .default_callback
= main_show_vesa
,
131 struct cli_module_descr vesa_commands
= {
132 .modules
= list_vesa_commands
,
133 .default_callback
= enable_vesa
,
136 struct cli_mode_descr vesa_mode
= {
139 .default_modules
= &vesa_commands
,
140 .show_modules
= &vesa_show_modules
,