report_platform.c 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. * From Coreboot src/northbridge/intel/sandybridge/report_platform.c
  3. *
  4. * Copyright (C) 2012 Google Inc.
  5. *
  6. * SPDX-License-Identifier: GPL-2.0
  7. */
  8. #include <common.h>
  9. #include <asm/cpu.h>
  10. #include <asm/pci.h>
  11. #include <asm/arch/pch.h>
  12. static void report_cpu_info(void)
  13. {
  14. char cpu_string[CPU_MAX_NAME_LEN], *cpu_name;
  15. const char *mode[] = {"NOT ", ""};
  16. struct cpuid_result cpuidr;
  17. int vt, txt, aes;
  18. u32 index;
  19. index = 0x80000000;
  20. cpuidr = cpuid(index);
  21. if (cpuidr.eax < 0x80000004) {
  22. strcpy(cpu_string, "Platform info not available");
  23. cpu_name = cpu_string;
  24. } else {
  25. cpu_name = cpu_get_name(cpu_string);
  26. }
  27. cpuidr = cpuid(1);
  28. debug("CPU id(%x): %s\n", cpuidr.eax, cpu_name);
  29. aes = (cpuidr.ecx & (1 << 25)) ? 1 : 0;
  30. txt = (cpuidr.ecx & (1 << 6)) ? 1 : 0;
  31. vt = (cpuidr.ecx & (1 << 5)) ? 1 : 0;
  32. debug("AES %ssupported, TXT %ssupported, VT %ssupported\n",
  33. mode[aes], mode[txt], mode[vt]);
  34. }
  35. /* The PCI id name match comes from Intel document 472178 */
  36. static struct {
  37. u16 dev_id;
  38. const char *dev_name;
  39. } pch_table[] = {
  40. {0x1E41, "Desktop Sample"},
  41. {0x1E42, "Mobile Sample"},
  42. {0x1E43, "SFF Sample"},
  43. {0x1E44, "Z77"},
  44. {0x1E45, "H71"},
  45. {0x1E46, "Z75"},
  46. {0x1E47, "Q77"},
  47. {0x1E48, "Q75"},
  48. {0x1E49, "B75"},
  49. {0x1E4A, "H77"},
  50. {0x1E53, "C216"},
  51. {0x1E55, "QM77"},
  52. {0x1E56, "QS77"},
  53. {0x1E58, "UM77"},
  54. {0x1E57, "HM77"},
  55. {0x1E59, "HM76"},
  56. {0x1E5D, "HM75"},
  57. {0x1E5E, "HM70"},
  58. {0x1E5F, "NM70"},
  59. };
  60. static void report_pch_info(void)
  61. {
  62. const char *pch_type = "Unknown";
  63. int i;
  64. u16 dev_id;
  65. uint8_t rev_id;
  66. dev_id = x86_pci_read_config16(PCH_LPC_DEV, 2);
  67. for (i = 0; i < ARRAY_SIZE(pch_table); i++) {
  68. if (pch_table[i].dev_id == dev_id) {
  69. pch_type = pch_table[i].dev_name;
  70. break;
  71. }
  72. }
  73. rev_id = x86_pci_read_config8(PCH_LPC_DEV, 8);
  74. debug("PCH type: %s, device id: %x, rev id %x\n", pch_type, dev_id,
  75. rev_id);
  76. }
  77. void report_platform_info(void)
  78. {
  79. report_cpu_info();
  80. report_pch_info();
  81. }