/* $Id$ */
/** @file
* APCI Platform Driver.
*/
/*
* Copyright (C) 2012-2013 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 based on MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatform.c
* r13361, UDK2010.SR1:
*
* Sample ACPI Platform Driver
*
* Copyright (c) 2008 - 2011, Intel Corporation. All rights reserved.<BR>
* 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 <PiDxe.h>
#include <Protocol/AcpiTable.h>
#include <Protocol/FirmwareVolume2.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/DebugLib.h>
#include <IndustryStandard/Acpi.h>
/**
Locate the first instance of a protocol. If the protocol requested is an
FV protocol, then it will return the first FV that contains the ACPI table
storage file.
@param Instance Return pointer to the first instance of the protocol
@return EFI_SUCCESS The function completed successfully.
@return EFI_NOT_FOUND The protocol could not be located.
@return EFI_OUT_OF_RESOURCES There are not enough resources to find the protocol.
**/
)
{
FvStatus = 0;
//
// Locate protocol.
//
NULL,
);
//
// Defined errors at this time are not found and out of resources.
//
return Status;
}
//
// Looking for FV with ACPI storage file
//
//
// Get the protocol on this handle
// This should not fail because of LocateHandleBuffer
//
(VOID**) &FvInstance
);
//
// See if it has the ACPI storage file
//
NULL,
&Size,
&FileType,
);
//
// If we found it, then we are done
//
if (Status == EFI_SUCCESS) {
*Instance = FvInstance;
break;
}
}
//
// Our exit status is determined by the success of the previous operations
// If the protocol was found, Instance already points to it.
//
//
// Free any allocated buffers
//
return Status;
}
/**
This function calculates and updates an UINT8 checksum.
@param Buffer Pointer to buffer to checksum
@param Size Number of bytes to checksum
**/
)
{
//
// Set checksum to 0 first
//
Buffer[ChecksumOffset] = 0;
//
// Update checksum value
//
}
#ifdef VBOX
VOID *
{
//
// First Search 0x0e0000 - 0x0fffff for RSD Ptr
//
}
}
//
// Search EBDA
//
}
}
return NULL;
}
{
while (Count-- > 0) {
&& (NoChecksum ||
)) {
return Ptr;
}
Ptr++;
}
return NULL;
}
{
static struct {
} TableInfo[] = {
// MADT, optional
// FACP (also called FADT)
// FACS, according 5.2.9 of ACPI v2. spec FACS doesn't have checksum field
// DSDT
// SSDT
// HPET
// MCFG
};
{
{
// we actually have 2 FADTs, see https://xtracker.innotek.de/index.php?bug=4082
}
{
if (!Ptr)
}
if (Ptr)
}
#if 0
// RSDT
Table++;
// XSDT
Table++;
#endif
}
#endif /* VBOX */
/**
Entrypoint of Acpi Platform driver.
@param ImageHandle
@param SystemTable
@return EFI_SUCCESS
@return EFI_LOAD_ERROR
@return EFI_OUT_OF_RESOURCES
**/
)
{
#ifdef USE_MEM_TABLES
#else
#endif
#ifndef USE_MEM_TABLES
#endif
Size = 0;
Instance = 0;
CurrentTable = NULL;
TableHandle = 0;
//
// Find the AcpiTable protocol
//
return EFI_ABORTED;
}
#ifdef USE_MEM_TABLES
//
// VBOX already has tables prepared in memory - just reuse them.
//
#else
//
// Locate the firmware volume protocol
//
return EFI_ABORTED;
}
//
// Read tables from the storage file.
//
#endif
while (Status == EFI_SUCCESS) {
#ifdef USE_MEM_TABLES
if (CurrentTable) {
}
#else
(VOID**) &CurrentTable,
&Size,
);
#endif
//
// Add the table
//
TableHandle = 0;
#ifdef VBOX
#endif
//
// Checksum ACPI table
//
//
// Install ACPI table
//
);
#ifndef USE_MEM_TABLES /* In case we're reading ACPI tables from memory we haven't
allocated this memory, so it isn't required to free it */
//
// Free memory allocated by ReadSection
//
#endif
return EFI_ABORTED;
}
//
// Increment the instance
//
Instance++;
CurrentTable = NULL;
}
}
return EFI_SUCCESS;
}