]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Add in UefiApplicationEntryPoint library class and library instance.
authorqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 9 Jan 2007 08:17:21 +0000 (08:17 +0000)
committerqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 9 Jan 2007 08:17:21 +0000 (08:17 +0000)
The major difference between UefiApplicationEntryPoint and UefiDriverEntryPoint is that:
1) UEFI application will always be unloaded no matter what is the return status code from the application. Therefore, the library destructors should be called always.
2) UEFI application should not register any callback to evevnt such as EFI_EVENT_GROUP_VIRTUAL_ADDRESS_CHANGE and EFI_EVENT_GROUP_EXIT_BOOT_SERVICES.
3) UEFI application does not support module merger like Uefi Driver.

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

MdePkg/Include/Library/UefiApplicationEntryPoint.h [new file with mode: 0644]
MdePkg/Library/UefiApplicationEntryPoint/ApplicationEntryPoint.c [new file with mode: 0644]
MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.msa [new file with mode: 0644]
MdePkg/MdePkg.fpd
MdePkg/MdePkg.spd

diff --git a/MdePkg/Include/Library/UefiApplicationEntryPoint.h b/MdePkg/Include/Library/UefiApplicationEntryPoint.h
new file mode 100644 (file)
index 0000000..ff8b5b2
--- /dev/null
@@ -0,0 +1,129 @@
+/** @file\r
+  Entry point to a UEFI Application.\r
+\r
+Copyright (c) 2007, Intel Corporation<BR>\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
+\r
+**/\r
+\r
+#ifndef __UEFI_APPLICATION_ENTRY_POINT_H__\r
+#define __UEFI_APPLICATION_ENTRY_POINT_H__\r
+\r
+//\r
+// Declare the EFI/UEFI Specification Revision to which this driver is implemented \r
+//\r
+extern const UINT32                   _gUefiDriverRevision;\r
+\r
+/**\r
+  Enrty point to UEFI Application.\r
+\r
+  @param  ImageHandle ImageHandle of the loaded driver.\r
+  @param  SystemTable Pointer to the EFI System Table.\r
+\r
+  @retval  EFI_SUCCESS One or more of the drivers returned a success code.\r
+  @retval  !EFI_SUCESS The return status from the last driver entry point in the list.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+_ModuleEntryPoint (\r
+  IN EFI_HANDLE        ImageHandle,\r
+  IN EFI_SYSTEM_TABLE  *SystemTable\r
+  );\r
+\r
+\r
+/**\r
+  Enrty point wrapper of UEFI Application.\r
+\r
+  @param  ImageHandle ImageHandle of the loaded driver.\r
+  @param  SystemTable Pointer to the EFI System Table.\r
+\r
+  @retval  EFI_SUCCESS One or more of the drivers returned a success code.\r
+  @retval  !EFI_SUCESS The return status from the last driver entry point in the list.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+EfiMain (\r
+  IN EFI_HANDLE        ImageHandle,\r
+  IN EFI_SYSTEM_TABLE  *SystemTable\r
+  );\r
+\r
+\r
+/**\r
+  Invoke the destuctors of all libraries and call gBS->Exit\r
+  to return control to firmware core.\r
+\r
+  @param  Status Status returned by the application that is exiting.\r
+  \r
+  @retval VOID\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+Exit (\r
+  IN EFI_STATUS  Status\r
+  );\r
+\r
+\r
+/**\r
+  Call constructors for all libraries.  Autogen tool inserts the implementation\r
+  of this function into Autogen.c.\r
+\r
+  @param  ImageHandle ImageHandle of the loaded driver.\r
+  @param  SystemTable Pointer to the EFI System Table.\r
+  \r
+  @retval VOID\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+ProcessLibraryConstructorList (\r
+  IN EFI_HANDLE        ImageHandle,\r
+  IN EFI_SYSTEM_TABLE  *SystemTable\r
+  );\r
+\r
+\r
+/**\r
+  Call destructors for all libraries. Autogen tool inserts the implementation\r
+  of this function into Autogen.c.\r
+\r
+  @param  ImageHandle ImageHandle of the loaded driver.\r
+  @param  SystemTable Pointer to the EFI System Table.\r
+\r
+  @retval VOID\r
+**/\r
+VOID\r
+EFIAPI\r
+ProcessLibraryDestructorList (\r
+  IN EFI_HANDLE        ImageHandle,\r
+  IN EFI_SYSTEM_TABLE  *SystemTable\r
+  );\r
+\r
+/**\r
+  Call driver entry point. For UEFI application, user\r
+  can only specify one entry point. Tool will automatically insert\r
+  this to Autogen.c.\r
+\r
+  @param  ImageHandle ImageHandle of the loaded driver.\r
+  @param  SystemTable Pointer to the EFI System Table.\r
+\r
+  @return Status returned by entry points specified by\r
+          the user.  \r
\r
+**/\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+ProcessModuleEntryPointList (\r
+  IN EFI_HANDLE        ImageHandle,\r
+  IN EFI_SYSTEM_TABLE  *SystemTable\r
+  );\r
+\r
+#endif\r
diff --git a/MdePkg/Library/UefiApplicationEntryPoint/ApplicationEntryPoint.c b/MdePkg/Library/UefiApplicationEntryPoint/ApplicationEntryPoint.c
new file mode 100644 (file)
index 0000000..d6d9bea
--- /dev/null
@@ -0,0 +1,103 @@
+/** @file\r
+  Entry point library instance to a UEFI application.\r
+\r
+Copyright (c) 2007, Intel Corporation<BR>\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
+\r
+**/\r
+\r
+/**\r
+  Enrty point to UEFI application.\r
+\r
+  @param  ImageHandle ImageHandle of the loaded driver.\r
+  @param  SystemTable Pointer to the EFI System Table.\r
+\r
+  @retval  EFI_SUCCESS One or more of the drivers returned a success code.\r
+  @retval  !EFI_SUCESS The return status from the last driver entry point in the list.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+_ModuleEntryPoint (\r
+  IN EFI_HANDLE        ImageHandle,\r
+  IN EFI_SYSTEM_TABLE  *SystemTable\r
+  )\r
+{\r
+  EFI_STATUS                 Status;\r
+\r
+  if (_gUefiDriverRevision != 0) {\r
+    //\r
+    // Make sure that the EFI/UEFI spec revision of the platform is >= EFI/UEFI spec revision of the application.\r
+    //\r
+    if (SystemTable->Hdr.Revision < _gUefiDriverRevision) {\r
+      return EFI_INCOMPATIBLE_VERSION;\r
+    }\r
+  }\r
+\r
+  //\r
+  // Call constructor for all libraries.\r
+  //\r
+  ProcessLibraryConstructorList (ImageHandle, SystemTable);\r
+\r
+  //\r
+  // Call the module's entry point\r
+  //\r
+  Status = ProcessModuleEntryPointList (ImageHandle, SystemTable);\r
+\r
+  //\r
+  // Process destructor for all libraries.\r
+  //\r
+  ProcessLibraryDestructorList (ImageHandle, SystemTable);\r
+\r
+  //\r
+  // Return the return status code from the driver entry point\r
+  //\r
+  return Status;\r
+}\r
+\r
+/**\r
+  Invoke the destuctors of all libraries and call gBS->Exit\r
+  to return control to firmware core.\r
+\r
+  @param  Status Status returned by the application that is exiting.\r
+  \r
+  @retval VOID\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+Exit (\r
+  IN EFI_STATUS  Status\r
+  )\r
+\r
+{\r
+  ProcessLibraryDestructorList (gImageHandle, gST);\r
+\r
+  gBS->Exit (gImageHandle, Status, 0, NULL);\r
+}\r
+\r
+/**\r
+  Enrty point wrapper of UEFI Application.\r
+\r
+  @param  ImageHandle ImageHandle of the loaded driver.\r
+  @param  SystemTable Pointer to the EFI System Table.\r
+\r
+  @retval  EFI_SUCCESS One or more of the drivers returned a success code.\r
+  @retval  !EFI_SUCESS The return status from the last driver entry point in the list.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+EfiMain (\r
+  IN EFI_HANDLE        ImageHandle,\r
+  IN EFI_SYSTEM_TABLE  *SystemTable\r
+  )\r
+{\r
+  return _ModuleEntryPoint (ImageHandle, SystemTable);\r
+}\r
diff --git a/MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.msa b/MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.msa
new file mode 100644 (file)
index 0000000..3565085
--- /dev/null
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0">\r
+  <MsaHeader>\r
+    <ModuleName>UefiApplicationEntryPoint</ModuleName>\r
+    <ModuleType>UEFI_DRIVER</ModuleType>\r
+    <GuidValue>DADE8301-CB29-4fd5-8148-56FD246C5B88</GuidValue>\r
+    <Version>1.0</Version>\r
+    <Abstract>Component description file for the entry point to a EFI Application</Abstract>\r
+    <Description>Library to abstract entry point to a EFI Application.</Description>\r
+    <Copyright>Copyright (c) 2007, Intel Corporation.</Copyright>\r
+    <License>All rights reserved. This program and the accompanying materials
+      are licensed and made available under the terms and conditions of the BSD License
+      which accompanies this distribution.  The full text of the license may be found at
+      http://opensource.org/licenses/bsd-license.php
+      THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+      WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.</License>\r
+    <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION   0x00000052</Specification>\r
+  </MsaHeader>\r
+  <ModuleDefinitions>\r
+    <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>\r
+    <BinaryModule>false</BinaryModule>\r
+    <OutputFileBasename>UefiApplicationEntryPoint</OutputFileBasename>\r
+  </ModuleDefinitions>\r
+  <LibraryClassDefinitions>\r
+    <LibraryClass Usage="ALWAYS_PRODUCED">\r
+      <Keyword>UefiApplicationEntryPoint</Keyword>\r
+    </LibraryClass>\r
+    <LibraryClass Usage="ALWAYS_CONSUMED">\r
+      <Keyword>UefiBootServicesTableLib</Keyword>\r
+    </LibraryClass>\r
+  </LibraryClassDefinitions>\r
+  <SourceFiles>\r
+    <Filename>ApplicationEntryPoint.c</Filename>\r
+  </SourceFiles>\r
+  <PackageDependencies>\r
+    <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
+  </PackageDependencies>\r
+  <Externs>\r
+    <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>\r
+    <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>\r
+  </Externs>\r
+</ModuleSurfaceArea>
index 113b8eedaee39d2bb7b70562ee076ab2f233dd0b..2fba0c6f08e0347f0f3ed2144ec1d5aafc46c3dd 100644 (file)
@@ -6,7 +6,7 @@
     <Version>0.3</Version>\r
     <Abstract>EFI/Tiano MdePkg Package</Abstract>\r
     <Description>This FPD file is used for Package Level build.</Description>\r
     <Version>0.3</Version>\r
     <Abstract>EFI/Tiano MdePkg Package</Abstract>\r
     <Description>This FPD file is used for Package Level build.</Description>\r
-    <Copyright>Copyright (c) 2006, Intel Corporation</Copyright>\r
+    <Copyright>Copyright (c) 2006 - 2007, Intel Corporation</Copyright>\r
     <License>All rights reserved. This program and the accompanying materials
       are licensed and made available under the terms and conditions of the BSD License
       which accompanies this distribution.  The full text of the license may be found at
     <License>All rights reserved. This program and the accompanying materials
       are licensed and made available under the terms and conditions of the BSD License
       which accompanies this distribution.  The full text of the license may be found at
       </ModuleSaBuildOptions>\r
     </ModuleSA>\r
     <ModuleSA SupArchList="IA32" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" ModuleGuid="926c9cd0-4bb8-479b-9ac4-8a2a23f85307">\r
       </ModuleSaBuildOptions>\r
     </ModuleSA>\r
     <ModuleSA SupArchList="IA32" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" ModuleGuid="926c9cd0-4bb8-479b-9ac4-8a2a23f85307">\r
-      <PcdBuildDefinition>\r
-        <PcdData ItemType="FIXED_AT_BUILD">\r
-          <C_Name>PcdIoBlockBaseAddressForIpf</C_Name>\r
-          <Token>0x0000000c</Token>\r
-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>\r
-          <DatumType>UINT64</DatumType>\r
-          <MaxDatumSize>8</MaxDatumSize>\r
-          <Value>0x0ffffc000000</Value>\r
-        </PcdData>\r
-      </PcdBuildDefinition>\r
       <ModuleSaBuildOptions>\r
         <FvBinding>NULL</FvBinding>\r
         <FfsFormatKey>LIBRARY</FfsFormatKey>\r
       <ModuleSaBuildOptions>\r
         <FvBinding>NULL</FvBinding>\r
         <FfsFormatKey>LIBRARY</FfsFormatKey>\r
       </ModuleSaBuildOptions>\r
     </ModuleSA>\r
     <ModuleSA SupArchList="X64" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" ModuleGuid="926c9cd0-4bb8-479b-9ac4-8a2a23f85307">\r
       </ModuleSaBuildOptions>\r
     </ModuleSA>\r
     <ModuleSA SupArchList="X64" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" ModuleGuid="926c9cd0-4bb8-479b-9ac4-8a2a23f85307">\r
-      <PcdBuildDefinition>\r
-        <PcdData ItemType="FIXED_AT_BUILD">\r
-          <C_Name>PcdIoBlockBaseAddressForIpf</C_Name>\r
-          <Token>0x0000000c</Token>\r
-          <TokenSpaceGuidCName>gEfiMdePkgTokenSpaceGuid</TokenSpaceGuidCName>\r
-          <DatumType>UINT64</DatumType>\r
-          <MaxDatumSize>8</MaxDatumSize>\r
-          <Value>0x0ffffc000000</Value>\r
-        </PcdData>\r
-      </PcdBuildDefinition>\r
       <ModuleSaBuildOptions>\r
         <FvBinding>NULL</FvBinding>\r
         <FfsFormatKey>LIBRARY</FfsFormatKey>\r
       <ModuleSaBuildOptions>\r
         <FvBinding>NULL</FvBinding>\r
         <FfsFormatKey>LIBRARY</FfsFormatKey>\r
         <FfsFormatKey>LIBRARY</FfsFormatKey>\r
       </ModuleSaBuildOptions>\r
     </ModuleSA>\r
         <FfsFormatKey>LIBRARY</FfsFormatKey>\r
       </ModuleSaBuildOptions>\r
     </ModuleSA>\r
+    <!--Mod: UefiApplicationEntryPoint Type: UEFI_DRIVER Path: MdePkg\Library\UefiApplicationEntryPoint\UefiApplicationEntryPoint.msa-->\r
+    <ModuleSA ModuleGuid="DADE8301-CB29-4fd5-8148-56FD246C5B88" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3" SupArchList="IA32"/>\r
+    <!--Mod: UefiApplicationEntryPoint Type: UEFI_DRIVER Path: MdePkg\Library\UefiApplicationEntryPoint\UefiApplicationEntryPoint.msa-->\r
+    <ModuleSA ModuleGuid="DADE8301-CB29-4fd5-8148-56FD246C5B88" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3" SupArchList="X64"/>\r
+    <!--Mod: UefiApplicationEntryPoint Type: UEFI_DRIVER Path: MdePkg\Library\UefiApplicationEntryPoint\UefiApplicationEntryPoint.msa-->\r
+    <ModuleSA ModuleGuid="DADE8301-CB29-4fd5-8148-56FD246C5B88" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3" SupArchList="IPF"/>\r
+    <!--Mod: UefiApplicationEntryPoint Type: UEFI_DRIVER Path: MdePkg\Library\UefiApplicationEntryPoint\UefiApplicationEntryPoint.msa-->\r
+    <ModuleSA ModuleGuid="DADE8301-CB29-4fd5-8148-56FD246C5B88" ModuleVersion="1.0" PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec" PackageVersion="0.3" SupArchList="EBC"/>\r
   </FrameworkModules>\r
   <BuildOptions>\r
     <Ffs FfsKey="APPLICATION">\r
   </FrameworkModules>\r
   <BuildOptions>\r
     <Ffs FfsKey="APPLICATION">\r
index 86fa64c265a75831de690198a8a53ff33e473719..e92e203b01437579daf4a28a8607c76320f1f257 100644 (file)
@@ -6,7 +6,7 @@
     <Version>0.3</Version>\r
     <Abstract>Framework Module Development Environment Industry Standards</Abstract>\r
     <Description>This Package provides headers and libraries that conform to EFI/Framework Industry standards.</Description>\r
     <Version>0.3</Version>\r
     <Abstract>Framework Module Development Environment Industry Standards</Abstract>\r
     <Description>This Package provides headers and libraries that conform to EFI/Framework Industry standards.</Description>\r
-    <Copyright>Copyright (c) 2006, Intel Corporation.</Copyright>\r
+    <Copyright>Copyright (c) 2006 - 2007, Intel Corporation.</Copyright>\r
     <License>All rights reserved.
       This program and the accompanying materials are licensed and made available under
       the terms and conditions of the BSD License which accompanies this distribution.
     <License>All rights reserved.
       This program and the accompanying materials are licensed and made available under
       the terms and conditions of the BSD License which accompanies this distribution.
       <IncludeHeader>Include/Library/UefiRuntimeServicesTableLib.h</IncludeHeader>\r
       <HelpText/>\r
     </LibraryClass>\r
       <IncludeHeader>Include/Library/UefiRuntimeServicesTableLib.h</IncludeHeader>\r
       <HelpText/>\r
     </LibraryClass>\r
+    <LibraryClass Name="UefiApplicationEntryPoint" SupArchList="IA32 X64 IPF EBC ARM PPC" SupModuleList="UEFI_APPLICATION">\r
+      <IncludeHeader>Include/Library/UefiApplicationEntryPoint.h</IncludeHeader>\r
+      <HelpText>Library to abstract entry point to a EFI Application.</HelpText>\r
+    </LibraryClass>\r
   </LibraryClassDeclarations>\r
   <IndustryStdIncludes>\r
     <IndustryStdHeader Name="BaseTypes">\r
   </LibraryClassDeclarations>\r
   <IndustryStdIncludes>\r
     <IndustryStdHeader Name="BaseTypes">\r
     <Filename>Library/UefiLib/UefiLib.msa</Filename>\r
     <Filename>Library/DxeMemoryLib/DxeMemoryLib.msa</Filename>\r
     <Filename>Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.msa</Filename>\r
     <Filename>Library/UefiLib/UefiLib.msa</Filename>\r
     <Filename>Library/DxeMemoryLib/DxeMemoryLib.msa</Filename>\r
     <Filename>Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.msa</Filename>\r
+    <Filename>Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.msa</Filename>\r
   </MsaFiles>\r
   <PackageHeaders>\r
     <IncludePkgHeader ModuleType="BASE">Include/Base.h</IncludePkgHeader>\r
   </MsaFiles>\r
   <PackageHeaders>\r
     <IncludePkgHeader ModuleType="BASE">Include/Base.h</IncludePkgHeader>\r