xref: /onnv-gate/usr/src/uts/sun4u/os/mach_ddi_impl.c (revision 11596:e9010337bcd3)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
51991Sheppo  * Common Development and Distribution License (the "License").
61991Sheppo  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
211991Sheppo 
220Sstevel@tonic-gate /*
23*11596SJason.Beloro@Sun.COM  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
240Sstevel@tonic-gate  * Use is subject to license terms.
250Sstevel@tonic-gate  */
260Sstevel@tonic-gate 
270Sstevel@tonic-gate /*
280Sstevel@tonic-gate  * sun4u specific DDI implementation
290Sstevel@tonic-gate  */
300Sstevel@tonic-gate #include <sys/bootconf.h>
310Sstevel@tonic-gate #include <sys/conf.h>
320Sstevel@tonic-gate #include <sys/ddi_subrdefs.h>
330Sstevel@tonic-gate #include <sys/ethernet.h>
340Sstevel@tonic-gate #include <sys/idprom.h>
350Sstevel@tonic-gate #include <sys/machsystm.h>
360Sstevel@tonic-gate #include <sys/promif.h>
370Sstevel@tonic-gate #include <sys/prom_plat.h>
380Sstevel@tonic-gate #include <sys/sunndi.h>
390Sstevel@tonic-gate #include <sys/systeminfo.h>
400Sstevel@tonic-gate #include <sys/fpu/fpusystm.h>
410Sstevel@tonic-gate #include <sys/vm.h>
420Sstevel@tonic-gate #include <sys/fs/dv_node.h>
430Sstevel@tonic-gate #include <sys/fs/snode.h>
440Sstevel@tonic-gate 
450Sstevel@tonic-gate /*
460Sstevel@tonic-gate  * Favored drivers of this implementation
470Sstevel@tonic-gate  * architecture.  These drivers MUST be present for
480Sstevel@tonic-gate  * the system to boot at all.
490Sstevel@tonic-gate  */
500Sstevel@tonic-gate char *impl_module_list[] = {
510Sstevel@tonic-gate 	"rootnex",
520Sstevel@tonic-gate 	"options",
530Sstevel@tonic-gate 	"sad",		/* Referenced via init_tbl[] */
540Sstevel@tonic-gate 	"pseudo",
550Sstevel@tonic-gate 	"clone",
560Sstevel@tonic-gate 	"scsi_vhci",
570Sstevel@tonic-gate 	(char *)0
580Sstevel@tonic-gate };
590Sstevel@tonic-gate 
600Sstevel@tonic-gate /*
610Sstevel@tonic-gate  * These strings passed to not_serviced in locore.s
620Sstevel@tonic-gate  */
630Sstevel@tonic-gate const char busname_ovec[] = "onboard ";
640Sstevel@tonic-gate const char busname_svec[] = "SBus ";
650Sstevel@tonic-gate const char busname_vec[] = "";
660Sstevel@tonic-gate 
670Sstevel@tonic-gate 
680Sstevel@tonic-gate static uint64_t *intr_map_reg[32];
690Sstevel@tonic-gate 
700Sstevel@tonic-gate /*
710Sstevel@tonic-gate  * Forward declarations
720Sstevel@tonic-gate  */
730Sstevel@tonic-gate static int getlongprop_buf();
740Sstevel@tonic-gate static int get_boardnum(int nid, dev_info_t *par);
750Sstevel@tonic-gate 
760Sstevel@tonic-gate /*
770Sstevel@tonic-gate  * Check the status of the device node passed as an argument.
780Sstevel@tonic-gate  *
790Sstevel@tonic-gate  *	if ((status is OKAY) || (status is DISABLED))
800Sstevel@tonic-gate  *		return DDI_SUCCESS
810Sstevel@tonic-gate  *	else
820Sstevel@tonic-gate  *		print a warning and return DDI_FAILURE
830Sstevel@tonic-gate  */
840Sstevel@tonic-gate /*ARGSUSED*/
850Sstevel@tonic-gate int
check_status(int id,char * buf,dev_info_t * parent)860Sstevel@tonic-gate check_status(int id, char *buf, dev_info_t *parent)
870Sstevel@tonic-gate {
880Sstevel@tonic-gate 	char status_buf[64];
890Sstevel@tonic-gate 	char devtype_buf[OBP_MAXPROPNAME];
900Sstevel@tonic-gate 	char board_buf[32];
910Sstevel@tonic-gate 	char path[OBP_MAXPATHLEN];
920Sstevel@tonic-gate 	int boardnum;
930Sstevel@tonic-gate 	int retval = DDI_FAILURE;
940Sstevel@tonic-gate 	extern int status_okay(int, char *, int);
950Sstevel@tonic-gate 
960Sstevel@tonic-gate 	/*
970Sstevel@tonic-gate 	 * is the status okay?
980Sstevel@tonic-gate 	 */
990Sstevel@tonic-gate 	if (status_okay(id, status_buf, sizeof (status_buf)))
1000Sstevel@tonic-gate 		return (DDI_SUCCESS);
1010Sstevel@tonic-gate 
1020Sstevel@tonic-gate 	/*
1030Sstevel@tonic-gate 	 * a status property indicating bad memory will be associated
1040Sstevel@tonic-gate 	 * with a node which has a "device_type" property with a value of
1050Sstevel@tonic-gate 	 * "memory-controller". in this situation, return DDI_SUCCESS
1060Sstevel@tonic-gate 	 */
1070Sstevel@tonic-gate 	if (getlongprop_buf(id, OBP_DEVICETYPE, devtype_buf,
1080Sstevel@tonic-gate 	    sizeof (devtype_buf)) > 0) {
1090Sstevel@tonic-gate 		if (strcmp(devtype_buf, "memory-controller") == 0)
1100Sstevel@tonic-gate 			retval = DDI_SUCCESS;
1110Sstevel@tonic-gate 	}
1120Sstevel@tonic-gate 
1130Sstevel@tonic-gate 	/*
1140Sstevel@tonic-gate 	 * get the full OBP pathname of this node
1150Sstevel@tonic-gate 	 */
1160Sstevel@tonic-gate 	if (prom_phandle_to_path((phandle_t)id, path, sizeof (path)) < 0)
1170Sstevel@tonic-gate 		cmn_err(CE_WARN, "prom_phandle_to_path(%d) failed", id);
1180Sstevel@tonic-gate 
1190Sstevel@tonic-gate 	/*
1200Sstevel@tonic-gate 	 * get the board number, if one exists
1210Sstevel@tonic-gate 	 */
1220Sstevel@tonic-gate 	if ((boardnum = get_boardnum(id, parent)) >= 0)
1230Sstevel@tonic-gate 		(void) sprintf(board_buf, " on board %d", boardnum);
1240Sstevel@tonic-gate 	else
1250Sstevel@tonic-gate 		board_buf[0] = '\0';
1260Sstevel@tonic-gate 
1270Sstevel@tonic-gate 	/*
1280Sstevel@tonic-gate 	 * print the status property information
1290Sstevel@tonic-gate 	 */
1300Sstevel@tonic-gate 	cmn_err(CE_WARN, "status '%s' for '%s'%s",
131*11596SJason.Beloro@Sun.COM 	    status_buf, path, board_buf);
1320Sstevel@tonic-gate 	return (retval);
1330Sstevel@tonic-gate }
1340Sstevel@tonic-gate 
1350Sstevel@tonic-gate /*
1360Sstevel@tonic-gate  * determine the board number associated with this nodeid
1370Sstevel@tonic-gate  */
1380Sstevel@tonic-gate static int
get_boardnum(int nid,dev_info_t * par)1390Sstevel@tonic-gate get_boardnum(int nid, dev_info_t *par)
1400Sstevel@tonic-gate {
1410Sstevel@tonic-gate 	int board_num;
1420Sstevel@tonic-gate 
143789Sahrens 	if (prom_getprop((pnode_t)nid, OBP_BOARDNUM,
1440Sstevel@tonic-gate 	    (caddr_t)&board_num) != -1)
1450Sstevel@tonic-gate 		return (board_num);
1460Sstevel@tonic-gate 
1470Sstevel@tonic-gate 	/*
1480Sstevel@tonic-gate 	 * Look at current node and up the parent chain
1490Sstevel@tonic-gate 	 * till we find a node with an OBP_BOARDNUM.
1500Sstevel@tonic-gate 	 */
1510Sstevel@tonic-gate 	while (par) {
1520Sstevel@tonic-gate 		nid = ddi_get_nodeid(par);
1530Sstevel@tonic-gate 
154789Sahrens 		if (prom_getprop((pnode_t)nid, OBP_BOARDNUM,
1550Sstevel@tonic-gate 		    (caddr_t)&board_num) != -1)
1560Sstevel@tonic-gate 			return (board_num);
1570Sstevel@tonic-gate 
1580Sstevel@tonic-gate 		par = ddi_get_parent(par);
1590Sstevel@tonic-gate 	}
1600Sstevel@tonic-gate 	return (-1);
1610Sstevel@tonic-gate }
1620Sstevel@tonic-gate 
1630Sstevel@tonic-gate /*
1640Sstevel@tonic-gate  * Note that this routine does not take into account the endianness
1650Sstevel@tonic-gate  * of the host or the device (or PROM) when retrieving properties.
1660Sstevel@tonic-gate  */
1670Sstevel@tonic-gate static int
getlongprop_buf(int id,char * name,char * buf,int maxlen)1680Sstevel@tonic-gate getlongprop_buf(int id, char *name, char *buf, int maxlen)
1690Sstevel@tonic-gate {
1700Sstevel@tonic-gate 	int size;
1710Sstevel@tonic-gate 
172789Sahrens 	size = prom_getproplen((pnode_t)id, name);
1730Sstevel@tonic-gate 	if (size <= 0 || (size > maxlen - 1))
1740Sstevel@tonic-gate 		return (-1);
1750Sstevel@tonic-gate 
176789Sahrens 	if (-1 == prom_getprop((pnode_t)id, name, buf))
1770Sstevel@tonic-gate 		return (-1);
1780Sstevel@tonic-gate 
1790Sstevel@tonic-gate 	/*
1800Sstevel@tonic-gate 	 * Workaround for bugid 1085575 - OBP may return a "name" property
1810Sstevel@tonic-gate 	 * without null terminating the string with '\0'.  When this occurs,
1820Sstevel@tonic-gate 	 * append a '\0' and return (size + 1).
1830Sstevel@tonic-gate 	 */
1840Sstevel@tonic-gate 	if (strcmp("name", name) == 0) {
1850Sstevel@tonic-gate 		if (buf[size - 1] != '\0') {
1860Sstevel@tonic-gate 			buf[size] = '\0';
1870Sstevel@tonic-gate 			size += 1;
1880Sstevel@tonic-gate 		}
1890Sstevel@tonic-gate 	}
1900Sstevel@tonic-gate 
1910Sstevel@tonic-gate 	return (size);
1920Sstevel@tonic-gate }
1930Sstevel@tonic-gate 
1940Sstevel@tonic-gate /*
1950Sstevel@tonic-gate  * Routines to set/get UPA slave only device interrupt mapping registers.
1960Sstevel@tonic-gate  * set_intr_mapping_reg() is called by the UPA master to register the address
1970Sstevel@tonic-gate  * of an interrupt mapping register. The upa id is that of the master. If
1980Sstevel@tonic-gate  * this routine is called on behalf of a slave device, the framework
1990Sstevel@tonic-gate  * determines the upa id of the slave based on that supplied by the master.
2000Sstevel@tonic-gate  *
2010Sstevel@tonic-gate  * get_intr_mapping_reg() is called by the UPA nexus driver on behalf
2020Sstevel@tonic-gate  * of a child device to get and program the interrupt mapping register of
2030Sstevel@tonic-gate  * one of it's child nodes.  It uses the upa id of the child device to
2040Sstevel@tonic-gate  * index into a table of mapping registers.  If the routine is called on
2050Sstevel@tonic-gate  * behalf of a slave device and the mapping register has not been set,
2060Sstevel@tonic-gate  * the framework determines the devinfo node of the corresponding master
2070Sstevel@tonic-gate  * nexus which owns the mapping register of the slave and installs that
2080Sstevel@tonic-gate  * driver.  The device driver which owns the mapping register must call
2090Sstevel@tonic-gate  * set_intr_mapping_reg() in its attach routine to register the slaves
2100Sstevel@tonic-gate  * mapping register with the system.
2110Sstevel@tonic-gate  */
2120Sstevel@tonic-gate void
set_intr_mapping_reg(int upaid,uint64_t * addr,int slave)2130Sstevel@tonic-gate set_intr_mapping_reg(int upaid, uint64_t *addr, int slave)
2140Sstevel@tonic-gate {
2150Sstevel@tonic-gate 	int affin_upaid;
2160Sstevel@tonic-gate 
2170Sstevel@tonic-gate 	/* For UPA master devices, set the mapping reg addr and we're done */
2180Sstevel@tonic-gate 	if (slave == 0) {
2190Sstevel@tonic-gate 		intr_map_reg[upaid] = addr;
2200Sstevel@tonic-gate 		return;
2210Sstevel@tonic-gate 	}
2220Sstevel@tonic-gate 
2230Sstevel@tonic-gate 	/*
2240Sstevel@tonic-gate 	 * If we get here, we're adding an entry for a UPA slave only device.
2250Sstevel@tonic-gate 	 * The UPA id of the device which has affinity with that requesting,
2260Sstevel@tonic-gate 	 * will be the device with the same UPA id minus the slave number.
2270Sstevel@tonic-gate 	 * If the affin_upaid is negative, silently return to the caller.
2280Sstevel@tonic-gate 	 */
2290Sstevel@tonic-gate 	if ((affin_upaid = upaid - slave) < 0)
2300Sstevel@tonic-gate 		return;
2310Sstevel@tonic-gate 
2320Sstevel@tonic-gate 	/*
2330Sstevel@tonic-gate 	 * Load the address of the mapping register in the correct slot
2340Sstevel@tonic-gate 	 * for the slave device.
2350Sstevel@tonic-gate 	 */
2360Sstevel@tonic-gate 	intr_map_reg[affin_upaid] = addr;
2370Sstevel@tonic-gate }
2380Sstevel@tonic-gate 
2390Sstevel@tonic-gate uint64_t *
get_intr_mapping_reg(int upaid,int slave)2400Sstevel@tonic-gate get_intr_mapping_reg(int upaid, int slave)
2410Sstevel@tonic-gate {
2420Sstevel@tonic-gate 	int affin_upaid;
2430Sstevel@tonic-gate 	dev_info_t *affin_dip;
2440Sstevel@tonic-gate 	uint64_t *addr = intr_map_reg[upaid];
2450Sstevel@tonic-gate 
2460Sstevel@tonic-gate 	/* If we're a UPA master, or we have a valid mapping register. */
2470Sstevel@tonic-gate 	if (!slave || addr != NULL)
2480Sstevel@tonic-gate 		return (addr);
2490Sstevel@tonic-gate 
2500Sstevel@tonic-gate 	/*
2510Sstevel@tonic-gate 	 * We only get here if we're a UPA slave only device whose interrupt
2520Sstevel@tonic-gate 	 * mapping register has not been set.
2530Sstevel@tonic-gate 	 * We need to try and install the nexus whose physical address
2540Sstevel@tonic-gate 	 * space is where the slaves mapping register resides.  They
2550Sstevel@tonic-gate 	 * should call set_intr_mapping_reg() in their xxattach() to register
2560Sstevel@tonic-gate 	 * the mapping register with the system.
2570Sstevel@tonic-gate 	 */
2580Sstevel@tonic-gate 
2590Sstevel@tonic-gate 	/*
2600Sstevel@tonic-gate 	 * We don't know if a single- or multi-interrupt proxy is fielding
2610Sstevel@tonic-gate 	 * our UPA slave interrupt, we must check both cases.
2620Sstevel@tonic-gate 	 * Start out by assuming the multi-interrupt case.
2630Sstevel@tonic-gate 	 * We assume that single- and multi- interrupters are not
2640Sstevel@tonic-gate 	 * overlapping in UPA portid space.
2650Sstevel@tonic-gate 	 */
2660Sstevel@tonic-gate 
2670Sstevel@tonic-gate 	affin_upaid = upaid | 3;
2680Sstevel@tonic-gate 
2690Sstevel@tonic-gate 	/*
2700Sstevel@tonic-gate 	 * We start looking for the multi-interrupter affinity node.
2710Sstevel@tonic-gate 	 * We know it's ONLY a child of the root node since the root
2720Sstevel@tonic-gate 	 * node defines UPA space.
2730Sstevel@tonic-gate 	 */
2740Sstevel@tonic-gate 	for (affin_dip = ddi_get_child(ddi_root_node()); affin_dip;
2750Sstevel@tonic-gate 	    affin_dip = ddi_get_next_sibling(affin_dip))
2760Sstevel@tonic-gate 		if (ddi_prop_get_int(DDI_DEV_T_ANY, affin_dip,
2770Sstevel@tonic-gate 		    DDI_PROP_DONTPASS, "upa-portid", -1) == affin_upaid)
2780Sstevel@tonic-gate 			break;
2790Sstevel@tonic-gate 
2800Sstevel@tonic-gate 	if (affin_dip) {
2810Sstevel@tonic-gate 		if (i_ddi_attach_node_hierarchy(affin_dip) == DDI_SUCCESS) {
2820Sstevel@tonic-gate 			/* try again to get the mapping register. */
2830Sstevel@tonic-gate 			addr = intr_map_reg[upaid];
2840Sstevel@tonic-gate 		}
2850Sstevel@tonic-gate 	}
2860Sstevel@tonic-gate 
2870Sstevel@tonic-gate 	/*
2880Sstevel@tonic-gate 	 * If we still don't have a mapping register try single -interrupter
2890Sstevel@tonic-gate 	 * case.
2900Sstevel@tonic-gate 	 */
2910Sstevel@tonic-gate 	if (addr == NULL) {
2920Sstevel@tonic-gate 
2930Sstevel@tonic-gate 		affin_upaid = upaid | 1;
2940Sstevel@tonic-gate 
2950Sstevel@tonic-gate 		for (affin_dip = ddi_get_child(ddi_root_node()); affin_dip;
2960Sstevel@tonic-gate 		    affin_dip = ddi_get_next_sibling(affin_dip))
2970Sstevel@tonic-gate 			if (ddi_prop_get_int(DDI_DEV_T_ANY, affin_dip,
2980Sstevel@tonic-gate 			    DDI_PROP_DONTPASS, "upa-portid", -1) == affin_upaid)
2990Sstevel@tonic-gate 				break;
3000Sstevel@tonic-gate 
3010Sstevel@tonic-gate 		if (affin_dip) {
3020Sstevel@tonic-gate 			if (i_ddi_attach_node_hierarchy(affin_dip)
3030Sstevel@tonic-gate 			    == DDI_SUCCESS) {
3040Sstevel@tonic-gate 				/* try again to get the mapping register. */
3050Sstevel@tonic-gate 				addr = intr_map_reg[upaid];
3060Sstevel@tonic-gate 			}
3070Sstevel@tonic-gate 		}
3080Sstevel@tonic-gate 	}
3090Sstevel@tonic-gate 	return (addr);
3100Sstevel@tonic-gate }
3110Sstevel@tonic-gate 
3120Sstevel@tonic-gate 
3130Sstevel@tonic-gate static struct upa_dma_pfns {
3140Sstevel@tonic-gate 	pfn_t hipfn;
3150Sstevel@tonic-gate 	pfn_t lopfn;
3160Sstevel@tonic-gate } upa_dma_pfn_array[MAX_UPA];
3170Sstevel@tonic-gate 
3180Sstevel@tonic-gate static int upa_dma_pfn_ndx = 0;
3190Sstevel@tonic-gate 
3200Sstevel@tonic-gate /*
3210Sstevel@tonic-gate  * Certain UPA busses cannot accept dma transactions from any other source
3220Sstevel@tonic-gate  * except for memory due to livelock conditions in their hardware. (e.g. sbus
3230Sstevel@tonic-gate  * and PCI). These routines allow devices or busses on the UPA to register
3240Sstevel@tonic-gate  * a physical address block within it's own register space where DMA can be
3250Sstevel@tonic-gate  * performed.  Currently, the FFB is the only such device which supports
3260Sstevel@tonic-gate  * device DMA on the UPA.
3270Sstevel@tonic-gate  */
3280Sstevel@tonic-gate void
pf_set_dmacapable(pfn_t hipfn,pfn_t lopfn)3290Sstevel@tonic-gate pf_set_dmacapable(pfn_t hipfn, pfn_t lopfn)
3300Sstevel@tonic-gate {
3310Sstevel@tonic-gate 	int i = upa_dma_pfn_ndx;
3320Sstevel@tonic-gate 
3330Sstevel@tonic-gate 	upa_dma_pfn_ndx++;
3340Sstevel@tonic-gate 
3350Sstevel@tonic-gate 	upa_dma_pfn_array[i].hipfn = hipfn;
3360Sstevel@tonic-gate 	upa_dma_pfn_array[i].lopfn = lopfn;
3370Sstevel@tonic-gate }
3380Sstevel@tonic-gate 
3390Sstevel@tonic-gate void
pf_unset_dmacapable(pfn_t pfn)3400Sstevel@tonic-gate pf_unset_dmacapable(pfn_t pfn)
3410Sstevel@tonic-gate {
3420Sstevel@tonic-gate 	int i;
3430Sstevel@tonic-gate 
3440Sstevel@tonic-gate 	for (i = 0; i < upa_dma_pfn_ndx; i++) {
3450Sstevel@tonic-gate 		if (pfn <= upa_dma_pfn_array[i].hipfn &&
3460Sstevel@tonic-gate 		    pfn >= upa_dma_pfn_array[i].lopfn) {
3470Sstevel@tonic-gate 			upa_dma_pfn_array[i].hipfn =
3480Sstevel@tonic-gate 			    upa_dma_pfn_array[upa_dma_pfn_ndx - 1].hipfn;
3490Sstevel@tonic-gate 			upa_dma_pfn_array[i].lopfn =
3500Sstevel@tonic-gate 			    upa_dma_pfn_array[upa_dma_pfn_ndx - 1].lopfn;
3510Sstevel@tonic-gate 			upa_dma_pfn_ndx--;
3520Sstevel@tonic-gate 			break;
3530Sstevel@tonic-gate 		}
3540Sstevel@tonic-gate 	}
3550Sstevel@tonic-gate }
3560Sstevel@tonic-gate 
3570Sstevel@tonic-gate /*
3580Sstevel@tonic-gate  * This routine should only be called using a pfn that is known to reside
3590Sstevel@tonic-gate  * in IO space.  The function pf_is_memory() can be used to determine this.
3600Sstevel@tonic-gate  */
3610Sstevel@tonic-gate int
pf_is_dmacapable(pfn_t pfn)3620Sstevel@tonic-gate pf_is_dmacapable(pfn_t pfn)
3630Sstevel@tonic-gate {
3640Sstevel@tonic-gate 	int i, j;
3650Sstevel@tonic-gate 
3660Sstevel@tonic-gate 	/* If the caller passed in a memory pfn, return true. */
3670Sstevel@tonic-gate 	if (pf_is_memory(pfn))
3680Sstevel@tonic-gate 		return (1);
3690Sstevel@tonic-gate 
3700Sstevel@tonic-gate 	for (i = upa_dma_pfn_ndx, j = 0; j < i; j++)
3710Sstevel@tonic-gate 		if (pfn <= upa_dma_pfn_array[j].hipfn &&
3720Sstevel@tonic-gate 		    pfn >= upa_dma_pfn_array[j].lopfn)
3730Sstevel@tonic-gate 			return (1);
3740Sstevel@tonic-gate 
3750Sstevel@tonic-gate 	return (0);
3760Sstevel@tonic-gate }
3770Sstevel@tonic-gate 
3780Sstevel@tonic-gate 
3790Sstevel@tonic-gate /*
3800Sstevel@tonic-gate  * Find cpu_id corresponding to the dip of a CPU device node
3810Sstevel@tonic-gate  */
3820Sstevel@tonic-gate int
dip_to_cpu_id(dev_info_t * dip,processorid_t * cpu_id)3830Sstevel@tonic-gate dip_to_cpu_id(dev_info_t *dip, processorid_t *cpu_id)
3840Sstevel@tonic-gate {
385789Sahrens 	pnode_t		nodeid;
3860Sstevel@tonic-gate 	int		i;
3870Sstevel@tonic-gate 
388789Sahrens 	nodeid = (pnode_t)ddi_get_nodeid(dip);
3890Sstevel@tonic-gate 	for (i = 0; i < NCPU; i++) {
3900Sstevel@tonic-gate 		if (cpunodes[i].nodeid == nodeid) {
3910Sstevel@tonic-gate 			*cpu_id = i;
3920Sstevel@tonic-gate 			return (DDI_SUCCESS);
3930Sstevel@tonic-gate 		}
3940Sstevel@tonic-gate 	}
3950Sstevel@tonic-gate 	return (DDI_FAILURE);
3960Sstevel@tonic-gate }
397*11596SJason.Beloro@Sun.COM 
398*11596SJason.Beloro@Sun.COM /* ARGSUSED */
399*11596SJason.Beloro@Sun.COM void
translate_devid(dev_info_t * dip)400*11596SJason.Beloro@Sun.COM translate_devid(dev_info_t *dip)
401*11596SJason.Beloro@Sun.COM {
402*11596SJason.Beloro@Sun.COM }
403