Change SMM CPU I/O to SMM CPU I/O 2

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9735 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
mdkinney
2010-01-14 04:20:04 +00:00
parent f659880bfa
commit 8fc71decbe
10 changed files with 128 additions and 156 deletions

View File

@@ -4,7 +4,7 @@
All assertions for bit field operations are handled bit field functions in the
Base Library.
Copyright (c) 2009, Intel Corporation<BR>
Copyright (c) 2009 - 2010, Intel Corporation<BR>
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
@@ -13,8 +13,6 @@
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: IoHighLevel.c
The following IoLib instances share the same version of this file:
BaseIoLibIntrinsic
@@ -23,7 +21,6 @@
SmmIoLibCpuIo
**/
#include "SmmCpuIoLibInternal.h"
/**

View File

@@ -3,7 +3,7 @@
The implementation of I/O operation for this library instance
are based on EFI_CPU_IO_PROTOCOL.
Copyright (c) 2009, Intel Corporation<BR>
Copyright (c) 2009 - 2010, Intel Corporation<BR>
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
@@ -12,18 +12,14 @@
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: IoLib.c
**/
#include "SmmCpuIoLibInternal.h"
//
// Globle varible to cache pointer to CpuIo protocol.
//
EFI_SMM_CPU_IO_PROTOCOL *mCpuIo = NULL;
EFI_SMM_PCI_ROOT_BRIDGE_IO_PROTOCOL *mPciRootBridgeIo = NULL;
EFI_SMM_CPU_IO2_PROTOCOL *mCpuIo2 = NULL;
/**
The constructor function caches the pointer to CpuIo protocol.
@@ -46,10 +42,7 @@ IoLibConstructor (
{
EFI_STATUS Status;
Status = gSmst->SmmLocateProtocol (&gEfiSmmPciRootBridgeIoProtocolGuid, NULL, (VOID **) &mPciRootBridgeIo);
if (EFI_ERROR (Status)) {
Status = gSmst->SmmLocateProtocol (&gEfiSmmCpuIoProtocolGuid, NULL, (VOID **) &mCpuIo);
}
Status = gSmst->SmmLocateProtocol (&gEfiSmmCpuIo2ProtocolGuid, NULL, (VOID **) &mCpuIo2);
ASSERT_EFI_ERROR (Status);
return Status;
@@ -79,11 +72,7 @@ IoReadWorker (
EFI_STATUS Status;
UINT64 Data;
if (mPciRootBridgeIo != NULL) {
Status = mPciRootBridgeIo->Io.Read (mPciRootBridgeIo, (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width, Port, 1, &Data);
} else {
Status = mCpuIo->Io.Read (mCpuIo, Width, Port, 1, &Data);
}
Status = mCpuIo2->Io.Read (mCpuIo2, Width, Port, 1, &Data);
ASSERT_EFI_ERROR (Status);
return Data;
@@ -114,11 +103,7 @@ IoWriteWorker (
{
EFI_STATUS Status;
if (mPciRootBridgeIo != NULL) {
Status = mPciRootBridgeIo->Io.Write (mPciRootBridgeIo, (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width, Port, 1, &Data);
} else {
Status = mCpuIo->Io.Write (mCpuIo, Width, Port, 1, &Data);
}
Status = mCpuIo2->Io.Write (mCpuIo2, Width, Port, 1, &Data);
ASSERT_EFI_ERROR (Status);
return Data;
@@ -148,11 +133,7 @@ MmioReadWorker (
EFI_STATUS Status;
UINT64 Data;
if (mPciRootBridgeIo != NULL) {
Status = mPciRootBridgeIo->Mem.Read (mPciRootBridgeIo, (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width, Address, 1, &Data);
} else {
Status = mCpuIo->Mem.Read (mCpuIo, Width, Address, 1, &Data);
}
Status = mCpuIo2->Mem.Read (mCpuIo2, Width, Address, 1, &Data);
ASSERT_EFI_ERROR (Status);
return Data;
@@ -183,11 +164,7 @@ MmioWriteWorker (
{
EFI_STATUS Status;
if (mPciRootBridgeIo != NULL) {
Status = mPciRootBridgeIo->Mem.Write (mPciRootBridgeIo, (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width, Address, 1, &Data);
} else {
Status = mCpuIo->Mem.Write (mCpuIo, Width, Address, 1, &Data);
}
Status = mCpuIo2->Mem.Write (mCpuIo2, Width, Address, 1, &Data);
ASSERT_EFI_ERROR (Status);
return Data;

View File

@@ -1,7 +1,7 @@
/** @file
I/O Library MMIO Buffer Functions.
Copyright (c) 2009, Intel Corporation<BR>
Copyright (c) 2009 - 2010, Intel Corporation<BR>
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
@@ -10,11 +10,8 @@
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: IoLibMmioBuffer.c
**/
#include "SmmCpuIoLibInternal.h"
/**

View File

@@ -4,7 +4,7 @@
for implementation of IoLib library instance. It is included
all source code of this library instance.
Copyright (c) 2009, Intel Corporation
Copyright (c) 2009 - 2010, 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
@@ -13,16 +13,13 @@
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: DxeCpuIoLibInternal.h
**/
#ifndef _SMM_CPUIO_LIB_INTERNAL_H_
#define _SMM_CPUIO_LIB_INTERNAL_H_
#include <PiSmm.h>
#include <Protocol/SmmCpuIo.h>
#include <Protocol/SmmCpuIo2.h>
#include <Protocol/SmmPciRootBridgeIo.h>
#include <Library/IoLib.h>
#include <Library/DebugLib.h>

View File

@@ -3,7 +3,7 @@
#
# I/O Library implementation that uses the CPU I/O Protocol for I/O
# and MMIO operations.
# Copyright (c) 2009, Intel Corporation.
# Copyright (c) 2009 - 2010, 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
@@ -12,19 +12,16 @@
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
#
#**/
[Defines]
INF_VERSION = 0x00010005
BASE_NAME = SmmIoLibCpuIo
BASE_NAME = SmmIoLibSmmCpuIo2
FILE_GUID = DEEEA15E-4A77-4513-BA75-71D26FEF78A1
MODULE_TYPE = DXE_SMM_DRIVER
VERSION_STRING = 1.0
LIBRARY_CLASS = IoLib|DXE_SMM_DRIVER SMM_CORE
EFI_SPECIFICATION_VERSION = 0x00020000
PI_SPECIFICATION_VERSION = 0x0001000A
CONSTRUCTOR = IoLibConstructor
#
@@ -33,13 +30,12 @@
# VALID_ARCHITECTURES = IA32 X64
#
[Sources.common]
[Sources]
IoLibMmioBuffer.c
SmmCpuIoLibInternal.h
IoHighLevel.c
IoLib.c
[Packages]
MdePkg/MdePkg.dec
@@ -49,8 +45,7 @@
SmmServicesTableLib
[Protocols]
gEfiSmmCpuIoProtocolGuid ## CONSUMES
gEfiSmmPciRootBridgeIoProtocolGuid ## CONSUMES
gEfiSmmCpuIo2ProtocolGuid ## CONSUMES
[Depex]
gEfiSmmCpuIoProtocolGuid OR gEfiSmmPciRootBridgeIoProtocolGuid
gEfiSmmCpuIo2ProtocolGuid