Update Unix platform to use dynamic HII pcd to save console output mode.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7580 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qhuang8 2009-02-23 03:20:54 +00:00
parent fcf24bad4a
commit c71b65973b
8 changed files with 117 additions and 44 deletions

View File

@ -19,7 +19,7 @@ Revision History
--*/ --*/
#include "PiDxe.h" #include <PiDxe.h>
#include <Guid/EventGroup.h> #include <Guid/EventGroup.h>
#include <Protocol/FvbExtension.h> #include <Protocol/FvbExtension.h>
#include <Protocol/FirmwareVolumeBlock.h> #include <Protocol/FirmwareVolumeBlock.h>
@ -846,7 +846,7 @@ Returns:
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
FvbProtocolGetPhysicalAddress ( FvbProtocolGetPhysicalAddress (
IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This, IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
OUT EFI_PHYSICAL_ADDRESS *Address OUT EFI_PHYSICAL_ADDRESS *Address
) )
/*++ /*++
@ -877,8 +877,8 @@ Returns:
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
FvbProtocolGetBlockSize ( FvbProtocolGetBlockSize (
IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This, IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
IN EFI_LBA Lba, IN CONST EFI_LBA Lba,
OUT UINTN *BlockSize, OUT UINTN *BlockSize,
OUT UINTN *NumOfBlocks OUT UINTN *NumOfBlocks
) )
@ -921,7 +921,7 @@ Returns:
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
FvbProtocolGetAttributes ( FvbProtocolGetAttributes (
IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This, IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
OUT EFI_FVB_ATTRIBUTES_2 *Attributes OUT EFI_FVB_ATTRIBUTES_2 *Attributes
) )
/*++ /*++
@ -948,7 +948,7 @@ Returns:
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
FvbProtocolSetAttributes ( FvbProtocolSetAttributes (
IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This, IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
IN OUT EFI_FVB_ATTRIBUTES_2 *Attributes IN OUT EFI_FVB_ATTRIBUTES_2 *Attributes
) )
/*++ /*++
@ -975,7 +975,7 @@ Returns:
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
FvbProtocolEraseBlocks ( FvbProtocolEraseBlocks (
IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This, IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
... ...
) )
/*++ /*++
@ -1073,7 +1073,7 @@ Returns:
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
FvbProtocolWrite ( FvbProtocolWrite (
IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This, IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
IN EFI_LBA Lba, IN EFI_LBA Lba,
IN UINTN Offset, IN UINTN Offset,
IN OUT UINTN *NumBytes, IN OUT UINTN *NumBytes,
@ -1115,15 +1115,15 @@ Returns:
FvbDevice = FVB_DEVICE_FROM_THIS (This); FvbDevice = FVB_DEVICE_FROM_THIS (This);
return FvbWriteBlock (FvbDevice->Instance, Lba, Offset, NumBytes, Buffer, mFvbModuleGlobal, EfiGoneVirtual ()); return FvbWriteBlock (FvbDevice->Instance, (EFI_LBA)Lba, (UINTN)Offset, NumBytes, (UINT8 *)Buffer, mFvbModuleGlobal, EfiGoneVirtual ());
} }
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
FvbProtocolRead ( FvbProtocolRead (
IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This, IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
IN EFI_LBA Lba, IN CONST EFI_LBA Lba,
IN UINTN Offset, IN CONST UINTN Offset,
IN OUT UINTN *NumBytes, IN OUT UINTN *NumBytes,
IN UINT8 *Buffer IN UINT8 *Buffer
) )
@ -1256,7 +1256,7 @@ Returns:
Ptr = (UINT16 *) FwVolHeader; Ptr = (UINT16 *) FwVolHeader;
Checksum = 0; Checksum = 0;
while (HeaderLength > 0) { while (HeaderLength > 0) {
Checksum = Checksum + (*Ptr); Checksum = (UINT16)(Checksum + (*Ptr));
HeaderLength--; HeaderLength--;
Ptr++; Ptr++;
} }
@ -1312,12 +1312,8 @@ Returns:
// Allocate runtime services data for global variable, which contains // Allocate runtime services data for global variable, which contains
// the private data of all firmware volume block instances // the private data of all firmware volume block instances
// //
Status = gBS->AllocatePool ( mFvbModuleGlobal = AllocateRuntimePool (sizeof (ESAL_FWB_GLOBAL));
EfiRuntimeServicesData, ASSERT (mFvbModuleGlobal != NULL);
sizeof (ESAL_FWB_GLOBAL),
(VOID**) &mFvbModuleGlobal
);
ASSERT_EFI_ERROR (Status);
// //
// Calculate the total size for all firmware volume block instances // Calculate the total size for all firmware volume block instances
@ -1366,12 +1362,8 @@ Returns:
// the private data of each FV instance. But in virtual mode or in physical // the private data of each FV instance. But in virtual mode or in physical
// mode, the address of the the physical memory may be different. // mode, the address of the the physical memory may be different.
// //
Status = gBS->AllocatePool ( mFvbModuleGlobal->FvInstance[FVB_PHYSICAL] = AllocateRuntimePool (BufferSize);
EfiRuntimeServicesData, ASSERT (mFvbModuleGlobal->FvInstance[FVB_PHYSICAL] != NULL);
BufferSize,
(VOID**) &mFvbModuleGlobal->FvInstance[FVB_PHYSICAL]
);
ASSERT_EFI_ERROR (Status);
// //
// Make a virtual copy of the FvInstance pointer. // Make a virtual copy of the FvInstance pointer.
@ -1452,12 +1444,8 @@ Returns:
// //
// Add a FVB Protocol Instance // Add a FVB Protocol Instance
// //
Status = gBS->AllocatePool ( FvbDevice = AllocateRuntimePool (sizeof (EFI_FW_VOL_BLOCK_DEVICE));
EfiRuntimeServicesData, ASSERT (FvbDevice != NULL);
sizeof (EFI_FW_VOL_BLOCK_DEVICE),
(VOID**) &FvbDevice
);
ASSERT_EFI_ERROR (Status);
CopyMem (FvbDevice, &mFvbDeviceTemplate, sizeof (EFI_FW_VOL_BLOCK_DEVICE)); CopyMem (FvbDevice, &mFvbDeviceTemplate, sizeof (EFI_FW_VOL_BLOCK_DEVICE));
@ -1541,12 +1529,8 @@ Returns:
// //
// Allocate for scratch space, an intermediate buffer for FVB extention // Allocate for scratch space, an intermediate buffer for FVB extention
// //
Status = gBS->AllocatePool ( mFvbModuleGlobal->FvbScratchSpace[FVB_PHYSICAL] = AllocateRuntimePool (MaxLbaSize);
EfiRuntimeServicesData, ASSERT (mFvbModuleGlobal->FvbScratchSpace[FVB_PHYSICAL] != NULL);
MaxLbaSize,
(VOID**)&mFvbModuleGlobal->FvbScratchSpace[FVB_PHYSICAL]
);
ASSERT_EFI_ERROR (Status);
mFvbModuleGlobal->FvbScratchSpace[FVB_VIRTUAL] = mFvbModuleGlobal->FvbScratchSpace[FVB_PHYSICAL]; mFvbModuleGlobal->FvbScratchSpace[FVB_VIRTUAL] = mFvbModuleGlobal->FvbScratchSpace[FVB_PHYSICAL];

View File

@ -0,0 +1,36 @@
/**@file
Setup Variable data structure for Unix platform.
Copyright (c) 2009, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef __UNIX_SYSTEM_CONFIGUE_H__
#define __UNIX_SYSTEM_CONFIGUE_H__
#define EFI_UXIX_SYSTEM_CONFIG_GUID \
{0x375ea976, 0x3ccd, 0x4e74, {0xa8, 0x45, 0x26, 0xb9, 0xb3, 0x24, 0xb1, 0x3c}}
#pragma pack(1)
typedef struct {
//
// Console output mode
//
UINT32 ConOutColumn;
UINT32 ConOutRow;
} WIN_NT_SYSTEM_CONFIGURATION;
#pragma pack()
extern EFI_GUID gEfiUnixSystemConfigGuid;
#endif

View File

@ -23,6 +23,44 @@ Abstract:
#include "BdsPlatform.h" #include "BdsPlatform.h"
CHAR16 mFirmwareVendor[] = L"TianoCore.org"; CHAR16 mFirmwareVendor[] = L"TianoCore.org";
UNIX_SYSTEM_CONFIGURATION mSystemConfigData;
VOID
SetupVariableInit (
VOID
)
{
EFI_STATUS Status;
UINTN Size;
Size = sizeof (mSystemConfigData);
Status = gRT->GetVariable (
L"Setup",
&gEfiUnixSystemConfigGuid,
NULL,
&Size,
(VOID *) &mSystemConfigData
);
if (EFI_ERROR (Status)) {
//
// SetupVariable is corrupt
//
mSystemConfigData.ConOutRow = PcdGet32 (PcdConOutColumn);
mSystemConfigData.ConOutColumn = PcdGet32 (PcdConOutRow);
Status = gRT->SetVariable (
L"Setup",
&gEfiUnixSystemConfigGuid,
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,
sizeof (mSystemConfigData),
(VOID *) &mSystemConfigData
);
if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "Failed to save Setup Variable to non-volatile storage, Status = %r\n", Status));
}
}
}
// //
// BDS Platform Functions // BDS Platform Functions
@ -35,7 +73,7 @@ PlatformBdsInit (
Routine Description: Routine Description:
Platform Bds init. Incude the platform firmware vendor, revision Platform Bds init. Include the platform firmware vendor, revision
and so crc check. and so crc check.
Arguments: Arguments:

View File

@ -27,6 +27,7 @@ Abstract:
#include <Library/DebugLib.h> #include <Library/DebugLib.h>
#include <Library/BaseMemoryLib.h> #include <Library/BaseMemoryLib.h>
#include <Library/UefiBootServicesTableLib.h> #include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/MemoryAllocationLib.h> #include <Library/MemoryAllocationLib.h>
#include <Library/BaseLib.h> #include <Library/BaseLib.h>
#include <Library/PcdLib.h> #include <Library/PcdLib.h>
@ -37,6 +38,7 @@ Abstract:
#include <Protocol/UnixThunk.h> #include <Protocol/UnixThunk.h>
#include <Protocol/UnixIo.h> #include <Protocol/UnixIo.h>
#include <Guid/Bmp.h> #include <Guid/Bmp.h>
#include <Guid/WinNtSystemConfig.h>
extern BDS_CONSOLE_CONNECT_ENTRY gPlatformConsole[]; extern BDS_CONSOLE_CONNECT_ENTRY gPlatformConsole[];
extern EFI_DEVICE_PATH_PROTOCOL *gPlatformConnectSequence[]; extern EFI_DEVICE_PATH_PROTOCOL *gPlatformConnectSequence[];

View File

@ -24,7 +24,6 @@
EDK_RELEASE_VERSION = 0x00020000 EDK_RELEASE_VERSION = 0x00020000
EFI_SPECIFICATION_VERSION = 0x00020000 EFI_SPECIFICATION_VERSION = 0x00020000
ENTRY_POINT = BdsInitialize
# #
# The following information is for reference only and not required by the build tools. # The following information is for reference only and not required by the build tools.
@ -34,9 +33,8 @@
[Sources.common] [Sources.common]
BdsPlatform.c BdsPlatform.c
BdsPlatform.h
PlatformData.c PlatformData.c
BdsPlatform.h
[Packages] [Packages]
MdePkg/MdePkg.dec MdePkg/MdePkg.dec
@ -69,6 +67,7 @@
BaseLib BaseLib
MemoryAllocationLib MemoryAllocationLib
UefiBootServicesTableLib UefiBootServicesTableLib
UefiRuntimeServicesTableLib
BaseMemoryLib BaseMemoryLib
DebugLib DebugLib
PcdLib PcdLib
@ -78,3 +77,11 @@
[Guids] [Guids]
gEfiDefaultBmpLogoGuid # ALWAYS_CONSUMED gEfiDefaultBmpLogoGuid # ALWAYS_CONSUMED
gEfiUnixSystemConfigGuid
[Pcd.common]
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn
[Depex]
gEfiVariableArchProtocolGuid AND gEfiVariableWriteArchProtocolGuid

View File

@ -54,7 +54,7 @@
gEfiUnixCPUSpeedGuid = {0xf2d74e5a, 0x8985, 0x11db, {0x97, 0x05, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35}} gEfiUnixCPUSpeedGuid = {0xf2d74e5a, 0x8985, 0x11db, {0x97, 0x05, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35}}
gEfiUnixSerialPortGuid = {0x6d3a727d, 0x66c8, 0x4d19, {0x87, 0xe6, 0x02, 0x15, 0x86, 0x14, 0x90, 0xf3}} gEfiUnixSerialPortGuid = {0x6d3a727d, 0x66c8, 0x4d19, {0x87, 0xe6, 0x02, 0x15, 0x86, 0x14, 0x90, 0xf3}}
gEfiFlashMapHobGuid = {0xb091e7d2, 0x05a0, 0x4198, {0x94, 0xf0, 0x74, 0xb7, 0xb8, 0xc5, 0x54, 0x59}} gEfiFlashMapHobGuid = {0xb091e7d2, 0x05a0, 0x4198, {0x94, 0xf0, 0x74, 0xb7, 0xb8, 0xc5, 0x54, 0x59}}
gEfiUnixSystemConfigGuid = {0x375ea976, 0x3ccd, 0x4e74, {0xa8, 0x45, 0x26, 0xb9, 0xb3, 0x24, 0xb1, 0x3c}}
[PcdsFixedAtBuild.common] [PcdsFixedAtBuild.common]
gEfiUnixPkgTokenSpaceGuid.PcdUnixBootMode|1|UINT32|0x00001006 gEfiUnixPkgTokenSpaceGuid.PcdUnixBootMode|1|UINT32|0x00001006

View File

@ -219,7 +219,7 @@
UnixLib|UnixPkg/Library/DxeUnixLib/DxeUnixLib.inf UnixLib|UnixPkg/Library/DxeUnixLib/DxeUnixLib.inf
OemHookStatusCodeLib|UnixPkg/Library/DxeUnixOemHookStatusCodeLib/DxeUnixOemHookStatusCodeLib.inf OemHookStatusCodeLib|UnixPkg/Library/DxeUnixOemHookStatusCodeLib/DxeUnixOemHookStatusCodeLib.inf
DebugLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf DebugLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
PrintLib|MdeModulePkg/Library/EdkDxePrintLib/EdkDxePrintLib.inf PrintLib|MdeModulePkg/Library/DxePrintLibPrint2Protocol/DxePrintLibPrint2Protocol.inf
################################################################################ ################################################################################
# #
@ -389,6 +389,10 @@
gEfiUnixPkgTokenSpaceGuid.PcdUnixMemorySize|L"64!64"|VOID*|10 gEfiUnixPkgTokenSpaceGuid.PcdUnixMemorySize|L"64!64"|VOID*|10
gEfiUnixPkgTokenSpaceGuid.PcdUnixSerialPort|L"/dev/ttyS0!/dev/ttyS1"|VOID*|20 gEfiUnixPkgTokenSpaceGuid.PcdUnixSerialPort|L"/dev/ttyS0!/dev/ttyS1"|VOID*|20
[PcdsDynamicHii.common.DEFAULT]
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn|0x0053 0x0065 0x0074 0x0075 0x0070|gEfiWinNtSystemConfigGuid|0x0|80 # Variable: L"Setup"
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow|0x0053 0x0065 0x0074 0x0075 0x0070|gEfiWinNtSystemConfigGuid|0x4|25 # Variable: L"Setup"
################################################################################################### ###################################################################################################
# #
# Components Section - list of the modules and components that will be processed by compilation # Components Section - list of the modules and components that will be processed by compilation
@ -500,6 +504,7 @@
MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
MdeModulePkg/Universal/PrintDxe/PrintDxe.inf
MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf { MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf {
<LibraryClasses> <LibraryClasses>
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf

View File

@ -211,7 +211,8 @@ INF UnixPkg/UnixSerialIoDxe/UnixSerialIo.inf
INF UnixPkg/UnixUgaDxe/UnixUga.inf INF UnixPkg/UnixUgaDxe/UnixUga.inf
#INF UnixPkg/UnixConsoleDxe/UnixConsole.inf #INF UnixPkg/UnixConsoleDxe/UnixConsole.inf
INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
INF MdeModulePkg/Universal/PrintDxe/PrintDxe.inf
INF IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf INF IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf
INF UnixPkg/UnixSimpleFileSystemDxe/UnixSimpleFileSystem.inf INF UnixPkg/UnixSimpleFileSystemDxe/UnixSimpleFileSystem.inf
INF MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf INF MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf