pcie_ck804_boot.c revision d12abe7ce2663ac39e686a14960eb4febf560195
/*
* 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
*/
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Library file that has code for PCIe booting
*/
#include <sys/pci_cfgspace.h>
/*
* PCI Configuration (ck804, PCIe) related library functions
*/
/* Globals */
extern int pci_boot_debug;
{
*slot_number = 0;
if (!(status & PCI_STAT_CAP))
return (B_FALSE);
"pcix-capid-pointer", capsp);
"pci-msi-capid-pointer", capsp);
}
"pci-msix-capid-pointer", capsp);
}
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_PCIE2PCI) ==
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_number =
if (cdip)
(void) ndi_prop_update_int(
"pcie-slotcap-reg", slot_cap);
/* Is PCI Express HotPlug capability set? */
if (cdip &&
(slot_cap & PCIE_SLOTCAP_HP_CAPABLE)) {
(void) ndi_prop_update_int(
"pci-hotplug-type",
}
}
/*
* Can only do I/O based config space access at
* this early stage. Meaning, one cannot access
* extended config space i.e. > 256 bytes.
* So, AER cap_id property will be created much later.
*/
if (cdip) {
"pcie-capid-reg",
capsp + PCIE_PCIECAP));
"pcie-capid-pointer", capsp);
}
}
"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
*/
static boolean_t
{
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");
return (B_TRUE);
}
/*
* Only for Nvidia's CrushK 8-04 chipsets:
* To enable hotplug; we need to map in two I/O BARs
* from ISA bridge's config space
*/
void
{
/* System Control BAR i/o space */
/* Analog BAR i/o space */
"assigned-addresses",
}