]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Add PrintThunk driver, it depends on PrintLib on top of MdePkg:
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 23 Feb 2009 03:25:36 +0000 (03:25 +0000)
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 23 Feb 2009 03:25:36 +0000 (03:25 +0000)
1. If the library instance is BasePrintLib, it has no prerequisite to produce EDK print protocol
2. If the library instance mapping is DxePrintLibPrint2Protocol, it acts as PrintOnPrint2Thunk.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7584 6f19259b-4bc3-4df7-8a09-765794883524

EdkCompatibilityPkg/Compatibility/PrintThunk/PrintThunk.c [new file with mode: 0644]
EdkCompatibilityPkg/Compatibility/PrintThunk/PrintThunk.inf [new file with mode: 0644]

diff --git a/EdkCompatibilityPkg/Compatibility/PrintThunk/PrintThunk.c b/EdkCompatibilityPkg/Compatibility/PrintThunk/PrintThunk.c
new file mode 100644 (file)
index 0000000..6d17f5b
--- /dev/null
@@ -0,0 +1,68 @@
+/** @file\r
+  Module produces EDK gEfiPrintProtocolGuid for backward compatibility support.\r
+\r
+  EDK II retires old EDK Print Protocol and this module produces\r
+  gEfiPrintProtocolGuid based on PrintLib:\r
+  1) If it links against BasePrintLib in MdePkg, it produces gEfiPrintProtocolGuid\r
+     without any prerequisites.\r
+  2) If it links against DxePrintLibPrint2Protocol in MdeModulePkg, it produces\r
+     gEfiPrintProtocolGuid on top of gEfiPrint2ProtocolGuid.\r
+\r
+Copyright (c) 2009, Intel Corporation\r
+\r
+All rights reserved. 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
+Module Name:\r
+\r
+**/\r
+\r
+#include <PiDxe.h>\r
+\r
+#include <Protocol/Print.h>\r
+#include <Library/PrintLib.h>\r
+#include <Library/UefiBootServicesTableLib.h>\r
+#include <Library/DebugLib.h>\r
+\r
+EFI_HANDLE  mPrintThunkHandle = NULL;\r
+\r
+CONST EFI_PRINT_PROTOCOL mPrintProtocol = {\r
+  UnicodeVSPrint,\r
+};\r
+\r
+\r
+/**\r
+  The user Entry Point for Print thunk module.\r
+\r
+  This is the entry point for Print thunk DXE Driver. It installs the Print Protocol on\r
+  top of PrintLib class in MdePkg.\r
+\r
+  @param[in] ImageHandle    The firmware allocated handle for the EFI image.\r
+  @param[in] SystemTable    A pointer to the EFI System Table.\r
+\r
+  @retval EFI_SUCCESS       The entry point is executed successfully.\r
+  @retval Others            Some error occurs when executing this entry point.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+InitPrintThunk (\r
+  IN EFI_HANDLE           ImageHandle,\r
+  IN EFI_SYSTEM_TABLE     *SystemTable\r
+  )\r
+{\r
+  EFI_STATUS  Status;\r
+\r
+  Status = gBS->InstallMultipleProtocolInterfaces (\r
+                  &mPrintThunkHandle,\r
+                  &gEfiPrintProtocolGuid, &mPrintProtocol,\r
+                  NULL\r
+                  );\r
+  ASSERT_EFI_ERROR (Status);\r
+\r
+  return Status;\r
+}\r
diff --git a/EdkCompatibilityPkg/Compatibility/PrintThunk/PrintThunk.inf b/EdkCompatibilityPkg/Compatibility/PrintThunk/PrintThunk.inf
new file mode 100644 (file)
index 0000000..c3a1373
--- /dev/null
@@ -0,0 +1,55 @@
+#/** @file\r
+# Module produces EDK gEfiPrintProtocolGuid for backward compatibility support.\r
+#\r
+# EDK II retires old EDK Print Protocol and this module produces\r
+# gEfiPrintProtocolGuid based on PrintLib:\r
+# 1) If it links against BasePrintLib in MdePkg, it produces gEfiPrintProtocolGuid\r
+#    without any prerequisites.\r
+# 2) If it links against DxePrintLibPrint2Protocol in MdeModulePkg, it produces\r
+#    gEfiPrintProtocolGuid on top of gEfiPrint2ProtocolGuid.\r
+#\r
+# Copyright (c) 2009, Intel Corporation\r
+#\r
+#  All rights reserved. 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
+#  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
+\r
+[Defines]\r
+  INF_VERSION                    = 0x00010005\r
+  BASE_NAME                      = PrintThunk\r
+  FILE_GUID                      = 3792FF94-8614-45ed-902B-1207BF1490A8\r
+  MODULE_TYPE                    = DXE_DRIVER\r
+  VERSION_STRING                 = 1.0\r
+\r
+  ENTRY_POINT                    = InitPrintThunk\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC\r
+#\r
+\r
+[Sources]\r
+  PrintThunk.c\r
+\r
+[Packages]\r
+  MdePkg/MdePkg.dec\r
+  EdkCompatibilityPkg/EdkCompatibilityPkg.dec\r
+\r
+[LibraryClasses]\r
+  UefiDriverEntryPoint\r
+  DebugLib\r
+  UefiBootServicesTableLib\r
+  PrintLib\r
+\r
+[Protocols]\r
+  gEfiPrintProtocolGuid      ## PRODUCES\r
+\r
+[Depex]\r
+  TRUE\r