/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
#include <sys/autoconf.h>
#include <sys/sysmacros.h>
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Generic PCI Capabilites Interface for all pci platforms
*/
#ifdef DEBUG
#endif
/* Cap Base Macro */
/*
* pci_cap_probe: returns the capid and base based upon a given index
*/
int
{
int i, search_ext = 0;
return (DDI_FAILURE);
/* PCIE and PCIX Version 2 contain Extended Config Space */
+ PCI_CAP_NEXT_PTR), i++) {
break;
if (id == PCI_CAP_ID_PCI_E)
search_ext = 1;
else if (id == PCI_CAP_ID_PCIX) {
continue;
search_ext = 1;
}
}
goto found;
}
if (!search_ext)
return (DDI_FAILURE);
break;
}
return (DDI_FAILURE);
return (DDI_FAILURE);
PCI_CAP_DBG("pci_cap_probe: index=%x, id=%x, base=%x\n",
return (DDI_SUCCESS);
}
/*
* pci_lcap_locate: Helper function locates a base in conventional config space.
*/
int
{
return (DDI_FAILURE);
switch (header & PCI_HEADER_TYPE_M) {
case PCI_HEADER_ZERO:
break;
case PCI_HEADER_PPB:
break;
case PCI_HEADER_CARDBUS:
break;
default:
return (DDI_FAILURE);
}
return (DDI_SUCCESS);
}
}
return (DDI_FAILURE);
}
/*
* pci_xcap_locate: Helper function locates a base in extended config space.
*/
int
{
return (DDI_FAILURE);
break;
if (((xcaps_hdr >> PCIE_EXT_CAP_ID_SHIFT) &
PCIE_EXT_CAP_ID_MASK) == id) {
return (DDI_SUCCESS);
}
}
return (DDI_FAILURE);
}
/*
* There can be multiple pci caps with a Hypertransport technology cap ID
* Each is distiguished by a type register in the upper half of the cap
* header (the "command" register part).
*
* This returns the location of a hypertransport capability whose upper
* 16-bits of the cap header matches <reg_val> after masking the value
* with <reg_mask>; if both <reg_mask> and <reg_val> are 0, it will return
* the first HT cap found
*/
int
{
return (DDI_FAILURE);
switch (header & PCI_HEADER_TYPE_M) {
case PCI_HEADER_ZERO:
break;
case PCI_HEADER_PPB:
break;
default:
return (DDI_FAILURE);
}
return (DDI_SUCCESS);
}
}
return (DDI_FAILURE);
}
/*
* pci_cap_get: This function uses the base or capid to get a byte, word,
* or dword. If access by capid is requested, the function uses the capid to
* locate the base. Access by a base results in better performance
* because no cap list traversal is required.
*/
{
return (PCI_CAP_EINVAL32);
/*
* Each access to a PCI Configuration Space should be checked
* by the calling function. A returned value of the 2's complement
* of -1 indicates that either the device is offlined or it does not
* exist.
*/
switch (size) {
case PCI_CAP_CFGSZ_8:
break;
case PCI_CAP_CFGSZ_16:
break;
case PCI_CAP_CFGSZ_32:
break;
default:
}
return (data);
}
/*
* pci_cap_put: This function uses the caps ptr or capid to put a byte, word,
* or dword. If access by capid is requested, the function uses the capid to
* locate the base. Access by base results in better performance
* because no cap list traversal is required.
*/
int
{
/*
* use the pci_config_size_t to switch for the appropriate read
*/
return (DDI_FAILURE);
switch (size) {
case PCI_CAP_CFGSZ_8:
break;
case PCI_CAP_CFGSZ_16:
break;
case PCI_CAP_CFGSZ_32:
break;
default:
return (DDI_FAILURE);
}
return (DDI_SUCCESS);
}
/*
* Cache the entire Cap Structure. The caller is required to allocate and free
* buffer.
*/
int
{
int i;
return (DDI_FAILURE);
return (DDI_FAILURE);
}
return (DDI_SUCCESS);
}