Impact: Cleanups.
Fix indentation in all *.h files by sticking to the Linux style (indent
-linux), using 2 spaces for indentation.
Misc.: Corrected typos in comments, wrapped to 80 characters
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
* OTHER DEALINGS IN THE SOFTWARE.
*
* -----------------------------------------------------------------------
-*/
+ */
#ifndef DEFINE_HDT_ATA_H
#define DEFINE_HDT_ATA_H
+#include <com32io.h>
#include "hdt.h"
-#include <com32io.h>
struct ata_identify_device {
unsigned short words000_009[10];
- unsigned char serial_no[20];
+ unsigned char serial_no[20];
unsigned short words020_022[3];
- unsigned char fw_rev[8];
- unsigned char model[40];
+ unsigned char fw_rev[8];
+ unsigned char model[40];
unsigned short words047_079[33];
unsigned short major_rev_num;
unsigned short minor_rev_num;
struct diskinfo {
int disk;
- int ebios; /* EBIOS supported on this disk */
- int cbios; /* CHS geometry is valid */
+ int ebios; /* EBIOS supported on this disk */
+ int cbios; /* CHS geometry is valid */
int heads;
int sectors_per_track;
int sectors;
// DWORD=32
// QWORD=64
struct device_parameter {
- uint16_t len;
- uint16_t info;
- uint32_t cylinders;
- uint32_t heads;
- uint32_t sectors_per_track;
- uint64_t sectors;
- uint16_t bytes_per_sector;
- uint32_t dpte_pointer;
- uint16_t device_path_information;
- uint8_t device_path_lenght;
- uint8_t device_path_reserved;
- uint16_t device_path_reserved_2;
- uint8_t host_bus_type[4];
- uint8_t interface_type[8];
- uint64_t interace_path;
- uint64_t device_path[2];
- uint8_t reserved;
- uint8_t cheksum;
+ uint16_t len;
+ uint16_t info;
+ uint32_t cylinders;
+ uint32_t heads;
+ uint32_t sectors_per_track;
+ uint64_t sectors;
+ uint16_t bytes_per_sector;
+ uint32_t dpte_pointer;
+ uint16_t device_path_information;
+ uint8_t device_path_lenght;
+ uint8_t device_path_reserved;
+ uint16_t device_path_reserved_2;
+ uint8_t host_bus_type[4];
+ uint8_t interface_type[8];
+ uint64_t interace_path;
+ uint64_t device_path[2];
+ uint8_t reserved;
+ uint8_t cheksum;
} ATTR_PACKED;
-
/* Useless stuff until I manage how to send ata packets */
#ifdef ATA
enum {
- ATA_ID_FW_REV = 23,
- ATA_ID_PROD = 27,
- ATA_ID_FW_REV_LEN = 8,
- ATA_ID_PROD_LEN = 40,
+ ATA_ID_FW_REV = 23,
+ ATA_ID_PROD = 27,
+ ATA_ID_FW_REV_LEN = 8,
+ ATA_ID_PROD_LEN = 40,
};
-void ata_id_c_string(const uint16_t *id, unsigned char *s, unsigned int ofs, unsigned int len);
-void ata_id_string(const uint16_t *id, unsigned char *s, unsigned int ofs, unsigned int len);
-int int13_retry(const com32sys_t *inreg, com32sys_t *outreg);
-void printregs(const com32sys_t *r);
+void ata_id_c_string(const uint16_t * id, unsigned char *s, unsigned int ofs,
+ unsigned int len);
+void ata_id_string(const uint16_t * id, unsigned char *s, unsigned int ofs,
+ unsigned int len);
+int int13_retry(const com32sys_t * inreg, com32sys_t * outreg);
+void printregs(const com32sys_t * r);
#endif
int get_disk_params(int disk, struct diskinfo *disk_info);
* OTHER DEALINGS IN THE SOFTWARE.
*
* -----------------------------------------------------------------------
-*/
+ */
#ifndef DEFINE_HDT_CLI_H
#define DEFINE_HDT_CLI_H
#include <stdio.h>
+
#include "hdt-common.h"
#define CLI_CLEAR "clear"
} cli_mode_t;
struct s_cli_mode {
- cli_mode_t mode;
- char prompt[32];
+ cli_mode_t mode;
+ char prompt[32];
};
-
void show_cli_help(struct s_cli_mode *cli_mode);
void start_cli_mode(struct s_hardware *hardware, int argc, char *argv[]);
-void main_show(char *item, struct s_hardware *hardware, struct s_cli_mode *cli_mode);
+void main_show(char *item, struct s_hardware *hardware,
+ struct s_cli_mode *cli_mode);
int do_exit(struct s_cli_mode *cli_mode);
-//DMI STUFF
+// DMI STUFF
#define CLI_DMI_BASE_BOARD "base_board"
#define CLI_DMI_BATTERY "battery"
#define CLI_DMI_BIOS "bios"
#define CLI_DMI_PROCESSOR "cpu"
#define CLI_DMI_SYSTEM "system"
-void main_show_dmi(struct s_hardware *hardware,struct s_cli_mode *cli_mode);
-void handle_dmi_commands(char *cli_line, struct s_cli_mode *cli_mode, struct s_hardware *hardware);
+void main_show_dmi(struct s_hardware *hardware, struct s_cli_mode *cli_mode);
+void handle_dmi_commands(char *cli_line, struct s_cli_mode *cli_mode,
+ struct s_hardware *hardware);
void show_dmi_base_board(struct s_hardware *hardware);
void show_dmi_system(struct s_hardware *hardware);
void show_dmi_bios(struct s_hardware *hardware);
void show_dmi_chassis(struct s_hardware *hardware);
void show_dmi_cpu(struct s_hardware *hardware);
void show_dmi_modules(struct s_hardware *hardware);
-void show_dmi_memory_modules(struct s_hardware *hardware,bool clearscreen, bool show_free_banks);
+void show_dmi_memory_modules(struct s_hardware *hardware, bool clearscreen,
+ bool show_free_banks);
void show_dmi_memory_bank(struct s_hardware *hardware, const char *item);
void show_dmi_battery(struct s_hardware *hardware);
-//PCI STUFF
+// PCI STUFF
#define CLI_PCI_DEVICE "device"
void main_show_pci(struct s_hardware *hardware);
-void handle_pci_commands(char *cli_line, struct s_cli_mode *cli_mode, struct s_hardware *hardware);
+void handle_pci_commands(char *cli_line, struct s_cli_mode *cli_mode,
+ struct s_hardware *hardware);
void pci_show(char *item, struct s_hardware *hardware);
void cli_detect_pci(struct s_hardware *hardware);
-//CPU STUFF
-void main_show_cpu(struct s_hardware *hardware,struct s_cli_mode *cli_mode);
-void handle_cpu_commands(char *cli_line, struct s_cli_mode *cli_mode, struct s_hardware *hardware);
+// CPU STUFF
+void main_show_cpu(struct s_hardware *hardware, struct s_cli_mode *cli_mode);
+void handle_cpu_commands(char *cli_line, struct s_cli_mode *cli_mode,
+ struct s_hardware *hardware);
void cpu_show(char *item, struct s_hardware *hardware);
-//PXE STUFF
-void main_show_pxe(struct s_hardware *hardware,struct s_cli_mode *cli_mode);
-void handle_pxe_commands(char *cli_line, struct s_cli_mode *cli_mode, struct s_hardware *hardware);
+// PXE STUFF
+void main_show_pxe(struct s_hardware *hardware, struct s_cli_mode *cli_mode);
+void handle_pxe_commands(char *cli_line, struct s_cli_mode *cli_mode,
+ struct s_hardware *hardware);
-//KERNEL STUFF
-void main_show_kernel(struct s_hardware *hardware,struct s_cli_mode *cli_mode);
-void handle_kernel_commands(char *cli_line, struct s_cli_mode *cli_mode, struct s_hardware *hardware);
+// KERNEL STUFF
+void main_show_kernel(struct s_hardware *hardware, struct s_cli_mode *cli_mode);
+void handle_kernel_commands(char *cli_line, struct s_cli_mode *cli_mode,
+ struct s_hardware *hardware);
-//SYSLINUX STUFF
-void main_show_syslinux(struct s_hardware *hardware,struct s_cli_mode *cli_mode);
-void handle_syslinux_commands(char *cli_line, struct s_cli_mode *cli_mode, struct s_hardware *hardware);
+// SYSLINUX STUFF
+void main_show_syslinux(struct s_hardware *hardware,
+ struct s_cli_mode *cli_mode);
+void handle_syslinux_commands(char *cli_line, struct s_cli_mode *cli_mode,
+ struct s_hardware *hardware);
//VESA STUFF
void main_show_vesa(struct s_hardware *hardware);
* OTHER DEALINGS IN THE SOFTWARE.
*
* -----------------------------------------------------------------------
-*/
+ */
#ifndef DEFINE_HDT_COMMON_H
#define DEFINE_HDT_COMMON_H
#include <stdio.h>
+#include <syslinux/pxe.h>
#include "sys/pci.h"
+
#include "cpuid.h"
#include "dmi/dmi.h"
-#include <syslinux/pxe.h>
#include "hdt-ata.h"
#include "../lib/sys/vesa/vesa.h"
-/* This two values are used for switching for the menu to the CLI mode*/
+/* 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
#define MAX_VESA_MODES 255
display_line_nb++; \
} while (0);
-
struct s_pxe {
- uint16_t vendor_id;
- uint16_t product_id;
- uint16_t subvendor_id;
- uint16_t subproduct_id;
- uint8_t rev;
- uint8_t pci_bus;
- uint8_t pci_dev;
- uint8_t pci_func;
- uint8_t base_class;
- uint8_t sub_class;
- uint8_t prog_intf;
- uint8_t nictype;
- char mac_addr[18]; /* The current mac address */
- uint8_t ip_addr[4];
-
- pxe_bootp_t dhcpdata; /* The dhcp answer */
- struct pci_device *pci_device; /* The matching pci device */
- uint8_t pci_device_pos; /* It position in our pci sorted list*/
+ uint16_t vendor_id;
+ uint16_t product_id;
+ uint16_t subvendor_id;
+ uint16_t subproduct_id;
+ uint8_t rev;
+ uint8_t pci_bus;
+ uint8_t pci_dev;
+ uint8_t pci_func;
+ uint8_t base_class;
+ uint8_t sub_class;
+ uint8_t prog_intf;
+ uint8_t nictype;
+ char mac_addr[18]; /* The current mac address */
+ uint8_t ip_addr[4];
+ pxe_bootp_t dhcpdata; /* The dhcp answer */
+ struct pci_device *pci_device; /* The matching pci device */
+ uint8_t pci_device_pos; /* It position in our pci sorted list */
+ uint8_t pci_device_pos; /* It position in our pci sorted list*/
};
struct s_vesa_mode_info {
};
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*/
+ s_dmi dmi; /* DMI table */
+ s_cpu cpu; /* CPU information */
+ struct pci_domain *pci_domain; /* PCI Devices */
+ struct diskinfo disk_info[256]; /* Disk Information */
struct s_pxe pxe;
struct s_vesa vesa;
bool is_pxe_valid;
bool is_vesa_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*/
- bool vesa_detection;/* Does the vesa sutff have been already detected*/
+ bool dmi_detection; /* Does the dmi stuff has already been detected? */
+ bool pci_detection; /* Does the pci stuff has already been detected? */
+ bool cpu_detection; /* Does the cpu stuff has already been detected? */
+ bool disk_detection;/* Does the disk stuff has already been detected? */
+ bool pxe_detection; /* Does the pxe stuff has already been detected? */
+ bool vesa_detection;/* Does the vesa sutff have been already detected? */
char syslinux_fs[22];
- const struct syslinux_version *sv;
+ struct syslinux_version *sv;
char modules_pcimap_path[255];
char pciids_path[255];
};
* OTHER DEALINGS IN THE SOFTWARE.
*
* -----------------------------------------------------------------------
-*/
+ */
#ifndef DEFINE_HDT_MENU_H
#define DEFINE_HDT_MENU_H
#include <stdio.h>
+
#include "menu.h"
#include "help.h"
//#include "cpuid.h"
#define MAX_DISK_SUB_MENU 32
struct s_my_menu {
- unsigned char menu;
- int items_count;
+ unsigned char menu;
+ int items_count;
};
struct s_hdt_menu {
- struct s_my_menu main_menu;
- struct s_my_menu cpu_menu;
- struct s_my_menu mobo_menu;
- struct s_my_menu chassis_menu;
- struct s_my_menu bios_menu;
- struct s_my_menu system_menu;
- struct s_my_menu pci_menu;
- struct s_my_menu pci_sub_menu[MAX_PCI_SUB_MENU];
- struct s_my_menu kernel_menu;
- struct s_my_menu memory_menu;
- struct s_my_menu memory_sub_menu[MAX_MEMORY_SUB_MENU];
- struct s_my_menu disk_menu;
- struct s_my_menu disk_sub_menu[MAX_DISK_SUB_MENU];
- struct s_my_menu battery_menu;
- struct s_my_menu syslinux_menu;
- struct s_my_menu about_menu;
- struct s_my_menu summary_menu;
- struct s_my_menu pxe_menu;
- struct s_my_menu vesa_menu;
- struct s_my_menu vesa_card_menu;
- struct s_my_menu vesa_modes_menu;
- int total_menu_count; // sum of all menus we have
+ struct s_my_menu main_menu;
+ struct s_my_menu cpu_menu;
+ struct s_my_menu mobo_menu;
+ struct s_my_menu chassis_menu;
+ struct s_my_menu bios_menu;
+ struct s_my_menu system_menu;
+ struct s_my_menu pci_menu;
+ struct s_my_menu pci_sub_menu[MAX_PCI_SUB_MENU];
+ struct s_my_menu kernel_menu;
+ struct s_my_menu memory_menu;
+ struct s_my_menu memory_sub_menu[MAX_MEMORY_SUB_MENU];
+ struct s_my_menu disk_menu;
+ struct s_my_menu disk_sub_menu[MAX_DISK_SUB_MENU];
+ struct s_my_menu battery_menu;
+ struct s_my_menu syslinux_menu;
+ struct s_my_menu about_menu;
+ struct s_my_menu summary_menu;
+ struct s_my_menu pxe_menu;
+ struct s_my_menu vesa_menu;
+ struct s_my_menu vesa_card_menu;
+ struct s_my_menu vesa_modes_menu;
+ int total_menu_count; // Sum of all menus we have
};
TIMEOUTCODE ontimeout();
-void keys_handler(t_menusystem *ms, t_menuitem *mi,unsigned int scancode);
+void keys_handler(t_menusystem * ms, t_menuitem * mi, unsigned int scancode);
// PCI Stuff
-void compute_pci_device(struct s_my_menu *menu,struct pci_device *pci_device,int pci_bus, int pci_slot, int pci_func);
+void compute_pci_device(struct s_my_menu *menu, struct pci_device *pci_device,
+ int pci_bus, int pci_slot, int pci_func);
int compute_PCI(struct s_hdt_menu *hdt_menu, struct s_hardware *hardware);
// KERNEL Stuff
-void compute_kernel(struct s_my_menu *menu,struct s_hardware *hardware);
+void compute_kernel(struct s_my_menu *menu, struct s_hardware *hardware);
// Disk Stuff
-int compute_disk_module(struct s_my_menu *menu, int nb_sub_disk_menu, struct diskinfo *d,int disk_number);
+int compute_disk_module(struct s_my_menu *menu, int nb_sub_disk_menu,
+ struct diskinfo *d, int disk_number);
void compute_disks(struct s_hdt_menu *menu, struct diskinfo *disk_info);
// DMI Stuff
-void compute_motherboard(struct s_my_menu *menu,s_dmi *dmi);
-void compute_battery(struct s_my_menu *menu, s_dmi *dmi);
-void compute_system(struct s_my_menu *menu,s_dmi *dmi);
-void compute_chassis(struct s_my_menu *menu,s_dmi *dmi);
-void compute_bios(struct s_my_menu *menu,s_dmi *dmi);
-void compute_memory(struct s_hdt_menu *menu, s_dmi *dmi);
-void compute_memory_module(struct s_my_menu *menu, s_dmi *dmi, int slot_number);
+void compute_motherboard(struct s_my_menu *menu, s_dmi * dmi);
+void compute_battery(struct s_my_menu *menu, s_dmi * dmi);
+void compute_system(struct s_my_menu *menu, s_dmi * dmi);
+void compute_chassis(struct s_my_menu *menu, s_dmi * dmi);
+void compute_bios(struct s_my_menu *menu, s_dmi * dmi);
+void compute_memory(struct s_hdt_menu *menu, s_dmi * dmi);
+void compute_memory_module(struct s_my_menu *menu, s_dmi * dmi,
+ int slot_number);
// Processor Stuff
-void compute_processor(struct s_my_menu *menu,struct s_hardware *hardware);
+void compute_processor(struct s_my_menu *menu, struct s_hardware *hardware);
// Syslinux stuff
-void compute_syslinuxmenu(struct s_my_menu *menu,struct s_hardware *hardware);
+void compute_syslinuxmenu(struct s_my_menu *menu, struct s_hardware *hardware);
// About menu
void compute_aboutmenu(struct s_my_menu *menu);
// Summary menu
void compute_summarymenu(struct s_my_menu *menu, struct s_hardware *hardware);
-//PXE menu
-void compute_PXE(struct s_my_menu *menu,struct s_hardware *hardware);
+// PXE menu
+void compute_PXE(struct s_my_menu *menu, struct s_hardware *hardware);
//VESA menu
int compute_VESA(struct s_hdt_menu *hdt_menu, struct s_hardware *hardware);
int start_menu_mode(struct s_hardware *hardware, char *version_string);
void setup_menu(char *version);
-void compute_main_menu(struct s_hdt_menu *hdt_menu, struct s_hardware *hardware);
-void compute_submenus(struct s_hdt_menu *hdt_menu,struct s_hardware *hardware);
+void compute_main_menu(struct s_hdt_menu *hdt_menu,
+ struct s_hardware *hardware);
+void compute_submenus(struct s_hdt_menu *hdt_menu, struct s_hardware *hardware);
void detect_hardware(struct s_hardware *hardware);
#endif
* OTHER DEALINGS IN THE SOFTWARE.
*
* -----------------------------------------------------------------------
-*/
+ */
#ifndef DEFINE_HDT_H
#define DEFINE_HDT_H