summaryrefslogtreecommitdiffstats
path: root/UnixPkg
diff options
context:
space:
mode:
authorqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>2009-02-23 03:20:54 +0000
committerqhuang8 <qhuang8@6f19259b-4bc3-4df7-8a09-765794883524>2009-02-23 03:20:54 +0000
commitc71b65973b59d4eb4bf9b79c5fa59bb511c464ce (patch)
tree87ceda282b798a9f25d41a349e9549d3676ab8b8 /UnixPkg
parentfcf24bad4a7b0e7acb540caaa618f53547033d85 (diff)
downloadedk2-c71b65973b59d4eb4bf9b79c5fa59bb511c464ce.tar.gz
edk2-c71b65973b59d4eb4bf9b79c5fa59bb511c464ce.tar.bz2
edk2-c71b65973b59d4eb4bf9b79c5fa59bb511c464ce.zip
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
Diffstat (limited to 'UnixPkg')
-rw-r--r--UnixPkg/FvbServicesRuntimeDxe/FWBlockService.c58
-rw-r--r--UnixPkg/Include/Guid/UnixSystemConfig.h36
-rw-r--r--UnixPkg/Library/UnixBdsLib/BdsPlatform.c40
-rw-r--r--UnixPkg/Library/UnixBdsLib/BdsPlatform.h2
-rw-r--r--UnixPkg/Library/UnixBdsLib/PlatformBds.inf13
-rw-r--r--UnixPkg/UnixPkg.dec2
-rw-r--r--UnixPkg/UnixPkg.dsc7
-rw-r--r--UnixPkg/UnixPkg.fdf3
8 files changed, 117 insertions, 44 deletions
diff --git a/UnixPkg/FvbServicesRuntimeDxe/FWBlockService.c b/UnixPkg/FvbServicesRuntimeDxe/FWBlockService.c
index 79f6be6ae5..21ae8f8501 100644
--- a/UnixPkg/FvbServicesRuntimeDxe/FWBlockService.c
+++ b/UnixPkg/FvbServicesRuntimeDxe/FWBlockService.c
@@ -19,7 +19,7 @@ Revision History
--*/
-#include "PiDxe.h"
+#include <PiDxe.h>
#include <Guid/EventGroup.h>
#include <Protocol/FvbExtension.h>
#include <Protocol/FirmwareVolumeBlock.h>
@@ -846,7 +846,7 @@ Returns:
EFI_STATUS
EFIAPI
FvbProtocolGetPhysicalAddress (
- IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
+ IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
OUT EFI_PHYSICAL_ADDRESS *Address
)
/*++
@@ -877,8 +877,8 @@ Returns:
EFI_STATUS
EFIAPI
FvbProtocolGetBlockSize (
- IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
- IN EFI_LBA Lba,
+ IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
+ IN CONST EFI_LBA Lba,
OUT UINTN *BlockSize,
OUT UINTN *NumOfBlocks
)
@@ -921,7 +921,7 @@ Returns:
EFI_STATUS
EFIAPI
FvbProtocolGetAttributes (
- IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
+ IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
OUT EFI_FVB_ATTRIBUTES_2 *Attributes
)
/*++
@@ -948,7 +948,7 @@ Returns:
EFI_STATUS
EFIAPI
FvbProtocolSetAttributes (
- IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
+ IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
IN OUT EFI_FVB_ATTRIBUTES_2 *Attributes
)
/*++
@@ -975,7 +975,7 @@ Returns:
EFI_STATUS
EFIAPI
FvbProtocolEraseBlocks (
- IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
+ IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
...
)
/*++
@@ -1073,7 +1073,7 @@ Returns:
EFI_STATUS
EFIAPI
FvbProtocolWrite (
- IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
+ IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
IN EFI_LBA Lba,
IN UINTN Offset,
IN OUT UINTN *NumBytes,
@@ -1115,15 +1115,15 @@ Returns:
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
EFIAPI
FvbProtocolRead (
- IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
- IN EFI_LBA Lba,
- IN UINTN Offset,
+ IN CONST EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *This,
+ IN CONST EFI_LBA Lba,
+ IN CONST UINTN Offset,
IN OUT UINTN *NumBytes,
IN UINT8 *Buffer
)
@@ -1256,7 +1256,7 @@ Returns:
Ptr = (UINT16 *) FwVolHeader;
Checksum = 0;
while (HeaderLength > 0) {
- Checksum = Checksum + (*Ptr);
+ Checksum = (UINT16)(Checksum + (*Ptr));
HeaderLength--;
Ptr++;
}
@@ -1312,12 +1312,8 @@ Returns:
// Allocate runtime services data for global variable, which contains
// the private data of all firmware volume block instances
//
- Status = gBS->AllocatePool (
- EfiRuntimeServicesData,
- sizeof (ESAL_FWB_GLOBAL),
- (VOID**) &mFvbModuleGlobal
- );
- ASSERT_EFI_ERROR (Status);
+ mFvbModuleGlobal = AllocateRuntimePool (sizeof (ESAL_FWB_GLOBAL));
+ ASSERT (mFvbModuleGlobal != NULL);
//
// 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
// mode, the address of the the physical memory may be different.
//
- Status = gBS->AllocatePool (
- EfiRuntimeServicesData,
- BufferSize,
- (VOID**) &mFvbModuleGlobal->FvInstance[FVB_PHYSICAL]
- );
- ASSERT_EFI_ERROR (Status);
+ mFvbModuleGlobal->FvInstance[FVB_PHYSICAL] = AllocateRuntimePool (BufferSize);
+ ASSERT (mFvbModuleGlobal->FvInstance[FVB_PHYSICAL] != NULL);
//
// Make a virtual copy of the FvInstance pointer.
@@ -1452,12 +1444,8 @@ Returns:
//
// Add a FVB Protocol Instance
//
- Status = gBS->AllocatePool (
- EfiRuntimeServicesData,
- sizeof (EFI_FW_VOL_BLOCK_DEVICE),
- (VOID**) &FvbDevice
- );
- ASSERT_EFI_ERROR (Status);
+ FvbDevice = AllocateRuntimePool (sizeof (EFI_FW_VOL_BLOCK_DEVICE));
+ ASSERT (FvbDevice != NULL);
CopyMem (FvbDevice, &mFvbDeviceTemplate, sizeof (EFI_FW_VOL_BLOCK_DEVICE));
@@ -1541,12 +1529,8 @@ Returns:
//
// Allocate for scratch space, an intermediate buffer for FVB extention
//
- Status = gBS->AllocatePool (
- EfiRuntimeServicesData,
- MaxLbaSize,
- (VOID**)&mFvbModuleGlobal->FvbScratchSpace[FVB_PHYSICAL]
- );
- ASSERT_EFI_ERROR (Status);
+ mFvbModuleGlobal->FvbScratchSpace[FVB_PHYSICAL] = AllocateRuntimePool (MaxLbaSize);
+ ASSERT (mFvbModuleGlobal->FvbScratchSpace[FVB_PHYSICAL] != NULL);
mFvbModuleGlobal->FvbScratchSpace[FVB_VIRTUAL] = mFvbModuleGlobal->FvbScratchSpace[FVB_PHYSICAL];
diff --git a/UnixPkg/Include/Guid/UnixSystemConfig.h b/UnixPkg/Include/Guid/UnixSystemConfig.h
new file mode 100644
index 0000000000..a81f08a7a4
--- /dev/null
+++ b/UnixPkg/Include/Guid/UnixSystemConfig.h
@@ -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
diff --git a/UnixPkg/Library/UnixBdsLib/BdsPlatform.c b/UnixPkg/Library/UnixBdsLib/BdsPlatform.c
index 42882ca1f3..f4d32f1a57 100644
--- a/UnixPkg/Library/UnixBdsLib/BdsPlatform.c
+++ b/UnixPkg/Library/UnixBdsLib/BdsPlatform.c
@@ -23,6 +23,44 @@ Abstract:
#include "BdsPlatform.h"
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
@@ -35,7 +73,7 @@ PlatformBdsInit (
Routine Description:
- Platform Bds init. Incude the platform firmware vendor, revision
+ Platform Bds init. Include the platform firmware vendor, revision
and so crc check.
Arguments:
diff --git a/UnixPkg/Library/UnixBdsLib/BdsPlatform.h b/UnixPkg/Library/UnixBdsLib/BdsPlatform.h
index 6d5df84de5..f7b15556bf 100644
--- a/UnixPkg/Library/UnixBdsLib/BdsPlatform.h
+++ b/UnixPkg/Library/UnixBdsLib/BdsPlatform.h
@@ -27,6 +27,7 @@ Abstract:
#include <Library/DebugLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/UefiBootServicesTableLib.h>
+#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/BaseLib.h>
#include <Library/PcdLib.h>
@@ -37,6 +38,7 @@ Abstract:
#include <Protocol/UnixThunk.h>
#include <Protocol/UnixIo.h>
#include <Guid/Bmp.h>
+#include <Guid/WinNtSystemConfig.h>
extern BDS_CONSOLE_CONNECT_ENTRY gPlatformConsole[];
extern EFI_DEVICE_PATH_PROTOCOL *gPlatformConnectSequence[];
diff --git a/UnixPkg/Library/UnixBdsLib/PlatformBds.inf b/UnixPkg/Library/UnixBdsLib/PlatformBds.inf
index ffdec8a2ee..c296fe8c61 100644
--- a/UnixPkg/Library/UnixBdsLib/PlatformBds.inf
+++ b/UnixPkg/Library/UnixBdsLib/PlatformBds.inf
@@ -24,7 +24,6 @@
EDK_RELEASE_VERSION = 0x00020000
EFI_SPECIFICATION_VERSION = 0x00020000
- ENTRY_POINT = BdsInitialize
#
# The following information is for reference only and not required by the build tools.
@@ -34,9 +33,8 @@
[Sources.common]
BdsPlatform.c
- BdsPlatform.h
PlatformData.c
-
+ BdsPlatform.h
[Packages]
MdePkg/MdePkg.dec
@@ -69,6 +67,7 @@
BaseLib
MemoryAllocationLib
UefiBootServicesTableLib
+ UefiRuntimeServicesTableLib
BaseMemoryLib
DebugLib
PcdLib
@@ -78,3 +77,11 @@
[Guids]
gEfiDefaultBmpLogoGuid # ALWAYS_CONSUMED
+ gEfiUnixSystemConfigGuid
+
+[Pcd.common]
+ gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow
+ gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn
+
+[Depex]
+ gEfiVariableArchProtocolGuid AND gEfiVariableWriteArchProtocolGuid
diff --git a/UnixPkg/UnixPkg.dec b/UnixPkg/UnixPkg.dec
index f351e94954..573c430866 100644
--- a/UnixPkg/UnixPkg.dec
+++ b/UnixPkg/UnixPkg.dec
@@ -54,7 +54,7 @@
gEfiUnixCPUSpeedGuid = {0xf2d74e5a, 0x8985, 0x11db, {0x97, 0x05, 0x00, 0x40, 0xd0, 0x2b, 0x18, 0x35}}
gEfiUnixSerialPortGuid = {0x6d3a727d, 0x66c8, 0x4d19, {0x87, 0xe6, 0x02, 0x15, 0x86, 0x14, 0x90, 0xf3}}
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]
gEfiUnixPkgTokenSpaceGuid.PcdUnixBootMode|1|UINT32|0x00001006
diff --git a/UnixPkg/UnixPkg.dsc b/UnixPkg/UnixPkg.dsc
index c827c3c2a9..9443e8739e 100644
--- a/UnixPkg/UnixPkg.dsc
+++ b/UnixPkg/UnixPkg.dsc
@@ -219,7 +219,7 @@
UnixLib|UnixPkg/Library/DxeUnixLib/DxeUnixLib.inf
OemHookStatusCodeLib|UnixPkg/Library/DxeUnixOemHookStatusCodeLib/DxeUnixOemHookStatusCodeLib.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.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
@@ -500,6 +504,7 @@
MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
+ MdeModulePkg/Universal/PrintDxe/PrintDxe.inf
MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf {
<LibraryClasses>
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
diff --git a/UnixPkg/UnixPkg.fdf b/UnixPkg/UnixPkg.fdf
index 4ca51be0c4..956895697a 100644
--- a/UnixPkg/UnixPkg.fdf
+++ b/UnixPkg/UnixPkg.fdf
@@ -211,7 +211,8 @@ INF UnixPkg/UnixSerialIoDxe/UnixSerialIo.inf
INF UnixPkg/UnixUgaDxe/UnixUga.inf
#INF UnixPkg/UnixConsoleDxe/UnixConsole.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 UnixPkg/UnixSimpleFileSystemDxe/UnixSimpleFileSystem.inf
INF MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf