blob: 22ce7a57cd0d3e3c3be2c009fdd21c1f9000a549 [file] [log] [blame]
Angel Ponsbea5ce72020-07-29 18:40:00 +02001/* SPDX-License-Identifier: GPL-2.0-only */
2
3#include <memory_info.h>
4#include <smbios.h>
5#include <stdint.h>
6#include <string.h>
7
8/* this function will fill the corresponding locator */
9__weak void smbios_fill_dimm_locator(const struct dimm_info *dimm, struct smbios_type17 *t)
10{
11 char locator[40];
12
13 snprintf(locator, sizeof(locator), "Channel-%d-DIMM-%d",
14 dimm->channel_num, dimm->dimm_num);
15 t->device_locator = smbios_add_string(t->eos, locator);
16
17 snprintf(locator, sizeof(locator), "BANK %d", dimm->bank_locator);
18 t->bank_locator = smbios_add_string(t->eos, locator);
19}
20
21__weak const char *smbios_mainboard_bios_version(void)
22{
23 return NULL;
24}
25
26__weak const char *smbios_mainboard_serial_number(void)
27{
28 return CONFIG_MAINBOARD_SERIAL_NUMBER;
29}
30
31__weak const char *smbios_mainboard_version(void)
32{
33 return CONFIG_MAINBOARD_VERSION;
34}
35
36__weak const char *smbios_mainboard_manufacturer(void)
37{
38 return CONFIG_MAINBOARD_SMBIOS_MANUFACTURER;
39}
40
41__weak const char *smbios_mainboard_product_name(void)
42{
43 return CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME;
44}
45
46__weak const char *smbios_mainboard_asset_tag(void)
47{
48 return "";
49}
50
51__weak u8 smbios_mainboard_feature_flags(void)
52{
53 return 0;
54}
55
56__weak const char *smbios_mainboard_location_in_chassis(void)
57{
58 return "";
59}
60
61__weak smbios_board_type smbios_mainboard_board_type(void)
62{
63 return SMBIOS_BOARD_TYPE_UNKNOWN;
64}
65
66/*
67 * System Enclosure or Chassis Types as defined in SMBIOS specification.
68 * The default value is SMBIOS_ENCLOSURE_DESKTOP (0x03) but laptop,
69 * convertible, or tablet enclosure will be used if the appropriate
70 * system type is selected.
71 */
72__weak smbios_enclosure_type smbios_mainboard_enclosure_type(void)
73{
74 if (CONFIG(SYSTEM_TYPE_LAPTOP))
75 return SMBIOS_ENCLOSURE_LAPTOP;
76 else if (CONFIG(SYSTEM_TYPE_TABLET))
77 return SMBIOS_ENCLOSURE_TABLET;
78 else if (CONFIG(SYSTEM_TYPE_CONVERTIBLE))
79 return SMBIOS_ENCLOSURE_CONVERTIBLE;
80 else if (CONFIG(SYSTEM_TYPE_DETACHABLE))
81 return SMBIOS_ENCLOSURE_DETACHABLE;
82 else
83 return SMBIOS_ENCLOSURE_DESKTOP;
84}
85
86__weak const char *smbios_system_serial_number(void)
87{
88 return smbios_mainboard_serial_number();
89}
90
91__weak const char *smbios_system_version(void)
92{
93 return smbios_mainboard_version();
94}
95
96__weak const char *smbios_system_manufacturer(void)
97{
98 return smbios_mainboard_manufacturer();
99}
100
101__weak const char *smbios_system_product_name(void)
102{
103 return smbios_mainboard_product_name();
104}
105
106__weak void smbios_system_set_uuid(u8 *uuid)
107{
108 /* leave all zero */
109}
110
111__weak unsigned int smbios_cpu_get_max_speed_mhz(void)
112{
113 return 0; /* Unknown */
114}
115
116__weak unsigned int smbios_cpu_get_current_speed_mhz(void)
117{
118 return 0; /* Unknown */
119}
120
121__weak const char *smbios_system_sku(void)
122{
123 return "";
124}
125
126__weak const char *smbios_chassis_version(void)
127{
128 return "";
129}
130
131__weak const char *smbios_chassis_serial_number(void)
132{
133 return "";
134}
135
136__weak const char *smbios_processor_serial_number(void)
137{
138 return "";
139}