]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Change to a NEON compatible CPU Arch (ARMv7 is NEON optional) and add performance...
authorandrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 21 Apr 2010 17:48:09 +0000 (17:48 +0000)
committerandrewfish <andrewfish@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 21 Apr 2010 17:48:09 +0000 (17:48 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10387 6f19259b-4bc3-4df7-8a09-765794883524

BeagleBoardPkg/BeagleBoardPkg.dsc
BeagleBoardPkg/Library/EblCmdLib/EblCmdLib.c
BeagleBoardPkg/Library/EblCmdLib/EblCmdLib.inf

index 4b08af25eb9f614e1a60b83f8a1359a75a3e917b..3394ed2607e7b4326e544e1976a1fd4621337c6f 100644 (file)
@@ -28,7 +28,6 @@
   BUILD_TARGETS                  = DEBUG|RELEASE
   SKUID_IDENTIFIER               = DEFAULT
   FLASH_DEFINITION               = BeagleBoardPkg/BeagleBoardPkg.fdf
-  DEFINE TARGET_HACK             = DEBUG
 
 
 [LibraryClasses.common]
   ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
   DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
   SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
+  PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
 
 
 [LibraryClasses.common.UEFI_APPLICATION]
   ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
   UefiDecompressLib|IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.inf
+  PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
 
 [LibraryClasses.common.UEFI_DRIVER]
   ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf
   UefiDecompressLib|IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.inf
   ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
+  PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
 
 [LibraryClasses.common.DXE_RUNTIME_DRIVER]
   HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
   XCODE:*_*_ARM_ARCHDLINK_FLAGS  == -arch armv7
   XCODE:RELEASE_*_*_CC_FLAGS     = -DMDEPKG_NDEBUG 
 
-  RVCT:*_*_ARM_ARCHCC_FLAGS == --cpu 7-A --thumb
-  RVCT:RELEASE_*_*_CC_FLAGS = -DMDEPKG_NDEBUG 
+  RVCT:*_*_ARM_ARCHCC_FLAGS  == --cpu Cortex-A8 --thumb
+  RVCT:*_*_ARM_ARCHASM_FLAGS == --cpu Cortex-A8 
+  RVCT:RELEASE_*_*_CC_FLAGS  = -DMDEPKG_NDEBUG 
 
 ################################################################################
 #
   gArmTokenSpaceGuid.PcdCpuResetAddress|0x80008000
   
   gEmbeddedTokenSpaceGuid.PcdTimerPeriod|100000
-  gEmbeddedTokenSpaceGuid.PcdEmbeddedFdPerformanceCounterPeriodInNanoseconds|77
-  gEmbeddedTokenSpaceGuid.PcdEmbeddedFdPerformanceCounterFrequencyInHz|13000000
+  gEmbeddedTokenSpaceGuid.PcdEmbeddedPerformanceCounterPeriodInNanoseconds|77
+  gEmbeddedTokenSpaceGuid.PcdEmbeddedPerformanceCounterFrequencyInHz|13000000
   
   #
   # ARM Pcds
   # Bds
   #
   BeagleBoardPkg/Bds/Bds.inf  
-  
-  #
-  # Gdb Stub
+
   #
-  EmbeddedPkg/GdbStub/GdbStub.inf
-  ArmPkg/Drivers/DebugSupportDxe/DebugSupportDxe.inf
+  # Example Application
+  #  
+  MdeModulePkg/Application/HelloWorld/HelloWorld.inf
 
index 2141c159b500e6ef962ca3f0b15790d7c3e112f5..413bb47fc28ab9fdf86414ed369ebcd9e78633eb 100644 (file)
 #include <Library/EfiFileLib.h>\r
 #include <Library/ArmDisassemblerLib.h>\r
 #include <Library/PeCoffGetEntryPointLib.h>\r
+#include <Library/PerformanceLib.h>\r
+#include <Library/TimerLib.h>\r
 \r
 #include <Guid/DebugImageInfoTable.h>\r
+\r
 #include <Protocol/DebugSupport.h>\r
 #include <Protocol/LoadedImage.h>\r
 \r
@@ -146,6 +149,101 @@ EblDisassembler (
 }\r
 \r
 \r
+CHAR8 *\r
+ImageHandleToPdbFileName (\r
+  IN  EFI_HANDLE    Handle\r
+  )\r
+{\r
+  EFI_STATUS                  Status;\r
+  EFI_LOADED_IMAGE_PROTOCOL   *LoadedImage;\r
+\r
+  Status = gBS->HandleProtocol (Handle, &gEfiLoadedImageProtocolGuid, (VOID **)&LoadedImage);\r
+  if (EFI_ERROR (Status)) {\r
+    return "";\r
+  }\r
+\r
+  return PeCoffLoaderGetPdbPointer (LoadedImage->ImageBase);\r
+}\r
+\r
+CHAR8 *mTokenList[] = {\r
+  "SEC",\r
+  "PEI",\r
+  "DXE",\r
+  "BDS",\r
+  NULL\r
+};\r
+\r
+/**\r
+  Simple arm disassembler via a library\r
+\r
+  Argv[0] - disasm\r
+  Argv[1] - Address to start disassembling from\r
+  ARgv[2] - Number of instructions to disassembly (optional)\r
+\r
+  @param  Argc   Number of command arguments in Argv\r
+  @param  Argv   Array of strings that represent the parsed command line. \r
+                 Argv[0] is the comamnd name\r
+\r
+  @return EFI_SUCCESS\r
+\r
+**/\r
+EFI_STATUS\r
+EblPerformance (\r
+  IN UINTN  Argc,\r
+  IN CHAR8  **Argv\r
+  )\r
+{\r
+  UINTN       Key;\r
+  CONST VOID  *Handle;\r
+  CONST CHAR8 *Token, *Module;\r
+  UINT64      Start, Stop, TimeStamp;\r
+  UINT64      Delta, TicksPerSecond, Milliseconds, Microseconds;\r
+  UINTN       Index;\r
+\r
+  TicksPerSecond = GetPerformanceCounterProperties (NULL, NULL);\r
+\r
+  Key       = 0;\r
+  do {\r
+    Key = GetPerformanceMeasurement (Key, (CONST VOID **)&Handle, &Token, &Module, &Start, &Stop);\r
+    if (Key != 0) {\r
+      if (AsciiStriCmp ("StartImage:", Token) == 0) {\r
+        if (Stop == 0) {\r
+          // The entry for EBL is still running so the stop time will be zero. Skip it\r
+          AsciiPrint ("   running     %a\n", ImageHandleToPdbFileName ((EFI_HANDLE)Handle));\r
+        } else {\r
+          Delta = Stop - Start;\r
+          Microseconds = DivU64x64Remainder (MultU64x32 (Delta, 1000000), TicksPerSecond, NULL);\r
+          AsciiPrint ("%10ld us  %a\n", Microseconds, ImageHandleToPdbFileName ((EFI_HANDLE)Handle));\r
+        }\r
+      }\r
+    }\r
+  } while (Key != 0);\r
+\r
+  AsciiPrint ("\n");\r
+\r
+  TimeStamp = 0;\r
+  Key       = 0;\r
+  do {\r
+    Key = GetPerformanceMeasurement (Key, (CONST VOID **)&Handle, &Token, &Module, &Start, &Stop);\r
+    if (Key != 0) {\r
+      for (Index = 0; mTokenList[Index] != NULL; Index++) {\r
+        if (AsciiStriCmp (mTokenList[Index], Token) == 0) {\r
+          Delta = Stop - Start;\r
+          TimeStamp += Delta;\r
+          Milliseconds = DivU64x64Remainder (MultU64x32 (Delta, 1000), TicksPerSecond, NULL);\r
+          AsciiPrint ("%6a %6ld ms\n", Token, Milliseconds);\r
+          break;\r
+        }\r
+      }   \r
+    }\r
+  } while (Key != 0);\r
+\r
+  AsciiPrint ("Total Time = %ld ms\n\n", DivU64x64Remainder (MultU64x32 (TimeStamp, 1000), TicksPerSecond, NULL));\r
+\r
+  return EFI_SUCCESS;\r
+}\r
+\r
+\r
 GLOBAL_REMOVE_IF_UNREFERENCED const EBL_COMMAND_TABLE mLibCmdTemplate[] =\r
 {\r
   {\r
@@ -154,6 +252,12 @@ GLOBAL_REMOVE_IF_UNREFERENCED const EBL_COMMAND_TABLE mLibCmdTemplate[] =
     NULL,\r
     EblDisassembler\r
   },\r
+  {\r
+    "performance",\r
+    " Display boot performance info",\r
+    NULL,\r
+    EblPerformance\r
+  },\r
   {\r
     "symboltable [\"format string\"] [PECOFF]",\r
     " show symbol table commands for debugger",\r
index 9273aa92e4f48fe4b192395624a43430a4b92a82..8fa7805fb0a04fb3a2adfd22ddb7ba2c39e125fe 100644 (file)
@@ -34,6 +34,7 @@
 \r
 [Packages]\r
   MdePkg/MdePkg.dec\r
+  MdeModulePkg/MdeModulePkg.dec\r
   EmbeddedPkg/EmbeddedPkg.dec\r
   ArmPkg/ArmPkg.dec\r
 \r
@@ -41,6 +42,8 @@
   BaseLib\r
   DebugLib\r
   ArmDisassemblerLib\r
+  PerformanceLib\r
+  TimerLib\r
   \r
 [Protocols]\r
  gEfiDebugSupportProtocolGuid\r
@@ -48,4 +51,3 @@
   \r
 [Guids]\r
  gEfiDebugImageInfoTableGuid\r
\r