The implementation of I/O operation for this library instance \r
are based on EFI_CPU_IO_PROTOCOL.\r
\r
- Copyright (c) 2006, Intel Corporation<BR>\r
+ Copyright (c) 2006-2010, Intel Corporation<BR>\r
All rights reserved. This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
which accompanies this distribution. The full text of the license may be found at\r
//\r
// Globle varible to cache pointer to CpuIo protocol.\r
//\r
-EFI_CPU_IO_PROTOCOL *mCpuIo = NULL;\r
-EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *mPciRootBridgeIo = NULL;\r
+EFI_CPU_IO_PROTOCOL *mCpuIo = NULL;\r
\r
/**\r
The constructor function caches the pointer to CpuIo protocol.\r
IN EFI_SYSTEM_TABLE *SystemTable\r
)\r
{\r
- EFI_STATUS Status;\r
+ EFI_STATUS Status;\r
\r
- Status = gBS->LocateProtocol (&gEfiPciRootBridgeIoProtocolGuid, NULL, (VOID **) &mPciRootBridgeIo);\r
- if (EFI_ERROR (Status)) {\r
- Status = gBS->LocateProtocol (&gEfiCpuIoProtocolGuid, NULL, (VOID **) &mCpuIo);\r
- }\r
+ Status = gBS->LocateProtocol (&gEfiCpuIoProtocolGuid, NULL, (VOID **) &mCpuIo);\r
ASSERT_EFI_ERROR (Status);\r
\r
return Status;\r
UINT64\r
EFIAPI\r
IoReadWorker (\r
- IN UINTN Port,\r
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width\r
+ IN UINTN Port,\r
+ IN EFI_CPU_IO_PROTOCOL_WIDTH Width\r
)\r
{\r
EFI_STATUS Status;\r
UINT64 Data;\r
\r
- if (mPciRootBridgeIo != NULL) {\r
- Status = mPciRootBridgeIo->Io.Read (mPciRootBridgeIo, (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width, Port, 1, &Data);\r
- } else {\r
- Status = mCpuIo->Io.Read (mCpuIo, Width, Port, 1, &Data);\r
- }\r
+ Status = mCpuIo->Io.Read (mCpuIo, Width, Port, 1, &Data);\r
ASSERT_EFI_ERROR (Status);\r
\r
return Data;\r
UINT64\r
EFIAPI\r
IoWriteWorker (\r
- IN UINTN Port,\r
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width,\r
- IN UINT64 Data\r
+ IN UINTN Port,\r
+ IN EFI_CPU_IO_PROTOCOL_WIDTH Width,\r
+ IN UINT64 Data\r
)\r
{\r
- EFI_STATUS Status;\r
+ EFI_STATUS Status;\r
\r
- if (mPciRootBridgeIo != NULL) {\r
- Status = mPciRootBridgeIo->Io.Write (mPciRootBridgeIo, (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width, Port, 1, &Data);\r
- } else {\r
- Status = mCpuIo->Io.Write (mCpuIo, Width, Port, 1, &Data);\r
- }\r
+ Status = mCpuIo->Io.Write (mCpuIo, Width, Port, 1, &Data);\r
ASSERT_EFI_ERROR (Status);\r
\r
return Data;\r
UINT64\r
EFIAPI\r
MmioReadWorker (\r
- IN UINTN Address,\r
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width\r
+ IN UINTN Address,\r
+ IN EFI_CPU_IO_PROTOCOL_WIDTH Width\r
)\r
{\r
- EFI_STATUS Status;\r
- UINT64 Data;\r
+ EFI_STATUS Status;\r
+ UINT64 Data;\r
\r
- if (mPciRootBridgeIo != NULL) {\r
- Status = mPciRootBridgeIo->Mem.Read (mPciRootBridgeIo, (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width, Address, 1, &Data);\r
- } else {\r
- Status = mCpuIo->Mem.Read (mCpuIo, Width, Address, 1, &Data);\r
- }\r
+ Status = mCpuIo->Mem.Read (mCpuIo, Width, Address, 1, &Data);\r
ASSERT_EFI_ERROR (Status);\r
\r
return Data;\r
UINT64\r
EFIAPI\r
MmioWriteWorker (\r
- IN UINTN Address,\r
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width,\r
- IN UINT64 Data\r
+ IN UINTN Address,\r
+ IN EFI_CPU_IO_PROTOCOL_WIDTH Width,\r
+ IN UINT64 Data\r
)\r
{\r
- EFI_STATUS Status;\r
+ EFI_STATUS Status;\r
\r
- if (mPciRootBridgeIo != NULL) {\r
- Status = mPciRootBridgeIo->Mem.Write (mPciRootBridgeIo, (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width, Address, 1, &Data);\r
- } else {\r
- Status = mCpuIo->Mem.Write (mCpuIo, Width, Address, 1, &Data);\r
- }\r
+ Status = mCpuIo->Mem.Write (mCpuIo, Width, Address, 1, &Data);\r
ASSERT_EFI_ERROR (Status);\r
\r
return Data;\r