]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Refine Legacy Region thunk to comply with PI 1.2.
authorxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 18 Mar 2010 08:37:20 +0000 (08:37 +0000)
committerxli24 <xli24@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 18 Mar 2010 08:37:20 +0000 (08:37 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10279 6f19259b-4bc3-4df7-8a09-765794883524

EdkCompatibilityPkg/Compatibility/LegacyRegion2OnLegacyRegionThunk/LegacyRegion2OnLegacyRegionThunk.c

index 79cc62aa6d53b92f1a42f4947788381687e29c2b..be5f8dee63221160b83274c4d9f22fcc76670a86 100644 (file)
@@ -4,7 +4,7 @@
   Intel's Framework Legacy Region Protocol is replaced by Legacy Region 2 Protocol in PI 1.2.\r
   This module produces PI Legacy Region 2 Protocol on top of Framework Legacy Region Protocol.\r
 \r
-Copyright (c) 2009, Intel Corporation\r
+Copyright (c) 2009 - 2010, Intel Corporation\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
@@ -63,6 +63,10 @@ LegacyRegion2Decode (
   IN  BOOLEAN                      *On\r
   )\r
 {\r
+  if ((Start < 0xC0000) || ((Start + Length - 1) > 0xFFFFF)) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
   ASSERT (Granularity != NULL);\r
   *Granularity = 0;\r
 \r
@@ -103,6 +107,10 @@ LegacyRegion2Lock (
   OUT UINT32                      *Granularity\r
   )\r
 {\r
+  if ((Start < 0xC0000) || ((Start + Length - 1) > 0xFFFFF)) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
   ASSERT (Granularity != NULL);\r
 \r
   return mLegacyRegion->Lock (\r
@@ -147,14 +155,18 @@ LegacyRegion2BootLock (
   OUT UINT32                              *Granularity\r
   )\r
 {\r
-  ASSERT (Granularity != NULL);\r
+  if ((Start < 0xC0000) || ((Start + Length - 1) > 0xFFFFF)) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
 \r
-  return mLegacyRegion->BootLock (\r
-                          mLegacyRegion,\r
-                          Start,\r
-                          Length,\r
-                          Granularity\r
-                          );\r
+  //\r
+  // PI Legacy Region 2 Protocol and Framework Legacy Region Protocol have different\r
+  // semantic of BootLock() API, so we cannot thunk to Framework Legacy Region Protocol\r
+  // to produce the functionality of PI version. In addition, this functionality is\r
+  // chipset dependent, so here we return EFI_UNSUPPORTED, which is a valid return status\r
+  // code specified by PI spec.\r
+  //\r
+  return EFI_UNSUPPORTED;\r
 }\r
 \r
 /**\r
@@ -186,6 +198,10 @@ LegacyRegion2Unlock (
   OUT UINT32                       *Granularity\r
   )\r
 {\r
+  if ((Start < 0xC0000) || ((Start + Length - 1) > 0xFFFFF)) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
   ASSERT (Granularity != NULL);\r
 \r
   return mLegacyRegion->UnLock (\r
@@ -203,7 +219,7 @@ LegacyRegion2Unlock (
   region. Each attribute may have a different granularity and the granularity may not be the same\r
   for all memory ranges in the legacy region.  \r
 \r
-  @param  This[in]              Indicates the EFI_LEGACY_REGION_PROTOCOL instance.\r
+  @param  This[in]              Indicates the EFI_LEGACY_REGION2_PROTOCOL instance.\r
   @param  DescriptorCount[out]  The number of region descriptor entries returned in the Descriptor\r
                                 buffer.\r
   @param  Descriptor[out]       A pointer to a pointer used to return a buffer where the legacy\r
@@ -211,8 +227,8 @@ LegacyRegion2Unlock (
                                 DescriptorCount number of region descriptors.  This function will\r
                                 provide the memory for the buffer.\r
 \r
-  @retval EFI_SUCCESS           The region's attributes were successfully modified.\r
-  @retval EFI_INVALID_PARAMETER If Start or Length describe an address not in the Legacy Region.\r
+  @retval EFI_SUCCESS           The information structure was returned.\r
+  @retval EFI_UNSUPPORTED       This function is not supported.\r
 \r
 **/\r
 EFI_STATUS\r