Hi,

Consider a simple driver which needs that some data structures be filled by the
Platform, which is using the driver.

Driver.c
#include <Platform.h>

Struct a = platformVal;

We can define platformVal in Platform.h, which would be unique to the platform 
being built.
This Platform.h can be placed in include directories, whose path would be 
defined in Platform.dec file.

Now, whenever we build driver for each unique platform, we need not to mention 
Platform.dec file in driver.inf [packages] section.
We can append Platform.dec include paths to each driver. i.e. look for the 
include files in [packages] section as well as in Platform include directories.

For this, I am looking for Platform.dec file in same directory as Platform.dsc 
and using same name as Platform.dsc

We can refine this change further. i.e. add Platform include directories to 
driver's include paths based on some condition in driver.inf file.

Thanks & Regards,
Pankaj Bansal

> -----Original Message-----
> From: Kinney, Michael D [mailto:michael.d.kin...@intel.com]
> Sent: Monday, February 26, 2018 1:13 PM
> To: Pankaj Bansal <pankaj.ban...@nxp.com>; edk2-devel@lists.01.org;
> Kinney, Michael D <michael.d.kin...@intel.com>
> Cc: Gao, Liming <liming....@intel.com>
> Subject: RE: [edk2] [RFC] Add Platform Include path in modules
> 
> Hi,
> 
> Can you provide a simple example that shows how this feature is used and
> how it works?
> 
> Thanks,
> 
> Mike
> 
> > -----Original Message-----
> > From: edk2-devel [mailto:edk2-devel-
> > boun...@lists.01.org] On Behalf Of Pankaj Bansal
> > Sent: Sunday, February 25, 2018 10:29 PM
> > To: edk2-devel@lists.01.org
> > Cc: Gao, Liming <liming....@intel.com>
> > Subject: [edk2] [RFC] Add Platform Include path in modules
> >
> > When we are writing the drivers for IP modules, then sometimes we want
> > that Platform specific customizations or platform dependent values be
> > supplied to IP module driver. normally we achieve this using Pcd
> > values.
> >
> > But sometimes we want to use header files for such data.e.g. if the
> > values are complex structures.
> >
> > we need a mechanism that platform be able to supply these header files
> > to a module, without changing module code.
> >
> > This patch is an attempt to achieve this functionality.
> >
> > Cc: Yonghong Zhu <yonghong....@intel.com>
> > Cc: Liming Gao <liming....@intel.com>
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Pankaj Bansal <pankaj.ban...@nxp.com>
> > ---
> >  BaseTools/Source/Python/AutoGen/AutoGen.py | 12
> > ++++++++++++
> >  1 file changed, 12 insertions(+)
> >
> > diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py
> > b/BaseTools/Source/Python/AutoGen/AutoGen.py
> > index 405bfa1..de4a17c 100644
> > --- a/BaseTools/Source/Python/AutoGen/AutoGen.py
> > +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
> > @@ -3783,6 +3783,18 @@ class ModuleAutoGen(AutoGen):
> >                  for Inc in IncludesList:
> >                      if Inc not in
> > self._IncludePathList:
> >
> > self._IncludePathList.append(str(Inc))
> > +            PackageFile =
> > PathClass(os.path.join(self.PlatformInfo.MetaFile.SubDir
> > , self.PlatformInfo.MetaFile.BaseName + '.dec'),
> > self.PlatformInfo.MetaFile.Root)
> > +            Package = self.BuildDatabase[PackageFile,
> > self.Arch, self.BuildTarget, self.ToolChain]
> > +            PackageDir = mws.join(self.WorkspaceDir,
> > Package.MetaFile.Dir)
> > +            if PackageDir not in self._IncludePathList:
> > +
> > self._IncludePathList.append(PackageDir)
> > +            IncludesList = Package.Includes
> > +            if Package._PrivateIncludes:
> > +                if not
> > self.MetaFile.Path.startswith(PackageDir):
> > +                    IncludesList =
> > list(set(Package.Includes).difference(set(Package._Priva
> > teIncludes)))
> > +            for Inc in IncludesList:
> > +                if Inc not in self._IncludePathList:
> > +
> > self._IncludePathList.append(str(Inc))
> >          return self._IncludePathList
> >
> >      def _GetIncludePathLength(self):
> > --
> > 2.7.4
> >
> > _______________________________________________
> > edk2-devel mailing list
> > edk2-devel@lists.01.org
> > https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flis
> > ts.01.org%2Fmailman%2Flistinfo%2Fedk2-
> devel&data=02%7C01%7Cpankaj.bans
> >
> al%40nxp.com%7Ccaec1b6b479b4111c26308d57cec86ac%7C686ea1d3bc2b4
> c6fa92c
> >
> d99c5c301635%7C0%7C0%7C636552277685045614&sdata=G3VP7FkkVcBKN4
> bkA5RRdJ
> > FzfpdIBhuxmRmBMcFvMY8%3D&reserved=0
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to