aboutsummaryrefslogtreecommitdiffstats
path: root/com32/hdt/hdt-common.h
blob: 5c3282c618108612b9cbee79fbbfc12a49d537e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/* ----------------------------------------------------------------------- *
 *
 *   Copyright 2009 Erwan Velu - All Rights Reserved
 *
 *   Permission is hereby granted, free of charge, to any person
 *   obtaining a copy of this software and associated documentation
 *   files (the "Software"), to deal in the Software without
 *   restriction, including without limitation the rights to use,
 *   copy, modify, merge, publish, distribute, sublicense, and/or
 *   sell copies of the Software, and to permit persons to whom
 *   the Software is furnished to do so, subject to the following
 *   conditions:
 *
 *   The above copyright notice and this permission notice shall
 *   be included in all copies or substantial portions of the Software.
 *
 *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 *   OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 *   NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 *   HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 *   WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 *   FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 *   OTHER DEALINGS IN THE SOFTWARE.
 *
 * -----------------------------------------------------------------------
*/

#ifndef DEFINE_HDT_COMMON_H
#define DEFINE_HDT_COMMON_H
#include <stdio.h>
#include "sys/pci.h"
#include "cpuid.h"
#include "dmi/dmi.h"
#include <syslinux/pxe.h>
#include "hdt-ata.h"

/* This two values are used for switching for the menu to the CLI mode*/
#define HDT_SWITCH_TO_CLI "hdt_switch_to_cli"
#define HDT_RETURN_TO_CLI 100

extern int display_line_nb;

#define more_printf(...) do {\
 if (display_line_nb == 23) {\
   char tempbuf[10];\
   printf("Press enter to continue\n");\
   display_line_nb=0;\
   fgets(tempbuf, sizeof(tempbuf), stdin);\
 }\
 printf ( __VA_ARGS__);\
 display_line_nb++; \
} while (0);


struct s_hardware {
  s_dmi dmi; /* DMI table */
  s_cpu cpu; /* CPU information */
  struct pci_domain *pci_domain; /* PCI Devices */
  struct diskinfo disk_info[256];     /* Disk Information*/
  t_PXENV_UNDI_GET_NIC_TYPE gnt;

  int pci_ids_return_code;
  int modules_pcimap_return_code;
  int nb_pci_devices;
  bool is_dmi_valid;
  bool is_pxe_valid;

  bool dmi_detection; /* Does the dmi stuff have been already detected */
  bool pci_detection; /* Does the pci stuff have been already detected */
  bool cpu_detection; /* Does the cpu stuff have been already detected */
  bool disk_detection; /* Does the disk stuff have been already detected */
  bool pxe_detection; /* Does the pxe stuff have been already detected*/
};

char *find_argument(const char **argv, const char *argument);
int detect_dmi(struct s_hardware *hardware);
void detect_disks(struct s_hardware *hardware);
void detect_pci(struct s_hardware *hardware);
void cpu_detect(struct s_hardware *hardware);
int detect_pxe(struct s_hardware *hardware);
void init_hardware(struct s_hardware *hardware);
void clear_screen(void);
#endif