#include <cpu/x86/name.h>
#include <cbfs_core.h>
#include <arch/byteorder.h>
+#if CONFIG_CHROMEOS
+#include <vendorcode/google/chromeos/gnvs.h>
+#endif
static u8 smbios_checksum(u8 *p, u32 length)
{
static int smbios_cpu_vendor(char *start)
{
- char tmp[13];
+ char tmp[13] = "Unknown";
u32 *_tmp = (u32 *)tmp;
- struct cpuid_result res = cpuid(0);
+ struct cpuid_result res;
- _tmp[0] = res.ebx;
- _tmp[1] = res.edx;
- _tmp[2] = res.ecx;
- tmp[12] = '\0';
- return smbios_add_string(start, tmp);
+ if (cpu_have_cpuid()) {
+ res = cpuid(0);
+ _tmp[0] = res.ebx;
+ _tmp[1] = res.edx;
+ _tmp[2] = res.ecx;
+ tmp[12] = '\0';
+ }
+ return smbios_add_string(start, tmp);
}
static int smbios_processor_name(char *start)
{
- char tmp[49];
+ char tmp[49] = "Unknown Processor Name";
u32 *_tmp = (u32 *)tmp;
struct cpuid_result res;
int i;
- for (i = 0; i < 3; i++) {
- res = cpuid(0x80000002 + i);
- _tmp[i * 4 + 0] = res.eax;
- _tmp[i * 4 + 1] = res.ebx;
- _tmp[i * 4 + 2] = res.ecx;
- _tmp[i * 4 + 3] = res.edx;
+ if (cpu_have_cpuid()) {
+ res = cpuid(0x80000000);
+ if (res.eax >= 0x80000004) {
+ for (i = 0; i < 3; i++) {
+ res = cpuid(0x80000002 + i);
+ _tmp[i * 4 + 0] = res.eax;
+ _tmp[i * 4 + 1] = res.ebx;
+ _tmp[i * 4 + 2] = res.ecx;
+ _tmp[i * 4 + 3] = res.edx;
+ }
+ tmp[48] = 0;
+ }
}
-
- tmp[48] = 0;
return smbios_add_string(start, tmp);
}
t->length = len - 2;
t->vendor = smbios_add_string(t->eos, "coreboot");
+#if !CONFIG_CHROMEOS
t->bios_release_date = smbios_add_string(t->eos, COREBOOT_DMI_DATE);
t->bios_version = smbios_add_string(t->eos, COREBOOT_VERSION);
+#else
+#define SPACES \
+ " "
+ t->bios_release_date = smbios_add_string(t->eos, COREBOOT_DMI_DATE);
+ u32 version_offset = (u32)smbios_string_table_len(t->eos);
+ t->bios_version = smbios_add_string(t->eos, SPACES);
+ /* SMBIOS offsets start at 1 rather than 0 */
+ vboot_data->vbt10 = (u32)t->eos + (version_offset - 1);
+#endif
if ((hdr = get_cbfs_header()) != (struct cbfs_header *)0xffffffff)
t->bios_rom_size = (ntohl(hdr->romsize) / 65535) - 1;
t->length = len - 2;
t->manufacturer = smbios_add_string(t->eos, CONFIG_MAINBOARD_VENDOR);
t->product_name = smbios_add_string(t->eos, CONFIG_MAINBOARD_PART_NUMBER);
+ t->serial_number = smbios_add_string(t->eos, "123456789");
+ t->version = smbios_add_string(t->eos, "1.0");
len = t->length + smbios_string_table_len(t->eos);
*current += len;
return len;
struct smbios_type4 *t = (struct smbios_type4 *)*current;
int len = sizeof(struct smbios_type4);
- res = cpuid(1);
+ /* Provide sane defaults even for CPU without CPUID */
+ res.eax = res.edx = 0;
+ res.ebx = 0x10000;
+
+ if (cpu_have_cpuid()) {
+ res = cpuid(1);
+ }
memset(t, 0, sizeof(struct smbios_type4));
t->type = SMBIOS_PROCESSOR_INFORMATION;
t->processor_id[1] = res.edx;
t->processor_manufacturer = smbios_cpu_vendor(t->eos);
t->processor_version = smbios_processor_name(t->eos);
- t->processor_family = 0x0c;
+ t->processor_family = (res.eax > 0) ? 0x0c : 0x6;
t->processor_type = 3; /* System Processor */
t->processor_upgrade = 0x06;
t->core_count = (res.ebx >> 16) & 0xff;