/* $Id$ */
/** @file
*/
/*
* Copyright (C) 2009-2010 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*/
/*++
This code is baed on:
Copyright (c) 2006 - 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
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
--*/
#include <IndustryStandard/Pci.h>
#include <IndustryStandard/Acpi.h>
#include <IndustryStandard/SmBios.h>
#include "LegacyBiosMpTable.h"
#include <Library/DebugLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Guid/GlobalVariable.h>
)
/*++
Routine Description:
Convert RSDP of ACPI Table if its location is lower than Address:0x100000
Assumption here:
As in legacy Bios, ACPI table is required to place in E/F Seg,
So here we just check if the range is E/F seg,
and if Not, assume the Memory type is EfiACPIReclaimMemory/EfiACPIMemoryNVS
Arguments:
TableLen - Acpi RSDP length
Table - pointer to the table
Returns:
EFI_SUCCESS - Convert Table successfully
Other - Failed
--*/
{
);
//
// Change configuration table Pointer
//
*Table = AcpiTableNew;
return EFI_SUCCESS;
}
)
/*++
Routine Description:
Convert Smbios Table if the Location of the SMBios Table is lower than Address 0x100000
Assumption here:
As in legacy Bios, Smbios table is required to place in E/F Seg,
So here we just check if the range is F seg,
and if Not, assume the Memory type is EfiACPIMemoryNVS/EfiRuntimeServicesData
Arguments:
Table - pointer to the table
Returns:
EFI_SUCCESS - Convert Table successfully
Other - Failed
--*/
{
//
// Get Smibos configuration Table
//
//
// Relocate the Smibos memory
//
} else {
//
// According to Smbios Spec 2.4, we should set entry point length as 0x1F if version is 2.1
//
SmbiosEntryLen = 0x1F;
}
);
CopyMem (
);
//
// Get Smbios Structure table address, and make sure the start address is 32-bit align
//
CopyMem (
);
//
// Change the SMBIOS pointer
//
*Table = SmbiosTableNew;
return EFI_SUCCESS;
}
)
/*++
Routine Description:
Convert MP Table if the Location of the SMBios Table is lower than Address 0x100000
Assumption here:
As in legacy Bios, MP table is required to place in E/F Seg,
So here we just check if the range is E/F seg,
and if Not, assume the Memory type is EfiACPIMemoryNVS/EfiRuntimeServicesData
Arguments:
Table - pointer to the table
Returns:
EFI_SUCCESS - Convert Table successfully
Other - Failed
--*/
{
//
// Get MP configuration Table
//
//
// Get Floating pointer structure length
//
}
//
// Relocate memory
//
);
//
// If Mp Table exists
//
if (MpsTableOri != NULL) {
//
// Get Mps table length, including Ext table
//
CopyMem (MpsTableNew, MpsTableOri, MpsTableOri->BaseTableLength + MpsTableOri->ExtendedTableLength);
}
MpsTableNew->Checksum = 0;
}
//
// Change the pointer
//
return EFI_SUCCESS;
}
)
/*++
Routine Description:
Convert ACPI Table /Smbios Table /MP Table if its location is lower than Address:0x100000
Assumption here:
So here we just check if the range is E/F seg,
and if Not, assume the Memory type is EfiACPIReclaimMemory/EfiACPIMemoryNVS
Arguments:
TableGuid - Guid of the table
Table - pointer to the table
Returns:
EFI_SUCCESS - Convert Table successfully
Other - Failed
--*/
{
//
// If match acpi guid (1.0, 2.0, or later), Convert ACPI table according to version.
//
//
// If Acpi 1.0 Table, then RSDP structure doesn't contain Length field, use structure size
//
//
// If Acpi 2.0 or later, use RSDP Length fied.
//
} else {
//
// Invalid Acpi Version, return
//
return EFI_UNSUPPORTED;
}
return Status;
}
//
// If matches smbios guid, convert Smbios table.
//
return Status;
}
//
// If the table is MP table?
//
return Status;
}
return EFI_UNSUPPORTED;
}