public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch] Revert "BaseTools:BaseTools supports to the driver combination."
@ 2019-02-25  0:15 Liming Gao
  2019-02-28  2:06 ` Feng, Bob C
  0 siblings, 1 reply; 2+ messages in thread
From: Liming Gao @ 2019-02-25  0:15 UTC (permalink / raw)
  To: edk2-devel

This reverts commit 838bc257bae3f9fc6723f41f3980f6cfbedb77e5.
After further evaluation, there are the unclear behavior in for the
driver combination feature. To not impact Q1 stable tag, remove it first.
1. If the drivers to be combined have the different PCD or library instance
   setting, build should not combine them and report build break. But this
   commit doesn't consider this case.
2. When start the sub driver fail, continue to start other sub driver. This
   behavior is required to be clarifed in build spec. 
3. Unload the sub driver when the combined driver start fail. This case need 
   to call the sub driver unload function for the driver start fail only.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
---
 BaseTools/Source/Python/AutoGen/GenC.py            | 32 ++++------------------
 .../Source/Python/Workspace/WorkspaceCommon.py     |  8 ------
 2 files changed, 5 insertions(+), 35 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Python/AutoGen/GenC.py
index 0f1b3bb9a3..a922464f56 100644
--- a/BaseTools/Source/Python/AutoGen/GenC.py
+++ b/BaseTools/Source/Python/AutoGen/GenC.py
@@ -1457,25 +1457,10 @@ def CreateLibraryDestructorCode(Info, AutoGenC, AutoGenH):
 def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH):
     if Info.IsLibrary or Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_SEC]:
         return
-    ModuleEntryPointList = []
-    for Lib in Info.DependentLibraryList:
-        if len(Lib.ModuleEntryPointList) > 0:
-            if Lib.ModuleType == Info.ModuleType:
-                ModuleEntryPointList = ModuleEntryPointList + Lib.ModuleEntryPointList
-            else:
-                EdkLogger.error(
-                    "build",
-                    PREBUILD_ERROR,
-                    "Driver's ModuleType must be consistent [%s]"%(str(Lib)),
-                    File=str(Info.PlatformInfo),
-                    ExtraData="consumed by [%s]" % str(Info.MetaFile)
-                )
-    ModuleEntryPointList = ModuleEntryPointList + Info.Module.ModuleEntryPointList
-
     #
     # Module Entry Points
     #
-    NumEntryPoints = len(ModuleEntryPointList)
+    NumEntryPoints = len(Info.Module.ModuleEntryPointList)
     if 'PI_SPECIFICATION_VERSION' in Info.Module.Specification:
         PiSpecVersion = Info.Module.Specification['PI_SPECIFICATION_VERSION']
     else:
@@ -1485,7 +1470,7 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH):
     else:
         UefiSpecVersion = '0x00000000'
     Dict = {
-        'Function'       :   ModuleEntryPointList,
+        'Function'       :   Info.Module.ModuleEntryPointList,
         'PiSpecVersion'  :   PiSpecVersion + 'U',
         'UefiSpecVersion':   UefiSpecVersion + 'U'
     }
@@ -1498,7 +1483,7 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH):
                   AUTOGEN_ERROR,
                   '%s must have exactly one entry point' % Info.ModuleType,
                   File=str(Info),
-                  ExtraData= ", ".join(ModuleEntryPointList)
+                  ExtraData= ", ".join(Info.Module.ModuleEntryPointList)
                   )
     if Info.ModuleType == SUP_MODULE_PEI_CORE:
         AutoGenC.Append(gPeiCoreEntryPointString.Replace(Dict))
@@ -1552,18 +1537,11 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH):
 def CreateModuleUnloadImageCode(Info, AutoGenC, AutoGenH):
     if Info.IsLibrary or Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_BASE, SUP_MODULE_SEC]:
         return
-
-    ModuleUnloadImageList = []
-    for Lib in Info.DependentLibraryList:
-        if len(Lib.ModuleUnloadImageList) > 0:
-            ModuleUnloadImageList = ModuleUnloadImageList + Lib.ModuleUnloadImageList
-    ModuleUnloadImageList = ModuleUnloadImageList + Info.Module.ModuleUnloadImageList
-
     #
     # Unload Image Handlers
     #
-    NumUnloadImage = len(ModuleUnloadImageList)
-    Dict = {'Count':str(NumUnloadImage) + 'U', 'Function':ModuleUnloadImageList}
+    NumUnloadImage = len(Info.Module.ModuleUnloadImageList)
+    Dict = {'Count':str(NumUnloadImage) + 'U', 'Function':Info.Module.ModuleUnloadImageList}
     if NumUnloadImage < 2:
         AutoGenC.Append(gUefiUnloadImageString[NumUnloadImage].Replace(Dict))
     else:
diff --git a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
index 22abda8743..b79280bc2e 100644
--- a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
+++ b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
@@ -20,8 +20,6 @@ from Workspace.BuildClassObject import StructurePcd
 from Common.BuildToolError import RESOURCE_NOT_AVAILABLE
 from Common.BuildToolError import OPTION_MISSING
 from Common.BuildToolError import BUILD_ERROR
-from Common.BuildToolError import PREBUILD_ERROR
-import Common.EdkLogger as EdkLogError
 
 class OrderedListDict(OrderedDict):
     def __init__(self, *args, **kwargs):
@@ -140,12 +138,6 @@ def GetModuleLibInstances(Module, Platform, BuildDatabase, Arch, Target, Toolcha
                             return []
 
                 LibraryModule = BuildDatabase[LibraryPath, Arch, Target, Toolchain]
-                if LibraryModule.ModuleEntryPointList and LibraryModule.ModuleType != Module.ModuleType:
-                    EdkLogError.error(
-                        "build", PREBUILD_ERROR,
-                        "Driver's ModuleType must be consistent [%s]" % (str(Module)),
-                        File=str(FileName),
-                        ExtraData="consumed by [%s]" % str(LibraryModule))
                 # for those forced library instance (NULL library), add a fake library class
                 if LibraryClassName.startswith("NULL"):
                     LibraryModule.LibraryClass.append(LibraryClassObject(LibraryClassName, [ModuleType]))
-- 
2.13.0.windows.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Patch] Revert "BaseTools:BaseTools supports to the driver combination."
  2019-02-25  0:15 [Patch] Revert "BaseTools:BaseTools supports to the driver combination." Liming Gao
@ 2019-02-28  2:06 ` Feng, Bob C
  0 siblings, 0 replies; 2+ messages in thread
From: Feng, Bob C @ 2019-02-28  2:06 UTC (permalink / raw)
  To: Gao, Liming, edk2-devel@lists.01.org

Reviewed-by: Bob Feng <bob.c.feng@intel.com>

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Liming Gao
Sent: Monday, February 25, 2019 8:15 AM
To: edk2-devel@lists.01.org
Subject: [edk2] [Patch] Revert "BaseTools:BaseTools supports to the driver combination."

This reverts commit 838bc257bae3f9fc6723f41f3980f6cfbedb77e5.
After further evaluation, there are the unclear behavior in for the driver combination feature. To not impact Q1 stable tag, remove it first.
1. If the drivers to be combined have the different PCD or library instance
   setting, build should not combine them and report build break. But this
   commit doesn't consider this case.
2. When start the sub driver fail, continue to start other sub driver. This
   behavior is required to be clarifed in build spec. 
3. Unload the sub driver when the combined driver start fail. This case need 
   to call the sub driver unload function for the driver start fail only.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao <liming.gao@intel.com>
---
 BaseTools/Source/Python/AutoGen/GenC.py            | 32 ++++------------------
 .../Source/Python/Workspace/WorkspaceCommon.py     |  8 ------
 2 files changed, 5 insertions(+), 35 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Python/AutoGen/GenC.py
index 0f1b3bb9a3..a922464f56 100644
--- a/BaseTools/Source/Python/AutoGen/GenC.py
+++ b/BaseTools/Source/Python/AutoGen/GenC.py
@@ -1457,25 +1457,10 @@ def CreateLibraryDestructorCode(Info, AutoGenC, AutoGenH):
 def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH):
     if Info.IsLibrary or Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_SEC]:
         return
-    ModuleEntryPointList = []
-    for Lib in Info.DependentLibraryList:
-        if len(Lib.ModuleEntryPointList) > 0:
-            if Lib.ModuleType == Info.ModuleType:
-                ModuleEntryPointList = ModuleEntryPointList + Lib.ModuleEntryPointList
-            else:
-                EdkLogger.error(
-                    "build",
-                    PREBUILD_ERROR,
-                    "Driver's ModuleType must be consistent [%s]"%(str(Lib)),
-                    File=str(Info.PlatformInfo),
-                    ExtraData="consumed by [%s]" % str(Info.MetaFile)
-                )
-    ModuleEntryPointList = ModuleEntryPointList + Info.Module.ModuleEntryPointList
-
     #
     # Module Entry Points
     #
-    NumEntryPoints = len(ModuleEntryPointList)
+    NumEntryPoints = len(Info.Module.ModuleEntryPointList)
     if 'PI_SPECIFICATION_VERSION' in Info.Module.Specification:
         PiSpecVersion = Info.Module.Specification['PI_SPECIFICATION_VERSION']
     else:
@@ -1485,7 +1470,7 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH):
     else:
         UefiSpecVersion = '0x00000000'
     Dict = {
-        'Function'       :   ModuleEntryPointList,
+        'Function'       :   Info.Module.ModuleEntryPointList,
         'PiSpecVersion'  :   PiSpecVersion + 'U',
         'UefiSpecVersion':   UefiSpecVersion + 'U'
     }
@@ -1498,7 +1483,7 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH):
                   AUTOGEN_ERROR,
                   '%s must have exactly one entry point' % Info.ModuleType,
                   File=str(Info),
-                  ExtraData= ", ".join(ModuleEntryPointList)
+                  ExtraData= ", 
+ ".join(Info.Module.ModuleEntryPointList)
                   )
     if Info.ModuleType == SUP_MODULE_PEI_CORE:
         AutoGenC.Append(gPeiCoreEntryPointString.Replace(Dict))
@@ -1552,18 +1537,11 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH):
 def CreateModuleUnloadImageCode(Info, AutoGenC, AutoGenH):
     if Info.IsLibrary or Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_BASE, SUP_MODULE_SEC]:
         return
-
-    ModuleUnloadImageList = []
-    for Lib in Info.DependentLibraryList:
-        if len(Lib.ModuleUnloadImageList) > 0:
-            ModuleUnloadImageList = ModuleUnloadImageList + Lib.ModuleUnloadImageList
-    ModuleUnloadImageList = ModuleUnloadImageList + Info.Module.ModuleUnloadImageList
-
     #
     # Unload Image Handlers
     #
-    NumUnloadImage = len(ModuleUnloadImageList)
-    Dict = {'Count':str(NumUnloadImage) + 'U', 'Function':ModuleUnloadImageList}
+    NumUnloadImage = len(Info.Module.ModuleUnloadImageList)
+    Dict = {'Count':str(NumUnloadImage) + 'U', 
+ 'Function':Info.Module.ModuleUnloadImageList}
     if NumUnloadImage < 2:
         AutoGenC.Append(gUefiUnloadImageString[NumUnloadImage].Replace(Dict))
     else:
diff --git a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
index 22abda8743..b79280bc2e 100644
--- a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
+++ b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py
@@ -20,8 +20,6 @@ from Workspace.BuildClassObject import StructurePcd  from Common.BuildToolError import RESOURCE_NOT_AVAILABLE  from Common.BuildToolError import OPTION_MISSING  from Common.BuildToolError import BUILD_ERROR -from Common.BuildToolError import PREBUILD_ERROR -import Common.EdkLogger as EdkLogError
 
 class OrderedListDict(OrderedDict):
     def __init__(self, *args, **kwargs):
@@ -140,12 +138,6 @@ def GetModuleLibInstances(Module, Platform, BuildDatabase, Arch, Target, Toolcha
                             return []
 
                 LibraryModule = BuildDatabase[LibraryPath, Arch, Target, Toolchain]
-                if LibraryModule.ModuleEntryPointList and LibraryModule.ModuleType != Module.ModuleType:
-                    EdkLogError.error(
-                        "build", PREBUILD_ERROR,
-                        "Driver's ModuleType must be consistent [%s]" % (str(Module)),
-                        File=str(FileName),
-                        ExtraData="consumed by [%s]" % str(LibraryModule))
                 # for those forced library instance (NULL library), add a fake library class
                 if LibraryClassName.startswith("NULL"):
                     LibraryModule.LibraryClass.append(LibraryClassObject(LibraryClassName, [ModuleType]))
--
2.13.0.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-02-28  2:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-25  0:15 [Patch] Revert "BaseTools:BaseTools supports to the driver combination." Liming Gao
2019-02-28  2:06 ` Feng, Bob C

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox