/*
* 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 <ctype.h>
#include <errno.h>
#include <kstat.h>
#include <limits.h>
#include <strings.h>
#include <unistd.h>
#include <zone.h>
#include <topo_error.h>
#include <fm/topo_mod.h>
#include <topo_method.h>
#include <topo_subr.h>
#include <mem.h>
/*
* platform specific mem module
*/
/*
* Flags for mem_fmri_str2nvl
*/
topo_instance_t, void *, void *);
nvlist_t **);
{ NULL }
};
{ mem_enum, mem_release };
int
{
if (version != MEM_VERSION)
return (-1); /* mod errno already set */
}
return (0);
}
void
{
}
/*ARGSUSED*/
static int
{
PLATFORM_MEM_VERSION)) == NULL) {
/*
* There is no platform specific mem module.
*/
return (0);
} else {
/* Fail to load the module */
return (-1);
}
}
return (-1);
}
return (0);
}
static void
{
}
/*
* Convert an input string to a URI escaped string and return the new string.
* RFC2396 Section 2.4 says that data must be escaped if it does not have a
* representation using an unreserved character, where an unreserved character
* is one that is either alphanumeric or one of the marks defined in S2.3.
*/
static size_t
{
const char *p;
char c, *q;
size_t n = 0;
if (s == NULL)
s = empty_str;
for (p = s; (c = *p) != '\0'; p++) {
n++; /* represent c as itself */
else
n += 3; /* represent c as escape */
}
return (n);
*q++ = c;
} else {
*q++ = '%';
}
}
q--; /* len is too small: truncate output string */
*q = '\0';
return (n);
}
/*ARGSUSED*/
static int
{
const char *format;
int err;
int i;
}
/*
* If we have a DIMM offset, include it in the string. If we have a
* PA then use that. Otherwise just format the unum element.
*/
FM_FMRI_MEM_OFFSET "=%3$llx";
FM_FMRI_MEM_PHYSADDR "=%3$llx";
} else
/*
* If we have a well-formed unum we step over the hc:// and
* authority prefix
*/
unum += 5;
++unum;
prefix = "";
} else {
for (i = 0; i < presz - 1; i++) {
presz - (i + 2));
} else if (preunum[i] == ' ') {
preunum[i] = ',';
}
}
}
}
if (err != 0) {
}
return (0);
}
/*ARGSUSED*/
static int
{
if (version > TOPO_METH_STR2NVL_VERSION)
/* We're expecting a string version of a mem scheme FMRI. */
"%s: bad scheme\n", __func__);
}
/* Check that first component is "unum=". */
"%s: no unum\n", __func__);
}
"%s: fmri string to long\n", __func__);
}
/* Skip past "mem:///unum=" part". */
/* Check that there is a unum string. */
"%s: null unum\n", __func__);
}
/*
*/
/* Look for last '/'. */
break;
flags |= MEMFMRI_PA;
errno = 0;
"%s: bad paddr\n", __func__);
return (topo_mod_seterrno(mod,
}
flags |= MEMFMRI_OFFSET;
errno = 0;
"%s: bad offset\n", __func__);
return (topo_mod_seterrno(mod,
}
} else {
"%s: unrecognized component=%s\n",
break;
}
}
if (flags & MEMFMRI_PA) {
}
if (flags & MEMFMRI_OFFSET) {
}
if (err != 0) {
}
return (0);
}