obpsym_1275.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* 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 (c) 1991-1995, 1996, by Sun Microsystems, Inc.
* All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* This module provides kernel callbacks to IEEE 1275-1994 system.
* such that address and name lookups can work and use kernel symbol names.
* For example "ctrace" will provide symbolic names, if they are available.
* Also, normal firmware name to address lookups should work, though be
* careful with clashing kernel names, such as "startup" and "reset" which
* may be the firmware names and *not* the kernel names.
*
* This file contains the glue that gets control from the firmware and
*
* The platform code needs to provide the routines add_vx_handler
* handler for a given callback name.
*/
#include <sys/prom_isa.h>
#define MAX_NAME 128
static void
{
int error = -1;
char *symname;
if (nresults == 0)
return; /* No room for results. Just return. */
/*
* If there are no arguments, fall through and return an error.
* Otherwise, try to translate the symbol name arg to a value.
*/
if (nargs != 0) {
}
/*
* Stuff the results in the argument array and set the
* nresults element to the number of results actually returned
* in the argument array. (It's a maximum of 2).
*
* cif[0]: service name ( Pointer to service name )
* cif[1]: nargs ( number of argument cells)
* cif[2]: nresults ( number of result cells)
* cif[3]: argument{0} ( First argument cell )
* ...
* cif[3 + nargs]: result{0} ( First result cell )
* ...
*/
if (nresults > 1) {
} else {
}
}
static void
{
if (nresults == 0)
return; /* No room for results. Just return. */
/*
* If there are no arguments, fall through and return "not found".
* Otherwise, try to translate the value to a symbol-name/offset.
*/
*name = (char)0;
if (nargs != 0) {
}
/*
* Stuff the results in the argument array and set the
* nresults element to the number of results actually returned
* in the argument array. (It's a maximum of 2).
*
* cif[0]: service name ( Pointer to service name )
* cif[1]: nargs ( number of argument cells)
* cif[2]: nresults ( number of result cells)
* cif[3]: argument{0} ( First argument cell )
* ...
* cif[3 + nargs]: result{0} ( First result cell )
* ...
*/
/*
* Treat this as an integer, so we sign-extend -1, offsets
* are always postive, -1 indicates not found.
*/
if (nresults > 1) {
} else {
}
}
void
{
/*
* This code assumes a wrapper for the callbacks,
* though not all implementations will need them,
* they should be easy enough to provide. It might
* be better to provide these as 2 macros set by each
* platform, this assumes there's a single handler.
*/
(void) prom_set_symbol_lookup((void *)callback_handler,
(void *)callback_handler);
}
int
install_callbacks(void)
{
void add_vx_handler(char *, int, void (*f)(cell_t *));
return (0);
}
void
remove_callbacks(void)
{
void remove_vx_handler(char *);
(void) prom_set_symbol_lookup((void *)0, (void *)0);
remove_vx_handler("sym-to-value");
remove_vx_handler("value-to-sym");
}