summaryrefslogtreecommitdiff
path: root/IntelFrameworkModulePkg/Library
diff options
context:
space:
mode:
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2009-06-25 13:47:45 +0000
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2009-06-25 13:47:45 +0000
commit8e8227d1a3d7361dcc3b3080509903c7b96b57f4 (patch)
treec6a6124e5bc10c4c748c7d568759fb73bf492bd2 /IntelFrameworkModulePkg/Library
parent745ed9b412dc18d9e189e754a2303ceb7a76fe5f (diff)
downloadedk2-platforms-8e8227d1a3d7361dcc3b3080509903c7b96b57f4.tar.xz
Code scrub for PCI Bus module and PciIncompatibleDeviceSupportLib module.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8662 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'IntelFrameworkModulePkg/Library')
-rw-r--r--IntelFrameworkModulePkg/Library/PciIncompatibleDeviceSupportLib/IncompatiblePciDeviceList.h144
-rw-r--r--IntelFrameworkModulePkg/Library/PciIncompatibleDeviceSupportLib/PciIncompatibleDeviceSupportLib.c80
-rw-r--r--IntelFrameworkModulePkg/Library/PciIncompatibleDeviceSupportLib/PciIncompatibleDeviceSupportLib.inf4
3 files changed, 97 insertions, 131 deletions
diff --git a/IntelFrameworkModulePkg/Library/PciIncompatibleDeviceSupportLib/IncompatiblePciDeviceList.h b/IntelFrameworkModulePkg/Library/PciIncompatibleDeviceSupportLib/IncompatiblePciDeviceList.h
index 629c5f5469..53609c0bfc 100644
--- a/IntelFrameworkModulePkg/Library/PciIncompatibleDeviceSupportLib/IncompatiblePciDeviceList.h
+++ b/IntelFrameworkModulePkg/Library/PciIncompatibleDeviceSupportLib/IncompatiblePciDeviceList.h
@@ -1,7 +1,7 @@
/** @file
- The incompatible PCI device list
+ The incompatible PCI device list template.
-Copyright (c) 2006 - 2007, Intel Corporation
+Copyright (c) 2006 - 2009, 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
@@ -19,7 +19,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Library/MemoryAllocationLib.h>
#include <Library/DebugLib.h>
-#include <IndustryStandard/Pci22.h>
+#include <IndustryStandard/Pci.h>
#include <IndustryStandard/Acpi.h>
@@ -51,11 +51,10 @@ typedef struct {
EFI_PCI_REGISTER_VALUE_DATA PciRegisterValueData;
} EFI_PCI_REGISTER_VALUE_DESCRIPTOR;
-
//
// the incompatible PCI devices list for ACPI resource
//
-GLOBAL_REMOVE_IF_UNREFERENCED UINT64 IncompatiblePciDeviceListForResource[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED UINT64 gIncompatiblePciDeviceListForResource[] = {
//
// DEVICE_INF_TAG,
// PCI_DEVICE_ID (VendorID, DeviceID, Revision, SubVendorId, SubDeviceId),
@@ -63,76 +62,37 @@ GLOBAL_REMOVE_IF_UNREFERENCED UINT64 IncompatiblePciDeviceListForResource[] = {
// ResType, GFlag , SFlag, Granularity, RangeMin,
// RangeMax, Offset, AddrLen
//
+
+ //
+ // Sample Device 1
+ //
+ //DEVICE_INF_TAG,
+ //PCI_DEVICE_ID(0xXXXX, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
+ //DEVICE_RES_TAG,
+ //PCI_BAR_TYPE_IO,
+ //PCI_ACPI_UNUSED,
+ //PCI_ACPI_UNUSED,
+ //PCI_ACPI_UNUSED,
+ //PCI_ACPI_UNUSED,
+ //PCI_BAR_EVEN_ALIGN,
+ //PCI_BAR_ALL,
+ //PCI_BAR_NOCHANGE,
+
//
- // Device Adaptec 9004
- //
- DEVICE_INF_TAG,
- PCI_DEVICE_ID(0x9004, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
- DEVICE_RES_TAG,
- PCI_BAR_TYPE_IO,
- PCI_ACPI_UNUSED,
- PCI_ACPI_UNUSED,
- PCI_ACPI_UNUSED,
- PCI_ACPI_UNUSED,
- PCI_BAR_EVEN_ALIGN,
- PCI_BAR_ALL,
- PCI_BAR_NOCHANGE,
- //
- // Device Adaptec 9005
- //
- DEVICE_INF_TAG,
- PCI_DEVICE_ID(0x9005, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
- DEVICE_RES_TAG,
- PCI_BAR_TYPE_IO,
- PCI_ACPI_UNUSED,
- PCI_ACPI_UNUSED,
- PCI_ACPI_UNUSED,
- PCI_ACPI_UNUSED,
- PCI_BAR_EVEN_ALIGN,
- PCI_BAR_ALL,
- PCI_BAR_NOCHANGE,
- //
- // Device QLogic 1007
- //
- DEVICE_INF_TAG,
- PCI_DEVICE_ID(0x1077, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
- DEVICE_RES_TAG,
- PCI_BAR_TYPE_IO,
- PCI_ACPI_UNUSED,
- PCI_ACPI_UNUSED,
- PCI_ACPI_UNUSED,
- PCI_ACPI_UNUSED,
- PCI_BAR_EVEN_ALIGN,
- PCI_BAR_ALL,
- PCI_BAR_NOCHANGE,
- //
- // Device Agilent 103C
- //
- DEVICE_INF_TAG,
- PCI_DEVICE_ID(0x103C, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
- DEVICE_RES_TAG,
- PCI_BAR_TYPE_IO,
- PCI_ACPI_UNUSED,
- PCI_ACPI_UNUSED,
- PCI_ACPI_UNUSED,
- PCI_ACPI_UNUSED,
- PCI_BAR_EVEN_ALIGN,
- PCI_BAR_ALL,
- PCI_BAR_NOCHANGE,
- //
- // Device Agilent 15BC
- //
- DEVICE_INF_TAG,
- PCI_DEVICE_ID(0x15BC, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
- DEVICE_RES_TAG,
- PCI_BAR_TYPE_IO,
- PCI_ACPI_UNUSED,
- PCI_ACPI_UNUSED,
- PCI_ACPI_UNUSED,
- PCI_ACPI_UNUSED,
- PCI_BAR_EVEN_ALIGN,
- PCI_BAR_ALL,
- PCI_BAR_NOCHANGE,
+ // Sample Device 2
+ //
+ //DEVICE_INF_TAG,
+ //PCI_DEVICE_ID(0xXXXX, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
+ //DEVICE_RES_TAG,
+ //PCI_BAR_TYPE_IO,
+ //PCI_ACPI_UNUSED,
+ //PCI_ACPI_UNUSED,
+ //PCI_ACPI_UNUSED,
+ //PCI_ACPI_UNUSED,
+ //PCI_BAR_EVEN_ALIGN,
+ //PCI_BAR_ALL,
+ //PCI_BAR_NOCHANGE,
+
//
// The end of the list
//
@@ -142,7 +102,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED UINT64 IncompatiblePciDeviceListForResource[] = {
//
// the incompatible PCI devices list for the values of configuration registers
//
-GLOBAL_REMOVE_IF_UNREFERENCED UINT64 IncompatiblePciDeviceListForRegister[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED UINT64 gIncompatiblePciDeviceListForRegister[] = {
//
// DEVICE_INF_TAG,
// PCI_DEVICE_ID (VendorID, DeviceID, Revision, SubVendorId, SubDeviceId),
@@ -151,26 +111,26 @@ GLOBAL_REMOVE_IF_UNREFERENCED UINT64 IncompatiblePciDeviceListForRegister[] = {
// AND_VALUE, OR_VALUE
//
- // Device Lava 0x1407, DeviceId 0x0110
+ // Sample Device 1
//
- DEVICE_INF_TAG,
- PCI_DEVICE_ID(0x1407, 0x0110, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
- DEVICE_RES_TAG,
- PCI_REGISTER_READ,
- PCI_CAPBILITY_POINTER_OFFSET,
- 0xffffff00,
- VALUE_NOCARE,
+ //DEVICE_INF_TAG,
+ //PCI_DEVICE_ID(0xXXXX, 0xXXXX, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
+ //DEVICE_RES_TAG,
+ //PCI_REGISTER_READ,
+ //PCI_CAPBILITY_POINTER_OFFSET,
+ //0xffffff00,
+ //VALUE_NOCARE,
//
- // Device Lava 0x1407, DeviceId 0x0111
+ // Sample Device 2
//
- DEVICE_INF_TAG,
- PCI_DEVICE_ID(0x1407, 0x0111, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
- DEVICE_RES_TAG,
- PCI_REGISTER_READ,
- PCI_CAPBILITY_POINTER_OFFSET,
- 0xffffff00,
- VALUE_NOCARE,
+ //DEVICE_INF_TAG,
+ //PCI_DEVICE_ID(0xXXXX, 0xXXXX, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE, DEVICE_ID_NOCARE),
+ //DEVICE_RES_TAG,
+ //PCI_REGISTER_READ,
+ //PCI_CAPBILITY_POINTER_OFFSET,
+ //0xffffff00,
+ //VALUE_NOCARE,
//
// The end of the list
@@ -181,7 +141,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED UINT64 IncompatiblePciDeviceListForRegister[] = {
//
// the incompatible PCI devices list for the access width of configuration registers
//
-GLOBAL_REMOVE_IF_UNREFERENCED UINT64 DeviceListForAccessWidth[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED UINT64 gDeviceListForAccessWidth[] = {
//
// DEVICE_INF_TAG,
// PCI_DEVICE_ID (VendorID, DeviceID, Revision, SubVendorId, SubDeviceId),
diff --git a/IntelFrameworkModulePkg/Library/PciIncompatibleDeviceSupportLib/PciIncompatibleDeviceSupportLib.c b/IntelFrameworkModulePkg/Library/PciIncompatibleDeviceSupportLib/PciIncompatibleDeviceSupportLib.c
index 61a936de12..4934d4e2c1 100644
--- a/IntelFrameworkModulePkg/Library/PciIncompatibleDeviceSupportLib/PciIncompatibleDeviceSupportLib.c
+++ b/IntelFrameworkModulePkg/Library/PciIncompatibleDeviceSupportLib/PciIncompatibleDeviceSupportLib.c
@@ -1,26 +1,32 @@
/** @file
- The implementation of PCI incompatible device support libary.
+ The template of PCI incompatible device support libary.
-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
-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.
+Copyright (c) 2006 - 2009, 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.
**/
#include "IncompatiblePciDeviceList.h"
+EFI_PCI_REGISTER_ACCESS_DATA mPciRegisterAccessData = {0, 0, 0};
+EFI_PCI_REGISTER_VALUE_DATA mPciRegisterValueData = {0, 0};
+
+
/**
- Check whether two PCI devices matched
+ Check whether two PCI devices matched.
- @param PciDeviceInfo A pointer to EFI_PCI_DEVICE_INFO.
- @param Header A pointer to EFI_PCI_DEVICE_INFO.
+ @param PciDeviceInfo A pointer to EFI_PCI_DEVICE_INFO.
+ @param Header A pointer to EFI_PCI_DEVICE_INFO.
+
+ @retval EFI_SUCCESS Two PCI devices matched.
+ @retval EFI_UNSUPPORTED Two PCI devices don't match.
- @retval returns EFI_SUCCESS if two PCI device matched.
**/
EFI_STATUS
DeviceCheck (
@@ -67,19 +73,22 @@ DeviceCheck (
/**
Check the incompatible device list for ACPI resource update and return
- the configuration
+ the configuration.
This function searches the incompatible device list according to request
information. If the PCI device belongs to the devices list, corresponding
configuration informtion will be returned, in the meantime return EFI_SUCCESS.
- @param PciDeviceInfo A pointer to PCI device information.
- @param Configuration Returned information.
+ @param PciDeviceInfo A pointer to PCI device information.
+ @param Configuration Returned information.
+
+ @retval EFI_SUCCESS If check incompatible device successfully.
+ @retval EFI_ABORTED No any resource type.
+ @retval EFI_OUT_OF_RESOURCES No memory available.
+ @retval EFI_UNSUPPORTED Invalid Tag encounted.
- @retval returns EFI_SUCCESS if check incompatible device ok.
- Otherwise return EFI_UNSUPPORTED.
**/
-RETURN_STATUS
+EFI_STATUS
EFIAPI
PciResourceUpdateCheck (
IN EFI_PCI_DEVICE_INFO *PciDeviceInfo,
@@ -103,7 +112,7 @@ PciResourceUpdateCheck (
//
* (VOID **) Configuration = NULL;
- ListPtr = IncompatiblePciDeviceListForResource;
+ ListPtr = gIncompatiblePciDeviceListForResource;
while (*ListPtr != LIST_END_TAG) {
Tag = *ListPtr;
@@ -136,7 +145,7 @@ PciResourceUpdateCheck (
AcpiPtr = AllocateZeroPool (
sizeof (EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR) * Index + sizeof (EFI_ACPI_END_TAG_DESCRIPTOR)
- );
+ );
if (AcpiPtr == NULL) {
return EFI_OUT_OF_RESOURCES;
}
@@ -204,10 +213,11 @@ PciResourceUpdateCheck (
@param Offset The address within the PCI configuration space.
@param Configuration Returned information.
- @retval returns EFI_SUCCESS if check incompatible device ok.
- Otherwise return EFI_UNSUPPORTED.
+ @retval EFI_SUCCESS If check incompatible device successfully.
+ @retval EFI_UNSUPPORTED Failed to check incompatibility device.
+
**/
-RETURN_STATUS
+EFI_STATUS
EFIAPI
PciRegisterUpdateCheck (
IN EFI_PCI_DEVICE_INFO *PciDeviceInfo,
@@ -224,7 +234,7 @@ PciRegisterUpdateCheck (
ASSERT (PciDeviceInfo != NULL);
- ListPtr = IncompatiblePciDeviceListForRegister;
+ ListPtr = gIncompatiblePciDeviceListForRegister;
//
// Initialize the return value to NULL
@@ -257,10 +267,8 @@ PciRegisterUpdateCheck (
if (((EFI_PCI_REGISTER_VALUE_DESCRIPTOR *)ListPtr)->AccessType == AccessType) {
Dsc = (EFI_PCI_REGISTER_VALUE_DATA *) (ListPtr + 2);
- RegisterPtr = AllocateZeroPool (sizeof (EFI_PCI_REGISTER_VALUE_DATA));
- if (RegisterPtr == NULL) {
- return EFI_SUCCESS;
- }
+
+ RegisterPtr = &mPciRegisterValueData;
RegisterPtr->AndValue = Dsc->AndValue;
RegisterPtr->OrValue = Dsc->OrValue;
@@ -304,10 +312,11 @@ PciRegisterUpdateCheck (
@param AccessWidth Access width needs to check incompatibility.
@param Configuration Returned information.
- @retval returns EFI_SUCCESS if check incompatible device ok.
- Otherwise return EFI_UNSUPPORTED.
+ @retval EFI_SUCCESS If check incompatible device successfully.
+ @retval EFI_UNSUPPORTED Failed to check incompatibility device.
+
**/
-RETURN_STATUS
+EFI_STATUS
EFIAPI
PciRegisterAccessCheck (
IN EFI_PCI_DEVICE_INFO *PciDeviceInfo,
@@ -325,7 +334,7 @@ PciRegisterAccessCheck (
ASSERT (PciDeviceInfo != NULL);
- ListPtr = DeviceListForAccessWidth;
+ ListPtr = gDeviceListForAccessWidth;
//
// Initialize the return value to NULL
@@ -361,10 +370,7 @@ PciRegisterAccessCheck (
if((Dsc->StartOffset <= Offset) && (Dsc->EndOffset > Offset)) {
- RegisterPtr = AllocateZeroPool (sizeof (EFI_PCI_REGISTER_ACCESS_DATA));
- if (RegisterPtr == NULL) {
- return EFI_OUT_OF_RESOURCES;
- }
+ RegisterPtr = &mPciRegisterAccessData;
RegisterPtr->StartOffset = Dsc->StartOffset;
RegisterPtr->EndOffset = Dsc->EndOffset;
diff --git a/IntelFrameworkModulePkg/Library/PciIncompatibleDeviceSupportLib/PciIncompatibleDeviceSupportLib.inf b/IntelFrameworkModulePkg/Library/PciIncompatibleDeviceSupportLib/PciIncompatibleDeviceSupportLib.inf
index b5f7cc6670..50b0c13f73 100644
--- a/IntelFrameworkModulePkg/Library/PciIncompatibleDeviceSupportLib/PciIncompatibleDeviceSupportLib.inf
+++ b/IntelFrameworkModulePkg/Library/PciIncompatibleDeviceSupportLib/PciIncompatibleDeviceSupportLib.inf
@@ -1,7 +1,7 @@
#/** @file
-# PCI Incompatible device support Library
+# PCI Incompatible device support Library template.
#
-# Check PCI incompatible devices and set necessary configuration
+# Check PCI incompatible devices and set necessary configuration.
# Copyright (c) 2007 - 2009, Intel Corporation.
#
# All rights reserved. This program and the accompanying materials