]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdePkg/IntelFrameworkPkg HobLib: Add BuildResourceDescriptorWithOwnerHob() API.
authorStar Zeng <star.zeng@intel.com>
Mon, 27 Oct 2014 00:42:57 +0000 (00:42 +0000)
committerlzeng14 <lzeng14@Edk2>
Mon, 27 Oct 2014 00:42:57 +0000 (00:42 +0000)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16230 6f19259b-4bc3-4df7-8a09-765794883524

IntelFrameworkPkg/Library/PeiHobLibFramework/HobLib.c
MdePkg/Include/Library/HobLib.h
MdePkg/Library/DxeCoreHobLib/HobLib.c
MdePkg/Library/DxeHobLib/HobLib.c
MdePkg/Library/PeiHobLib/HobLib.c

index f614c7ba68c6d66c6dfab514202974261260e621..c4c14f9ae3f983da79bb855acd54e4e6ea3fca28 100644 (file)
@@ -5,7 +5,7 @@
  This library instance uses EFI_HOB_TYPE_CV defined in Intel framework HOB specification v0.9\r
  to implement HobLib BuildCvHob() API. \r
 \r
-Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2014, 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
@@ -304,6 +304,46 @@ BuildModuleHob (
   Hob->EntryPoint = EntryPoint;\r
 }\r
 \r
+/**
+  Builds a HOB that describes a chunk of system memory with Owner GUID.\r
+
+  This function builds a HOB that describes a chunk of system memory.
+  It can only be invoked during PEI phase;
+  for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
+  
+  If there is no additional space for HOB creation, then ASSERT().
+
+  @param  ResourceType        The type of resource described by this HOB.
+  @param  ResourceAttribute   The resource attributes of the memory described by this HOB.
+  @param  PhysicalStart       The 64 bit physical address of memory described by this HOB.
+  @param  NumberOfBytes       The length of the memory described by this HOB in bytes.
+  @param  OwnerGUID           GUID for the owner of this resource.\r
+
+**/
+VOID
+EFIAPI
+BuildResourceDescriptorWithOwnerHob (
+  IN EFI_RESOURCE_TYPE            ResourceType,
+  IN EFI_RESOURCE_ATTRIBUTE_TYPE  ResourceAttribute,
+  IN EFI_PHYSICAL_ADDRESS         PhysicalStart,
+  IN UINT64                       NumberOfBytes,
+  IN EFI_GUID                     *OwnerGUID
+  )
+{
+  EFI_HOB_RESOURCE_DESCRIPTOR  *Hob;
+  EFI_STATUS                    Status;
+
+  Status = PeiServicesCreateHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, sizeof (EFI_HOB_RESOURCE_DESCRIPTOR), (void **)&Hob);
+  ASSERT_EFI_ERROR (Status);
+
+  Hob->ResourceType      = ResourceType;
+  Hob->ResourceAttribute = ResourceAttribute;
+  Hob->PhysicalStart     = PhysicalStart;
+  Hob->ResourceLength    = NumberOfBytes;
+
+  CopyGuid (&Hob->Owner, OwnerGUID);
+}\r
+\r
 /**\r
   Builds a HOB that describes a chunk of system memory.\r
 \r
@@ -339,6 +379,7 @@ BuildResourceDescriptorHob (
   Hob->ResourceAttribute = ResourceAttribute;\r
   Hob->PhysicalStart     = PhysicalStart;\r
   Hob->ResourceLength    = NumberOfBytes;\r
+  ZeroMem (&(Hob->Owner), sizeof (EFI_GUID));\r
 }\r
 \r
 /**\r
index e28328fad6d77465f7f515509b974c53f680b8f8..855a0ece2cf6863fae7351fa898e1552a03158a2 100644 (file)
@@ -8,7 +8,7 @@
   allows the PEI phase to pass information to the DXE phase. HOBs are position\r
   independent and can be relocated easily to different memory memory locations.\r
 \r
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2014, 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
@@ -184,6 +184,32 @@ BuildModuleHob (
   IN EFI_PHYSICAL_ADDRESS   EntryPoint\r
   );\r
 \r
+/**
+  Builds a HOB that describes a chunk of system memory with Owner GUID.\r
+
+  This function builds a HOB that describes a chunk of system memory.
+  It can only be invoked during PEI phase;
+  for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
+  
+  If there is no additional space for HOB creation, then ASSERT().
+
+  @param  ResourceType        The type of resource described by this HOB.
+  @param  ResourceAttribute   The resource attributes of the memory described by this HOB.
+  @param  PhysicalStart       The 64 bit physical address of memory described by this HOB.
+  @param  NumberOfBytes       The length of the memory described by this HOB in bytes.
+  @param  OwnerGUID           GUID for the owner of this resource.\r
+
+**/
+VOID
+EFIAPI
+BuildResourceDescriptorWithOwnerHob (
+  IN EFI_RESOURCE_TYPE            ResourceType,
+  IN EFI_RESOURCE_ATTRIBUTE_TYPE  ResourceAttribute,
+  IN EFI_PHYSICAL_ADDRESS         PhysicalStart,
+  IN UINT64                       NumberOfBytes,
+  IN EFI_GUID                     *OwnerGUID
+  );\r
+\r
 /**\r
   Builds a HOB that describes a chunk of system memory.\r
 \r
index afa66b4f9dad6e344d11716aa3c094fa25f99c14..e483f9c98de3de68b15a0b7830bbb6f84b8110c3 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   HOB Library implementation for DxeCore driver.\r
 \r
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2014, 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
@@ -239,6 +239,38 @@ BuildModuleHob (
   ASSERT (FALSE);\r
 }\r
 \r
+/**
+  Builds a HOB that describes a chunk of system memory with Owner GUID.\r
+
+  This function builds a HOB that describes a chunk of system memory.
+  It can only be invoked during PEI phase;
+  for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
+  
+  If there is no additional space for HOB creation, then ASSERT().
+
+  @param  ResourceType        The type of resource described by this HOB.
+  @param  ResourceAttribute   The resource attributes of the memory described by this HOB.
+  @param  PhysicalStart       The 64 bit physical address of memory described by this HOB.
+  @param  NumberOfBytes       The length of the memory described by this HOB in bytes.
+  @param  OwnerGUID           GUID for the owner of this resource.\r
+
+**/
+VOID
+EFIAPI
+BuildResourceDescriptorWithOwnerHob (
+  IN EFI_RESOURCE_TYPE            ResourceType,
+  IN EFI_RESOURCE_ATTRIBUTE_TYPE  ResourceAttribute,
+  IN EFI_PHYSICAL_ADDRESS         PhysicalStart,
+  IN UINT64                       NumberOfBytes,
+  IN EFI_GUID                     *OwnerGUID
+  )
+{
+  //\r
+  // PEI HOB is read only for DXE phase\r
+  //\r
+  ASSERT (FALSE);\r
+}\r
+\r
 /**\r
   Builds a HOB that describes a chunk of system memory.\r
 \r
index 215436149d2b874206bd606b53c94f9a693cd917..3cedc6f6c6565f946f3b948396d9b616d488015c 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   HOB Library implemenation for Dxe Phase.\r
 \r
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2014, 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
@@ -272,6 +272,38 @@ BuildModuleHob (
   ASSERT (FALSE);\r
 }\r
 \r
+/**
+  Builds a HOB that describes a chunk of system memory with Owner GUID.\r
+
+  This function builds a HOB that describes a chunk of system memory.
+  It can only be invoked during PEI phase;
+  for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
+  
+  If there is no additional space for HOB creation, then ASSERT().
+
+  @param  ResourceType        The type of resource described by this HOB.
+  @param  ResourceAttribute   The resource attributes of the memory described by this HOB.
+  @param  PhysicalStart       The 64 bit physical address of memory described by this HOB.
+  @param  NumberOfBytes       The length of the memory described by this HOB in bytes.
+  @param  OwnerGUID           GUID for the owner of this resource.\r
+
+**/
+VOID
+EFIAPI
+BuildResourceDescriptorWithOwnerHob (
+  IN EFI_RESOURCE_TYPE            ResourceType,
+  IN EFI_RESOURCE_ATTRIBUTE_TYPE  ResourceAttribute,
+  IN EFI_PHYSICAL_ADDRESS         PhysicalStart,
+  IN UINT64                       NumberOfBytes,
+  IN EFI_GUID                     *OwnerGUID
+  )
+{
+  //\r
+  // PEI HOB is read only for DXE phase\r
+  //\r
+  ASSERT (FALSE);\r
+}\r
+\r
 /**\r
   Builds a HOB that describes a chunk of system memory.\r
 \r
index 32523d4277501d5e9d85d4e1c7caaf0eecc40a4d..a608325c6555c061a63f064cd9eaccac5d99d6b1 100644 (file)
@@ -300,6 +300,46 @@ BuildModuleHob (
   Hob->EntryPoint = EntryPoint;\r
 }\r
 \r
+/**
+  Builds a HOB that describes a chunk of system memory with Owner GUID.\r
+
+  This function builds a HOB that describes a chunk of system memory.
+  It can only be invoked during PEI phase;
+  for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
+  
+  If there is no additional space for HOB creation, then ASSERT().
+
+  @param  ResourceType        The type of resource described by this HOB.
+  @param  ResourceAttribute   The resource attributes of the memory described by this HOB.
+  @param  PhysicalStart       The 64 bit physical address of memory described by this HOB.
+  @param  NumberOfBytes       The length of the memory described by this HOB in bytes.
+  @param  OwnerGUID           GUID for the owner of this resource.\r
+
+**/
+VOID
+EFIAPI
+BuildResourceDescriptorWithOwnerHob (
+  IN EFI_RESOURCE_TYPE            ResourceType,
+  IN EFI_RESOURCE_ATTRIBUTE_TYPE  ResourceAttribute,
+  IN EFI_PHYSICAL_ADDRESS         PhysicalStart,
+  IN UINT64                       NumberOfBytes,
+  IN EFI_GUID                     *OwnerGUID
+  )
+{
+  EFI_HOB_RESOURCE_DESCRIPTOR  *Hob;
+  EFI_STATUS                    Status;
+
+  Status = PeiServicesCreateHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, sizeof (EFI_HOB_RESOURCE_DESCRIPTOR), (void **)&Hob);
+  ASSERT_EFI_ERROR (Status);
+
+  Hob->ResourceType      = ResourceType;
+  Hob->ResourceAttribute = ResourceAttribute;
+  Hob->PhysicalStart     = PhysicalStart;
+  Hob->ResourceLength    = NumberOfBytes;
+
+  CopyGuid (&Hob->Owner, OwnerGUID);
+}\r
+\r
 /**\r
   Builds a HOB that describes a chunk of system memory.\r
 \r