Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

94 lines
2.5 KiB

  1. #include <efi.h>
  2. #include <efilib.h>
  3. // CPUID Registers
  4. #define CV_IA64_CPUID0 3328
  5. #define CV_IA64_CPUID1 3329
  6. #define CV_IA64_CPUID2 3330
  7. #define CV_IA64_CPUID3 3331
  8. #define CV_IA64_CPUID4 3332
  9. EFI_STATUS
  10. EfiMain ( IN EFI_HANDLE ImageHandle,
  11. IN EFI_SYSTEM_TABLE *SystemTable)
  12. {
  13. UINT64 val64;
  14. UINT32 val32;
  15. UINT32 model;
  16. UINT32 revision;
  17. UINT32 family;
  18. InitializeLib( ImageHandle, SystemTable );
  19. Print( L"CPUID Program\n\n" );
  20. SystemTable->ConOut->ClearScreen( SystemTable->ConOut );
  21. val64 = __getReg( CV_IA64_CPUID3 );
  22. model = ( UINT32 )( ( val64 >> 16 ) & 0xFF ); // ProcessorModel
  23. Print( L"Processor Model = %x\n", model );
  24. revision = ( UINT32 )( ( val64 >> 8 ) & 0xFF ); // ProcessorRevision
  25. Print( L"Processor Revision = %x\n", revision );
  26. family = ( UINT32 ) ( ( val64 >> 24 ) & 0xFF ); // ProcessorFamily
  27. Print( L"Processor Family = %x\n", family );
  28. val32 = ( UINT32 ) ( ( val64 >> 32 ) & 0xFF ); // ProcessorArchRev
  29. Print( L"Processor ArchRev = %x\n\n", val32 );
  30. switch ( model ) {
  31. case 0: Print( L"Itanium " );
  32. break;
  33. case 1: Print( L"McKinley " );
  34. break;
  35. default: Print( L"IA64 " );
  36. break;
  37. }
  38. switch ( revision ) {
  39. case 0: Print( L"A stepping\n\n" );
  40. break;
  41. case 1: Print( L"B0 stepping\n\n" );
  42. break;
  43. case 2: Print( L"B1 stepping\n\n" );
  44. break;
  45. case 3: Print( L"B2 stepping \n\n" );
  46. break;
  47. default: Print( L"Unknown stepping\n\n" );
  48. break;
  49. }
  50. // IA64 architected CPUID0 & CPUID1: Vendor Information.
  51. val64 = __getReg( CV_IA64_CPUID0 );
  52. Print( L"VendorString[0] = %X\n", val64 );
  53. val64 = __getReg( CV_IA64_CPUID1 );
  54. Print( L"VendorString[1] = %X\n", val64 );
  55. // IA64 architected CPUID2: Processor Serial Number.
  56. val64 = __getReg( CV_IA64_CPUID2 );
  57. Print( L"Processor Serial Number = %X\n", val64 );
  58. // IA64 architected CPUID4: General Features / Capability bits.
  59. val64 = __getReg( CV_IA64_CPUID4 );
  60. Print( L"Processor Feature Bits = %X\n\n", val64 );
  61. return EFI_SUCCESS;
  62. }