1. Removed #ifdef SNP_DEBUG and used debug lib to output information

2. Rename PcdPlatformNoCsmSupport to PcdPlatformCsmSupport.
3  Removed #ifdef EFI_NO_CSM and used PcdPlatformCsmSupport.
4. Removed #ifdef ALIGNMENT from C Variable.c and added 2 files Variable/Pei/Ipf/VariableWorker.c and Variable/Pei/VariableWorker.c


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2487 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
vanjeff
2007-03-20 02:44:09 +00:00
parent b06af5d71e
commit 3aaddf9276
13 changed files with 202 additions and 233 deletions

View File

@ -2075,14 +2075,6 @@
<MaxDatumSize>4</MaxDatumSize> <MaxDatumSize>4</MaxDatumSize>
<Value>320</Value> <Value>320</Value>
</PcdData> </PcdData>
<PcdData ItemType="FEATURE_FLAG">
<C_Name>PcdNtEmulatorEnable</C_Name>
<Token>0x0001003e</Token>
<TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
<DatumType>BOOLEAN</DatumType>
<MaxDatumSize>1</MaxDatumSize>
<Value>FALSE</Value>
</PcdData>
</PcdBuildDefinition> </PcdBuildDefinition>
<ModuleSaBuildOptions> <ModuleSaBuildOptions>
<FvBinding>NULL</FvBinding> <FvBinding>NULL</FvBinding>
@ -8030,14 +8022,6 @@
<MaxDatumSize>4</MaxDatumSize> <MaxDatumSize>4</MaxDatumSize>
<Value>320</Value> <Value>320</Value>
</PcdData> </PcdData>
<PcdData ItemType="FEATURE_FLAG">
<C_Name>PcdNtEmulatorEnable</C_Name>
<Token>0x0001003e</Token>
<TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
<DatumType>BOOLEAN</DatumType>
<MaxDatumSize>1</MaxDatumSize>
<Value>FALSE</Value>
</PcdData>
</PcdBuildDefinition> </PcdBuildDefinition>
<ModuleSaBuildOptions> <ModuleSaBuildOptions>
<FvBinding>NULL</FvBinding> <FvBinding>NULL</FvBinding>
@ -12587,14 +12571,6 @@
<MaxDatumSize>4</MaxDatumSize> <MaxDatumSize>4</MaxDatumSize>
<Value>320</Value> <Value>320</Value>
</PcdData> </PcdData>
<PcdData ItemType="FEATURE_FLAG">
<C_Name>PcdNtEmulatorEnable</C_Name>
<Token>0x0001003e</Token>
<TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
<DatumType>BOOLEAN</DatumType>
<MaxDatumSize>1</MaxDatumSize>
<Value>FALSE</Value>
</PcdData>
</PcdBuildDefinition> </PcdBuildDefinition>
<ModuleSaBuildOptions> <ModuleSaBuildOptions>
<FvBinding>NULL</FvBinding> <FvBinding>NULL</FvBinding>
@ -16966,14 +16942,6 @@
<MaxDatumSize>4</MaxDatumSize> <MaxDatumSize>4</MaxDatumSize>
<Value>320</Value> <Value>320</Value>
</PcdData> </PcdData>
<PcdData ItemType="FEATURE_FLAG">
<C_Name>PcdNtEmulatorEnable</C_Name>
<Token>0x0001003e</Token>
<TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
<DatumType>BOOLEAN</DatumType>
<MaxDatumSize>1</MaxDatumSize>
<Value>FALSE</Value>
</PcdData>
</PcdBuildDefinition> </PcdBuildDefinition>
<ModuleSaBuildOptions> <ModuleSaBuildOptions>
<FvBinding>NULL</FvBinding> <FvBinding>NULL</FvBinding>

View File

@ -1,17 +1,17 @@
/*++ /*++
Copyright (c) 2006, Intel Corporation Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name: Module Name:
pxe_bc_dhcp.c pxe_bc_dhcp.c
Abstract: Abstract:
DHCP and PXE discovery protocol implementations. DHCP and PXE discovery protocol implementations.
@ -411,7 +411,7 @@ Routine description:
Arguments: Arguments:
Smbios - Pointer to SMBIOS structure Smbios - Pointer to SMBIOS structure
StringNumber - String number to return. 0 is used to skip all strings and StringNumber - String number to return. 0 is used to skip all strings and
point to the next SMBIOS structure. point to the next SMBIOS structure.
Returns: Returns:
@ -1165,11 +1165,11 @@ Parameters:
Private := Pointer to PxeBc interface Private := Pointer to PxeBc interface
ExtraEdit := Pointer to extra option checking function ExtraEdit := Pointer to extra option checking function
OpFlags := UdpRead() option flags OpFlags := UdpRead() option flags
ServerIpPtr := ServerIpPtr :=
ServerPortPtr := ServerPortPtr :=
ClientIpPtr := ClientIpPtr :=
ClientPortPtr := ClientPortPtr :=
DhcpRxBuf := DhcpRxBuf :=
TimeoutEvent := TimeoutEvent :=
Returns: Returns:
@ -2309,7 +2309,7 @@ Routine description:
Parameters: Parameters:
This := Pointer to PxeBc interface This := Pointer to PxeBc interface
SortOffers := SortOffers :=
Returns: Returns:
--*/ --*/
@ -2466,12 +2466,12 @@ DoDiscover (
PXE_SERVER_LISTS *ServerListPtr PXE_SERVER_LISTS *ServerListPtr
) )
/*++ /*++
Routine description: Routine description:
This function tries to complete the PXE Bootserver and/or boot image This function tries to complete the PXE Bootserver and/or boot image
discovery sequence. When this command completes successfully, the discovery sequence. When this command completes successfully, the
PXEdiscover and PXEreply fields in the BC instance data structure are PXEdiscover and PXEreply fields in the BC instance data structure are
updated. If the Info pointer is set to NULL, the discovery information updated. If the Info pointer is set to NULL, the discovery information
in the DHCPack and ProxyOffer packets must be valid and will be used. in the DHCPack and ProxyOffer packets must be valid and will be used.
If Info is not set to NULL, the discovery methods in the Info field If Info is not set to NULL, the discovery methods in the Info field
must be set and will be used. When discovering any layer number other must be set and will be used. When discovering any layer number other
than zero (the credential flag does not count), only unicast discovery than zero (the credential flag does not count), only unicast discovery
@ -2479,12 +2479,12 @@ Routine description:
Parameters: Parameters:
Private := Pointer to PxeBc interface Private := Pointer to PxeBc interface
OpFlags := OpFlags :=
Type := Type :=
LayerPtr := LayerPtr :=
UseBis := UseBis :=
DestPtr := DestPtr :=
ServerListPtr := ServerListPtr :=
Returns: Returns:
--*/ --*/
@ -2771,12 +2771,12 @@ Routine Description:
Parameters: Parameters:
Private := Pointer to PxeBc interface Private := Pointer to PxeBc interface
Type := Type :=
LayerPtr := LayerPtr :=
UseBis := UseBis :=
DiscoverInfoPtr := DiscoverInfoPtr :=
McastServerListPtr := McastServerListPtr :=
ServerListPtr := ServerListPtr :=
Returns: Returns:
--*/ --*/
@ -2907,11 +2907,11 @@ BcDiscover (
Routine description: Routine description:
Parameters: Parameters:
This := This :=
Type := Type :=
LayerPtr := LayerPtr :=
UseBis := UseBis :=
DiscoverInfoPtr := DiscoverInfoPtr :=
Returns: Returns:
--*/ --*/

View File

@ -19,11 +19,6 @@ Abstract:
#include "PxeDhcp4.h" #include "PxeDhcp4.h"
#define DebugPrint(x)
//
// #define DebugPrint(x) Aprint x
//
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
STATIC STATIC
INTN INTN
offer_verify ( offer_verify (
@ -400,7 +395,7 @@ PxeDhcp4Init (
Private->offer_list = NULL; Private->offer_list = NULL;
Private->callback = NULL; Private->callback = NULL;
DebugPrint (("%a:%d:%r\n", __FILE__, __LINE__, EfiStatus)); DEBUG ((EFI_D_ERROR, "%r\n", EfiStatus));
return EfiStatus; return EfiStatus;
} }
@ -687,7 +682,7 @@ PxeDhcp4Select (
EfiStatus = add_opt (&request, srvid); EfiStatus = add_opt (&request, srvid);
if (EFI_ERROR (EfiStatus)) { if (EFI_ERROR (EfiStatus)) {
DebugPrint (("%a:%d:%r\n", __FILE__, __LINE__, EfiStatus)); DEBUG ((EFI_D_ERROR, "%r\n", EfiStatus));
Private->callback = NULL; Private->callback = NULL;
return EfiStatus; return EfiStatus;
} }
@ -702,7 +697,7 @@ PxeDhcp4Select (
EfiStatus = add_opt (&request, op); EfiStatus = add_opt (&request, op);
if (EFI_ERROR (EfiStatus)) { if (EFI_ERROR (EfiStatus)) {
DebugPrint (("%a:%d:%r\n", __FILE__, __LINE__, EfiStatus)); DEBUG ((EFI_D_ERROR, "%r\n", EfiStatus));
Private->callback = NULL; Private->callback = NULL;
return EfiStatus; return EfiStatus;
} }
@ -724,7 +719,7 @@ PxeDhcp4Select (
); );
if (EFI_ERROR (EfiStatus)) { if (EFI_ERROR (EfiStatus)) {
DebugPrint (("%a:%d:%r\n", __FILE__, __LINE__, EfiStatus)); DEBUG ((EFI_D_ERROR, "%r\n", EfiStatus));
Private->callback = NULL; Private->callback = NULL;
return EfiStatus; return EfiStatus;
} }

View File

@ -1,12 +1,12 @@
/*++ /*++
Copyright (c) 2006, Intel Corporation Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module name: Module name:
snp.h snp.h
@ -22,17 +22,8 @@ Revision history:
#include "IndustryStandard/pci22.h" #include "IndustryStandard/pci22.h"
#define SNP_DEBUG 0
#define FOUR_GIGABYTES (UINT64) 0x100000000ULL #define FOUR_GIGABYTES (UINT64) 0x100000000ULL
#if SNP_DEBUG
#undef D_NET
#define D_NET D_WARN
#define SNP_PRINT(DebugInfo) Print (DebugInfo)
#else
#define SNP_PRINT(DebugInfo)
#endif
#define SNP_DRIVER_SIGNATURE EFI_SIGNATURE_32 ('s', 'n', 'd', 's') #define SNP_DRIVER_SIGNATURE EFI_SIGNATURE_32 ('s', 'n', 'd', 's')
#define MAX_MAP_LENGTH 100 #define MAX_MAP_LENGTH 100
@ -455,13 +446,4 @@ VOID
#define SNP_MEM_PAGES(x) (((x) - 1) / 4096 + 1) #define SNP_MEM_PAGES(x) (((x) - 1) / 4096 + 1)
#if SNP_DEBUG
extern
VOID
snp_wait_for_key (
VOID
)
;
#endif
#endif /* _SNP_H */ #endif /* _SNP_H */

View File

@ -1,12 +1,12 @@
/*++ /*++
Copyright (c) 2006, Intel Corporation Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module name: Module name:
callback.c callback.c
@ -482,7 +482,7 @@ Returns:
} }
if (Index >= MAX_MAP_LENGTH) { if (Index >= MAX_MAP_LENGTH) {
SNP_PRINT (L"SNP maplist is FULL\n"); DEBUG ((EFI_D_INFO, "SNP maplist is FULL\n"));
*DevAddrPtr = 0; *DevAddrPtr = 0;
return ; return ;
} }

View File

@ -1,12 +1,12 @@
/*++ /*++
Copyright (c) 2006, Intel Corporation Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module name: Module name:
snp.c snp.c
@ -41,10 +41,8 @@ Returns:
--*/ --*/
{ {
#if SNP_DEBUG DEBUG ((EFI_D_ERROR, "\nissue_hwundi_command() - This should not be called!"));
Aprint ("\nissue_hwundi_command() - This should not be called!");
snp_wait_for_key ();
#endif
if (cdb == 0) { if (cdb == 0) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
@ -65,7 +63,7 @@ calc_8bit_cksum (
Routine Description: Routine Description:
Compute 8-bit checksum of a buffer. Compute 8-bit checksum of a buffer.
Arguments: Arguments:
ptr - Pointer to buffer. ptr - Pointer to buffer.
len - Length of buffer in bytes. len - Length of buffer in bytes.
@ -147,19 +145,13 @@ SimpleNetworkDriverSupported (
); );
if (Status == EFI_ALREADY_STARTED) if (Status == EFI_ALREADY_STARTED)
{ {
#if SNP_DEBUG DEBUG ((EFI_D_INFO, "Support(): Already Started. on handle %x\n", Controller));
Aprint ("Support(): Already Started. on handle %x\n", Controller);
#endif
return EFI_ALREADY_STARTED; return EFI_ALREADY_STARTED;
} }
if (!EFI_ERROR (Status)) if (!EFI_ERROR (Status))
{ {
DEBUG ((EFI_D_INFO, "Support(): UNDI3.1 found on handle %x\n", Controller));
#if SNP_DEBUG
Aprint ("Support(): UNDI3.1 found on handle %x\n", Controller);
snp_wait_for_key ();
#endif
IsUndi31 = TRUE; IsUndi31 = TRUE;
} else { } else {
// //
@ -177,10 +169,7 @@ SimpleNetworkDriverSupported (
return Status; return Status;
} }
#if SNP_DEBUG DEBUG ((EFI_D_INFO, "Support(): UNDI3.0 found on handle %x\n", Controller));
Aprint ("Support(): UNDI3.0 found on handle %x\n", Controller);
snp_wait_for_key ();
#endif
} }
// //
// check the version, we don't want to connect to the undi16 // check the version, we don't want to connect to the undi16
@ -244,10 +233,7 @@ SimpleNetworkDriverSupported (
} }
Status = EFI_SUCCESS; Status = EFI_SUCCESS;
#if SNP_DEBUG DEBUG ((EFI_D_INFO, "Support(): supported on %x\n", Controller));
Aprint ("Support(): supported on %x\n", Controller);
snp_wait_for_key ();
#endif
Done: Done:
if (IsUndi31) { if (IsUndi31) {
@ -374,10 +360,8 @@ Arguments:
// probably not a 3.1 UNDI // probably not a 3.1 UNDI
// //
UndiNew = TRUE; UndiNew = TRUE;
#if SNP_DEBUG DEBUG ((EFI_D_INFO, "Start(): UNDI3.1 found\n"));
Aprint ("Start(): UNDI3.1 found\n");
snp_wait_for_key ();
#endif
} else { } else {
UndiNew = FALSE; UndiNew = FALSE;
Status = gBS->OpenProtocol ( Status = gBS->OpenProtocol (
@ -399,10 +383,7 @@ Arguments:
return Status; return Status;
} }
#if SNP_DEBUG DEBUG ((EFI_D_INFO, "Start(): UNDI3.0 found\n"));
Aprint ("Start(): UNDI3.0 found\n");
snp_wait_for_key ();
#endif
} }
pxe = (PXE_UNDI *) (UINTN) (Nii->ID); pxe = (PXE_UNDI *) (UINTN) (Nii->ID);
@ -996,7 +977,7 @@ Returns:
Controller Controller
); );
} }
Status = gBS->CloseProtocol ( Status = gBS->CloseProtocol (
Controller, Controller,
&gEfiDevicePathProtocolGuid, &gEfiDevicePathProtocolGuid,
@ -1077,7 +1058,7 @@ add_v2p (
Routine Description: Routine Description:
This routine maps the given CPU address to a Device address. It creates a This routine maps the given CPU address to a Device address. It creates a
an entry in the map list with the virtual and physical addresses and the an entry in the map list with the virtual and physical addresses and the
un map cookie. un map cookie.
Arguments: Arguments:
@ -1138,7 +1119,7 @@ find_v2p (
/*++ /*++
Routine Description: Routine Description:
This routine searches the linked list of mapped address nodes (for undi3.0 This routine searches the linked list of mapped address nodes (for undi3.0
interface) to find the node that corresponds to the given virtual address and interface) to find the node that corresponds to the given virtual address and
returns a pointer to that node. returns a pointer to that node.
@ -1176,9 +1157,9 @@ del_v2p (
/*++ /*++
Routine Description: Routine Description:
This routine unmaps the given virtual address and frees the memory allocated This routine unmaps the given virtual address and frees the memory allocated
for the map list node corresponding to that address. for the map list node corresponding to that address.
Arguments: Arguments:
vaddr - virtual address (or CPU address) to be unmapped vaddr - virtual address (or CPU address) to be unmapped
@ -1210,11 +1191,9 @@ Returns:
gBS->FreePool (v); gBS->FreePool (v);
#if SNP_DEBUG
if (Status) { if (Status) {
Print (L"Unmap failed with status = %x\n", Status); DEBUG ((EFI_D_ERROR, "Unmap failed with status = %x\n", Status));
} }
#endif
return Status; return Status;
} }
@ -1223,42 +1202,13 @@ Returns:
v->next = t->next; v->next = t->next;
Status = mPciIoFncs->Unmap (mPciIoFncs, t->unmap); Status = mPciIoFncs->Unmap (mPciIoFncs, t->unmap);
gBS->FreePool (t); gBS->FreePool (t);
#if SNP_DEBUG
if (Status) { if (Status) {
Print (L"Unmap failed with status = %x\n", Status); DEBUG ((EFI_D_ERROR, "Unmap failed with status = %x\n", Status));
} }
#endif
return Status; return Status;
} }
} }
return EFI_NOT_FOUND; return EFI_NOT_FOUND;
} }
#if SNP_DEBUG
VOID
snp_wait_for_key (
VOID
)
/*++
Routine Description:
Wait for a key stroke, used for debugging purposes
Arguments:
none
Returns:
none
--*/
{
EFI_INPUT_KEY key;
Aprint ("\nPress any key to continue\n");
while (gST->ConIn->ReadKeyStroke (gST->ConIn, &key) == EFI_NOT_READY) {
;
}
}
#endif

View File

@ -0,0 +1,44 @@
/*++
Copyright (c) 2007, 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.
Module Name:
VariableWorker.c
Abstract:
Framework PEIM to provide the Variable functionality
--*/
#include <Variable.h>
VARIABLE_HEADER *
GetVariableByIndex (
IN VARIABLE_INDEX_TABLE *IndexTable,
IN UINT32 Count
)
{
return (VARIABLE_HEADER *) (UINTN) ((((UINT32)IndexTable->Index[Count]) << 2) + ((UINT32)(UINTN)IndexTable->StartPtr & 0xFFFC0000) );
}
VOID
VariableIndexTableUpdate (
IN OUT VARIABLE_INDEX_TABLE *IndexTable,
IN VARIABLE_HEADER *Variable
)
{
IndexTable->Index[IndexTable->Length++] = (UINT16) (((UINT32)(UINTN) Variable) >> 2);
return;
}

View File

@ -8,7 +8,6 @@ http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name: Module Name:
Variable.c Variable.c
@ -50,7 +49,7 @@ Routine Description:
Provide the functionality of the variable services. Provide the functionality of the variable services.
Arguments: Arguments:
FfsHeadher - The FFS file header FfsHeadher - The FFS file header
PeiServices - General purpose services available to every PEIM. PeiServices - General purpose services available to every PEIM.
@ -192,7 +191,7 @@ Returns:
EFI_SUCCESS - Found match variable EFI_SUCCESS - Found match variable
EFI_NOT_FOUND - Variable not found EFI_NOT_FOUND - Variable not found
--*/ --*/
{ {
if (VariableName[0] == 0) { if (VariableName[0] == 0) {
@ -265,7 +264,7 @@ Returns:
// No Variable Address equals zero, so 0 as initial value is safe. // No Variable Address equals zero, so 0 as initial value is safe.
// //
MaxIndex = 0; MaxIndex = 0;
GuidHob = GetFirstGuidHob (&gEfiVariableIndexTableGuid); GuidHob = GetFirstGuidHob (&gEfiVariableIndexTableGuid);
if (GuidHob == NULL) { if (GuidHob == NULL) {
IndexTable = BuildGuidHob (&gEfiVariableIndexTableGuid, sizeof (VARIABLE_INDEX_TABLE)); IndexTable = BuildGuidHob (&gEfiVariableIndexTableGuid, sizeof (VARIABLE_INDEX_TABLE));
@ -277,13 +276,8 @@ Returns:
IndexTable = GET_GUID_HOB_DATA (GuidHob); IndexTable = GET_GUID_HOB_DATA (GuidHob);
for (Count = 0; Count < IndexTable->Length; Count++) for (Count = 0; Count < IndexTable->Length; Count++)
{ {
#if ALIGNMENT <= 1 MaxIndex = GetVariableByIndex (IndexTable, Count);
MaxIndex = (VARIABLE_HEADER *) (UINTN) (IndexTable->Index[Count] + ((UINTN) IndexTable->StartPtr & 0xFFFF0000));
#else
#if ALIGNMENT >= 4
MaxIndex = (VARIABLE_HEADER *) (UINTN) ((((UINT32)IndexTable->Index[Count]) << 2) + ((UINT32)(UINTN)IndexTable->StartPtr & 0xFFFC0000) );
#endif
#endif
if (CompareWithValidVariable (MaxIndex, VariableName, VendorGuid, PtrTrack) == EFI_SUCCESS) { if (CompareWithValidVariable (MaxIndex, VariableName, VendorGuid, PtrTrack) == EFI_SUCCESS) {
PtrTrack->StartPtr = IndexTable->StartPtr; PtrTrack->StartPtr = IndexTable->StartPtr;
PtrTrack->EndPtr = IndexTable->EndPtr; PtrTrack->EndPtr = IndexTable->EndPtr;
@ -308,7 +302,7 @@ Returns:
VariableBase = (UINT8 *) (UINTN) PcdGet32 (PcdFlashNvStorageVariableBase); VariableBase = (UINT8 *) (UINTN) PcdGet32 (PcdFlashNvStorageVariableBase);
VariableStoreHeader = (VARIABLE_STORE_HEADER *) (VariableBase + \ VariableStoreHeader = (VARIABLE_STORE_HEADER *) (VariableBase + \
((EFI_FIRMWARE_VOLUME_HEADER *) (VariableBase)) -> HeaderLength); ((EFI_FIRMWARE_VOLUME_HEADER *) (VariableBase)) -> HeaderLength);
if (GetVariableStoreStatus (VariableStoreHeader) != EfiValid) { if (GetVariableStoreStatus (VariableStoreHeader) != EfiValid) {
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
} }
@ -342,13 +336,7 @@ Returns:
// //
if (IndexTable->Length < VARIABLE_INDEX_TABLE_VOLUME) if (IndexTable->Length < VARIABLE_INDEX_TABLE_VOLUME)
{ {
#if ALIGNMENT <= 1 VariableIndexTableUpdate (IndexTable, Variable);
IndexTable->Index[IndexTable->Length++] = (UINT16) (UINTN) Variable;
#else
#if ALIGNMENT >= 4
IndexTable->Index[IndexTable->Length++] = (UINT16) (((UINT32)(UINTN) Variable) >> 2);
#endif
#endif
} }
if (CompareWithValidVariable (Variable, VariableName, VendorGuid, PtrTrack) == EFI_SUCCESS) { if (CompareWithValidVariable (Variable, VariableName, VendorGuid, PtrTrack) == EFI_SUCCESS) {

View File

@ -1,18 +1,18 @@
/*++ /*++
Copyright (c) 2006, Intel Corporation Copyright (c) 2006, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name: Module Name:
Variable.h Variable.h
Abstract: Abstract:
Tiano PEIM to provide the variable functionality Tiano PEIM to provide the variable functionality
@ -24,7 +24,7 @@ Abstract:
// //
// BugBug: We need relcate the head file. // BugBug: We need relcate the head file.
// //
#include <Common/Variable.h> #include <Common/Variable.h>
#include <VarMachine.h> #include <VarMachine.h>
@ -150,4 +150,16 @@ Returns:
--*/ --*/
; ;
VARIABLE_HEADER *
GetVariableByIndex (
IN VARIABLE_INDEX_TABLE *IndexTable,
IN UINT32 Count
);
VOID
VariableIndexTableUpdate (
IN OUT VARIABLE_INDEX_TABLE *IndexTable,
IN VARIABLE_HEADER *Variable
);
#endif // _PEI_VARIABLE_H #endif // _PEI_VARIABLE_H

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<MsaHeader> <MsaHeader>
<ModuleName>PeiVariable</ModuleName> <ModuleName>PeiVariable</ModuleName>
@ -42,6 +42,8 @@
<Filename>Variable.h</Filename> <Filename>Variable.h</Filename>
<Filename>Variable.c</Filename> <Filename>Variable.c</Filename>
<Filename>Variable.dxs</Filename> <Filename>Variable.dxs</Filename>
<Filename SupArchList="IA32 X64 EBC">VariableWorker.c</Filename>
<Filename SupArchList="IPF">Ipf/VariableWorker.c</Filename>
<Filename SupArchList="IA32">Ia32/VarMachine.h</Filename> <Filename SupArchList="IA32">Ia32/VarMachine.h</Filename>
<Filename SupArchList="EBC">Ebc/VarMachine.h</Filename> <Filename SupArchList="EBC">Ebc/VarMachine.h</Filename>
<Filename SupArchList="X64">x64/VarMachine.h</Filename> <Filename SupArchList="X64">x64/VarMachine.h</Filename>

View File

@ -0,0 +1,44 @@
/*++
Copyright (c) 2007, 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.
Module Name:
VariableWorker.c
Abstract:
Framework PEIM to provide the Variable functionality
--*/
#include <Variable.h>
VARIABLE_HEADER *
GetVariableByIndex (
IN VARIABLE_INDEX_TABLE *IndexTable,
IN UINT32 Count
)
{
return (VARIABLE_HEADER *) (UINTN) (IndexTable->Index[Count] + ((UINTN) IndexTable->StartPtr & 0xFFFF0000));
}
VOID
VariableIndexTableUpdate (
IN OUT VARIABLE_INDEX_TABLE *IndexTable,
IN VARIABLE_HEADER *Variable
)
{
IndexTable->Index[IndexTable->Length++] = (UINT16) (UINTN) Variable;
return;
}

View File

@ -3224,14 +3224,6 @@
<MaxDatumSize>4</MaxDatumSize> <MaxDatumSize>4</MaxDatumSize>
<Value>320</Value> <Value>320</Value>
</PcdData> </PcdData>
<PcdData ItemType="FEATURE_FLAG">
<C_Name>PcdNtEmulatorEnable</C_Name>
<Token>0x0001003e</Token>
<TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
<DatumType>BOOLEAN</DatumType>
<MaxDatumSize>1</MaxDatumSize>
<Value>FALSE</Value>
</PcdData>
</PcdBuildDefinition> </PcdBuildDefinition>
<ModuleSaBuildOptions> <ModuleSaBuildOptions>
<FvBinding>NULL</FvBinding> <FvBinding>NULL</FvBinding>

View File

@ -3216,14 +3216,6 @@
<MaxDatumSize>4</MaxDatumSize> <MaxDatumSize>4</MaxDatumSize>
<Value>320</Value> <Value>320</Value>
</PcdData> </PcdData>
<PcdData ItemType="FEATURE_FLAG">
<C_Name>PcdNtEmulatorEnable</C_Name>
<Token>0x0001003e</Token>
<TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
<DatumType>BOOLEAN</DatumType>
<MaxDatumSize>1</MaxDatumSize>
<Value>FALSE</Value>
</PcdData>
</PcdBuildDefinition> </PcdBuildDefinition>
<ModuleSaBuildOptions> <ModuleSaBuildOptions>
<FvBinding>NULL</FvBinding> <FvBinding>NULL</FvBinding>