/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* This file contains ddi functions common to sparc implementations
*/
#include <sys/dditypes.h>
#include <sys/ddi_impldefs.h>
/*
* DDI Mapping
*/
/*
* Enable DDI_MAP_DEBUG for map debugging messages...
* (c.f. rootnex.c)
* #define DDI_MAP_DEBUG
*/
#ifdef DDI_MAP_DEBUG
#endif /* DDI_MAP_DEBUG */
/*
* i_ddi_bus_map:
* Generic bus_map entry point, for byte addressable devices
* to be programmed at this level.
*/
int
{
int error;
/*
* First, if given an rnumber, convert it to a regspec...
*/
#ifdef DDI_MAP_DEBUG
static char *out_of_range =
"i_ddi_bus_map: Out of range rnumber <%d>, device <%s>";
#endif /* DDI_MAP_DEBUG */
#ifdef DDI_MAP_DEBUG
ddi_get_name(rdip));
#endif /* DDI_MAP_DEBUG */
return (DDI_ME_RNUMBER_RANGE);
}
/*
* Convert the given ddi_map_req_t from rnumber to regspec...
*/
}
/*
* Adjust offset and length correspnding to called values.
* A non-zero length means override the one in the regspec,
* regardless of what's in the parent's range.
*/
if (len != 0)
/*
* If we had an MMU, this is where you'd program the MMU and hat layer.
* Since we're using the default function here, we do not have an MMU
* to program.
*/
/*
* Apply any parent ranges at this level, if applicable.
* (This is where nexus specific regspec translation takes place.
* Use of this function is implicit agreement that translation is
* provided via ddi_apply_range.) Note that we assume that
* the request is within the parents limits.
*/
#ifdef DDI_MAP_DEBUG
ddi_map_debug("applying range of parent <%s> to child <%s>...\n",
#endif /* DDI_MAP_DEBUG */
return (error);
/*
* Call my parents bus_map function with modified values...
*/
}
/*
* i_ddi_map_fault: wrapper for bus_map_fault.
*/
int
{
return (DDI_FAILURE);
/* request appropriate parent to map fault */
}
/*
* Creating register mappings and handling interrupts:
*/
struct regspec *
{
return ((struct regspec *)0);
}
/*
* Static function to determine if a reg prop is enclosed within
* a given a range spec. (For readability: only used by i_ddi_aply_range.).
*/
static int
{
return (0);
return (0);
return (1); /* size is really 2**(bits_per_word) */
return (1);
return (0);
}
/*
* i_ddi_apply_range:
* Apply range of dp to struct regspec *rp, if applicable.
* If there's any range defined, it gets applied.
*/
int
{
int nrange, b;
static char out_of_range[] =
"Out of range register specification from device node <%s>";
if (nrange == 0) {
#ifdef DDI_MAP_DEBUG
ddi_map_debug(" No range.\n");
#endif /* DDI_MAP_DEBUG */
return (0);
}
/*
* Find a match, making sure the regspec is within the range
* of the parent, noting that a size of zero in a range spec
* really means a size of 2**(bitsperword).
*/
break; /* found a match */
if (b == nrange) {
return (DDI_ME_REGSPEC_RANGE);
}
#ifdef DDI_MAP_DEBUG
ddi_map_debug(" Range: %x.%x %x.%x %x\n",
#endif /* DDI_MAP_DEBUG */
#ifdef DDI_MAP_DEBUG
#endif /* DDI_MAP_DEBUG */
return (0);
}
/*
* Return an integer in native machine format from an OBP 1275 integer
* representation, which is big-endian, with no particular alignment
* guarantees. intp points to the OBP data, and n the number of bytes.
*/
int
{
int i = 0;
ASSERT(n > 0 && n <= 4);
while (n-- > 0) {
i = (i << 8) | *intp++;
}
return (i);
}