Adding upstream version 4.00~pre55+dfsg.
[syslinux-debian/hramrach.git] / com32 / hdt / hdt-common.c
blob736d9b6e2bcd9cef7056d8b27627c1f9f947d5bc
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
12 * conditions:
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 * -----------------------------------------------------------------------
29 #include <stdlib.h>
30 #include <string.h>
31 #include <stdio.h>
32 #include <getkey.h>
33 #include "syslinux/config.h"
34 #include "../lib/sys/vesa/vesa.h"
35 #include "hdt-common.h"
36 #include <disk/util.h>
37 #include <disk/mbrs.h>
38 #include <memory.h>
40 /* ISOlinux requires a 8.3 format */
41 void convert_isolinux_filename(char *filename, struct s_hardware *hardware)
43 /* Exit if we are not running ISOLINUX */
44 if (hardware->sv->filesystem != SYSLINUX_FS_ISOLINUX)
45 return;
46 /* Searching the dot */
47 char *dot = strchr(filename, '.');
48 /* Exiting if no dot exists in that string */
49 if (dot == NULL)
50 return;
51 /* Exiting if the extension is 3 char or less */
52 if (strlen(dot) <= 4)
53 return;
55 /* We have an extension bigger than .blah
56 * so we have to shorten it to 3*/
57 dot[4] = '\0';
60 void detect_parameters(const int argc, const char *argv[],
61 struct s_hardware *hardware)
63 /* Quiet mode - make the output more quiet */
64 quiet = false;
66 /* Vesa mode isn't set until we explictly call it */
67 vesamode = false;
69 for (int i = 1; i < argc; i++) {
70 if (!strncmp(argv[i], "quiet", 5)) {
71 quiet = true;
72 } else if (!strncmp(argv[i], "modules_pcimap=", 15)) {
73 strncpy(hardware->modules_pcimap_path, argv[i] + 15,
74 sizeof(hardware->modules_pcimap_path));
75 convert_isolinux_filename(hardware->modules_pcimap_path, hardware);
76 } else if (!strncmp(argv[i], "pciids=", 7)) {
77 strncpy(hardware->pciids_path, argv[i] + 7,
78 sizeof(hardware->pciids_path));
79 convert_isolinux_filename(hardware->pciids_path, hardware);
80 } else if (!strncmp(argv[i], "modules_alias=", 14)) {
81 strncpy(hardware->modules_alias_path, argv[i] + 14,
82 sizeof(hardware->modules_alias_path));
83 convert_isolinux_filename(hardware->modules_alias_path, hardware);
84 } else if (!strncmp(argv[i], "memtest=", 8)) {
85 strncpy(hardware->memtest_label, argv[i] + 8,
86 sizeof(hardware->memtest_label));
87 convert_isolinux_filename(hardware->memtest_label, hardware);
88 } else if (!strncmp(argv[i], "reboot=", 7)) {
89 strncpy(hardware->reboot_label, argv[i] + 7,
90 sizeof(hardware->reboot_label));
91 convert_isolinux_filename(hardware->reboot_label, hardware);
92 } else if (!strncmp(argv[i], "vesa", 4)) {
93 vesamode = true;
94 max_console_lines = MAX_CLI_LINES;
95 /* If the user defines a background image */
96 if (!strncmp(argv[i], "vesa=", 5)) {
97 strncpy(hardware->vesa_background, argv[i] + 5,
98 sizeof(hardware->vesa_background));
100 } else if (!strncmp(argv[i], "novesa", 6)) {
101 vesamode = false;
102 max_console_lines = MAX_VESA_CLI_LINES;
103 } else if (!strncmp(argv[i], "auto=", 5)) {
104 /* The auto= parameter is separated in several argv[]
105 * as it can contains spaces.
106 * We use the AUTO_DELIMITER char to define the limits
107 * of this parameter.
108 * i.e auto='show dmi; show pci'
111 /* Extracting the first parameter */
112 strcpy(hardware->auto_label, argv[i] + 6);
113 strcat(hardware->auto_label, " ");
114 char *pos;
115 i++;
117 /* While we can't find the other AUTO_DELIMITER, let's process the argv[] */
118 while (((pos = strstr(argv[i], AUTO_DELIMITER)) == NULL)
119 && (i < argc)) {
120 strcat(hardware->auto_label, argv[i]);
121 strcat(hardware->auto_label, " ");
122 i++;
125 /* If we didn't reach the end of the line, let's grab the last item */
126 if (i < argc) {
127 strcat(hardware->auto_label, argv[i]);
128 hardware->auto_label[strlen(hardware->auto_label) - 1] = 0;
134 void detect_syslinux(struct s_hardware *hardware)
136 hardware->sv = syslinux_version();
137 switch (hardware->sv->filesystem) {
138 case SYSLINUX_FS_SYSLINUX:
139 strlcpy(hardware->syslinux_fs, "SYSlinux", 9);
140 break;
141 case SYSLINUX_FS_PXELINUX:
142 strlcpy(hardware->syslinux_fs, "PXElinux", 9);
143 break;
144 case SYSLINUX_FS_ISOLINUX:
145 strlcpy(hardware->syslinux_fs, "ISOlinux", 9);
146 break;
147 case SYSLINUX_FS_EXTLINUX:
148 strlcpy(hardware->syslinux_fs, "EXTlinux", 9);
149 break;
150 case SYSLINUX_FS_UNKNOWN:
151 default:
152 strlcpy(hardware->syslinux_fs, "Unknown Bootloader",
153 sizeof hardware->syslinux_fs);
154 break;
158 void init_hardware(struct s_hardware *hardware)
160 hardware->pci_ids_return_code = 0;
161 hardware->modules_pcimap_return_code = 0;
162 hardware->modules_alias_return_code = 0;
163 hardware->cpu_detection = false;
164 hardware->pci_detection = false;
165 hardware->disk_detection = false;
166 hardware->disks_count = 0;
167 hardware->dmi_detection = false;
168 hardware->pxe_detection = false;
169 hardware->vesa_detection = false;
170 hardware->vpd_detection = false;
171 hardware->memory_detection = false;
172 hardware->nb_pci_devices = 0;
173 hardware->is_dmi_valid = false;
174 hardware->is_pxe_valid = false;
175 hardware->is_vpd_valid = false;
176 hardware->pci_domain = NULL;
177 hardware->detected_memory_size = 0;
179 /* Cleaning structures */
180 memset(hardware->disk_info, 0, sizeof(hardware->disk_info));
181 memset(hardware->mbr_ids, 0, sizeof(hardware->mbr_ids));
182 memset(&hardware->dmi, 0, sizeof(s_dmi));
183 memset(&hardware->cpu, 0, sizeof(s_cpu));
184 memset(&hardware->pxe, 0, sizeof(struct s_pxe));
185 memset(&hardware->vesa, 0, sizeof(struct s_vesa));
186 memset(&hardware->vpd, 0, sizeof(s_vpd));
187 memset(hardware->syslinux_fs, 0, sizeof hardware->syslinux_fs);
188 memset(hardware->pciids_path, 0, sizeof hardware->pciids_path);
189 memset(hardware->modules_pcimap_path, 0,
190 sizeof hardware->modules_pcimap_path);
191 memset(hardware->modules_alias_path, 0,
192 sizeof hardware->modules_alias_path);
193 memset(hardware->memtest_label, 0, sizeof hardware->memtest_label);
194 memset(hardware->reboot_label, 0, sizeof hardware->reboot_label);
195 memset(hardware->auto_label, 0, sizeof hardware->auto_label);
196 memset(hardware->vesa_background, 0, sizeof hardware->vesa_background);
197 strcat(hardware->pciids_path, "pci.ids");
198 strcat(hardware->modules_pcimap_path, "modules.pcimap");
199 strcat(hardware->modules_alias_path, "modules.alias");
200 strcat(hardware->memtest_label, "memtest");
201 strcat(hardware->reboot_label, "reboot.c32");
202 strncpy(hardware->vesa_background, CLI_DEFAULT_BACKGROUND,
203 sizeof(hardware->vesa_background));
207 * Detecting if a DMI table exist
208 * if yes, let's parse it
210 int detect_dmi(struct s_hardware *hardware)
212 if (hardware->dmi_detection == true)
213 return -1;
214 hardware->dmi_detection = true;
215 if (dmi_iterate(&hardware->dmi) == -ENODMITABLE) {
216 hardware->is_dmi_valid = false;
217 return -ENODMITABLE;
220 parse_dmitable(&hardware->dmi);
221 hardware->is_dmi_valid = true;
222 return 0;
226 * vpd_detection - populate the VPD structure
228 * VPD is a structure available on IBM machines.
229 * It is documented at:
230 * http://www.pc.ibm.com/qtechinfo/MIGR-45120.html
231 * (XXX the page seems to be gone)
233 int detect_vpd(struct s_hardware *hardware)
235 if (hardware->vpd_detection)
236 return -1;
237 else
238 hardware->vpd_detection = true;
240 if (vpd_decode(&hardware->vpd) == -ENOVPDTABLE) {
241 hardware->is_vpd_valid = false;
242 return -ENOVPDTABLE;
243 } else {
244 hardware->is_vpd_valid = true;
245 return 0;
249 /* Detection vesa stuff*/
250 int detect_vesa(struct s_hardware *hardware)
252 static com32sys_t rm;
253 struct vesa_general_info *gi;
254 struct vesa_mode_info *mi;
255 uint16_t mode, *mode_ptr;
256 char *oem_ptr;
258 if (hardware->vesa_detection == true)
259 return -1;
261 hardware->vesa_detection = true;
262 hardware->is_vesa_valid = false;
264 /* Allocate space in the bounce buffer for these structures */
265 gi = &((struct vesa_info *)__com32.cs_bounce)->gi;
266 mi = &((struct vesa_info *)__com32.cs_bounce)->mi;
268 gi->signature = VBE2_MAGIC; /* Get VBE2 extended data */
269 rm.eax.w[0] = 0x4F00; /* Get SVGA general information */
270 rm.edi.w[0] = OFFS(gi);
271 rm.es = SEG(gi);
272 __intcall(0x10, &rm, &rm);
274 if (rm.eax.w[0] != 0x004F) {
275 return -1;
278 mode_ptr = GET_PTR(gi->video_mode_ptr);
279 oem_ptr = GET_PTR(gi->oem_vendor_name_ptr);
280 strncpy(hardware->vesa.vendor, oem_ptr, sizeof(hardware->vesa.vendor));
281 oem_ptr = GET_PTR(gi->oem_product_name_ptr);
282 strncpy(hardware->vesa.product, oem_ptr, sizeof(hardware->vesa.product));
283 oem_ptr = GET_PTR(gi->oem_product_rev_ptr);
284 strncpy(hardware->vesa.product_revision, oem_ptr,
285 sizeof(hardware->vesa.product_revision));
287 hardware->vesa.major_version = (gi->version >> 8) & 0xff;
288 hardware->vesa.minor_version = gi->version & 0xff;
289 hardware->vesa.total_memory = gi->total_memory;
290 hardware->vesa.software_rev = gi->oem_software_rev;
292 hardware->vesa.vmi_count = 0;
294 while ((mode = *mode_ptr++) != 0xFFFF) {
296 rm.eax.w[0] = 0x4F01; /* Get SVGA mode information */
297 rm.ecx.w[0] = mode;
298 rm.edi.w[0] = OFFS(mi);
299 rm.es = SEG(mi);
300 __intcall(0x10, &rm, &rm);
302 /* Must be a supported mode */
303 if (rm.eax.w[0] != 0x004f)
304 continue;
306 /* Saving detected values */
307 memcpy(&hardware->vesa.vmi[hardware->vesa.vmi_count].mi, mi,
308 sizeof(struct vesa_mode_info));
309 hardware->vesa.vmi[hardware->vesa.vmi_count].mode = mode;
311 hardware->vesa.vmi_count++;
313 hardware->is_vesa_valid = true;
314 return 0;
317 /* Try to detect disks from port 0x80 to 0xff */
318 void detect_disks(struct s_hardware *hardware)
320 int i = -1;
321 int err;
323 if (hardware->disk_detection)
324 return;
326 hardware->disk_detection = true;
327 for (int drive = 0x80; drive < 0xff; drive++) {
328 i++;
329 hardware->disk_info[i].disk = drive;
330 err = get_drive_parameters(&hardware->disk_info[i]);
333 * Do not print output when drive does not exist or
334 * doesn't support int13 (cdrom, ...)
336 if (err == -1 || !hardware->disk_info[i].cbios)
337 continue;
339 /* Detect MBR */
340 hardware->mbr_ids[i] = get_mbr_id(&hardware->disk_info[i]);
342 hardware->disks_count++;
346 int detect_pxe(struct s_hardware *hardware)
348 void *dhcpdata;
350 size_t dhcplen;
351 t_PXENV_UNDI_GET_NIC_TYPE gnt;
353 if (hardware->pxe_detection == true)
354 return -1;
355 hardware->pxe_detection = true;
356 hardware->is_pxe_valid = false;
357 memset(&gnt, 0, sizeof(t_PXENV_UNDI_GET_NIC_TYPE));
358 memset(&hardware->pxe, 0, sizeof(struct s_pxe));
360 /* This code can only work if pxelinux is loaded */
361 if (hardware->sv->filesystem != SYSLINUX_FS_PXELINUX) {
362 return -1;
364 // printf("PXE: PXElinux detected\n");
365 if (!pxe_get_cached_info(PXENV_PACKET_TYPE_DHCP_ACK, &dhcpdata, &dhcplen)) {
366 pxe_bootp_t *dhcp = &hardware->pxe.dhcpdata;
367 memcpy(&hardware->pxe.dhcpdata, dhcpdata,
368 sizeof(hardware->pxe.dhcpdata));
369 snprintf(hardware->pxe.mac_addr, sizeof(hardware->pxe.mac_addr),
370 "%02x:%02x:%02x:%02x:%02x:%02x", dhcp->CAddr[0],
371 dhcp->CAddr[1], dhcp->CAddr[2], dhcp->CAddr[3],
372 dhcp->CAddr[4], dhcp->CAddr[5]);
374 /* Saving our IP address in a easy format */
375 hardware->pxe.ip_addr[0] = hardware->pxe.dhcpdata.yip & 0xff;
376 hardware->pxe.ip_addr[1] = hardware->pxe.dhcpdata.yip >> 8 & 0xff;
377 hardware->pxe.ip_addr[2] = hardware->pxe.dhcpdata.yip >> 16 & 0xff;
378 hardware->pxe.ip_addr[3] = hardware->pxe.dhcpdata.yip >> 24 & 0xff;
380 if (!pxe_get_nic_type(&gnt)) {
381 switch (gnt.NicType) {
382 case PCI_NIC:
383 hardware->is_pxe_valid = true;
384 hardware->pxe.vendor_id = gnt.info.pci.Vendor_ID;
385 hardware->pxe.product_id = gnt.info.pci.Dev_ID;
386 hardware->pxe.subvendor_id = gnt.info.pci.SubVendor_ID;
387 hardware->pxe.subproduct_id =
388 gnt.info.pci.SubDevice_ID,
389 hardware->pxe.rev = gnt.info.pci.Rev;
390 hardware->pxe.pci_bus = (gnt.info.pci.BusDevFunc >> 8) & 0xff;
391 hardware->pxe.pci_dev = (gnt.info.pci.BusDevFunc >> 3) & 0x7;
392 hardware->pxe.pci_func = gnt.info.pci.BusDevFunc & 0x03;
393 hardware->pxe.base_class = gnt.info.pci.Base_Class;
394 hardware->pxe.sub_class = gnt.info.pci.Sub_Class;
395 hardware->pxe.prog_intf = gnt.info.pci.Prog_Intf;
396 hardware->pxe.nictype = gnt.NicType;
397 break;
398 case CardBus_NIC:
399 hardware->is_pxe_valid = true;
400 hardware->pxe.vendor_id = gnt.info.cardbus.Vendor_ID;
401 hardware->pxe.product_id = gnt.info.cardbus.Dev_ID;
402 hardware->pxe.subvendor_id = gnt.info.cardbus.SubVendor_ID;
403 hardware->pxe.subproduct_id =
404 gnt.info.cardbus.SubDevice_ID,
405 hardware->pxe.rev = gnt.info.cardbus.Rev;
406 hardware->pxe.pci_bus =
407 (gnt.info.cardbus.BusDevFunc >> 8) & 0xff;
408 hardware->pxe.pci_dev =
409 (gnt.info.cardbus.BusDevFunc >> 3) & 0x7;
410 hardware->pxe.pci_func = gnt.info.cardbus.BusDevFunc & 0x03;
411 hardware->pxe.base_class = gnt.info.cardbus.Base_Class;
412 hardware->pxe.sub_class = gnt.info.cardbus.Sub_Class;
413 hardware->pxe.prog_intf = gnt.info.cardbus.Prog_Intf;
414 hardware->pxe.nictype = gnt.NicType;
415 break;
416 case PnP_NIC:
417 default:
418 return -1;
419 break;
421 /* Let's try to find the associated pci device */
422 detect_pci(hardware);
424 /* The firt pass try to find the exact pci device */
425 hardware->pxe.pci_device = NULL;
426 hardware->pxe.pci_device_pos = 0;
427 struct pci_device *pci_device;
428 int pci_number = 0;
429 for_each_pci_func(pci_device, hardware->pci_domain) {
430 pci_number++;
431 if ((__pci_bus == hardware->pxe.pci_bus) &&
432 (__pci_slot == hardware->pxe.pci_dev) &&
433 (__pci_func == hardware->pxe.pci_func) &&
434 (pci_device->vendor == hardware->pxe.vendor_id)
435 && (pci_device->product == hardware->pxe.product_id)) {
436 hardware->pxe.pci_device = pci_device;
437 hardware->pxe.pci_device_pos = pci_number;
438 return 0;
442 /* If we reach that part, it means the pci device pointed by
443 * the pxe rom wasn't found in our list.
444 * Let's try to find the device only by its pci ids.
445 * The pci device we'll match is maybe not exactly the good one
446 * as we can have the same pci id several times.
447 * At least, the pci id, the vendor/product will be right.
448 * That's clearly a workaround for some weird cases.
449 * This should happend very unlikely */
450 hardware->pxe.pci_device = NULL;
451 hardware->pxe.pci_device_pos = 0;
452 pci_number = 0;
453 for_each_pci_func(pci_device, hardware->pci_domain) {
454 pci_number++;
455 if ((pci_device->vendor == hardware->pxe.vendor_id)
456 && (pci_device->product == hardware->pxe.product_id)) {
457 hardware->pxe.pci_device = pci_device;
458 hardware->pxe.pci_device_pos = pci_number;
459 return 0;
465 return 0;
468 void detect_memory(struct s_hardware *hardware) {
469 if (hardware->memory_detection == false) {
470 hardware->memory_detection = true;
471 hardware->detected_memory_size = detect_memsize();
475 void detect_pci(struct s_hardware *hardware)
477 if (hardware->pci_detection == true)
478 return;
479 hardware->pci_detection = true;
481 hardware->nb_pci_devices = 0;
483 /* Scanning to detect pci buses and devices */
484 hardware->pci_domain = pci_scan();
486 if (!hardware->pci_domain)
487 return;
489 /* Gathering addtional information */
490 gather_additional_pci_config(hardware->pci_domain);
492 struct pci_device *pci_device;
493 for_each_pci_func(pci_device, hardware->pci_domain) {
494 hardware->nb_pci_devices++;
497 if (!quiet) {
498 more_printf("PCI: %d devices detected\n", hardware->nb_pci_devices);
499 more_printf("PCI: Resolving names\n");
501 /* Assigning product & vendor name for each device */
502 hardware->pci_ids_return_code =
503 get_name_from_pci_ids(hardware->pci_domain, hardware->pciids_path);
505 if (!quiet)
506 more_printf("PCI: Resolving class names\n");
507 /* Assigning class name for each device */
508 hardware->pci_ids_return_code =
509 get_class_name_from_pci_ids(hardware->pci_domain,
510 hardware->pciids_path);
512 if (!quiet)
513 more_printf("PCI: Resolving module names\n");
514 /* Detecting which kernel module should match each device using modules.pcimap */
515 hardware->modules_pcimap_return_code =
516 get_module_name_from_pcimap(hardware->pci_domain,
517 hardware->modules_pcimap_path);
519 /* Detecting which kernel module should match each device using modules.alias */
520 hardware->modules_alias_return_code =
521 get_module_name_from_alias(hardware->pci_domain,
522 hardware->modules_alias_path);
524 /* We try to detect the pxe stuff to populate the PXE: field of pci devices */
525 detect_pxe(hardware);
528 void cpu_detect(struct s_hardware *hardware)
530 if (hardware->cpu_detection == true)
531 return;
532 detect_cpu(&hardware->cpu);
533 /* Old processors doesn't manage the identify commands
534 * Let's use the dmi value in that case */
535 if (strlen(remove_spaces(hardware->cpu.model)) == 0)
536 strncpy(hardware->cpu.model, hardware->dmi.processor.version,
537 sizeof(hardware->cpu.model));
539 /* Some CPUs like to put many spaces in the model name
540 * That makes some weird display in console/menu
541 * Let's remove that mulitple spaces */
542 strncpy(hardware->cpu.model,del_multi_spaces(hardware->cpu.model),sizeof(hardware->cpu.model));
543 hardware->cpu_detection = true;
547 * Find the last instance of a particular command line argument
548 * (which should include the final =; do not use for boolean arguments)
550 const char *find_argument(const char **argv, const char *argument)
552 int la = strlen(argument);
553 const char **arg;
554 const char *ptr = NULL;
556 for (arg = argv; *arg; arg++) {
557 if (!memcmp(*arg, argument, la))
558 ptr = *arg + la;
561 return ptr;
564 void clear_screen(void)
566 move_cursor_to_next_line();
567 disable_utf8();
568 set_g1_special_char();
569 set_us_g0_charset();
570 display_cursor(false);
571 clear_entire_screen();
572 gotoxy(0,0);
573 reset_more_printf();
576 /* remove begining spaces */
577 char *skip_spaces(char *p)
579 while (*p && *p <= ' ') {
580 p++;
583 return p;
586 /* remove trailing & begining spaces */
587 char *remove_spaces(char *p)
589 char *save = p;
590 p += strlen(p) - 1;
591 while (*p && *p <= ' ') {
592 *p = '\0';
593 p--;
595 p = save;
596 while (*p && *p <= ' ') {
597 p++;
600 return p;
603 /* remove trailing LF */
604 char *remove_trailing_lf(char *p)
606 char *save = p;
607 p += strlen(p) - 1;
608 while (*p && *p == 10) {
609 *p = '\0';
610 p--;
612 p = save;
614 return p;
617 /* delete multiple spaces, one is enough */
618 char *del_multi_spaces(char *p)
620 /* Saving the original pointer */
621 char *save = p;
623 /* Let's parse the complete string
624 * As we search for a double spacing
625 * we have to be sure then string is
626 * long enough to be processed */
627 while (*p && *p + 1) {
629 /* If we have two consecutive spaces */
630 if ((*p == ' ') && (*(p + 1) == ' ')) {
632 /* Let's copy to the current position
633 * the content from the second space*/
634 strncpy(p, p + 1, strlen(p + 1));
636 /* The string is 1 char smaller */
637 *(p + strlen(p) - 1) = '\0';
639 /* Don't increment the pointer as we
640 * changed the content of the current position*/
641 continue;
644 /* Nothing as been found, let's see on the next char */
645 p++;
647 /* Returning the original pointer */
648 return save;
651 /* Reset the more_printf counter */
652 void reset_more_printf(void)
654 display_line_nb = 0;
657 int draw_background(const char *what)
659 if (!what)
660 return vesacon_default_background();
661 else
662 return vesacon_load_background(what);
665 void init_console(struct s_hardware *hardware)
667 if (vesamode) {
668 openconsole(&dev_rawcon_r, &dev_vesaserial_w);
669 draw_background(hardware->vesa_background);
670 } else
671 console_ansi_raw();