]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelSiliconPkg/Feature/VTd/PlatformVTdInfoSamplePei/PlatformVTdInfoSamplePei.c
IntelSiliconPkg/PlatformIntelVTdInfoSamplePei: Move to feature dir.
[mirror_edk2.git] / IntelSiliconPkg / Feature / VTd / PlatformVTdInfoSamplePei / PlatformVTdInfoSamplePei.c
diff --git a/IntelSiliconPkg/Feature/VTd/PlatformVTdInfoSamplePei/PlatformVTdInfoSamplePei.c b/IntelSiliconPkg/Feature/VTd/PlatformVTdInfoSamplePei/PlatformVTdInfoSamplePei.c
new file mode 100644 (file)
index 0000000..c79398f
--- /dev/null
@@ -0,0 +1,65 @@
+/** @file\r
+  Platform VTd Info Sample PEI driver.\r
+\r
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>\r
+  This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include <PiPei.h>\r
+\r
+#include <Ppi/VTdInfo.h>\r
+\r
+#include <Library/PeiServicesLib.h>\r
+#include <Library/DebugLib.h>\r
+\r
+typedef struct {\r
+  UINT64                                  Revision;\r
+  UINT8                                   HostAddressWidth;\r
+  UINT8                                   Reserved[3];\r
+  UINT32                                  VTdEngineCount;\r
+  UINT64                                  VTdEngineAddress[2];\r
+} MY_VTD_INFO_PPI;\r
+\r
+MY_VTD_INFO_PPI  mPlatformVTdSample = {\r
+  EDKII_VTD_INFO_PPI_REVISION,\r
+  0x26,\r
+  {0},\r
+  2,\r
+  {0xFED90000, 0xFED91000},\r
+};\r
+\r
+EFI_PEI_PPI_DESCRIPTOR mPlatformVTdInfoSampleDesc = {\r
+  (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
+  &gEdkiiVTdInfoPpiGuid,\r
+  &mPlatformVTdSample\r
+};\r
+\r
+/**\r
+  Platform VTd Info sample driver.\r
+\r
+  @param[in] FileHandle  Handle of the file being invoked.\r
+  @param[in] PeiServices Describes the list of possible PEI Services.\r
+\r
+  @retval EFI_SUCCESS if it completed successfully.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+PlatformVTdInfoSampleInitialize (\r
+  IN       EFI_PEI_FILE_HANDLE  FileHandle,\r
+  IN CONST EFI_PEI_SERVICES     **PeiServices\r
+  )\r
+{\r
+  EFI_STATUS  Status;\r
+\r
+  Status = PeiServicesInstallPpi (&mPlatformVTdInfoSampleDesc);\r
+  ASSERT_EFI_ERROR (Status);\r
+\r
+  return Status;\r
+}\r