www.pudn.com > PlxSdk.rar > PciSupport.h


#ifndef __PCI_SUPPORT_H
#define __PCI_SUPPORT_H

/*******************************************************************************
 * Copyright (c) 2007 PLX Technology, Inc.
 *
 * PLX Technology Inc. licenses this software under specific terms and
 * conditions.  Use of any of the software or derviatives thereof in any
 * product without a PLX Technology chip is strictly prohibited.
 *
 * PLX Technology, Inc. provides this software AS IS, WITHOUT ANY WARRANTY,
 * EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTY OF
 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  PLX makes no guarantee
 * or representations regarding the use of, or the results of the use of,
 * the software and documentation in terms of correctness, accuracy,
 * reliability, currentness, or otherwise; and you rely on the software,
 * documentation and results solely at your own risk.
 *
 * IN NO EVENT SHALL PLX BE LIABLE FOR ANY LOSS OF USE, LOSS OF BUSINESS,
 * LOSS OF PROFITS, INDIRECT, INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES
 * OF ANY KIND.  IN NO EVENT SHALL PLX'S TOTAL LIABILITY EXCEED THE SUM
 * PAID TO PLX FOR THE PRODUCT LICENSED HEREUNDER.
 *
 ******************************************************************************/

/******************************************************************************
 *
 * File Name:
 *
 *      PciSupport.h
 *
 * Description:
 *
 *      The header file for PCI support functions
 *
 * Revision History:
 *
 *      02-01-07 : PLX SDK v5.00
 *
 ******************************************************************************/


#include 
#include "DriverDefs.h"




/**********************************************
 *               Definitions
 *********************************************/
#if !defined(PCI_ANY_ID)
    #define PCI_ANY_ID                      (~0)
#endif

// Macros for PCI register access
#define PLX_PCI_REG_READ(pdx, offset, pValue) \
    pci_read_config_dword(   \
        (pdx)->pPciDevice,   \
        (offset),            \
        (pValue)             \
        )

#define PLX_PCI_REG_WRITE(pdx, offset, value) \
    pci_write_config_dword(  \
        (pdx)->pPciDevice,   \
        (offset),            \
        (value)              \
        )

// Unsupported calls not needed for Linux - bus scan is allowed
#define PlxPciRegisterRead_Unsupported       PlxPciRegisterRead
#define PlxPciRegisterWrite_Unsupported      PlxPciRegisterWrite


// Memory access functions
#define PHYS_MEM_READ_8(addr)           ((U8)PlxPhysicalMemRead((addr) , sizeof(U8)))
#define PHYS_MEM_READ_16(addr)          ((U16)PlxPhysicalMemRead((addr), sizeof(U16)))
#define PHYS_MEM_READ_32(addr)          ((U32)PlxPhysicalMemRead((addr), sizeof(U32)))

#define PHYS_MEM_WRITE_8(addr , value)  PlxPhysicalMemWrite((addr), (value), sizeof(U8))
#define PHYS_MEM_WRITE_16(addr, value)  PlxPhysicalMemWrite((addr), (value), sizeof(U16))
#define PHYS_MEM_WRITE_32(addr, value)  PlxPhysicalMemWrite((addr), (value), sizeof(U32))


// Used to scan ROM for services
#define BIOS_MEM_START                  0x000E0000
#define BIOS_MEM_END                    0x000FFFF0

// ACPI probe states
#define ACPI_PCIE_NOT_PROBED            0
#define ACPI_PCIE_NOT_AVAILABLE         (-1)


// ACPI RSDT v1.0 structure
typedef struct _ACPI_RSDT_v1_0
{
    U32 Signature;
    U32 Length;
    U8  Revision;
    U8  Oem_Id[6];
    U8  Oem_Table_Id[8];
    U32 Oem_Revision;
    U32 Creator_Id;
    U32 Creator_Revision;
} ACPI_RSDT_v1_0;




/**********************************************
 *               Functions
 *********************************************/
RETURN_CODE
PlxPciRegisterRead(
    U8   bus,
    U8   slot,
    U8   function,
    U16  offset,
    U32 *pValue
    );

RETURN_CODE
PlxPciRegisterWrite(
    U8  bus,
    U8  slot,
    U8  function,
    U16 offset,
    U32 value
    );

RETURN_CODE
PlxPciExpressRegRead(
    U8   bus,
    U8   slot,
    U8   function,
    U16  offset,
    U32 *pValue
    );

RETURN_CODE
PlxPciExpressRegWrite(
    U8  bus,
    U8  slot,
    U8  function,
    U16 offset,
    U32 value
    );

VOID
PlxProbeForEcamBase(
    VOID
    );

U32
PlxPhysicalMemRead(
    U32 address,
    U8  size
    );

U32
PlxPhysicalMemWrite(
    U32 address,
    U32 value,
    U8  size
    );




#endif