/*
* 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/pci_impl.h>
#include <sys/pci_cfgspace.h>
#include <sys/pci_cfgspace_impl.h>
#include <sys/bootconf.h>
/*
* pci irq routing information table
*/
int pci_irq_nroutes;
static int pci_bios_get_irq_routing(pci_irq_route_t *, int, int *);
static void pci_get_irq_routing_table(void);
/*
* Retrieve information from the bios needed for system
* configuration early during startup.
*/
void
startup_pci_bios(void)
{
}
/*
* Issue the bios get irq routing information table interrupt
*
* Despite the name, the information in the table is only
* used to derive slot names for some named pci hot-plug slots.
*
* Returns the number of irq routing table entries returned
* by the bios, or 0 and optionally, the number of entries required.
*/
static int
{
int i, n;
int rval = 0;
if (nneededp)
*nneededp = 0;
/*
* Set up irq routing header with the size and address
* of some useable low-memory data addresses. Initalize
*/
n = nroutes * sizeof (pci_irq_route_t);
for (i = 0; i < n; i++)
bufp[i] = 0;
sizeof (pci_irq_route_t));
if (nneededp)
*nneededp = n;
} else {
/*
* Copy resulting irq routing data from low memory up to
* the kernel address space, avoiding memcpy as usual.
*/
if (n <= nroutes) {
for (i = 0; i < n * sizeof (pci_irq_route_t); i++)
rval = n;
}
}
return (rval);
}
static void
{
int n = N_PCI_IRQ_ROUTES;
int nneeded = 0;
int nroutes;
/*
* Get irq routing table information.
* Allocate a buffer for an initial default number of entries.
* If the bios indicates it needs a larger buffer, try it again.
* Drive on if it still won't cooperate and play nice after that.
*/
if (nneeded > N_PCI_IRQ_ROUTES_MAX) {
"pci: unable to get IRQ routing information, "
"required buffer space of %d entries exceeds max\n",
nneeded);
return;
}
n = nneeded;
if (nroutes == 0) {
"pci: unable to get IRQ routing information, "
"required buffer space for %d entries\n", n);
}
}
if (nroutes > 0) {
}
}
/*
* Use the results of the PCI BIOS call that returned the routing tables
* to build the 1275 slot-names property for the indicated bus.
* Results are returned in buf. Length is return value, -1 is returned on
* overflow and zero is returned if no data exists to build a property.
*/
int
{
if (pci_irq_nroutes == 0)
return (0);
nnames = 0;
mask = 0;
for (i = 0; i < pci_irq_nroutes; i++)
slot[i] = 0xff;
for (i = 0; i < pci_irq_nroutes; i++) {
continue;
if (pci_irq_routes[i].pir_slot != 0) {
nnames++;
}
}
if (nnames == 0)
return (0);
return (-1);
plen = 4;
for (i = 0; i < pci_irq_nroutes; i++) {
if (slot[i] == 0xff)
continue;
}
return (plen);
}