Revision: 13991
          http://edk2.svn.sourceforge.net/edk2/?rev=13991&view=rev
Author:   li-elvin
Date:     2012-12-12 07:47:33 +0000 (Wed, 12 Dec 2012)
Log Message:
-----------
Remove hard code value and create new PCDs for OpROM reserved range in CSM 
module.

Signed-off-by: Li Elvin <[email protected]>
Reviewed-by: Yao Jiewen <[email protected]>

Modified Paths:
--------------
    trunk/edk2/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBios.c
    trunk/edk2/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf
    trunk/edk2/IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec

Modified: trunk/edk2/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBios.c
===================================================================
--- trunk/edk2/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBios.c   
2012-12-12 03:03:07 UTC (rev 13990)
+++ trunk/edk2/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBios.c   
2012-12-12 07:47:33 UTC (rev 13991)
@@ -682,6 +682,7 @@
   LEGACY_BIOS_INSTANCE               *Private;
   EFI_TO_COMPATIBILITY16_INIT_TABLE  *EfiToLegacy16InitTable;
   EFI_PHYSICAL_ADDRESS               MemoryAddress;
+  EFI_PHYSICAL_ADDRESS               EbdaReservedBaseAddress;
   VOID                               *MemoryPtr;
   EFI_PHYSICAL_ADDRESS               MemoryAddressUnder1MB;
   UINTN                              Index;
@@ -880,9 +881,21 @@
   //
   // Allocate all 32k chunks from 0x60000 ~ 0x88000 for Legacy OPROMs that
   // don't use PMM but look for zeroed memory. Note that various non-BBS
-  // SCSIs expect different areas to be free
+  // OpROMs expect different areas to be free
   //
-  for (MemStart = 0x60000; MemStart < 0x88000; MemStart += 0x1000) {
+  EbdaReservedBaseAddress = MemoryAddress;
+  MemoryAddress = PcdGet32 (PcdOpromReservedMemoryBase);
+  MemorySize    = PcdGet32 (PcdOpromReservedMemorySize);
+  //
+  // Check if base address and size for reserved memory are 4KB aligned.
+  //
+  ASSERT ((MemoryAddress & 0xFFF) == 0);
+  ASSERT ((MemorySize & 0xFFF) == 0);
+  //
+  // Check if the reserved memory is below EBDA reserved range.
+  //
+  ASSERT ((MemoryAddress < EbdaReservedBaseAddress) && ((MemoryAddress + 
MemorySize - 1) < EbdaReservedBaseAddress));
+  for (MemStart = MemoryAddress; MemStart < MemoryAddress + MemorySize; 
MemStart += 0x1000) {
     Status = AllocateLegacyMemory (
                AllocateAddress,
                MemStart,

Modified: trunk/edk2/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf
===================================================================
--- trunk/edk2/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf      
2012-12-12 03:03:07 UTC (rev 13990)
+++ trunk/edk2/IntelFrameworkModulePkg/Csm/LegacyBiosDxe/LegacyBiosDxe.inf      
2012-12-12 07:47:33 UTC (rev 13991)
@@ -140,6 +140,8 @@
   gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdEndOpromShadowAddress
   gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLowPmmMemorySize
   gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdHighPmmMemorySize
+  gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdOpromReservedMemoryBase
+  gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdOpromReservedMemorySize
 
 [Depex]
   gEfiLegacyRegion2ProtocolGuid AND gEfiLegacyInterruptProtocolGuid AND 
gEfiLegacyBiosPlatformProtocolGuid AND gEfiLegacy8259ProtocolGuid AND 
gEfiGenericMemTestProtocolGuid AND gEfiCpuArchProtocolGuid AND 
gEfiTimerArchProtocolGuid AND gEfiVariableWriteArchProtocolGuid

Modified: trunk/edk2/IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
===================================================================
--- trunk/edk2/IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec      
2012-12-12 03:03:07 UTC (rev 13990)
+++ trunk/edk2/IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec      
2012-12-12 07:47:33 UTC (rev 13991)
@@ -199,6 +199,18 @@
   ## The value should be a multiple of 4KB.
   
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdEbdaReservedMemorySize|0x8000|UINT32|0x30000005
 
+  ## The PCD is used to specify memory base address for OPROM to find free 
memory.
+  # Some OPROMs do not use EBDA or PMM to allocate memory for its usage, 
+  # instead they find the memory filled with zero from 0x20000.
+  # The range should be below the EBDA reserved range from 
+  # (CONVENTIONAL_MEMORY_TOP - PcdEbdaReservedMemorySize) to 
CONVENTIONAL_MEMORY_TOP.
+  
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdOpromReservedMemoryBase|0x60000|UINT32|0x3000000c
+  
+  ## The PCD is used to specify memory size with bytes for OPROM to find free 
memory.
+  ## The value should be a multiple of 4KB. And the range should be below the 
EBDA reserved range from 
+  # (CONVENTIONAL_MEMORY_TOP - PcdEbdaReservedMemorySize) to 
CONVENTIONAL_MEMORY_TOP.
+  
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdOpromReservedMemorySize|0x28000|UINT32|0x3000000d
+
   ## The PCD is used to specify memory size with page number for a 
pre-allocated reserved memory to be used
   #  by PEI in S3 phase. The default size 32K. When changing the value of this 
PCD, the platform
   #  developer should make sure the memory size is large enough to meet PEI 
requiremnt in S3 phase.

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to