summaryrefslogtreecommitdiff
path: root/com32/hdt/hdt-cli-vpd.c
blob: 67c58008a714bdf3396c58601da11fd5343670c3 (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
/* ----------------------------------------------------------------------- *
 *
 *   Copyright 2009 Pierre-Alexandre Meyer - 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.
 *
 * -----------------------------------------------------------------------
 */

#include <string.h>
#include <vpd/vpd.h>

#include "hdt-cli.h"
#include "hdt-common.h"

void main_show_vpd(int argc __unused, char **argv __unused,
		   struct s_hardware *hardware)
{
    reset_more_printf();

    if (!hardware->is_vpd_valid) {
	more_printf("No VPD structure detected.\n");
	return;
    }

    more_printf("VPD present at address : %s\n", hardware->vpd.base_address);
    if (strlen(hardware->vpd.bios_build_id) > 0)
	more_printf("Bios Build ID                 : %s\n",
		    hardware->vpd.bios_build_id);
    if (strlen(hardware->vpd.bios_release_date) > 0)
	more_printf("Bios Release Date             : %s\n",
		    hardware->vpd.bios_release_date);
    if (strlen(hardware->vpd.bios_version) > 0)
	more_printf("Bios Version                  : %s\n",
		    hardware->vpd.bios_version);
    if (strlen(hardware->vpd.default_flash_filename) > 0)
	more_printf("Default Flash Filename        : %s\n",
		    hardware->vpd.default_flash_filename);
    if (strlen(hardware->vpd.box_serial_number) > 0)
	more_printf("Box Serial Number             : %s\n",
		    hardware->vpd.box_serial_number);
    if (strlen(hardware->vpd.motherboard_serial_number) > 0)
	more_printf("Motherboard Serial Number     : %s\n",
		    hardware->vpd.motherboard_serial_number);
    if (strlen(hardware->vpd.machine_type_model) > 0)
	more_printf("Machine Type/Model            : %s\n",
		    hardware->vpd.machine_type_model);
}

struct cli_module_descr vpd_show_modules = {
    .modules = NULL,
    .default_callback = main_show_vpd,
};

struct cli_mode_descr vpd_mode = {
    .mode = VPD_MODE,
    .name = CLI_VPD,
    .default_modules = NULL,
    .show_modules = &vpd_show_modules,
    .set_modules = NULL,
};