/*
* 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
*/
/*
*/
/*
* Library file that has code for PCIe booting
*/
#include <sys/pcie_impl.h>
#include <sys/pci_cfgspace.h>
/*
* PCI Configuration (Nvidia chipsets, PCIe) related library functions
*/
/* Globals */
extern int pci_boot_debug;
extern uint64_t mcfg_mem_base;
{
*slot_valid = B_FALSE;
if (!(status & PCI_STAT_CAP))
return (B_FALSE);
if (cap == PCI_CAP_ID_PCI_E) {
#ifdef DEBUG
if (pci_boot_debug)
#endif /* DEBUG */
/*
* See section 7.8.2 of PCI-Express Base Spec v1.0a
* PCIE_PCIECAP_DEV_TYPE_PCIE2PCI implies that the
* device is a PCIe2PCI bridge
*/
((status & PCIE_PCIECAP_DEV_TYPE_MASK) ==
PCIE_PCIECAP_DEV_TYPE_PCIE2PCI) ? 1 : 0;
/*
* Check for "Slot Implemented" bit
* PCIE_PCIECAP_SLOT_IMPL implies that.
*/
if (status & PCIE_PCIECAP_SLOT_IMPL) {
/* offset 14h is Slot Cap Register */
capsp + PCIE_SLOTCAP);
*slot_valid = B_TRUE;
*slot_number =
/* Is PCI Express HotPlug capability set? */
if (cdip &&
(slot_cap & PCIE_SLOTCAP_HP_CAPABLE)) {
(void) ndi_prop_update_int(
"pci-hotplug-type",
}
}
}
"pci-hotplug-type", INBAND_HPC_SHPC);
}
}
return (found_pciex);
}
/*
* scan all buses, devices, functions to look for any
* PCI-Express device in the system.
* If found, return B_TRUE else B_FALSE
*/
{
nfunc = 1;
#ifdef DEBUG
if (pci_boot_debug)
#endif /* DEBUG */
/* no function at this address */
continue;
if (header == 0xff)
continue; /* illegal value */
/*
* according to some mail from Microsoft posted to
* the pci-drivers alias, their only requirement for
* a multifunction device is for the 1st function to
* have to PCI_HEADER_MULTI bit set.
*/
nfunc = 8;
return (B_TRUE);
} /* end of func */
} /* end of dev */
return (B_FALSE);
}
{
/*
* Currently this is being hard-coded.
* We need to figure out if the root bus does indeed
* have PCI-Ex in the path by looking for MCFG in
* the ACPI tables
*/
return (B_FALSE);
#ifdef DEBUG
if (pci_boot_debug)
#endif /* DEBUG */
"device_type", "pciex");
"compatible", "pciex_root_complex");
/* save base addr in bus_t for pci_cfgacc_xxx() */
return (B_TRUE);
}
/*
* add_nvidia_isa_bridge_props():
* To enable native hotplug; we need to map in two I/O BARs
* from ISA bridge's config space
*
* NOTE: For now, this function is only used for Nvidia's CrushK 8-04 chipsets.
*/
void
{
/* System Control BAR i/o space */
/* Analog BAR i/o space */
"assigned-addresses",
}